Commit graph

11 commits

Author SHA1 Message Date
Francois Ramu 7795558ad5 drivers: flash: stm32 flash base address from the DTS node
For the flash driver, the base address is the MCU internal flash
address (usually 0x8000000). This PR gets the that address
from the device tree node "st,stm32-nv-flash"
instead of relying on the CONFIG_FLASH_BASE_ADDRESS
which might differ when building for another flash memory.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-01-29 14:12:47 -06:00
Weifeng Li 93869605eb drivers: flash: flash_stm32l5x: fix the STM32U5X flash bank issue
STM32U5X has 128k/256k/512k/1M/2M dual bank Flash.
The address of the 2 bank are continuous, so it's no need a "Dummy page"
in "stm32_flash_layout", which cause wrong slot1 section (for secondary
image), and the BANK2_OFFSET is not right either, which cause
"flash_stm32_valid_range" return a failure.
To fix the issue, just set CONFIG_FLASH_SIZE to STM32_SERIES_MAX_FLASH
Tested on NUCLEO-U545RE with mcuboot.

Signed-off-by: Weifeng Li <weifeng.li@aofrio.com>
2023-12-14 19:06:36 +00:00
Florian Vaussard 4c9e42925e drivers: flash: stm32l5: use write-block-size when writing
STM32L5 have a write block size of 8, but STM32U5 and STM32H5 have a
write block size of 16. Convert write_dword() and
flash_stm32_write_range() to write write-block-size data at a time.

Fixes #60724

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2023-07-28 09:02:17 +00:00
Florian Vaussard 199486546a drivers: flash: stm32l5: use write-block-size when validating
STM32L5 have a write block size of 8, but STM32U5 and STM32H5 have a
write block size of 16. Use write-block-size from the device tree
instead of hardcoding this value when validating the range of write
operations.

Fixes #60724

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2023-07-28 09:02:17 +00:00
Francois Ramu a62fc404be drivers: flash: stm32 flash drivers supports the new stm32h5 serie
Introduce the stm32h5 serie to the the existing flash driver
It is based on the stm32l5 model.
 Add a function to check if the flash is in dual
or single bank mode.
Some stm32 devices can map 2 or 1 flash banks.
Adapt the FLASH register names for the stm32h5 mcu.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-28 15:07:51 +02:00
Maciej Zagrabski 7ca8accdc6 drivers: flash: fix uninitialised layout_size
Requesting page layout triggers filling bank array
only once, and returns pre-filled array on consequential calls.
But ignores array size.

Remember size of this array as well.

Fixes #54563

Signed-off-by: Maciej Zagrabski <mzi@trackunit.com>
2023-02-08 19:01:32 +09:00
Francois Ramu 05da8d7a7a drivers: flash: stm32 page layout size differs in stm32u5 or stm32l5
Adjust the size of the stm32_flash_layout[] table depending on the
bank configuration of the stm32u5 or stm32l5 devices.
That will avoid div by zero error in flash_get_page_info()
if the layout_size is not correct.
Assign the *layout_size only once with the correct value : 3 or 1.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-27 01:05:44 +09:00
Erwan Gouriou cbef00587b drivers: flash: stm32: Rename _l5_u5.c driver to _l5x.c
This will simplify addition of new series that share the same driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-03 11:01:44 +01:00
Francois Ramu 623b0418b6 drivers: flash for the stm32l5x or stm32u5 serie with max 2MB
Adds the stm32u5 flash controller driver for this serie
to the existing stm32l5 flash driver part
Only 1 or 2 MB devices exist today (4MB is possible in the future).
This flash controller driver is adapted from the flash_stm32l5.c

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-04-13 13:55:34 -07:00
Wouter Cappelle e7d5b172d0 STM32L5: flash: enable support for DBANK == 0
STM32L5 has option to disable dual bank support.
When this is disabled, the flash page size is changed
from 2k pages to 4k pages. This PR adds support for this
diversity.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-02-21 20:56:58 -05:00
Krishna Mohan Dani 365ff6db9f drivers/flash: stm32l5: Adding flash driver for stm32l5x series
This commit adds flash driver in non-secure mode for stm32l5x
series with icache enabled. This commit also adds a flash
programming error status check applicable for all platforms
except stm32f1 series.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-08-04 10:26:06 -05:00