drivers: flash: stm32: Fix insufficient wait time

flash_erase cannot erase a page from the STM32xx SOC flash. It seems
that the erase wait time is not enough and against to what the SOC's
datasheet states. As a result this patch doubles the wait time.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
diff --git a/drivers/flash/flash_stm32.c b/drivers/flash/flash_stm32.c
index ced2fd7..9970631 100644
--- a/drivers/flash/flash_stm32.c
+++ b/drivers/flash/flash_stm32.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2017 Linaro Limited
  * Copyright (c) 2017 BayLibre, SAS.
+ * Copyright (c) 2019 Centaur Analytics, Inc
  *
  * SPDX-License-Identifier: Apache-2.0
  */
@@ -16,24 +17,29 @@
 
 /* STM32F0: maximum erase time of 40ms for a 2K sector */
 #if defined(CONFIG_SOC_SERIES_STM32F0X)
-#define STM32_FLASH_TIMEOUT	(K_MSEC(40))
+#define STM32_FLASH_MAX_ERASE_TIME	(K_MSEC(40))
 /* STM32F3: maximum erase time of 40ms for a 2K sector */
 #elif defined(CONFIG_SOC_SERIES_STM32F3X)
-#define STM32_FLASH_TIMEOUT	(K_MSEC(40))
+#define STM32_FLASH_MAX_ERASE_TIME	(K_MSEC(40))
 /* STM32F4: maximum erase time of 4s for a 128K sector */
 #elif defined(CONFIG_SOC_SERIES_STM32F4X)
-#define STM32_FLASH_TIMEOUT	(K_MSEC(4000))
+#define STM32_FLASH_MAX_ERASE_TIME	(K_MSEC(4000))
 /* STM32F7: maximum erase time of 4s for a 256K sector */
 #elif defined(CONFIG_SOC_SERIES_STM32F7X)
-#define STM32_FLASH_TIMEOUT	(K_MSEC(4000))
+#define STM32_FLASH_MAX_ERASE_TIME	(K_MSEC(4000))
 /* STM32L4: maximum erase time of 24.47ms for a 2K sector */
 #elif defined(CONFIG_SOC_SERIES_STM32L4X)
-#define STM32_FLASH_TIMEOUT	(K_MSEC(25))
+#define STM32_FLASH_MAX_ERASE_TIME	(K_MSEC(25))
 /* STM32WB: maximum erase time of 24.5ms for a 4K sector */
 #elif defined(CONFIG_SOC_SERIES_STM32WBX)
-#define STM32_FLASH_TIMEOUT	(K_MSEC(25))
+#define STM32_FLASH_MAX_ERASE_TIME	(K_MSEC(25))
 #endif
 
+/* Let's wait for double the max erase time to be sure that the operation is
+ * completed.
+ */
+#define STM32_FLASH_TIMEOUT	(2 * STM32_FLASH_MAX_ERASE_TIME)
+
 #define CFG_HW_FLASH_SEMID	2
 
 /*