From 20689c17d41542320aaa6a90043fdeb97bf05e10 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 15 Dec 2020 12:32:21 -0600 Subject: [PATCH] drivers: clock_control: stm32: Convert drivers to new DT device macros Convert clock_control drivers from: DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE As part of this we also changed STM32_CLOCK_CONTROL_NAME to be based on devicetree. Signed-off-by: Kumar Gala --- drivers/clock_control/clock_stm32_ll_common.c | 3 ++- drivers/clock_control/clock_stm32_ll_h7.c | 3 ++- drivers/clock_control/clock_stm32_ll_mp1.c | 3 ++- include/drivers/clock_control/stm32_clock_control.h | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/clock_control/clock_stm32_ll_common.c b/drivers/clock_control/clock_stm32_ll_common.c index 35a743b13fc..5675aed5fb6 100644 --- a/drivers/clock_control/clock_stm32_ll_common.c +++ b/drivers/clock_control/clock_stm32_ll_common.c @@ -568,8 +568,9 @@ static int stm32_clock_control_init(const struct device *dev) * @brief RCC device, note that priority is intentionally set to 1 so * that the device init runs just after SOC init */ -DEVICE_AND_API_INIT(rcc_stm32, STM32_CLOCK_CONTROL_NAME, +DEVICE_DT_DEFINE(DT_NODELABEL(rcc), &stm32_clock_control_init, + device_pm_control_nop, NULL, NULL, PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_STM32_DEVICE_INIT_PRIORITY, diff --git a/drivers/clock_control/clock_stm32_ll_h7.c b/drivers/clock_control/clock_stm32_ll_h7.c index 958457b1673..f45719b01d2 100644 --- a/drivers/clock_control/clock_stm32_ll_h7.c +++ b/drivers/clock_control/clock_stm32_ll_h7.c @@ -682,8 +682,9 @@ static int stm32_clock_control_init(const struct device *dev) * @brief RCC device, note that priority is intentionally set to 1 so * that the device init runs just after SOC init */ -DEVICE_AND_API_INIT(rcc_stm32, STM32_CLOCK_CONTROL_NAME, +DEVICE_DT_DEFINE(DT_NODELABEL(rcc), &stm32_clock_control_init, + device_pm_control_nop, NULL, NULL, PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_STM32_DEVICE_INIT_PRIORITY, diff --git a/drivers/clock_control/clock_stm32_ll_mp1.c b/drivers/clock_control/clock_stm32_ll_mp1.c index c72cfd8c149..2f032f9c35c 100644 --- a/drivers/clock_control/clock_stm32_ll_mp1.c +++ b/drivers/clock_control/clock_stm32_ll_mp1.c @@ -411,8 +411,9 @@ static int stm32_clock_control_init(const struct device *dev) * @brief RCC device, note that priority is intentionally set to 1 so * that the device init runs just after SOC init */ -DEVICE_AND_API_INIT(rcc_stm32, STM32_CLOCK_CONTROL_NAME, +DEVICE_DT_DEFINE(DT_NODELABEL(rcc), &stm32_clock_control_init, + device_pm_control_nop, NULL, NULL, PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_STM32_DEVICE_INIT_PRIORITY, diff --git a/include/drivers/clock_control/stm32_clock_control.h b/include/drivers/clock_control/stm32_clock_control.h index 48e344f3337..b8c653e7ee0 100644 --- a/include/drivers/clock_control/stm32_clock_control.h +++ b/include/drivers/clock_control/stm32_clock_control.h @@ -13,7 +13,7 @@ #include /* common clock control device name for all STM32 chips */ -#define STM32_CLOCK_CONTROL_NAME "stm32-cc" +#define STM32_CLOCK_CONTROL_NAME DT_LABEL(DT_NODELABEL(rcc)) struct stm32_pclken { uint32_t bus;