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>
This commit is contained in:
Aurelien Jarno 2022-06-17 21:56:23 +02:00 committed by Anas Nashif
commit 67bceb0257

View file

@ -24,12 +24,11 @@
#include <zephyr/logging/log.h> #include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(LOG_DOMAIN); LOG_MODULE_REGISTER(LOG_DOMAIN);
#define STM32H7_FLASH_MAX_ERASE_TIME 4000
/* Let's wait for double the max erase time to be sure that the operation is /* Let's wait for double the max erase time to be sure that the operation is
* completed. * completed.
*/ */
#define STM32H7_FLASH_TIMEOUT (2 * STM32H7_FLASH_MAX_ERASE_TIME) #define STM32H7_FLASH_TIMEOUT \
(2 * DT_PROP(DT_INST(0, st_stm32_nv_flash), max_erase_time))
#ifdef CONFIG_CPU_CORTEX_M4 #ifdef CONFIG_CPU_CORTEX_M4
#error Flash driver on M4 core is not supported yet #error Flash driver on M4 core is not supported yet