Skip to content

Commit 5de1b09

Browse files
ikmdanicarlescufi
authored andcommitted
drivers/flash: STM32: Adding condition to enable HSI clock for L1 series.
This commit adds changes to enable HSI clock for stm32l1 series. Signed-off-by: Krishna Mohan Dani <[email protected]>
1 parent 3374bc1 commit 5de1b09

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/flash/flash_stm32.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,9 @@ flash_stm32_get_parameters(const struct device *dev)
348348

349349
static struct flash_stm32_priv flash_data = {
350350
.regs = (FLASH_TypeDef *) DT_INST_REG_ADDR(0),
351+
/* Getting clocks information from device tree description depending
352+
* on the presence of 'clocks' property.
353+
*/
351354
#if DT_INST_NODE_HAS_PROP(0, clocks)
352355
.pclken = {
353356
.enr = DT_INST_CLOCKS_CELL(0, bits),
@@ -369,19 +372,21 @@ static const struct flash_driver_api flash_stm32_api = {
369372
static int stm32_flash_init(const struct device *dev)
370373
{
371374
int rc;
372-
/* Below is applicable to L4, F0, F1, F3, G0*/
375+
/* Below is applicable to F0, F1, F3, G0, G4, L1, L4 & WB55 series.
376+
* For F2, F4, F7 & H7 series, this is not applicable.
377+
*/
373378
#if DT_INST_NODE_HAS_PROP(0, clocks)
374379
struct flash_stm32_priv *p = FLASH_STM32_PRIV(dev);
375380
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
376381

377382
/*
378-
* On STM32F0, Flash interface clock source is always HSI,
379-
* so statically enable HSI here.
380-
* Below is applicable to F0, F1 and F3 as HSI is the source
383+
* On STM32 F0, F1, F3 & L1 series, flash interface clock source is
384+
* always HSI, so statically enable HSI here.
381385
*/
382386
#if defined(CONFIG_SOC_SERIES_STM32F0X) || \
383387
defined(CONFIG_SOC_SERIES_STM32F1X) || \
384-
defined(CONFIG_SOC_SERIES_STM32F3X)
388+
defined(CONFIG_SOC_SERIES_STM32F3X) || \
389+
defined(CONFIG_SOC_SERIES_STM32L1X)
385390
LL_RCC_HSI_Enable();
386391

387392
while (!LL_RCC_HSI_IsReady()) {

0 commit comments

Comments
 (0)