From 5d68d2f41df5099f890052756f14f5a810f34312 Mon Sep 17 00:00:00 2001
From: Tom Rini <trini@konsulko.com>
Date: Sat, 23 Jul 2022 13:05:00 -0400
Subject: [PATCH] Convert CONFIG_SYS_FLASH_ERASE_TOUT et al to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_FLASH_ERASE_TOUT
   CONFIG_SYS_FLASH_LOCK_TOUT
   CONFIG_SYS_FLASH_UNLOCK_TOUT
   CONFIG_SYS_FLASH_WRITE_TOUT

In practice, for two m68k platforms we move to hard-coding with a
comment the timeout values, rather than try and make convoluted Kconfig
logic.  We add options for the write and erase options to the pic32
flash driver, as this driver does make use of them.  Everywhere else
these are unreferenced values.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 README                               | 12 ------------
 board/cobra5272/flash.c              |  8 ++++----
 board/freescale/m5253demo/flash.c    | 10 ++++++----
 drivers/mtd/Kconfig                  | 12 ++++++++++++
 include/configs/M5253DEMO.h          |  2 --
 include/configs/M5275EVB.h           |  1 -
 include/configs/MCR3000.h            |  2 --
 include/configs/MPC837XERDB.h        |  3 ---
 include/configs/MPC8548CDS.h         |  2 --
 include/configs/P1010RDB.h           |  3 ---
 include/configs/P2041RDB.h           |  2 --
 include/configs/T102xRDB.h           |  2 --
 include/configs/T104xRDB.h           |  2 --
 include/configs/T208xQDS.h           |  2 --
 include/configs/T208xRDB.h           |  2 --
 include/configs/T4240RDB.h           |  2 --
 include/configs/amcore.h             |  1 -
 include/configs/armadillo-800eva.h   |  5 -----
 include/configs/astro_mcf5373l.h     |  1 -
 include/configs/ax25-ae350.h         |  3 ---
 include/configs/blanche.h            |  5 -----
 include/configs/cobra5272.h          |  1 -
 include/configs/corenet_ds.h         |  2 --
 include/configs/eb_cpu5282.h         |  1 -
 include/configs/ids8313.h            |  3 ---
 include/configs/integrator-common.h  |  2 --
 include/configs/km/pg-wcom-ls102xa.h |  2 --
 include/configs/kzm9g.h              |  4 ----
 include/configs/ls1021aqds.h         |  2 --
 include/configs/ls1021atwr.h         |  2 --
 include/configs/ls1043aqds.h         |  2 --
 include/configs/ls1043ardb.h         |  2 --
 include/configs/ls1046aqds.h         |  2 --
 include/configs/ls1088aqds.h         |  2 --
 include/configs/ls1088ardb.h         |  2 --
 include/configs/ls2080aqds.h         |  2 --
 include/configs/ls2080ardb.h         |  2 --
 include/configs/p1_p2_rdb_pc.h       |  3 ---
 include/configs/socrates.h           |  2 --
 include/configs/vexpress_common.h    |  2 --
 include/configs/zynq-common.h        |  2 --
 41 files changed, 22 insertions(+), 102 deletions(-)

diff --git a/README b/README
index 8a50bf645c..697b0d3a35 100644
--- a/README
+++ b/README
@@ -1731,18 +1731,6 @@ Configuration Settings:
 - CONFIG_SYS_MAX_FLASH_SECT:
 		Max number of sectors on a Flash chip
 
-- CONFIG_SYS_FLASH_ERASE_TOUT:
-		Timeout for Flash erase operations (in ms)
-
-- CONFIG_SYS_FLASH_WRITE_TOUT:
-		Timeout for Flash write operations (in ms)
-
-- CONFIG_SYS_FLASH_LOCK_TOUT
-		Timeout for Flash set sector lock bit operation (in ms)
-
-- CONFIG_SYS_FLASH_UNLOCK_TOUT
-		Timeout for Flash clear lock bits operation (in ms)
-
 - CONFIG_SYS_FLASH_PROTECTION
 		If defined, hardware flash sectors protection is used
 		instead of U-Boot software protection.
diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c
index 4337f4879d..5d15ed4e69 100644
--- a/board/cobra5272/flash.c
+++ b/board/cobra5272/flash.c
@@ -200,8 +200,8 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 			do {
 				result = *addr;
 
-				/* check timeout */
-				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				/* check timeout, 1000ms */
+				if (get_timer(start) > 1000) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip1 = TMO;
 					break;
@@ -289,8 +289,8 @@ static int write_word(flash_info_t *info, ulong dest, ulong data)
 	do {
 		result = *addr;
 
-		/* check timeout */
-		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		/* check timeout, 1000ms */
+		if (get_timer(start) > 1000) {
 			chip1 = ERR | TMO;
 			break;
 		}
diff --git a/board/freescale/m5253demo/flash.c b/board/freescale/m5253demo/flash.c
index 3197421781..bff1ac5fb1 100644
--- a/board/freescale/m5253demo/flash.c
+++ b/board/freescale/m5253demo/flash.c
@@ -242,7 +242,8 @@ int flash_erase(flash_info_t * info, int s_first, int s_last)
 					count = 0;
 				}
 
-				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				/* check timeout, 1000ms */
+				if (get_timer(start) > 1000) {
 					printf("Timeout\n");
 					*addr = 0x00F0;	/* reset to read mode */
 
@@ -294,8 +295,8 @@ int flash_erase(flash_info_t * info, int s_first, int s_last)
 						enable_interrupts();
 
 					while ((*addr & 0x0080) != 0x0080) {
-						if (get_timer(start) >
-						    CONFIG_SYS_FLASH_ERASE_TOUT) {
+						/* check timeout, 1000ms */
+						if (get_timer(start) > 1000) {
 							printf("Timeout\n");
 							*addr = 0x00F0;	/* reset to read mode */
 
@@ -430,7 +431,8 @@ int write_word(flash_info_t * info, FPWV * dest, u16 data)
 	/* data polling for D7 */
 	while (res == 0
 	       && (*dest & (u8) 0x00800080) != (data & (u8) 0x00800080)) {
-		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		/* check timeout, 500ms */
+		if (get_timer(start) > 500) {
 			*dest = (u8) 0x00F000F0;	/* reset bank */
 			res = 1;
 		}
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 985cc01e42..e28ff04955 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -157,6 +157,18 @@ config FLASH_PIC32
 	  This enables access to Microchip PIC32 internal non-CFI flash
 	  chips through PIC32 Non-Volatile-Memory Controller.
 
+config SYS_FLASH_ERASE_TOUT
+	int "Timeout in ms for performing an erase operation on the flash"
+	depends on FLASH_PIC32
+	help
+	  Timeout for Flash erase operations (in ms)
+
+config SYS_FLASH_WRITE_TOUT
+	int "Timeout in ms for performing a write operation on the flash"
+	depends on FLASH_PIC32
+	help
+	  Timeout for Flash write operations (in ms)
+
 config RENESAS_RPC_HF
 	bool "Renesas RCar Gen3 RPC HyperFlash driver"
 	depends on RCAR_GEN3 && DM_MTD
diff --git a/include/configs/M5253DEMO.h b/include/configs/M5253DEMO.h
index cac9b24ead..88c2bbbf25 100644
--- a/include/configs/M5253DEMO.h
+++ b/include/configs/M5253DEMO.h
@@ -94,7 +94,6 @@
 /* FLASH organization */
 #define CONFIG_SYS_FLASH_BASE		(CONFIG_SYS_CS0_BASE)
 #define CONFIG_SYS_MAX_FLASH_SECT	2048	/* max number of sectors on one chip */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	1000
 
 #define FLASH_SST6401B		0x200
 #define SST_ID_xF6401B		0x236D236D
@@ -110,7 +109,6 @@
 #else
 #	define CONFIG_SYS_SST_SECT		2048
 #	define CONFIG_SYS_SST_SECTSZ		0x1000
-#	define CONFIG_SYS_FLASH_WRITE_TOUT	500
 #endif
 
 /* Cache Configuration */
diff --git a/include/configs/M5275EVB.h b/include/configs/M5275EVB.h
index 292578fc15..80d079a489 100644
--- a/include/configs/M5275EVB.h
+++ b/include/configs/M5275EVB.h
@@ -92,7 +92,6 @@
  * FLASH organization
  */
 #define CONFIG_SYS_MAX_FLASH_SECT	11	/* max number of sectors on one chip */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	1000
 
 #define CONFIG_SYS_FLASH_SIZE		0x200000
 
diff --git a/include/configs/MCR3000.h b/include/configs/MCR3000.h
index 41ab860850..f6854cb8c9 100644
--- a/include/configs/MCR3000.h
+++ b/include/configs/MCR3000.h
@@ -70,8 +70,6 @@
 /* FLASH organization */
 #define CONFIG_SYS_FLASH_BASE		CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_MAX_FLASH_SECT	35
-#define CONFIG_SYS_FLASH_ERASE_TOUT	120000
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500
 
 /*
  * For booting Linux, the board info and command line data
diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h
index 87ae953085..a25bf74645 100644
--- a/include/configs/MPC837XERDB.h
+++ b/include/configs/MPC837XERDB.h
@@ -144,9 +144,6 @@
 
 #define CONFIG_SYS_MAX_FLASH_SECT	256 /* max sectors per device */
 
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
-
 /*
  * NAND Flash on the Local Bus
  */
diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h
index febe8c2476..d4a2b0184f 100644
--- a/include/configs/MPC8548CDS.h
+++ b/include/configs/MPC8548CDS.h
@@ -125,8 +125,6 @@
 #define CONFIG_SYS_FLASH_BANKS_LIST \
 	{CONFIG_SYS_FLASH_BASE_PHYS + 0x800000, CONFIG_SYS_FLASH_BASE_PHYS}
 #define CONFIG_SYS_MAX_FLASH_SECT	128		/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_HWCONFIG			/* enable hwconfig */
 
diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h
index 9f680f21b8..a057d59177 100644
--- a/include/configs/P1010RDB.h
+++ b/include/configs/P1010RDB.h
@@ -166,9 +166,6 @@ extern unsigned long get_sdram_size(void);
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #define CONFIG_FLASH_SHOW_PROGRESS	45	/* count down from 45/5: 9..1 */
 
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
-
 /* CFI for NOR Flash */
 
 /* NAND Flash on IFC */
diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h
index 3a3f1d3061..b4a7b46881 100644
--- a/include/configs/P2041RDB.h
+++ b/include/configs/P2041RDB.h
@@ -124,8 +124,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024		/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000		/* Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500		/* Write Timeout (ms) */
 
 /* Nand Flash */
 #ifdef CONFIG_NAND_FSL_ELBC
diff --git a/include/configs/T102xRDB.h b/include/configs/T102xRDB.h
index 6e7f0bcd52..7c5fbbba59 100644
--- a/include/configs/T102xRDB.h
+++ b/include/configs/T102xRDB.h
@@ -169,8 +169,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{CONFIG_SYS_FLASH_BASE_PHYS}
 
diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h
index 140b307478..39b04b204e 100644
--- a/include/configs/T104xRDB.h
+++ b/include/configs/T104xRDB.h
@@ -131,8 +131,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{CONFIG_SYS_FLASH_BASE_PHYS}
 
diff --git a/include/configs/T208xQDS.h b/include/configs/T208xQDS.h
index 53f62837c6..0cb8d394d1 100644
--- a/include/configs/T208xQDS.h
+++ b/include/configs/T208xQDS.h
@@ -134,8 +134,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{CONFIG_SYS_FLASH_BASE_PHYS \
 					+ 0x8000000, CONFIG_SYS_FLASH_BASE_PHYS}
diff --git a/include/configs/T208xRDB.h b/include/configs/T208xRDB.h
index 8a0b005559..bccc3385cb 100644
--- a/include/configs/T208xRDB.h
+++ b/include/configs/T208xRDB.h
@@ -124,8 +124,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 #define CONFIG_SYS_FLASH_BANKS_LIST	{CONFIG_SYS_FLASH_BASE_PHYS }
 
 /* CPLD on IFC */
diff --git a/include/configs/T4240RDB.h b/include/configs/T4240RDB.h
index d2f5cebfc0..181b5fe2a4 100644
--- a/include/configs/T4240RDB.h
+++ b/include/configs/T4240RDB.h
@@ -205,8 +205,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{CONFIG_SYS_FLASH_BASE_PHYS \
 					+ 0x8000000, CONFIG_SYS_FLASH_BASE_PHYS}
diff --git a/include/configs/amcore.h b/include/configs/amcore.h
index 3c9267b14e..89b94b2930 100644
--- a/include/configs/amcore.h
+++ b/include/configs/amcore.h
@@ -37,7 +37,6 @@
 #define CONFIG_SYS_SDRAM_SIZE		0x1000000
 #define CONFIG_SYS_FLASH_BASE		0xffc00000
 #define CONFIG_SYS_MAX_FLASH_SECT	1024
-#define CONFIG_SYS_FLASH_ERASE_TOUT	1000
 
 /* amcore design has flash data bytes wired swapped */
 #define CONFIG_SYS_WRITE_SWAPPED_DATA
diff --git a/include/configs/armadillo-800eva.h b/include/configs/armadillo-800eva.h
index 1c7494183a..d54cadd41e 100644
--- a/include/configs/armadillo-800eva.h
+++ b/include/configs/armadillo-800eva.h
@@ -50,11 +50,6 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	512
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ (CONFIG_SYS_FLASH_BASE) }
 
-#define CONFIG_SYS_FLASH_ERASE_TOUT	3000
-#define CONFIG_SYS_FLASH_WRITE_TOUT	3000
-#define CONFIG_SYS_FLASH_LOCK_TOUT	3000
-#define CONFIG_SYS_FLASH_UNLOCK_TOUT	3000
-
 /* ENV setting */
 
 /* SH Ether */
diff --git a/include/configs/astro_mcf5373l.h b/include/configs/astro_mcf5373l.h
index da4d49741d..f85108463f 100644
--- a/include/configs/astro_mcf5373l.h
+++ b/include/configs/astro_mcf5373l.h
@@ -207,7 +207,6 @@
 
 /* FLASH organization */
 #define CONFIG_SYS_MAX_FLASH_SECT	259
-#define CONFIG_SYS_FLASH_ERASE_TOUT	1000
 
 #define CONFIG_SYS_FLASH_SIZE		0x2000000
 #define CONFIG_SYS_FLASH_CFI_NONBLOCK	1
diff --git a/include/configs/ax25-ae350.h b/include/configs/ax25-ae350.h
index daa5cdf5b2..653acdc9af 100644
--- a/include/configs/ax25-ae350.h
+++ b/include/configs/ax25-ae350.h
@@ -46,9 +46,6 @@
 #define CONFIG_SYS_FLASH_BASE		PHYS_FLASH_1
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ PHYS_FLASH_1, }
 
-#define CONFIG_SYS_FLASH_ERASE_TOUT	120000	/* TO for Flash Erase (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* TO for Flash Write (ms) */
-
 /* max number of memory banks */
 /*
  * There are 4 banks supported for this Controller,
diff --git a/include/configs/blanche.h b/include/configs/blanche.h
index 25b6e7005e..76271ebe2e 100644
--- a/include/configs/blanche.h
+++ b/include/configs/blanche.h
@@ -33,11 +33,6 @@
 #define CONFIG_SYS_MAX_FLASH_SECT	1024
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ (CONFIG_SYS_FLASH_BASE) }
 #define CONFIG_SYS_FLASH_BANKS_SIZES	{ (CONFIG_SYS_FLASH_SIZE) }
-
-#define CONFIG_SYS_FLASH_ERASE_TOUT	3000
-#define CONFIG_SYS_FLASH_WRITE_TOUT	3000
-#define CONFIG_SYS_FLASH_LOCK_TOUT	3000
-#define CONFIG_SYS_FLASH_UNLOCK_TOUT	3000
 #endif
 
 /* Board Clock */
diff --git a/include/configs/cobra5272.h b/include/configs/cobra5272.h
index dd7b6c0873..5e364b4990 100644
--- a/include/configs/cobra5272.h
+++ b/include/configs/cobra5272.h
@@ -190,7 +190,6 @@ enter a valid image address in flash */
  * FLASH organization
  */
 #define CONFIG_SYS_MAX_FLASH_SECT	11	/* max number of sectors on one chip	*/
-#define CONFIG_SYS_FLASH_ERASE_TOUT	1000	/* flash timeout */
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h
index 7d666e553b..c12cdd4132 100644
--- a/include/configs/corenet_ds.h
+++ b/include/configs/corenet_ds.h
@@ -114,8 +114,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024		/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000		/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500		/* Flash Write Timeout (ms) */
 
 /* Nand Flash */
 #ifdef CONFIG_NAND_FSL_ELBC
diff --git a/include/configs/eb_cpu5282.h b/include/configs/eb_cpu5282.h
index 6e444c4789..1a05914c1b 100644
--- a/include/configs/eb_cpu5282.h
+++ b/include/configs/eb_cpu5282.h
@@ -95,7 +95,6 @@
 #define CONFIG_SYS_INT_FLASH_ENABLE	0x21
 
 #define	CONFIG_SYS_MAX_FLASH_SECT	128
-#define	CONFIG_SYS_FLASH_ERASE_TOUT	10000000
 
 #define CONFIG_SYS_FLASH_SIZE		16*1024*1024
 
diff --git a/include/configs/ids8313.h b/include/configs/ids8313.h
index 26f0741be3..3dbd141a76 100644
--- a/include/configs/ids8313.h
+++ b/include/configs/ids8313.h
@@ -112,9 +112,6 @@
 
 #define CONFIG_SYS_MAX_FLASH_SECT	128
 
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500
-
 /*
  * NAND FLASH setup
  */
diff --git a/include/configs/integrator-common.h b/include/configs/integrator-common.h
index 4408fd0c23..512e0e61aa 100644
--- a/include/configs/integrator-common.h
+++ b/include/configs/integrator-common.h
@@ -44,5 +44,3 @@
 #define CONFIG_SYS_FLASH_BASE		0x24000000
 
 /* Timeout values in ticks */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	(2 * CONFIG_SYS_HZ) /* Erase Timeout */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	(2 * CONFIG_SYS_HZ) /* Write Timeout */
diff --git a/include/configs/km/pg-wcom-ls102xa.h b/include/configs/km/pg-wcom-ls102xa.h
index 1477483db5..1d9e0b6551 100644
--- a/include/configs/km/pg-wcom-ls102xa.h
+++ b/include/configs/km/pg-wcom-ls102xa.h
@@ -65,8 +65,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45	/* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	512	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ CONFIG_SYS_FLASH_BASE_PHYS }
 
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index 83c676803b..9147a726e5 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -44,13 +44,9 @@
 #define FLASH_SECTOR_SIZE	(256 * 1024)	/* 256 KB sectors */
 
 /* Timeout for Flash erase operations (in ms) */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	(3 * 1000)
 /* Timeout for Flash write operations (in ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	(3 * 1000)
 /* Timeout for Flash set sector lock bit operations (in ms) */
-#define CONFIG_SYS_FLASH_LOCK_TOUT		(3 * 1000)
 /* Timeout for Flash clear lock bit operations (in ms) */
-#define CONFIG_SYS_FLASH_UNLOCK_TOUT	(3 * 1000)
 
 /* GPIO / PFC */
 #define CONFIG_SH_GPIO_PFC
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index 73f1797b47..f3e694c3c8 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -70,8 +70,6 @@
 #define CONFIG_SYS_WRITE_SWAPPED_DATA
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{CONFIG_SYS_FLASH_BASE_PHYS, \
 					CONFIG_SYS_FLASH_BASE_PHYS + 0x8000000}
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index 732869ac14..8681417eb0 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -99,8 +99,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45	/* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ CONFIG_SYS_FLASH_BASE_PHYS }
 
diff --git a/include/configs/ls1043aqds.h b/include/configs/ls1043aqds.h
index f11d3e976b..e265b1a48e 100644
--- a/include/configs/ls1043aqds.h
+++ b/include/configs/ls1043aqds.h
@@ -75,8 +75,6 @@
 #define CONFIG_SYS_NOR_FTIM3		0
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{CONFIG_SYS_FLASH_BASE_PHYS, \
 					CONFIG_SYS_FLASH_BASE_PHYS + 0x8000000}
diff --git a/include/configs/ls1043ardb.h b/include/configs/ls1043ardb.h
index 45b2359dda..352b7dbdd8 100644
--- a/include/configs/ls1043ardb.h
+++ b/include/configs/ls1043ardb.h
@@ -43,8 +43,6 @@
 #define CONFIG_SYS_IFC_CCR		0x01000000
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ CONFIG_SYS_FLASH_BASE_PHYS }
 
diff --git a/include/configs/ls1046aqds.h b/include/configs/ls1046aqds.h
index 7139463016..261646fe70 100644
--- a/include/configs/ls1046aqds.h
+++ b/include/configs/ls1046aqds.h
@@ -92,8 +92,6 @@
 #define CONFIG_SYS_NOR_FTIM3		0
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{CONFIG_SYS_FLASH_BASE_PHYS, \
 					CONFIG_SYS_FLASH_BASE_PHYS + 0x8000000}
diff --git a/include/configs/ls1088aqds.h b/include/configs/ls1088aqds.h
index 004de7cfb7..c02acfb858 100644
--- a/include/configs/ls1088aqds.h
+++ b/include/configs/ls1088aqds.h
@@ -66,8 +66,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ CONFIG_SYS_FLASH_BASE,\
 					 CONFIG_SYS_FLASH_BASE + 0x40000000}
diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
index 14b2c9793b..61df2a4253 100644
--- a/include/configs/ls1088ardb.h
+++ b/include/configs/ls1088ardb.h
@@ -51,8 +51,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ CONFIG_SYS_FLASH_BASE }
 #endif
diff --git a/include/configs/ls2080aqds.h b/include/configs/ls2080aqds.h
index ff1c192c6b..c7146314df 100644
--- a/include/configs/ls2080aqds.h
+++ b/include/configs/ls2080aqds.h
@@ -68,8 +68,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ CONFIG_SYS_FLASH_BASE,\
 					 CONFIG_SYS_FLASH_BASE + 0x40000000}
diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index b2dd6c6589..d20eaec752 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -65,8 +65,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS	45 /* count down from 45/5: 9..1 */
 
 #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* sectors per device */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ CONFIG_SYS_FLASH_BASE,\
 					 CONFIG_SYS_FLASH_BASE + 0x40000000}
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index 385e338bfb..e849f5ee87 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -198,9 +198,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #define CONFIG_FLASH_SHOW_PROGRESS	45	/* count down from 45/5: 9..1 */
 
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */
-
 /* Nand Flash */
 #ifdef CONFIG_NAND_FSL_ELBC
 #define CONFIG_SYS_NAND_BASE		0xff800000
diff --git a/include/configs/socrates.h b/include/configs/socrates.h
index c3b1be9698..185da975fc 100644
--- a/include/configs/socrates.h
+++ b/include/configs/socrates.h
@@ -89,8 +89,6 @@
 #define CONFIG_SYS_FLASH_BASE		CONFIG_SYS_LBC_FLASH_BASE /* start of FLASH	*/
 
 #define CONFIG_SYS_MAX_FLASH_SECT	256		/* sectors per device	*/
-#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms)	*/
-#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms)	*/
 
 #define CONFIG_SYS_LBC_LCRR		0x00030004    /* LB clock ratio reg	*/
 #define CONFIG_SYS_LBC_LBCR		0x00000000    /* LB config reg		*/
diff --git a/include/configs/vexpress_common.h b/include/configs/vexpress_common.h
index 91ce2fe0ca..572a5171fc 100644
--- a/include/configs/vexpress_common.h
+++ b/include/configs/vexpress_common.h
@@ -173,8 +173,6 @@
 #define CONFIG_SYS_FLASH_BASE1		V2M_NOR1
 
 /* Timeout values in ticks */
-#define CONFIG_SYS_FLASH_ERASE_TOUT	(2 * CONFIG_SYS_HZ) /* Erase Timeout */
-#define CONFIG_SYS_FLASH_WRITE_TOUT	(2 * CONFIG_SYS_HZ) /* Write Timeout */
 
 /* 255 0x40000 sectors + first or last sector may have 4 erase regions = 259 */
 #define CONFIG_SYS_MAX_FLASH_SECT	259		/* Max sectors */
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index c9d8d09f19..cb4f420972 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -39,8 +39,6 @@
 /* NOR */
 #ifdef CONFIG_MTD_NOR_FLASH
 # define CONFIG_SYS_MAX_FLASH_SECT	512
-# define CONFIG_SYS_FLASH_ERASE_TOUT	1000
-# define CONFIG_SYS_FLASH_WRITE_TOUT	5000
 # define CONFIG_FLASH_SHOW_PROGRESS	10
 # define CONFIG_SYS_FLASH_QUIET_TEST
 #endif
-- 
2.39.5