devicetree: DT_NODE_HAS_COMPAT_STATUS_OKAY -> DT_NODE_HAS_COMPAT_STATUS
Swap this out and make the status a parameter. Leave a couple of cases of DT_NODE_HAS_COMPAT(). Signed-off-by: Kumar Gala <kumar.gala@linaro.org> Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
6f35d3bd16
commit
c2135f8721
17 changed files with 33 additions and 30 deletions
|
@ -122,7 +122,7 @@ static int frdm_k64f_pinmux_init(struct device *dev)
|
|||
pinmux_pin_set(portb, 10, PORT_PCR_MUX(kPORT_PinDisabledOrAnalog));
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay)
|
||||
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
#endif
|
||||
|
|
|
@ -33,7 +33,7 @@ static int frdm_k82f_pinmux_init(struct device *dev)
|
|||
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay)
|
||||
/* Red, green, blue LEDs as PWM channels */
|
||||
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
|
|
|
@ -30,7 +30,7 @@ static int hexiwear_k64_pinmux_init(struct device *dev)
|
|||
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay)
|
||||
/* Red, green, blue LEDs as PWM channels */
|
||||
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
|
|
|
@ -23,7 +23,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
|
|||
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT1_NAME);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm0), nxp_lpc_usart, okay)
|
||||
/* USART0 RX, TX */
|
||||
const u32_t port0_pin0_config = (
|
||||
IOCON_PIO_FUNC1 |
|
||||
|
@ -107,7 +107,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
|
|||
pinmux_pin_set(port1, 10, port1_pin10_config);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_i2c, okay)
|
||||
/* PORT0 PIN25 is configured as FC4_RTS_SCL_SSEL1 */
|
||||
pinmux_pin_set(port0, 25, IOCON_PIO_FUNC1 |
|
||||
IOCON_PIO_I2CSLEW_I2C |
|
||||
|
@ -127,7 +127,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
|
|||
IOCON_PIO_I2CFILTER_EN);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm5), nxp_lpc_spi)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm5), nxp_lpc_spi, okay)
|
||||
/* PORT0 PIN18 is configured as FC5_TXD_SCL_MISO */
|
||||
pinmux_pin_set(port0, 18, IOCON_PIO_FUNC1 |
|
||||
IOCON_PIO_MODE_PULLUP |
|
||||
|
|
|
@ -95,7 +95,7 @@ static int lpcxpresso_55s16_pinmux_init(struct device *dev)
|
|||
pinmux_pin_set(port1, DT_GPIO_PIN(DT_ALIAS(led2), gpios), led2_config);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm0), nxp_lpc_usart, okay)
|
||||
/* USART0 RX, TX */
|
||||
const u32_t port0_pin29_config = (
|
||||
IOCON_PIO_FUNC1 |
|
||||
|
@ -117,7 +117,7 @@ static int lpcxpresso_55s16_pinmux_init(struct device *dev)
|
|||
pinmux_pin_set(port0, 30, port0_pin30_config);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_i2c, okay)
|
||||
/* PORT1 PIN20 is configured as FC4_TXD_SCL_MISO_WS */
|
||||
pinmux_pin_set(port1, 20, IOCON_PIO_FUNC5 |
|
||||
IOCON_PIO_MODE_INACT |
|
||||
|
|
|
@ -23,7 +23,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
|
|||
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT1_NAME);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm0), nxp_lpc_usart, okay)
|
||||
/* USART0 RX, TX */
|
||||
const u32_t port0_pin29_config = (
|
||||
IOCON_PIO_FUNC1 |
|
||||
|
@ -88,7 +88,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
|
|||
pinmux_pin_set(port1, DT_GPIO_PIN(DT_ALIAS(sw2), gpios), sw2_config);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_i2c, okay)
|
||||
/* PORT1 PIN20 is configured as FC4_TXD_SCL_MISO_WS */
|
||||
pinmux_pin_set(port1, 20, IOCON_PIO_FUNC5 |
|
||||
IOCON_PIO_MODE_INACT |
|
||||
|
|
|
@ -34,7 +34,7 @@ static int twr_ke18f_pinmux_init(struct device *dev)
|
|||
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm0), nxp_kinetis_ftm_pwm)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm0), nxp_kinetis_ftm_pwm, okay)
|
||||
/* Tri-color LED as PWM */
|
||||
pinmux_pin_set(portb, 5, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
pinmux_pin_set(portd, 15, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
|
@ -46,7 +46,7 @@ static int twr_ke18f_pinmux_init(struct device *dev)
|
|||
pinmux_pin_set(portd, 16, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay)
|
||||
/* User LEDs as PWM */
|
||||
pinmux_pin_set(portc, 10, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
pinmux_pin_set(portc, 11, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
|
|
|
@ -20,8 +20,8 @@ LOG_MODULE_DECLARE(can_driver, CONFIG_CAN_LOG_LEVEL);
|
|||
|
||||
#define CAN_INIT_TIMEOUT (10 * sys_clock_hw_cycles_per_sec() / MSEC_PER_SEC)
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can1), st_stm32_can) && \
|
||||
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can2), st_stm32_can)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(can1), st_stm32_can, okay) && \
|
||||
DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(can2), st_stm32_can, okay)
|
||||
#error Simultaneous use of CAN_1 and CAN_2 not supported yet
|
||||
#endif
|
||||
|
||||
|
@ -1045,7 +1045,7 @@ static const struct can_driver_api can_api_funcs = {
|
|||
.register_state_change_isr = can_stm32_register_state_change_isr
|
||||
};
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can1), st_stm32_can)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(can1), st_stm32_can, okay)
|
||||
|
||||
static void config_can_1_irq(CAN_TypeDef *can);
|
||||
|
||||
|
@ -1134,7 +1134,7 @@ NET_DEVICE_INIT(socket_can_stm32_1, SOCKET_CAN_NAME_1, socket_can_init_1,
|
|||
|
||||
#endif /* DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can1)) */
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can2), st_stm32_can)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(can2), st_stm32_can, okay)
|
||||
|
||||
static void config_can_2_irq(CAN_TypeDef *can);
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(uart_stm32);
|
||||
|
||||
#define HAS_LPUART_1 (DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(lpuart1), \
|
||||
st_stm32_lpuart))
|
||||
#define HAS_LPUART_1 (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart1), \
|
||||
st_stm32_lpuart, okay))
|
||||
|
||||
/* convenience defines */
|
||||
#define DEV_CFG(dev) \
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
MEMORY
|
||||
{
|
||||
#ifdef CONFIG_XIP
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_CHOSEN(zephyr_flash), soc_nv_flash)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_CHOSEN(zephyr_flash), soc_nv_flash, okay)
|
||||
#define ROM_BASE DT_REG_ADDR(DT_CHOSEN(zephyr_flash))
|
||||
#define ROM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_flash))
|
||||
#elif DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_CHOSEN(zephyr_flash), jedec_spi_nor)
|
||||
#elif DT_NODE_HAS_COMPAT_STATUS(DT_CHOSEN(zephyr_flash), jedec_spi_nor, okay)
|
||||
/* For jedec,spi-nor we expect the spi controller to memory map the flash
|
||||
* and for that mapping to be the second register property of the spi
|
||||
* controller.
|
||||
|
|
|
@ -995,8 +995,8 @@
|
|||
*
|
||||
* Example usages which evaluate to 1:
|
||||
*
|
||||
* DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(n), vnd_specific_device)
|
||||
* DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(n), generic_device)
|
||||
* DT_NODE_HAS_COMPAT(DT_NODELABEL(n), vnd_specific_device)
|
||||
* DT_NODE_HAS_COMPAT(DT_NODELABEL(n), generic_device)
|
||||
*
|
||||
* This macro only uses the value of the compatible property. Whether
|
||||
* or not a particular compatible has a matching binding has no effect
|
||||
|
@ -1007,9 +1007,12 @@
|
|||
* @return 1 if the node's compatible property contains compat,
|
||||
* 0 otherwise.
|
||||
*/
|
||||
#define DT_NODE_HAS_COMPAT_STATUS_OKAY(node_id, compat) \
|
||||
#define DT_NODE_HAS_COMPAT(node_id, compat) \
|
||||
IS_ENABLED(DT_CAT(node_id, _COMPAT_MATCHES_##compat))
|
||||
|
||||
#define DT_NODE_HAS_COMPAT_STATUS(node_id, compat, status) \
|
||||
DT_NODE_HAS_COMPAT(node_id, compat) && DT_NODE_HAS_STATUS(node_id, status)
|
||||
|
||||
/**
|
||||
* @brief Does a devicetree node have a property?
|
||||
*
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
/* Use to check if a sercom 'n' is enabled for a given 'compat' */
|
||||
#define ATMEL_SAM0_DT_SERCOM_CHECK(n, compat) \
|
||||
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(sercom##n), compat)
|
||||
DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(sercom##n), compat, okay)
|
||||
|
||||
/* Common macro for use to set HCLK_FREQ_HZ */
|
||||
#define ATMEL_SAM0_DT_CPU_CLK_FREQ_HZ \
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
* @param addr_if_no_match MDK address to return otherwise
|
||||
*/
|
||||
#define NODE_ADDRESS(lbl, compat, addr_if_match, addr_if_no_match) \
|
||||
COND_CODE_1(DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(lbl), compat), \
|
||||
COND_CODE_1(DT_NODE_HAS_COMPAT(DT_NODELABEL(lbl), compat), \
|
||||
(addr_if_match), (addr_if_no_match))
|
||||
|
||||
#define CHECK_SPI_REG(lbl, num) \
|
||||
|
|
|
@ -67,7 +67,7 @@ static ALWAYS_INLINE void clock_init(void)
|
|||
/* Attach 12 MHz clock to FLEXCOMM0 */
|
||||
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0);
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_i2c, okay)
|
||||
/* attach 12 MHz clock to FLEXCOMM4 */
|
||||
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4);
|
||||
|
||||
|
@ -75,7 +75,7 @@ static ALWAYS_INLINE void clock_init(void)
|
|||
RESET_PeripheralReset(kFC4_RST_SHIFT_RSTn);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm5), nxp_lpc_spi)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm5), nxp_lpc_spi, okay)
|
||||
/* Attach 12 MHz clock to FLEXCOMM5 */
|
||||
CLOCK_AttachClk(kFRO_HF_to_FLEXCOMM5);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ static ALWAYS_INLINE void clock_init(void)
|
|||
/* Enables the clock for the I/O controller.: Enable Clock. */
|
||||
CLOCK_EnableClock(kCLOCK_Iocon);
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_i2c, okay)
|
||||
/* attach 12 MHz clock to FLEXCOMM4 */
|
||||
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
interrupt-parent = <&test_intc>;
|
||||
|
||||
test_arrays: array-holder {
|
||||
/* vnd,undefined-compat is for DT_NODE_HAS_COMPAT_STATUS_OKAY() */
|
||||
/* vnd,undefined-compat is for DT_NODE_HAS_COMPAT_STATUS(..,okay) */
|
||||
compatible = "vnd,array-holder", "vnd,undefined-compat";
|
||||
a = <1000 2000 3000>;
|
||||
b = [aa bb cc dd];
|
||||
|
|
|
@ -181,7 +181,7 @@ static void test_has_nodelabel(void)
|
|||
"TEST_NODELABEL_ALLCAPS");
|
||||
}
|
||||
|
||||
#define TA_HAS_COMPAT(compat) DT_NODE_HAS_COMPAT_STATUS_OKAY(TEST_ARRAYS, compat)
|
||||
#define TA_HAS_COMPAT(compat) DT_NODE_HAS_COMPAT(TEST_ARRAYS, compat)
|
||||
|
||||
static void test_has_compat(void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue