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 <erwan.gouriou@linaro.org>
This commit is contained in:
parent
a41a4e5e24
commit
5cbff34e35
1 changed files with 6 additions and 5 deletions
|
@ -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!");
|
"The CONFIG_ENTROPY_STM32_THR_POOL_SIZE must be a power of 2!");
|
||||||
|
|
||||||
struct entropy_stm32_rng_dev_cfg {
|
struct entropy_stm32_rng_dev_cfg {
|
||||||
struct stm32_pclken pclken;
|
struct stm32_pclken *pclken;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct entropy_stm32_rng_dev_data {
|
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);
|
RNG_POOL_DEFINE(thr, CONFIG_ENTROPY_STM32_THR_POOL_SIZE);
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct entropy_stm32_rng_dev_cfg entropy_stm32_rng_config = {
|
static struct stm32_pclken pclken_rng[] = STM32_DT_INST_CLOCKS(0);
|
||||||
.pclken = { .bus = DT_INST_CLOCKS_CELL(0, bus),
|
|
||||||
.enr = DT_INST_CLOCKS_CELL(0, bits) },
|
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 = {
|
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,
|
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);
|
__ASSERT_NO_MSG(res == 0);
|
||||||
|
|
||||||
/* Locking semaphore initialized to 1 (unlocked) */
|
/* Locking semaphore initialized to 1 (unlocked) */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue