From 5cbff34e35a6f88a65fdf610d33079342cf75718 Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Thu, 5 Jan 2023 17:07:35 +0100 Subject: [PATCH] drivers: entropy: stm32: Allow to configure clock source from dt Use STM32_DT_INST_CLOCKS to populate device clock information. This will allow to add clock source information in next commits. Signed-off-by: Erwan Gouriou --- drivers/entropy/entropy_stm32.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/entropy/entropy_stm32.c b/drivers/entropy/entropy_stm32.c index 1585f300a3d..2a928787007 100644 --- a/drivers/entropy/entropy_stm32.c +++ b/drivers/entropy/entropy_stm32.c @@ -76,7 +76,7 @@ BUILD_ASSERT((CONFIG_ENTROPY_STM32_THR_POOL_SIZE & "The CONFIG_ENTROPY_STM32_THR_POOL_SIZE must be a power of 2!"); struct entropy_stm32_rng_dev_cfg { - struct stm32_pclken pclken; + struct stm32_pclken *pclken; }; struct entropy_stm32_rng_dev_data { @@ -91,9 +91,10 @@ struct entropy_stm32_rng_dev_data { RNG_POOL_DEFINE(thr, CONFIG_ENTROPY_STM32_THR_POOL_SIZE); }; -static const struct entropy_stm32_rng_dev_cfg entropy_stm32_rng_config = { - .pclken = { .bus = DT_INST_CLOCKS_CELL(0, bus), - .enr = DT_INST_CLOCKS_CELL(0, bits) }, +static struct stm32_pclken pclken_rng[] = STM32_DT_INST_CLOCKS(0); + +static struct entropy_stm32_rng_dev_cfg entropy_stm32_rng_config = { + .pclken = pclken_rng }; static struct entropy_stm32_rng_dev_data entropy_stm32_rng_data = { @@ -652,7 +653,7 @@ static int entropy_stm32_rng_init(const struct device *dev) } res = clock_control_on(dev_data->clock, - (clock_control_subsys_t *)&dev_cfg->pclken); + (clock_control_subsys_t *)&dev_cfg->pclken[0]); __ASSERT_NO_MSG(res == 0); /* Locking semaphore initialized to 1 (unlocked) */