Skip to content

Commit 5cbff34

Browse files
erwangocarlescufi
authored andcommitted
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 <[email protected]>
1 parent a41a4e5 commit 5cbff34

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/entropy/entropy_stm32.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ BUILD_ASSERT((CONFIG_ENTROPY_STM32_THR_POOL_SIZE &
7676
"The CONFIG_ENTROPY_STM32_THR_POOL_SIZE must be a power of 2!");
7777

7878
struct entropy_stm32_rng_dev_cfg {
79-
struct stm32_pclken pclken;
79+
struct stm32_pclken *pclken;
8080
};
8181

8282
struct entropy_stm32_rng_dev_data {
@@ -91,9 +91,10 @@ struct entropy_stm32_rng_dev_data {
9191
RNG_POOL_DEFINE(thr, CONFIG_ENTROPY_STM32_THR_POOL_SIZE);
9292
};
9393

94-
static const struct entropy_stm32_rng_dev_cfg entropy_stm32_rng_config = {
95-
.pclken = { .bus = DT_INST_CLOCKS_CELL(0, bus),
96-
.enr = DT_INST_CLOCKS_CELL(0, bits) },
94+
static struct stm32_pclken pclken_rng[] = STM32_DT_INST_CLOCKS(0);
95+
96+
static struct entropy_stm32_rng_dev_cfg entropy_stm32_rng_config = {
97+
.pclken = pclken_rng
9798
};
9899

99100
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)
652653
}
653654

654655
res = clock_control_on(dev_data->clock,
655-
(clock_control_subsys_t *)&dev_cfg->pclken);
656+
(clock_control_subsys_t *)&dev_cfg->pclken[0]);
656657
__ASSERT_NO_MSG(res == 0);
657658

658659
/* Locking semaphore initialized to 1 (unlocked) */

0 commit comments

Comments
 (0)