From 11532e5e4ab8762a8415dc26f109a42fb01ab4b7 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 10 Sep 2024 09:42:45 -0400 Subject: [PATCH 1/8] [nrf fromtree] soc: snps: move init code from SYS_INIT to hooks Replace SYS_INIT with SoC hooks and adapt SoC init code Signed-off-by: Anas Nashif (cherry picked from commit 49f7204530528d5efd15a1ab1a6fddce2d8a509c) --- soc/snps/arc_iot/Kconfig | 1 + soc/snps/arc_iot/soc.c | 11 ++--------- soc/snps/emsk/Kconfig | 4 ++++ soc/snps/emsk/soc_config.c | 6 +----- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/soc/snps/arc_iot/Kconfig b/soc/snps/arc_iot/Kconfig index 362d2d1ae71..0ea361d2325 100644 --- a/soc/snps/arc_iot/Kconfig +++ b/soc/snps/arc_iot/Kconfig @@ -6,3 +6,4 @@ config SOC_ARC_IOT select ARC select CPU_HAS_MPU select CPU_HAS_FPU + select SOC_EARLY_INIT_HOOK diff --git a/soc/snps/arc_iot/soc.c b/soc/snps/arc_iot/soc.c index 832c6df5f51..d42ed3f9d9c 100644 --- a/soc/snps/arc_iot/soc.c +++ b/soc/snps/arc_iot/soc.c @@ -15,14 +15,7 @@ #define CPU_FREQ DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency) -static int arc_iot_init(void) +void soc_early_init_hook(void) { - - if (arc_iot_pll_fout_config(CPU_FREQ / 1000000) < 0) { - return -1; - } - - return 0; + arc_iot_pll_fout_config(CPU_FREQ / 1000000); } - -SYS_INIT(arc_iot_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); diff --git a/soc/snps/emsk/Kconfig b/soc/snps/emsk/Kconfig index 88cdfe70671..014d5357f0a 100644 --- a/soc/snps/emsk/Kconfig +++ b/soc/snps/emsk/Kconfig @@ -4,12 +4,16 @@ config SOC_EMSK select ARC + select SOC_EARLY_INIT_HOOK config SOC_EMSK_EM7D select CPU_HAS_MPU + select SOC_EARLY_INIT_HOOK config SOC_EMSK_EM9D select CPU_HAS_FPU + select SOC_EARLY_INIT_HOOK config SOC_EMSK_EM11D select CPU_HAS_FPU + select SOC_EARLY_INIT_HOOK diff --git a/soc/snps/emsk/soc_config.c b/soc/snps/emsk/soc_config.c index adca19b683c..c43942facb0 100644 --- a/soc/snps/emsk/soc_config.c +++ b/soc/snps/emsk/soc_config.c @@ -11,7 +11,7 @@ #ifdef CONFIG_UART_NS16550 -static int uart_ns16550_init(void) +void soc_early_init_hook(void) { /* On ARC EM Starter kit board, @@ -25,10 +25,6 @@ static int uart_ns16550_init(void) sys_write32(0, DT_REG_ADDR(DT_INST(1, ns16550))+0x4); sys_write32(0, DT_REG_ADDR(DT_INST(1, ns16550))+0x10); #endif /* DT_NODE_HAS_STATUS(DT_INST(1, ns16550), okay) */ - - return 0; } -SYS_INIT(uart_ns16550_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); - #endif /* CONFIG_UART_NS16550 */ From 6dfc5786e3e70bc6d3e752aefe2634fef82457e4 Mon Sep 17 00:00:00 2001 From: Jiafei Pan Date: Mon, 26 Aug 2024 19:12:31 +0800 Subject: [PATCH 2/8] [nrf fromtree] soc: imx8m: change RDC configuration based on device tree Can disable RDC configuration if RDC node is disabled. Signed-off-by: Jiafei Pan (cherry picked from commit bd03883744d49598dbb6755632e25469159906cc) --- soc/nxp/imx/imx8m/a53/soc.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/soc/nxp/imx/imx8m/a53/soc.c b/soc/nxp/imx/imx8m/a53/soc.c index 002b884daa0..c5eaa312370 100644 --- a/soc/nxp/imx/imx8m/a53/soc.c +++ b/soc/nxp/imx/imx8m/a53/soc.c @@ -12,40 +12,50 @@ #include #include +#if DT_NODE_HAS_STATUS(DT_NODELABEL(rdc), okay) + +#define rdc_inst ((RDC_Type *)DT_REG_ADDR(DT_NODELABEL(rdc))) + /* set RDC permission for peripherals */ static void soc_rdc_init(void) { rdc_domain_assignment_t assignment = {0}; rdc_periph_access_config_t periphConfig; - RDC_Init(RDC); + RDC_Init(rdc_inst); assignment.domainId = A53_DOMAIN_ID; - RDC_SetMasterDomainAssignment(RDC, kRDC_Master_A53, &assignment); + RDC_SetMasterDomainAssignment(rdc_inst, kRDC_Master_A53, &assignment); RDC_GetDefaultPeriphAccessConfig(&periphConfig); #if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart2), rdc) periphConfig.periph = kRDC_Periph_UART2; periphConfig.policy = RDC_DT_VAL(uart2); - RDC_SetPeriphAccessConfig(RDC, &periphConfig); + RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig); #endif #if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart4), rdc) periphConfig.periph = kRDC_Periph_UART4; periphConfig.policy = RDC_DT_VAL(uart4); - RDC_SetPeriphAccessConfig(RDC, &periphConfig); + RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig); #endif #if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(enet), rdc) periphConfig.periph = kRDC_Periph_ENET1; periphConfig.policy = RDC_DT_VAL(enet); - RDC_SetPeriphAccessConfig(RDC, &periphConfig); + RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig); #endif } +#else + +#define soc_rdc_init() do { } while (false) + +#endif static int soc_init(void) { soc_rdc_init(); + return 0; } From 540b83426e750c430fc85db3cd4a69d901d247aa Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 10 Sep 2024 09:42:40 -0400 Subject: [PATCH 3/8] [nrf fromtree] soc: nxp: move init code from SYS_INIT to hooks Replace SYS_INIT with SoC hooks and adapt SoC init code Signed-off-by: Anas Nashif (cherry picked from commit f519f00f1665d75c3a5bdcff9e396c8158fbac45) --- soc/nxp/imx/imx6sx/Kconfig | 1 + soc/nxp/imx/imx6sx/soc.c | 6 +----- soc/nxp/imx/imx7d/Kconfig | 1 + soc/nxp/imx/imx7d/soc.c | 6 +----- soc/nxp/imx/imx8m/Kconfig | 5 +++++ soc/nxp/imx/imx8m/a53/soc.c | 6 +----- soc/nxp/imx/imx8m/m4_mini/soc.c | 6 +----- soc/nxp/imx/imx8m/m4_quad/soc.c | 6 +----- soc/nxp/imx/imx8m/m7/soc.c | 6 +----- soc/nxp/imxrt/imxrt10xx/Kconfig | 3 ++- soc/nxp/imxrt/imxrt10xx/lpm_rt1064.c | 6 +----- soc/nxp/imxrt/imxrt10xx/power.c | 7 +------ soc/nxp/imxrt/imxrt10xx/soc.c | 18 ++++++++++-------- soc/nxp/imxrt/imxrt118x/Kconfig | 1 + soc/nxp/imxrt/imxrt118x/soc.c | 6 +----- soc/nxp/imxrt/imxrt5xx/Kconfig | 1 + soc/nxp/imxrt/imxrt5xx/cm33/power.c | 7 +------ soc/nxp/imxrt/imxrt5xx/cm33/soc.c | 12 ++++++------ soc/nxp/imxrt/imxrt6xx/Kconfig | 1 + soc/nxp/imxrt/imxrt6xx/cm33/soc.c | 8 +------- soc/nxp/kinetis/k2x/Kconfig | 1 + soc/nxp/kinetis/k2x/soc.c | 6 +----- soc/nxp/kinetis/k6x/Kconfig | 1 + soc/nxp/kinetis/k6x/soc.c | 7 +------ soc/nxp/kinetis/k8x/Kconfig | 1 + soc/nxp/kinetis/k8x/soc.c | 6 +----- soc/nxp/kinetis/ke1xf/Kconfig | 1 + soc/nxp/kinetis/ke1xf/soc.c | 6 +----- soc/nxp/kinetis/ke1xz/Kconfig | 1 + soc/nxp/kinetis/ke1xz/soc.c | 6 +----- soc/nxp/kinetis/kl2x/Kconfig | 1 + soc/nxp/kinetis/kl2x/soc.c | 6 +----- soc/nxp/kinetis/kv5x/Kconfig | 1 + soc/nxp/kinetis/kv5x/soc.c | 6 +----- soc/nxp/kinetis/kwx/Kconfig | 1 + soc/nxp/kinetis/kwx/soc_kw2xd.c | 6 +----- soc/nxp/kinetis/kwx/soc_kw4xz.c | 6 +----- soc/nxp/lpc/lpc51u68/Kconfig | 1 + soc/nxp/lpc/lpc51u68/soc.c | 8 +------- soc/nxp/mcx/mcxc/Kconfig | 1 + soc/nxp/mcx/mcxc/soc.c | 5 +---- soc/nxp/rw/Kconfig | 1 + soc/nxp/rw/power.c | 6 +----- soc/nxp/rw/soc.c | 12 +++++------- soc/nxp/s32/s32k1/Kconfig | 1 + soc/nxp/s32/s32k1/soc.c | 6 +----- soc/nxp/s32/s32k3/Kconfig | 1 + soc/nxp/s32/s32k3/soc.c | 6 +----- soc/nxp/s32/s32ze/Kconfig | 1 + soc/nxp/s32/s32ze/soc.c | 6 +----- 50 files changed, 73 insertions(+), 158 deletions(-) diff --git a/soc/nxp/imx/imx6sx/Kconfig b/soc/nxp/imx/imx6sx/Kconfig index 901b2c90a64..f83d462be4c 100644 --- a/soc/nxp/imx/imx6sx/Kconfig +++ b/soc/nxp/imx/imx6sx/Kconfig @@ -9,6 +9,7 @@ config SOC_SERIES_IMX6SX select CPU_HAS_FPU select CPU_HAS_ARM_MPU select CLOCK_CONTROL + select SOC_EARLY_INIT_HOOK config SOC_MCIMX6X_M4 select HAS_IMX_HAL diff --git a/soc/nxp/imx/imx6sx/soc.c b/soc/nxp/imx/imx6sx/soc.c index a968e5d5cb1..11cbac10002 100644 --- a/soc/nxp/imx/imx6sx/soc.c +++ b/soc/nxp/imx/imx6sx/soc.c @@ -287,7 +287,7 @@ static void SOC_ClockInit(void) * * @return 0 */ -static int mcimx6x_m4_init(void) +void soc_early_init_hook(void) { /* Configure RDC */ SOC_RdcInit(); @@ -300,8 +300,4 @@ static int mcimx6x_m4_init(void) /* Initialize clock */ SOC_ClockInit(); - - return 0; } - -SYS_INIT(mcimx6x_m4_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/imx/imx7d/Kconfig b/soc/nxp/imx/imx7d/Kconfig index fbebe524242..1aa97734285 100644 --- a/soc/nxp/imx/imx7d/Kconfig +++ b/soc/nxp/imx/imx7d/Kconfig @@ -8,6 +8,7 @@ config SOC_SERIES_IMX7D select CLOCK_CONTROL select CPU_HAS_FPU select CPU_HAS_ARM_MPU + select SOC_EARLY_INIT_HOOK config SOC_MCIMX7D_M4 select HAS_IMX_HAL diff --git a/soc/nxp/imx/imx7d/soc.c b/soc/nxp/imx/imx7d/soc.c index 5ebf3ec0738..df3ee95f2e1 100644 --- a/soc/nxp/imx/imx7d/soc.c +++ b/soc/nxp/imx/imx7d/soc.c @@ -222,7 +222,7 @@ static void nxp_mcimx7_mu_config(void) } #endif /* CONFIG_IPM_IMX */ -static int nxp_mcimx7_init(void) +void soc_early_init_hook(void) { /* SoC specific RDC settings */ @@ -250,8 +250,4 @@ static int nxp_mcimx7_init(void) #ifdef CONFIG_IPM_IMX nxp_mcimx7_mu_config(); #endif /* CONFIG_IPM_IMX */ - - return 0; } - -SYS_INIT(nxp_mcimx7_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/imx/imx8m/Kconfig b/soc/nxp/imx/imx8m/Kconfig index fe206de1527..a1344a8c38e 100644 --- a/soc/nxp/imx/imx8m/Kconfig +++ b/soc/nxp/imx/imx8m/Kconfig @@ -10,6 +10,7 @@ config SOC_MIMX8MM6_A53 select HAS_MCUX_IOMUXC if PINCTRL select HAS_MCUX_RDC select HAS_MCUX_CACHE + select SOC_PREP_HOOK config SOC_MIMX8MM6_M4 select ARM @@ -21,6 +22,7 @@ config SOC_MIMX8MM6_M4 select HAS_MCUX_RDC select HAS_MCUX_IGPIO select HAS_MCUX_IOMUXC + select SOC_EARLY_INIT_HOOK config SOC_MIMX8ML8_A53 select ARM64 @@ -31,6 +33,7 @@ config SOC_MIMX8ML8_A53 select HAS_MCUX_IOMUXC if PINCTRL select HAS_MCUX_RDC select HAS_MCUX_CACHE + select SOC_PREP_HOOK config SOC_MIMX8MN6_A53 select ARM64 @@ -41,6 +44,7 @@ config SOC_MIMX8MN6_A53 select HAS_MCUX_IOMUXC if PINCTRL select HAS_MCUX_RDC select HAS_MCUX_CACHE + select SOC_PREP_HOOK config SOC_MIMX8ML8_ADSP select XTENSA @@ -71,6 +75,7 @@ config SOC_MIMX8ML8_M7 select ARM_MPU select HAS_MCUX_IGPIO select HAS_MCUX_IOMUXC + select SOC_EARLY_INIT_HOOK config SOC_MIMX8MQ6_M4 select ARM diff --git a/soc/nxp/imx/imx8m/a53/soc.c b/soc/nxp/imx/imx8m/a53/soc.c index c5eaa312370..a20ae395f18 100644 --- a/soc/nxp/imx/imx8m/a53/soc.c +++ b/soc/nxp/imx/imx8m/a53/soc.c @@ -52,11 +52,7 @@ static void soc_rdc_init(void) #endif -static int soc_init(void) +void soc_prep_hook(void) { soc_rdc_init(); - - return 0; } - -SYS_INIT(soc_init, EARLY, 1); diff --git a/soc/nxp/imx/imx8m/m4_mini/soc.c b/soc/nxp/imx/imx8m/m4_mini/soc.c index fab49d98bff..784c39fcc04 100644 --- a/soc/nxp/imx/imx8m/m4_mini/soc.c +++ b/soc/nxp/imx/imx8m/m4_mini/soc.c @@ -148,7 +148,7 @@ static void SOC_ClockInit(void) CLOCK_EnableClock(kCLOCK_Sec_Debug); } -static int nxp_mimx8mm6_init(void) +void soc_early_init_hook(void) { /* SoC specific RDC settings */ @@ -156,8 +156,4 @@ static int nxp_mimx8mm6_init(void) /* SoC specific Clock settings */ SOC_ClockInit(); - - return 0; } - -SYS_INIT(nxp_mimx8mm6_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/imx/imx8m/m4_quad/soc.c b/soc/nxp/imx/imx8m/m4_quad/soc.c index e2849f62fe4..031121bc424 100644 --- a/soc/nxp/imx/imx8m/m4_quad/soc.c +++ b/soc/nxp/imx/imx8m/m4_quad/soc.c @@ -111,7 +111,7 @@ static void SOC_ClockInit(void) CLOCK_EnableClock(kCLOCK_Sec_Debug); } -static int nxp_mimx8mq6_init(void) +void soc_early_init_hook(void) { /* SoC specific RDC settings */ @@ -119,8 +119,4 @@ static int nxp_mimx8mq6_init(void) /* SoC specific Clock settings */ SOC_ClockInit(); - - return 0; } - -SYS_INIT(nxp_mimx8mq6_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/imx/imx8m/m7/soc.c b/soc/nxp/imx/imx8m/m7/soc.c index 724368eac37..683d550b149 100644 --- a/soc/nxp/imx/imx8m/m7/soc.c +++ b/soc/nxp/imx/imx8m/m7/soc.c @@ -203,7 +203,7 @@ static void gpio_init(void) #endif } -static int nxp_mimx8ml8_init(void) +void soc_early_init_hook(void) { /* SoC specific RDC settings */ @@ -213,8 +213,4 @@ static int nxp_mimx8ml8_init(void) SOC_ClockInit(); gpio_init(); - - return 0; } - -SYS_INIT(nxp_mimx8ml8_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/imxrt/imxrt10xx/Kconfig b/soc/nxp/imxrt/imxrt10xx/Kconfig index 05eb7b5e8ac..c86f946aab8 100644 --- a/soc/nxp/imxrt/imxrt10xx/Kconfig +++ b/soc/nxp/imxrt/imxrt10xx/Kconfig @@ -6,7 +6,6 @@ config SOC_SERIES_IMXRT10XX select CPU_CORTEX_M_HAS_DWT select CPU_HAS_ICACHE select CPU_HAS_DCACHE - select SOC_RESET_HOOK select CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS select ARM select CLOCK_CONTROL @@ -29,6 +28,8 @@ config SOC_SERIES_IMXRT10XX select HAS_MCUX_USB_EHCI select HAS_SWO select HAS_PM + select SOC_RESET_HOOK + select SOC_EARLY_INIT_HOOK config SOC_MIMXRT1011 select CPU_HAS_FPU diff --git a/soc/nxp/imxrt/imxrt10xx/lpm_rt1064.c b/soc/nxp/imxrt/imxrt10xx/lpm_rt1064.c index c7cc46d0307..ad850f138f9 100644 --- a/soc/nxp/imxrt/imxrt10xx/lpm_rt1064.c +++ b/soc/nxp/imxrt/imxrt10xx/lpm_rt1064.c @@ -339,7 +339,7 @@ void clock_lpm_init(void) XTALOSC24M->OSC_CONFIG1 = tmp_reg; } -static int imxrt_lpm_init(void) +void imxrt_lpm_init(void) { struct clock_callbacks callbacks; @@ -464,8 +464,4 @@ static int imxrt_lpm_init(void) /* Install LPM callbacks */ imxrt_clock_pm_callbacks_register(&callbacks); - return 0; } - - -SYS_INIT(imxrt_lpm_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/imxrt/imxrt10xx/power.c b/soc/nxp/imxrt/imxrt10xx/power.c index fac3180c0db..5936b70e02a 100644 --- a/soc/nxp/imxrt/imxrt10xx/power.c +++ b/soc/nxp/imxrt/imxrt10xx/power.c @@ -240,7 +240,7 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) } /* Initialize power system */ -static int rt10xx_power_init(void) +void rt10xx_power_init(void) { dcdc_internal_regulator_config_t reg_config; @@ -268,9 +268,4 @@ static int rt10xx_power_init(void) /* Enable high gate drive on power FETs to reduce leakage current */ PMU_CoreEnableIncreaseGateDrive(PMU, true); - - - return 0; } - -SYS_INIT(rt10xx_power_init, PRE_KERNEL_2, 0); diff --git a/soc/nxp/imxrt/imxrt10xx/soc.c b/soc/nxp/imxrt/imxrt10xx/soc.c index 9b197163567..d8a11dafd34 100644 --- a/soc/nxp/imxrt/imxrt10xx/soc.c +++ b/soc/nxp/imxrt/imxrt10xx/soc.c @@ -332,25 +332,29 @@ void imxrt_audio_codec_pll_init(uint32_t clock_name, uint32_t clk_src, } #endif +extern void rt10xx_power_init(void); +extern void imxrt_lpm_init(void); + /** * * @brief Perform basic hardware initialization * * Initialize the interrupt controller device drivers. * Also initialize the timer device driver, if required. - * - * @return 0 */ - -static int imxrt_init(void) +void soc_early_init_hook(void) { sys_cache_instr_enable(); sys_cache_data_enable(); /* Initialize system clock */ clock_init(); - - return 0; +#ifdef CONFIG_PM +#ifdef CONFIG_SOC_MIMXRT1064 + imxrt_lpm_init(); +#endif + rt10xx_power_init(); +#endif } #ifdef CONFIG_SOC_RESET_HOOK @@ -365,5 +369,3 @@ void soc_reset_hook(void) #endif } #endif - -SYS_INIT(imxrt_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/imxrt/imxrt118x/Kconfig b/soc/nxp/imxrt/imxrt118x/Kconfig index 10c8180c300..8dc3afe19f9 100644 --- a/soc/nxp/imxrt/imxrt118x/Kconfig +++ b/soc/nxp/imxrt/imxrt118x/Kconfig @@ -21,6 +21,7 @@ config SOC_SERIES_IMXRT118X select HAS_MCUX_IOMUXC select HAS_SWO select HAS_MCUX_FLEXSPI + select SOC_EARLY_INIT_HOOK config SOC_MIMXRT1189_CM33 select CPU_CORTEX_M33 diff --git a/soc/nxp/imxrt/imxrt118x/soc.c b/soc/nxp/imxrt/imxrt118x/soc.c index 2576c858b9e..85299643de7 100644 --- a/soc/nxp/imxrt/imxrt118x/soc.c +++ b/soc/nxp/imxrt/imxrt118x/soc.c @@ -394,7 +394,7 @@ static ALWAYS_INLINE void trdc_enable_all_access(void) * @return 0 */ -static int imxrt_init(void) +void soc_early_init_hook(void) { /* Initialize system clock */ clock_init(); @@ -409,8 +409,6 @@ static int imxrt_init(void) #endif __ISB(); __DSB(); - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -419,5 +417,3 @@ void soc_reset_hook(void) SystemInit(); } #endif - -SYS_INIT(imxrt_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/imxrt/imxrt5xx/Kconfig b/soc/nxp/imxrt/imxrt5xx/Kconfig index dcaf50b03b1..81ccd78df6e 100644 --- a/soc/nxp/imxrt/imxrt5xx/Kconfig +++ b/soc/nxp/imxrt/imxrt5xx/Kconfig @@ -31,6 +31,7 @@ config SOC_MIMXRT595S_CM33 select HAS_MCUX_USDHC2 select HAS_MCUX_USB_LPCIP3511 select HAS_MCUX_CTIMER + select SOC_EARLY_INIT_HOOK config SOC_MIMXRT595S_F1 select XTENSA diff --git a/soc/nxp/imxrt/imxrt5xx/cm33/power.c b/soc/nxp/imxrt/imxrt5xx/cm33/power.c index 3599dcfa646..30911cbb22d 100644 --- a/soc/nxp/imxrt/imxrt5xx/cm33/power.c +++ b/soc/nxp/imxrt/imxrt5xx/cm33/power.c @@ -61,10 +61,8 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) } /* Initialize power system */ -static int rt5xx_power_init(void) +void rt5xx_power_init(void) { - int ret = 0; - /* This function is called to set vddcore low voltage detection * falling trip voltage, this is not impacting the voltage in anyway. */ @@ -75,7 +73,4 @@ static int rt5xx_power_init(void) POWER_UpdatePmicRecoveryTime(1); #endif - return ret; } - -SYS_INIT(rt5xx_power_init, PRE_KERNEL_2, 0); diff --git a/soc/nxp/imxrt/imxrt5xx/cm33/soc.c b/soc/nxp/imxrt/imxrt5xx/cm33/soc.c index c10b404ed48..f4371511e4e 100644 --- a/soc/nxp/imxrt/imxrt5xx/cm33/soc.c +++ b/soc/nxp/imxrt/imxrt5xx/cm33/soc.c @@ -511,16 +511,16 @@ void __weak imxrt_deinit_display_interface(void) #endif +extern void rt5xx_power_init(void); + /** * * @brief Perform basic hardware initialization * * Initialize the interrupt controller device drivers. * Also initialize the timer device driver, if required. - * - * @return 0 */ -static int nxp_rt500_init(void) +void soc_early_init_hook(void) { /* Initialize clocks with tool generated code */ rt5xx_clock_init(); @@ -536,8 +536,8 @@ static int nxp_rt500_init(void) IOPCTL->PIO[1][15] = 0; IOPCTL->PIO[3][28] = 0; IOPCTL->PIO[3][29] = 0; +#ifdef CONFIG_PM + rt5xx_power_init(); +#endif - return 0; } - -SYS_INIT(nxp_rt500_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/imxrt/imxrt6xx/Kconfig b/soc/nxp/imxrt/imxrt6xx/Kconfig index b68855292e3..831b8b1b1ab 100644 --- a/soc/nxp/imxrt/imxrt6xx/Kconfig +++ b/soc/nxp/imxrt/imxrt6xx/Kconfig @@ -30,6 +30,7 @@ config SOC_MIMXRT685S_CM33 select INIT_SYS_PLL select HAS_MCUX_USB_LPCIP3511 select HAS_MCUX_CTIMER + select SOC_EARLY_INIT_HOOK if SOC_SERIES_IMXRT6XX diff --git a/soc/nxp/imxrt/imxrt6xx/cm33/soc.c b/soc/nxp/imxrt/imxrt6xx/cm33/soc.c index d829558754e..9071a20bd68 100644 --- a/soc/nxp/imxrt/imxrt6xx/cm33/soc.c +++ b/soc/nxp/imxrt/imxrt6xx/cm33/soc.c @@ -360,11 +360,9 @@ void imxrt_usdhc_dat3_pull(bool pullup) * * Initialize the interrupt controller device drivers. * Also initialize the timer device driver, if required. - * - * @return 0 */ -static int nxp_rt600_init(void) +void soc_early_init_hook(void) { /* Initialize clock */ clock_init(); @@ -372,8 +370,6 @@ static int nxp_rt600_init(void) #ifndef CONFIG_IMXRT6XX_CODE_CACHE CACHE64_DisableCache(CACHE64); #endif - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -400,5 +396,3 @@ void soc_reset_hook(void) } #endif - -SYS_INIT(nxp_rt600_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/kinetis/k2x/Kconfig b/soc/nxp/kinetis/k2x/Kconfig index cf61f57132b..f89d6c86b4c 100644 --- a/soc/nxp/kinetis/k2x/Kconfig +++ b/soc/nxp/kinetis/k2x/Kconfig @@ -14,6 +14,7 @@ config SOC_SERIES_KINETIS_K2X select CPU_CORTEX_M_HAS_DWT select CLOCK_CONTROL select SOC_RESET_HOOK + select SOC_EARLY_INIT_HOOK config SOC_MK22F51212 select HAS_MCUX diff --git a/soc/nxp/kinetis/k2x/soc.c b/soc/nxp/kinetis/k2x/soc.c index 82aecf9b687..e89526f5556 100644 --- a/soc/nxp/kinetis/k2x/soc.c +++ b/soc/nxp/kinetis/k2x/soc.c @@ -118,15 +118,13 @@ static ALWAYS_INLINE void clock_init(void) * @return 0 */ -static int fsl_frdm_k22f_init(void) +void soc_early_init_hook(void) { /* release I/O power hold to allow normal run state */ PMC->REGSC |= PMC_REGSC_ACKISO_MASK; /* Initialize PLL/system clock to 120 MHz */ clock_init(); - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -137,5 +135,3 @@ void soc_reset_hook(void) } #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(fsl_frdm_k22f_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/kinetis/k6x/Kconfig b/soc/nxp/kinetis/k6x/Kconfig index 5ec9c9acf21..af342ae30ca 100644 --- a/soc/nxp/kinetis/k6x/Kconfig +++ b/soc/nxp/kinetis/k6x/Kconfig @@ -11,6 +11,7 @@ config SOC_SERIES_KINETIS_K6X select HAS_MCUX_PIT select CLOCK_CONTROL select SOC_RESET_HOOK + select SOC_EARLY_INIT_HOOK config SOC_MK64F12 select HAS_MCUX diff --git a/soc/nxp/kinetis/k6x/soc.c b/soc/nxp/kinetis/k6x/soc.c index 41708af7954..c8eb6ba7870 100644 --- a/soc/nxp/kinetis/k6x/soc.c +++ b/soc/nxp/kinetis/k6x/soc.c @@ -124,10 +124,9 @@ static ALWAYS_INLINE void clock_init(void) * Initialize the interrupt controller device drivers. * Also initialize the timer device driver, if required. * - * @return 0 */ -static int k6x_init(void) +void soc_early_init_hook(void) { #if !defined(CONFIG_ARM_MPU) uint32_t temp_reg; @@ -162,8 +161,6 @@ static int k6x_init(void) #endif /* Initialize PLL/system clock up to 180 MHz */ clock_init(); - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -174,5 +171,3 @@ void soc_reset_hook(void) } #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(k6x_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/kinetis/k8x/Kconfig b/soc/nxp/kinetis/k8x/Kconfig index 649300c3dba..bf30d20797e 100644 --- a/soc/nxp/kinetis/k8x/Kconfig +++ b/soc/nxp/kinetis/k8x/Kconfig @@ -27,6 +27,7 @@ config SOC_SERIES_KINETIS_K8X select HAS_MCUX_RCM select HAS_MCUX_CACHE select SOC_RESET_HOOK + select SOC_EARLY_INIT_HOOK if SOC_SERIES_KINETIS_K8X diff --git a/soc/nxp/kinetis/k8x/soc.c b/soc/nxp/kinetis/k8x/soc.c index 19d6f2df341..d338ad72a96 100644 --- a/soc/nxp/kinetis/k8x/soc.c +++ b/soc/nxp/kinetis/k8x/soc.c @@ -92,7 +92,7 @@ static ALWAYS_INLINE void clk_init(void) #endif } -static int k8x_init(void) +void soc_early_init_hook(void) { #if !defined(CONFIG_ARM_MPU) uint32_t temp_reg; @@ -116,8 +116,6 @@ static int k8x_init(void) /* Initialize system clocks and PLL */ clk_init(); - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -128,5 +126,3 @@ void soc_reset_hook(void) } #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(k8x_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/kinetis/ke1xf/Kconfig b/soc/nxp/kinetis/ke1xf/Kconfig index a89888edaad..b3cf86dd935 100644 --- a/soc/nxp/kinetis/ke1xf/Kconfig +++ b/soc/nxp/kinetis/ke1xf/Kconfig @@ -30,6 +30,7 @@ config SOC_SERIES_KINETIS_KE1XF select HAS_MCUX_PWT select HAS_MCUX_RCM select SOC_RESET_HOOK + select SOC_EARLY_INIT_HOOK select HAS_PM config SOC_MKE16F16 diff --git a/soc/nxp/kinetis/ke1xf/soc.c b/soc/nxp/kinetis/ke1xf/soc.c index 7ada4249dfa..5d3e2291fe6 100644 --- a/soc/nxp/kinetis/ke1xf/soc.c +++ b/soc/nxp/kinetis/ke1xf/soc.c @@ -237,7 +237,7 @@ static ALWAYS_INLINE void clk_init(void) #endif } -static int ke1xf_init(void) +void soc_early_init_hook(void) { #if !defined(CONFIG_ARM_MPU) @@ -264,8 +264,6 @@ static int ke1xf_init(void) /* SystemInit will have enabled the code cache. Disable it here */ L1CACHE_DisableCodeCache(); #endif - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -314,5 +312,3 @@ void soc_reset_hook(void) } #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(ke1xf_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/kinetis/ke1xz/Kconfig b/soc/nxp/kinetis/ke1xz/Kconfig index 2563a220041..f8e878cb13a 100644 --- a/soc/nxp/kinetis/ke1xz/Kconfig +++ b/soc/nxp/kinetis/ke1xz/Kconfig @@ -13,3 +13,4 @@ config SOC_SERIES_KE1XZ select HAS_MCUX select HAS_PM select SOC_RESET_HOOK + select SOC_EARLY_INIT_HOOK diff --git a/soc/nxp/kinetis/ke1xz/soc.c b/soc/nxp/kinetis/ke1xz/soc.c index 38521bccc85..5a6b443c1fe 100644 --- a/soc/nxp/kinetis/ke1xz/soc.c +++ b/soc/nxp/kinetis/ke1xz/soc.c @@ -144,13 +144,11 @@ static ALWAYS_INLINE void clk_init(void) #endif } -static int ke1xz_init(void) +void soc_early_init_hook(void) { /* Initialize system clocks and PLL */ clk_init(); - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -162,5 +160,3 @@ void soc_reset_hook(void) } #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(ke1xz_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/kinetis/kl2x/Kconfig b/soc/nxp/kinetis/kl2x/Kconfig index c2e5255e00a..e545c2a6800 100644 --- a/soc/nxp/kinetis/kl2x/Kconfig +++ b/soc/nxp/kinetis/kl2x/Kconfig @@ -10,6 +10,7 @@ config SOC_SERIES_KINETIS_KL2X select CPU_CORTEX_M_HAS_VTOR select CLOCK_CONTROL select SOC_RESET_HOOK + select SOC_EARLY_INIT_HOOK config SOC_MKL25Z4 select CPU_CORTEX_M0PLUS diff --git a/soc/nxp/kinetis/kl2x/soc.c b/soc/nxp/kinetis/kl2x/soc.c index 9a525b2632c..71fe3d35a35 100644 --- a/soc/nxp/kinetis/kl2x/soc.c +++ b/soc/nxp/kinetis/kl2x/soc.c @@ -79,12 +79,10 @@ static ALWAYS_INLINE void clock_init(void) #endif } -static int kl2x_init(void) +void soc_early_init_hook(void) { /* Initialize system clock to 48 MHz */ clock_init(); - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -95,5 +93,3 @@ void soc_reset_hook(void) } #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(kl2x_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/kinetis/kv5x/Kconfig b/soc/nxp/kinetis/kv5x/Kconfig index 6c9cd6f34ef..d4d977ce212 100644 --- a/soc/nxp/kinetis/kv5x/Kconfig +++ b/soc/nxp/kinetis/kv5x/Kconfig @@ -22,3 +22,4 @@ config SOC_SERIES_KINETIS_KV5X select HAS_MCG select HAS_MCUX_RCM select SOC_RESET_HOOK + select SOC_EARLY_INIT_HOOK diff --git a/soc/nxp/kinetis/kv5x/soc.c b/soc/nxp/kinetis/kv5x/soc.c index 91c4823e4e2..cd5d4048c42 100644 --- a/soc/nxp/kinetis/kv5x/soc.c +++ b/soc/nxp/kinetis/kv5x/soc.c @@ -78,7 +78,7 @@ static ALWAYS_INLINE void clk_init(void) CLOCK_SetSimConfig(&sim_config); } -static int kv5x_init(void) +void soc_early_init_hook(void) { /* release I/O power hold to allow normal run state */ PMC->REGSC |= PMC_REGSC_ACKISO_MASK; @@ -93,8 +93,6 @@ static int kv5x_init(void) sys_cache_instr_enable(); sys_cache_data_enable(); - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -105,5 +103,3 @@ void soc_reset_hook(void) } #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(kv5x_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/kinetis/kwx/Kconfig b/soc/nxp/kinetis/kwx/Kconfig index 49a9f78c04b..150de248d4e 100644 --- a/soc/nxp/kinetis/kwx/Kconfig +++ b/soc/nxp/kinetis/kwx/Kconfig @@ -9,6 +9,7 @@ config SOC_SERIES_KINETIS_KWX select CPU_CORTEX_M_HAS_VTOR select CLOCK_CONTROL select SOC_RESET_HOOK + select SOC_EARLY_INIT_HOOK config SOC_MKW22D5 select CPU_CORTEX_M4 diff --git a/soc/nxp/kinetis/kwx/soc_kw2xd.c b/soc/nxp/kinetis/kwx/soc_kw2xd.c index 95e5a955acc..c2fcddfa6ed 100644 --- a/soc/nxp/kinetis/kwx/soc_kw2xd.c +++ b/soc/nxp/kinetis/kwx/soc_kw2xd.c @@ -147,15 +147,13 @@ static ALWAYS_INLINE void clock_init(void) * * @return 0 */ -static int kw2xd_init(void) +void soc_early_init_hook(void) { /* release I/O power hold to allow normal run state */ PMC->REGSC |= PMC_REGSC_ACKISO_MASK; /* Initialize PLL/system clock to 48 MHz */ clock_init(); - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -166,5 +164,3 @@ void soc_reset_hook(void) } #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(kw2xd_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/kinetis/kwx/soc_kw4xz.c b/soc/nxp/kinetis/kwx/soc_kw4xz.c index a14fe28c165..4e33f4df5b8 100644 --- a/soc/nxp/kinetis/kwx/soc_kw4xz.c +++ b/soc/nxp/kinetis/kwx/soc_kw4xz.c @@ -79,12 +79,10 @@ static ALWAYS_INLINE void clock_init(void) #endif } -static int kwx_init(void) +void soc_early_init_hook(void) { /* Initialize system clock to 40 MHz */ clock_init(); - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -95,5 +93,3 @@ void soc_reset_hook(void) } #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(kwx_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/lpc/lpc51u68/Kconfig b/soc/nxp/lpc/lpc51u68/Kconfig index 8a2436d1237..37c8231d7f6 100644 --- a/soc/nxp/lpc/lpc51u68/Kconfig +++ b/soc/nxp/lpc/lpc51u68/Kconfig @@ -16,6 +16,7 @@ config SOC_SERIES_LPC51U68 select CPU_CORTEX_M_HAS_SYSTICK select CPU_CORTEX_M_HAS_VTOR select SOC_RESET_HOOK + select SOC_EARLY_INIT_HOOK config SOC_LPC51U68 select CLOCK_CONTROL diff --git a/soc/nxp/lpc/lpc51u68/soc.c b/soc/nxp/lpc/lpc51u68/soc.c index b38b601baaa..fd8f23800b3 100644 --- a/soc/nxp/lpc/lpc51u68/soc.c +++ b/soc/nxp/lpc/lpc51u68/soc.c @@ -11,7 +11,7 @@ #include #include -int soc_init(void) +void soc_early_init_hook(void) { POWER_DisablePD(kPDRUNCFG_PD_FRO_EN); CLOCK_SetupFROClocking(12000000U); @@ -42,17 +42,11 @@ int soc_init(void) POWER_DisablePD(kPDRUNCFG_PD_VD7_ENA); POWER_DisablePD(kPDRUNCFG_PD_VREFP_SW); POWER_DisablePD(kPDRUNCFG_PD_TEMPS); - - return 0; } #ifdef CONFIG_SOC_RESET_HOOK - void soc_reset_hook(void) { SystemInit(); } - #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(soc_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/mcx/mcxc/Kconfig b/soc/nxp/mcx/mcxc/Kconfig index 02ed4233bc0..ff49d66ae65 100644 --- a/soc/nxp/mcx/mcxc/Kconfig +++ b/soc/nxp/mcx/mcxc/Kconfig @@ -16,6 +16,7 @@ config SOC_SERIES_MCXC select HAS_MCUX_LPUART select HAS_MCUX_LPI2C select HAS_MCUX_TPM + select SOC_EARLY_INIT_HOOK if SOC_SERIES_MCXC diff --git a/soc/nxp/mcx/mcxc/soc.c b/soc/nxp/mcx/mcxc/soc.c index a6d0d8bd9fd..00001999a49 100644 --- a/soc/nxp/mcx/mcxc/soc.c +++ b/soc/nxp/mcx/mcxc/soc.c @@ -93,10 +93,9 @@ static void clock_init(void) #endif } -static int mcxc_init(void) +void soc_early_init_hook(void) { clock_init(); - return 0; } #ifdef CONFIG_SOC_RESET_HOOK @@ -107,5 +106,3 @@ void soc_reset_hook(void) } #endif /* CONFIG_SOC_RESET_HOOK */ - -SYS_INIT(mcxc_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/rw/Kconfig b/soc/nxp/rw/Kconfig index e67d0013721..272d7073bfa 100644 --- a/soc/nxp/rw/Kconfig +++ b/soc/nxp/rw/Kconfig @@ -17,6 +17,7 @@ config SOC_SERIES_RW6XX select HAS_MCUX_FLEXCOMM select HAS_MCUX_CACHE select HAS_PM + select SOC_EARLY_INIT_HOOK if SOC_SERIES_RW6XX diff --git a/soc/nxp/rw/power.c b/soc/nxp/rw/power.c index 2979d48ff5b..1f0255a388f 100644 --- a/soc/nxp/rw/power.c +++ b/soc/nxp/rw/power.c @@ -109,7 +109,7 @@ __weak void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) __enable_irq(); } -static int nxp_rw6xx_power_init(void) +void nxp_rw6xx_power_init(void) { uint32_t suspend_sleepconfig[5] = DT_PROP_OR(NODE_ID, deep_sleep_config, {}); @@ -142,8 +142,4 @@ static int nxp_rw6xx_power_init(void) IRQ_CONNECT(DT_IRQN(DT_NODELABEL(pin1)), DT_IRQ(DT_NODELABEL(pin1), priority), pin1_isr, NULL, 0); #endif - - return 0; } - -SYS_INIT(nxp_rw6xx_power_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); diff --git a/soc/nxp/rw/soc.c b/soc/nxp/rw/soc.c index 8aa3d6f6dee..1a52626a053 100644 --- a/soc/nxp/rw/soc.c +++ b/soc/nxp/rw/soc.c @@ -268,17 +268,16 @@ __ramfunc void clock_init(void) } +extern void nxp_rw6xx_power_init(void); /** * * @brief Perform basic hardware initialization * * Initialize the interrupt controller device drivers. * Also initialize the timer device driver, if required. - * - * @return 0 */ -static int nxp_rw600_init(void) +void soc_early_init_hook(void) { #if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(wwdt), nxp_lpc_wwdt, okay)) POWER_EnableResetSource(kPOWER_ResetSourceWdt); @@ -305,8 +304,9 @@ static int nxp_rw600_init(void) #if defined(CONFIG_ADC_MCUX_GAU) || defined(CONFIG_DAC_MCUX_GAU) POWER_PowerOnGau(); #endif - - return 0; +#if CONFIG_PM + nxp_rw6xx_power_init(); +#endif } void soc_reset_hook(void) @@ -314,5 +314,3 @@ void soc_reset_hook(void) /* This is provided by the SDK */ SystemInit(); } - -SYS_INIT(nxp_rw600_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/s32/s32k1/Kconfig b/soc/nxp/s32/s32k1/Kconfig index 0883614c82b..2bb3a271904 100644 --- a/soc/nxp/s32/s32k1/Kconfig +++ b/soc/nxp/s32/s32k1/Kconfig @@ -19,6 +19,7 @@ config SOC_SERIES_S32K1 select HAS_MCUX_WDOG32 select HAS_MCUX_RTC select HAS_MCUX_ADC12 + select SOC_EARLY_INIT_HOOK config SOC_S32K116 select CPU_CORTEX_M0PLUS diff --git a/soc/nxp/s32/s32k1/soc.c b/soc/nxp/s32/s32k1/soc.c index 20a27eb13c0..484838cf68c 100644 --- a/soc/nxp/s32/s32k1/soc.c +++ b/soc/nxp/s32/s32k1/soc.c @@ -48,7 +48,7 @@ void z_arm_watchdog_init(void) } #endif /* CONFIG_WDOG_INIT */ -static int soc_init(void) +void soc_early_init_hook(void) { #if !defined(CONFIG_ARM_MPU) uint32_t tmp; @@ -71,8 +71,4 @@ static int soc_init(void) #endif OsIf_Init(NULL); - - return 0; } - -SYS_INIT(soc_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/s32/s32k3/Kconfig b/soc/nxp/s32/s32k3/Kconfig index fdf0bba2687..627898f7231 100644 --- a/soc/nxp/s32/s32k3/Kconfig +++ b/soc/nxp/s32/s32k3/Kconfig @@ -22,6 +22,7 @@ config SOC_SERIES_S32K3 select HAS_MCUX_LPSPI select HAS_MCUX_CACHE select HAS_MCUX_EDMA + select SOC_EARLY_INIT_HOOK if SOC_SERIES_S32K3 diff --git a/soc/nxp/s32/s32k3/soc.c b/soc/nxp/s32/s32k3/soc.c index be822677189..e2ecba3c6fb 100644 --- a/soc/nxp/s32/s32k3/soc.c +++ b/soc/nxp/s32/s32k3/soc.c @@ -49,14 +49,10 @@ const struct ivt ivt_header __attribute__((section(".ivt_header"))) = { }; #endif /* CONFIG_XIP */ -static int soc_init(void) +void soc_early_init_hook(void) { sys_cache_instr_enable(); sys_cache_data_enable(); OsIf_Init(NULL); - - return 0; } - -SYS_INIT(soc_init, PRE_KERNEL_1, 0); diff --git a/soc/nxp/s32/s32ze/Kconfig b/soc/nxp/s32/s32ze/Kconfig index 8c9041a2fe3..9ee9aaa1429 100644 --- a/soc/nxp/s32/s32ze/Kconfig +++ b/soc/nxp/s32/s32ze/Kconfig @@ -18,6 +18,7 @@ config SOC_SERIES_S32ZE select HAS_MCUX_PIT select HAS_MCUX_FLEXCAN select HAS_MCUX_LPI2C + select SOC_EARLY_INIT_HOOK if SOC_SERIES_S32ZE diff --git a/soc/nxp/s32/s32ze/soc.c b/soc/nxp/s32/s32ze/soc.c index 801e0173ae3..da05a2085b7 100644 --- a/soc/nxp/s32/s32ze/soc.c +++ b/soc/nxp/s32/s32ze/soc.c @@ -44,11 +44,7 @@ void soc_reset_hook(void) } } -static int soc_init(void) +void soc_early_init_hook(void) { OsIf_Init(NULL); - - return 0; } - -SYS_INIT(soc_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); From b226d08d3ebf8f89ef903e9eed2a8278eb624f0c Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 6 Aug 2024 11:33:22 -0500 Subject: [PATCH 4/8] [nrf fromtree] drivers: kinetis-pinctrl: Account for SCG K4 Add support for SCG K4 clock control in kinetis pinctrl. Signed-off-by: Declan Snyder (cherry picked from commit 2db9ea94de253398942c8a5aa6b9dc0ddab509e1) --- drivers/pinctrl/pinctrl_kinetis.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/pinctrl_kinetis.c b/drivers/pinctrl/pinctrl_kinetis.c index 13b0c8ac720..7a8151c7be1 100644 --- a/drivers/pinctrl/pinctrl_kinetis.c +++ b/drivers/pinctrl/pinctrl_kinetis.c @@ -76,9 +76,13 @@ static int pinctrl_mcux_init(const struct device *dev) } #if DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_sim), okay) -#define PINCTRL_MCUX_DT_INST_CLOCK_SUBSYS(n) \ - CLK_GATE_DEFINE(DT_INST_CLOCKS_CELL(n, offset), \ - DT_INST_CLOCKS_CELL(n, bits)) +#define PINCTRL_MCUX_DT_INST_CLOCK_SUBSYS(n) \ + CLK_GATE_DEFINE(DT_INST_CLOCKS_CELL(n, offset), DT_INST_CLOCKS_CELL(n, bits)) +#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_scg_k4) +#define PINCTRL_MCUX_DT_INST_CLOCK_SUBSYS(n) \ + (DT_INST_CLOCKS_CELL(n, mrcc_offset) == 0 \ + ? 0 \ + : MAKE_MRCC_REGADDR(MRCC_BASE, DT_INST_CLOCKS_CELL(n, mrcc_offset))) #else #define PINCTRL_MCUX_DT_INST_CLOCK_SUBSYS(n) \ DT_INST_CLOCKS_CELL(n, name) From 761c28583207d70918e6dfafb9ed06932c4b3a39 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Fri, 20 Sep 2024 10:34:24 +0800 Subject: [PATCH 5/8] [nrf fromtree] devicetree: add `DT_NODE_HAS_STATUS_OKAY` We already have `DT_HAS_COMPAT_STATUS_OKAY` and `DT_NUM_INST_STATUS_OKAY`, it seems intuitive to assume that `DT_NODE_HAS_STATUS_OKAY` exists, so much so that it was used before it's implemented. This patch implements `DT_NODE_HAS_STATUS_OKAY`, which is equivalent to: `DT_NODE_HAS_STATUS(, okay)` Added test for it in `tests/lib/devicetree/api` Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin (cherry picked from commit 5aebd1276d68af036c30d544d6ef92f0893b53d7) --- include/zephyr/devicetree.h | 22 ++++++++++++++++++++++ tests/lib/devicetree/api/src/main.c | 11 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index 38c5656079c..eb894a1f9a9 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -3403,6 +3403,28 @@ #define DT_NODE_HAS_STATUS(node_id, status) \ DT_NODE_HAS_STATUS_INTERNAL(node_id, status) +/** + * @brief Does a node identifier refer to a node with a status `okay`? + * + * Example uses: + * + * @code{.c} + * DT_NODE_HAS_STATUS_OKAY(DT_PATH(soc, i2c_12340000)) + * @endcode + * + * Tests whether a node identifier refers to a node which: + * + * - exists in the devicetree, and + * - has a status property as `okay` + * + * As usual, both a missing status and an `ok` status are treated as + * `okay`. + * + * @param node_id a node identifier + * @return 1 if the node has status as `okay`, 0 otherwise. + */ +#define DT_NODE_HAS_STATUS_OKAY(node_id) DT_NODE_HAS_STATUS(node_id, okay) + /** * @brief Does the devicetree have a status `okay` node with a compatible? * diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index 9de03524d8a..aacbc16b404 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -366,6 +366,17 @@ ZTEST(devicetree_api, test_has_status) 0, ""); } +ZTEST(devicetree_api, test_has_status_okay) +{ + zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(test_gpio_1)), 1); + + zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(test_no_status)), 1); + + zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(disabled_gpio)), 0); + + zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(reserved_gpio)), 0); +} + ZTEST(devicetree_api, test_bus) { int pin, flags; From 1bd9d4fdc2f4bb19cc98f4c1bf5c60b4a96b18aa Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Fri, 20 Sep 2024 12:47:40 +0800 Subject: [PATCH 6/8] [nrf fromtree] zephyr: bulk update to DT_NODE_HAS_STATUS_OKAY Change instances of: DT_NODE_HAS_STATUS(, okay) to DT_NODE_HAS_STATUS_OKAY() Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin (cherry picked from commit 52a202309bd383c3c60770ab5e6e6ac4d263f5c4) --- arch/arm/core/cortex_m/fault.c | 2 +- boards/arm/v2m_musca_b1/pinmux.c | 2 +- boards/arm/v2m_musca_s1/pinmux.c | 2 +- boards/digilent/arty_a7/board.c | 4 +- boards/nordic/nrf9160dk/board.c | 4 +- boards/nordic/nrf9160dk/nrf52840_reset.c | 4 +- boards/nxp/frdm_mcxa156/board.c | 22 +-- boards/nxp/frdm_mcxn236/board.c | 36 ++-- boards/nxp/frdm_mcxn947/board.c | 58 +++--- boards/silabs/dev_kits/sltb004a/board.c | 2 +- drivers/adc/adc_gd32.c | 6 +- drivers/audio/dmic_mcux.c | 2 +- drivers/clock_control/clock_control_gd32.c | 2 +- .../clock_control/clock_control_ifx_cat1.c | 174 +++++++++--------- drivers/clock_control/clock_control_litex.h | 2 +- drivers/clock_control/clock_control_max32.c | 12 +- .../clock_control/clock_control_mcux_ccm.c | 14 +- .../clock_control/clock_control_mcux_scg.c | 4 +- .../clock_control/clock_control_mcux_sim.c | 2 +- .../clock_control/clock_control_nrf2_fll16m.c | 2 +- .../clock_control/clock_control_nrf2_lfclk.c | 2 +- .../clock_control/clock_control_renesas_ra.c | 2 +- .../clock_control_renesas_ra_cgc.c | 2 +- .../clock_control/clock_control_smartbond.c | 18 +- drivers/clock_control/clock_stm32_ll_wb0.c | 2 +- drivers/counter/counter_mcux_snvs.c | 4 +- drivers/counter/counter_smartbond_timer.c | 2 +- drivers/disk/sdmmc_stm32.c | 2 +- drivers/dma/dma_mcux_edma.c | 6 +- drivers/dma/dma_stm32.c | 16 +- drivers/dma/dma_stm32_bdma.c | 4 +- drivers/dma/dmamux_stm32.c | 28 +-- drivers/espi/espi_mchp_xec_host_v2.c | 6 +- drivers/ethernet/eth_stm32_hal.c | 4 +- drivers/ethernet/nxp_enet/eth_mcux.c | 10 +- drivers/ethernet/nxp_enet/eth_nxp_enet.c | 2 +- drivers/ethernet/phy/phy_adin2111.c | 2 +- drivers/flash/soc_flash_lpc.c | 4 +- drivers/flash/soc_flash_mcux.c | 12 +- drivers/flash/soc_flash_nrf.c | 8 +- drivers/gpio/gpio_esp32.c | 14 +- drivers/gpio/gpio_gd32.c | 2 +- drivers/gpio/gpio_lpc11u6x.c | 12 +- drivers/gpio/gpio_mchp_xec.c | 24 +-- drivers/gpio/gpio_nrfx.c | 2 +- drivers/gpio/gpio_nxp_s32.c | 8 +- drivers/gpio/gpio_renesas_ra_ioport.c | 2 +- drivers/gpio/gpio_sam0.c | 8 +- drivers/gpio/gpio_stm32.c | 4 +- drivers/gpio/gpio_xlnx_axi.c | 2 +- drivers/i2c/i2c_esp32.c | 8 +- drivers/i2s/i2s_litex.c | 4 +- .../interrupt_controller/intc_mchp_ecia_xec.c | 2 +- drivers/led_strip/lpd880x.c | 2 +- drivers/lora/shell.c | 2 +- drivers/memc/memc_nxp_s32_qspi.c | 2 +- drivers/pinctrl/pinctrl_esp32.c | 4 +- drivers/pinctrl/pinctrl_ite_it8xxx2.c | 2 +- drivers/pinctrl/pinctrl_kinetis.c | 2 +- drivers/rtc/rtc_smartbond.c | 2 +- drivers/sensor/bosch/bmi08x/bmi08x.h | 2 +- drivers/sensor/st/stm32_temp/stm32_temp.c | 4 +- drivers/sensor/st/stm32_vbat/stm32_vbat.c | 2 +- drivers/sensor/st/stm32_vref/stm32_vref.c | 4 +- drivers/serial/leuart_gecko.c | 8 +- drivers/serial/uart_cmsdk_apb.c | 20 +- drivers/serial/uart_lpc11u6x.c | 84 ++++----- drivers/serial/uart_lpc11u6x.h | 16 +- drivers/serial/uart_miv.c | 4 +- drivers/spi/spi_smartbond.c | 4 +- drivers/spi/spi_xec_qmspi.c | 4 +- drivers/timer/mcux_os_timer.c | 10 +- drivers/timer/nrf_grtc_timer.c | 4 +- drivers/timer/smartbond_timer.c | 2 +- drivers/usb/device/usb_dc_mcux.c | 8 +- drivers/usb/device/usb_dc_nrfx.c | 4 +- drivers/usb/udc/udc_nrf.c | 4 +- drivers/watchdog/wdt_esp32.c | 4 +- include/zephyr/device.h | 2 +- .../clock_control/stm32_clock_control.h | 6 +- include/zephyr/drivers/emul.h | 2 +- include/zephyr/linker/linker-defs.h | 9 +- include/zephyr/pm/state.h | 6 +- kernel/init.c | 6 +- kernel/xip.c | 6 +- modules/hal_nordic/nrfx/nrfx_config.h | 2 +- samples/basic/button/src/main.c | 2 +- samples/basic/threads/src/main.c | 4 +- samples/bluetooth/central_otc/src/main.c | 4 +- .../encrypted_advertising/central/src/main.c | 2 +- .../peripheral/src/main.c | 2 +- samples/bluetooth/iso_receive/src/main.c | 2 +- samples/bluetooth/mesh_provisioner/src/main.c | 8 +- samples/bluetooth/periodic_sync/src/main.c | 2 +- samples/bluetooth/peripheral_hids/src/hog.c | 2 +- samples/bluetooth/peripheral_hr/src/main.c | 2 +- .../boards/espressif/deep_sleep/src/main.c | 2 +- .../boards/espressif/light_sleep/src/main.c | 2 +- samples/boards/nordic/battery/src/battery.c | 4 +- .../nxp/mimxrt1060_evk/system_off/src/main.c | 4 +- samples/boards/st/i2c_timing/src/main.c | 2 +- samples/boards/st/mco/src/main.c | 2 +- .../st/power_mgmt/standby_shutdown/src/main.c | 2 +- .../boards/st/power_mgmt/wkup_pins/src/main.c | 2 +- samples/drivers/espi/src/main.c | 10 +- samples/drivers/i2s/echo/src/main.c | 12 +- samples/drivers/lora/receive/src/main.c | 2 +- samples/drivers/lora/send/src/main.c | 2 +- samples/shields/x_nucleo_53l0a1/src/main.c | 2 +- .../subsys/mgmt/osdp/control_panel/src/main.c | 2 +- .../mgmt/osdp/peripheral_device/src/main.c | 2 +- samples/subsys/task_wdt/src/main.c | 2 +- soc/arm/beetle/power.c | 12 +- soc/atmel/sam/common/soc_power.c | 4 +- soc/intel/intel_adsp/common/clk.c | 4 +- .../intel_adsp/common/include/adsp_clk.h | 4 +- soc/intel/intel_adsp/common/mem_window.c | 8 +- soc/ite/ec/it8xxx2/soc.c | 8 +- soc/microchip/mec/common/soc_dt.h | 2 +- soc/microchip/mec/mec172x/device_power.c | 6 +- .../common/nrf54hx_nrf92x_mpu_regions.c | 6 +- soc/nordic/nrf52/soc.c | 2 +- soc/nordic/nrf53/soc.c | 2 +- soc/nordic/nrf54h/soc.c | 2 +- soc/nordic/nrf92/soc.c | 2 +- soc/nordic/validate_enabled_instances.c | 6 +- soc/nxp/imx/imx6sx/soc.c | 86 ++++----- soc/nxp/imx/imx7d/soc.c | 26 +-- soc/nxp/imx/imx8m/a53/soc.c | 8 +- soc/nxp/imx/imx8m/m4_mini/soc.c | 8 +- soc/nxp/imx/imx8m/m4_quad/soc.c | 8 +- soc/nxp/imx/imx8m/m7/soc.c | 24 +-- soc/nxp/imxrt/imxrt10xx/flexspi.c | 2 +- soc/nxp/imxrt/imxrt10xx/soc.c | 24 +-- soc/nxp/imxrt/imxrt118x/soc.c | 36 ++-- soc/nxp/imxrt/imxrt11xx/soc.c | 24 +-- soc/nxp/imxrt/imxrt5xx/cm33/soc.c | 4 +- soc/nxp/imxrt/imxrt6xx/cm33/soc.c | 4 +- soc/nxp/imxrt/imxrt6xx/cm33/soc.h | 4 +- soc/nxp/kinetis/k6x/soc.c | 2 +- soc/nxp/kinetis/ke1xf/soc.c | 32 ++-- soc/nxp/kinetis/ke1xz/soc.c | 18 +- soc/nxp/kinetis/kl2x/soc.c | 2 +- soc/nxp/kinetis/kwx/soc_kw4xz.c | 8 +- soc/nxp/lpc/lpc55xxx/soc.c | 2 +- soc/nxp/mcx/mcxc/soc.c | 2 +- soc/nxp/rw/power.c | 14 +- soc/nxp/rw/soc.c | 10 +- soc/openisa/rv32m1/soc.c | 8 +- soc/renesas/ra/ra4m1/soc.c | 2 +- soc/renesas/smartbond/da1469x/power.c | 2 +- soc/snps/emsk/soc_config.c | 8 +- soc/st/stm32/stm32h7x/mpu_regions.c | 4 +- soc/xlnx/zynq7000/xc7zxxx/soc.c | 8 +- soc/xlnx/zynq7000/xc7zxxxs/soc.c | 8 +- .../nordic/hal/nrf5/radio/radio_nrf5_fem.h | 4 +- subsys/pm/policy.c | 4 +- subsys/tracing/sysview/sysview_config.c | 2 +- subsys/usb/device/usb_device.c | 2 +- .../host/id/mocks/zephyr/linker/linker-defs.h | 4 + tests/drivers/adc/adc_api/src/test_adc.c | 4 +- .../src/test_stm32_clock_configuration_adc.c | 2 +- .../src/test_stm32_clock_configuration_i2c.c | 2 +- .../src/test_stm32_clock_configuration_i2s.c | 2 +- .../test_stm32_clock_configuration_lptim.c | 2 +- .../src/test_stm32_clock_configuration.c | 2 +- tests/drivers/eeprom/api/src/main.c | 4 +- tests/drivers/gpio/gpio_basic_api/src/main.c | 2 +- .../gpio/gpio_basic_api/src/test_gpio.h | 8 +- .../gpio/gpio_reserved_ranges/src/main.c | 12 +- tests/drivers/i2c/i2c_api/src/test_i2c.c | 6 +- tests/drivers/i2c/i2c_ram/src/test_i2c_ram.c | 2 +- tests/drivers/i2c/i2c_tca954x/src/main.c | 4 +- tests/drivers/memc/ram/src/main.c | 24 +-- tests/drivers/pwm/pwm_api/src/test_pwm.c | 8 +- .../drivers/smbus/smbus_api/src/test_smbus.c | 2 +- .../smbus/smbus_api/src/test_smbus_qemu.c | 2 +- .../watchdog/wdt_basic_api/src/test_wdt.c | 4 +- .../watchdog/wdt_basic_reset_none/src/main.c | 2 +- .../watchdog/wdt_error_cases/src/main.c | 4 +- 180 files changed, 743 insertions(+), 738 deletions(-) diff --git a/arch/arm/core/cortex_m/fault.c b/arch/arm/core/cortex_m/fault.c index 4cc01f87129..4e604ba8033 100644 --- a/arch/arm/core/cortex_m/fault.c +++ b/arch/arm/core/cortex_m/fault.c @@ -743,7 +743,7 @@ static inline bool z_arm_is_pc_valid(uintptr_t pc) return true; } -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_itcm)) /* Is it in the ITCM */ if ((((uintptr_t)&__itcm_start) <= pc) && (pc < ((uintptr_t)&__itcm_end))) { return true; diff --git a/boards/arm/v2m_musca_b1/pinmux.c b/boards/arm/v2m_musca_b1/pinmux.c index 443d462eb21..2a2c44d62b9 100644 --- a/boards/arm/v2m_musca_b1/pinmux.c +++ b/boards/arm/v2m_musca_b1/pinmux.c @@ -40,7 +40,7 @@ static void arm_musca_b1_pinmux_defaults(void) scc[IOMUX_ALTF1_OUTSEL] = 0xffff; scc[IOMUX_ALTF1_OENSEL] = 0xffff; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) /* clear bit 0/1 for GPIO0/1 to steer from ALTF1 */ scc[IOMUX_MAIN_INSEL] &= ~(BIT(0) | BIT(1)); scc[IOMUX_MAIN_OUTSEL] &= ~(BIT(0) | BIT(1)); diff --git a/boards/arm/v2m_musca_s1/pinmux.c b/boards/arm/v2m_musca_s1/pinmux.c index a1a1a4ad252..3affa53dadf 100644 --- a/boards/arm/v2m_musca_s1/pinmux.c +++ b/boards/arm/v2m_musca_s1/pinmux.c @@ -40,7 +40,7 @@ static void arm_musca_s1_pinmux_defaults(void) scc[IOMUX_ALTF1_OUTSEL] = 0xffff; scc[IOMUX_ALTF1_OENSEL] = 0xffff; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) /* clear bit 0/1 for GPIO0/1 to steer from ALTF1 */ scc[IOMUX_MAIN_INSEL] &= ~(BIT(0) | BIT(1)); scc[IOMUX_MAIN_OUTSEL] &= ~(BIT(0) | BIT(1)); diff --git a/boards/digilent/arty_a7/board.c b/boards/digilent/arty_a7/board.c index 984cd34ab43..0e087c212b4 100644 --- a/boards/digilent/arty_a7/board.c +++ b/boards/digilent/arty_a7/board.c @@ -16,7 +16,7 @@ LOG_MODULE_REGISTER(board, CONFIG_LOG_DEFAULT_LEVEL); #define DAPLINK_QSPI_MUX_NODE DT_NODELABEL(daplink_qspi_mux) -#if DT_NODE_HAS_STATUS(DAPLINK_QSPI_MUX_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(DAPLINK_QSPI_MUX_NODE) int board_daplink_qspi_mux_select(enum board_daplink_qspi_mux_mode mode) { struct gpio_dt_spec mux = GPIO_DT_SPEC_GET(DAPLINK_QSPI_MUX_NODE, mux_gpios); @@ -77,4 +77,4 @@ static int board_init(void) } SYS_INIT(board_init, POST_KERNEL, CONFIG_BOARD_INIT_PRIORITY); -#endif /* DT_NODE_HAS_STATUS(DAPLINK_QSPI_MUX_NODE, okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DAPLINK_QSPI_MUX_NODE) */ diff --git a/boards/nordic/nrf9160dk/board.c b/boards/nordic/nrf9160dk/board.c index adf137df196..c8e680c4539 100644 --- a/boards/nordic/nrf9160dk/board.c +++ b/boards/nordic/nrf9160dk/board.c @@ -32,7 +32,7 @@ LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_NRF9160DK_LOG_LEVEL); GET_PORT(reset_input, gpios, 0) == 0 && \ GET_PIN(reset_input, gpios, 0) == 18) #define USE_RESET_GPIO \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(reset_input), okay) && \ + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(reset_input)) && \ !RESET_INPUT_IS_PINRESET) struct switch_cfg { @@ -47,7 +47,7 @@ struct switch_cfg { #endif }; -#define ROUTING_ENABLED(_name) DT_NODE_HAS_STATUS(DT_NODELABEL(_name), okay) +#define ROUTING_ENABLED(_name) DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(_name)) #define SWITCH_CFG(_name, _idx) \ { \ .gpio = GET_DEV(_name, control_gpios, _idx), \ diff --git a/boards/nordic/nrf9160dk/nrf52840_reset.c b/boards/nordic/nrf9160dk/nrf52840_reset.c index e639b5765b7..aa9f9d4b620 100644 --- a/boards/nordic/nrf9160dk/nrf52840_reset.c +++ b/boards/nordic/nrf9160dk/nrf52840_reset.c @@ -12,7 +12,7 @@ #define RESET_NODE DT_NODELABEL(nrf52840_reset) -#if DT_NODE_HAS_STATUS(RESET_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(RESET_NODE) #define RESET_GPIO_CTRL DT_GPIO_CTLR(RESET_NODE, gpios) #define RESET_GPIO_PIN DT_GPIO_PIN(RESET_NODE, gpios) @@ -65,4 +65,4 @@ int bt_hci_transport_setup(const struct device *h4) return 0; } -#endif /* DT_NODE_HAS_STATUS(RESET_NODE, okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(RESET_NODE) */ diff --git a/boards/nxp/frdm_mcxa156/board.c b/boards/nxp/frdm_mcxa156/board.c index 98801c47a1a..84347c4715c 100644 --- a/boards/nxp/frdm_mcxa156/board.c +++ b/boards/nxp/frdm_mcxa156/board.c @@ -66,52 +66,52 @@ static int frdm_mcxa156_init(void) CLOCK_SetClockDiv(kCLOCK_DivAHBCLK, 1U); /* !< Set AHBCLKDIV divider to value 1 */ CLOCK_SetClockDiv(kCLOCK_DivFRO_HF_DIV, 1U); /* !< Set FROHFDIV divider to value 1 */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(porta), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(porta)) RESET_ReleasePeripheralReset(kPORT0_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portb), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portb)) RESET_ReleasePeripheralReset(kPORT1_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portc)) RESET_ReleasePeripheralReset(kPORT2_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portd), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portd)) RESET_ReleasePeripheralReset(kPORT3_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(porte), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(porte)) RESET_ReleasePeripheralReset(kPORT4_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) RESET_ReleasePeripheralReset(kGPIO0_RST_SHIFT_RSTn); CLOCK_EnableClock(kCLOCK_GateGPIO0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) RESET_ReleasePeripheralReset(kGPIO1_RST_SHIFT_RSTn); CLOCK_EnableClock(kCLOCK_GateGPIO1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) RESET_ReleasePeripheralReset(kGPIO2_RST_SHIFT_RSTn); CLOCK_EnableClock(kCLOCK_GateGPIO2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) RESET_ReleasePeripheralReset(kGPIO3_RST_SHIFT_RSTn); CLOCK_EnableClock(kCLOCK_GateGPIO3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) RESET_ReleasePeripheralReset(kGPIO4_RST_SHIFT_RSTn); CLOCK_EnableClock(kCLOCK_GateGPIO4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetClockDiv(kCLOCK_DivLPUART0, 1u); CLOCK_AttachClk(kFRO12M_to_LPUART0); #endif diff --git a/boards/nxp/frdm_mcxn236/board.c b/boards/nxp/frdm_mcxn236/board.c index 8f0d1fd7976..fbaf20ccd65 100644 --- a/boards/nxp/frdm_mcxn236/board.c +++ b/boards/nxp/frdm_mcxn236/board.c @@ -88,84 +88,84 @@ static int frdm_mcxn236_init(void) /* Set AHBCLKDIV divider to value 1 */ CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm1)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom1Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm2)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom2Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm3)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom3Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm4)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom4Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm5)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom5Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM5); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(os_timer), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(os_timer)) CLOCK_AttachClk(kCLK_1M_to_OSTIMER); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) CLOCK_EnableClock(kCLOCK_Gpio0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) CLOCK_EnableClock(kCLOCK_Gpio1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) CLOCK_EnableClock(kCLOCK_Gpio2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) CLOCK_EnableClock(kCLOCK_Gpio3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) CLOCK_EnableClock(kCLOCK_Gpio4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio5)) CLOCK_EnableClock(kCLOCK_Gpio5); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(wwdt0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(wwdt0)) CLOCK_SetClkDiv(kCLOCK_DivWdt0Clk, 1u); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer0)) CLOCK_SetClkDiv(kCLOCK_DivCtimer0Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer1)) CLOCK_SetClkDiv(kCLOCK_DivCtimer1Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer2)) CLOCK_SetClkDiv(kCLOCK_DivCtimer2Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer3)) CLOCK_SetClkDiv(kCLOCK_DivCtimer3Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer4)) CLOCK_SetClkDiv(kCLOCK_DivCtimer4Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER4); #endif diff --git a/boards/nxp/frdm_mcxn947/board.c b/boards/nxp/frdm_mcxn947/board.c index 37ec5f4dd6d..db21a4ae194 100644 --- a/boards/nxp/frdm_mcxn947/board.c +++ b/boards/nxp/frdm_mcxn947/board.c @@ -127,7 +127,7 @@ static int frdm_mcxn947_init(void) CLOCK_SetupExtClocking(BOARD_XTAL0_CLK_HZ); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcan0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcan0)) /* Set up PLL1 for 80 MHz FlexCAN clock */ const pll_setup_t pll1Setup = { .pllctrl = SCG_SPLLCTRL_SOURCE(1U) | SCG_SPLLCTRL_SELI(27U) | @@ -146,50 +146,50 @@ static int frdm_mcxn947_init(void) CLOCK_SetClkDiv(kCLOCK_DivPLL1Clk0, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm1)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom1Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm2)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom2Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm4)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom4Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(os_timer), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(os_timer)) CLOCK_AttachClk(kCLK_1M_to_OSTIMER); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) CLOCK_EnableClock(kCLOCK_Gpio0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) CLOCK_EnableClock(kCLOCK_Gpio1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) CLOCK_EnableClock(kCLOCK_Gpio2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) CLOCK_EnableClock(kCLOCK_Gpio3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) CLOCK_EnableClock(kCLOCK_Gpio4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio5)) CLOCK_EnableClock(kCLOCK_Gpio5); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dac0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac0)) SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac0); CLOCK_SetClkDiv(kCLOCK_DivDac0Clk, 1u); CLOCK_AttachClk(kFRO_HF_to_DAC0); @@ -197,7 +197,7 @@ static int frdm_mcxn947_init(void) CLOCK_EnableClock(kCLOCK_Dac0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dac1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac1)) SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac1); CLOCK_SetClkDiv(kCLOCK_DivDac1Clk, 1u); CLOCK_AttachClk(kFRO_HF_to_DAC1); @@ -205,7 +205,7 @@ static int frdm_mcxn947_init(void) CLOCK_EnableClock(kCLOCK_Dac1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) CLOCK_AttachClk(kNONE_to_ENETRMII); CLOCK_EnableClock(kCLOCK_Enet); SYSCON0->PRESETCTRL2 = SYSCON_PRESETCTRL2_ENET_RST_MASK; @@ -214,41 +214,41 @@ static int frdm_mcxn947_init(void) SYSCON->ENET_PHY_INTF_SEL = SYSCON_ENET_PHY_INTF_SEL_PHY_SEL(1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(wwdt0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(wwdt0)) CLOCK_SetClkDiv(kCLOCK_DivWdt0Clk, 1u); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer0)) CLOCK_SetClkDiv(kCLOCK_DivCtimer0Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer1)) CLOCK_SetClkDiv(kCLOCK_DivCtimer1Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer2)) CLOCK_SetClkDiv(kCLOCK_DivCtimer2Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer3)) CLOCK_SetClkDiv(kCLOCK_DivCtimer3Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer4)) CLOCK_SetClkDiv(kCLOCK_DivCtimer4Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcan0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcan0)) CLOCK_SetClkDiv(kCLOCK_DivFlexcan0Clk, 1U); CLOCK_AttachClk(kPLL1_CLK0_to_FLEXCAN0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc0)) CLOCK_SetClkDiv(kCLOCK_DivUSdhcClk, 1u); CLOCK_AttachClk(kFRO_HF_to_USDHC); #endif @@ -260,17 +260,17 @@ static int frdm_mcxn947_init(void) enable_cache64(); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(vref), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(vref)) CLOCK_EnableClock(kCLOCK_Vref); SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlVref); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpadc0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpadc0)) CLOCK_SetClkDiv(kCLOCK_DivAdc0Clk, 1U); CLOCK_AttachClk(kFRO_HF_to_ADC0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI usb_phy_config_struct_t usbPhyConfig = { BOARD_USB_PHY_D_CAL, BOARD_USB_PHY_TXCAL45DP, BOARD_USB_PHY_TXCAL45DM, }; @@ -312,13 +312,13 @@ static int frdm_mcxn947_init(void) USB_EhciPhyInit(kUSB_ControllerEhci0, BOARD_XTAL0_CLK_HZ, &usbPhyConfig); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpcmp0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpcmp0)) CLOCK_SetClkDiv(kCLOCK_DivCmp0FClk, 1U); CLOCK_AttachClk(kFRO12M_to_CMP0F); SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp0 | kSPC_controlCmp0Dac)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptmr0)) /* * Clock Select Decides what input source the lptmr will clock from @@ -340,9 +340,9 @@ static int frdm_mcxn947_init(void) CLOCK_SetupClockCtrl(kCLOCK_CLKIN_ENA_FM_USBH_LPT); #endif /* DT_PROP(DT_NODELABEL(lptmr0), clk_source) */ -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptmr0)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio0)) CLOCK_SetClkDiv(kCLOCK_DivFlexioClk, 1u); CLOCK_AttachClk(kPLL0_to_FLEXIO); #endif diff --git a/boards/silabs/dev_kits/sltb004a/board.c b/boards/silabs/dev_kits/sltb004a/board.c index 43dd2a6b3b2..1b09177ce69 100644 --- a/boards/silabs/dev_kits/sltb004a/board.c +++ b/boards/silabs/dev_kits/sltb004a/board.c @@ -37,7 +37,7 @@ static int efr32mg_sltb004a_init(void) #define CCS811 DT_NODELABEL(ccs811) -#if DT_NODE_HAS_STATUS(CCS811, okay) +#if DT_NODE_HAS_STATUS_OKAY(CCS811) cfg = (struct supply_cfg){ .gpio = DEVICE_DT_GET(DT_GPIO_CTLR(CCS811, supply_gpios)), .pin = DT_GPIO_PIN(CCS811, supply_gpios), diff --git a/drivers/adc/adc_gd32.c b/drivers/adc/adc_gd32.c index 75760de6713..46fbfc783b7 100644 --- a/drivers/adc/adc_gd32.c +++ b/drivers/adc/adc_gd32.c @@ -41,9 +41,9 @@ LOG_MODULE_REGISTER(adc_gd32, CONFIG_ADC_LOG_LEVEL); #define ADC1_NODE DT_NODELABEL(adc1) #define ADC2_NODE DT_NODELABEL(adc2) -#define ADC0_ENABLE DT_NODE_HAS_STATUS(ADC0_NODE, okay) -#define ADC1_ENABLE DT_NODE_HAS_STATUS(ADC1_NODE, okay) -#define ADC2_ENABLE DT_NODE_HAS_STATUS(ADC2_NODE, okay) +#define ADC0_ENABLE DT_NODE_HAS_STATUS_OKAY(ADC0_NODE) +#define ADC1_ENABLE DT_NODE_HAS_STATUS_OKAY(ADC1_NODE) +#define ADC2_ENABLE DT_NODE_HAS_STATUS_OKAY(ADC2_NODE) #ifndef ADC0 /** diff --git a/drivers/audio/dmic_mcux.c b/drivers/audio/dmic_mcux.c index ff357fda9bb..0f032e8368c 100644 --- a/drivers/audio/dmic_mcux.c +++ b/drivers/audio/dmic_mcux.c @@ -686,7 +686,7 @@ static const struct _dmic_ops dmic_ops = { /* Gets pointer for a given PDM channel node */ #define PDM_DMIC_CHAN_GET(pdm_node) \ - COND_CODE_1(DT_NODE_HAS_STATUS(pdm_node, okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(pdm_node), \ (&pdm_channel_##pdm_node), (NULL)), /* Gets array of pointers to PDM channels */ diff --git a/drivers/clock_control/clock_control_gd32.c b/drivers/clock_control/clock_control_gd32.c index 1a20d5e4ab2..52b197e2029 100644 --- a/drivers/clock_control/clock_control_gd32.c +++ b/drivers/clock_control/clock_control_gd32.c @@ -43,7 +43,7 @@ struct clock_control_gd32_config { #if DT_HAS_COMPAT_STATUS_OKAY(gd_gd32_timer) /* timer identifiers */ #define TIMER_ID_OR_NONE(nodelabel) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(nodelabel), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(nodelabel)), \ (DT_CLOCKS_CELL(DT_NODELABEL(nodelabel), id),), ()) static const uint16_t timer_ids[] = { diff --git a/drivers/clock_control/clock_control_ifx_cat1.c b/drivers/clock_control/clock_control_ifx_cat1.c index 1d89ed0fbe0..606e06c4e46 100644 --- a/drivers/clock_control/clock_control_ifx_cat1.c +++ b/drivers/clock_control/clock_control_ifx_cat1.c @@ -18,111 +18,111 @@ /* Enumeration of enabled in device tree Clock, uses for indexing clock info table */ enum { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_imo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) INFINEON_CAT1_CLOCK_IMO, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iho), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) INFINEON_CAT1_CLOCK_IHO, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux0)) INFINEON_CAT1_CLOCK_PATHMUX0, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux1)) INFINEON_CAT1_CLOCK_PATHMUX1, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux2)) INFINEON_CAT1_CLOCK_PATHMUX2, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux3)) INFINEON_CAT1_CLOCK_PATHMUX3, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux4)) INFINEON_CAT1_CLOCK_PATHMUX4, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf0)) INFINEON_CAT1_CLOCK_HF0, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf1)) INFINEON_CAT1_CLOCK_HF1, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf2)) INFINEON_CAT1_CLOCK_HF2, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf3)) INFINEON_CAT1_CLOCK_HF3, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf4)) INFINEON_CAT1_CLOCK_HF4, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf5)) INFINEON_CAT1_CLOCK_HF5, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf6)) INFINEON_CAT1_CLOCK_HF6, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf7)) INFINEON_CAT1_CLOCK_HF7, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf8), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf8)) INFINEON_CAT1_CLOCK_HF8, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf9), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf9)) INFINEON_CAT1_CLOCK_HF9, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf10), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf10)) INFINEON_CAT1_CLOCK_HF10, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf11), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf11)) INFINEON_CAT1_CLOCK_HF11, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf12), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf12)) INFINEON_CAT1_CLOCK_HF12, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf13), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf13)) INFINEON_CAT1_CLOCK_HF13, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_fast), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_fast)) INFINEON_CAT1_CLOCK_FAST, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_slow), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_slow)) INFINEON_CAT1_CLOCK_SLOW, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_peri), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_peri)) INFINEON_CAT1_CLOCK_PERI, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll0)) INFINEON_CAT1_CLOCK_PLL0, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll1)) INFINEON_CAT1_CLOCK_PLL1, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(fll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(fll0)) INFINEON_CAT1_CLOCK_FLL0, #endif @@ -142,111 +142,111 @@ struct infineon_cat1_clock_info_t { static struct infineon_cat1_clock_info_t clock_info_table[INFINEON_CAT1_ENABLED_CLOCK_COUNT] = { /* We always have IMO */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_imo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) [INFINEON_CAT1_CLOCK_IMO] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_imo)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iho), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) [INFINEON_CAT1_CLOCK_IHO] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_iho)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux0)) [INFINEON_CAT1_CLOCK_PATHMUX0] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(path_mux0)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux1)) [INFINEON_CAT1_CLOCK_PATHMUX1] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(path_mux1)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux2)) [INFINEON_CAT1_CLOCK_PATHMUX2] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(path_mux2)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux3)) [INFINEON_CAT1_CLOCK_PATHMUX3] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(path_mux3)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux4)) [INFINEON_CAT1_CLOCK_PATHMUX4] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(path_mux4)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf0)) [INFINEON_CAT1_CLOCK_HF0] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf0)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf1)) [INFINEON_CAT1_CLOCK_HF1] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf1)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf2)) [INFINEON_CAT1_CLOCK_HF2] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf2)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf3)) [INFINEON_CAT1_CLOCK_HF3] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf3)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf4)) [INFINEON_CAT1_CLOCK_HF4] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf4)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf5)) [INFINEON_CAT1_CLOCK_HF5] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf5)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf6)) [INFINEON_CAT1_CLOCK_HF6] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf6)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf7)) [INFINEON_CAT1_CLOCK_HF7] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf7)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf8), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf8)) [INFINEON_CAT1_CLOCK_HF8] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf8)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf9), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf9)) [INFINEON_CAT1_CLOCK_HF9] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf9)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf10), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf10)) [INFINEON_CAT1_CLOCK_HF10] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf10)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf11), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf11)) [INFINEON_CAT1_CLOCK_HF11] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf11)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf12), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf12)) [INFINEON_CAT1_CLOCK_HF12] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf12)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf13), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf13)) [INFINEON_CAT1_CLOCK_HF13] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf13)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_fast), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_fast)) [INFINEON_CAT1_CLOCK_FAST] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_fast)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_slow), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_slow)) [INFINEON_CAT1_CLOCK_SLOW] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_slow)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_peri), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_peri)) [INFINEON_CAT1_CLOCK_PERI] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_peri)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll0)) [INFINEON_CAT1_CLOCK_PLL0] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(pll0)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll1)) [INFINEON_CAT1_CLOCK_PLL1] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(pll1)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(fll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(fll0)) [INFINEON_CAT1_CLOCK_FLL0] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(fll0)) }, #endif }; @@ -326,7 +326,7 @@ static cyhal_clock_t *_get_hal_obj_from_ord(uint32_t dt_ord) return ret_obj; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dpll_hp), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dpll_hp)) __WEAK void cycfg_ClockStartupError(uint32_t error) { (void)error; /* Suppress the compiler warning */ @@ -390,25 +390,25 @@ static int clock_control_infineon_cat1_init(const struct device *dev) uint32 clock_div; /* Configure IMO */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_imo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_IMO].obj; if (cyhal_clock_get(clock_obj, &CYHAL_CLOCK_RSC_IMO)) { return -EIO; } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iho), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_IHO].obj; if (cyhal_clock_get(clock_obj, &CYHAL_CLOCK_RSC_IHO)) { return -EIO; } #endif -#if !DT_NODE_HAS_STATUS(DT_NODELABEL(clk_imo), okay) && \ - !DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iho), okay) +#if !DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) && \ + !DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) #error "IMO clock or IHO clock must be enabled" #endif /* Configure the PathMux[0] to source defined in tree device 'path_mux0' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux0)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PATHMUX0].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(path_mux0)); @@ -418,7 +418,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the PathMux[1] to source defined in tree device 'path_mux1' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux1)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PATHMUX1].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(path_mux1)); @@ -428,7 +428,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the PathMux[2] to source defined in tree device 'path_mux2' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux2)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PATHMUX2].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(path_mux2)); @@ -438,7 +438,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the PathMux[3] to source defined in tree device 'path_mux3' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux3)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PATHMUX3].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(path_mux3)); @@ -448,7 +448,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the PathMux[4] to source defined in tree device 'path_mux4' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux4)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PATHMUX4].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(path_mux4)); @@ -458,7 +458,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure FLL0 */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(fll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(fll0)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_FLL0].obj; frequency = DT_PROP(DT_NODELABEL(fll0), clock_frequency); @@ -470,7 +470,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure PLL0 */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll0)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PLL0].obj; frequency = DT_PROP(DT_NODELABEL(pll0), clock_frequency); @@ -483,7 +483,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure PLL1 */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll1)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PLL1].obj; frequency = DT_PROP(DT_NODELABEL(pll1), clock_frequency); @@ -495,7 +495,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[0] to source defined in tree device 'clk_hf0' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf0)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF0].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf0)); clock_div = DT_PROP(DT_NODELABEL(clk_hf0), clock_div); @@ -506,7 +506,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[1] to source defined in tree device 'clk_hf1' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf1)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF1].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf1)); clock_div = DT_PROP(DT_NODELABEL(clk_hf1), clock_div); @@ -517,7 +517,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[2] to source defined in tree device 'clk_hf2' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf2)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF2].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf2)); clock_div = DT_PROP(DT_NODELABEL(clk_hf2), clock_div); @@ -528,7 +528,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[3] to source defined in tree device 'clk_hf3' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf3)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF3].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf3)); clock_div = DT_PROP(DT_NODELABEL(clk_hf3), clock_div); @@ -539,7 +539,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[4] to source defined in tree device 'clk_hf4' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf4)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF4].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf4)); clock_div = DT_PROP(DT_NODELABEL(clk_hf4), clock_div); @@ -550,7 +550,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[5] to source defined in tree device 'clk_hf5' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf5)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF5].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf5)); clock_div = DT_PROP(DT_NODELABEL(clk_hf5), clock_div); @@ -561,7 +561,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[6] to source defined in tree device 'clk_hf6' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf6)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF6].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf6)); clock_div = DT_PROP(DT_NODELABEL(clk_hf6), clock_div); @@ -572,7 +572,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[7] to source defined in tree device 'clk_hf7' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf7)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF7].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf7)); clock_div = DT_PROP(DT_NODELABEL(clk_hf7), clock_div); @@ -583,7 +583,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[8] to source defined in tree device 'clk_hf8' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf8), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf8)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF8].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf8)); clock_div = DT_PROP(DT_NODELABEL(clk_hf8), clock_div); @@ -594,7 +594,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[9] to source defined in tree device 'clk_hf9' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf9), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf9)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF9].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf9)); clock_div = DT_PROP(DT_NODELABEL(clk_hf9), clock_div); @@ -605,7 +605,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[10] to source defined in tree device 'clk_hf10' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf10), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf10)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF10].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf10)); clock_div = DT_PROP(DT_NODELABEL(clk_hf10), clock_div); @@ -616,7 +616,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[11] to source defined in tree device 'clk_hf11' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf11), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf11)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF11].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf11)); clock_div = DT_PROP(DT_NODELABEL(clk_hf11), clock_div); @@ -627,7 +627,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[12] to source defined in tree device 'clk_hf12' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf12), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf12)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF12].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf12)); clock_div = DT_PROP(DT_NODELABEL(clk_hf12), clock_div); @@ -638,7 +638,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[13] to source defined in tree device 'clk_hf13' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf13), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf13)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF13].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf13)); clock_div = DT_PROP(DT_NODELABEL(clk_hf13), clock_div); @@ -649,7 +649,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the clock fast to source defined in tree device 'clk_fast' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_fast), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_fast)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_FAST].obj; clock_div = DT_PROP(DT_NODELABEL(clk_fast), clock_div); @@ -663,7 +663,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the clock peri to source defined in tree device 'clk_peri' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_peri), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_peri)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PERI].obj; clock_div = DT_PROP(DT_NODELABEL(clk_peri), clock_div); @@ -677,7 +677,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the clock slow to source defined in tree device 'clk_slow' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_slow), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_slow)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_SLOW].obj; clock_div = DT_PROP(DT_NODELABEL(clk_slow), clock_div); @@ -690,7 +690,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dpll_hp), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dpll_hp)) Cy_SysClk_Dpll_Hp0_Init(); SystemCoreClockUpdate(); #endif @@ -713,7 +713,7 @@ static const struct clock_control_driver_api clock_control_infineon_cat1_api = { .off = clock_control_infineon_cat_on_off }; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_imo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) DEVICE_DT_DEFINE(DT_NODELABEL(clk_imo), clock_control_infineon_cat1_init, NULL, @@ -723,7 +723,7 @@ DEVICE_DT_DEFINE(DT_NODELABEL(clk_imo), CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_infineon_cat1_api); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iho), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) DEVICE_DT_DEFINE(DT_NODELABEL(clk_iho), clock_control_infineon_cat1_init, NULL, diff --git a/drivers/clock_control/clock_control_litex.h b/drivers/clock_control/clock_control_litex.h index 14d371c077c..8a1b25de400 100644 --- a/drivers/clock_control/clock_control_litex.h +++ b/drivers/clock_control/clock_control_litex.h @@ -73,7 +73,7 @@ lcko->margin.exp = CLKOUT_MARGIN_EXP(N); /* Devicetree clkout defines */ -#define CLKOUT_EXIST(N) DT_NODE_HAS_STATUS(DT_NODELABEL(clk##N), okay) +#define CLKOUT_EXIST(N) DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk##N)) #define CLKOUT_ID(N) DT_REG_ADDR(DT_NODELABEL(clk##N)) #define CLKOUT_FREQ(N) DT_PROP(DT_NODELABEL(clk##N), \ litex_clock_frequency) diff --git a/drivers/clock_control/clock_control_max32.c b/drivers/clock_control/clock_control_max32.c index 2cbed41bd23..29d7cc2fef4 100644 --- a/drivers/clock_control/clock_control_max32.c +++ b/drivers/clock_control/clock_control_max32.c @@ -106,27 +106,27 @@ static void setup_fixed_clocks(void) MXC_SYS_ClockSourceDisable(ADI_MAX32_CLK_EXTCLK); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_ipo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_ipo)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_IPO); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_erfo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_erfo)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_ERFO); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_ibro), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_ibro)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_IBRO); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iso), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iso)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_ISO); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_inro), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_inro)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_INRO); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_ertco), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_ertco)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_ERTCO); #endif diff --git a/drivers/clock_control/clock_control_mcux_ccm.c b/drivers/clock_control/clock_control_mcux_ccm.c index 8ff09672352..c3b7f2416c4 100644 --- a/drivers/clock_control/clock_control_mcux_ccm.c +++ b/drivers/clock_control/clock_control_mcux_ccm.c @@ -216,14 +216,14 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc1)) && CONFIG_IMX_USDHC case IMX_CCM_USDHC1_CLK: *rate = CLOCK_GetSysPfdFreq(kCLOCK_Pfd0) / (CLOCK_GetDiv(kCLOCK_Usdhc1Div) + 1U); break; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc2), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc2)) && CONFIG_IMX_USDHC case IMX_CCM_USDHC2_CLK: *rate = CLOCK_GetSysPfdFreq(kCLOCK_Pfd0) / (CLOCK_GetDiv(kCLOCK_Usdhc2Div) + 1U); @@ -339,12 +339,12 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, / (CLOCK_GetDiv(kCLOCK_Sai3Div) + 1); break; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexspi), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexspi)) case IMX_CCM_FLEXSPI_CLK: *rate = CLOCK_GetClockRootFreq(kCLOCK_FlexspiClkRoot); break; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexspi2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexspi2)) case IMX_CCM_FLEXSPI2_CLK: *rate = CLOCK_GetClockRootFreq(kCLOCK_Flexspi2ClkRoot); break; @@ -354,7 +354,7 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, *rate = CLOCK_GetFreq(kCLOCK_PerClk); break; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexio1), okay) && CONFIG_MCUX_FLEXIO +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio1)) && CONFIG_MCUX_FLEXIO case IMX_CCM_FLEXIO1_CLK: { uint32_t flexio_mux = CLOCK_GetMux(kCLOCK_Flexio1Mux); @@ -376,8 +376,8 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, / (CLOCK_GetDiv(kCLOCK_Flexio1Div) + 1); } break; #endif -#if (DT_NODE_HAS_STATUS(DT_NODELABEL(flexio2), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(flexio3), okay)) && CONFIG_MCUX_FLEXIO +#if (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio2)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio3))) && CONFIG_MCUX_FLEXIO case IMX_CCM_FLEXIO2_3_CLK: { uint32_t flexio_mux = CLOCK_GetMux(kCLOCK_Flexio2Mux); diff --git a/drivers/clock_control/clock_control_mcux_scg.c b/drivers/clock_control/clock_control_mcux_scg.c index 5642aabe8dd..684cb8f2aa2 100644 --- a/drivers/clock_control/clock_control_mcux_scg.c +++ b/drivers/clock_control/clock_control_mcux_scg.c @@ -125,7 +125,7 @@ static int mcux_scg_get_rate(const struct device *dev, static int mcux_scg_init(const struct device *dev) { -#if DT_NODE_HAS_STATUS(MCUX_SCG_CLOCK_NODE(clkout_clk), okay) +#if DT_NODE_HAS_STATUS_OKAY(MCUX_SCG_CLOCK_NODE(clkout_clk)) #if DT_SAME_NODE(DT_CLOCKS_CTLR(MCUX_SCG_CLOCK_NODE(clkout_clk)), MCUX_SCG_CLOCK_NODE(slow_clk)) CLOCK_SetClkOutSel(kClockClkoutSelScgSlow); #elif DT_SAME_NODE(DT_CLOCKS_CTLR(MCUX_SCG_CLOCK_NODE(clkout_clk)), MCUX_SCG_CLOCK_NODE(sosc_clk)) @@ -139,7 +139,7 @@ static int mcux_scg_init(const struct device *dev) #else #error Unsupported SCG clkout clock source #endif -#endif /* DT_NODE_HAS_STATUS(MCUX_SCG_CLOCK_NODE(clkout_clk), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(MCUX_SCG_CLOCK_NODE(clkout_clk)) */ return 0; } diff --git a/drivers/clock_control/clock_control_mcux_sim.c b/drivers/clock_control/clock_control_mcux_sim.c index 26c9a3c1c2a..2b16e5d6361 100644 --- a/drivers/clock_control/clock_control_mcux_sim.c +++ b/drivers/clock_control/clock_control_mcux_sim.c @@ -67,7 +67,7 @@ static int mcux_sim_get_subsys_rate(const struct device *dev, return 0; } -#if DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_ke1xf_sim), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_kinetis_ke1xf_sim)) #define NXP_KINETIS_SIM_NODE DT_INST(0, nxp_kinetis_ke1xf_sim) #if DT_NODE_HAS_PROP(DT_INST(0, nxp_kinetis_ke1xf_sim), clkout_source) #define NXP_KINETIS_SIM_CLKOUT_SOURCE \ diff --git a/drivers/clock_control/clock_control_nrf2_fll16m.c b/drivers/clock_control/clock_control_nrf2_fll16m.c index 7f3bf0aacee..613e433e527 100644 --- a/drivers/clock_control/clock_control_nrf2_fll16m.c +++ b/drivers/clock_control/clock_control_nrf2_fll16m.c @@ -26,7 +26,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define FLL16M_LFXO_NODE DT_INST_PHANDLE_BY_NAME(0, clocks, lfxo) #define FLL16M_HFXO_NODE DT_INST_PHANDLE_BY_NAME(0, clocks, hfxo) -#define FLL16M_HAS_LFXO DT_NODE_HAS_STATUS(FLL16M_LFXO_NODE, okay) +#define FLL16M_HAS_LFXO DT_NODE_HAS_STATUS_OKAY(FLL16M_LFXO_NODE) #define FLL16M_LFXO_ACCURACY DT_PROP(FLL16M_LFXO_NODE, accuracy_ppm) #define FLL16M_HFXO_ACCURACY DT_PROP(FLL16M_HFXO_NODE, accuracy_ppm) diff --git a/drivers/clock_control/clock_control_nrf2_lfclk.c b/drivers/clock_control/clock_control_nrf2_lfclk.c index 9ce7974570e..36b8e247297 100644 --- a/drivers/clock_control/clock_control_nrf2_lfclk.c +++ b/drivers/clock_control/clock_control_nrf2_lfclk.c @@ -19,7 +19,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define LFCLK_LFXO_NODE DT_INST_PHANDLE_BY_NAME(0, clocks, lfxo) #define LFCLK_HFXO_NODE DT_INST_PHANDLE_BY_NAME(0, clocks, hfxo) -#define LFCLK_HAS_LFXO DT_NODE_HAS_STATUS(LFCLK_LFXO_NODE, okay) +#define LFCLK_HAS_LFXO DT_NODE_HAS_STATUS_OKAY(LFCLK_LFXO_NODE) #define LFCLK_LFLPRC_ACCURACY DT_INST_PROP(0, lflprc_accuracy_ppm) #define LFCLK_LFRC_ACCURACY DT_INST_PROP(0, lfrc_accuracy_ppm) diff --git a/drivers/clock_control/clock_control_renesas_ra.c b/drivers/clock_control/clock_control_renesas_ra.c index 0b058633151..3065c94e785 100644 --- a/drivers/clock_control/clock_control_renesas_ra.c +++ b/drivers/clock_control/clock_control_renesas_ra.c @@ -38,7 +38,7 @@ #define CLKSRC_FREQ(clk) DT_PROP(DT_PATH(clocks, clk), clock_frequency) -#define IS_CLKSRC_ENABLED(clk) DT_NODE_HAS_STATUS(DT_PATH(clocks, clk), okay) +#define IS_CLKSRC_ENABLED(clk) DT_NODE_HAS_STATUS_OKAY(DT_PATH(clocks, clk)) #define SCKSCR_INIT_VALUE _CONCAT(CLKSRC_, SYSCLK_SRC) diff --git a/drivers/clock_control/clock_control_renesas_ra_cgc.c b/drivers/clock_control/clock_control_renesas_ra_cgc.c index b03852fc86e..70512905be7 100644 --- a/drivers/clock_control/clock_control_renesas_ra_cgc.c +++ b/drivers/clock_control/clock_control_renesas_ra_cgc.c @@ -12,7 +12,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pclkblock), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pclkblock)) #define MSTP_REGS_ELEM(node_id, prop, idx) \ [DT_STRING_TOKEN_BY_IDX(node_id, prop, idx)] = \ (volatile uint32_t *)DT_REG_ADDR_BY_IDX(node_id, idx), diff --git a/drivers/clock_control/clock_control_smartbond.c b/drivers/clock_control/clock_control_smartbond.c index ed0cc205264..3d866fb4c58 100644 --- a/drivers/clock_control/clock_control_smartbond.c +++ b/drivers/clock_control/clock_control_smartbond.c @@ -265,7 +265,7 @@ static inline int smartbond_clock_control_off(const struct device *dev, switch (clk) { case SMARTBOND_CLK_RC32K: /* RC32K is used by POWERUP and WAKEUP HW FSM */ - BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(rc32k), okay), + BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(rc32k)), "RC32K is not allowed to be turned off"); ret = -EPERM; break; @@ -472,12 +472,12 @@ static void smartbond_clock_control_update_memory_settings(uint32_t sys_clock_fr { if (sys_clock_freq > 32000000) { da1469x_qspi_set_read_pipe_delay(QSPIC_ID, 7); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) da1469x_qspi_set_read_pipe_delay(QSPIC2_ID, 7); #endif } else { da1469x_qspi_set_read_pipe_delay(QSPIC_ID, 2); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) da1469x_qspi_set_read_pipe_delay(QSPIC2_ID, 2); #endif } @@ -485,7 +485,7 @@ static void smartbond_clock_control_update_memory_settings(uint32_t sys_clock_fr da1469x_qspi_set_cs_delay(QSPIC_ID, SystemCoreClock, DT_PROP(DT_NODELABEL(flash_controller), read_cs_idle_delay), DT_PROP(DT_NODELABEL(flash_controller), erase_cs_idle_delay)); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) da1469x_qspi_set_cs_delay(QSPIC2_ID, SystemCoreClock, DT_PROP(DT_NODELABEL(memc), read_cs_idle_min_ns), DT_PROP_OR(DT_NODELABEL(memc), erase_cs_idle_min_ns, 0)); @@ -565,7 +565,7 @@ int smartbond_clocks_init(const struct device *dev) ARG_UNUSED(dev); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) /* Make sure QSPIC2 is enabled */ da1469x_clock_amba_enable(CRG_TOP_CLK_AMBA_REG_QSPI2_ENABLE_Msk); #endif @@ -579,12 +579,12 @@ int smartbond_clocks_init(const struct device *dev) DT_FOREACH_CHILD_STATUS_OKAY_SEP(DT_PATH(crg, osc), ENABLE_OSC, (;)); /* Make sure that selected sysclock is enabled */ - BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_PROP(DT_NODELABEL(sys_clk), clock_src), okay), + BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_PROP(DT_NODELABEL(sys_clk), clock_src)), "Clock selected as system clock no enabled in DT"); - BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_PROP(DT_NODELABEL(lp_clk), clock_src), okay), + BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_PROP(DT_NODELABEL(lp_clk), clock_src)), "Clock selected as LP clock no enabled in DT"); BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(pll), disabled) || - DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay), + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xtal32m)), "PLL enabled in DT but XTAL32M is disabled"); clk_id = DT_DEP_ORD(DT_PROP(DT_NODELABEL(lp_clk), clock_src)); @@ -616,7 +616,7 @@ static int smartbond_clocks_pm_action(const struct device *dev, enum pm_device_a case PM_DEVICE_ACTION_SUSPEND: break; case PM_DEVICE_ACTION_RESUME: -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) /* Make sure QSPIC2 is enabled */ da1469x_clock_amba_enable(CRG_TOP_CLK_AMBA_REG_QSPI2_ENABLE_Msk); #endif diff --git a/drivers/clock_control/clock_stm32_ll_wb0.c b/drivers/clock_control/clock_stm32_ll_wb0.c index 6654867e01e..3a08cf64067 100644 --- a/drivers/clock_control/clock_stm32_ll_wb0.c +++ b/drivers/clock_control/clock_stm32_ll_wb0.c @@ -39,7 +39,7 @@ #if DT_NODE_HAS_PROP(STM32_CLOCK_CONTROL_NODE, slow_clock) -# if !DT_NODE_HAS_STATUS(DT_RCC_SLOWCLK_NODE, okay) +# if !DT_NODE_HAS_STATUS_OKAY(DT_RCC_SLOWCLK_NODE) # error slow-clock source is not enabled # endif diff --git a/drivers/counter/counter_mcux_snvs.c b/drivers/counter/counter_mcux_snvs.c index 3346cc21e75..172b4b894a3 100644 --- a/drivers/counter/counter_mcux_snvs.c +++ b/drivers/counter/counter_mcux_snvs.c @@ -311,7 +311,7 @@ static const struct counter_driver_api mcux_snvs_driver_api = { BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1, "unsupported snvs instance"); -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) static struct mcux_snvs_data mcux_snvs_data_0; static void mcux_snvs_irq_config_0(const struct device *dev); @@ -339,4 +339,4 @@ static void mcux_snvs_irq_config_0(const struct device *dev) mcux_snvs_isr, DEVICE_DT_INST_GET(0), 0); irq_enable(DT_INST_IRQN(0)); } -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ diff --git a/drivers/counter/counter_smartbond_timer.c b/drivers/counter/counter_smartbond_timer.c index 8dc3baba045..8ee8f006dae 100644 --- a/drivers/counter/counter_smartbond_timer.c +++ b/drivers/counter/counter_smartbond_timer.c @@ -27,7 +27,7 @@ LOG_MODULE_REGISTER(counter_timer, CONFIG_COUNTER_LOG_LEVEL); #define COUNTER_DT_DEVICE(_idx) DEVICE_DT_GET_OR_NULL(DT_NODELABEL(timer##_idx)) -#define PDC_XTAL_EN (DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay) ? \ +#define PDC_XTAL_EN (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xtal32m)) ? \ MCU_PDC_EN_XTAL : MCU_PDC_EN_NONE) struct counter_smartbond_data { diff --git a/drivers/disk/sdmmc_stm32.c b/drivers/disk/sdmmc_stm32.c index a344bb9d192..393950fb664 100644 --- a/drivers/disk/sdmmc_stm32.c +++ b/drivers/disk/sdmmc_stm32.c @@ -710,7 +710,7 @@ static int disk_stm32_sdmmc_init(const struct device *dev) return err; } -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) #if STM32_SDMMC_USE_DMA diff --git a/drivers/dma/dma_mcux_edma.c b/drivers/dma/dma_mcux_edma.c index 26c7cf58c34..7da8bf79b06 100644 --- a/drivers/dma/dma_mcux_edma.c +++ b/drivers/dma/dma_mcux_edma.c @@ -55,11 +55,11 @@ struct dma_mcux_edma_config { #ifdef CONFIG_DMA_MCUX_USE_DTCM_FOR_DMA_DESCRIPTORS -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #define EDMA_TCDPOOL_CACHE_ATTR __dtcm_noinit_section -#else /* DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) */ +#else /* DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) */ #error Selected DTCM for MCUX DMA descriptors but no DTCM section. -#endif /* DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) */ #elif defined(CONFIG_NOCACHE_MEMORY) #define EDMA_TCDPOOL_CACHE_ATTR __nocache diff --git a/drivers/dma/dma_stm32.c b/drivers/dma/dma_stm32.c index 178d83665b4..e2941a77cdc 100644 --- a/drivers/dma/dma_stm32.c +++ b/drivers/dma/dma_stm32.c @@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(dma_stm32, CONFIG_DMA_LOG_LEVEL); #define DT_DRV_COMPAT st_stm32_dma_v2bis #endif -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) #if DT_INST_IRQ_HAS_IDX(0, 7) #define DMA_STM32_0_STREAM_COUNT 8 #elif DT_INST_IRQ_HAS_IDX(0, 6) @@ -41,9 +41,9 @@ LOG_MODULE_REGISTER(dma_stm32, CONFIG_DMA_LOG_LEVEL); #else #define DMA_STM32_0_STREAM_COUNT 3 #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) #if DT_INST_IRQ_HAS_IDX(1, 7) #define DMA_STM32_1_STREAM_COUNT 8 #elif DT_INST_IRQ_HAS_IDX(1, 6) @@ -53,7 +53,7 @@ LOG_MODULE_REGISTER(dma_stm32, CONFIG_DMA_LOG_LEVEL); #else #define DMA_STM32_1_STREAM_COUNT 5 #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) */ static const uint32_t table_m_size[] = { LL_DMA_MDATAALIGN_BYTE, @@ -755,7 +755,7 @@ static void dma_stm32_irq_##dma##_##chan(const struct device *dev) \ #endif /* CONFIG_DMA_STM32_SHARED_IRQS */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) DMA_STM32_DEFINE_IRQ_HANDLER(0, 0); DMA_STM32_DEFINE_IRQ_HANDLER(0, 1); @@ -803,10 +803,10 @@ static void dma_stm32_config_irq_0(const struct device *dev) DMA_STM32_INIT_DEV(0); -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) DMA_STM32_DEFINE_IRQ_HANDLER(1, 0); DMA_STM32_DEFINE_IRQ_HANDLER(1, 1); @@ -855,4 +855,4 @@ static void dma_stm32_config_irq_1(const struct device *dev) DMA_STM32_INIT_DEV(1); -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) */ diff --git a/drivers/dma/dma_stm32_bdma.c b/drivers/dma/dma_stm32_bdma.c index 1df5746facb..7f769f47ac4 100644 --- a/drivers/dma/dma_stm32_bdma.c +++ b/drivers/dma/dma_stm32_bdma.c @@ -901,7 +901,7 @@ static void bdma_stm32_irq_##bdma##_##chan(const struct device *dev) \ } while (false) -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) #define BDMA_STM32_DEFINE_IRQ_HANDLER_GEN(i, _) \ BDMA_STM32_DEFINE_IRQ_HANDLER(0, i) @@ -918,4 +918,4 @@ static void bdma_stm32_config_irq_0(const struct device *dev) BDMA_STM32_INIT_DEV(0); -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ diff --git a/drivers/dma/dmamux_stm32.c b/drivers/dma/dmamux_stm32.c index d12a294eb7f..27e02b1c188 100644 --- a/drivers/dma/dmamux_stm32.c +++ b/drivers/dma/dmamux_stm32.c @@ -108,7 +108,7 @@ struct dmamux_stm32_dma_fops { }; #if (defined(CONFIG_DMA_STM32_V1) || defined(CONFIG_DMA_STM32_V2)) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux1), okay) + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux1)) static const struct dmamux_stm32_dma_fops dmamux1 = { dma_stm32_configure, dma_stm32_start, @@ -118,7 +118,7 @@ static const struct dmamux_stm32_dma_fops dmamux1 = { }; #endif -#if defined(CONFIG_DMA_STM32_BDMA) && DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux2), okay) +#if defined(CONFIG_DMA_STM32_BDMA) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux2)) static const struct dmamux_stm32_dma_fops dmamux2 = { bdma_stm32_configure, bdma_stm32_start, @@ -130,17 +130,17 @@ static const struct dmamux_stm32_dma_fops dmamux2 = { const struct dmamux_stm32_dma_fops *get_dma_fops(const struct dmamux_stm32_config *dev_config) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux1)) if (dev_config->base == DT_REG_ADDR(DT_NODELABEL(dmamux1))) { return &dmamux1; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux1)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux2)) if (dev_config->base == DT_REG_ADDR(DT_NODELABEL(dmamux2))) { return &dmamux2; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux2)) */ __ASSERT(false, "Unknown dma base address %x", dev_config->base); return (void *)0; @@ -298,24 +298,24 @@ static int dmamux_stm32_init(const struct device *dev) } #endif /* DT_INST_NODE_HAS_PROP(0, clocks) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux1)) /* DMA 1 and DMA2 for DMAMUX1, BDMA for DMAMUX2 */ if (config->base == DT_REG_ADDR(DT_NODELABEL(dmamux1))) { /* DMAs assigned to DMAMUX channels at build time might not be ready. */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dma1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dma1)) if (device_is_ready(DEVICE_DT_GET(DT_NODELABEL(dma1))) == false) { return -ENODEV; } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dma2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dma2)) if (device_is_ready(DEVICE_DT_GET(DT_NODELABEL(dma2))) == false) { return -ENODEV; } #endif } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux1)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux2), okay) && DT_NODE_HAS_STATUS(DT_NODELABEL(bdma1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux2)) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(bdma1)) if (config->base == DT_REG_ADDR(DT_NODELABEL(dmamux2))) { if (device_is_ready(DEVICE_DT_GET(DT_NODELABEL(bdma1))) == false) { return -ENODEV; @@ -346,19 +346,19 @@ static const struct dma_driver_api dma_funcs = { #define DMA_1_BEGIN_DMAMUX_CHANNEL DT_PROP_OR(DT_NODELABEL(dma1), dma_offset, 0) #define DMA_1_END_DMAMUX_CHANNEL (DMA_1_BEGIN_DMAMUX_CHANNEL + \ DT_PROP_OR(DT_NODELABEL(dma1), dma_requests, 0)) -#define DEV_DMA1 COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(dma1), okay), \ +#define DEV_DMA1 COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dma1)), \ DEVICE_DT_GET(DT_NODELABEL(dma1)), NULL) #define DMA_2_BEGIN_DMAMUX_CHANNEL DT_PROP_OR(DT_NODELABEL(dma2), dma_offset, 0) #define DMA_2_END_DMAMUX_CHANNEL (DMA_2_BEGIN_DMAMUX_CHANNEL + \ DT_PROP_OR(DT_NODELABEL(dma2), dma_requests, 0)) -#define DEV_DMA2 COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(dma2), okay), \ +#define DEV_DMA2 COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dma2)), \ DEVICE_DT_GET(DT_NODELABEL(dma2)), NULL) #define BDMA_1_BEGIN_DMAMUX_CHANNEL DT_PROP_OR(DT_NODELABEL(bdma1), dma_offset, 0) #define BDMA_1_END_DMAMUX_CHANNEL (BDMA_1_BEGIN_DMAMUX_CHANNEL + \ DT_PROP_OR(DT_NODELABEL(bdma1), dma_requests, 0)) -#define DEV_BDMA COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(bdma1), okay), \ +#define DEV_BDMA COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(bdma1)), \ DEVICE_DT_GET(DT_NODELABEL(bdma1)), NULL) #define DEV_DMA_BINDING(mux_channel) \ diff --git a/drivers/espi/espi_mchp_xec_host_v2.c b/drivers/espi/espi_mchp_xec_host_v2.c index 8cf4e085ed5..12d32007e84 100644 --- a/drivers/espi/espi_mchp_xec_host_v2.c +++ b/drivers/espi/espi_mchp_xec_host_v2.c @@ -108,7 +108,7 @@ static uint8_t ec_host_cmd_sram[CONFIG_ESPI_XEC_PERIPHERAL_HOST_CMD_PARAM_SIZE] #ifdef CONFIG_ESPI_PERIPHERAL_XEC_MAILBOX -BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(mbox0), okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mbox0)), "XEC mbox0 DT node is disabled!"); static struct xec_mbox_config { @@ -171,7 +171,7 @@ static int init_mbox0(const struct device *dev) #ifdef CONFIG_ESPI_PERIPHERAL_8042_KBC -BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(kbc0), okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(kbc0)), "XEC kbc0 DT node is disabled!"); struct xec_kbc0_config { @@ -665,7 +665,7 @@ static int init_acpi_ec1(const struct device *dev) #ifdef CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD -BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(emi0), okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(emi0)), "XEC EMI0 DT node is disabled!"); struct xec_emi_config { diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index 02ae6830f60..4186039a1be 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -50,7 +50,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #endif #if defined(CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER) && \ - !DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) + !DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #error DTCM for DMA buffer is activated but zephyr,dtcm is not present in dts #endif @@ -91,7 +91,7 @@ static const struct device *eth_stm32_phy_dev = DEVICE_PHY_BY_NAME(0); #define ETH_DMA_TX_TIMEOUT_MS 20U /* transmit timeout in milliseconds */ #if defined(CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER) && \ - DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) + DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #define __eth_stm32_desc __dtcm_noinit_section #define __eth_stm32_buf __dtcm_noinit_section #elif defined(CONFIG_SOC_SERIES_STM32H7X) diff --git a/drivers/ethernet/nxp_enet/eth_mcux.c b/drivers/ethernet/nxp_enet/eth_mcux.c index 2ac0296d6b2..397fa58bae1 100644 --- a/drivers/ethernet/nxp_enet/eth_mcux.c +++ b/drivers/ethernet/nxp_enet/eth_mcux.c @@ -149,7 +149,7 @@ static const char *eth_name(ENET_Type *base) switch ((int)base) { case DT_INST_REG_ADDR(0): return "ETH_0"; -#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) case DT_INST_REG_ADDR(1): return "ETH_1"; #endif @@ -964,10 +964,10 @@ static void eth_mcux_init(const struct device *dev) context->phy_handle->ops = &phyksz8081_ops; #if defined(CONFIG_SOC_SERIES_IMXRT10XX) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) sys_clock = CLOCK_GetFreq(kCLOCK_IpgClk); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet2)) sys_clock = CLOCK_GetFreq(kCLOCK_EnetPll1Clk); #endif #elif defined(CONFIG_SOC_SERIES_IMXRT11XX) @@ -1350,7 +1350,7 @@ static void eth_mcux_err_isr(const struct device *dev) } while (false) #define ETH_MCUX_IRQ_PTP(n) \ - COND_CODE_1(DT_NODE_HAS_STATUS(PTP_INST_NODEID(n), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(PTP_INST_NODEID(n)), \ (ETH_MCUX_IRQ_PTP_INIT(n)), \ (ETH_MCUX_NONE)) @@ -1454,7 +1454,7 @@ static void eth_mcux_err_isr(const struct device *dev) #define ETH_MCUX_PINCTRL_INIT(n) #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) && \ CONFIG_ETH_MCUX_USE_DTCM_FOR_DMA_BUFFER /* Use DTCM for hardware DMA buffers */ #define _mcux_dma_desc __dtcm_bss_section diff --git a/drivers/ethernet/nxp_enet/eth_nxp_enet.c b/drivers/ethernet/nxp_enet/eth_nxp_enet.c index a92b13f8da9..b80e0cc34bd 100644 --- a/drivers/ethernet/nxp_enet/eth_nxp_enet.c +++ b/drivers/ethernet/nxp_enet/eth_nxp_enet.c @@ -854,7 +854,7 @@ static const struct ethernet_api api_funcs = { #define NXP_ENET_DT_PHY_DEV(node_id, phy_phandle, idx) \ DEVICE_DT_GET(DT_PHANDLE_BY_IDX(node_id, phy_phandle, idx)) -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) && \ CONFIG_ETH_NXP_ENET_USE_DTCM_FOR_DMA_BUFFER #define _nxp_enet_dma_desc_section __dtcm_bss_section #define _nxp_enet_dma_buffer_section __dtcm_noinit_section diff --git a/drivers/ethernet/phy/phy_adin2111.c b/drivers/ethernet/phy/phy_adin2111.c index 380def0ebe7..902838bd08d 100644 --- a/drivers/ethernet/phy/phy_adin2111.c +++ b/drivers/ethernet/phy/phy_adin2111.c @@ -7,7 +7,7 @@ #include -#if DT_NODE_HAS_STATUS(DT_INST(0, adi_adin2111_phy), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, adi_adin2111_phy)) #define DT_DRV_COMPAT adi_adin2111_phy #else #define DT_DRV_COMPAT adi_adin1100_phy diff --git a/drivers/flash/soc_flash_lpc.c b/drivers/flash/soc_flash_lpc.c index ae457fe926b..5f931a1bf73 100644 --- a/drivers/flash/soc_flash_lpc.c +++ b/drivers/flash/soc_flash_lpc.c @@ -17,9 +17,9 @@ #include "fsl_flashiap.h" -#if DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc11), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_fmc11)) #define DT_DRV_COMPAT nxp_iap_fmc11 -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc54), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_fmc54)) #define DT_DRV_COMPAT nxp_iap_fmc54 #else #error No matching compatible for soc_flash_lpc.c diff --git a/drivers/flash/soc_flash_mcux.c b/drivers/flash/soc_flash_mcux.c index 6eaf90cd010..cc743371baa 100644 --- a/drivers/flash/soc_flash_mcux.c +++ b/drivers/flash/soc_flash_mcux.c @@ -22,19 +22,19 @@ LOG_MODULE_REGISTER(flash_mcux); -#if DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_ftfa), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_kinetis_ftfa)) #define DT_DRV_COMPAT nxp_kinetis_ftfa -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_ftfe), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_kinetis_ftfe)) #define DT_DRV_COMPAT nxp_kinetis_ftfe -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_ftfl), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_kinetis_ftfl)) #define DT_DRV_COMPAT nxp_kinetis_ftfl -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc55), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_fmc55)) #define DT_DRV_COMPAT nxp_iap_fmc55 #define SOC_HAS_IAP 1 -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc553), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_fmc553)) #define DT_DRV_COMPAT nxp_iap_fmc553 #define SOC_HAS_IAP 1 -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_msf1), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_msf1)) #define DT_DRV_COMPAT nxp_iap_msf1 #define SOC_HAS_IAP_MSF1 1 #else diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index 16ab00b9660..a960656f5d2 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -23,13 +23,13 @@ #include LOG_MODULE_REGISTER(flash_nrf); -#if DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf51_flash_controller), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf51_flash_controller)) #define DT_DRV_COMPAT nordic_nrf51_flash_controller -#elif DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf52_flash_controller), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf52_flash_controller)) #define DT_DRV_COMPAT nordic_nrf52_flash_controller -#elif DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf53_flash_controller), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf53_flash_controller)) #define DT_DRV_COMPAT nordic_nrf53_flash_controller -#elif DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf91_flash_controller), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf91_flash_controller)) #define DT_DRV_COMPAT nordic_nrf91_flash_controller #else #error No matching compatible for soc_flash_nrf.c diff --git a/drivers/gpio/gpio_esp32.c b/drivers/gpio/gpio_esp32.c index ea12070235e..d0c933ca37d 100644 --- a/drivers/gpio/gpio_esp32.c +++ b/drivers/gpio/gpio_esp32.c @@ -284,7 +284,7 @@ static int gpio_esp32_port_get_raw(const struct device *port, uint32_t *value) if (cfg->gpio_port == 0) { *value = cfg->gpio_dev->in; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { *value = cfg->gpio_dev->in1.data; #endif @@ -302,7 +302,7 @@ static int gpio_esp32_port_set_masked_raw(const struct device *port, if (cfg->gpio_port == 0) { cfg->gpio_dev->out = (cfg->gpio_dev->out & ~mask) | (mask & value); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { cfg->gpio_dev->out1.data = (cfg->gpio_dev->out1.data & ~mask) | (mask & value); #endif @@ -320,7 +320,7 @@ static int gpio_esp32_port_set_bits_raw(const struct device *port, if (cfg->gpio_port == 0) { cfg->gpio_dev->out_w1ts = pins; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { cfg->gpio_dev->out1_w1ts.data = pins; #endif @@ -336,7 +336,7 @@ static int gpio_esp32_port_clear_bits_raw(const struct device *port, if (cfg->gpio_port == 0) { cfg->gpio_dev->out_w1tc = pins; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { cfg->gpio_dev->out1_w1tc.data = pins; #endif @@ -353,7 +353,7 @@ static int gpio_esp32_port_toggle_bits(const struct device *port, if (cfg->gpio_port == 0) { cfg->gpio_dev->out ^= pins; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { cfg->gpio_dev->out1.data ^= pins; #endif @@ -531,11 +531,11 @@ static void IRAM_ATTR gpio_esp32_isr(void *param) { ARG_UNUSED(param); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) gpio_esp32_fire_callbacks(DEVICE_DT_INST_GET(0)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) gpio_esp32_fire_callbacks(DEVICE_DT_INST_GET(1)); #endif } diff --git a/drivers/gpio/gpio_gd32.c b/drivers/gpio/gpio_gd32.c index 744f5e4a776..1c40be4de4c 100644 --- a/drivers/gpio/gpio_gd32.c +++ b/drivers/gpio/gpio_gd32.c @@ -365,7 +365,7 @@ static int gpio_gd32_init(const struct device *port) }, \ .reg = DT_INST_REG_ADDR(n), \ .clkid = DT_INST_CLOCKS_CELL(n, id), \ - COND_CODE_1(DT_NODE_HAS_STATUS(SYSCFG_NODE, okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SYSCFG_NODE), \ (.clkid_exti = DT_CLOCKS_CELL(SYSCFG_NODE, id),), \ (.clkid_exti = DT_CLOCKS_CELL(AFIO_NODE, id),)) \ .reset = RESET_DT_SPEC_INST_GET(n), \ diff --git a/drivers/gpio/gpio_lpc11u6x.c b/drivers/gpio/gpio_lpc11u6x.c index a44deceed9b..102d8c3e8b6 100644 --- a/drivers/gpio/gpio_lpc11u6x.c +++ b/drivers/gpio/gpio_lpc11u6x.c @@ -459,21 +459,21 @@ static void gpio_lpc11u6x_isr(const void *arg) } } /* For each port with active pins, fire the GPIO interrupt callbacks. */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) if (pins[0]) { port = DEVICE_DT_GET(DT_NODELABEL(gpio0)); data = port->data; gpio_fire_callbacks(&data->cb_list, port, pins[0]); } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) if (pins[1]) { port = DEVICE_DT_GET(DT_NODELABEL(gpio1)); data = port->data; gpio_fire_callbacks(&data->cb_list, port, pins[1]); } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) if (pins[2]) { port = DEVICE_DT_GET(DT_NODELABEL(gpio2)); data = port->data; @@ -589,14 +589,14 @@ DEVICE_DT_DEFINE(DT_NODELABEL(gpio##id), \ PRE_KERNEL_2, CONFIG_GPIO_INIT_PRIORITY, \ &gpio_lpc11u6x_driver_api) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) GPIO_LPC11U6X_INIT(0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) GPIO_LPC11U6X_INIT(1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) GPIO_LPC11U6X_INIT(2); #endif diff --git a/drivers/gpio/gpio_mchp_xec.c b/drivers/gpio/gpio_mchp_xec.c index 86d9f2a5d7a..e96130a0941 100644 --- a/drivers/gpio/gpio_mchp_xec.c +++ b/drivers/gpio/gpio_mchp_xec.c @@ -341,7 +341,7 @@ static const struct gpio_driver_api gpio_xec_driver_api = { .manage_callback = gpio_xec_manage_callback, }; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_000_036), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_000_036)) static int gpio_xec_port000_036_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port000_036_config = { @@ -385,9 +385,9 @@ static int gpio_xec_port000_036_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_000_036), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_000_036)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_040_076), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_040_076)) static int gpio_xec_port040_076_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port040_076_config = { @@ -431,9 +431,9 @@ static int gpio_xec_port040_076_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_040_076), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_040_076)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_100_136), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_100_136)) static int gpio_xec_port100_136_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port100_136_config = { @@ -477,9 +477,9 @@ static int gpio_xec_port100_136_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_100_136), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_100_136)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_140_176), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_140_176)) static int gpio_xec_port140_176_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port140_176_config = { @@ -523,9 +523,9 @@ static int gpio_xec_port140_176_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_140_176), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_140_176)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_200_236), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_200_236)) static int gpio_xec_port200_236_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port200_236_config = { @@ -569,9 +569,9 @@ static int gpio_xec_port200_236_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_200_236), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_200_236)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_240_276), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_240_276)) static int gpio_xec_port240_276_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port240_276_config = { @@ -615,4 +615,4 @@ static int gpio_xec_port240_276_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_240_276), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_240_276)) */ diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index d89c964cc90..151cf1a830c 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -446,7 +446,7 @@ static const struct gpio_driver_api gpio_nrfx_drv_api_funcs = { #define GPIOTE_CHECK(id) \ COND_CODE_1(DT_INST_NODE_HAS_PROP(id, gpiote_instance), \ - (BUILD_ASSERT(DT_NODE_HAS_STATUS(GPIOTE_PHANDLE(id), okay), \ + (BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(GPIOTE_PHANDLE(id)), \ "Please enable GPIOTE instance for used GPIO port!")), \ ()) diff --git a/drivers/gpio/gpio_nxp_s32.c b/drivers/gpio/gpio_nxp_s32.c index e9bcc29c907..5e9e7a55471 100644 --- a/drivers/gpio/gpio_nxp_s32.c +++ b/drivers/gpio/gpio_nxp_s32.c @@ -519,7 +519,7 @@ static const struct gpio_driver_api gpio_nxp_s32_driver_api = { DT_NODE_HAS_PROP(DT_DRV_INST(n), interrupts)), \ "interrupts and interrupt-parent must be set when " \ "using external interrupts"); \ - IF_ENABLED(DT_NODE_HAS_STATUS(GPIO_NXP_S32_EIRQ_NODE(n), okay), ( \ + IF_ENABLED(DT_NODE_HAS_STATUS_OKAY(GPIO_NXP_S32_EIRQ_NODE(n)), ( \ static uint8_t gpio_nxp_s32_eirq_data_##n[] = { \ LISTIFY(DT_NUM_IRQS(DT_DRV_INST(n)), \ GPIO_NXP_S32_EIRQ_PIN_LINE, (,), n) \ @@ -533,7 +533,7 @@ static const struct gpio_driver_api gpio_nxp_s32_driver_api = { )) #define GPIO_NXP_S32_GET_EIRQ_INFO(n) \ - .eirq_info = UTIL_AND(DT_NODE_HAS_STATUS(GPIO_NXP_S32_EIRQ_NODE(n), okay),\ + .eirq_info = UTIL_AND(DT_NODE_HAS_STATUS_OKAY(GPIO_NXP_S32_EIRQ_NODE(n)),\ &gpio_nxp_s32_eirq_##n), #else #define GPIO_NXP_S32_SET_EIRQ_INFO(n) @@ -547,7 +547,7 @@ static const struct gpio_driver_api gpio_nxp_s32_driver_api = { BUILD_ASSERT((DT_INST_NODE_HAS_PROP(n, nxp_wkpu) == \ DT_INST_NODE_HAS_PROP(n, nxp_wkpu_interrupts)), \ "nxp,wkpu and nxp,wkpu-interrupts must be provided"); \ - IF_ENABLED(DT_NODE_HAS_STATUS(GPIO_NXP_S32_WKPU_NODE(n), okay), ( \ + IF_ENABLED(DT_NODE_HAS_STATUS_OKAY(GPIO_NXP_S32_WKPU_NODE(n)), ( \ static uint8_t gpio_nxp_s32_wkpu_data_##n[] = \ DT_INST_PROP(n, nxp_wkpu_interrupts); \ static struct gpio_nxp_s32_irq_config gpio_nxp_s32_wkpu_##n = { \ @@ -560,7 +560,7 @@ static const struct gpio_driver_api gpio_nxp_s32_driver_api = { )) #define GPIO_NXP_S32_GET_WKPU_INFO(n) \ - .wkpu_info = UTIL_AND(DT_NODE_HAS_STATUS(GPIO_NXP_S32_WKPU_NODE(n), okay),\ + .wkpu_info = UTIL_AND(DT_NODE_HAS_STATUS_OKAY(GPIO_NXP_S32_WKPU_NODE(n)),\ &gpio_nxp_s32_wkpu_##n) #else #define GPIO_NXP_S32_SET_WKPU_INFO(n) diff --git a/drivers/gpio/gpio_renesas_ra_ioport.c b/drivers/gpio/gpio_renesas_ra_ioport.c index 8005acab360..65fc946438a 100644 --- a/drivers/gpio/gpio_renesas_ra_ioport.c +++ b/drivers/gpio/gpio_renesas_ra_ioport.c @@ -176,7 +176,7 @@ static const struct gpio_driver_api gpio_ra_drv_api_funcs = { DT_REG_ADDR(DT_NODELABEL(ioport##suffix))) #define GPIO_DEVICE_INIT_RA_IF_OKAY(suffix) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(ioport##suffix), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ioport##suffix)), \ (GPIO_DEVICE_INIT_RA(suffix)), \ ()) diff --git a/drivers/gpio/gpio_sam0.c b/drivers/gpio/gpio_sam0.c index 03cfab48e60..98234d3319d 100644 --- a/drivers/gpio/gpio_sam0.c +++ b/drivers/gpio/gpio_sam0.c @@ -286,7 +286,7 @@ static const struct gpio_driver_api gpio_sam0_api = { static int gpio_sam0_init(const struct device *dev) { return 0; } /* Port A */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(porta), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(porta)) static const struct gpio_sam0_config gpio_sam0_config_0 = { .common = { @@ -308,7 +308,7 @@ DEVICE_DT_DEFINE(DT_NODELABEL(porta), #endif /* Port B */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portb), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portb)) static const struct gpio_sam0_config gpio_sam0_config_1 = { .common = { @@ -330,7 +330,7 @@ DEVICE_DT_DEFINE(DT_NODELABEL(portb), #endif /* Port C */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portc)) static const struct gpio_sam0_config gpio_sam0_config_2 = { .common = { @@ -352,7 +352,7 @@ DEVICE_DT_DEFINE(DT_NODELABEL(portc), #endif /* Port D */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portd), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portd)) static const struct gpio_sam0_config gpio_sam0_config_3 = { .common = { diff --git a/drivers/gpio/gpio_stm32.c b/drivers/gpio/gpio_stm32.c index 407c1a414e6..23edb977755 100644 --- a/drivers/gpio/gpio_stm32.c +++ b/drivers/gpio/gpio_stm32.c @@ -697,7 +697,7 @@ static int gpio_stm32_init(const struct device *dev) } #if (defined(PWR_CR2_IOSV) || defined(PWR_SVMCR_IO2SV)) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(gpiog), okay) + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpiog)) z_stm32_hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY); /* Port G[15:2] requires external power supply */ /* Cf: L4/L5 RM, Chapter "Independent I/O supply rail" */ @@ -747,7 +747,7 @@ static int gpio_stm32_init(const struct device *dev) DT_CLOCKS_CELL(DT_NODELABEL(gpio##__suffix), bus)) #define GPIO_DEVICE_INIT_STM32_IF_OKAY(__suffix, __SUFFIX) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(gpio##__suffix), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio##__suffix)), \ (GPIO_DEVICE_INIT_STM32(__suffix, __SUFFIX)), \ ()) diff --git a/drivers/gpio/gpio_xlnx_axi.c b/drivers/gpio/gpio_xlnx_axi.c index 4b50bf85cd6..3b1238310f9 100644 --- a/drivers/gpio/gpio_xlnx_axi.c +++ b/drivers/gpio/gpio_xlnx_axi.c @@ -382,7 +382,7 @@ static const struct gpio_driver_api gpio_xlnx_axi_driver_api = { #define GPIO_XLNX_AXI_GPIO2_HAS_COMPAT_STATUS_OKAY(n) \ UTIL_AND(DT_NODE_HAS_COMPAT(DT_INST_CHILD(n, gpio2), xlnx_xps_gpio_1_00_a_gpio2), \ - DT_NODE_HAS_STATUS(DT_INST_CHILD(n, gpio2), okay)) + DT_NODE_HAS_STATUS_OKAY(DT_INST_CHILD(n, gpio2))) #define GPIO_XLNX_AXI_GPIO2_COND_INIT(n) \ IF_ENABLED(UTIL_AND(DT_INST_PROP_OR(n, xlnx_is_dual, 1), \ diff --git a/drivers/i2c/i2c_esp32.c b/drivers/i2c/i2c_esp32.c index 3c138172209..07c8ea536ca 100644 --- a/drivers/i2c/i2c_esp32.c +++ b/drivers/i2c/i2c_esp32.c @@ -843,7 +843,7 @@ static int IRAM_ATTR i2c_esp32_init(const struct device *dev) &i2c_esp32_config_##idx, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ &i2c_esp32_driver_api); -#if DT_NODE_HAS_STATUS(I2C(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(I2C(0)) #ifndef SOC_I2C_SUPPORT_HW_CLR_BUS #if !DT_NODE_HAS_PROP(I2C(0), sda_gpios) || !DT_NODE_HAS_PROP(I2C(0), scl_gpios) #error "Missing and properties to build for this target." @@ -854,9 +854,9 @@ static int IRAM_ATTR i2c_esp32_init(const struct device *dev) #endif #endif /* !SOC_I2C_SUPPORT_HW_CLR_BUS */ ESP32_I2C_INIT(0); -#endif /* DT_NODE_HAS_STATUS(I2C(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(I2C(0)) */ -#if DT_NODE_HAS_STATUS(I2C(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(I2C(1)) #ifndef SOC_I2C_SUPPORT_HW_CLR_BUS #if !DT_NODE_HAS_PROP(I2C(1), sda_gpios) || !DT_NODE_HAS_PROP(I2C(1), scl_gpios) #error "Missing and properties to build for this target." @@ -867,4 +867,4 @@ ESP32_I2C_INIT(0); #endif #endif /* !SOC_I2C_SUPPORT_HW_CLR_BUS */ ESP32_I2C_INIT(1); -#endif /* DT_NODE_HAS_STATUS(I2C(1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(I2C(1)) */ diff --git a/drivers/i2s/i2s_litex.c b/drivers/i2s/i2s_litex.c index e66eaed7972..6105804d8ce 100644 --- a/drivers/i2s/i2s_litex.c +++ b/drivers/i2s/i2s_litex.c @@ -634,9 +634,9 @@ static const struct i2s_driver_api i2s_litex_driver_api = { irq_enable(DT_IRQN(DT_NODELABEL(i2s_##dir))); \ } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2s_rx), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2s_rx)) I2S_INIT(rx); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2s_tx), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2s_tx)) I2S_INIT(tx); #endif diff --git a/drivers/interrupt_controller/intc_mchp_ecia_xec.c b/drivers/interrupt_controller/intc_mchp_ecia_xec.c index f1fc0f8c28b..c4844643ccb 100644 --- a/drivers/interrupt_controller/intc_mchp_ecia_xec.c +++ b/drivers/interrupt_controller/intc_mchp_ecia_xec.c @@ -445,7 +445,7 @@ int mchp_ecia_info_unset_callback(int ecia_info) * Leaving a node disabled also allows another driver/application to take over * aggregation by managing the GIRQ itself. */ -#define XEC_CHK_REQ_AGGR(n) DT_NODE_HAS_STATUS(n, okay) | +#define XEC_CHK_REQ_AGGR(n) DT_NODE_HAS_STATUS_OKAY(n) | #define XEC_ECIA_REQUIRE_AGGR_ISR \ ( \ diff --git a/drivers/led_strip/lpd880x.c b/drivers/led_strip/lpd880x.c index 991e2e3fb57..d4b56509db1 100644 --- a/drivers/led_strip/lpd880x.c +++ b/drivers/led_strip/lpd880x.c @@ -9,7 +9,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_INST(0, greeled_lpd8806), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, greeled_lpd8806)) #define DT_DRV_COMPAT greeled_lpd8806 #else #define DT_DRV_COMPAT greeled_lpd8803 diff --git a/drivers/lora/shell.c b/drivers/lora/shell.c index 692446b06cf..7d3775c9d5c 100644 --- a/drivers/lora/shell.c +++ b/drivers/lora/shell.c @@ -13,7 +13,7 @@ LOG_MODULE_REGISTER(lora_shell, CONFIG_LORA_LOG_LEVEL); #define DEFAULT_RADIO_NODE DT_ALIAS(lora0) -BUILD_ASSERT(DT_NODE_HAS_STATUS(DEFAULT_RADIO_NODE, okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DEFAULT_RADIO_NODE), "No default LoRa radio specified in DT"); static struct lora_modem_config modem_config = { diff --git a/drivers/memc/memc_nxp_s32_qspi.c b/drivers/memc/memc_nxp_s32_qspi.c index f588a0bd9af..e1d5c60bd67 100644 --- a/drivers/memc/memc_nxp_s32_qspi.c +++ b/drivers/memc/memc_nxp_s32_qspi.c @@ -139,7 +139,7 @@ uint8_t memc_nxp_s32_qspi_get_instance(const struct device *dev) #define QSPI_PORT_SIZE_FN(node_id, side_upper, port) \ COND_CODE_1(IS_EQ(DT_REG_ADDR(node_id), QSPI_PCSF##side_upper##port), \ - (COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), \ + (COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(node_id), \ (.memSize##side_upper##port = DT_PROP(node_id, size) / 8,), \ (.memSize##side_upper##port = 0,))), \ (EMPTY)) diff --git a/drivers/pinctrl/pinctrl_esp32.c b/drivers/pinctrl/pinctrl_esp32.c index 89c1ba43b41..4ed39229d56 100644 --- a/drivers/pinctrl/pinctrl_esp32.c +++ b/drivers/pinctrl/pinctrl_esp32.c @@ -254,7 +254,7 @@ static int esp32_pin_configure(const uint32_t pin_mux, const uint32_t pin_cfg) gpio_dev_t *const gpio_dev = (gpio_dev_t *)DT_REG_ADDR(DT_NODELABEL(gpio0)); gpio_dev->out_w1ts = BIT(pin_num); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { gpio_dev_t *const gpio_dev = (gpio_dev_t *)DT_REG_ADDR(DT_NODELABEL(gpio1)); @@ -268,7 +268,7 @@ static int esp32_pin_configure(const uint32_t pin_mux, const uint32_t pin_cfg) gpio_dev_t *const gpio_dev = (gpio_dev_t *)DT_REG_ADDR(DT_NODELABEL(gpio0)); gpio_dev->out_w1tc = BIT(pin_num); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { gpio_dev_t *const gpio_dev = (gpio_dev_t *)DT_REG_ADDR(DT_NODELABEL(gpio1)); diff --git a/drivers/pinctrl/pinctrl_ite_it8xxx2.c b/drivers/pinctrl/pinctrl_ite_it8xxx2.c index 91ca93ea293..422f8c6c67f 100644 --- a/drivers/pinctrl/pinctrl_ite_it8xxx2.c +++ b/drivers/pinctrl/pinctrl_ite_it8xxx2.c @@ -366,7 +366,7 @@ static int pinctrl_it8xxx2_init(const struct device *dev) gpio_base->GPIO_GCR &= ~IT8XXX2_GPIO_LPCRSTEN; #ifdef CONFIG_SOC_IT8XXX2_REG_SET_V2 -#if defined(CONFIG_I2C_ITE_ENHANCE) && DT_NODE_HAS_STATUS(DT_NODELABEL(i2c5), okay) +#if defined(CONFIG_I2C_ITE_ENHANCE) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c5)) const struct gpio_dt_spec scl_gpios = GPIO_DT_SPEC_GET(DT_NODELABEL(i2c5), scl_gpios); const struct gpio_dt_spec sda_gpios = GPIO_DT_SPEC_GET(DT_NODELABEL(i2c5), sda_gpios); diff --git a/drivers/pinctrl/pinctrl_kinetis.c b/drivers/pinctrl/pinctrl_kinetis.c index 7a8151c7be1..bc250d742cf 100644 --- a/drivers/pinctrl/pinctrl_kinetis.c +++ b/drivers/pinctrl/pinctrl_kinetis.c @@ -75,7 +75,7 @@ static int pinctrl_mcux_init(const struct device *dev) return 0; } -#if DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_sim), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_kinetis_sim)) #define PINCTRL_MCUX_DT_INST_CLOCK_SUBSYS(n) \ CLK_GATE_DEFINE(DT_INST_CLOCKS_CELL(n, offset), DT_INST_CLOCKS_CELL(n, bits)) #elif DT_HAS_COMPAT_STATUS_OKAY(nxp_scg_k4) diff --git a/drivers/rtc/rtc_smartbond.c b/drivers/rtc/rtc_smartbond.c index 7aa0d461d27..3d171e58f69 100644 --- a/drivers/rtc/rtc_smartbond.c +++ b/drivers/rtc/rtc_smartbond.c @@ -626,7 +626,7 @@ static int rtc_smartbond_init(const struct device *dev) /* Wakeup device from RTC events (alarm/roll over) */ #if CONFIG_PM - bool is_xtal32m_enabled = DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay); + bool is_xtal32m_enabled = DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xtal32m)); int pdc_idx = da1469x_pdc_add(MCU_PDC_TRIGGER_RTC_ALARM, MCU_PDC_MASTER_M33, is_xtal32m_enabled ? MCU_PDC_EN_XTAL : 0); diff --git a/drivers/sensor/bosch/bmi08x/bmi08x.h b/drivers/sensor/bosch/bmi08x/bmi08x.h index 6b8b33f8ec7..83926126e48 100644 --- a/drivers/sensor/bosch/bmi08x/bmi08x.h +++ b/drivers/sensor/bosch/bmi08x/bmi08x.h @@ -427,7 +427,7 @@ enum bmi08x_odr { #define BMI08X_GYR_SCALE(range_dps) ((2 * range_dps * SENSOR_PI) / 180LL / 65536LL) /* report of data sync is selected */ -#define BMI08X_ACCEL_DATA_SYNC_EN(inst) DT_NODE_HAS_STATUS(DT_INST_PHANDLE(inst, data_sync), okay) +#define BMI08X_ACCEL_DATA_SYNC_EN(inst) DT_NODE_HAS_STATUS_OKAY(DT_INST_PHANDLE(inst, data_sync)) /* Macro used for compile time optimization to compile in/out code used for data-sync * if at least 1 bmi08x has data-sync enabled */ diff --git a/drivers/sensor/st/stm32_temp/stm32_temp.c b/drivers/sensor/st/stm32_temp/stm32_temp.c index aa746e0c699..787eb4c99e6 100644 --- a/drivers/sensor/st/stm32_temp/stm32_temp.c +++ b/drivers/sensor/st/stm32_temp/stm32_temp.c @@ -188,7 +188,7 @@ static int stm32_temp_init(const struct device *dev) * this driver even if the ADC used for measurement is disabled. In such cases, * fail build with an explicit error message. */ -#if !DT_NODE_HAS_STATUS(DT_INST_IO_CHANNELS_CTLR(0), okay) +#if !DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(0)) /* Use BUILD_ASSERT to get preprocessing on the message */ BUILD_ASSERT(0, "ADC '" DT_NODE_FULL_NAME(DT_INST_IO_CHANNELS_CTLR(0)) "' needed by " @@ -235,4 +235,4 @@ SENSOR_DEVICE_DT_INST_DEFINE(0, stm32_temp_init, NULL, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &stm32_temp_driver_api); -#endif /* !DT_NODE_HAS_STATUS(DT_INST_IO_CHANNELS_CTLR(0), okay) */ +#endif /* !DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(0)) */ diff --git a/drivers/sensor/st/stm32_vbat/stm32_vbat.c b/drivers/sensor/st/stm32_vbat/stm32_vbat.c index b74e0cf8b7f..98bebad37fa 100644 --- a/drivers/sensor/st/stm32_vbat/stm32_vbat.c +++ b/drivers/sensor/st/stm32_vbat/stm32_vbat.c @@ -125,7 +125,7 @@ static int stm32_vbat_init(const struct device *dev) } #define ASSERT_VBAT_ADC_ENABLED(inst) \ - BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_INST_IO_CHANNELS_CTLR(inst), okay), \ + BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(inst)), \ "ADC instance '" DT_NODE_FULL_NAME(DT_INST_IO_CHANNELS_CTLR(inst)) "' needed " \ "by Vbat sensor '" DT_NODE_FULL_NAME(DT_DRV_INST(inst)) "' is not enabled") diff --git a/drivers/sensor/st/stm32_vref/stm32_vref.c b/drivers/sensor/st/stm32_vref/stm32_vref.c index b2cf7222fad..b76c2ea0e6e 100644 --- a/drivers/sensor/st/stm32_vref/stm32_vref.c +++ b/drivers/sensor/st/stm32_vref/stm32_vref.c @@ -154,7 +154,7 @@ static int stm32_vref_init(const struct device *dev) * possible to compile this driver even if the ADC used for measurement is * disabled. In such cases, fail build with an explicit error message. */ -#if !DT_NODE_HAS_STATUS(DT_INST_IO_CHANNELS_CTLR(0), okay) +#if !DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(0)) /* Use BUILD_ASSERT to get preprocessing on the message */ BUILD_ASSERT(0, "ADC '" DT_NODE_FULL_NAME(DT_INST_IO_CHANNELS_CTLR(0)) "' needed by " @@ -183,4 +183,4 @@ static const struct stm32_vref_config stm32_vref_dev_config = { SENSOR_DEVICE_DT_INST_DEFINE(0, stm32_vref_init, NULL, &stm32_vref_dev_data, &stm32_vref_dev_config, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &stm32_vref_driver_api); -#endif /* !DT_NODE_HAS_STATUS(DT_INST_IO_CHANNELS_CTLR(0), okay) */ +#endif /* !DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(0)) */ diff --git a/drivers/serial/leuart_gecko.c b/drivers/serial/leuart_gecko.c index daaff59069c..9eec982802c 100644 --- a/drivers/serial/leuart_gecko.c +++ b/drivers/serial/leuart_gecko.c @@ -317,7 +317,7 @@ static const struct uart_driver_api leuart_gecko_driver_api = { #endif }; -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) #define PIN_LEUART_0_RXD {DT_INST_PROP_BY_IDX(0, location_rx, 1), \ DT_INST_PROP_BY_IDX(0, location_rx, 2), gpioModeInput, 1} @@ -368,9 +368,9 @@ static void leuart_gecko_config_func_0(const struct device *dev) } #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) #define PIN_LEUART_1_RXD {DT_INST_PROP_BY_IDX(1, location_rx, 1), \ DT_INST_PROP_BY_IDX(1, location_rx, 2), gpioModeInput, 1} @@ -421,4 +421,4 @@ static void leuart_gecko_config_func_1(const struct device *dev) } #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) */ diff --git a/drivers/serial/uart_cmsdk_apb.c b/drivers/serial/uart_cmsdk_apb.c index a6568133b72..e4ceb883bd6 100644 --- a/drivers/serial/uart_cmsdk_apb.c +++ b/drivers/serial/uart_cmsdk_apb.c @@ -475,7 +475,7 @@ static const struct uart_driver_api uart_cmsdk_apb_driver_api = { #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ }; -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_cmsdk_apb_irq_config_func_0(const struct device *dev); @@ -538,9 +538,9 @@ static void uart_cmsdk_apb_irq_config_func_0(const struct device *dev) #endif #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_cmsdk_apb_irq_config_func_1(const struct device *dev); @@ -603,9 +603,9 @@ static void uart_cmsdk_apb_irq_config_func_1(const struct device *dev) #endif #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(2)) #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_cmsdk_apb_irq_config_func_2(const struct device *dev); @@ -668,9 +668,9 @@ static void uart_cmsdk_apb_irq_config_func_2(const struct device *dev) #endif #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(2)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(3)) #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_cmsdk_apb_irq_config_func_3(const struct device *dev); @@ -733,9 +733,9 @@ static void uart_cmsdk_apb_irq_config_func_3(const struct device *dev) #endif #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(3), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(3)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(4)) #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_cmsdk_apb_irq_config_func_4(const struct device *dev); @@ -798,4 +798,4 @@ static void uart_cmsdk_apb_irq_config_func_4(const struct device *dev) #endif #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(4), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(4)) */ diff --git a/drivers/serial/uart_lpc11u6x.c b/drivers/serial/uart_lpc11u6x.c index 5645fb7910b..3a13850429f 100644 --- a/drivers/serial/uart_lpc11u6x.c +++ b/drivers/serial/uart_lpc11u6x.c @@ -13,7 +13,7 @@ #include "uart_lpc11u6x.h" -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) static int lpc11u6x_uart0_poll_in(const struct device *dev, unsigned char *c) { const struct lpc11u6x_uart0_config *cfg = dev->config; @@ -443,12 +443,12 @@ static void lpc11u6x_uart0_isr_config(const struct device *dev) } #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) static int lpc11u6x_uartx_poll_in(const struct device *dev, unsigned char *c) { @@ -810,18 +810,18 @@ static int lpc11u6x_uartx_init(const struct device *dev) LPC11U6X_UARTX_CFG_ENABLE; #ifdef CONFIG_UART_INTERRUPT_DRIVEN -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) lpc11u6x_uartx_isr_config_1(dev); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) lpc11u6x_uartx_isr_config_2(dev); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) */ #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ return 0; @@ -876,44 +876,44 @@ DEVICE_DT_DEFINE(DT_NODELABEL(uart##idx), \ PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ &uartx_api) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) LPC11U6X_UARTX_INIT(1); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) LPC11U6X_UARTX_INIT(2); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) LPC11U6X_UARTX_INIT(3); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) LPC11U6X_UARTX_INIT(4); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) */ #if CONFIG_UART_INTERRUPT_DRIVEN && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4))) struct lpc11u6x_uartx_shared_irq lpc11u6x_uartx_shared_irq_info_1 = { .devices = { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) DEVICE_DT_GET(DT_NODELABEL(uart1)), #else NULL, -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) */ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) DEVICE_DT_GET(DT_NODELABEL(uart4)), #else NULL, -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) */ }, }; static void lpc11u6x_uartx_isr_config_1(const struct device *dev) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) IRQ_CONNECT(DT_IRQN(DT_NODELABEL(uart1)), DT_IRQ(DT_NODELABEL(uart1), priority), lpc11u6x_uartx_shared_isr, @@ -927,34 +927,34 @@ static void lpc11u6x_uartx_isr_config_1(const struct device *dev) &lpc11u6x_uartx_shared_irq_info_1, 0); irq_enable(DT_IRQN(DT_NODELABEL(uart4))); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) */ } #endif /* CONFIG_UART_INTERRUPT_DRIVEN && - * (DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay)) + * (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4))) */ #if CONFIG_UART_INTERRUPT_DRIVEN && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3))) struct lpc11u6x_uartx_shared_irq lpc11u6x_uartx_shared_irq_info_2 = { .devices = { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) DEVICE_DT_GET(DT_NODELABEL(uart2)), #else NULL, -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) */ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) DEVICE_DT_GET(DT_NODELABEL(uart3)), #else NULL, -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) */ }, }; static void lpc11u6x_uartx_isr_config_2(const struct device *dev) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) IRQ_CONNECT(DT_IRQN(DT_NODELABEL(uart2)), DT_IRQ(DT_NODELABEL(uart2), priority), lpc11u6x_uartx_shared_isr, @@ -968,11 +968,11 @@ static void lpc11u6x_uartx_isr_config_2(const struct device *dev) &lpc11u6x_uartx_shared_irq_info_2, 0); irq_enable(DT_IRQN(DT_NODELABEL(uart3))); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) */ } #endif /* CONFIG_UART_INTERRUPT_DRIVEN && - * (DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay)) + * (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3))) */ #endif /* DT_NODE_EXISTS(DT_NODELABEL(uart1) || * DT_NODE_EXISTS(DT_NODELABEL(uart2) || diff --git a/drivers/serial/uart_lpc11u6x.h b/drivers/serial/uart_lpc11u6x.h index 8951945e65a..257846cbdd4 100644 --- a/drivers/serial/uart_lpc11u6x.h +++ b/drivers/serial/uart_lpc11u6x.h @@ -199,20 +199,20 @@ struct lpc11u6x_uartx_shared_irq { }; #if CONFIG_UART_INTERRUPT_DRIVEN && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4))) static void lpc11u6x_uartx_isr_config_1(const struct device *dev); #endif /* CONFIG_UART_INTERRUPT_DRIVEN && - * (DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay)) + * (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3))) */ #if CONFIG_UART_INTERRUPT_DRIVEN && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3))) static void lpc11u6x_uartx_isr_config_2(const struct device *dev); #endif /* CONFIG_UART_INTERRUPT_DRIVEN && - * (DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay)) + * (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3))) */ #endif /* ZEPHYR_DRIVERS_SERIAL_UART_LPC11U6X_H_ */ diff --git a/drivers/serial/uart_miv.c b/drivers/serial/uart_miv.c index bf35b4cf656..d1b5cfb0e26 100644 --- a/drivers/serial/uart_miv.c +++ b/drivers/serial/uart_miv.c @@ -387,7 +387,7 @@ static const struct uart_driver_api uart_miv_driver_api = { BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1, "unsupported uart_miv instance"); -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) static struct uart_miv_data uart_miv_data_0; @@ -424,4 +424,4 @@ static void uart_miv_irq_cfg_func_0(const struct device *dev) } #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ diff --git a/drivers/spi/spi_smartbond.c b/drivers/spi/spi_smartbond.c index 324273bc12e..7a2be279e98 100644 --- a/drivers/spi/spi_smartbond.c +++ b/drivers/spi/spi_smartbond.c @@ -1227,11 +1227,11 @@ static int spi_smartbond_isr_connect(const struct device *dev) switch ((uint32_t)cfg->regs) { case (uint32_t)SPI: - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(spi), okay), + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(spi)), (SPI_SMARTBOND_ISR_CONNECT), (NULL)); break; case (uint32_t)SPI2: - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(spi2), okay), + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(spi2)), (SPI2_SMARTBOND_ISR_CONNECT), (NULL)); break; default: diff --git a/drivers/spi/spi_xec_qmspi.c b/drivers/spi/spi_xec_qmspi.c index f606f3145c3..02cd34d259f 100644 --- a/drivers/spi/spi_xec_qmspi.c +++ b/drivers/spi/spi_xec_qmspi.c @@ -681,7 +681,7 @@ static const struct spi_driver_api spi_qmspi_driver_api = { DT_INST_PROP(0, dldh), \ DT_INST_PROP(0, dcsda)) -#if DT_NODE_HAS_STATUS(DT_INST(0, microchip_xec_qmspi), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, microchip_xec_qmspi)) PINCTRL_DT_INST_DEFINE(0); @@ -708,4 +708,4 @@ DEVICE_DT_INST_DEFINE(0, &spi_qmspi_0_config, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, &spi_qmspi_driver_api); -#endif /* DT_NODE_HAS_STATUS(DT_INST(0, microchip_xec_qmspi), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_INST(0, microchip_xec_qmspi)) */ diff --git a/drivers/timer/mcux_os_timer.c b/drivers/timer/mcux_os_timer.c index 74580e684b0..c6eb776e43a 100644 --- a/drivers/timer/mcux_os_timer.c +++ b/drivers/timer/mcux_os_timer.c @@ -36,7 +36,7 @@ static OSTIMER_Type *base; * certain deep sleep modes and the time elapsed when it is powered off. */ static uint64_t cyc_sys_compensated; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(standby), okay) && CONFIG_PM +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM static const struct device *counter_dev; #endif @@ -71,7 +71,7 @@ void mcux_lpc_ostick_isr(const void *arg) sys_clock_announce(IS_ENABLED(CONFIG_TICKLESS_KERNEL) ? dticks : 1); } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(standby), okay) && CONFIG_PM +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM /* The OS Timer is disabled in certain low power modes and cannot wakeup the system * on timeout. This function will be called by the low power code to allow the @@ -178,7 +178,7 @@ void sys_clock_set_timeout(int32_t ticks, bool idle) return; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(standby), okay) && CONFIG_PM +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM if (idle) { /* OS Timer may not be able to wakeup in certain low power modes. * For these cases, we start a counter that can wakeup @@ -247,7 +247,7 @@ uint64_t sys_clock_cycle_get_64(void) void sys_clock_idle_exit(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(standby), okay) && CONFIG_PM +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM /* The tick should be compensated for states where the * OS Timer is disabled */ @@ -280,7 +280,7 @@ static int sys_clock_driver_init(void) irq_enable(DT_INST_IRQN(0)); /* On some SoC's, OS Timer cannot wakeup from low power mode in standby modes */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(standby), okay) && CONFIG_PM +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM counter_dev = DEVICE_DT_GET_OR_NULL(DT_INST_PHANDLE(0, deep_sleep_counter)); #endif diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 07d58e402c9..fb9c859caeb 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -426,7 +426,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) nrfy_grtc_timeout_get(NRF_GRTC) * CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / 32768 + MAX_CC_LATCH_WAIT_TIME_US; k_busy_wait(wait_time); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lfxo), okay) && NRF_GRTC_HAS_CLKSEL +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lfxo)) && NRF_GRTC_HAS_CLKSEL nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); #endif k_spin_unlock(&lock, key); @@ -502,7 +502,7 @@ static int sys_clock_driver_init(void) #endif #if defined(CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(lfxo), okay) && NRF_GRTC_HAS_CLKSEL + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lfxo)) && NRF_GRTC_HAS_CLKSEL /* Switch to LFXO as the low-frequency clock source. */ nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); #endif diff --git a/drivers/timer/smartbond_timer.c b/drivers/timer/smartbond_timer.c index ceef22ce5fa..afa86617e0e 100644 --- a/drivers/timer/smartbond_timer.c +++ b/drivers/timer/smartbond_timer.c @@ -199,7 +199,7 @@ static int sys_clock_driver_init(void) uint8_t pdc_idx; uint8_t en_xtal; - en_xtal = DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay) ? MCU_PDC_EN_XTAL : 0; + en_xtal = DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xtal32m)) ? MCU_PDC_EN_XTAL : 0; /* Enable wakeup by TIMER2 */ pdc_idx = da1469x_pdc_add(MCU_PDC_TRIGGER_TIMER2, MCU_PDC_MASTER_M33, en_xtal); diff --git a/drivers/usb/device/usb_dc_mcux.c b/drivers/usb/device/usb_dc_mcux.c index b28499db1d6..14a8918d106 100644 --- a/drivers/usb/device/usb_dc_mcux.c +++ b/drivers/usb/device/usb_dc_mcux.c @@ -84,17 +84,17 @@ BUILD_ASSERT(NUM_INSTS <= 1, "Only one USB device supported"); #elif defined(CONFIG_SOC_LPC55S36) #define CONTROLLER_ID kUSB_ControllerLpcIp3511Fs0 #elif defined(CONFIG_SOC_LPC55S69_CPU0) || defined(CONFIG_SOC_LPC55S69_CPU1) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usbhs), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usbhs)) #define CONTROLLER_ID kUSB_ControllerLpcIp3511Hs0 -#elif DT_NODE_HAS_STATUS(DT_NODELABEL(usbfs), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usbfs)) #define CONTROLLER_ID kUSB_ControllerLpcIp3511Fs0 #endif /* LPC55s69 */ #elif defined(CONFIG_SOC_SERIES_IMXRT11XX) || \ defined(CONFIG_SOC_SERIES_IMXRT10XX) || \ defined(CONFIG_SOC_SERIES_MCXN) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) #define CONTROLLER_ID kUSB_ControllerEhci0 -#elif DT_NODE_HAS_STATUS(DT_NODELABEL(usb2), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb2)) #define CONTROLLER_ID kUSB_ControllerEhci1 #endif /* IMX RT */ #elif defined(CONFIG_SOC_SERIES_RW6XX) diff --git a/drivers/usb/device/usb_dc_nrfx.c b/drivers/usb/device/usb_dc_nrfx.c index a165c24f789..c8442cb8f64 100644 --- a/drivers/usb/device/usb_dc_nrfx.c +++ b/drivers/usb/device/usb_dc_nrfx.c @@ -1900,8 +1900,8 @@ static int usb_init(void) == NRF5X_REG_MODE_DCDC), #if NRFX_POWER_SUPPORTS_DCDCEN_VDDH .dcdcenhv = COND_CODE_1(CONFIG_SOC_SERIES_NRF52X, - (DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf52x_regulator_hv), okay)), - (DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf53x_regulator_hv), okay))), + (DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf52x_regulator_hv))), + (DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf53x_regulator_hv)))), #endif }; diff --git a/drivers/usb/udc/udc_nrf.c b/drivers/usb/udc/udc_nrf.c index c6951074c85..c024d2a6a18 100644 --- a/drivers/usb/udc/udc_nrf.c +++ b/drivers/usb/udc/udc_nrf.c @@ -824,8 +824,8 @@ static const struct udc_nrf_config udc_nrf_cfg = { == NRF5X_REG_MODE_DCDC), #if NRFX_POWER_SUPPORTS_DCDCEN_VDDH .dcdcenhv = COND_CODE_1(CONFIG_SOC_SERIES_NRF52X, - (DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf52x_regulator_hv), okay)), - (DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf53x_regulator_hv), okay))), + (DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf52x_regulator_hv))), + (DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf53x_regulator_hv)))), #endif }, diff --git a/drivers/watchdog/wdt_esp32.c b/drivers/watchdog/wdt_esp32.c index 8fe4c877fd0..1c7ee61ee64 100644 --- a/drivers/watchdog/wdt_esp32.c +++ b/drivers/watchdog/wdt_esp32.c @@ -226,10 +226,10 @@ static void wdt_esp32_isr(void *arg) } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(wdt0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(wdt0)) ESP32_WDT_INIT(0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(wdt1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(wdt1)) ESP32_WDT_INIT(1); #endif diff --git a/include/zephyr/device.h b/include/zephyr/device.h index 52b8604db80..5f93954a9ff 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -309,7 +309,7 @@ typedef int16_t device_handle_t; * @return a @ref device reference for the node identifier, which may be `NULL`. */ #define DEVICE_DT_GET_OR_NULL(node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(node_id), \ (DEVICE_DT_GET(node_id)), (NULL)) /** diff --git a/include/zephyr/drivers/clock_control/stm32_clock_control.h b/include/zephyr/drivers/clock_control/stm32_clock_control.h index c33714be976..b03fa790027 100644 --- a/include/zephyr/drivers/clock_control/stm32_clock_control.h +++ b/include/zephyr/drivers/clock_control/stm32_clock_control.h @@ -250,7 +250,7 @@ #endif /** PLL/PLL1 clock source */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll)) && \ DT_NODE_HAS_PROP(DT_NODELABEL(pll), clocks) #define DT_PLL_CLOCKS_CTRL DT_CLOCKS_CTLR(DT_NODELABEL(pll)) #if DT_SAME_NODE(DT_PLL_CLOCKS_CTRL, DT_NODELABEL(clk_msi)) @@ -275,7 +275,7 @@ #endif /** PLL2 clock source */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll2), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll2)) && \ DT_NODE_HAS_PROP(DT_NODELABEL(pll2), clocks) #define DT_PLL2_CLOCKS_CTRL DT_CLOCKS_CTLR(DT_NODELABEL(pll2)) #if DT_SAME_NODE(DT_PLL2_CLOCKS_CTRL, DT_NODELABEL(clk_msis)) @@ -291,7 +291,7 @@ #endif /** PLL3 clock source */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll3), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll3)) && \ DT_NODE_HAS_PROP(DT_NODELABEL(pll3), clocks) #define DT_PLL3_CLOCKS_CTRL DT_CLOCKS_CTLR(DT_NODELABEL(pll3)) #if DT_SAME_NODE(DT_PLL3_CLOCKS_CTRL, DT_NODELABEL(clk_msis)) diff --git a/include/zephyr/drivers/emul.h b/include/zephyr/drivers/emul.h index c0830bb0205..a20679573e4 100644 --- a/include/zephyr/drivers/emul.h +++ b/include/zephyr/drivers/emul.h @@ -195,7 +195,7 @@ struct emul { * @return a @ref emul reference for the node identifier, which may be `NULL`. */ #define EMUL_DT_GET_OR_NULL(node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), (EMUL_DT_GET(node_id)), (NULL)) + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(node_id), (EMUL_DT_GET(node_id)), (NULL)) /** * @brief Set up a list of emulators diff --git a/include/zephyr/linker/linker-defs.h b/include/zephyr/linker/linker-defs.h index 5c1089c0fcf..ff3cbe6ca6c 100644 --- a/include/zephyr/linker/linker-defs.h +++ b/include/zephyr/linker/linker-defs.h @@ -32,6 +32,7 @@ */ #ifdef ZTEST_UNITTEST #define DT_NODE_HAS_STATUS(node, status) 0 +#define DT_NODE_HAS_STATUS_OKAY(node) 0 #else #include #endif @@ -159,7 +160,7 @@ extern char __gcov_bss_size[]; /* end address of image, used by newlib for the heap */ extern char _end[]; -#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ccm))) extern char __ccm_data_rom_start[]; extern char __ccm_start[]; extern char __ccm_data_start[]; @@ -171,14 +172,14 @@ extern char __ccm_noinit_end[]; extern char __ccm_end[]; #endif -#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_itcm))) extern char __itcm_start[]; extern char __itcm_end[]; extern char __itcm_size[]; extern char __itcm_load_start[]; #endif -#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm))) extern char __dtcm_data_start[]; extern char __dtcm_data_end[]; extern char __dtcm_bss_start[]; @@ -190,7 +191,7 @@ extern char __dtcm_start[]; extern char __dtcm_end[]; #endif -#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ocm), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ocm))) extern char __ocm_data_start[]; extern char __ocm_data_end[]; extern char __ocm_bss_start[]; diff --git a/include/zephyr/pm/state.h b/include/zephyr/pm/state.h index 87363ea27d2..6590b90c385 100644 --- a/include/zephyr/pm/state.h +++ b/include/zephyr/pm/state.h @@ -194,7 +194,7 @@ struct pm_state_constraint { * @param idx Index within the array. */ #define Z_DT_PHANDLE_01(node_id, prop, idx) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_PHANDLE_BY_IDX(node_id, prop, idx), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, prop, idx)), \ (1), (0)) /** @@ -207,7 +207,7 @@ struct pm_state_constraint { * @param node_id A node identifier with compatible zephyr,power-state */ #define Z_PM_STATE_INFO_FROM_DT_CPU(i, node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)), \ (PM_STATE_INFO_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)),), ()) /** @@ -220,7 +220,7 @@ struct pm_state_constraint { * @param node_id A node identifier with compatible zephyr,power-state */ #define Z_PM_STATE_FROM_DT_CPU(i, node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)), \ (PM_STATE_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)),), ()) /** @endcond */ diff --git a/kernel/init.c b/kernel/init.c index 1c24c5fc2b2..cd361e74936 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -226,17 +226,17 @@ void z_bss_zero(void) } z_early_memset(__bss_start, 0, __bss_end - __bss_start); -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ccm)) z_early_memset(&__ccm_bss_start, 0, (uintptr_t) &__ccm_bss_end - (uintptr_t) &__ccm_bss_start); #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) z_early_memset(&__dtcm_bss_start, 0, (uintptr_t) &__dtcm_bss_end - (uintptr_t) &__dtcm_bss_start); #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ocm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ocm)) z_early_memset(&__ocm_bss_start, 0, (uintptr_t) &__ocm_bss_end - (uintptr_t) &__ocm_bss_start); diff --git a/kernel/xip.c b/kernel/xip.c index a5752560c85..34e92ef1844 100644 --- a/kernel/xip.c +++ b/kernel/xip.c @@ -31,15 +31,15 @@ void z_data_copy(void) z_early_memcpy(&__ramfunc_start, &__ramfunc_load_start, (uintptr_t) &__ramfunc_size); #endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */ -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ccm)) z_early_memcpy(&__ccm_data_start, &__ccm_data_rom_start, __ccm_data_end - __ccm_data_start); #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_itcm)) z_early_memcpy(&__itcm_start, &__itcm_load_start, (uintptr_t) &__itcm_size); #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) z_early_memcpy(&__dtcm_data_start, &__dtcm_data_load_start, __dtcm_data_end - __dtcm_data_start); #endif diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index c7a7f169c01..47a12f90925 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -1006,7 +1006,7 @@ #define NRFX_IPCT_PUB_OR_SUB_MASK(inst_num) \ COND_CODE_1(IS_EMPTY(inst_num), \ - (DT_NODE_HAS_STATUS(NRFX_CONFIG_IPCT_LOCAL_NODE, okay)), \ + (DT_NODE_HAS_STATUS_OKAY(NRFX_CONFIG_IPCT_LOCAL_NODE)), \ (DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(ipct, inst_num)), owned_channels))) /* Variables names generation. */ diff --git a/samples/basic/button/src/main.c b/samples/basic/button/src/main.c index b181afcc34e..a86407a65c2 100644 --- a/samples/basic/button/src/main.c +++ b/samples/basic/button/src/main.c @@ -18,7 +18,7 @@ * Get button configuration from the devicetree sw0 alias. This is mandatory. */ #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, diff --git a/samples/basic/threads/src/main.c b/samples/basic/threads/src/main.c index 0554ddd9daf..529df15908a 100644 --- a/samples/basic/threads/src/main.c +++ b/samples/basic/threads/src/main.c @@ -20,11 +20,11 @@ #define LED0_NODE DT_ALIAS(led0) #define LED1_NODE DT_ALIAS(led1) -#if !DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(LED0_NODE) #error "Unsupported board: led0 devicetree alias is not defined" #endif -#if !DT_NODE_HAS_STATUS(LED1_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(LED1_NODE) #error "Unsupported board: led1 devicetree alias is not defined" #endif diff --git a/samples/bluetooth/central_otc/src/main.c b/samples/bluetooth/central_otc/src/main.c index 23a2968e14a..171bbe7187c 100644 --- a/samples/bluetooth/central_otc/src/main.c +++ b/samples/bluetooth/central_otc/src/main.c @@ -77,8 +77,8 @@ static void print_hex_number(const uint8_t *num, size_t len) #define SW1_NODE DT_ALIAS(sw1) #define SW2_NODE DT_ALIAS(sw2) #define SW3_NODE DT_ALIAS(sw3) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) || !DT_NODE_HAS_STATUS(SW1_NODE, okay) || \ - !DT_NODE_HAS_STATUS(SW2_NODE, okay) || !DT_NODE_HAS_STATUS(SW3_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) || !DT_NODE_HAS_STATUS_OKAY(SW1_NODE) || \ + !DT_NODE_HAS_STATUS_OKAY(SW2_NODE) || !DT_NODE_HAS_STATUS_OKAY(SW3_NODE) #error "Unsupported board: This sample need 4 buttons to run" #endif diff --git a/samples/bluetooth/encrypted_advertising/central/src/main.c b/samples/bluetooth/encrypted_advertising/central/src/main.c index 888940af780..122641b311a 100644 --- a/samples/bluetooth/encrypted_advertising/central/src/main.c +++ b/samples/bluetooth/encrypted_advertising/central/src/main.c @@ -30,7 +30,7 @@ LOG_MODULE_DECLARE(ead_central_sample, CONFIG_BT_EAD_LOG_LEVEL); * Get button configuration from the devicetree sw0 alias. This is mandatory. */ #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0}); diff --git a/samples/bluetooth/encrypted_advertising/peripheral/src/main.c b/samples/bluetooth/encrypted_advertising/peripheral/src/main.c index 6b269d30513..affa5430af2 100644 --- a/samples/bluetooth/encrypted_advertising/peripheral/src/main.c +++ b/samples/bluetooth/encrypted_advertising/peripheral/src/main.c @@ -26,7 +26,7 @@ LOG_MODULE_DECLARE(ead_peripheral_sample, CONFIG_BT_EAD_LOG_LEVEL); * Get button configuration from the devicetree sw0 alias. This is mandatory. */ #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0}); diff --git a/samples/bluetooth/iso_receive/src/main.c b/samples/bluetooth/iso_receive/src/main.c index 3b7c051f387..989694907b4 100644 --- a/samples/bluetooth/iso_receive/src/main.c +++ b/samples/bluetooth/iso_receive/src/main.c @@ -42,7 +42,7 @@ static K_SEM_DEFINE(sem_big_sync_lost, 0, BIS_ISO_CHAN_COUNT); /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) -#if DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(LED0_NODE) static const struct gpio_dt_spec led_gpio = GPIO_DT_SPEC_GET(LED0_NODE, gpios); #define HAS_LED 1 #define BLINK_ONOFF K_MSEC(500) diff --git a/samples/bluetooth/mesh_provisioner/src/main.c b/samples/bluetooth/mesh_provisioner/src/main.c index 472dc020d43..d4be8601304 100644 --- a/samples/bluetooth/mesh_provisioner/src/main.c +++ b/samples/bluetooth/mesh_provisioner/src/main.c @@ -20,7 +20,7 @@ static uint8_t node_uuid[16]; K_SEM_DEFINE(sem_unprov_beacon, 0, 1); K_SEM_DEFINE(sem_node_added, 0, 1); -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) K_SEM_DEFINE(sem_button_pressed, 0, 1); #endif @@ -315,7 +315,7 @@ static uint8_t check_unconfigured(struct bt_mesh_cdb_node *node, void *data) return BT_MESH_CDB_ITER_CONTINUE; } -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0}); static struct gpio_callback button_cb_data; @@ -366,7 +366,7 @@ int main(void) printk("Bluetooth initialized\n"); bt_ready(); -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) button_init(); #endif @@ -383,7 +383,7 @@ int main(void) bin2hex(node_uuid, 16, uuid_hex_str, sizeof(uuid_hex_str)); -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) k_sem_reset(&sem_button_pressed); printk("Device %s detected, press button 1 to provision.\n", uuid_hex_str); err = k_sem_take(&sem_button_pressed, K_SECONDS(30)); diff --git a/samples/bluetooth/periodic_sync/src/main.c b/samples/bluetooth/periodic_sync/src/main.c index 44c5a8530b4..a8baf5d2600 100644 --- a/samples/bluetooth/periodic_sync/src/main.c +++ b/samples/bluetooth/periodic_sync/src/main.c @@ -24,7 +24,7 @@ static K_SEM_DEFINE(sem_per_sync_lost, 0, 1); /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) -#if DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(LED0_NODE) #define HAS_LED 1 static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios); #define BLINK_ONOFF K_MSEC(500) diff --git a/samples/bluetooth/peripheral_hids/src/hog.c b/samples/bluetooth/peripheral_hids/src/hog.c index cf67521517d..9aefdf2ea98 100644 --- a/samples/bluetooth/peripheral_hids/src/hog.c +++ b/samples/bluetooth/peripheral_hids/src/hog.c @@ -180,7 +180,7 @@ void hog_init(void) void hog_button_loop(void) { -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) const struct gpio_dt_spec sw0 = GPIO_DT_SPEC_GET(SW0_NODE, gpios); gpio_pin_configure_dt(&sw0, GPIO_INPUT); diff --git a/samples/bluetooth/peripheral_hr/src/main.c b/samples/bluetooth/peripheral_hr/src/main.c index 8d7f73e5440..19c640ca91b 100644 --- a/samples/bluetooth/peripheral_hr/src/main.c +++ b/samples/bluetooth/peripheral_hr/src/main.c @@ -123,7 +123,7 @@ static void hrs_notify(void) /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) -#if DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(LED0_NODE) #include #define HAS_LED 1 static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios); diff --git a/samples/boards/espressif/deep_sleep/src/main.c b/samples/boards/espressif/deep_sleep/src/main.c index edf8b559705..519a1a550df 100644 --- a/samples/boards/espressif/deep_sleep/src/main.c +++ b/samples/boards/espressif/deep_sleep/src/main.c @@ -17,7 +17,7 @@ #endif #ifdef CONFIG_EXAMPLE_GPIO_WAKEUP -#if !DT_NODE_HAS_STATUS(DT_ALIAS(wakeup_button), okay) +#if !DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(wakeup_button)) #error "Unsupported: wakeup-button alias is not defined" #else static const struct gpio_dt_spec wakeup_button = GPIO_DT_SPEC_GET(DT_ALIAS(wakeup_button), gpios); diff --git a/samples/boards/espressif/light_sleep/src/main.c b/samples/boards/espressif/light_sleep/src/main.c index 50cb920d159..9134f6a2006 100644 --- a/samples/boards/espressif/light_sleep/src/main.c +++ b/samples/boards/espressif/light_sleep/src/main.c @@ -16,7 +16,7 @@ */ #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "unsupported board: sw0 devicetree alias is not defined" #endif diff --git a/samples/boards/nordic/battery/src/battery.c b/samples/boards/nordic/battery/src/battery.c index a0fbb651b58..3a31a91398b 100644 --- a/samples/boards/nordic/battery/src/battery.c +++ b/samples/boards/nordic/battery/src/battery.c @@ -51,7 +51,7 @@ struct divider_config { }; static const struct divider_config divider_config = { -#if DT_NODE_HAS_STATUS(VBATT, okay) +#if DT_NODE_HAS_STATUS_OKAY(VBATT) .io_channel = { DT_IO_CHANNELS_INPUT(VBATT), }, @@ -72,7 +72,7 @@ struct divider_data { int16_t raw; }; static struct divider_data divider_data = { -#if DT_NODE_HAS_STATUS(VBATT, okay) +#if DT_NODE_HAS_STATUS_OKAY(VBATT) .adc = DEVICE_DT_GET(DT_IO_CHANNELS_CTLR(VBATT)), #else .adc = DEVICE_DT_GET(DT_IO_CHANNELS_CTLR(ZEPHYR_USER)), diff --git a/samples/boards/nxp/mimxrt1060_evk/system_off/src/main.c b/samples/boards/nxp/mimxrt1060_evk/system_off/src/main.c index 57b0298f861..af5dbf4b845 100644 --- a/samples/boards/nxp/mimxrt1060_evk/system_off/src/main.c +++ b/samples/boards/nxp/mimxrt1060_evk/system_off/src/main.c @@ -17,12 +17,12 @@ #define SOFT_OFF_S 10U #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif #define SNVS_RTC_NODE DT_NODELABEL(snvs_rtc) -#if !DT_NODE_HAS_STATUS(SNVS_RTC_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SNVS_RTC_NODE) #error "Unsupported board: snvs_rtc node is not enabled" #endif diff --git a/samples/boards/st/i2c_timing/src/main.c b/samples/boards/st/i2c_timing/src/main.c index 41b8dfa2dee..80f8001318d 100644 --- a/samples/boards/st/i2c_timing/src/main.c +++ b/samples/boards/st/i2c_timing/src/main.c @@ -10,7 +10,7 @@ #include -#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_0)) #define I2C_DEV_NODE DT_ALIAS(i2c_0) #else #error "Please set the correct I2C device" diff --git a/samples/boards/st/mco/src/main.c b/samples/boards/st/mco/src/main.c index 966e80f8525..7e79d1e8cd8 100644 --- a/samples/boards/st/mco/src/main.c +++ b/samples/boards/st/mco/src/main.c @@ -25,7 +25,7 @@ int main(void) return -1; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(mco2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mco2)) dev = DEVICE_DT_GET(DT_NODELABEL(mco2)); if (device_is_ready(dev)) { printk("MCO2 device successfully configured\n"); diff --git a/samples/boards/st/power_mgmt/standby_shutdown/src/main.c b/samples/boards/st/power_mgmt/standby_shutdown/src/main.c index 6610f01f955..b74051bc99f 100644 --- a/samples/boards/st/power_mgmt/standby_shutdown/src/main.c +++ b/samples/boards/st/power_mgmt/standby_shutdown/src/main.c @@ -23,7 +23,7 @@ #define SLEEP_TIME_MS 3000 #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif diff --git a/samples/boards/st/power_mgmt/wkup_pins/src/main.c b/samples/boards/st/power_mgmt/wkup_pins/src/main.c index 2284a76b035..c83db862d43 100644 --- a/samples/boards/st/power_mgmt/wkup_pins/src/main.c +++ b/samples/boards/st/power_mgmt/wkup_pins/src/main.c @@ -15,7 +15,7 @@ #define WAIT_TIME_US 4000000 #define WKUP_SRC_NODE DT_ALIAS(wkup_src) -#if !DT_NODE_HAS_STATUS(WKUP_SRC_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(WKUP_SRC_NODE) #error "Unsupported board: wkup_src devicetree alias is not defined" #endif diff --git a/samples/drivers/espi/src/main.c b/samples/drivers/espi/src/main.c index fff0998459d..aa6b92a4725 100644 --- a/samples/drivers/espi/src/main.c +++ b/samples/drivers/espi/src/main.c @@ -45,7 +45,7 @@ LOG_MODULE_DECLARE(espi, CONFIG_ESPI_LOG_LEVEL); /* The devicetree node identifier for the board power rails pins. */ #define BRD_PWR_NODE DT_NODELABEL(board_power) -#if DT_NODE_HAS_STATUS(BRD_PWR_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(BRD_PWR_NODE) static const struct gpio_dt_spec pwrgd_gpio = GPIO_DT_SPEC_GET(BRD_PWR_NODE, pwrg_gpios); static const struct gpio_dt_spec rsm_gpio = GPIO_DT_SPEC_GET(BRD_PWR_NODE, rsm_gpios); #endif @@ -911,7 +911,7 @@ int espi_init(void) return ret; } -#if DT_NODE_HAS_STATUS(BRD_PWR_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(BRD_PWR_NODE) static int wait_for_pin(const struct gpio_dt_spec *gpio, uint16_t timeout, int exp_level) { uint16_t loop_cnt = timeout; @@ -1172,7 +1172,7 @@ int espi_test(void) */ k_sleep(K_SECONDS(1)); -#if DT_NODE_HAS_STATUS(BRD_PWR_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(BRD_PWR_NODE) if (!gpio_is_ready_dt(&pwrgd_gpio)) { LOG_ERR("%s: device not ready.", pwrgd_gpio.port->name); return -ENODEV; @@ -1201,7 +1201,7 @@ int espi_test(void) LOG_INF("Hello eSPI test %s", CONFIG_BOARD); -#if DT_NODE_HAS_STATUS(BRD_PWR_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(BRD_PWR_NODE) ret = gpio_pin_configure_dt(&pwrgd_gpio, GPIO_INPUT); if (ret) { LOG_ERR("Unable to configure %d:%d", pwrgd_gpio.pin, ret); @@ -1252,7 +1252,7 @@ int espi_test(void) } #endif -#if DT_NODE_HAS_STATUS(BRD_PWR_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(BRD_PWR_NODE) ret = wait_for_pin(&pwrgd_gpio, PWR_SEQ_TIMEOUT, 1); if (ret) { LOG_ERR("RSMRST_PWRGD timeout"); diff --git a/samples/drivers/i2s/echo/src/main.c b/samples/drivers/i2s/echo/src/main.c index c0ac1505d7b..bffa794158b 100644 --- a/samples/drivers/i2s/echo/src/main.c +++ b/samples/drivers/i2s/echo/src/main.c @@ -30,12 +30,12 @@ #define TIMEOUT 1000 #define SW0_NODE DT_ALIAS(sw0) -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) static struct gpio_dt_spec sw0_spec = GPIO_DT_SPEC_GET(SW0_NODE, gpios); #endif #define SW1_NODE DT_ALIAS(sw1) -#if DT_NODE_HAS_STATUS(SW1_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW1_NODE) static struct gpio_dt_spec sw1_spec = GPIO_DT_SPEC_GET(SW1_NODE, gpios); #endif @@ -47,7 +47,7 @@ static int16_t echo_block[SAMPLES_PER_BLOCK]; static volatile bool echo_enabled = true; static K_SEM_DEFINE(toggle_transfer, 1, 1); -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) static void sw0_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins) { @@ -58,7 +58,7 @@ static void sw0_handler(const struct device *dev, struct gpio_callback *cb, } #endif -#if DT_NODE_HAS_STATUS(SW1_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW1_NODE) static void sw1_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins) { @@ -70,7 +70,7 @@ static bool init_buttons(void) { int ret; -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) static struct gpio_callback sw0_cb_data; if (!gpio_is_ready_dt(&sw0_spec)) { @@ -98,7 +98,7 @@ static bool init_buttons(void) printk("Press \"%s\" to toggle the echo effect\n", sw0_spec.port->name); #endif -#if DT_NODE_HAS_STATUS(SW1_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW1_NODE) static struct gpio_callback sw1_cb_data; if (!gpio_is_ready_dt(&sw1_spec)) { diff --git a/samples/drivers/lora/receive/src/main.c b/samples/drivers/lora/receive/src/main.c index 9b503354001..e6ba6086ae0 100644 --- a/samples/drivers/lora/receive/src/main.c +++ b/samples/drivers/lora/receive/src/main.c @@ -11,7 +11,7 @@ #include #define DEFAULT_RADIO_NODE DT_ALIAS(lora0) -BUILD_ASSERT(DT_NODE_HAS_STATUS(DEFAULT_RADIO_NODE, okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DEFAULT_RADIO_NODE), "No default LoRa radio specified in DT"); #define MAX_DATA_LEN 255 diff --git a/samples/drivers/lora/send/src/main.c b/samples/drivers/lora/send/src/main.c index 63cce8367af..7988fa8762e 100644 --- a/samples/drivers/lora/send/src/main.c +++ b/samples/drivers/lora/send/src/main.c @@ -11,7 +11,7 @@ #include #define DEFAULT_RADIO_NODE DT_ALIAS(lora0) -BUILD_ASSERT(DT_NODE_HAS_STATUS(DEFAULT_RADIO_NODE, okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DEFAULT_RADIO_NODE), "No default LoRa radio specified in DT"); #define MAX_DATA_LEN 10 diff --git a/samples/shields/x_nucleo_53l0a1/src/main.c b/samples/shields/x_nucleo_53l0a1/src/main.c index e2688eec21b..9de9469ba7d 100644 --- a/samples/shields/x_nucleo_53l0a1/src/main.c +++ b/samples/shields/x_nucleo_53l0a1/src/main.c @@ -15,7 +15,7 @@ * Get button configuration from the devicetree sw0 alias. This is mandatory. */ #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif diff --git a/samples/subsys/mgmt/osdp/control_panel/src/main.c b/samples/subsys/mgmt/osdp/control_panel/src/main.c index 1942e822733..2b58692e926 100644 --- a/samples/subsys/mgmt/osdp/control_panel/src/main.c +++ b/samples/subsys/mgmt/osdp/control_panel/src/main.c @@ -12,7 +12,7 @@ /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) -#if !DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(LED0_NODE) #error "BOARD does not define a debug LED" #endif diff --git a/samples/subsys/mgmt/osdp/peripheral_device/src/main.c b/samples/subsys/mgmt/osdp/peripheral_device/src/main.c index 8ffdd10f081..74d4fed6d2c 100644 --- a/samples/subsys/mgmt/osdp/peripheral_device/src/main.c +++ b/samples/subsys/mgmt/osdp/peripheral_device/src/main.c @@ -12,7 +12,7 @@ /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) -#if !DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(LED0_NODE) #error "BOARD does not define a debug LED" #endif diff --git a/samples/subsys/task_wdt/src/main.c b/samples/subsys/task_wdt/src/main.c index f06ef1faef2..a366b3683eb 100644 --- a/samples/subsys/task_wdt/src/main.c +++ b/samples/subsys/task_wdt/src/main.c @@ -21,7 +21,7 @@ * from there. Otherwise, the task watchdog will be used without a * hardware watchdog fallback. */ -#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(watchdog0)) #define WDT_NODE DT_ALIAS(watchdog0) #elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_window_watchdog) #define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(st_stm32_window_watchdog) diff --git a/soc/arm/beetle/power.c b/soc/arm/beetle/power.c index 4377d79d3f0..700969f4673 100644 --- a/soc/arm/beetle/power.c +++ b/soc/arm/beetle/power.c @@ -11,13 +11,13 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) #define CLK_BIT_GPIO0 _BEETLE_GPIO0 #else #define CLK_BIT_GPIO0 0 #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) #define CLK_BIT_GPIO1 _BEETLE_GPIO1 #else #define CLK_BIT_GPIO1 0 @@ -25,13 +25,13 @@ #define AHB_CLK_BITS (CLK_BIT_GPIO0 | CLK_BIT_GPIO1) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(timer0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(timer0)) #define CLK_BIT_TIMER0 _BEETLE_TIMER0 #else #define CLK_BIT_TIMER0 0 #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(timer1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(timer1)) #define CLK_BIT_TIMER1 _BEETLE_TIMER1 #else #define CLK_BIT_TIMER1 0 @@ -43,13 +43,13 @@ #define CLK_BIT_WDOG 0 #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) #define CLK_BIT_UART0 _BEETLE_UART0 #else #define CLK_BIT_UART0 0 #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) #define CLK_BIT_UART1 _BEETLE_UART1 #else #define CLK_BIT_UART1 0 diff --git a/soc/atmel/sam/common/soc_power.c b/soc/atmel/sam/common/soc_power.c index 08499b98b10..0b477f9fbe9 100644 --- a/soc/atmel/sam/common/soc_power.c +++ b/soc/atmel/sam/common/soc_power.c @@ -12,7 +12,7 @@ #endif #if defined(CONFIG_REBOOT) -#if DT_NODE_HAS_STATUS(SAM_DT_RSTC_DRIVER, okay) +#if DT_NODE_HAS_STATUS_OKAY(SAM_DT_RSTC_DRIVER) void sys_arch_reboot(int type) { @@ -33,5 +33,5 @@ void sys_arch_reboot(int type) } } -#endif /* DT_NODE_HAS_STATUS */ +#endif /* DT_NODE_HAS_STATUS_OKAY */ #endif /* CONFIG_REBOOT */ diff --git a/soc/intel/intel_adsp/common/clk.c b/soc/intel/intel_adsp/common/clk.c index 3cb4b0e2db7..ebcda7be1e7 100644 --- a/soc/intel/intel_adsp/common/clk.c +++ b/soc/intel/intel_adsp/common/clk.c @@ -129,10 +129,10 @@ struct adsp_clock_source_desc adsp_clk_src_info[ADSP_CLOCK_SOURCE_COUNT] = { */ [ADSP_CLOCK_SOURCE_XTAL_OSC] = { CONFIG_DAI_DMIC_HW_IOCLK }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(audioclk), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(audioclk)) [ADSP_CLOCK_SOURCE_AUDIO_CARDINAL] = { DT_PROP(DT_NODELABEL(audioclk), clock_frequency) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pllclk), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pllclk)) [ADSP_CLOCK_SOURCE_AUDIO_PLL_FIXED] = { DT_PROP(DT_NODELABEL(pllclk), clock_frequency) }, #endif [ADSP_CLOCK_SOURCE_MLCK_INPUT] = { 0 }, diff --git a/soc/intel/intel_adsp/common/include/adsp_clk.h b/soc/intel/intel_adsp/common/include/adsp_clk.h index ccfb5cdc7e7..591116c5561 100644 --- a/soc/intel/intel_adsp/common/include/adsp_clk.h +++ b/soc/intel/intel_adsp/common/include/adsp_clk.h @@ -64,10 +64,10 @@ struct adsp_cpu_clock_info *adsp_cpu_clocks_get(void); /* Clock sources used by dai */ #define ADSP_CLOCK_SOURCE_XTAL_OSC 0 -#if DT_NODE_HAS_STATUS(DT_NODELABEL(audioclk), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(audioclk)) #define ADSP_CLOCK_SOURCE_AUDIO_CARDINAL 1 #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pllclk), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pllclk)) #define ADSP_CLOCK_SOURCE_AUDIO_PLL_FIXED 2 #endif diff --git a/soc/intel/intel_adsp/common/mem_window.c b/soc/intel/intel_adsp/common/mem_window.c index 8ca591deb36..ae5abcb77bf 100644 --- a/soc/intel/intel_adsp/common/mem_window.c +++ b/soc/intel/intel_adsp/common/mem_window.c @@ -58,15 +58,15 @@ void mem_window_idle_exit(void) &mem_win_config_##n, PRE_KERNEL_1, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); -#if DT_NODE_HAS_STATUS(MEM_WINDOW_NODE(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(MEM_WINDOW_NODE(0)) MEM_WINDOW_DEFINE(0) #endif -#if DT_NODE_HAS_STATUS(MEM_WINDOW_NODE(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(MEM_WINDOW_NODE(1)) MEM_WINDOW_DEFINE(1) #endif -#if DT_NODE_HAS_STATUS(MEM_WINDOW_NODE(2), okay) +#if DT_NODE_HAS_STATUS_OKAY(MEM_WINDOW_NODE(2)) MEM_WINDOW_DEFINE(2) #endif -#if DT_NODE_HAS_STATUS(MEM_WINDOW_NODE(3), okay) +#if DT_NODE_HAS_STATUS_OKAY(MEM_WINDOW_NODE(3)) MEM_WINDOW_DEFINE(3) #endif diff --git a/soc/ite/ec/it8xxx2/soc.c b/soc/ite/ec/it8xxx2/soc.c index 0f2501111be..2c2660ac3b1 100644 --- a/soc/ite/ec/it8xxx2/soc.c +++ b/soc/ite/ec/it8xxx2/soc.c @@ -403,7 +403,7 @@ static int ite_it8xxx2_init(void) IT8XXX2_EGPIO_EGCR |= IT8XXX2_EGPIO_EEPODD; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) /* UART1 board init */ /* bit2: clocks to UART1 modules are not gated. */ IT8XXX2_ECPM_CGCTRL3R &= ~BIT(2); @@ -417,9 +417,9 @@ static int ite_it8xxx2_init(void) /* switch UART1 on without hardware flow control */ gpio_regs->GPIO_GCR1 |= IT8XXX2_GPIO_U1CTRL_SIN0_SOUT0_EN; -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* UART2 board init */ /* setting voltage 3.3v */ gpio_regs->GPIO_GCR21 &= ~(IT8XXX2_GPIO_GPH1VS | IT8XXX2_GPIO_GPH2VS); @@ -435,7 +435,7 @@ static int ite_it8xxx2_init(void) /* switch UART2 on without hardware flow control */ gpio_regs->GPIO_GCR1 |= IT8XXX2_GPIO_U2CTRL_SIN1_SOUT1_EN; -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) */ #if (SOC_USBPD_ITE_PHY_PORT_COUNT > 0) int port; diff --git a/soc/microchip/mec/common/soc_dt.h b/soc/microchip/mec/common/soc_dt.h index cfaa8821da9..39f772f964f 100644 --- a/soc/microchip/mec/common/soc_dt.h +++ b/soc/microchip/mec/common/soc_dt.h @@ -35,7 +35,7 @@ #define MCHP_DT_ESPI_VW_FLAG_RST_SRC_MSK0 0x7 #define MCHP_DT_NODE_FROM_VWTABLE(name) DT_CHILD(DT_PATH(mchp_xec_espi_vw_routing), name) -#define MCHP_DT_VW_NODE_HAS_STATUS(name) DT_NODE_HAS_STATUS(MCHP_DT_NODE_FROM_VWTABLE(name), okay) +#define MCHP_DT_VW_NODE_HAS_STATUS(name) DT_NODE_HAS_STATUS_OKAY(MCHP_DT_NODE_FROM_VWTABLE(name)) /* Macro to store eSPI virtual wire DT flags * b[0] = DT status property 0 is disabled, 1 enabled, diff --git a/soc/microchip/mec/mec172x/device_power.c b/soc/microchip/mec/mec172x/device_power.c index 8a35d6ddd00..eab5bfb0419 100644 --- a/soc/microchip/mec/mec172x/device_power.c +++ b/soc/microchip/mec/mec172x/device_power.c @@ -93,14 +93,14 @@ void soc_deep_sleep_non_wake_dis(void) void soc_deep_sleep_wake_en(void) { #if defined(CONFIG_KSCAN) || \ - (!defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS(DT_NODELABEL(ps2_0), okay)) + (!defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ps2_0))) struct ecia_named_regs *regs = ECIA_XEC_REG_BASE; #if defined(CONFIG_KSCAN) /* Enable PLL wake via KSCAN */ regs->GIRQ21.SRC = MCHP_KEYSCAN_GIRQ_BIT; regs->GIRQ21.EN_SET = MCHP_KEYSCAN_GIRQ_BIT; #endif -#if !defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS(DT_NODELABEL(ps2_0), okay) +#if !defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ps2_0)) /* Enable PS2_0B_WK */ regs->GIRQ21.SRC = MCHP_PS2_0_PORT0B_WK_GIRQ_BIT; regs->GIRQ21.EN_SET = MCHP_PS2_0_PORT0B_WK_GIRQ_BIT; @@ -110,7 +110,7 @@ void soc_deep_sleep_wake_en(void) void soc_deep_sleep_wake_dis(void) { -#if !defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS(DT_NODELABEL(ps2_0), okay) +#if !defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ps2_0)) struct ecia_named_regs *regs = ECIA_XEC_REG_BASE; /* Enable PS2_0B_WK */ diff --git a/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c b/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c index 66659588411..b76fac86bcd 100644 --- a/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c +++ b/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c @@ -28,15 +28,15 @@ static struct arm_mpu_region mpu_regions[] = { REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, CONFIG_SRAM_SIZE * 1024)), -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usbhs), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usbhs)) MPU_REGION_ENTRY("USBHS_CORE", USBHS_BASE, REGION_RAM_NOCACHE_ATTR(USBHS_BASE, USBHS_SIZE)), #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(can120), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(can120)) MPU_REGION_ENTRY("CAN120_MCAN", CAN120_BASE, REGION_RAM_NOCACHE_ATTR(CAN120_BASE, CAN120_SIZE)), #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(can121), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(can121)) MPU_REGION_ENTRY("CAN121_MCAN", CAN121_BASE, REGION_RAM_NOCACHE_ATTR(CAN121_BASE, CAN121_SIZE)), #endif diff --git a/soc/nordic/nrf52/soc.c b/soc/nordic/nrf52/soc.c index 3262b84bc85..4bb3b8640e5 100644 --- a/soc/nordic/nrf52/soc.c +++ b/soc/nordic/nrf52/soc.c @@ -37,7 +37,7 @@ static int nordicsemi_nrf52_init(void) nrf_power_dcdcen_set(NRF_POWER, true); #endif #if NRF_POWER_HAS_DCDCEN_VDDH && (defined(CONFIG_SOC_DCDC_NRF52X_HV) || \ - DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf52x_regulator_hv), okay)) + DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf52x_regulator_hv))) nrf_power_dcdcen_vddh_set(NRF_POWER, true); #endif diff --git a/soc/nordic/nrf53/soc.c b/soc/nordic/nrf53/soc.c index 46e8e5ca20d..67eb5dfb67b 100644 --- a/soc/nordic/nrf53/soc.c +++ b/soc/nordic/nrf53/soc.c @@ -531,7 +531,7 @@ static int nordicsemi_nrf53_init(void) (DT_PROP(DT_NODELABEL(vregradio), regulator_initial_mode) == NRF5X_REG_MODE_DCDC) nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_RADIO, true); #endif -#if defined(CONFIG_SOC_DCDC_NRF53X_HV) || DT_NODE_HAS_STATUS(DT_NODELABEL(vregh), okay) +#if defined(CONFIG_SOC_DCDC_NRF53X_HV) || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(vregh)) nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_HIGH, true); #endif diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index ed4cb3f45d2..85570bd9ff3 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -145,7 +145,7 @@ static int nordicsemi_nrf54h_init(void) return err; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ccm030), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ccm030)) /* DMASEC is set to non-secure by default, which prevents CCM from * accessing secure memory. Change DMASEC to secure. */ diff --git a/soc/nordic/nrf92/soc.c b/soc/nordic/nrf92/soc.c index 1a40bb58dda..d9a54e4f1aa 100644 --- a/soc/nordic/nrf92/soc.c +++ b/soc/nordic/nrf92/soc.c @@ -93,7 +93,7 @@ static int nordicsemi_nrf92_init(void) trim_hsfll(); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ccm030), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ccm030)) /* DMASEC is set to non-secure by default, which prevents CCM from * accessing secure memory. Change DMASEC to secure. */ diff --git a/soc/nordic/validate_enabled_instances.c b/soc/nordic/validate_enabled_instances.c index b3e4dd70bbf..afcfc6e8ca8 100644 --- a/soc/nordic/validate_enabled_instances.c +++ b/soc/nordic/validate_enabled_instances.c @@ -7,16 +7,16 @@ #include #define I2C_ENABLED(idx) (IS_ENABLED(CONFIG_I2C) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(i2c##idx), okay)) + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c##idx))) #define SPI_ENABLED(idx) (IS_ENABLED(CONFIG_SPI) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(spi##idx), okay)) + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(spi##idx))) #define UART_ENABLED(idx) (IS_ENABLED(CONFIG_SERIAL) && \ (IS_ENABLED(CONFIG_SOC_SERIES_NRF53X) || \ IS_ENABLED(CONFIG_SOC_SERIES_NRF54LX) || \ IS_ENABLED(CONFIG_SOC_SERIES_NRF91X)) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart##idx), okay)) + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart##idx))) /* * In most Nordic SoCs, SPI and TWI peripherals with the same instance number diff --git a/soc/nxp/imx/imx6sx/soc.c b/soc/nxp/imx/imx6sx/soc.c index 11cbac10002..516c2e9bcf6 100644 --- a/soc/nxp/imx/imx6sx/soc.c +++ b/soc/nxp/imx/imx6sx/soc.c @@ -23,55 +23,55 @@ static void SOC_RdcInit(void) RDC_DOMAIN_PERM(M4_DOMAIN_ID, RDC_DOMAIN_PERM_RW), false, false); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) /* Set access to UART_1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart1, RDC_DT_VAL(uart1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* Set access to UART_2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart2, RDC_DT_VAL(uart2), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) /* Set access to UART_3 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart3, RDC_DT_VAL(uart3), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) /* Set access to UART_4 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart4, RDC_DT_VAL(uart4), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart5)) /* Set access to UART_5 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart5, RDC_DT_VAL(uart5), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart6)) /* Set access to UART_6 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart6, RDC_DT_VAL(uart6), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) /* Set access to GPIO_1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio1, RDC_DT_VAL(gpio1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) /* Set access to GPIO_2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio2, RDC_DT_VAL(gpio2), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) /* Set access to GPIO_3 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio3, RDC_DT_VAL(gpio3), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) /* Set access to GPIO_4 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio4, RDC_DT_VAL(gpio4), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio5)) /* Set access to GPIO_5 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio5, RDC_DT_VAL(gpio5), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio6)) /* Set access to GPIO_6 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio6, RDC_DT_VAL(gpio6), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio7)) /* Set access to GPIO_7 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio7, RDC_DT_VAL(gpio7), false, false); #endif @@ -81,69 +81,69 @@ static void SOC_RdcInit(void) RDC_SetPdapAccess(RDC, rdcPdapMuB, RDC_DT_VAL(mub), false, false); #endif /* CONFIG_IPM_IMX */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(epit1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(epit1)) /* Set access to EPIT_1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapEpit1, RDC_DT_VAL(epit1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(epit2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(epit2)) /* Set access to EPIT_2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapEpit2, RDC_DT_VAL(epit2), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c1)) /* Set access to I2C-1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapI2c1, RDC_DT_VAL(i2c1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c2)) /* Set access to I2C-2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapI2c2, RDC_DT_VAL(i2c2), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c3)) /* Set access to I2C-3 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapI2c3, RDC_DT_VAL(i2c3), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c4)) /* Set access to I2C-4 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapI2c4, RDC_DT_VAL(i2c4), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm1)) /* Set access to PWM-1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm1, RDC_DT_VAL(pwm1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm2)) /* Set access to PWM-2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm2, RDC_DT_VAL(pwm2), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm3)) /* Set access to PWM-3 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm3, RDC_DT_VAL(pwm3), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm4)) /* Set access to PWM-4 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm4, RDC_DT_VAL(pwm4), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm5)) /* Set access to PWM-5 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm5, RDC_DT_VAL(pwm5), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm6)) /* Set access to PWM-6 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm6, RDC_DT_VAL(pwm6), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm7)) /* Set access to PWM-7 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm7, RDC_DT_VAL(pwm7), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm8), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm8)) /* Set access to PWM-8 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm8, RDC_DT_VAL(pwm8), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc1)) /* Set access to ADC-1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapAdc1, RDC_DT_VAL(adc1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc2)) /* Set access to ADC-2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapAdc2, RDC_DT_VAL(adc2), false, false); #endif @@ -213,10 +213,10 @@ static void SOC_ClockInit(void) CCM_SetRootDivider(CCM, ccmRootPerclkPodf, 0); /* Enable EPIT clocks */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(epit1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(epit1)) CCM_ControlGate(CCM, ccmCcgrGateEpit1Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(epit2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(epit2)) CCM_ControlGate(CCM, ccmCcgrGateEpit2Clk, ccmClockNeededAll); #endif #endif /* CONFIG_COUNTER_IMX_EPIT */ @@ -229,16 +229,16 @@ static void SOC_ClockInit(void) CCM_SetRootDivider(CCM, ccmRootPerclkPodf, 0); /* Enable I2C clock */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c1)) CCM_ControlGate(CCM, ccmCcgrGateI2c1Serialclk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c2)) CCM_ControlGate(CCM, ccmCcgrGateI2c2Serialclk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c3)) CCM_ControlGate(CCM, ccmCcgrGateI2c3Serialclk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c4)) CCM_ControlGate(CCM, ccmCcgrGateI2c4Serialclk, ccmClockNeededAll); #endif #endif /* CONFIG_I2C_IMX */ @@ -251,28 +251,28 @@ static void SOC_ClockInit(void) CCM_SetRootDivider(CCM, ccmRootPerclkPodf, 0); /* Enable PWM clock */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm1)) CCM_ControlGate(CCM, ccmCcgrGatePwm1Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm2)) CCM_ControlGate(CCM, ccmCcgrGatePwm2Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm3)) CCM_ControlGate(CCM, ccmCcgrGatePwm3Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm4)) CCM_ControlGate(CCM, ccmCcgrGatePwm4Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm5)) CCM_ControlGate(CCM, ccmCcgrGatePwm5Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm6)) CCM_ControlGate(CCM, ccmCcgrGatePwm6Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm7)) CCM_ControlGate(CCM, ccmCcgrGatePwm7Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm8), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm8)) CCM_ControlGate(CCM, ccmCcgrGatePwm8Clk, ccmClockNeededAll); #endif #endif /* CONFIG_PWM_IMX */ diff --git a/soc/nxp/imx/imx7d/soc.c b/soc/nxp/imx/imx7d/soc.c index df3ee95f2e1..780c405a0bb 100644 --- a/soc/nxp/imx/imx7d/soc.c +++ b/soc/nxp/imx/imx7d/soc.c @@ -57,21 +57,21 @@ void SOC_RdcInit(void) static void nxp_mcimx7_gpio_config(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) RDC_SetPdapAccess(RDC, rdcPdapGpio1, RDC_DT_VAL(gpio1), false, false); /* Enable gpio clock gate */ CCM_ControlGate(CCM, ccmCcgrGateGpio1, ccmClockNeededRunWait); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) RDC_SetPdapAccess(RDC, rdcPdapGpio2, RDC_DT_VAL(gpio2), false, false); /* Enable gpio clock gate */ CCM_ControlGate(CCM, ccmCcgrGateGpio2, ccmClockNeededRunWait); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio7)) RDC_SetPdapAccess(RDC, rdcPdapGpio7, RDC_DT_VAL(gpio7), false, false); /* Enable gpio clock gate */ CCM_ControlGate(CCM, ccmCcgrGateGpio7, ccmClockNeededRunWait); @@ -84,7 +84,7 @@ static void nxp_mcimx7_gpio_config(void) static void nxp_mcimx7_uart_config(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* We need to grasp board uart exclusively */ RDC_SetPdapAccess(RDC, rdcPdapUart2, RDC_DT_VAL(uart2), false, false); /* Select clock derived from OSC clock(24M) */ @@ -99,7 +99,7 @@ static void nxp_mcimx7_uart_config(void) CCM_ControlGate(CCM, ccmCcgrGateUart2, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart6)) /* We need to grasp board uart exclusively */ RDC_SetPdapAccess(RDC, rdcPdapUart6, RDC_DT_VAL(uart6), false, false); /* Select clock derived from OSC clock(24M) */ @@ -121,7 +121,7 @@ static void nxp_mcimx7_uart_config(void) static void nxp_mcimx7_i2c_config(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c1)) /* In this example, we need to grasp board I2C exclusively */ RDC_SetPdapAccess(RDC, rdcPdapI2c1, RDC_DT_VAL(i2c1), false, false); /* Select I2C clock derived from OSC clock(24M) */ @@ -131,7 +131,7 @@ static void nxp_mcimx7_i2c_config(void) CCM_ControlGate(CCM, ccmCcgrGateI2c1, ccmClockNeededRunWait); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c2)) /* In this example, we need to grasp board I2C exclusively */ RDC_SetPdapAccess(RDC, rdcPdapI2c2, RDC_DT_VAL(i2c2), false, false); /* Select I2C clock derived from OSC clock(24M) */ @@ -141,7 +141,7 @@ static void nxp_mcimx7_i2c_config(void) CCM_ControlGate(CCM, ccmCcgrGateI2c2, ccmClockNeededRunWait); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c3)) /* In this example, we need to grasp board I2C exclusively */ RDC_SetPdapAccess(RDC, rdcPdapI2c3, RDC_DT_VAL(i2c3), false, false); /* Select I2C clock derived from OSC clock(24M) */ @@ -151,7 +151,7 @@ static void nxp_mcimx7_i2c_config(void) CCM_ControlGate(CCM, ccmCcgrGateI2c3, ccmClockNeededRunWait); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c4)) /* In this example, we need to grasp board I2C exclusively */ RDC_SetPdapAccess(RDC, rdcPdapI2c4, RDC_DT_VAL(i2c4), false, false); /* Select I2C clock derived from OSC clock(24M) */ @@ -168,7 +168,7 @@ static void nxp_mcimx7_i2c_config(void) static void nxp_mcimx7_pwm_config(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm1)) /* We need to grasp board pwm exclusively */ RDC_SetPdapAccess(RDC, rdcPdapPwm1, RDC_DT_VAL(pwm1), false, false); /* Select clock derived from OSC clock(24M) */ @@ -178,7 +178,7 @@ static void nxp_mcimx7_pwm_config(void) CCM_ControlGate(CCM, ccmCcgrGatePwm1, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm2)) /* We need to grasp board pwm exclusively */ RDC_SetPdapAccess(RDC, rdcPdapPwm2, RDC_DT_VAL(pwm2), false, false); /* Select clock derived from OSC clock(24M) */ @@ -188,7 +188,7 @@ static void nxp_mcimx7_pwm_config(void) CCM_ControlGate(CCM, ccmCcgrGatePwm2, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm3)) /* We need to grasp board pwm exclusively */ RDC_SetPdapAccess(RDC, rdcPdapPwm3, RDC_DT_VAL(pwm3), false, false); /* Select clock derived from OSC clock(24M) */ @@ -198,7 +198,7 @@ static void nxp_mcimx7_pwm_config(void) CCM_ControlGate(CCM, ccmCcgrGatePwm3, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm4)) /* We need to grasp board pwm exclusively */ RDC_SetPdapAccess(RDC, rdcPdapPwm4, RDC_DT_VAL(pwm4), false, false); /* Select clock derived from OSC clock(24M) */ diff --git a/soc/nxp/imx/imx8m/a53/soc.c b/soc/nxp/imx/imx8m/a53/soc.c index a20ae395f18..a110213e2b6 100644 --- a/soc/nxp/imx/imx8m/a53/soc.c +++ b/soc/nxp/imx/imx8m/a53/soc.c @@ -12,7 +12,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(rdc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(rdc)) #define rdc_inst ((RDC_Type *)DT_REG_ADDR(DT_NODELABEL(rdc))) @@ -28,19 +28,19 @@ static void soc_rdc_init(void) RDC_GetDefaultPeriphAccessConfig(&periphConfig); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart2), rdc) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) && DT_NODE_HAS_PROP(DT_NODELABEL(uart2), rdc) periphConfig.periph = kRDC_Periph_UART2; periphConfig.policy = RDC_DT_VAL(uart2); RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart4), rdc) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) && DT_NODE_HAS_PROP(DT_NODELABEL(uart4), rdc) periphConfig.periph = kRDC_Periph_UART4; periphConfig.policy = RDC_DT_VAL(uart4); RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(enet), rdc) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) && DT_NODE_HAS_PROP(DT_NODELABEL(enet), rdc) periphConfig.periph = kRDC_Periph_ENET1; periphConfig.policy = RDC_DT_VAL(enet); RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig); diff --git a/soc/nxp/imx/imx8m/m4_mini/soc.c b/soc/nxp/imx/imx8m/m4_mini/soc.c index 784c39fcc04..b809a900e11 100644 --- a/soc/nxp/imx/imx8m/m4_mini/soc.c +++ b/soc/nxp/imx/imx8m/m4_mini/soc.c @@ -104,25 +104,25 @@ static void SOC_ClockInit(void) CLOCK_SetRootMux(kCLOCK_RootAudioAhb, kCLOCK_AudioAhbRootmuxSysPll1); #if defined(CONFIG_UART_MCUX_IUART) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart1, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart1, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart2, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart2, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart3, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart3, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart4, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ diff --git a/soc/nxp/imx/imx8m/m4_quad/soc.c b/soc/nxp/imx/imx8m/m4_quad/soc.c index 031121bc424..eea984fc172 100644 --- a/soc/nxp/imx/imx8m/m4_quad/soc.c +++ b/soc/nxp/imx/imx8m/m4_quad/soc.c @@ -67,25 +67,25 @@ static void SOC_ClockInit(void) CLOCK_SetRootMux(kCLOCK_RootM4, kCLOCK_M4RootmuxSysPll1Div3); #if defined(CONFIG_UART_MCUX_IUART) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart1, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart1, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart2, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart2, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart3, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart3, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart4, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ diff --git a/soc/nxp/imx/imx8m/m7/soc.c b/soc/nxp/imx/imx8m/m7/soc.c index 683d550b149..7cd42b3bb5d 100644 --- a/soc/nxp/imx/imx8m/m7/soc.c +++ b/soc/nxp/imx/imx8m/m7/soc.c @@ -107,25 +107,25 @@ static void SOC_ClockInit(void) CLOCK_SetRootMux(kCLOCK_RootAhb, kCLOCK_AhbRootmuxSysPll1Div6); #if defined(CONFIG_UART_MCUX_IUART) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart1, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart1, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart2, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart2, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart3, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart3, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart4, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ @@ -134,21 +134,21 @@ static void SOC_ClockInit(void) #endif #if defined(CONFIG_SPI_MCUX_ECSPI) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ecspi1)) /* Set ECSPI1 source to SYSTEM PLL1 800MHZ */ CLOCK_SetRootMux(kCLOCK_RootEcspi1, kCLOCK_EcspiRootmuxSysPll1); /* Set root clock to 800MHZ / 10 = 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootEcspi1, 2U, 5U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ecspi2)) /* Set ECSPI2 source to SYSTEM PLL1 800MHZ */ CLOCK_SetRootMux(kCLOCK_RootEcspi2, kCLOCK_EcspiRootmuxSysPll1); /* Set root clock to 800MHZ / 10 = 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootEcspi2, 2U, 5U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ecspi3)) /* Set ECSPI3 source to SYSTEM PLL1 800MHZ */ CLOCK_SetRootMux(kCLOCK_RootEcspi3, kCLOCK_EcspiRootmuxSysPll1); /* Set root clock to 800MHZ / 10 = 80MHZ */ @@ -175,27 +175,27 @@ static void gpio_init(void) { #if defined(CONFIG_GPIO_MCUX_IGPIO) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) CLOCK_EnableClock(kCLOCK_Gpio1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) CLOCK_EnableClock(kCLOCK_Gpio2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) CLOCK_EnableClock(kCLOCK_Gpio3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) CLOCK_EnableClock(kCLOCK_Gpio4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio5)) CLOCK_EnableClock(kCLOCK_Gpio5); diff --git a/soc/nxp/imxrt/imxrt10xx/flexspi.c b/soc/nxp/imxrt/imxrt10xx/flexspi.c index a6a6239e9e7..5f288747c1a 100644 --- a/soc/nxp/imxrt/imxrt10xx/flexspi.c +++ b/soc/nxp/imxrt/imxrt10xx/flexspi.c @@ -28,7 +28,7 @@ uint32_t flexspi_clock_set_freq(uint32_t clock_name, uint32_t rate) div_sel = kCLOCK_FlexspiDiv; clk_name = kCLOCK_FlexSpi; break; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexspi2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexspi2)) case IMX_CCM_FLEXSPI2_CLK: /* Get clock root frequency */ root_rate = CLOCK_GetClockRootFreq(kCLOCK_Flexspi2ClkRoot) * diff --git a/soc/nxp/imxrt/imxrt10xx/soc.c b/soc/nxp/imxrt/imxrt10xx/soc.c index d8a11dafd34..941ae1d3474 100644 --- a/soc/nxp/imxrt/imxrt10xx/soc.c +++ b/soc/nxp/imxrt/imxrt10xx/soc.c @@ -67,10 +67,10 @@ const clock_enet_pll_config_t ethPllConfig = { .enableClkOutput500M = true, #endif #if defined(CONFIG_ETH_NXP_ENET) || defined(CONFIG_ETH_MCUX) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) .enableClkOutput = true, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet2)) .enableClkOutput1 = true, #endif #endif @@ -79,10 +79,10 @@ const clock_enet_pll_config_t ethPllConfig = { #else .enableClkOutput25M = false, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) .loopDivider = 1, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet2)) .loopDivider1 = 1, #endif }; @@ -226,7 +226,7 @@ static ALWAYS_INLINE void clock_init(void) #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && CONFIG_NET_L2_ETHERNET +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) && CONFIG_NET_L2_ETHERNET #if CONFIG_ETH_MCUX_RMII_EXT_CLK /* Enable clock input for ENET1 */ IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1TxClkOutputDir, false); @@ -236,43 +236,43 @@ static ALWAYS_INLINE void clock_init(void) #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet2), okay) && CONFIG_NET_L2_ETHERNET +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet2)) && CONFIG_NET_L2_ETHERNET /* Set ENET2 ref clock to be generated by External OSC,*/ /* direction as output and frequency to 50MHz */ IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET2TxClkOutputDir | kIOMUXC_GPR_ENET2RefClkMode, true); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && \ (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency)); CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency)); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI USB_EhciPhyInit(kUSB_ControllerEhci0, CPU_XTAL_CLK_HZ, &usbPhyConfig); #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb2), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb2)) && \ (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) CLOCK_EnableUsbhs1PhyPllClock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb2), clocks, clock_frequency)); CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb2), clocks, clock_frequency)); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI USB_EhciPhyInit(kUSB_ControllerEhci1, CPU_XTAL_CLK_HZ, &usbPhyConfig); #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc1)) && CONFIG_IMX_USDHC /* Configure USDHC clock source and divider */ CLOCK_InitSysPfd(kCLOCK_Pfd0, 24U); CLOCK_SetDiv(kCLOCK_Usdhc1Div, 1U); CLOCK_SetMux(kCLOCK_Usdhc1Mux, 1U); CLOCK_EnableClock(kCLOCK_Usdhc1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc2), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc2)) && CONFIG_IMX_USDHC /* Configure USDHC clock source and divider */ CLOCK_InitSysPfd(kCLOCK_Pfd0, 24U); CLOCK_SetDiv(kCLOCK_Usdhc2Div, 1U); diff --git a/soc/nxp/imxrt/imxrt118x/soc.c b/soc/nxp/imxrt/imxrt118x/soc.c index 85299643de7..1809d6b4b02 100644 --- a/soc/nxp/imxrt/imxrt118x/soc.c +++ b/soc/nxp/imxrt/imxrt118x/soc.c @@ -208,16 +208,16 @@ static ALWAYS_INLINE void clock_init(void) #endif #if defined(CONFIG_UART_MCUX_LPUART) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart1), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart2), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart1)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart2))) /* Configure LPUART0102 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_LPUART0102_ClockRoot_MuxSysPll3Div2; rootCfg.div = 10; #endif #if defined(CONFIG_I2C_MCUX_LPI2C) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c1), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c2), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c1)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c2))) /* Configure LPI2C0102 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_LPI2C0102_ClockRoot_MuxSysPll3Div2; rootCfg.div = 4; @@ -225,8 +225,8 @@ static ALWAYS_INLINE void clock_init(void) #endif #if defined(CONFIG_I2C_MCUX_LPI2C) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c3), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c4), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c3)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c4))) /* Configure LPI2C0304 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_LPI2C0304_ClockRoot_MuxSysPll3Div2; rootCfg.div = 4; @@ -234,8 +234,8 @@ static ALWAYS_INLINE void clock_init(void) #endif #if defined(CONFIG_I2C_MCUX_LPI2C) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c5), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c6), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c5)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c6))) /* Configure LPI2C0506 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_LPI2C0506_ClockRoot_MuxSysPll3Div2; rootCfg.div = 4; @@ -243,8 +243,8 @@ static ALWAYS_INLINE void clock_init(void) #endif #if defined(CONFIG_SPI_MCUX_LPSPI) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi1), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi2), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi1)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi2))) /* Configure LPSPI0102 using SYS_PLL3_PFD1_CLK */ rootCfg.mux = kCLOCK_LPSPI0102_ClockRoot_MuxSysPll3Pfd1; rootCfg.div = 2; @@ -253,28 +253,28 @@ static ALWAYS_INLINE void clock_init(void) #if defined(CONFIG_COUNTER_MCUX_GPT) -#if (DT_NODE_HAS_STATUS(DT_NODELABEL(gpt1), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpt1))) /* Configure GPT1 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_GPT1_ClockRoot_MuxSysPll3Div2; rootCfg.div = 1; CLOCK_SetRootClock(kCLOCK_Root_Gpt1, &rootCfg); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpt1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpt1)) */ -#if (DT_NODE_HAS_STATUS(DT_NODELABEL(gpt2), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpt2))) /* Configure GPT2 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_GPT2_ClockRoot_MuxSysPll3Div2; rootCfg.div = 1; CLOCK_SetRootClock(kCLOCK_Root_Gpt2, &rootCfg); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpt2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpt2)) */ #endif /* CONFIG_COUNTER_MCUX_GPT */ #ifdef CONFIG_MCUX_ACMP -#if (DT_NODE_HAS_STATUS(DT_NODELABEL(acmp1), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(acmp2), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(acmp3), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(acmp4), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(acmp1)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(acmp2)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(acmp3)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(acmp4))) /* Configure ACMP using MuxSysPll3Out */ rootCfg.mux = kCLOCK_ACMP_ClockRoot_MuxSysPll3Out; rootCfg.div = 2; diff --git a/soc/nxp/imxrt/imxrt11xx/soc.c b/soc/nxp/imxrt/imxrt11xx/soc.c index 7648052177b..10ae6866d13 100644 --- a/soc/nxp/imxrt/imxrt11xx/soc.c +++ b/soc/nxp/imxrt/imxrt11xx/soc.c @@ -409,7 +409,7 @@ static ALWAYS_INLINE void clock_init(void) #endif #if CONFIG_ETH_MCUX || CONFIG_ETH_NXP_ENET -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) /* 50 MHz ENET clock */ rootCfg.mux = kCLOCK_ENET1_ClockRoot_MuxSysPll1Div2; rootCfg.div = 10; @@ -424,7 +424,7 @@ static ALWAYS_INLINE void clock_init(void) (IOMUXC_GPR_GPR4_ENET_REF_CLK_DIR(0x01U) | IOMUXC_GPR_GPR4_ENET_TX_CLK_SEL(0x1U)); #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet1g), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet1g)) rootCfg.mux = kCLOCK_ENET2_ClockRoot_MuxSysPll1Div2; #if DT_ENUM_HAS_VALUE(DT_CHILD(DT_NODELABEL(enet1g), ethernet), phy_connection_type, rgmii) /* 125 MHz ENET1G clock */ @@ -491,13 +491,13 @@ static ALWAYS_INLINE void clock_init(void) #endif #ifdef CONFIG_CAN_MCUX_FLEXCAN -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcan1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcan1)) /* Configure CAN1 using Osc48MDiv2 */ rootCfg.mux = kCLOCK_CAN1_ClockRoot_MuxOscRc48MDiv2; rootCfg.div = 1; CLOCK_SetRootClock(kCLOCK_Root_Can1, &rootCfg); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcan3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcan3)) /* Configure CAN1 using Osc48MDiv2 */ rootCfg.mux = kCLOCK_CAN3_ClockRoot_MuxOscRc48MDiv2; rootCfg.div = 1; @@ -506,7 +506,7 @@ static ALWAYS_INLINE void clock_init(void) #endif #ifdef CONFIG_MCUX_ACMP -#if DT_NODE_HAS_STATUS(DT_NODELABEL(acmp1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(acmp1)) /* Configure ACMP1 using Osc48MDiv2*/ rootCfg.mux = kCLOCK_ACMP_ClockRoot_MuxOscRc48MDiv2; rootCfg.div = 1; @@ -532,28 +532,28 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_SetRootClock(kCLOCK_Root_Gpt1, &rootCfg); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) CLOCK_EnableUsbhs0PhyPllClock( kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency)); CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency)); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI USB_EhciPhyInit(kUSB_ControllerEhci0, CPU_XTAL_CLK_HZ, &usbPhyConfig); #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb2), okay) && (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb2)) && (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) CLOCK_EnableUsbhs1PhyPllClock( kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb2), clocks, clock_frequency)); CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb2), clocks, clock_frequency)); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI USB_EhciPhyInit(kUSB_ControllerEhci1, CPU_XTAL_CLK_HZ, &usbPhyConfig); #endif #endif #if CONFIG_IMX_USDHC -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc1)) /* Configure USDHC1 using SysPll2Pfd2*/ rootCfg.mux = kCLOCK_USDHC1_ClockRoot_MuxSysPll2Pfd2; rootCfg.div = 2; @@ -561,7 +561,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_EnableClock(kCLOCK_Usdhc1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc2)) /* Configure USDHC2 using SysPll2Pfd2*/ rootCfg.mux = kCLOCK_USDHC2_ClockRoot_MuxSysPll2Pfd2; rootCfg.div = 2; @@ -571,7 +571,7 @@ static ALWAYS_INLINE void clock_init(void) #endif #if !(DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_flash), nxp_imx_flexspi)) && \ - defined(CONFIG_MEMC_MCUX_FLEXSPI) && DT_NODE_HAS_STATUS(DT_NODELABEL(flexspi), okay) + defined(CONFIG_MEMC_MCUX_FLEXSPI) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexspi)) /* Configure FLEXSPI1 using OSC_RC_48M_DIV2 */ rootCfg.mux = kCLOCK_FLEXSPI1_ClockRoot_MuxOscRc48MDiv2; rootCfg.div = 1; diff --git a/soc/nxp/imxrt/imxrt5xx/cm33/soc.c b/soc/nxp/imxrt/imxrt5xx/cm33/soc.c index f4371511e4e..5d99d069da9 100644 --- a/soc/nxp/imxrt/imxrt5xx/cm33/soc.c +++ b/soc/nxp/imxrt/imxrt5xx/cm33/soc.c @@ -351,7 +351,7 @@ void __weak rt5xx_clock_init(void) /* Switch CLKOUT to FRO_DIV2 */ CLOCK_AttachClk(kFRO_DIV2_to_CLKOUT); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc0)) && CONFIG_IMX_USDHC /* Make sure USDHC ram buffer has been power up*/ POWER_DisablePD(kPDRUNCFG_APD_USDHC0_SRAM); POWER_DisablePD(kPDRUNCFG_PPD_USDHC0_SRAM); @@ -366,7 +366,7 @@ void __weak rt5xx_clock_init(void) RESET_PeripheralReset(kSDIO0_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(smartdma), okay) && CONFIG_DMA_MCUX_SMARTDMA +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(smartdma)) && CONFIG_DMA_MCUX_SMARTDMA /* Power up SMARTDMA ram */ POWER_DisablePD(kPDRUNCFG_APD_SMARTDMA_SRAM); POWER_DisablePD(kPDRUNCFG_PPD_SMARTDMA_SRAM); diff --git a/soc/nxp/imxrt/imxrt6xx/cm33/soc.c b/soc/nxp/imxrt/imxrt6xx/cm33/soc.c index 9071a20bd68..a81c8bc201a 100644 --- a/soc/nxp/imxrt/imxrt6xx/cm33/soc.c +++ b/soc/nxp/imxrt/imxrt6xx/cm33/soc.c @@ -286,7 +286,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_AttachClk(kNONE_to_WDT0_CLK); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc0)) && CONFIG_IMX_USDHC /* Make sure USDHC ram buffer has been power up*/ POWER_DisablePD(kPDRUNCFG_APD_USDHC0_SRAM); POWER_DisablePD(kPDRUNCFG_PPD_USDHC0_SRAM); @@ -343,7 +343,7 @@ static ALWAYS_INLINE void clock_init(void) #endif /* CONFIG_SOC_MIMXRT685S_CM33 */ } -#if (DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) && CONFIG_IMX_USDHC) +#if (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc0)) && CONFIG_IMX_USDHC) void imxrt_usdhc_pinmux(uint16_t nusdhc, bool init, uint32_t speed, uint32_t strength) { diff --git a/soc/nxp/imxrt/imxrt6xx/cm33/soc.h b/soc/nxp/imxrt/imxrt6xx/cm33/soc.h index 356b0e5727c..71e5d69544e 100644 --- a/soc/nxp/imxrt/imxrt6xx/cm33/soc.h +++ b/soc/nxp/imxrt/imxrt6xx/cm33/soc.h @@ -85,8 +85,8 @@ extern "C" { #endif #if CONFIG_IMX_USDHC && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc0)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc1))) void imxrt_usdhc_pinmux(uint16_t nusdhc, bool init, uint32_t speed, uint32_t strength); diff --git a/soc/nxp/kinetis/k6x/soc.c b/soc/nxp/kinetis/k6x/soc.c index c8eb6ba7870..32832dc8a0a 100644 --- a/soc/nxp/kinetis/k6x/soc.c +++ b/soc/nxp/kinetis/k6x/soc.c @@ -101,7 +101,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_SetSimConfig(&simConfig); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetLpuartClock(LPUART0SRC_OSCERCLK); #endif diff --git a/soc/nxp/kinetis/ke1xf/soc.c b/soc/nxp/kinetis/ke1xf/soc.c index 5d3e2291fe6..35968f6acf0 100644 --- a/soc/nxp/kinetis/ke1xf/soc.c +++ b/soc/nxp/kinetis/ke1xf/soc.c @@ -61,7 +61,7 @@ static const scg_sys_clk_config_t scg_sys_clk_config = { #endif }; -#if DT_NODE_HAS_STATUS(SCG_CLOCK_NODE(sosc_clk), okay) +#if DT_NODE_HAS_STATUS_OKAY(SCG_CLOCK_NODE(sosc_clk)) /* System Oscillator (SOSC) configuration */ ASSERT_ASYNC_CLK_DIV_VALID(SCG_CLOCK_DIV(soscdiv1_clk), "Invalid SCG SOSC divider 1 value"); @@ -155,7 +155,7 @@ static ALWAYS_INLINE void clk_init(void) }; scg_sys_clk_config_t current; -#if DT_NODE_HAS_STATUS(SCG_CLOCK_NODE(sosc_clk), okay) +#if DT_NODE_HAS_STATUS_OKAY(SCG_CLOCK_NODE(sosc_clk)) /* Optionally initialize system oscillator */ CLOCK_InitSysOsc(&scg_sosc_config); CLOCK_SetXtal0Freq(scg_sosc_config.freq); @@ -179,59 +179,59 @@ static ALWAYS_INLINE void clk_init(void) CLOCK_GetCurSysClkConfig(¤t); } while (current.src != scg_sys_clk_config.src); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetIpSrc(kCLOCK_Lpuart0, DT_CLOCKS_CELL(DT_NODELABEL(lpuart0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart1)) CLOCK_SetIpSrc(kCLOCK_Lpuart1, DT_CLOCKS_CELL(DT_NODELABEL(lpuart1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart2)) CLOCK_SetIpSrc(kCLOCK_Lpuart2, DT_CLOCKS_CELL(DT_NODELABEL(lpuart2), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c0)) CLOCK_SetIpSrc(kCLOCK_Lpi2c0, DT_CLOCKS_CELL(DT_NODELABEL(lpi2c0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c1)) CLOCK_SetIpSrc(kCLOCK_Lpi2c1, DT_CLOCKS_CELL(DT_NODELABEL(lpi2c1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi0)) CLOCK_SetIpSrc(kCLOCK_Lpspi0, DT_CLOCKS_CELL(DT_NODELABEL(lpspi0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi1)) CLOCK_SetIpSrc(kCLOCK_Lpspi1, DT_CLOCKS_CELL(DT_NODELABEL(lpspi1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc0)) CLOCK_SetIpSrc(kCLOCK_Adc0, DT_CLOCKS_CELL(DT_NODELABEL(adc0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc1)) CLOCK_SetIpSrc(kCLOCK_Adc1, DT_CLOCKS_CELL(DT_NODELABEL(adc1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc2)) CLOCK_SetIpSrc(kCLOCK_Adc2, DT_CLOCKS_CELL(DT_NODELABEL(adc2), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ftm0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ftm0)) CLOCK_SetIpSrc(kCLOCK_Ftm0, DT_CLOCKS_CELL(DT_NODELABEL(ftm0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ftm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ftm1)) CLOCK_SetIpSrc(kCLOCK_Ftm1, DT_CLOCKS_CELL(DT_NODELABEL(ftm1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ftm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ftm2)) CLOCK_SetIpSrc(kCLOCK_Ftm2, DT_CLOCKS_CELL(DT_NODELABEL(ftm2), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ftm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ftm3)) CLOCK_SetIpSrc(kCLOCK_Ftm3, DT_CLOCKS_CELL(DT_NODELABEL(ftm3), ip_source)); #endif diff --git a/soc/nxp/kinetis/ke1xz/soc.c b/soc/nxp/kinetis/ke1xz/soc.c index 5a6b443c1fe..0f8ad0de6ac 100644 --- a/soc/nxp/kinetis/ke1xz/soc.c +++ b/soc/nxp/kinetis/ke1xz/soc.c @@ -106,39 +106,39 @@ static ALWAYS_INLINE void clk_init(void) CLOCK_GetCurSysClkConfig(¤t); } while (current.src != scg_sys_clk_config.src); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetIpSrc(kCLOCK_Lpuart0, DT_CLOCKS_CELL(DT_NODELABEL(lpuart0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart1)) CLOCK_SetIpSrc(kCLOCK_Lpuart1, DT_CLOCKS_CELL(DT_NODELABEL(lpuart1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart2)) CLOCK_SetIpSrc(kCLOCK_Lpuart2, DT_CLOCKS_CELL(DT_NODELABEL(lpuart2), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c0)) CLOCK_SetIpSrc(kCLOCK_Lpi2c0, DT_CLOCKS_CELL(DT_NODELABEL(lpi2c0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c1)) CLOCK_SetIpSrc(kCLOCK_Lpi2c1, DT_CLOCKS_CELL(DT_NODELABEL(lpi2c1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexio), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio)) CLOCK_SetIpSrc(kCLOCK_Flexio0, DT_CLOCKS_CELL(DT_NODELABEL(flexio), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi0)) CLOCK_SetIpSrc(kCLOCK_Lpspi0, DT_CLOCKS_CELL(DT_NODELABEL(lpspi0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi1)) CLOCK_SetIpSrc(kCLOCK_Lpspi1, DT_CLOCKS_CELL(DT_NODELABEL(lpspi1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc0)) CLOCK_SetIpSrc(kCLOCK_Adc0, DT_CLOCKS_CELL(DT_NODELABEL(adc0), ip_source)); #endif diff --git a/soc/nxp/kinetis/kl2x/soc.c b/soc/nxp/kinetis/kl2x/soc.c index 71fe3d35a35..8ab125d4c7c 100644 --- a/soc/nxp/kinetis/kl2x/soc.c +++ b/soc/nxp/kinetis/kl2x/soc.c @@ -70,7 +70,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_SetInternalRefClkConfig(kMCG_IrclkEnable, kMCG_IrcSlow, 0); CLOCK_SetSimConfig(&simConfig); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) CLOCK_SetLpsci0Clock(LPSCI0SRC_MCGFLLCLK); #endif #if CONFIG_USB_KINETIS || CONFIG_UDC_KINETIS diff --git a/soc/nxp/kinetis/kwx/soc_kw4xz.c b/soc/nxp/kinetis/kwx/soc_kw4xz.c index 4e33f4df5b8..f6baedb07b7 100644 --- a/soc/nxp/kinetis/kwx/soc_kw4xz.c +++ b/soc/nxp/kinetis/kwx/soc_kw4xz.c @@ -67,14 +67,14 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_SetSimConfig(&simConfig); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetLpuartClock(LPUART0SRC_OSCERCLK); #endif #if defined(CONFIG_PWM) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(pwm0), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(pwm1), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(pwm2), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm0)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm1)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm2))) CLOCK_SetTpmClock(TPMSRC_MCGPLLCLK); #endif } diff --git a/soc/nxp/lpc/lpc55xxx/soc.c b/soc/nxp/lpc/lpc55xxx/soc.c index 233ab0d9d82..1959b525e92 100644 --- a/soc/nxp/lpc/lpc55xxx/soc.c +++ b/soc/nxp/lpc/lpc55xxx/soc.c @@ -193,7 +193,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(hs_lspi), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(hs_lspi)) /* Attach 12 MHz clock to HSLSPI */ CLOCK_AttachClk(kFRO_HF_DIV_to_HSLSPI); #endif diff --git a/soc/nxp/mcx/mcxc/soc.c b/soc/nxp/mcx/mcxc/soc.c index 00001999a49..01b42984b31 100644 --- a/soc/nxp/mcx/mcxc/soc.c +++ b/soc/nxp/mcx/mcxc/soc.c @@ -88,7 +88,7 @@ static void clock_init(void) /* Set SystemCoreClock variable. */ SystemCoreClock = DT_PROP(DT_NODELABEL(cpu0), clock_frequency); /* Set LPUART0 clock source. */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetLpuart0Clock(LPUART_CLOCK_SEL(lpuart0)); #endif } diff --git a/soc/nxp/rw/power.c b/soc/nxp/rw/power.c index 1f0255a388f..f4176b6349c 100644 --- a/soc/nxp/rw/power.c +++ b/soc/nxp/rw/power.c @@ -28,11 +28,11 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); power_sleep_config_t slp_cfg; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin0), okay) || DT_NODE_HAS_STATUS(DT_NODELABEL(pin1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)) pinctrl_soc_pin_t pin_cfg; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) static void pin0_isr(const struct device *dev) { uint8_t level = ~(DT_ENUM_IDX(DT_NODELABEL(pin0), wakeup_level)) & 0x1; @@ -44,7 +44,7 @@ static void pin0_isr(const struct device *dev) } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)) static void pin1_isr(const struct device *dev) { uint8_t level = ~(DT_ENUM_IDX(DT_NODELABEL(pin1), wakeup_level)) & 0x1; @@ -61,7 +61,7 @@ __weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) pin_cfg = IOMUX_GPIO_IDX(24) | IOMUX_TYPE(IOMUX_GPIO); pinctrl_configure_pins(&pin_cfg, 1, 0); POWER_ConfigWakeupPin(kPOWER_WakeupPin0, DT_ENUM_IDX(DT_NODELABEL(pin0), wakeup_level)); @@ -70,7 +70,7 @@ __weak void pm_state_set(enum pm_state state, uint8_t substate_id) EnableIRQ(DT_IRQN(DT_NODELABEL(pin0))); POWER_EnableWakeup(DT_IRQN(DT_NODELABEL(pin0))); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)) pin_cfg = IOMUX_GPIO_IDX(25) | IOMUX_TYPE(IOMUX_GPIO); pinctrl_configure_pins(&pin_cfg, 1, 0); POWER_ConfigWakeupPin(kPOWER_WakeupPin1, DT_ENUM_IDX(DT_NODELABEL(pin1), wakeup_level)); @@ -119,7 +119,7 @@ void nxp_rw6xx_power_init(void) slp_cfg.memPdCfg = suspend_sleepconfig[3]; slp_cfg.pm3BuckCfg = suspend_sleepconfig[4]; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) /* PIN 0 uses GPIO0_24, confiure the pin as GPIO */ pin_cfg = IOMUX_GPIO_IDX(24) | IOMUX_TYPE(IOMUX_GPIO); pinctrl_configure_pins(&pin_cfg, 1, 0); @@ -131,7 +131,7 @@ void nxp_rw6xx_power_init(void) NULL, 0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)) /* PIN 1 uses GPIO0_25, confiure the pin as GPIO */ pin_cfg = IOMUX_GPIO_IDX(25) | IOMUX_TYPE(IOMUX_GPIO); pinctrl_configure_pins(&pin_cfg, 1, 0); diff --git a/soc/nxp/rw/soc.c b/soc/nxp/rw/soc.c index 1a52626a053..9d3b6c548f1 100644 --- a/soc/nxp/rw/soc.c +++ b/soc/nxp/rw/soc.c @@ -221,7 +221,7 @@ __ramfunc void clock_init(void) #endif #endif /* CONFIG_SPI */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dmic0), okay) && CONFIG_AUDIO_DMIC_MCUX +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmic0)) && CONFIG_AUDIO_DMIC_MCUX /* Clock DMIC from Audio PLL. PLL output is sourced from AVPLL * channel 1, which is clocked at 12.288 MHz. We can divide this * by 4 to achieve the desired DMIC bit clk of 3.072 MHz @@ -230,7 +230,7 @@ __ramfunc void clock_init(void) CLOCK_SetClkDiv(kCLOCK_DivDmicClk, 4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lcdic), okay) && CONFIG_MIPI_DBI_NXP_LCDIC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lcdic)) && CONFIG_MIPI_DBI_NXP_LCDIC CLOCK_AttachClk(kMAIN_CLK_to_LCD_CLK); RESET_PeripheralReset(kLCDIC_RST_SHIFT_RSTn); #endif @@ -250,7 +250,7 @@ __ramfunc void clock_init(void) #endif #endif /* CONFIG_COUNTER_MCUX_CTIMER */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb_otg), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb_otg)) && CONFIG_USB_DC_NXP_EHCI /* Enable system xtal from Analog */ SYSCTL2->ANA_GRP_CTRL |= SYSCTL2_ANA_GRP_CTRL_PU_AG_MASK; /* reset USB */ @@ -261,7 +261,7 @@ __ramfunc void clock_init(void) CLOCK_EnableUsbhsPhyClock(); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && CONFIG_NET_L2_ETHERNET +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) && CONFIG_NET_L2_ETHERNET RESET_PeripheralReset(kENET_IPG_RST_SHIFT_RSTn); RESET_PeripheralReset(kENET_IPG_S_RST_SHIFT_RSTn); #endif @@ -289,7 +289,7 @@ void soc_early_init_hook(void) #define PMU_RESET_CAUSES \ COND_CODE_0(IS_EMPTY(PMU_RESET_CAUSES_), (PMU_RESET_CAUSES_), (0)) #define WDT_RESET \ - COND_CODE_1(DT_NODE_HAS_STATUS(wwdt, okay), (kPOWER_ResetSourceWdt), (0)) + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(wwdt), (kPOWER_ResetSourceWdt), (0)) #define RESET_CAUSES \ (PMU_RESET_CAUSES | WDT_RESET) #else diff --git a/soc/openisa/rv32m1/soc.c b/soc/openisa/rv32m1/soc.c index 95edf0c5383..0f41fc69ca6 100644 --- a/soc/openisa/rv32m1/soc.c +++ b/soc/openisa/rv32m1/soc.c @@ -197,16 +197,16 @@ static void rv32m1_switch_to_sirc(void) */ static void rv32m1_setup_peripheral_clocks(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(tpm0)) CLOCK_SetIpSrc(kCLOCK_Tpm0, kCLOCK_IpSrcFircAsync); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(tpm1)) CLOCK_SetIpSrc(kCLOCK_Tpm1, kCLOCK_IpSrcFircAsync); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(tpm2)) CLOCK_SetIpSrc(kCLOCK_Tpm2, kCLOCK_IpSrcFircAsync); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(tpm3)) CLOCK_SetIpSrc(kCLOCK_Tpm3, kCLOCK_IpSrcFircAsync); #endif } diff --git a/soc/renesas/ra/ra4m1/soc.c b/soc/renesas/ra/ra4m1/soc.c index 7f021ba17fa..7d8f2744914 100644 --- a/soc/renesas/ra/ra4m1/soc.c +++ b/soc/renesas/ra/ra4m1/soc.c @@ -107,7 +107,7 @@ const struct opt_set_mem ops __attribute__((section(".opt_set_mem"))) = { .LVDAS = 0x1, /* Disable voltage monitor 0 following reset */ .VDSEL1 = 0x3, .RSVD2 = 0x3, - .HOCOEN = !DT_NODE_HAS_STATUS(DT_PATH(clocks, hoco), okay), + .HOCOEN = !DT_NODE_HAS_STATUS_OKAY(DT_PATH(clocks, hoco)), .RSVD3 = 0x7, .HOCOFRQ1 = OFS1_HOCO_FREQ, .RSVD4 = 0x1ffff, diff --git a/soc/renesas/smartbond/da1469x/power.c b/soc/renesas/smartbond/da1469x/power.c index 80a497acff5..fec9b5f6c62 100644 --- a/soc/renesas/smartbond/da1469x/power.c +++ b/soc/renesas/smartbond/da1469x/power.c @@ -48,7 +48,7 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) static int renesas_da1469x_pm_init(void) { static const struct da1469x_sleep_config sleep_cfg = { - .enable_xtal_on_wakeup = DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay), + .enable_xtal_on_wakeup = DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xtal32m)), }; da1469x_sleep_config(&sleep_cfg); diff --git a/soc/snps/emsk/soc_config.c b/soc/snps/emsk/soc_config.c index c43942facb0..5c18898ecd2 100644 --- a/soc/snps/emsk/soc_config.c +++ b/soc/snps/emsk/soc_config.c @@ -17,14 +17,14 @@ void soc_early_init_hook(void) /* On ARC EM Starter kit board, * send the UART the command to clear the interrupt */ -#if DT_NODE_HAS_STATUS(DT_INST(0, ns16550), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, ns16550)) sys_write32(0, DT_REG_ADDR(DT_INST(0, ns16550))+0x4); sys_write32(0, DT_REG_ADDR(DT_INST(0, ns16550))+0x10); -#endif /* DT_NODE_HAS_STATUS(DT_INST(0, ns16550), okay) */ -#if DT_NODE_HAS_STATUS(DT_INST(1, ns16550), okay) +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_INST(0, ns16550)) */ +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(1, ns16550)) sys_write32(0, DT_REG_ADDR(DT_INST(1, ns16550))+0x4); sys_write32(0, DT_REG_ADDR(DT_INST(1, ns16550))+0x10); -#endif /* DT_NODE_HAS_STATUS(DT_INST(1, ns16550), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_INST(1, ns16550)) */ } #endif /* CONFIG_UART_NS16550 */ diff --git a/soc/st/stm32/stm32h7x/mpu_regions.c b/soc/st/stm32/stm32h7x/mpu_regions.c index 29825ad226a..8582db60724 100644 --- a/soc/st/stm32/stm32h7x/mpu_regions.c +++ b/soc/st/stm32/stm32h7x/mpu_regions.c @@ -21,8 +21,8 @@ static const struct arm_mpu_region mpu_regions[] = { REGION_512K | MPU_RASR_XN_Msk | P_RW_U_NA_Msk) }), -#if DT_NODE_HAS_STATUS(DT_NODELABEL(mac), okay) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mac)) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sram3)) MPU_REGION_ENTRY("SRAM3_ETH_BUF", DT_REG_ADDR(DT_NODELABEL(sram3)), REGION_RAM_NOCACHE_ATTR(REGION_16K)), diff --git a/soc/xlnx/zynq7000/xc7zxxx/soc.c b/soc/xlnx/zynq7000/xc7zxxx/soc.c index 37d30b02426..c1dad84ff36 100644 --- a/soc/xlnx/zynq7000/xc7zxxx/soc.c +++ b/soc/xlnx/zynq7000/xc7zxxx/soc.c @@ -39,13 +39,13 @@ static const struct arm_mmu_region mmu_regions[] = { /* ARM Arch timer, GIC are covered by the MPCore mapping */ /* GEMs */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gem0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gem0)) MMU_REGION_FLAT_ENTRY("gem0", DT_REG_ADDR(DT_NODELABEL(gem0)), DT_REG_SIZE(DT_NODELABEL(gem0)), MT_DEVICE | MATTR_SHARED | MPERM_R | MPERM_W), #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gem1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gem1)) MMU_REGION_FLAT_ENTRY("gem1", DT_REG_ADDR(DT_NODELABEL(gem1)), DT_REG_SIZE(DT_NODELABEL(gem1)), @@ -53,7 +53,7 @@ static const struct arm_mmu_region mmu_regions[] = { #endif /* GPIO controller */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(psgpio), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(psgpio)) MMU_REGION_FLAT_ENTRY("psgpio", DT_REG_ADDR(DT_NODELABEL(psgpio)), DT_REG_SIZE(DT_NODELABEL(psgpio)), @@ -106,7 +106,7 @@ void soc_reset_hook(void) sctlr &= ~SCTLR_A_Msk; __set_SCTLR(sctlr); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(slcr), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(slcr)) mm_reg_t addr = DT_REG_ADDR(DT_NODELABEL(slcr)); /* Unlock System Level Control Registers (SLCR) */ diff --git a/soc/xlnx/zynq7000/xc7zxxxs/soc.c b/soc/xlnx/zynq7000/xc7zxxxs/soc.c index a46d9a21784..982ee094e01 100644 --- a/soc/xlnx/zynq7000/xc7zxxxs/soc.c +++ b/soc/xlnx/zynq7000/xc7zxxxs/soc.c @@ -39,13 +39,13 @@ static const struct arm_mmu_region mmu_regions[] = { /* ARM Arch timer, GIC are covered by the MPCore mapping */ /* GEMs */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gem0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gem0)) MMU_REGION_FLAT_ENTRY("gem0", DT_REG_ADDR(DT_NODELABEL(gem0)), DT_REG_SIZE(DT_NODELABEL(gem0)), MT_DEVICE | MATTR_SHARED | MPERM_R | MPERM_W), #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gem1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gem1)) MMU_REGION_FLAT_ENTRY("gem1", DT_REG_ADDR(DT_NODELABEL(gem1)), DT_REG_SIZE(DT_NODELABEL(gem1)), @@ -53,7 +53,7 @@ static const struct arm_mmu_region mmu_regions[] = { #endif /* GPIO controller */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(psgpio), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(psgpio)) MMU_REGION_FLAT_ENTRY("psgpio", DT_REG_ADDR(DT_NODELABEL(psgpio)), DT_REG_SIZE(DT_NODELABEL(psgpio)), @@ -106,7 +106,7 @@ void soc_reset_hook(void) sctlr &= ~SCTLR_A_Msk; __set_SCTLR(sctlr); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(slcr), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(slcr)) mm_reg_t addr = DT_REG_ADDR(DT_NODELABEL(slcr)); /* Unlock System Level Control Registers (SLCR) */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_fem.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_fem.h index b9ada56b5ab..a80de9f85e5 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_fem.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_fem.h @@ -17,9 +17,9 @@ #if DT_NODE_HAS_PROP(DT_NODELABEL(radio), fem) #define FEM_NODE DT_PHANDLE(DT_NODELABEL(radio), fem) -#if DT_NODE_HAS_STATUS(FEM_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(FEM_NODE) #define HAL_RADIO_HAVE_FEM -#endif /* DT_NODE_HAS_STATUS(FEM_NODE, okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(FEM_NODE) */ #endif /* DT_NODE_HAS_PROP(DT_NODELABEL(radio), fem)) */ /* Does FEM_NODE have a particular DT compatible? */ diff --git a/subsys/pm/policy.c b/subsys/pm/policy.c index b13017f1603..39742cdf38c 100644 --- a/subsys/pm/policy.c +++ b/subsys/pm/policy.c @@ -77,8 +77,8 @@ struct pm_state_device_constraint { * @brief Helper macro to define a device pm constraints. */ #define PM_STATE_CONSTRAINT_DEFINE(i, node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_PHANDLE_BY_IDX(node_id, \ - zephyr_disabling_power_states, i), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, \ + zephyr_disabling_power_states, i)), \ (PM_STATE_CONSTRAINT_INIT(DT_PHANDLE_BY_IDX(node_id, \ zephyr_disabling_power_states, i)),), ()) diff --git a/subsys/tracing/sysview/sysview_config.c b/subsys/tracing/sysview/sysview_config.c index e68cb4f8a79..0ef395e4516 100644 --- a/subsys/tracing/sysview/sysview_config.c +++ b/subsys/tracing/sysview/sysview_config.c @@ -97,7 +97,7 @@ void SEGGER_SYSVIEW_Conf(void) SEGGER_SYSVIEW_Init(sys_clock_hw_cycles_per_sec(), sys_clock_hw_cycles_per_sec(), &SYSVIEW_X_OS_TraceAPI, cbSendSystemDesc); -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_sram), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_sram)) SEGGER_SYSVIEW_SetRAMBase(DT_REG_ADDR(DT_CHOSEN(zephyr_sram))); #else /* Setting RAMBase is just an optimization: this value is subtracted diff --git a/subsys/usb/device/usb_device.c b/subsys/usb/device/usb_device.c index e3a065fae1a..c285817e8ed 100644 --- a/subsys/usb/device/usb_device.c +++ b/subsys/usb/device/usb_device.c @@ -1295,7 +1295,7 @@ static void forward_status_cb(enum usb_dc_status_code status, const uint8_t *par static int usb_vbus_set(bool on) { #define USB_DEV_NODE DT_CHOSEN(zephyr_usb_device) -#if DT_NODE_HAS_STATUS(USB_DEV_NODE, okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(USB_DEV_NODE) && \ DT_NODE_HAS_PROP(USB_DEV_NODE, vbus_gpios) int ret = 0; struct gpio_dt_spec gpio_dev = GPIO_DT_SPEC_GET(USB_DEV_NODE, vbus_gpios); diff --git a/tests/bluetooth/host/id/mocks/zephyr/linker/linker-defs.h b/tests/bluetooth/host/id/mocks/zephyr/linker/linker-defs.h index f2f32310870..7bd7faa7935 100644 --- a/tests/bluetooth/host/id/mocks/zephyr/linker/linker-defs.h +++ b/tests/bluetooth/host/id/mocks/zephyr/linker/linker-defs.h @@ -10,6 +10,10 @@ #undef DT_NODE_HAS_STATUS #endif +#ifdef DT_NODE_HAS_STATUS_OKAY +#undef DT_NODE_HAS_STATUS_OKAY +#endif + #ifdef DT_FOREACH_OKAY_HELPER #undef DT_FOREACH_OKAY_HELPER #endif diff --git a/tests/drivers/adc/adc_api/src/test_adc.c b/tests/drivers/adc/adc_api/src/test_adc.c index 7d778cc6ef7..e7d1958cd5a 100644 --- a/tests/drivers/adc/adc_api/src/test_adc.c +++ b/tests/drivers/adc/adc_api/src/test_adc.c @@ -55,7 +55,7 @@ const struct device *get_adc_device(void) return adc_channels[0].dev; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(test_counter), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(test_counter)) && \ defined(CONFIG_COUNTER) static void init_counter(void) { @@ -90,7 +90,7 @@ static void init_adc(void) m_sample_buffer[i] = INVALID_ADC_VALUE; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(test_counter), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(test_counter)) && \ defined(CONFIG_COUNTER) init_counter(); #endif diff --git a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_adc.c b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_adc.c index fd28729a376..4ff7aec59db 100644 --- a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_adc.c +++ b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_adc.c @@ -10,7 +10,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc1)) #undef DT_DRV_COMPAT #define DT_DRV_COMPAT st_stm32_adc diff --git a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2c.c b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2c.c index 05a6dc0528f..5a1f1998289 100644 --- a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2c.c +++ b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2c.c @@ -11,7 +11,7 @@ #include #if !defined(CONFIG_SOC_SERIES_STM32F4X) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c1)) #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_i2c_v1) #define DT_DRV_COMPAT st_stm32_i2c_v1 diff --git a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2s.c b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2s.c index 4235f04207b..c4d9c37726b 100644 --- a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2s.c +++ b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2s.c @@ -10,7 +10,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2s2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2s2)) #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_i2s) #define DT_DRV_COMPAT st_stm32_i2s diff --git a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_lptim.c b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_lptim.c index 3c85739dce9..0b04e0882e2 100644 --- a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_lptim.c +++ b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_lptim.c @@ -10,7 +10,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lptim1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptim1)) #undef DT_DRV_COMPAT #define DT_DRV_COMPAT st_stm32_lptim diff --git a/tests/drivers/clock_control/stm32_clock_configuration/stm32h7_devices/src/test_stm32_clock_configuration.c b/tests/drivers/clock_control/stm32_clock_configuration/stm32h7_devices/src/test_stm32_clock_configuration.c index d7b05edd7f6..aaa86026df4 100644 --- a/tests/drivers/clock_control/stm32_clock_configuration/stm32h7_devices/src/test_stm32_clock_configuration.c +++ b/tests/drivers/clock_control/stm32_clock_configuration/stm32h7_devices/src/test_stm32_clock_configuration.c @@ -80,7 +80,7 @@ ZTEST(stm32h7_devices_clocks, test_spi_clk_config) RCC_SPI123CLKSOURCE_CLKP, spi1_actual_domain_clk); /* Check perclk configuration */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(perck), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(perck)) uint32_t perclk_dt_domain_clk, perclk_actual_domain_clk; perclk_dt_domain_clk = DT_CLOCKS_CELL_BY_IDX(DT_NODELABEL(perck), 0, bus); diff --git a/tests/drivers/eeprom/api/src/main.c b/tests/drivers/eeprom/api/src/main.c index 5a14565cccb..5d311b7567d 100644 --- a/tests/drivers/eeprom/api/src/main.c +++ b/tests/drivers/eeprom/api/src/main.c @@ -185,9 +185,9 @@ void test_main(void) { run_tests_on_eeprom(DEVICE_DT_GET(DT_ALIAS(eeprom_0))); -#if DT_NODE_HAS_STATUS(DT_ALIAS(eeprom_1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(eeprom_1)) run_tests_on_eeprom(DEVICE_DT_GET(DT_ALIAS(eeprom_1))); -#endif /* DT_NODE_HAS_STATUS(DT_ALIAS(eeprom_1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(eeprom_1)) */ ztest_verify_all_test_suites_ran(); } diff --git a/tests/drivers/gpio/gpio_basic_api/src/main.c b/tests/drivers/gpio/gpio_basic_api/src/main.c index 67326505e98..3e11722cf8c 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/main.c +++ b/tests/drivers/gpio/gpio_basic_api/src/main.c @@ -20,7 +20,7 @@ static void board_setup(void) { -#if DT_NODE_HAS_STATUS(DT_INST(0, test_gpio_basic_api), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, test_gpio_basic_api)) /* PIN_IN and PIN_OUT must be on same controller. */ const struct device *const in_dev = DEVICE_DT_GET(DEV_OUT); const struct device *const out_dev = DEVICE_DT_GET(DEV_IN); diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h b/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h index ba3d3ae5eba..78709937089 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h +++ b/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h @@ -12,7 +12,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_INST(0, test_gpio_basic_api), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, test_gpio_basic_api)) /* Execution of the test requires hardware configuration described in * devicetree. See the test,gpio_basic_api binding local to this test @@ -29,11 +29,11 @@ #define PIN_IN DT_GPIO_PIN(DT_INST(0, test_gpio_basic_api), in_gpios) #define PIN_IN_FLAGS DT_GPIO_FLAGS(DT_INST(0, test_gpio_basic_api), in_gpios) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(gpio_0), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(gpio_0)) #define DEV DT_GPIO_CTLR(DT_ALIAS(gpio_0)) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(gpio_1), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(gpio_1)) #define DEV DT_GPIO_CTLR(DT_ALIAS(gpio_1)) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(gpio_3), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(gpio_3)) #define DEV DT_GPIO_CTLR(DT_ALIAS(gpio_3)) #else #error Unsupported board diff --git a/tests/drivers/gpio/gpio_reserved_ranges/src/main.c b/tests/drivers/gpio/gpio_reserved_ranges/src/main.c index 1a56df9adc0..351a525d2ea 100644 --- a/tests/drivers/gpio/gpio_reserved_ranges/src/main.c +++ b/tests/drivers/gpio/gpio_reserved_ranges/src/main.c @@ -33,12 +33,12 @@ ZTEST(gpio_reserved_ranges, test_path_props) ZTEST(gpio_reserved_ranges, test_has_status) { - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_1, okay), 1, ""); - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_2, okay), 1, ""); - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_3, okay), 1, ""); - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_4, okay), 1, ""); - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_5, okay), 1, ""); - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_6, okay), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_1), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_2), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_3), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_4), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_5), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_6), 1, ""); } ZTEST(gpio_reserved_ranges, test_reserved_ranges) diff --git a/tests/drivers/i2c/i2c_api/src/test_i2c.c b/tests/drivers/i2c/i2c_api/src/test_i2c.c index 9ed4162b04b..ce0256b4500 100644 --- a/tests/drivers/i2c/i2c_api/src/test_i2c.c +++ b/tests/drivers/i2c/i2c_api/src/test_i2c.c @@ -16,11 +16,11 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_0)) #define I2C_DEV_NODE DT_ALIAS(i2c_0) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(i2c_1), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_1)) #define I2C_DEV_NODE DT_ALIAS(i2c_1) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(i2c_2), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_2)) #define I2C_DEV_NODE DT_ALIAS(i2c_2) #else #error "Please set the correct I2C device" diff --git a/tests/drivers/i2c/i2c_ram/src/test_i2c_ram.c b/tests/drivers/i2c/i2c_ram/src/test_i2c_ram.c index 3992897d90f..8fb39de2517 100644 --- a/tests/drivers/i2c/i2c_ram/src/test_i2c_ram.c +++ b/tests/drivers/i2c/i2c_ram/src/test_i2c_ram.c @@ -20,7 +20,7 @@ #define RAM_ADDR (0b10100010 >> 1) -#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_ram), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_ram)) #define I2C_DEV_NODE DT_ALIAS(i2c_ram) #define TX_DATA_OFFSET 2 static uint8_t tx_data[9] = {0x00, 0x00, 'Z', 'e', 'p', 'h', 'y', 'r', '\n'}; diff --git a/tests/drivers/i2c/i2c_tca954x/src/main.c b/tests/drivers/i2c/i2c_tca954x/src/main.c index 5524b1ed4dd..c5433f93a4a 100644 --- a/tests/drivers/i2c/i2c_tca954x/src/main.c +++ b/tests/drivers/i2c/i2c_tca954x/src/main.c @@ -8,13 +8,13 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_channel_0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_channel_0)) #define I2C_0_CTRL_NODE_ID DT_ALIAS(i2c_channel_0) #else #error "I2C 0 controller device not found" #endif -#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_channel_1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_channel_1)) #define I2C_1_CTRL_NODE_ID DT_ALIAS(i2c_channel_1) #else #error "I2C 1 controller device not found" diff --git a/tests/drivers/memc/ram/src/main.c b/tests/drivers/memc/ram/src/main.c index c8de856aa46..666f422da51 100644 --- a/tests/drivers/memc/ram/src/main.c +++ b/tests/drivers/memc/ram/src/main.c @@ -32,23 +32,23 @@ static void test_ram_rw(uint32_t *mem, size_t size) } } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sdram1)) BUF_DEF(sdram1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sdram2)) BUF_DEF(sdram2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sram1)) BUF_DEF(sram1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sram2)) BUF_DEF(sram2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) BUF_DEF(psram); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ram0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ram0)) #define RAM_SIZE DT_REG_SIZE(DT_NODELABEL(ram0)) static uint32_t *buf_ram0 = (uint32_t *)DT_REG_ADDR(DT_NODELABEL(ram0)); #endif @@ -57,7 +57,7 @@ ZTEST_SUITE(test_ram, NULL, NULL, NULL, NULL, NULL); ZTEST(test_ram, test_sdram1) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sdram1)) test_ram_rw(buf_sdram1, BUF_SIZE); #else ztest_test_skip(); @@ -66,7 +66,7 @@ ZTEST(test_ram, test_sdram1) ZTEST(test_ram, test_ram0) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ram0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ram0)) test_ram_rw(buf_ram0, RAM_SIZE); #else ztest_test_skip(); @@ -75,7 +75,7 @@ ZTEST(test_ram, test_ram0) ZTEST(test_ram, test_sdram2) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sdram2)) test_ram_rw(buf_sdram2, BUF_SIZE); #else ztest_test_skip(); @@ -84,7 +84,7 @@ ZTEST(test_ram, test_sdram2) ZTEST(test_ram, test_sram1) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sram1)) test_ram_rw(buf_sram1, BUF_SIZE); #else ztest_test_skip(); @@ -93,7 +93,7 @@ ZTEST(test_ram, test_sram1) ZTEST(test_ram, test_sram2) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sram2)) test_ram_rw(buf_sram2, BUF_SIZE); #else ztest_test_skip(); @@ -102,7 +102,7 @@ ZTEST(test_ram, test_sram2) ZTEST(test_ram, test_psram) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) test_ram_rw(buf_psram, BUF_SIZE); #else ztest_test_skip(); diff --git a/tests/drivers/pwm/pwm_api/src/test_pwm.c b/tests/drivers/pwm/pwm_api/src/test_pwm.c index b5fc72b37e8..69a4dcaeacc 100644 --- a/tests/drivers/pwm/pwm_api/src/test_pwm.c +++ b/tests/drivers/pwm/pwm_api/src/test_pwm.c @@ -29,13 +29,13 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_ALIAS(pwm_0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(pwm_0)) #define PWM_DEV_NODE DT_ALIAS(pwm_0) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(pwm_1), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(pwm_1)) #define PWM_DEV_NODE DT_ALIAS(pwm_1) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(pwm_2), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(pwm_2)) #define PWM_DEV_NODE DT_ALIAS(pwm_2) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(pwm_3), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(pwm_3)) #define PWM_DEV_NODE DT_ALIAS(pwm_3) #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pwm) diff --git a/tests/drivers/smbus/smbus_api/src/test_smbus.c b/tests/drivers/smbus/smbus_api/src/test_smbus.c index 5d1dd9ca49a..7743e04fbda 100644 --- a/tests/drivers/smbus/smbus_api/src/test_smbus.c +++ b/tests/drivers/smbus/smbus_api/src/test_smbus.c @@ -14,7 +14,7 @@ #include -BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(smbus0), okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(smbus0)), "SMBus node is disabled!"); #define FAKE_ADDRESS 0x10 diff --git a/tests/drivers/smbus/smbus_api/src/test_smbus_qemu.c b/tests/drivers/smbus/smbus_api/src/test_smbus_qemu.c index 74d8ba4408e..182794e7dc9 100644 --- a/tests/drivers/smbus/smbus_api/src/test_smbus_qemu.c +++ b/tests/drivers/smbus/smbus_api/src/test_smbus_qemu.c @@ -16,7 +16,7 @@ #include #include -BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(smbus0), okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(smbus0)), "SMBus node is disabled!"); /* Qemu q35 has default emulated EEPROM-like devices */ diff --git a/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c b/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c index 3166176de43..353d189db54 100644 --- a/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c +++ b/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c @@ -66,7 +66,7 @@ * 'watchdog0' property, or one of the following watchdog compatibles * must have an enabled node. */ -#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(watchdog0)) #define WDT_NODE DT_ALIAS(watchdog0) #elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_window_watchdog) #define WDT_NODE DT_INST(0, st_stm32_window_watchdog) @@ -148,7 +148,7 @@ static struct wdt_timeout_cfg m_cfg_wdt1; #define DATATYPE uint32_t #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #define NOINIT_SECTION ".dtcm_noinit.test_wdt" #else #define NOINIT_SECTION ".noinit.test_wdt" diff --git a/tests/drivers/watchdog/wdt_basic_reset_none/src/main.c b/tests/drivers/watchdog/wdt_basic_reset_none/src/main.c index 6a025a1478c..9fa3e0bd752 100644 --- a/tests/drivers/watchdog/wdt_basic_reset_none/src/main.c +++ b/tests/drivers/watchdog/wdt_basic_reset_none/src/main.c @@ -13,7 +13,7 @@ * 'watchdog0' property, or one of the following watchdog compatibles * must have an enabled node. */ -#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(watchdog0)) #define WDT_NODE DT_ALIAS(watchdog0) #elif DT_HAS_COMPAT_STATUS_OKAY(nxp_s32_swt) #define WDT_NODE DT_INST(0, nxp_s32_swt) diff --git a/tests/drivers/watchdog/wdt_error_cases/src/main.c b/tests/drivers/watchdog/wdt_error_cases/src/main.c index c1adc43eea3..b05bedf01c3 100644 --- a/tests/drivers/watchdog/wdt_error_cases/src/main.c +++ b/tests/drivers/watchdog/wdt_error_cases/src/main.c @@ -13,7 +13,7 @@ * 'watchdog0' property, or one of the following watchdog compatibles * must have an enabled node. */ -#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(watchdog0)) #define WDT_NODE DT_ALIAS(watchdog0) #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_wdt) #define WDT_NODE DT_INST(0, nordic_nrf_wdt) @@ -21,7 +21,7 @@ #define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_counter_watchdog) #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #define NOINIT_SECTION ".dtcm_noinit.test_wdt" #else #define NOINIT_SECTION ".noinit.test_wdt" From 3166c78d1b08b98de21ab7a729af5b336aa9662a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 22 Oct 2024 16:00:54 +0200 Subject: [PATCH 7/8] [nrf fromtree] pm: policy: split policy APIs implementations policy.c has grown organically, it contained many independent pieces of code. This patch splits each logical unit into its own C file, making it easier to browse the code. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 6f4bb118a8002acf2059d34b4408c97716577815) --- subsys/pm/CMakeLists.txt | 4 +- subsys/pm/Kconfig | 31 +- subsys/pm/policy.c | 456 -------------------------- subsys/pm/policy/CMakeLists.txt | 14 + subsys/pm/policy/Kconfig | 34 ++ subsys/pm/policy/policy_default.c | 79 +++++ subsys/pm/policy/policy_device_lock.c | 120 +++++++ subsys/pm/policy/policy_events.c | 101 ++++++ subsys/pm/policy/policy_latency.c | 107 ++++++ subsys/pm/policy/policy_state_lock.c | 86 +++++ 10 files changed, 546 insertions(+), 486 deletions(-) delete mode 100644 subsys/pm/policy.c create mode 100644 subsys/pm/policy/CMakeLists.txt create mode 100644 subsys/pm/policy/Kconfig create mode 100644 subsys/pm/policy/policy_default.c create mode 100644 subsys/pm/policy/policy_device_lock.c create mode 100644 subsys/pm/policy/policy_events.c create mode 100644 subsys/pm/policy/policy_latency.c create mode 100644 subsys/pm/policy/policy_state_lock.c diff --git a/subsys/pm/CMakeLists.txt b/subsys/pm/CMakeLists.txt index 0e961abda78..67d67729d8a 100644 --- a/subsys/pm/CMakeLists.txt +++ b/subsys/pm/CMakeLists.txt @@ -1,10 +1,12 @@ # SPDX-License-Identifier: Apache-2.0 if(CONFIG_PM) - zephyr_sources(pm.c policy.c state.c) + zephyr_sources(pm.c state.c) zephyr_sources_ifdef(CONFIG_PM_STATS pm_stats.c) endif() +add_subdirectory(policy) + zephyr_sources_ifdef(CONFIG_PM_DEVICE device.c) zephyr_sources_ifdef(CONFIG_PM_DEVICE_RUNTIME device_runtime.c) zephyr_sources_ifdef(CONFIG_PM_DEVICE_SHELL pm_shell.c) diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index bf69f778081..8acee7c6848 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -19,6 +19,8 @@ config PM power management subsystem of the number of ticks until the next kernel timer is due to expire. +rsource "policy/Kconfig" + if PM module = PM @@ -51,35 +53,6 @@ config PM_NEED_ALL_DEVICES_IDLE When this option is enabled, check that no devices are busy before entering into system low power mode. -choice PM_POLICY - prompt "Idle State Power Management Policy" - default PM_POLICY_DEFAULT - help - Select the idle state power management policy. - -config PM_POLICY_DEFAULT - bool "Default PM policy" - help - This option selects the default PM policy. Default policy is based - on CPU residency times and other constraints imposed by the drivers or - application. - -config PM_POLICY_CUSTOM - bool "Custom PM Policy" - help - This options allows applications to override the default policy with - a custom implementation. - -endchoice - -config PM_POLICY_DEVICE_CONSTRAINTS - bool "Power state constraints per device" - help - This option allows devices to have a list of power states - that when the system transition to them, cause power loss in the device. - This used to set and release power state constraints when - it is needed by the device. - endif # PM config PM_DEVICE diff --git a/subsys/pm/policy.c b/subsys/pm/policy.c deleted file mode 100644 index 39742cdf38c..00000000000 --- a/subsys/pm/policy.c +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright (c) 2018 Intel Corporation. - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) - -#define DT_SUB_LOCK_INIT(node_id) \ - { .state = PM_STATE_DT_INIT(node_id), \ - .substate_id = DT_PROP_OR(node_id, substate_id, 0), \ - .lock = ATOMIC_INIT(0), \ - }, - -/** - * State and substate lock structure. - * - * This struct is associating a reference counting to each - * couple to be used with the pm_policy_substate_lock_* functions. - * - * Operations on this array are in the order of O(n) with the number of power - * states and this is mostly due to the random nature of the substate value - * (that can be anything from a small integer value to a bitmask). We can - * probably do better with an hashmap. - */ -static struct { - enum pm_state state; - uint8_t substate_id; - atomic_t lock; -} substate_lock_t[] = { - DT_FOREACH_STATUS_OKAY(zephyr_power_state, DT_SUB_LOCK_INIT) -}; - -#endif - -#if defined(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) - -struct pm_state_device_constraint { - const struct device *const dev; - size_t pm_constraints_size; - struct pm_state_constraint *constraints; -}; - -/** - * @brief Synthesize the name of the object that holds a device pm constraint. - * - * @param dev_id Device identifier. - */ -#define PM_CONSTRAINTS_NAME(node_id) _CONCAT(__devicepmconstraints_, node_id) - -/** - * @brief initialize a device pm constraint with information from devicetree. - * - * @param node_id Node identifier. - */ -#define PM_STATE_CONSTRAINT_INIT(node_id) \ - { \ - .state = PM_STATE_DT_INIT(node_id), \ - .substate_id = DT_PROP_OR(node_id, substate_id, 0), \ - } - -/** - * @brief Helper macro to define a device pm constraints. - */ -#define PM_STATE_CONSTRAINT_DEFINE(i, node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, \ - zephyr_disabling_power_states, i)), \ - (PM_STATE_CONSTRAINT_INIT(DT_PHANDLE_BY_IDX(node_id, \ - zephyr_disabling_power_states, i)),), ()) - -/** - * @brief Helper macro to generate a list of device pm constraints. - */ -#define PM_STATE_CONSTRAINTS_DEFINE(node_id) \ - { \ - LISTIFY(DT_PROP_LEN_OR(node_id, zephyr_disabling_power_states, 0), \ - PM_STATE_CONSTRAINT_DEFINE, (), node_id) \ - } - -/** - * @brief Helper macro to define an array of device pm constraints. - */ -#define CONSTRAINTS_DEFINE(node_id) \ - Z_DECL_ALIGN(struct pm_state_constraint) \ - PM_CONSTRAINTS_NAME(node_id)[] = \ - PM_STATE_CONSTRAINTS_DEFINE(node_id); - -#define DEVICE_CONSTRAINTS_DEFINE(node_id) \ - COND_CODE_0(DT_NODE_HAS_PROP(node_id, zephyr_disabling_power_states), (), \ - (CONSTRAINTS_DEFINE(node_id))) - -DT_FOREACH_STATUS_OKAY_NODE(DEVICE_CONSTRAINTS_DEFINE) - -/** - * @brief Helper macro to initialize a pm state device constraint - */ -#define PM_STATE_DEVICE_CONSTRAINT_INIT(node_id) \ - { \ - .dev = DEVICE_DT_GET(node_id), \ - .pm_constraints_size = DT_PROP_LEN(node_id, zephyr_disabling_power_states), \ - .constraints = PM_CONSTRAINTS_NAME(node_id), \ - }, - -/** - * @brief Helper macro to initialize a pm state device constraint - */ -#define PM_STATE_DEVICE_CONSTRAINT_DEFINE(node_id) \ - COND_CODE_0(DT_NODE_HAS_PROP(node_id, zephyr_disabling_power_states), (), \ - (PM_STATE_DEVICE_CONSTRAINT_INIT(node_id))) - -static struct pm_state_device_constraint _devices_constraints[] = { - DT_FOREACH_STATUS_OKAY_NODE(PM_STATE_DEVICE_CONSTRAINT_DEFINE) -}; - -#endif /* CONFIG_PM_POLICY_DEVICE_CONSTRAINTS */ - -/** Lock to synchronize access to the latency request list. */ -static struct k_spinlock latency_lock; -/** List of maximum latency requests. */ -static sys_slist_t latency_reqs; -/** Maximum CPU latency in us */ -static int32_t max_latency_us = SYS_FOREVER_US; -/** Maximum CPU latency in cycles */ -static int32_t max_latency_cyc = -1; -/** List of latency change subscribers. */ -static sys_slist_t latency_subs; - -/** Lock to synchronize access to the events list. */ -static struct k_spinlock events_lock; -/** List of events. */ -static sys_slist_t events_list; -/** Pointer to Next Event. */ -static struct pm_policy_event *next_event; - -/** @brief Update maximum allowed latency. */ -static void update_max_latency(void) -{ - int32_t new_max_latency_us = SYS_FOREVER_US; - struct pm_policy_latency_request *req; - - SYS_SLIST_FOR_EACH_CONTAINER(&latency_reqs, req, node) { - if ((new_max_latency_us == SYS_FOREVER_US) || - ((int32_t)req->value_us < new_max_latency_us)) { - new_max_latency_us = (int32_t)req->value_us; - } - } - - if (max_latency_us != new_max_latency_us) { - struct pm_policy_latency_subscription *sreq; - int32_t new_max_latency_cyc = -1; - - SYS_SLIST_FOR_EACH_CONTAINER(&latency_subs, sreq, node) { - sreq->cb(new_max_latency_us); - } - - if (new_max_latency_us != SYS_FOREVER_US) { - new_max_latency_cyc = (int32_t)k_us_to_cyc_ceil32(new_max_latency_us); - } - - max_latency_us = new_max_latency_us; - max_latency_cyc = new_max_latency_cyc; - } -} - -/** @brief Update next event. */ -static void update_next_event(uint32_t cyc) -{ - int64_t new_next_event_cyc = -1; - struct pm_policy_event *evt; - - /* unset the next event pointer */ - next_event = NULL; - - SYS_SLIST_FOR_EACH_CONTAINER(&events_list, evt, node) { - uint64_t cyc_evt = evt->value_cyc; - - /* - * cyc value is a 32-bit rolling counter: - * - * |---------------->-----------------------| - * 0 cyc UINT32_MAX - * - * Values from [0, cyc) are events happening later than - * [cyc, UINT32_MAX], so pad [0, cyc) with UINT32_MAX + 1 to do - * the comparison. - */ - if (cyc_evt < cyc) { - cyc_evt += (uint64_t)UINT32_MAX + 1U; - } - - if ((new_next_event_cyc < 0) || (cyc_evt < new_next_event_cyc)) { - new_next_event_cyc = cyc_evt; - next_event = evt; - } - } -} - -int32_t pm_policy_next_event_ticks(void) -{ - int32_t cyc_evt = -1; - - if ((next_event) && (next_event->value_cyc > 0)) { - cyc_evt = next_event->value_cyc - k_cycle_get_32(); - cyc_evt = MAX(0, cyc_evt); - BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC >= CONFIG_SYS_CLOCK_TICKS_PER_SEC, - "HW Cycles per sec should be greater that ticks per sec"); - return k_cyc_to_ticks_floor32(cyc_evt); - } - - return -1; -} - -#ifdef CONFIG_PM_POLICY_DEFAULT -const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int32_t ticks) -{ - int64_t cyc = -1; - uint8_t num_cpu_states; - const struct pm_state_info *cpu_states; - -#ifdef CONFIG_PM_NEED_ALL_DEVICES_IDLE - if (pm_device_is_any_busy()) { - return NULL; - } -#endif - - if (ticks != K_TICKS_FOREVER) { - cyc = k_ticks_to_cyc_ceil32(ticks); - } - - num_cpu_states = pm_state_cpu_get_all(cpu, &cpu_states); - - if ((next_event) && (next_event->value_cyc >= 0)) { - uint32_t cyc_curr = k_cycle_get_32(); - int64_t cyc_evt = next_event->value_cyc - cyc_curr; - - /* event happening after cycle counter max value, pad */ - if (next_event->value_cyc <= cyc_curr) { - cyc_evt += UINT32_MAX; - } - - if (cyc_evt > 0) { - /* if there's no system wakeup event always wins, - * otherwise, who comes earlier wins - */ - if (cyc < 0) { - cyc = cyc_evt; - } else { - cyc = MIN(cyc, cyc_evt); - } - } - } - - for (int16_t i = (int16_t)num_cpu_states - 1; i >= 0; i--) { - const struct pm_state_info *state = &cpu_states[i]; - uint32_t min_residency_cyc, exit_latency_cyc; - - /* check if there is a lock on state + substate */ - if (pm_policy_state_lock_is_active(state->state, state->substate_id)) { - continue; - } - - min_residency_cyc = k_us_to_cyc_ceil32(state->min_residency_us); - exit_latency_cyc = k_us_to_cyc_ceil32(state->exit_latency_us); - - /* skip state if it brings too much latency */ - if ((max_latency_cyc >= 0) && - (exit_latency_cyc >= max_latency_cyc)) { - continue; - } - - if ((cyc < 0) || - (cyc >= (min_residency_cyc + exit_latency_cyc))) { - return state; - } - } - - return NULL; -} -#endif - -void pm_policy_state_lock_get(enum pm_state state, uint8_t substate_id) -{ -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) - for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { - if (substate_lock_t[i].state == state && - (substate_lock_t[i].substate_id == substate_id || - substate_id == PM_ALL_SUBSTATES)) { - atomic_inc(&substate_lock_t[i].lock); - } - } -#endif -} - -void pm_policy_state_lock_put(enum pm_state state, uint8_t substate_id) -{ -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) - for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { - if (substate_lock_t[i].state == state && - (substate_lock_t[i].substate_id == substate_id || - substate_id == PM_ALL_SUBSTATES)) { - atomic_t cnt = atomic_dec(&substate_lock_t[i].lock); - - ARG_UNUSED(cnt); - - __ASSERT(cnt >= 1, "Unbalanced state lock get/put"); - } - } -#endif -} - -bool pm_policy_state_lock_is_active(enum pm_state state, uint8_t substate_id) -{ -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) - for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { - if (substate_lock_t[i].state == state && - (substate_lock_t[i].substate_id == substate_id || - substate_id == PM_ALL_SUBSTATES)) { - return (atomic_get(&substate_lock_t[i].lock) != 0); - } - } -#endif - - return false; -} - -void pm_policy_latency_request_add(struct pm_policy_latency_request *req, - uint32_t value_us) -{ - req->value_us = value_us; - - k_spinlock_key_t key = k_spin_lock(&latency_lock); - - sys_slist_append(&latency_reqs, &req->node); - update_max_latency(); - - k_spin_unlock(&latency_lock, key); -} - -void pm_policy_latency_request_update(struct pm_policy_latency_request *req, - uint32_t value_us) -{ - k_spinlock_key_t key = k_spin_lock(&latency_lock); - - req->value_us = value_us; - update_max_latency(); - - k_spin_unlock(&latency_lock, key); -} - -void pm_policy_latency_request_remove(struct pm_policy_latency_request *req) -{ - k_spinlock_key_t key = k_spin_lock(&latency_lock); - - (void)sys_slist_find_and_remove(&latency_reqs, &req->node); - update_max_latency(); - - k_spin_unlock(&latency_lock, key); -} - -void pm_policy_latency_changed_subscribe(struct pm_policy_latency_subscription *req, - pm_policy_latency_changed_cb_t cb) -{ - k_spinlock_key_t key = k_spin_lock(&latency_lock); - - req->cb = cb; - sys_slist_append(&latency_subs, &req->node); - - k_spin_unlock(&latency_lock, key); -} - -void pm_policy_latency_changed_unsubscribe(struct pm_policy_latency_subscription *req) -{ - k_spinlock_key_t key = k_spin_lock(&latency_lock); - - (void)sys_slist_find_and_remove(&latency_subs, &req->node); - - k_spin_unlock(&latency_lock, key); -} - -void pm_policy_event_register(struct pm_policy_event *evt, uint32_t time_us) -{ - k_spinlock_key_t key = k_spin_lock(&events_lock); - uint32_t cyc = k_cycle_get_32(); - - evt->value_cyc = cyc + k_us_to_cyc_ceil32(time_us); - sys_slist_append(&events_list, &evt->node); - update_next_event(cyc); - - k_spin_unlock(&events_lock, key); -} - -void pm_policy_event_update(struct pm_policy_event *evt, uint32_t cycle) -{ - k_spinlock_key_t key = k_spin_lock(&events_lock); - - evt->value_cyc = cycle; - update_next_event(k_cycle_get_32()); - - k_spin_unlock(&events_lock, key); -} - -void pm_policy_event_unregister(struct pm_policy_event *evt) -{ - k_spinlock_key_t key = k_spin_lock(&events_lock); - - (void)sys_slist_find_and_remove(&events_list, &evt->node); - update_next_event(k_cycle_get_32()); - - k_spin_unlock(&events_lock, key); -} - -void pm_policy_device_power_lock_get(const struct device *dev) -{ -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) && defined(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) - for (size_t i = 0; i < ARRAY_SIZE(_devices_constraints); i++) { - if (_devices_constraints[i].dev == dev) { - for (size_t j = 0; j < _devices_constraints[i].pm_constraints_size; j++) { - pm_policy_state_lock_get( - _devices_constraints[i].constraints[j].state, - _devices_constraints[i].constraints[j].substate_id); - } - break; - } - } -#endif -} - -void pm_policy_device_power_lock_put(const struct device *dev) -{ -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) && defined(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) - for (size_t i = 0; i < ARRAY_SIZE(_devices_constraints); i++) { - if (_devices_constraints[i].dev == dev) { - for (size_t j = 0; j < _devices_constraints[i].pm_constraints_size; j++) { - pm_policy_state_lock_put( - _devices_constraints[i].constraints[j].state, - _devices_constraints[i].constraints[j].substate_id); - } - break; - } - } -#endif -} diff --git a/subsys/pm/policy/CMakeLists.txt b/subsys/pm/policy/CMakeLists.txt new file mode 100644 index 00000000000..e9d7d791ec5 --- /dev/null +++ b/subsys/pm/policy/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_PM) + zephyr_library_sources(policy_events.c policy_latency.c policy_state_lock.c) + + if(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) + zephyr_library_sources(policy_device_lock.c) + endif() + + if(CONFIG_PM_POLICY_DEFAULT) + zephyr_library_sources(policy_default.c) + endif() +endif() diff --git a/subsys/pm/policy/Kconfig b/subsys/pm/policy/Kconfig new file mode 100644 index 00000000000..2060c52cb13 --- /dev/null +++ b/subsys/pm/policy/Kconfig @@ -0,0 +1,34 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if PM +choice PM_POLICY + prompt "Idle State Power Management Policy" + default PM_POLICY_DEFAULT + help + Select the idle state power management policy. + +config PM_POLICY_DEFAULT + bool "Default PM policy" + help + This option selects the default PM policy. Default policy is based + on CPU residency times and other constraints imposed by the drivers or + application. + +config PM_POLICY_CUSTOM + bool "Custom PM Policy" + help + This options allows applications to override the default policy with + a custom implementation. + +endchoice + +config PM_POLICY_DEVICE_CONSTRAINTS + bool "Power state constraints per device" + help + This option allows devices to have a list of power states + that when the system transition to them, cause power loss in the device. + This used to set and release power state constraints when + it is needed by the device. + +endif # PM diff --git a/subsys/pm/policy/policy_default.c b/subsys/pm/policy/policy_default.c new file mode 100644 index 00000000000..74a0443e6cd --- /dev/null +++ b/subsys/pm/policy/policy_default.c @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2018 Intel Corporation. + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +extern struct pm_policy_event *next_event; +extern int32_t max_latency_cyc; + +const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int32_t ticks) +{ + int64_t cyc = -1; + uint8_t num_cpu_states; + const struct pm_state_info *cpu_states; + +#ifdef CONFIG_PM_NEED_ALL_DEVICES_IDLE + if (pm_device_is_any_busy()) { + return NULL; + } +#endif + + if (ticks != K_TICKS_FOREVER) { + cyc = k_ticks_to_cyc_ceil32(ticks); + } + + num_cpu_states = pm_state_cpu_get_all(cpu, &cpu_states); + + if ((next_event) && (next_event->value_cyc >= 0)) { + uint32_t cyc_curr = k_cycle_get_32(); + int64_t cyc_evt = next_event->value_cyc - cyc_curr; + + /* event happening after cycle counter max value, pad */ + if (next_event->value_cyc <= cyc_curr) { + cyc_evt += UINT32_MAX; + } + + if (cyc_evt > 0) { + /* if there's no system wakeup event always wins, + * otherwise, who comes earlier wins + */ + if (cyc < 0) { + cyc = cyc_evt; + } else { + cyc = MIN(cyc, cyc_evt); + } + } + } + + for (int16_t i = (int16_t)num_cpu_states - 1; i >= 0; i--) { + const struct pm_state_info *state = &cpu_states[i]; + uint32_t min_residency_cyc, exit_latency_cyc; + + /* check if there is a lock on state + substate */ + if (pm_policy_state_lock_is_active(state->state, state->substate_id)) { + continue; + } + + min_residency_cyc = k_us_to_cyc_ceil32(state->min_residency_us); + exit_latency_cyc = k_us_to_cyc_ceil32(state->exit_latency_us); + + /* skip state if it brings too much latency */ + if ((max_latency_cyc >= 0) && + (exit_latency_cyc >= max_latency_cyc)) { + continue; + } + + if ((cyc < 0) || + (cyc >= (min_residency_cyc + exit_latency_cyc))) { + return state; + } + } + + return NULL; +} diff --git a/subsys/pm/policy/policy_device_lock.c b/subsys/pm/policy/policy_device_lock.c new file mode 100644 index 00000000000..b508819fb73 --- /dev/null +++ b/subsys/pm/policy/policy_device_lock.c @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2018 Intel Corporation. + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +struct pm_state_device_constraint { + const struct device *const dev; + size_t pm_constraints_size; + struct pm_state_constraint *constraints; +}; + +/** + * @brief Synthesize the name of the object that holds a device pm constraint. + * + * @param dev_id Device identifier. + */ +#define PM_CONSTRAINTS_NAME(node_id) _CONCAT(__devicepmconstraints_, node_id) + +/** + * @brief initialize a device pm constraint with information from devicetree. + * + * @param node_id Node identifier. + */ +#define PM_STATE_CONSTRAINT_INIT(node_id) \ + { \ + .state = PM_STATE_DT_INIT(node_id), \ + .substate_id = DT_PROP_OR(node_id, substate_id, 0), \ + } + +/** + * @brief Helper macro to define a device pm constraints. + */ +#define PM_STATE_CONSTRAINT_DEFINE(i, node_id) \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, \ + zephyr_disabling_power_states, i)), \ + (PM_STATE_CONSTRAINT_INIT(DT_PHANDLE_BY_IDX(node_id, \ + zephyr_disabling_power_states, i)),), ()) + +/** + * @brief Helper macro to generate a list of device pm constraints. + */ +#define PM_STATE_CONSTRAINTS_DEFINE(node_id) \ + { \ + LISTIFY(DT_PROP_LEN_OR(node_id, zephyr_disabling_power_states, 0), \ + PM_STATE_CONSTRAINT_DEFINE, (), node_id) \ + } + +/** + * @brief Helper macro to define an array of device pm constraints. + */ +#define CONSTRAINTS_DEFINE(node_id) \ + Z_DECL_ALIGN(struct pm_state_constraint) \ + PM_CONSTRAINTS_NAME(node_id)[] = \ + PM_STATE_CONSTRAINTS_DEFINE(node_id); + +#define DEVICE_CONSTRAINTS_DEFINE(node_id) \ + COND_CODE_0(DT_NODE_HAS_PROP(node_id, zephyr_disabling_power_states), (), \ + (CONSTRAINTS_DEFINE(node_id))) + +DT_FOREACH_STATUS_OKAY_NODE(DEVICE_CONSTRAINTS_DEFINE) + +/** + * @brief Helper macro to initialize a pm state device constraint + */ +#define PM_STATE_DEVICE_CONSTRAINT_INIT(node_id) \ + { \ + .dev = DEVICE_DT_GET(node_id), \ + .pm_constraints_size = DT_PROP_LEN(node_id, zephyr_disabling_power_states), \ + .constraints = PM_CONSTRAINTS_NAME(node_id), \ + }, + +/** + * @brief Helper macro to initialize a pm state device constraint + */ +#define PM_STATE_DEVICE_CONSTRAINT_DEFINE(node_id) \ + COND_CODE_0(DT_NODE_HAS_PROP(node_id, zephyr_disabling_power_states), (), \ + (PM_STATE_DEVICE_CONSTRAINT_INIT(node_id))) + +static struct pm_state_device_constraint _devices_constraints[] = { + DT_FOREACH_STATUS_OKAY_NODE(PM_STATE_DEVICE_CONSTRAINT_DEFINE) +}; + +void pm_policy_device_power_lock_get(const struct device *dev) +{ +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + for (size_t i = 0; i < ARRAY_SIZE(_devices_constraints); i++) { + if (_devices_constraints[i].dev == dev) { + for (size_t j = 0; j < _devices_constraints[i].pm_constraints_size; j++) { + pm_policy_state_lock_get( + _devices_constraints[i].constraints[j].state, + _devices_constraints[i].constraints[j].substate_id); + } + break; + } + } +#endif +} + +void pm_policy_device_power_lock_put(const struct device *dev) +{ +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + for (size_t i = 0; i < ARRAY_SIZE(_devices_constraints); i++) { + if (_devices_constraints[i].dev == dev) { + for (size_t j = 0; j < _devices_constraints[i].pm_constraints_size; j++) { + pm_policy_state_lock_put( + _devices_constraints[i].constraints[j].state, + _devices_constraints[i].constraints[j].substate_id); + } + break; + } + } +#endif +} diff --git a/subsys/pm/policy/policy_events.c b/subsys/pm/policy/policy_events.c new file mode 100644 index 00000000000..dc06bffdf55 --- /dev/null +++ b/subsys/pm/policy/policy_events.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2018 Intel Corporation. + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include +#include +#include + +/** Lock to synchronize access to the events list. */ +static struct k_spinlock events_lock; +/** List of events. */ +static sys_slist_t events_list; +/** Pointer to Next Event. */ +struct pm_policy_event *next_event; + +/** @brief Update next event. */ +static void update_next_event(uint32_t cyc) +{ + int64_t new_next_event_cyc = -1; + struct pm_policy_event *evt; + + /* unset the next event pointer */ + next_event = NULL; + + SYS_SLIST_FOR_EACH_CONTAINER(&events_list, evt, node) { + uint64_t cyc_evt = evt->value_cyc; + + /* + * cyc value is a 32-bit rolling counter: + * + * |---------------->-----------------------| + * 0 cyc UINT32_MAX + * + * Values from [0, cyc) are events happening later than + * [cyc, UINT32_MAX], so pad [0, cyc) with UINT32_MAX + 1 to do + * the comparison. + */ + if (cyc_evt < cyc) { + cyc_evt += (uint64_t)UINT32_MAX + 1U; + } + + if ((new_next_event_cyc < 0) || (cyc_evt < new_next_event_cyc)) { + new_next_event_cyc = cyc_evt; + next_event = evt; + } + } +} + +int32_t pm_policy_next_event_ticks(void) +{ + int32_t cyc_evt = -1; + + if ((next_event) && (next_event->value_cyc > 0)) { + cyc_evt = next_event->value_cyc - k_cycle_get_32(); + cyc_evt = MAX(0, cyc_evt); + BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC >= CONFIG_SYS_CLOCK_TICKS_PER_SEC, + "HW Cycles per sec should be greater that ticks per sec"); + return k_cyc_to_ticks_floor32(cyc_evt); + } + + return -1; +} + +void pm_policy_event_register(struct pm_policy_event *evt, uint32_t time_us) +{ + k_spinlock_key_t key = k_spin_lock(&events_lock); + uint32_t cyc = k_cycle_get_32(); + + evt->value_cyc = cyc + k_us_to_cyc_ceil32(time_us); + sys_slist_append(&events_list, &evt->node); + update_next_event(cyc); + + k_spin_unlock(&events_lock, key); +} + +void pm_policy_event_update(struct pm_policy_event *evt, uint32_t cycle) +{ + k_spinlock_key_t key = k_spin_lock(&events_lock); + + evt->value_cyc = cycle; + update_next_event(k_cycle_get_32()); + + k_spin_unlock(&events_lock, key); +} + +void pm_policy_event_unregister(struct pm_policy_event *evt) +{ + k_spinlock_key_t key = k_spin_lock(&events_lock); + + (void)sys_slist_find_and_remove(&events_list, &evt->node); + update_next_event(k_cycle_get_32()); + + k_spin_unlock(&events_lock, key); +} diff --git a/subsys/pm/policy/policy_latency.c b/subsys/pm/policy/policy_latency.c new file mode 100644 index 00000000000..68e6ffcc5d5 --- /dev/null +++ b/subsys/pm/policy/policy_latency.c @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2018 Intel Corporation. + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include + +/** Lock to synchronize access to the latency request list. */ +static struct k_spinlock latency_lock; +/** List of maximum latency requests. */ +static sys_slist_t latency_reqs; +/** Maximum CPU latency in us */ +static int32_t max_latency_us = SYS_FOREVER_US; +/** Maximum CPU latency in cycles */ +int32_t max_latency_cyc = -1; +/** List of latency change subscribers. */ +static sys_slist_t latency_subs; + +/** @brief Update maximum allowed latency. */ +static void update_max_latency(void) +{ + int32_t new_max_latency_us = SYS_FOREVER_US; + struct pm_policy_latency_request *req; + + SYS_SLIST_FOR_EACH_CONTAINER(&latency_reqs, req, node) { + if ((new_max_latency_us == SYS_FOREVER_US) || + ((int32_t)req->value_us < new_max_latency_us)) { + new_max_latency_us = (int32_t)req->value_us; + } + } + + if (max_latency_us != new_max_latency_us) { + struct pm_policy_latency_subscription *sreq; + int32_t new_max_latency_cyc = -1; + + SYS_SLIST_FOR_EACH_CONTAINER(&latency_subs, sreq, node) { + sreq->cb(new_max_latency_us); + } + + if (new_max_latency_us != SYS_FOREVER_US) { + new_max_latency_cyc = (int32_t)k_us_to_cyc_ceil32(new_max_latency_us); + } + + max_latency_us = new_max_latency_us; + max_latency_cyc = new_max_latency_cyc; + } +} + +void pm_policy_latency_request_add(struct pm_policy_latency_request *req, + uint32_t value_us) +{ + req->value_us = value_us; + + k_spinlock_key_t key = k_spin_lock(&latency_lock); + + sys_slist_append(&latency_reqs, &req->node); + update_max_latency(); + + k_spin_unlock(&latency_lock, key); +} + +void pm_policy_latency_request_update(struct pm_policy_latency_request *req, + uint32_t value_us) +{ + k_spinlock_key_t key = k_spin_lock(&latency_lock); + + req->value_us = value_us; + update_max_latency(); + + k_spin_unlock(&latency_lock, key); +} + +void pm_policy_latency_request_remove(struct pm_policy_latency_request *req) +{ + k_spinlock_key_t key = k_spin_lock(&latency_lock); + + (void)sys_slist_find_and_remove(&latency_reqs, &req->node); + update_max_latency(); + + k_spin_unlock(&latency_lock, key); +} + +void pm_policy_latency_changed_subscribe(struct pm_policy_latency_subscription *req, + pm_policy_latency_changed_cb_t cb) +{ + k_spinlock_key_t key = k_spin_lock(&latency_lock); + + req->cb = cb; + sys_slist_append(&latency_subs, &req->node); + + k_spin_unlock(&latency_lock, key); +} + +void pm_policy_latency_changed_unsubscribe(struct pm_policy_latency_subscription *req) +{ + k_spinlock_key_t key = k_spin_lock(&latency_lock); + + (void)sys_slist_find_and_remove(&latency_subs, &req->node); + + k_spin_unlock(&latency_lock, key); +} diff --git a/subsys/pm/policy/policy_state_lock.c b/subsys/pm/policy/policy_state_lock.c new file mode 100644 index 00000000000..3876b76c804 --- /dev/null +++ b/subsys/pm/policy/policy_state_lock.c @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2018 Intel Corporation. + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + +#define DT_SUB_LOCK_INIT(node_id) \ + { .state = PM_STATE_DT_INIT(node_id), \ + .substate_id = DT_PROP_OR(node_id, substate_id, 0), \ + .lock = ATOMIC_INIT(0), \ + }, + +/** + * State and substate lock structure. + * + * This struct is associating a reference counting to each + * couple to be used with the pm_policy_substate_lock_* functions. + * + * Operations on this array are in the order of O(n) with the number of power + * states and this is mostly due to the random nature of the substate value + * (that can be anything from a small integer value to a bitmask). We can + * probably do better with an hashmap. + */ +static struct { + enum pm_state state; + uint8_t substate_id; + atomic_t lock; +} substate_lock_t[] = { + DT_FOREACH_STATUS_OKAY(zephyr_power_state, DT_SUB_LOCK_INIT) +}; + +#endif + +void pm_policy_state_lock_get(enum pm_state state, uint8_t substate_id) +{ +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { + if (substate_lock_t[i].state == state && + (substate_lock_t[i].substate_id == substate_id || + substate_id == PM_ALL_SUBSTATES)) { + atomic_inc(&substate_lock_t[i].lock); + } + } +#endif +} + +void pm_policy_state_lock_put(enum pm_state state, uint8_t substate_id) +{ +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { + if (substate_lock_t[i].state == state && + (substate_lock_t[i].substate_id == substate_id || + substate_id == PM_ALL_SUBSTATES)) { + atomic_t cnt = atomic_dec(&substate_lock_t[i].lock); + + ARG_UNUSED(cnt); + + __ASSERT(cnt >= 1, "Unbalanced state lock get/put"); + } + } +#endif +} + +bool pm_policy_state_lock_is_active(enum pm_state state, uint8_t substate_id) +{ +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { + if (substate_lock_t[i].state == state && + (substate_lock_t[i].substate_id == substate_id || + substate_id == PM_ALL_SUBSTATES)) { + return (atomic_get(&substate_lock_t[i].lock) != 0); + } + } +#endif + + return false; +} From e2dec8beace4ee2ba3d6991c0e424e8fb9eab1de Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 22 Oct 2024 16:07:52 +0200 Subject: [PATCH 8/8] [nrf fromtree] pm: policy: allow using latency API in standalone mode This option allows using the pm_policy_latency* APIs to gather latency requirements on systems that do not support PM (e.g. systems whithout CPU idle states). Because the API has a subscription mechanism, it can be useful to perform system-level adjustments based on latency requirements gathered from multiple system components. Signed-off-by: Gerard Marull-Paretas (cherry picked from commit 578008cd472e6d091f2960ec9dc40c233329f372) --- include/zephyr/pm/policy.h | 129 ++++++++++++++++---------------- subsys/pm/policy/CMakeLists.txt | 2 + subsys/pm/policy/Kconfig | 10 +++ 3 files changed, 78 insertions(+), 63 deletions(-) diff --git a/include/zephyr/pm/policy.h b/include/zephyr/pm/policy.h index caba887805a..e1e910f3e0a 100644 --- a/include/zephyr/pm/policy.h +++ b/include/zephyr/pm/policy.h @@ -137,49 +137,6 @@ void pm_policy_state_lock_put(enum pm_state state, uint8_t substate_id); */ bool pm_policy_state_lock_is_active(enum pm_state state, uint8_t substate_id); -/** - * @brief Add a new latency requirement. - * - * The system will not enter any power state that would make the system to - * exceed the given latency value. - * - * @param req Latency request. - * @param value_us Maximum allowed latency in microseconds. - */ -void pm_policy_latency_request_add(struct pm_policy_latency_request *req, - uint32_t value_us); - -/** - * @brief Update a latency requirement. - * - * @param req Latency request. - * @param value_us New maximum allowed latency in microseconds. - */ -void pm_policy_latency_request_update(struct pm_policy_latency_request *req, - uint32_t value_us); - -/** - * @brief Remove a latency requirement. - * - * @param req Latency request. - */ -void pm_policy_latency_request_remove(struct pm_policy_latency_request *req); - -/** - * @brief Subscribe to maximum latency changes. - * - * @param req Subscription request. - * @param cb Callback function (NULL to disable). - */ -void pm_policy_latency_changed_subscribe(struct pm_policy_latency_subscription *req, - pm_policy_latency_changed_cb_t cb); - -/** - * @brief Unsubscribe to maximum latency changes. - * - * @param req Subscription request. - */ -void pm_policy_latency_changed_unsubscribe(struct pm_policy_latency_subscription *req); /** * @brief Register an event. @@ -277,26 +234,6 @@ static inline bool pm_policy_state_lock_is_active(enum pm_state state, uint8_t s return false; } -static inline void pm_policy_latency_request_add( - struct pm_policy_latency_request *req, uint32_t value_us) -{ - ARG_UNUSED(req); - ARG_UNUSED(value_us); -} - -static inline void pm_policy_latency_request_update( - struct pm_policy_latency_request *req, uint32_t value_us) -{ - ARG_UNUSED(req); - ARG_UNUSED(value_us); -} - -static inline void pm_policy_latency_request_remove( - struct pm_policy_latency_request *req) -{ - ARG_UNUSED(req); -} - static inline void pm_policy_event_register(struct pm_policy_event *evt, uint32_t cycle) { ARG_UNUSED(evt); @@ -331,6 +268,72 @@ static inline int32_t pm_policy_next_event_ticks(void) #endif /* CONFIG_PM */ +#if defined(CONFIG_PM) || defined(CONFIG_PM_POLICY_LATENCY_STANDALONE) || defined(__DOXYGEN__) +/** + * @brief Add a new latency requirement. + * + * The system will not enter any power state that would make the system to + * exceed the given latency value. + * + * @param req Latency request. + * @param value_us Maximum allowed latency in microseconds. + */ +void pm_policy_latency_request_add(struct pm_policy_latency_request *req, + uint32_t value_us); + +/** + * @brief Update a latency requirement. + * + * @param req Latency request. + * @param value_us New maximum allowed latency in microseconds. + */ +void pm_policy_latency_request_update(struct pm_policy_latency_request *req, + uint32_t value_us); + +/** + * @brief Remove a latency requirement. + * + * @param req Latency request. + */ +void pm_policy_latency_request_remove(struct pm_policy_latency_request *req); + +/** + * @brief Subscribe to maximum latency changes. + * + * @param req Subscription request. + * @param cb Callback function (NULL to disable). + */ +void pm_policy_latency_changed_subscribe(struct pm_policy_latency_subscription *req, + pm_policy_latency_changed_cb_t cb); + +/** + * @brief Unsubscribe to maximum latency changes. + * + * @param req Subscription request. + */ +void pm_policy_latency_changed_unsubscribe(struct pm_policy_latency_subscription *req); +#else +static inline void pm_policy_latency_request_add( + struct pm_policy_latency_request *req, uint32_t value_us) +{ + ARG_UNUSED(req); + ARG_UNUSED(value_us); +} + +static inline void pm_policy_latency_request_update( + struct pm_policy_latency_request *req, uint32_t value_us) +{ + ARG_UNUSED(req); + ARG_UNUSED(value_us); +} + +static inline void pm_policy_latency_request_remove( + struct pm_policy_latency_request *req) +{ + ARG_UNUSED(req); +} +#endif /* CONFIG_PM CONFIG_PM_POLICY_LATENCY_STANDALONE */ + /** * @} */ diff --git a/subsys/pm/policy/CMakeLists.txt b/subsys/pm/policy/CMakeLists.txt index e9d7d791ec5..899e9f60b20 100644 --- a/subsys/pm/policy/CMakeLists.txt +++ b/subsys/pm/policy/CMakeLists.txt @@ -11,4 +11,6 @@ if(CONFIG_PM) if(CONFIG_PM_POLICY_DEFAULT) zephyr_library_sources(policy_default.c) endif() +elseif(CONFIG_PM_POLICY_LATENCY_STANDALONE) + zephyr_library_sources(policy_latency.c) endif() diff --git a/subsys/pm/policy/Kconfig b/subsys/pm/policy/Kconfig index 2060c52cb13..1a224c4ecc7 100644 --- a/subsys/pm/policy/Kconfig +++ b/subsys/pm/policy/Kconfig @@ -32,3 +32,13 @@ config PM_POLICY_DEVICE_CONSTRAINTS it is needed by the device. endif # PM + +config PM_POLICY_LATENCY_STANDALONE + bool "Allow gathering latency requirements in standalone mode" + depends on !PM + help + This option allows using the pm_policy_latency* APIs to gather latency + requirements on systems that do not support PM (e.g. systems whithout + CPU idle states). Because the API has a subscription mechanism, it can + be useful to perform system-level adjustments based on latency + requirements gathered from multiple system components.