Skip to content

Commit 67bceb0

Browse files
aurel32nashif
authored andcommitted
drivers: flash: stm32h7x: use max-erase-time instead of hard-coded timeout
As the erase time for a sector differs by a few order of magnitude for the various SoCs of the STM32H7 family, use the just added max-erase-time property from the device tree instead of the hard-coded 4 seconds value. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
1 parent 98a02fe commit 67bceb0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/flash/flash_stm32h7x.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@
2424
#include <zephyr/logging/log.h>
2525
LOG_MODULE_REGISTER(LOG_DOMAIN);
2626

27-
#define STM32H7_FLASH_MAX_ERASE_TIME 4000
28-
2927
/* Let's wait for double the max erase time to be sure that the operation is
3028
* completed.
3129
*/
32-
#define STM32H7_FLASH_TIMEOUT (2 * STM32H7_FLASH_MAX_ERASE_TIME)
30+
#define STM32H7_FLASH_TIMEOUT \
31+
(2 * DT_PROP(DT_INST(0, st_stm32_nv_flash), max_erase_time))
3332

3433
#ifdef CONFIG_CPU_CORTEX_M4
3534
#error Flash driver on M4 core is not supported yet

0 commit comments

Comments
 (0)