This converts the following to Kconfig:
   CONFIG_SYS_MAX_FLASH_SECT

Signed-off-by: Tom Rini <tr...@konsulko.com>
---
 README                                              | 3 ---
 configs/10m50_defconfig                             | 1 +
 configs/M5208EVBE_defconfig                         | 1 +
 configs/M5235EVB_Flash32_defconfig                  | 1 +
 configs/M5235EVB_defconfig                          | 1 +
 configs/M5249EVB_defconfig                          | 1 +
 configs/M5253DEMO_defconfig                         | 1 +
 configs/M5272C3_defconfig                           | 1 +
 configs/M5275EVB_defconfig                          | 1 +
 configs/M5282EVB_defconfig                          | 1 +
 configs/M53017EVB_defconfig                         | 1 +
 configs/M5329AFEE_defconfig                         | 1 +
 configs/M5329BFEE_defconfig                         | 1 +
 configs/M5373EVB_defconfig                          | 1 +
 configs/MCR3000_defconfig                           | 1 +
 configs/MPC837XERDB_defconfig                       | 1 +
 configs/MPC8548CDS_36BIT_defconfig                  | 1 +
 configs/MPC8548CDS_defconfig                        | 1 +
 configs/MPC8548CDS_legacy_defconfig                 | 1 +
 configs/P1010RDB-PA_36BIT_NAND_defconfig            | 1 +
 configs/P1010RDB-PA_36BIT_NOR_defconfig             | 1 +
 configs/P1010RDB-PA_36BIT_SDCARD_defconfig          | 1 +
 configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig        | 1 +
 configs/P1010RDB-PA_NAND_defconfig                  | 1 +
 configs/P1010RDB-PA_NOR_defconfig                   | 1 +
 configs/P1010RDB-PA_SDCARD_defconfig                | 1 +
 configs/P1010RDB-PA_SPIFLASH_defconfig              | 1 +
 configs/P1010RDB-PB_36BIT_NAND_defconfig            | 1 +
 configs/P1010RDB-PB_36BIT_NOR_defconfig             | 1 +
 configs/P1010RDB-PB_36BIT_SDCARD_defconfig          | 1 +
 configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig        | 1 +
 configs/P1010RDB-PB_NAND_defconfig                  | 1 +
 configs/P1010RDB-PB_NOR_defconfig                   | 1 +
 configs/P1010RDB-PB_SDCARD_defconfig                | 1 +
 configs/P1010RDB-PB_SPIFLASH_defconfig              | 1 +
 configs/P1020RDB-PC_36BIT_NAND_defconfig            | 1 +
 configs/P1020RDB-PC_36BIT_SDCARD_defconfig          | 1 +
 configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig        | 1 +
 configs/P1020RDB-PC_36BIT_defconfig                 | 1 +
 configs/P1020RDB-PC_NAND_defconfig                  | 1 +
 configs/P1020RDB-PC_SDCARD_defconfig                | 1 +
 configs/P1020RDB-PC_SPIFLASH_defconfig              | 1 +
 configs/P1020RDB-PC_defconfig                       | 1 +
 configs/P2020RDB-PC_36BIT_NAND_defconfig            | 1 +
 configs/P2020RDB-PC_36BIT_SDCARD_defconfig          | 1 +
 configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig        | 1 +
 configs/P2020RDB-PC_36BIT_defconfig                 | 1 +
 configs/P2020RDB-PC_NAND_defconfig                  | 1 +
 configs/P2020RDB-PC_SDCARD_defconfig                | 1 +
 configs/P2020RDB-PC_SPIFLASH_defconfig              | 1 +
 configs/P2020RDB-PC_defconfig                       | 1 +
 configs/P2041RDB_NAND_defconfig                     | 1 +
 configs/P2041RDB_SDCARD_defconfig                   | 1 +
 configs/P2041RDB_SPIFLASH_defconfig                 | 1 +
 configs/P2041RDB_defconfig                          | 1 +
 configs/P3041DS_NAND_defconfig                      | 1 +
 configs/P3041DS_SDCARD_defconfig                    | 1 +
 configs/P3041DS_SPIFLASH_defconfig                  | 1 +
 configs/P3041DS_defconfig                           | 1 +
 configs/P4080DS_SDCARD_defconfig                    | 1 +
 configs/P4080DS_SPIFLASH_defconfig                  | 1 +
 configs/P4080DS_defconfig                           | 1 +
 configs/P5040DS_NAND_defconfig                      | 1 +
 configs/P5040DS_SDCARD_defconfig                    | 1 +
 configs/P5040DS_SPIFLASH_defconfig                  | 1 +
 configs/P5040DS_defconfig                           | 1 +
 configs/T1024RDB_NAND_defconfig                     | 1 +
 configs/T1024RDB_SDCARD_defconfig                   | 1 +
 configs/T1024RDB_SPIFLASH_defconfig                 | 1 +
 configs/T1024RDB_defconfig                          | 1 +
 configs/T1042D4RDB_NAND_defconfig                   | 1 +
 configs/T1042D4RDB_SDCARD_defconfig                 | 1 +
 configs/T1042D4RDB_SPIFLASH_defconfig               | 1 +
 configs/T1042D4RDB_defconfig                        | 1 +
 configs/T2080QDS_NAND_defconfig                     | 1 +
 configs/T2080QDS_SDCARD_defconfig                   | 1 +
 configs/T2080QDS_SECURE_BOOT_defconfig              | 1 +
 configs/T2080QDS_SPIFLASH_defconfig                 | 1 +
 configs/T2080QDS_defconfig                          | 1 +
 configs/T2080RDB_NAND_defconfig                     | 1 +
 configs/T2080RDB_SDCARD_defconfig                   | 1 +
 configs/T2080RDB_SPIFLASH_defconfig                 | 1 +
 configs/T2080RDB_defconfig                          | 1 +
 configs/T2080RDB_revD_NAND_defconfig                | 1 +
 configs/T2080RDB_revD_SDCARD_defconfig              | 1 +
 configs/T2080RDB_revD_SPIFLASH_defconfig            | 1 +
 configs/T2080RDB_revD_defconfig                     | 1 +
 configs/T4240RDB_SDCARD_defconfig                   | 1 +
 configs/T4240RDB_defconfig                          | 1 +
 configs/amcore_defconfig                            | 1 +
 configs/astro_mcf5373l_defconfig                    | 1 +
 configs/at91sam9263ek_norflash_boot_defconfig       | 1 +
 configs/at91sam9263ek_norflash_defconfig            | 1 +
 configs/blanche_defconfig                           | 1 +
 configs/boston32r2_defconfig                        | 1 +
 configs/boston32r2el_defconfig                      | 1 +
 configs/boston32r6_defconfig                        | 1 +
 configs/boston32r6el_defconfig                      | 1 +
 configs/boston64r2_defconfig                        | 1 +
 configs/boston64r2el_defconfig                      | 1 +
 configs/boston64r6_defconfig                        | 1 +
 configs/boston64r6el_defconfig                      | 1 +
 configs/cobra5272_defconfig                         | 1 +
 configs/da850evm_direct_nor_defconfig               | 1 +
 configs/devkit3250_defconfig                        | 1 +
 configs/eb_cpu5282_defconfig                        | 1 +
 configs/eb_cpu5282_internal_defconfig               | 1 +
 configs/edminiv2_defconfig                          | 1 +
 configs/ethernut5_defconfig                         | 1 +
 configs/gazerbeam_defconfig                         | 1 +
 configs/ids8313_defconfig                           | 1 +
 configs/integratorap_cm720t_defconfig               | 1 +
 configs/integratorap_cm920t_defconfig               | 1 +
 configs/integratorap_cm926ejs_defconfig             | 1 +
 configs/integratorap_cm946es_defconfig              | 1 +
 configs/integratorcp_cm1136_defconfig               | 1 +
 configs/integratorcp_cm920t_defconfig               | 1 +
 configs/integratorcp_cm926ejs_defconfig             | 1 +
 configs/integratorcp_cm946es_defconfig              | 1 +
 configs/ls1021aqds_ddr4_nor_defconfig               | 1 +
 configs/ls1021aqds_ddr4_nor_lpuart_defconfig        | 1 +
 configs/ls1021aqds_nand_defconfig                   | 1 +
 configs/ls1021aqds_nor_SECURE_BOOT_defconfig        | 1 +
 configs/ls1021aqds_nor_defconfig                    | 1 +
 configs/ls1021aqds_nor_lpuart_defconfig             | 1 +
 configs/ls1021aqds_sdcard_ifc_defconfig             | 1 +
 configs/ls1021atwr_nor_SECURE_BOOT_defconfig        | 1 +
 configs/ls1021atwr_nor_defconfig                    | 1 +
 configs/ls1021atwr_nor_lpuart_defconfig             | 1 +
 configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig | 1 +
 configs/ls1021atwr_sdcard_ifc_defconfig             | 1 +
 configs/ls1043aqds_defconfig                        | 1 +
 configs/ls1043aqds_lpuart_defconfig                 | 1 +
 configs/ls1043aqds_nand_defconfig                   | 1 +
 configs/ls1043aqds_nor_ddr3_defconfig               | 1 +
 configs/ls1043aqds_sdcard_ifc_defconfig             | 1 +
 configs/ls1043aqds_tfa_SECURE_BOOT_defconfig        | 1 +
 configs/ls1043aqds_tfa_defconfig                    | 1 +
 configs/ls1043ardb_SECURE_BOOT_defconfig            | 1 +
 configs/ls1043ardb_defconfig                        | 1 +
 configs/ls1043ardb_nand_SECURE_BOOT_defconfig       | 1 +
 configs/ls1043ardb_nand_defconfig                   | 1 +
 configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig     | 1 +
 configs/ls1043ardb_sdcard_defconfig                 | 1 +
 configs/ls1043ardb_tfa_SECURE_BOOT_defconfig        | 1 +
 configs/ls1043ardb_tfa_defconfig                    | 1 +
 configs/ls1046aqds_SECURE_BOOT_defconfig            | 1 +
 configs/ls1046aqds_defconfig                        | 1 +
 configs/ls1046aqds_lpuart_defconfig                 | 1 +
 configs/ls1046aqds_nand_defconfig                   | 1 +
 configs/ls1046aqds_sdcard_ifc_defconfig             | 1 +
 configs/ls1046aqds_tfa_SECURE_BOOT_defconfig        | 1 +
 configs/ls1046aqds_tfa_defconfig                    | 1 +
 configs/ls1088aqds_defconfig                        | 1 +
 configs/ls1088aqds_sdcard_ifc_defconfig             | 1 +
 configs/ls1088aqds_tfa_defconfig                    | 1 +
 configs/ls2080aqds_SECURE_BOOT_defconfig            | 1 +
 configs/ls2080aqds_defconfig                        | 1 +
 configs/ls2080ardb_SECURE_BOOT_defconfig            | 1 +
 configs/ls2080ardb_defconfig                        | 1 +
 configs/ls2080ardb_nand_defconfig                   | 1 +
 configs/ls2088aqds_tfa_defconfig                    | 1 +
 configs/ls2088ardb_tfa_SECURE_BOOT_defconfig        | 1 +
 configs/ls2088ardb_tfa_defconfig                    | 1 +
 configs/malta64_defconfig                           | 1 +
 configs/malta64el_defconfig                         | 1 +
 configs/malta_defconfig                             | 1 +
 configs/maltael_defconfig                           | 1 +
 configs/microblaze-generic_defconfig                | 1 +
 configs/octeon_ebb7304_defconfig                    | 1 +
 configs/omap35_logic_somlv_defconfig                | 1 +
 configs/omap3_logic_somlv_defconfig                 | 1 +
 configs/pm9261_defconfig                            | 1 +
 configs/pm9263_defconfig                            | 1 +
 configs/qemu_arm64_defconfig                        | 1 +
 configs/qemu_arm_defconfig                          | 1 +
 configs/r2dplus_defconfig                           | 1 +
 configs/r8a77990_ebisu_defconfig                    | 1 +
 configs/r8a77995_draak_defconfig                    | 1 +
 configs/rcar3_salvator-x_defconfig                  | 1 +
 configs/rcar3_ulcb_defconfig                        | 1 +
 configs/sama5d3xek_mmc_defconfig                    | 1 +
 configs/sama5d3xek_nandflash_defconfig              | 1 +
 configs/sama5d3xek_spiflash_defconfig               | 1 +
 configs/socrates_defconfig                          | 1 +
 configs/stm32746g-eval_defconfig                    | 1 +
 configs/stm32746g-eval_spl_defconfig                | 1 +
 configs/stm32f429-discovery_defconfig               | 1 +
 configs/stm32f429-evaluation_defconfig              | 1 +
 configs/stm32f469-discovery_defconfig               | 1 +
 configs/stm32f746-disco_defconfig                   | 1 +
 configs/stm32f746-disco_spl_defconfig               | 1 +
 configs/stm32f769-disco_defconfig                   | 1 +
 configs/stm32f769-disco_spl_defconfig               | 1 +
 configs/total_compute_defconfig                     | 1 +
 configs/vexpress_aemv8a_juno_defconfig              | 1 +
 configs/vexpress_aemv8a_semi_defconfig              | 1 +
 configs/vexpress_ca9x4_defconfig                    | 1 +
 configs/xtfpga_defconfig                            | 1 +
 drivers/mtd/Kconfig                                 | 5 +++++
 include/configs/10m50_devboard.h                    | 1 -
 include/configs/3c120_devboard.h                    | 1 -
 include/configs/M5208EVBE.h                         | 1 -
 include/configs/M5235EVB.h                          | 1 -
 include/configs/M5249EVB.h                          | 1 -
 include/configs/M5253DEMO.h                         | 1 -
 include/configs/M5272C3.h                           | 1 -
 include/configs/M5275EVB.h                          | 1 -
 include/configs/M5282EVB.h                          | 1 -
 include/configs/M53017EVB.h                         | 1 -
 include/configs/M5329EVB.h                          | 1 -
 include/configs/M5373EVB.h                          | 1 -
 include/configs/MCR3000.h                           | 1 -
 include/configs/MPC837XERDB.h                       | 3 ---
 include/configs/MPC8548CDS.h                        | 1 -
 include/configs/P1010RDB.h                          | 1 -
 include/configs/P2041RDB.h                          | 2 --
 include/configs/T102xRDB.h                          | 2 --
 include/configs/T104xRDB.h                          | 2 --
 include/configs/T208xQDS.h                          | 2 --
 include/configs/T208xRDB.h                          | 1 -
 include/configs/T4240RDB.h                          | 2 --
 include/configs/am335x_evm.h                        | 1 -
 include/configs/am3517_evm.h                        | 1 -
 include/configs/amcore.h                            | 1 -
 include/configs/armadillo-800eva.h                  | 1 -
 include/configs/astro_mcf5373l.h                    | 1 -
 include/configs/at91sam9263ek.h                     | 1 -
 include/configs/ax25-ae350.h                        | 1 -
 include/configs/blanche.h                           | 1 -
 include/configs/boston.h                            | 6 ------
 include/configs/cobra5272.h                         | 5 -----
 include/configs/corenet_ds.h                        | 2 --
 include/configs/da850evm.h                          | 2 --
 include/configs/devkit3250.h                        | 1 -
 include/configs/dra7xx_evm.h                        | 1 -
 include/configs/draak.h                             | 1 -
 include/configs/eb_cpu5282.h                        | 2 --
 include/configs/ebisu.h                             | 1 -
 include/configs/edminiv2.h                          | 1 -
 include/configs/ethernut5.h                         | 1 -
 include/configs/gazerbeam.h                         | 2 --
 include/configs/ids8313.h                           | 3 ---
 include/configs/imx27lite-common.h                  | 2 --
 include/configs/integratorap.h                      | 1 -
 include/configs/integratorcp.h                      | 1 -
 include/configs/km/km-mpc83xx.h                     | 1 -
 include/configs/km/pg-wcom-ls102xa.h                | 2 --
 include/configs/kmcent2.h                           | 2 --
 include/configs/kzm9g.h                             | 1 -
 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/lsxl.h                              | 3 ---
 include/configs/malta.h                             | 1 -
 include/configs/microblaze-generic.h                | 7 -------
 include/configs/mx6sabreauto.h                      | 1 -
 include/configs/octeon_ebb7304.h                    | 5 -----
 include/configs/omap3_logic.h                       | 1 -
 include/configs/p1_p2_rdb_pc.h                      | 2 --
 include/configs/pm9261.h                            | 1 -
 include/configs/pm9263.h                            | 1 -
 include/configs/qemu-arm.h                          | 2 --
 include/configs/r2dplus.h                           | 1 -
 include/configs/salvator-x.h                        | 1 -
 include/configs/sama5d3xek.h                        | 1 -
 include/configs/socrates.h                          | 2 --
 include/configs/stm32f429-discovery.h               | 2 --
 include/configs/stm32f429-evaluation.h              | 2 --
 include/configs/stm32f469-discovery.h               | 2 --
 include/configs/stm32f746-disco.h                   | 2 --
 include/configs/total_compute.h                     | 4 ----
 include/configs/ulcb.h                              | 1 -
 include/configs/vexpress_aemv8.h                    | 9 ---------
 include/configs/vexpress_common.h                   | 4 ----
 include/configs/xtfpga.h                            | 3 ---
 include/configs/zynq-common.h                       | 1 -
 283 files changed, 203 insertions(+), 155 deletions(-)

diff --git a/README b/README
index 157612d00412..d88c350cb914 100644
--- a/README
+++ b/README
@@ -1756,9 +1756,6 @@ Configuration Settings:
                Enables allocating and saving a kernel copy of the bd_info in
                space between "bootm_low" and "bootm_low" + BOOTMAPSZ.
 
-- CONFIG_SYS_MAX_FLASH_SECT:
-               Max number of sectors on a Flash chip
-
 - CONFIG_SYS_FLASH_PROTECTION
                If defined, hardware flash sectors protection is used
                instead of U-Boot software protection.
diff --git a/configs/10m50_defconfig b/configs/10m50_defconfig
index 6c56cdc3286d..5083545a069c 100644
--- a/configs/10m50_defconfig
+++ b/configs/10m50_defconfig
@@ -40,6 +40,7 @@ CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_ALTERA_QSPI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_PHY_MARVELL=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
diff --git a/configs/M5208EVBE_defconfig b/configs/M5208EVBE_defconfig
index 858fc5bbfd2e..e294d1315cbc 100644
--- a/configs/M5208EVBE_defconfig
+++ b/configs/M5208EVBE_defconfig
@@ -38,6 +38,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=254
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
 CONFIG_MII=y
diff --git a/configs/M5235EVB_Flash32_defconfig 
b/configs/M5235EVB_Flash32_defconfig
index c7fd5a07a7c5..571b653b718a 100644
--- a/configs/M5235EVB_Flash32_defconfig
+++ b/configs/M5235EVB_Flash32_defconfig
@@ -45,6 +45,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_32BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
 CONFIG_MII=y
diff --git a/configs/M5235EVB_defconfig b/configs/M5235EVB_defconfig
index a14bf427ad0a..7f7d92ba019f 100644
--- a/configs/M5235EVB_defconfig
+++ b/configs/M5235EVB_defconfig
@@ -45,6 +45,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
 CONFIG_MII=y
diff --git a/configs/M5249EVB_defconfig b/configs/M5249EVB_defconfig
index 74301045c8e4..e4fb7ab96a83 100644
--- a/configs/M5249EVB_defconfig
+++ b/configs/M5249EVB_defconfig
@@ -29,4 +29,5 @@ CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_SYS_FLASH_CHECKSUM=y
+CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_MCFUART=y
diff --git a/configs/M5253DEMO_defconfig b/configs/M5253DEMO_defconfig
index 3ed703a7a793..79382eb0fe43 100644
--- a/configs/M5253DEMO_defconfig
+++ b/configs/M5253DEMO_defconfig
@@ -39,6 +39,7 @@ CONFIG_SYS_FSL_I2C_OFFSET=0x280
 CONFIG_SYS_I2C_SLAVE=0x7F
 CONFIG_SYS_I2C_SPEED=80000
 CONFIG_MTD_NOR_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=2048
 CONFIG_USE_SYS_MAX_FLASH_BANKS=y
 CONFIG_DRIVER_DM9000=y
 CONFIG_MCFUART=y
diff --git a/configs/M5272C3_defconfig b/configs/M5272C3_defconfig
index e3f736bf6308..7dc87a2b2736 100644
--- a/configs/M5272C3_defconfig
+++ b/configs/M5272C3_defconfig
@@ -57,6 +57,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
 CONFIG_MII=y
diff --git a/configs/M5275EVB_defconfig b/configs/M5275EVB_defconfig
index fe6ffca43c9f..9e2cc332505a 100644
--- a/configs/M5275EVB_defconfig
+++ b/configs/M5275EVB_defconfig
@@ -41,6 +41,7 @@ CONFIG_SYS_I2C_SPEED=80000
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=11
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
 CONFIG_MII=y
diff --git a/configs/M5282EVB_defconfig b/configs/M5282EVB_defconfig
index aeb7738ebe77..751d80500255 100644
--- a/configs/M5282EVB_defconfig
+++ b/configs/M5282EVB_defconfig
@@ -34,6 +34,7 @@ CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_SYS_FLASH_CHECKSUM=y
+CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
 CONFIG_MII=y
diff --git a/configs/M53017EVB_defconfig b/configs/M53017EVB_defconfig
index 28d51eaa9deb..103289193613 100644
--- a/configs/M53017EVB_defconfig
+++ b/configs/M53017EVB_defconfig
@@ -41,6 +41,7 @@ CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
 CONFIG_SYS_UNIFY_CACHE=y
diff --git a/configs/M5329AFEE_defconfig b/configs/M5329AFEE_defconfig
index c59359b820c7..152a0be28ead 100644
--- a/configs/M5329AFEE_defconfig
+++ b/configs/M5329AFEE_defconfig
@@ -40,6 +40,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
 CONFIG_SYS_UNIFY_CACHE=y
diff --git a/configs/M5329BFEE_defconfig b/configs/M5329BFEE_defconfig
index ae4add504b1c..0bb86c158fa0 100644
--- a/configs/M5329BFEE_defconfig
+++ b/configs/M5329BFEE_defconfig
@@ -41,6 +41,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_MTD_RAW_NAND=y
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
diff --git a/configs/M5373EVB_defconfig b/configs/M5373EVB_defconfig
index aead0f45bd30..27f72562d7a3 100644
--- a/configs/M5373EVB_defconfig
+++ b/configs/M5373EVB_defconfig
@@ -41,6 +41,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=137
 CONFIG_MTD_RAW_NAND=y
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
diff --git a/configs/MCR3000_defconfig b/configs/MCR3000_defconfig
index 6adba431ef09..086507e60165 100644
--- a/configs/MCR3000_defconfig
+++ b/configs/MCR3000_defconfig
@@ -83,6 +83,7 @@ CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=35
 CONFIG_MTD_RAW_NAND=y
 CONFIG_MPC8XX_FEC=y
 # CONFIG_PCI is not set
diff --git a/configs/MPC837XERDB_defconfig b/configs/MPC837XERDB_defconfig
index 1004d3c80507..9a421096e7a8 100644
--- a/configs/MPC837XERDB_defconfig
+++ b/configs/MPC837XERDB_defconfig
@@ -197,6 +197,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
 CONFIG_DM_ETH_PHY=y
diff --git a/configs/MPC8548CDS_36BIT_defconfig 
b/configs/MPC8548CDS_36BIT_defconfig
index 838a29a1ba8b..def5d6fdf44b 100644
--- a/configs/MPC8548CDS_36BIT_defconfig
+++ b/configs/MPC8548CDS_36BIT_defconfig
@@ -63,6 +63,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_PHY_ATHEROS=y
 CONFIG_PHY_BROADCOM=y
diff --git a/configs/MPC8548CDS_defconfig b/configs/MPC8548CDS_defconfig
index 2912b4446c68..881fca912b9b 100644
--- a/configs/MPC8548CDS_defconfig
+++ b/configs/MPC8548CDS_defconfig
@@ -62,6 +62,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_PHY_ATHEROS=y
 CONFIG_PHY_BROADCOM=y
diff --git a/configs/MPC8548CDS_legacy_defconfig 
b/configs/MPC8548CDS_legacy_defconfig
index 0f5b166f9987..99a63300af90 100644
--- a/configs/MPC8548CDS_legacy_defconfig
+++ b/configs/MPC8548CDS_legacy_defconfig
@@ -62,6 +62,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_PHY_ATHEROS=y
 CONFIG_PHY_BROADCOM=y
diff --git a/configs/P1010RDB-PA_36BIT_NAND_defconfig 
b/configs/P1010RDB-PA_36BIT_NAND_defconfig
index a4cf3ba22023..3c5e62d10b4a 100644
--- a/configs/P1010RDB-PA_36BIT_NAND_defconfig
+++ b/configs/P1010RDB-PA_36BIT_NAND_defconfig
@@ -101,6 +101,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/configs/P1010RDB-PA_36BIT_NOR_defconfig 
b/configs/P1010RDB-PA_36BIT_NOR_defconfig
index 0de8d87f1192..e5deb252ebad 100644
--- a/configs/P1010RDB-PA_36BIT_NOR_defconfig
+++ b/configs/P1010RDB-PA_36BIT_NOR_defconfig
@@ -69,6 +69,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PA_36BIT_SDCARD_defconfig 
b/configs/P1010RDB-PA_36BIT_SDCARD_defconfig
index 60b86d3a5e29..5bf9893fef9d 100644
--- a/configs/P1010RDB-PA_36BIT_SDCARD_defconfig
+++ b/configs/P1010RDB-PA_36BIT_SDCARD_defconfig
@@ -90,6 +90,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig 
b/configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig
index 515c05053d2f..e3cea01cc654 100644
--- a/configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig
+++ b/configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig
@@ -92,6 +92,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PA_NAND_defconfig 
b/configs/P1010RDB-PA_NAND_defconfig
index 9e303f378aab..466747483c12 100644
--- a/configs/P1010RDB-PA_NAND_defconfig
+++ b/configs/P1010RDB-PA_NAND_defconfig
@@ -100,6 +100,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/configs/P1010RDB-PA_NOR_defconfig 
b/configs/P1010RDB-PA_NOR_defconfig
index 982da33427fe..8a2bb55f6141 100644
--- a/configs/P1010RDB-PA_NOR_defconfig
+++ b/configs/P1010RDB-PA_NOR_defconfig
@@ -68,6 +68,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PA_SDCARD_defconfig 
b/configs/P1010RDB-PA_SDCARD_defconfig
index 71c1bb861e97..320eb691deea 100644
--- a/configs/P1010RDB-PA_SDCARD_defconfig
+++ b/configs/P1010RDB-PA_SDCARD_defconfig
@@ -89,6 +89,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PA_SPIFLASH_defconfig 
b/configs/P1010RDB-PA_SPIFLASH_defconfig
index 69e3165c0b9e..cad5fbb3823a 100644
--- a/configs/P1010RDB-PA_SPIFLASH_defconfig
+++ b/configs/P1010RDB-PA_SPIFLASH_defconfig
@@ -91,6 +91,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PB_36BIT_NAND_defconfig 
b/configs/P1010RDB-PB_36BIT_NAND_defconfig
index e17bef8016ec..7535d9f81273 100644
--- a/configs/P1010RDB-PB_36BIT_NAND_defconfig
+++ b/configs/P1010RDB-PB_36BIT_NAND_defconfig
@@ -103,6 +103,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/P1010RDB-PB_36BIT_NOR_defconfig 
b/configs/P1010RDB-PB_36BIT_NOR_defconfig
index d1a3edd16048..1811c5cc4b11 100644
--- a/configs/P1010RDB-PB_36BIT_NOR_defconfig
+++ b/configs/P1010RDB-PB_36BIT_NOR_defconfig
@@ -71,6 +71,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PB_36BIT_SDCARD_defconfig 
b/configs/P1010RDB-PB_36BIT_SDCARD_defconfig
index b8851f45a05b..405365e63dcf 100644
--- a/configs/P1010RDB-PB_36BIT_SDCARD_defconfig
+++ b/configs/P1010RDB-PB_36BIT_SDCARD_defconfig
@@ -92,6 +92,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig 
b/configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig
index 893f2f84cdcf..afbb38c63946 100644
--- a/configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig
+++ b/configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig
@@ -94,6 +94,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PB_NAND_defconfig 
b/configs/P1010RDB-PB_NAND_defconfig
index 48687a91bc54..9ab0bb5e094d 100644
--- a/configs/P1010RDB-PB_NAND_defconfig
+++ b/configs/P1010RDB-PB_NAND_defconfig
@@ -102,6 +102,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/P1010RDB-PB_NOR_defconfig 
b/configs/P1010RDB-PB_NOR_defconfig
index 586630ae632b..9196895842da 100644
--- a/configs/P1010RDB-PB_NOR_defconfig
+++ b/configs/P1010RDB-PB_NOR_defconfig
@@ -70,6 +70,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PB_SDCARD_defconfig 
b/configs/P1010RDB-PB_SDCARD_defconfig
index 08421403c6ae..bac9d01ae780 100644
--- a/configs/P1010RDB-PB_SDCARD_defconfig
+++ b/configs/P1010RDB-PB_SDCARD_defconfig
@@ -91,6 +91,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1010RDB-PB_SPIFLASH_defconfig 
b/configs/P1010RDB-PB_SPIFLASH_defconfig
index 7915c8f6a2d9..33f28402a7e7 100644
--- a/configs/P1010RDB-PB_SPIFLASH_defconfig
+++ b/configs/P1010RDB-PB_SPIFLASH_defconfig
@@ -93,6 +93,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1020RDB-PC_36BIT_NAND_defconfig 
b/configs/P1020RDB-PC_36BIT_NAND_defconfig
index 69d6493b1ed8..cc3efdc96e43 100644
--- a/configs/P1020RDB-PC_36BIT_NAND_defconfig
+++ b/configs/P1020RDB-PC_36BIT_NAND_defconfig
@@ -112,6 +112,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_ELBC=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x4000
diff --git a/configs/P1020RDB-PC_36BIT_SDCARD_defconfig 
b/configs/P1020RDB-PC_36BIT_SDCARD_defconfig
index e974b80420e0..4956eb299402 100644
--- a/configs/P1020RDB-PC_36BIT_SDCARD_defconfig
+++ b/configs/P1020RDB-PC_36BIT_SDCARD_defconfig
@@ -99,6 +99,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig 
b/configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig
index 016ae79d6938..6f8beca99e20 100644
--- a/configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig
+++ b/configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig
@@ -101,6 +101,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1020RDB-PC_36BIT_defconfig 
b/configs/P1020RDB-PC_36BIT_defconfig
index 9dd76803f6f2..a38943d8ee6c 100644
--- a/configs/P1020RDB-PC_36BIT_defconfig
+++ b/configs/P1020RDB-PC_36BIT_defconfig
@@ -79,6 +79,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1020RDB-PC_NAND_defconfig 
b/configs/P1020RDB-PC_NAND_defconfig
index 792a2fe7036f..2476352d6ab0 100644
--- a/configs/P1020RDB-PC_NAND_defconfig
+++ b/configs/P1020RDB-PC_NAND_defconfig
@@ -111,6 +111,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_ELBC=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x4000
diff --git a/configs/P1020RDB-PC_SDCARD_defconfig 
b/configs/P1020RDB-PC_SDCARD_defconfig
index 47ff7ebf3715..ed77af051cca 100644
--- a/configs/P1020RDB-PC_SDCARD_defconfig
+++ b/configs/P1020RDB-PC_SDCARD_defconfig
@@ -98,6 +98,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1020RDB-PC_SPIFLASH_defconfig 
b/configs/P1020RDB-PC_SPIFLASH_defconfig
index ad3eda7cbfd2..55794e683386 100644
--- a/configs/P1020RDB-PC_SPIFLASH_defconfig
+++ b/configs/P1020RDB-PC_SPIFLASH_defconfig
@@ -100,6 +100,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P1020RDB-PC_defconfig b/configs/P1020RDB-PC_defconfig
index 2b744decbbe4..57d5958125a7 100644
--- a/configs/P1020RDB-PC_defconfig
+++ b/configs/P1020RDB-PC_defconfig
@@ -78,6 +78,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P2020RDB-PC_36BIT_NAND_defconfig 
b/configs/P2020RDB-PC_36BIT_NAND_defconfig
index 2df97ba559ad..04540ae8ed0c 100644
--- a/configs/P2020RDB-PC_36BIT_NAND_defconfig
+++ b/configs/P2020RDB-PC_36BIT_NAND_defconfig
@@ -117,6 +117,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_ELBC=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x4000
diff --git a/configs/P2020RDB-PC_36BIT_SDCARD_defconfig 
b/configs/P2020RDB-PC_36BIT_SDCARD_defconfig
index a4e684a99c1b..3af641f6a0ca 100644
--- a/configs/P2020RDB-PC_36BIT_SDCARD_defconfig
+++ b/configs/P2020RDB-PC_36BIT_SDCARD_defconfig
@@ -104,6 +104,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig 
b/configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig
index 822f5f603d72..22937dd9dbed 100644
--- a/configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig
+++ b/configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig
@@ -106,6 +106,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P2020RDB-PC_36BIT_defconfig 
b/configs/P2020RDB-PC_36BIT_defconfig
index 0d697dbf8bdf..caa546a376f9 100644
--- a/configs/P2020RDB-PC_36BIT_defconfig
+++ b/configs/P2020RDB-PC_36BIT_defconfig
@@ -84,6 +84,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P2020RDB-PC_NAND_defconfig 
b/configs/P2020RDB-PC_NAND_defconfig
index 4c754560a958..852ef4419a05 100644
--- a/configs/P2020RDB-PC_NAND_defconfig
+++ b/configs/P2020RDB-PC_NAND_defconfig
@@ -116,6 +116,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_ELBC=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x4000
diff --git a/configs/P2020RDB-PC_SDCARD_defconfig 
b/configs/P2020RDB-PC_SDCARD_defconfig
index 595aa70f73f4..aeaa538700dd 100644
--- a/configs/P2020RDB-PC_SDCARD_defconfig
+++ b/configs/P2020RDB-PC_SDCARD_defconfig
@@ -103,6 +103,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P2020RDB-PC_SPIFLASH_defconfig 
b/configs/P2020RDB-PC_SPIFLASH_defconfig
index d6967754b17b..4a3ad3179e04 100644
--- a/configs/P2020RDB-PC_SPIFLASH_defconfig
+++ b/configs/P2020RDB-PC_SPIFLASH_defconfig
@@ -105,6 +105,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P2020RDB-PC_defconfig b/configs/P2020RDB-PC_defconfig
index c9f43191516e..101377b565b5 100644
--- a/configs/P2020RDB-PC_defconfig
+++ b/configs/P2020RDB-PC_defconfig
@@ -83,6 +83,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P2041RDB_NAND_defconfig b/configs/P2041RDB_NAND_defconfig
index fc4eab55b175..10f4d712d4bb 100644
--- a/configs/P2041RDB_NAND_defconfig
+++ b/configs/P2041RDB_NAND_defconfig
@@ -76,6 +76,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_ELBC=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/configs/P2041RDB_SDCARD_defconfig 
b/configs/P2041RDB_SDCARD_defconfig
index cdb44a0c05b9..a130983a2681 100644
--- a/configs/P2041RDB_SDCARD_defconfig
+++ b/configs/P2041RDB_SDCARD_defconfig
@@ -73,6 +73,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P2041RDB_SPIFLASH_defconfig 
b/configs/P2041RDB_SPIFLASH_defconfig
index eedaf8a748e0..5c2a0c1a1ef0 100644
--- a/configs/P2041RDB_SPIFLASH_defconfig
+++ b/configs/P2041RDB_SPIFLASH_defconfig
@@ -75,6 +75,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P2041RDB_defconfig b/configs/P2041RDB_defconfig
index 9379de07c193..e1cf145a64ad 100644
--- a/configs/P2041RDB_defconfig
+++ b/configs/P2041RDB_defconfig
@@ -70,6 +70,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/P3041DS_NAND_defconfig b/configs/P3041DS_NAND_defconfig
index 92ba8bf63e2f..61b9c016976d 100644
--- a/configs/P3041DS_NAND_defconfig
+++ b/configs/P3041DS_NAND_defconfig
@@ -81,6 +81,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_ELBC=y
diff --git a/configs/P3041DS_SDCARD_defconfig b/configs/P3041DS_SDCARD_defconfig
index 201991885732..410a98bbfcb6 100644
--- a/configs/P3041DS_SDCARD_defconfig
+++ b/configs/P3041DS_SDCARD_defconfig
@@ -78,6 +78,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/P3041DS_SPIFLASH_defconfig 
b/configs/P3041DS_SPIFLASH_defconfig
index 41afa473dcd2..700eab5e3078 100644
--- a/configs/P3041DS_SPIFLASH_defconfig
+++ b/configs/P3041DS_SPIFLASH_defconfig
@@ -80,6 +80,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/P3041DS_defconfig b/configs/P3041DS_defconfig
index 881c8f748101..ef402f0ddb10 100644
--- a/configs/P3041DS_defconfig
+++ b/configs/P3041DS_defconfig
@@ -75,6 +75,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/P4080DS_SDCARD_defconfig b/configs/P4080DS_SDCARD_defconfig
index 27f75844bb5d..f77ea226ea60 100644
--- a/configs/P4080DS_SDCARD_defconfig
+++ b/configs/P4080DS_SDCARD_defconfig
@@ -75,6 +75,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/P4080DS_SPIFLASH_defconfig 
b/configs/P4080DS_SPIFLASH_defconfig
index e3bb46a14342..b94a2be38209 100644
--- a/configs/P4080DS_SPIFLASH_defconfig
+++ b/configs/P4080DS_SPIFLASH_defconfig
@@ -77,6 +77,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/P4080DS_defconfig b/configs/P4080DS_defconfig
index 727c9b5fb71d..f0d67766126c 100644
--- a/configs/P4080DS_defconfig
+++ b/configs/P4080DS_defconfig
@@ -72,6 +72,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/P5040DS_NAND_defconfig b/configs/P5040DS_NAND_defconfig
index dbb760eb9ac2..48b868a548d9 100644
--- a/configs/P5040DS_NAND_defconfig
+++ b/configs/P5040DS_NAND_defconfig
@@ -81,6 +81,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_ELBC=y
diff --git a/configs/P5040DS_SDCARD_defconfig b/configs/P5040DS_SDCARD_defconfig
index 48e3ffa4eb3d..2eecbd98ee21 100644
--- a/configs/P5040DS_SDCARD_defconfig
+++ b/configs/P5040DS_SDCARD_defconfig
@@ -77,6 +77,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/P5040DS_SPIFLASH_defconfig 
b/configs/P5040DS_SPIFLASH_defconfig
index 2f3801d2a257..759bcf56ed86 100644
--- a/configs/P5040DS_SPIFLASH_defconfig
+++ b/configs/P5040DS_SPIFLASH_defconfig
@@ -79,6 +79,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/P5040DS_defconfig b/configs/P5040DS_defconfig
index 9685180545ec..d839a265e5d0 100644
--- a/configs/P5040DS_defconfig
+++ b/configs/P5040DS_defconfig
@@ -74,6 +74,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/T1024RDB_NAND_defconfig b/configs/T1024RDB_NAND_defconfig
index 577ea9300f30..ddfb9c08e3e9 100644
--- a/configs/T1024RDB_NAND_defconfig
+++ b/configs/T1024RDB_NAND_defconfig
@@ -105,6 +105,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/T1024RDB_SDCARD_defconfig 
b/configs/T1024RDB_SDCARD_defconfig
index 75225ba20dbf..8efd45f9220e 100644
--- a/configs/T1024RDB_SDCARD_defconfig
+++ b/configs/T1024RDB_SDCARD_defconfig
@@ -104,6 +104,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/T1024RDB_SPIFLASH_defconfig 
b/configs/T1024RDB_SPIFLASH_defconfig
index 8c6617aa02d3..ccb3fa416bda 100644
--- a/configs/T1024RDB_SPIFLASH_defconfig
+++ b/configs/T1024RDB_SPIFLASH_defconfig
@@ -107,6 +107,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/T1024RDB_defconfig b/configs/T1024RDB_defconfig
index 92d8365addd4..ab6486bd21c7 100644
--- a/configs/T1024RDB_defconfig
+++ b/configs/T1024RDB_defconfig
@@ -79,6 +79,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/T1042D4RDB_NAND_defconfig 
b/configs/T1042D4RDB_NAND_defconfig
index fb4923d94344..8e4dc127f730 100644
--- a/configs/T1042D4RDB_NAND_defconfig
+++ b/configs/T1042D4RDB_NAND_defconfig
@@ -101,6 +101,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/T1042D4RDB_SDCARD_defconfig 
b/configs/T1042D4RDB_SDCARD_defconfig
index ab5cf3fa4f4c..9b7ae6207578 100644
--- a/configs/T1042D4RDB_SDCARD_defconfig
+++ b/configs/T1042D4RDB_SDCARD_defconfig
@@ -100,6 +100,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/T1042D4RDB_SPIFLASH_defconfig 
b/configs/T1042D4RDB_SPIFLASH_defconfig
index aeb371d806ce..2995350135f1 100644
--- a/configs/T1042D4RDB_SPIFLASH_defconfig
+++ b/configs/T1042D4RDB_SPIFLASH_defconfig
@@ -103,6 +103,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/T1042D4RDB_defconfig b/configs/T1042D4RDB_defconfig
index 0a1331fef150..105b4c75a349 100644
--- a/configs/T1042D4RDB_defconfig
+++ b/configs/T1042D4RDB_defconfig
@@ -75,6 +75,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/T2080QDS_NAND_defconfig b/configs/T2080QDS_NAND_defconfig
index 54f5896c63d7..280354b4ff5e 100644
--- a/configs/T2080QDS_NAND_defconfig
+++ b/configs/T2080QDS_NAND_defconfig
@@ -108,6 +108,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/T2080QDS_SDCARD_defconfig 
b/configs/T2080QDS_SDCARD_defconfig
index 54cae76d9b5a..6cb8882bd276 100644
--- a/configs/T2080QDS_SDCARD_defconfig
+++ b/configs/T2080QDS_SDCARD_defconfig
@@ -107,6 +107,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/T2080QDS_SECURE_BOOT_defconfig 
b/configs/T2080QDS_SECURE_BOOT_defconfig
index 3b36349a7f71..ee45ea34b2ac 100644
--- a/configs/T2080QDS_SECURE_BOOT_defconfig
+++ b/configs/T2080QDS_SECURE_BOOT_defconfig
@@ -81,6 +81,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/T2080QDS_SPIFLASH_defconfig 
b/configs/T2080QDS_SPIFLASH_defconfig
index fc447ab4ebbb..277761308d71 100644
--- a/configs/T2080QDS_SPIFLASH_defconfig
+++ b/configs/T2080QDS_SPIFLASH_defconfig
@@ -110,6 +110,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/T2080QDS_defconfig b/configs/T2080QDS_defconfig
index 3f15ffc2d6b8..b576840ea376 100644
--- a/configs/T2080QDS_defconfig
+++ b/configs/T2080QDS_defconfig
@@ -82,6 +82,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/T2080RDB_NAND_defconfig b/configs/T2080RDB_NAND_defconfig
index 82d6ded46ce0..344ca5755e4f 100644
--- a/configs/T2080RDB_NAND_defconfig
+++ b/configs/T2080RDB_NAND_defconfig
@@ -110,6 +110,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/T2080RDB_SDCARD_defconfig 
b/configs/T2080RDB_SDCARD_defconfig
index 8c640c5c5d0b..a3d44ab6e665 100644
--- a/configs/T2080RDB_SDCARD_defconfig
+++ b/configs/T2080RDB_SDCARD_defconfig
@@ -109,6 +109,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/T2080RDB_SPIFLASH_defconfig 
b/configs/T2080RDB_SPIFLASH_defconfig
index 9a7c395fab21..94be0a010b7d 100644
--- a/configs/T2080RDB_SPIFLASH_defconfig
+++ b/configs/T2080RDB_SPIFLASH_defconfig
@@ -112,6 +112,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/T2080RDB_defconfig b/configs/T2080RDB_defconfig
index d140c26cd383..c875d22617a2 100644
--- a/configs/T2080RDB_defconfig
+++ b/configs/T2080RDB_defconfig
@@ -84,6 +84,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/T2080RDB_revD_NAND_defconfig 
b/configs/T2080RDB_revD_NAND_defconfig
index 43e595d33aae..02ce36e02244 100644
--- a/configs/T2080RDB_revD_NAND_defconfig
+++ b/configs/T2080RDB_revD_NAND_defconfig
@@ -111,6 +111,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/T2080RDB_revD_SDCARD_defconfig 
b/configs/T2080RDB_revD_SDCARD_defconfig
index ea0f40f66703..b99acbd94d96 100644
--- a/configs/T2080RDB_revD_SDCARD_defconfig
+++ b/configs/T2080RDB_revD_SDCARD_defconfig
@@ -110,6 +110,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/T2080RDB_revD_SPIFLASH_defconfig 
b/configs/T2080RDB_revD_SPIFLASH_defconfig
index af65e4378970..109511432f43 100644
--- a/configs/T2080RDB_revD_SPIFLASH_defconfig
+++ b/configs/T2080RDB_revD_SPIFLASH_defconfig
@@ -113,6 +113,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/T2080RDB_revD_defconfig b/configs/T2080RDB_revD_defconfig
index b6ca9f1ec1f8..8a6bc95c27d0 100644
--- a/configs/T2080RDB_revD_defconfig
+++ b/configs/T2080RDB_revD_defconfig
@@ -85,6 +85,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/T4240RDB_SDCARD_defconfig 
b/configs/T4240RDB_SDCARD_defconfig
index 739978463d78..1e10166f1d3a 100644
--- a/configs/T4240RDB_SDCARD_defconfig
+++ b/configs/T4240RDB_SDCARD_defconfig
@@ -95,6 +95,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/T4240RDB_defconfig b/configs/T4240RDB_defconfig
index 7956ba11cc32..e47521a4b1d6 100644
--- a/configs/T4240RDB_defconfig
+++ b/configs/T4240RDB_defconfig
@@ -70,6 +70,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=10000000
diff --git a/configs/amcore_defconfig b/configs/amcore_defconfig
index ad549c02c152..71ee97969d99 100644
--- a/configs/amcore_defconfig
+++ b/configs/amcore_defconfig
@@ -35,4 +35,5 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MCFUART=y
diff --git a/configs/astro_mcf5373l_defconfig b/configs/astro_mcf5373l_defconfig
index 3a44c7e8ec9d..db99c975ee91 100644
--- a/configs/astro_mcf5373l_defconfig
+++ b/configs/astro_mcf5373l_defconfig
@@ -43,6 +43,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=259
 CONFIG_MCFRTC=y
 CONFIG_SYS_MCFRTC_BASE=0xFC0A8000
 CONFIG_MCFUART=y
diff --git a/configs/at91sam9263ek_norflash_boot_defconfig 
b/configs/at91sam9263ek_norflash_boot_defconfig
index 7b975813928c..bd74eeae74ab 100644
--- a/configs/at91sam9263ek_norflash_boot_defconfig
+++ b/configs/at91sam9263ek_norflash_boot_defconfig
@@ -51,6 +51,7 @@ CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_ATMEL=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/configs/at91sam9263ek_norflash_defconfig 
b/configs/at91sam9263ek_norflash_defconfig
index 2c354f3b5b51..c33fedb54972 100644
--- a/configs/at91sam9263ek_norflash_defconfig
+++ b/configs/at91sam9263ek_norflash_defconfig
@@ -52,6 +52,7 @@ CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_ATMEL=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/configs/blanche_defconfig b/configs/blanche_defconfig
index 42f3dc4b6f47..8167dd17aad1 100644
--- a/configs/blanche_defconfig
+++ b/configs/blanche_defconfig
@@ -60,6 +60,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SMC911X=y
diff --git a/configs/boston32r2_defconfig b/configs/boston32r2_defconfig
index 2be57d2d1ed9..16c7a401dbc1 100644
--- a/configs/boston32r2_defconfig
+++ b/configs/boston32r2_defconfig
@@ -45,6 +45,7 @@ CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
 CONFIG_PCH_GBE=y
diff --git a/configs/boston32r2el_defconfig b/configs/boston32r2el_defconfig
index 524564355f44..cc73d3b156fe 100644
--- a/configs/boston32r2el_defconfig
+++ b/configs/boston32r2el_defconfig
@@ -46,6 +46,7 @@ CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
 CONFIG_PCH_GBE=y
diff --git a/configs/boston32r6_defconfig b/configs/boston32r6_defconfig
index 7bb4e692d6b7..dab4a9f3af59 100644
--- a/configs/boston32r6_defconfig
+++ b/configs/boston32r6_defconfig
@@ -46,6 +46,7 @@ CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
 CONFIG_PCH_GBE=y
diff --git a/configs/boston32r6el_defconfig b/configs/boston32r6el_defconfig
index 8ae2f235b1a7..0ded7cfcdf9a 100644
--- a/configs/boston32r6el_defconfig
+++ b/configs/boston32r6el_defconfig
@@ -47,6 +47,7 @@ CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
 CONFIG_PCH_GBE=y
diff --git a/configs/boston64r2_defconfig b/configs/boston64r2_defconfig
index 4a41e6b5cc64..e5c370699dbc 100644
--- a/configs/boston64r2_defconfig
+++ b/configs/boston64r2_defconfig
@@ -46,6 +46,7 @@ CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
 CONFIG_PCH_GBE=y
diff --git a/configs/boston64r2el_defconfig b/configs/boston64r2el_defconfig
index 0670ffabbbb2..4c141f45fb58 100644
--- a/configs/boston64r2el_defconfig
+++ b/configs/boston64r2el_defconfig
@@ -47,6 +47,7 @@ CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
 CONFIG_PCH_GBE=y
diff --git a/configs/boston64r6_defconfig b/configs/boston64r6_defconfig
index bf7f709524b9..7b8b9b82df3b 100644
--- a/configs/boston64r6_defconfig
+++ b/configs/boston64r6_defconfig
@@ -46,6 +46,7 @@ CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
 CONFIG_PCH_GBE=y
diff --git a/configs/boston64r6el_defconfig b/configs/boston64r6el_defconfig
index e1d46d30606a..f657cb872b39 100644
--- a/configs/boston64r6el_defconfig
+++ b/configs/boston64r6el_defconfig
@@ -47,6 +47,7 @@ CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
 CONFIG_PCH_GBE=y
diff --git a/configs/cobra5272_defconfig b/configs/cobra5272_defconfig
index 42f6087d83c9..e8301c6301a5 100644
--- a/configs/cobra5272_defconfig
+++ b/configs/cobra5272_defconfig
@@ -50,6 +50,7 @@ CONFIG_SYS_BR7_PRELIM_BOOL=y
 CONFIG_SYS_BR7_PRELIM=0x701
 CONFIG_SYS_OR7_PRELIM=0xFF00007C
 CONFIG_MTD_NOR_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=11
 CONFIG_USE_SYS_MAX_FLASH_BANKS=y
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
diff --git a/configs/da850evm_direct_nor_defconfig 
b/configs/da850evm_direct_nor_defconfig
index 8f6b8b9702f4..00ba7d7687ac 100644
--- a/configs/da850evm_direct_nor_defconfig
+++ b/configs/da850evm_direct_nor_defconfig
@@ -69,6 +69,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=67
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
diff --git a/configs/devkit3250_defconfig b/configs/devkit3250_defconfig
index eae073d76ea6..744ffbd94333 100644
--- a/configs/devkit3250_defconfig
+++ b/configs/devkit3250_defconfig
@@ -66,6 +66,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=71
 CONFIG_MTD_RAW_NAND=y
 CONFIG_SYS_NAND_USE_FLASH_BBT=y
 CONFIG_NAND_LPC32XX_SLC=y
diff --git a/configs/eb_cpu5282_defconfig b/configs/eb_cpu5282_defconfig
index 4cf03abc61e4..378de4bd8c29 100644
--- a/configs/eb_cpu5282_defconfig
+++ b/configs/eb_cpu5282_defconfig
@@ -48,6 +48,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
 CONFIG_MII=y
diff --git a/configs/eb_cpu5282_internal_defconfig 
b/configs/eb_cpu5282_internal_defconfig
index 117851584693..ef0512c8f708 100644
--- a/configs/eb_cpu5282_internal_defconfig
+++ b/configs/eb_cpu5282_internal_defconfig
@@ -46,6 +46,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_DM_ETH=y
 CONFIG_MCFFEC=y
 CONFIG_MII=y
diff --git a/configs/edminiv2_defconfig b/configs/edminiv2_defconfig
index 6b7cdbe4b119..1cd0ac020b2a 100644
--- a/configs/edminiv2_defconfig
+++ b/configs/edminiv2_defconfig
@@ -65,6 +65,7 @@ CONFIG_SYS_I2C_SLAVE=0x0
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=11
 CONFIG_MVGBE=y
 CONFIG_MII=y
 CONFIG_SYS_NS16550=y
diff --git a/configs/ethernut5_defconfig b/configs/ethernut5_defconfig
index 796b71793a7f..6725e3aa6813 100644
--- a/configs/ethernut5_defconfig
+++ b/configs/ethernut5_defconfig
@@ -71,6 +71,7 @@ CONFIG_SYS_I2C_SOFT_SLAVE=0
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=32
 CONFIG_MTD_RAW_NAND=y
 # CONFIG_SYS_NAND_USE_FLASH_BBT is not set
 CONFIG_NAND_ATMEL=y
diff --git a/configs/gazerbeam_defconfig b/configs/gazerbeam_defconfig
index a81aa00f2dba..cabe2897707a 100644
--- a/configs/gazerbeam_defconfig
+++ b/configs/gazerbeam_defconfig
@@ -191,6 +191,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=135
 CONFIG_PHYLIB_10G=y
 CONFIG_PHY_ATHEROS=y
 CONFIG_PHY_BROADCOM=y
diff --git a/configs/ids8313_defconfig b/configs/ids8313_defconfig
index 74dfc6680420..1f0a86469702 100644
--- a/configs/ids8313_defconfig
+++ b/configs/ids8313_defconfig
@@ -194,6 +194,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_ELBC=y
 CONFIG_PHY_ATHEROS=y
diff --git a/configs/integratorap_cm720t_defconfig 
b/configs/integratorap_cm720t_defconfig
index 71f645009792..644876e0b244 100644
--- a/configs/integratorap_cm720t_defconfig
+++ b/configs/integratorap_cm720t_defconfig
@@ -33,5 +33,6 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
diff --git a/configs/integratorap_cm920t_defconfig 
b/configs/integratorap_cm920t_defconfig
index 1c3b8a024e96..9cc8070faaa8 100644
--- a/configs/integratorap_cm920t_defconfig
+++ b/configs/integratorap_cm920t_defconfig
@@ -33,5 +33,6 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
diff --git a/configs/integratorap_cm926ejs_defconfig 
b/configs/integratorap_cm926ejs_defconfig
index 8dc7b0c06372..9f7371f17e6d 100644
--- a/configs/integratorap_cm926ejs_defconfig
+++ b/configs/integratorap_cm926ejs_defconfig
@@ -33,5 +33,6 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
diff --git a/configs/integratorap_cm946es_defconfig 
b/configs/integratorap_cm946es_defconfig
index c80a2b6a3a34..3f7f3e49882f 100644
--- a/configs/integratorap_cm946es_defconfig
+++ b/configs/integratorap_cm946es_defconfig
@@ -33,5 +33,6 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
diff --git a/configs/integratorcp_cm1136_defconfig 
b/configs/integratorcp_cm1136_defconfig
index 05d5bf015307..95d82b578dba 100644
--- a/configs/integratorcp_cm1136_defconfig
+++ b/configs/integratorcp_cm1136_defconfig
@@ -36,5 +36,6 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=64
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
diff --git a/configs/integratorcp_cm920t_defconfig 
b/configs/integratorcp_cm920t_defconfig
index eb9d1b765903..61191e2b53be 100644
--- a/configs/integratorcp_cm920t_defconfig
+++ b/configs/integratorcp_cm920t_defconfig
@@ -36,5 +36,6 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=64
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
diff --git a/configs/integratorcp_cm926ejs_defconfig 
b/configs/integratorcp_cm926ejs_defconfig
index 501c19c19277..b8b27da23b8a 100644
--- a/configs/integratorcp_cm926ejs_defconfig
+++ b/configs/integratorcp_cm926ejs_defconfig
@@ -36,5 +36,6 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=64
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
diff --git a/configs/integratorcp_cm946es_defconfig 
b/configs/integratorcp_cm946es_defconfig
index 3264475fb438..60e0979ee42a 100644
--- a/configs/integratorcp_cm946es_defconfig
+++ b/configs/integratorcp_cm946es_defconfig
@@ -36,5 +36,6 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=64
 CONFIG_BAUDRATE=38400
 CONFIG_OF_LIBFDT=y
diff --git a/configs/ls1021aqds_ddr4_nor_defconfig 
b/configs/ls1021aqds_ddr4_nor_defconfig
index 81459aa39fa8..7a540e7c5539 100644
--- a/configs/ls1021aqds_ddr4_nor_defconfig
+++ b/configs/ls1021aqds_ddr4_nor_defconfig
@@ -81,6 +81,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig 
b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
index 760f528f3c3f..bd22e6721b49 100644
--- a/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
+++ b/configs/ls1021aqds_ddr4_nor_lpuart_defconfig
@@ -81,6 +81,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1021aqds_nand_defconfig 
b/configs/ls1021aqds_nand_defconfig
index d1264fd318ae..bdef2ac84739 100644
--- a/configs/ls1021aqds_nand_defconfig
+++ b/configs/ls1021aqds_nand_defconfig
@@ -113,6 +113,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1021aqds_nor_SECURE_BOOT_defconfig 
b/configs/ls1021aqds_nor_SECURE_BOOT_defconfig
index b6d20424d9ce..681cb68c863b 100644
--- a/configs/ls1021aqds_nor_SECURE_BOOT_defconfig
+++ b/configs/ls1021aqds_nor_SECURE_BOOT_defconfig
@@ -80,6 +80,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1021aqds_nor_defconfig b/configs/ls1021aqds_nor_defconfig
index 96b668718150..e9fda69663fc 100644
--- a/configs/ls1021aqds_nor_defconfig
+++ b/configs/ls1021aqds_nor_defconfig
@@ -83,6 +83,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1021aqds_nor_lpuart_defconfig 
b/configs/ls1021aqds_nor_lpuart_defconfig
index 1b7aae5e898e..06f51d5ab88a 100644
--- a/configs/ls1021aqds_nor_lpuart_defconfig
+++ b/configs/ls1021aqds_nor_lpuart_defconfig
@@ -83,6 +83,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1021aqds_sdcard_ifc_defconfig 
b/configs/ls1021aqds_sdcard_ifc_defconfig
index 2964bb7465a4..13237c65a048 100644
--- a/configs/ls1021aqds_sdcard_ifc_defconfig
+++ b/configs/ls1021aqds_sdcard_ifc_defconfig
@@ -111,6 +111,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1021atwr_nor_SECURE_BOOT_defconfig 
b/configs/ls1021atwr_nor_SECURE_BOOT_defconfig
index ad815b6832f7..fe047007bc0a 100644
--- a/configs/ls1021atwr_nor_SECURE_BOOT_defconfig
+++ b/configs/ls1021atwr_nor_SECURE_BOOT_defconfig
@@ -67,6 +67,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_PHY_ATHEROS=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/ls1021atwr_nor_defconfig b/configs/ls1021atwr_nor_defconfig
index 4ee9fe1b40c2..7571d7c8b5e2 100644
--- a/configs/ls1021atwr_nor_defconfig
+++ b/configs/ls1021atwr_nor_defconfig
@@ -70,6 +70,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_PHY_ATHEROS=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/ls1021atwr_nor_lpuart_defconfig 
b/configs/ls1021atwr_nor_lpuart_defconfig
index 99271e79820e..96284e316c78 100644
--- a/configs/ls1021atwr_nor_lpuart_defconfig
+++ b/configs/ls1021atwr_nor_lpuart_defconfig
@@ -70,6 +70,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_PHY_ATHEROS=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig 
b/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig
index 11e1c8451cc4..01863abb9aaf 100644
--- a/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig
+++ b/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig
@@ -98,6 +98,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_PHY_ATHEROS=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/ls1021atwr_sdcard_ifc_defconfig 
b/configs/ls1021atwr_sdcard_ifc_defconfig
index cdd7f8e38d15..a981def7504d 100644
--- a/configs/ls1021atwr_sdcard_ifc_defconfig
+++ b/configs/ls1021atwr_sdcard_ifc_defconfig
@@ -98,6 +98,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_PHY_ATHEROS=y
 CONFIG_DM_ETH=y
 CONFIG_DM_MDIO=y
diff --git a/configs/ls1043aqds_defconfig b/configs/ls1043aqds_defconfig
index 6f767f749fd5..e0642c77a945 100644
--- a/configs/ls1043aqds_defconfig
+++ b/configs/ls1043aqds_defconfig
@@ -81,6 +81,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043aqds_lpuart_defconfig 
b/configs/ls1043aqds_lpuart_defconfig
index 6d4b5912bce9..b50b278748ec 100644
--- a/configs/ls1043aqds_lpuart_defconfig
+++ b/configs/ls1043aqds_lpuart_defconfig
@@ -81,6 +81,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043aqds_nand_defconfig 
b/configs/ls1043aqds_nand_defconfig
index 7311b1c558d8..5afeea763b7d 100644
--- a/configs/ls1043aqds_nand_defconfig
+++ b/configs/ls1043aqds_nand_defconfig
@@ -110,6 +110,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/configs/ls1043aqds_nor_ddr3_defconfig 
b/configs/ls1043aqds_nor_ddr3_defconfig
index 78e39c46dc68..373923b4d999 100644
--- a/configs/ls1043aqds_nor_ddr3_defconfig
+++ b/configs/ls1043aqds_nor_ddr3_defconfig
@@ -82,6 +82,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043aqds_sdcard_ifc_defconfig 
b/configs/ls1043aqds_sdcard_ifc_defconfig
index b8e4a7bc6ef3..607df6dd9d85 100644
--- a/configs/ls1043aqds_sdcard_ifc_defconfig
+++ b/configs/ls1043aqds_sdcard_ifc_defconfig
@@ -108,6 +108,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
index c4946f94e9f1..6e5f8fb9c673 100644
--- a/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1043aqds_tfa_SECURE_BOOT_defconfig
@@ -78,6 +78,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043aqds_tfa_defconfig b/configs/ls1043aqds_tfa_defconfig
index 31d6173fdb5e..c47eb92b25ca 100644
--- a/configs/ls1043aqds_tfa_defconfig
+++ b/configs/ls1043aqds_tfa_defconfig
@@ -87,6 +87,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043ardb_SECURE_BOOT_defconfig 
b/configs/ls1043ardb_SECURE_BOOT_defconfig
index 8105fc1030b0..48b96e18d87c 100644
--- a/configs/ls1043ardb_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_SECURE_BOOT_defconfig
@@ -64,6 +64,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043ardb_defconfig b/configs/ls1043ardb_defconfig
index 4b33e56be504..555b4173b060 100644
--- a/configs/ls1043ardb_defconfig
+++ b/configs/ls1043ardb_defconfig
@@ -67,6 +67,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043ardb_nand_SECURE_BOOT_defconfig 
b/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
index f30a7055d981..eea1aea18dee 100644
--- a/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_nand_SECURE_BOOT_defconfig
@@ -87,6 +87,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/configs/ls1043ardb_nand_defconfig 
b/configs/ls1043ardb_nand_defconfig
index 41a3eb7f4ca9..d0e5c37357f6 100644
--- a/configs/ls1043ardb_nand_defconfig
+++ b/configs/ls1043ardb_nand_defconfig
@@ -94,6 +94,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig 
b/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig
index 8df1a4910b39..4f125358c0fc 100644
--- a/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_sdcard_SECURE_BOOT_defconfig
@@ -88,6 +88,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043ardb_sdcard_defconfig 
b/configs/ls1043ardb_sdcard_defconfig
index ae04bd4be08f..6cfbc5960d10 100644
--- a/configs/ls1043ardb_sdcard_defconfig
+++ b/configs/ls1043ardb_sdcard_defconfig
@@ -92,6 +92,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig 
b/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig
index 990254b57494..da31529064a8 100644
--- a/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1043ardb_tfa_SECURE_BOOT_defconfig
@@ -63,6 +63,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1043ardb_tfa_defconfig b/configs/ls1043ardb_tfa_defconfig
index d9b51553ac23..76a2b2608e45 100644
--- a/configs/ls1043ardb_tfa_defconfig
+++ b/configs/ls1043ardb_tfa_defconfig
@@ -69,6 +69,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1046aqds_SECURE_BOOT_defconfig 
b/configs/ls1046aqds_SECURE_BOOT_defconfig
index fd996cd0ac52..10f808cefa86 100644
--- a/configs/ls1046aqds_SECURE_BOOT_defconfig
+++ b/configs/ls1046aqds_SECURE_BOOT_defconfig
@@ -78,6 +78,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1046aqds_defconfig b/configs/ls1046aqds_defconfig
index 5bdfe7e42587..28fd339803d1 100644
--- a/configs/ls1046aqds_defconfig
+++ b/configs/ls1046aqds_defconfig
@@ -81,6 +81,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1046aqds_lpuart_defconfig 
b/configs/ls1046aqds_lpuart_defconfig
index 3c0b3563b731..7cbc58458925 100644
--- a/configs/ls1046aqds_lpuart_defconfig
+++ b/configs/ls1046aqds_lpuart_defconfig
@@ -81,6 +81,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1046aqds_nand_defconfig 
b/configs/ls1046aqds_nand_defconfig
index 91a0ae4d7ee7..084d26462aaa 100644
--- a/configs/ls1046aqds_nand_defconfig
+++ b/configs/ls1046aqds_nand_defconfig
@@ -108,6 +108,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls1046aqds_sdcard_ifc_defconfig 
b/configs/ls1046aqds_sdcard_ifc_defconfig
index 6e70fe553491..1db39e64c604 100644
--- a/configs/ls1046aqds_sdcard_ifc_defconfig
+++ b/configs/ls1046aqds_sdcard_ifc_defconfig
@@ -109,6 +109,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
index 0fc632d0cbaa..5047baec8a48 100644
--- a/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1046aqds_tfa_SECURE_BOOT_defconfig
@@ -78,6 +78,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1046aqds_tfa_defconfig b/configs/ls1046aqds_tfa_defconfig
index a8a2b8e5374e..7ebb5def6455 100644
--- a/configs/ls1046aqds_tfa_defconfig
+++ b/configs/ls1046aqds_tfa_defconfig
@@ -87,6 +87,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1088aqds_defconfig b/configs/ls1088aqds_defconfig
index 2db19f1cc758..63ea991b6ce3 100644
--- a/configs/ls1088aqds_defconfig
+++ b/configs/ls1088aqds_defconfig
@@ -77,6 +77,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1088aqds_sdcard_ifc_defconfig 
b/configs/ls1088aqds_sdcard_ifc_defconfig
index 99051b378178..bc626e3f772d 100644
--- a/configs/ls1088aqds_sdcard_ifc_defconfig
+++ b/configs/ls1088aqds_sdcard_ifc_defconfig
@@ -97,6 +97,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls1088aqds_tfa_defconfig b/configs/ls1088aqds_tfa_defconfig
index 8965617becec..0da726c32aeb 100644
--- a/configs/ls1088aqds_tfa_defconfig
+++ b/configs/ls1088aqds_tfa_defconfig
@@ -85,6 +85,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls2080aqds_SECURE_BOOT_defconfig 
b/configs/ls2080aqds_SECURE_BOOT_defconfig
index f02e9aba3f77..b00b3fc3b1c3 100644
--- a/configs/ls2080aqds_SECURE_BOOT_defconfig
+++ b/configs/ls2080aqds_SECURE_BOOT_defconfig
@@ -66,6 +66,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls2080aqds_defconfig b/configs/ls2080aqds_defconfig
index 49f3fd5dc1ea..8002570d4a29 100644
--- a/configs/ls2080aqds_defconfig
+++ b/configs/ls2080aqds_defconfig
@@ -69,6 +69,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls2080ardb_SECURE_BOOT_defconfig 
b/configs/ls2080ardb_SECURE_BOOT_defconfig
index 55b93ca2f165..f27df9df7e9a 100644
--- a/configs/ls2080ardb_SECURE_BOOT_defconfig
+++ b/configs/ls2080ardb_SECURE_BOOT_defconfig
@@ -69,6 +69,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls2080ardb_defconfig b/configs/ls2080ardb_defconfig
index 973c657137d4..eec426e67671 100644
--- a/configs/ls2080ardb_defconfig
+++ b/configs/ls2080ardb_defconfig
@@ -72,6 +72,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls2080ardb_nand_defconfig 
b/configs/ls2080ardb_nand_defconfig
index f6a6a1150756..8ec4e6a7ff2d 100644
--- a/configs/ls2080ardb_nand_defconfig
+++ b/configs/ls2080ardb_nand_defconfig
@@ -92,6 +92,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
diff --git a/configs/ls2088aqds_tfa_defconfig b/configs/ls2088aqds_tfa_defconfig
index 63e54012b58e..4ad644d78c7d 100644
--- a/configs/ls2088aqds_tfa_defconfig
+++ b/configs/ls2088aqds_tfa_defconfig
@@ -80,6 +80,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
diff --git a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig 
b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
index 9aac8bfdcf54..5cd18a17e13a 100644
--- a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig
@@ -74,6 +74,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/ls2088ardb_tfa_defconfig b/configs/ls2088ardb_tfa_defconfig
index 754f8b0980c6..1611bb50f44b 100644
--- a/configs/ls2088ardb_tfa_defconfig
+++ b/configs/ls2088ardb_tfa_defconfig
@@ -81,6 +81,7 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1024
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_FSL_IFC=y
 CONFIG_SYS_NAND_ONFI_DETECTION=y
diff --git a/configs/malta64_defconfig b/configs/malta64_defconfig
index e55b4a491455..60a8815194bb 100644
--- a/configs/malta64_defconfig
+++ b/configs/malta64_defconfig
@@ -38,6 +38,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_PCNET=y
 CONFIG_PCI_GT64120=y
 CONFIG_PCI_MSC01=y
diff --git a/configs/malta64el_defconfig b/configs/malta64el_defconfig
index 6c6492d3febc..b4b0320fc0a0 100644
--- a/configs/malta64el_defconfig
+++ b/configs/malta64el_defconfig
@@ -40,6 +40,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_PCNET=y
 CONFIG_PCI_GT64120=y
 CONFIG_PCI_MSC01=y
diff --git a/configs/malta_defconfig b/configs/malta_defconfig
index 3aff68b0188f..ade98e623658 100644
--- a/configs/malta_defconfig
+++ b/configs/malta_defconfig
@@ -37,6 +37,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_PCNET=y
 CONFIG_PCI_GT64120=y
 CONFIG_PCI_MSC01=y
diff --git a/configs/maltael_defconfig b/configs/maltael_defconfig
index e268fb63743f..ef31afe86aa0 100644
--- a/configs/maltael_defconfig
+++ b/configs/maltael_defconfig
@@ -39,6 +39,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=128
 CONFIG_PCNET=y
 CONFIG_PCI_GT64120=y
 CONFIG_PCI_MSC01=y
diff --git a/configs/microblaze-generic_defconfig 
b/configs/microblaze-generic_defconfig
index a7892c6e33fd..192bf9873a48 100644
--- a/configs/microblaze-generic_defconfig
+++ b/configs/microblaze-generic_defconfig
@@ -70,6 +70,7 @@ CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=2048
 CONFIG_SPI_FLASH_ISSI=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/octeon_ebb7304_defconfig b/configs/octeon_ebb7304_defconfig
index 71df8cdabcb4..cf251abb9585 100644
--- a/configs/octeon_ebb7304_defconfig
+++ b/configs/octeon_ebb7304_defconfig
@@ -56,6 +56,7 @@ CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/omap35_logic_somlv_defconfig 
b/configs/omap35_logic_somlv_defconfig
index ab5dfad28fcc..6702df0b22d7 100644
--- a/configs/omap35_logic_somlv_defconfig
+++ b/configs/omap35_logic_somlv_defconfig
@@ -77,6 +77,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x20000
diff --git a/configs/omap3_logic_somlv_defconfig 
b/configs/omap3_logic_somlv_defconfig
index 8c5bc19f10bf..b161fe2369ec 100644
--- a/configs/omap3_logic_somlv_defconfig
+++ b/configs/omap3_logic_somlv_defconfig
@@ -78,6 +78,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW=y
 CONFIG_SYS_NAND_BLOCK_SIZE=0x20000
diff --git a/configs/pm9261_defconfig b/configs/pm9261_defconfig
index 6922380b0093..a5256b7a1811 100644
--- a/configs/pm9261_defconfig
+++ b/configs/pm9261_defconfig
@@ -48,6 +48,7 @@ CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_MTD_RAW_NAND=y
 # CONFIG_SYS_NAND_USE_FLASH_BBT is not set
 CONFIG_NAND_ATMEL=y
diff --git a/configs/pm9263_defconfig b/configs/pm9263_defconfig
index 2b4a844d804b..b7a8124e3055 100644
--- a/configs/pm9263_defconfig
+++ b/configs/pm9263_defconfig
@@ -52,6 +52,7 @@ CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_MTD_RAW_NAND=y
 # CONFIG_SYS_NAND_USE_FLASH_BBT is not set
 CONFIG_NAND_ATMEL=y
diff --git a/configs/qemu_arm64_defconfig b/configs/qemu_arm64_defconfig
index f7c93ba2af54..8d7bc19b7ae2 100644
--- a/configs/qemu_arm64_defconfig
+++ b/configs/qemu_arm64_defconfig
@@ -50,6 +50,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig
index 50945472315a..b2bc149e460c 100644
--- a/configs/qemu_arm_defconfig
+++ b/configs/qemu_arm_defconfig
@@ -52,6 +52,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_ETH=y
diff --git a/configs/r2dplus_defconfig b/configs/r2dplus_defconfig
index 2beda3a2fe0a..3af338c90bc3 100644
--- a/configs/r2dplus_defconfig
+++ b/configs/r2dplus_defconfig
@@ -45,6 +45,7 @@ CONFIG_CLK=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
 CONFIG_EEPRO100=y
diff --git a/configs/r8a77990_ebisu_defconfig b/configs/r8a77990_ebisu_defconfig
index e667d23d7eea..d13e3ea15bea 100644
--- a/configs/r8a77990_ebisu_defconfig
+++ b/configs/r8a77990_ebisu_defconfig
@@ -84,6 +84,7 @@ CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_RENESAS_RPC_HF=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/r8a77995_draak_defconfig b/configs/r8a77995_draak_defconfig
index afccf86461df..de25e525f921 100644
--- a/configs/r8a77995_draak_defconfig
+++ b/configs/r8a77995_draak_defconfig
@@ -77,6 +77,7 @@ CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_RENESAS_RPC_HF=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/rcar3_salvator-x_defconfig 
b/configs/rcar3_salvator-x_defconfig
index d423ad7b8261..bb2101ef688e 100644
--- a/configs/rcar3_salvator-x_defconfig
+++ b/configs/rcar3_salvator-x_defconfig
@@ -87,6 +87,7 @@ CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_RENESAS_RPC_HF=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/rcar3_ulcb_defconfig b/configs/rcar3_ulcb_defconfig
index 341abe4f6dda..8eb703a54329 100644
--- a/configs/rcar3_ulcb_defconfig
+++ b/configs/rcar3_ulcb_defconfig
@@ -86,6 +86,7 @@ CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_RENESAS_RPC_HF=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
diff --git a/configs/sama5d3xek_mmc_defconfig b/configs/sama5d3xek_mmc_defconfig
index 40a8c028c2dc..0f06d4309069 100644
--- a/configs/sama5d3xek_mmc_defconfig
+++ b/configs/sama5d3xek_mmc_defconfig
@@ -83,6 +83,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=131
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_ATMEL=y
 CONFIG_ATMEL_NAND_HW_PMECC=y
diff --git a/configs/sama5d3xek_nandflash_defconfig 
b/configs/sama5d3xek_nandflash_defconfig
index 772511543dbf..f29a1b7727d7 100644
--- a/configs/sama5d3xek_nandflash_defconfig
+++ b/configs/sama5d3xek_nandflash_defconfig
@@ -82,6 +82,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=131
 CONFIG_NAND_ATMEL=y
 CONFIG_PMECC_CAP=4
 CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER=y
diff --git a/configs/sama5d3xek_spiflash_defconfig 
b/configs/sama5d3xek_spiflash_defconfig
index 4e85807432e5..cfd6ae1b4c0b 100644
--- a/configs/sama5d3xek_spiflash_defconfig
+++ b/configs/sama5d3xek_spiflash_defconfig
@@ -84,6 +84,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=131
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_ATMEL=y
 CONFIG_ATMEL_NAND_HW_PMECC=y
diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig
index 60a38abc8e3a..75195b36addf 100644
--- a/configs/socrates_defconfig
+++ b/configs/socrates_defconfig
@@ -73,6 +73,7 @@ CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_MTD_RAW_NAND=y
 CONFIG_PHY_ATHEROS=y
diff --git a/configs/stm32746g-eval_defconfig b/configs/stm32746g-eval_defconfig
index 64610658c7bd..aa4e98acc584 100644
--- a/configs/stm32746g-eval_defconfig
+++ b/configs/stm32746g-eval_defconfig
@@ -42,6 +42,7 @@ CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_STM32_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=8
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/stm32746g-eval_spl_defconfig 
b/configs/stm32746g-eval_spl_defconfig
index 753a4b80cbbc..feba98516880 100644
--- a/configs/stm32746g-eval_spl_defconfig
+++ b/configs/stm32746g-eval_spl_defconfig
@@ -63,6 +63,7 @@ CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_STM32_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=8
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/stm32f429-discovery_defconfig 
b/configs/stm32f429-discovery_defconfig
index fde427ae692f..b347347e253c 100644
--- a/configs/stm32f429-discovery_defconfig
+++ b/configs/stm32f429-discovery_defconfig
@@ -32,4 +32,5 @@ CONFIG_ENV_IS_IN_FLASH=y
 # CONFIG_MMC is not set
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_STM32_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=12
 CONFIG_SYS_MAX_FLASH_BANKS=2
diff --git a/configs/stm32f429-evaluation_defconfig 
b/configs/stm32f429-evaluation_defconfig
index e2c41b0844e8..98c0507b535f 100644
--- a/configs/stm32f429-evaluation_defconfig
+++ b/configs/stm32f429-evaluation_defconfig
@@ -31,4 +31,5 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ARM_PL180_MMCI=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_STM32_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=12
 CONFIG_SYS_MAX_FLASH_BANKS=2
diff --git a/configs/stm32f469-discovery_defconfig 
b/configs/stm32f469-discovery_defconfig
index c7dbc69fa889..c27f760af4f5 100644
--- a/configs/stm32f469-discovery_defconfig
+++ b/configs/stm32f469-discovery_defconfig
@@ -33,6 +33,7 @@ CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_STM32_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=12
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/stm32f746-disco_defconfig 
b/configs/stm32f746-disco_defconfig
index e3f80ab8e206..61d6daa75762 100644
--- a/configs/stm32f746-disco_defconfig
+++ b/configs/stm32f746-disco_defconfig
@@ -42,6 +42,7 @@ CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_STM32_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=8
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/stm32f746-disco_spl_defconfig 
b/configs/stm32f746-disco_spl_defconfig
index 927d28dd9733..0368ece6390f 100644
--- a/configs/stm32f746-disco_spl_defconfig
+++ b/configs/stm32f746-disco_spl_defconfig
@@ -63,6 +63,7 @@ CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_STM32_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=8
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/stm32f769-disco_defconfig 
b/configs/stm32f769-disco_defconfig
index b7e9ee92a7e1..c177bd8c733f 100644
--- a/configs/stm32f769-disco_defconfig
+++ b/configs/stm32f769-disco_defconfig
@@ -41,6 +41,7 @@ CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_STM32_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=8
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/stm32f769-disco_spl_defconfig 
b/configs/stm32f769-disco_spl_defconfig
index bae28b4ec132..7515574dfbc1 100644
--- a/configs/stm32f769-disco_spl_defconfig
+++ b/configs/stm32f769-disco_spl_defconfig
@@ -62,6 +62,7 @@ CONFIG_MTD=y
 CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_STM32_FLASH=y
+CONFIG_SYS_MAX_FLASH_SECT=8
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/total_compute_defconfig b/configs/total_compute_defconfig
index 43db639c273c..ab13ac82ee77 100644
--- a/configs/total_compute_defconfig
+++ b/configs/total_compute_defconfig
@@ -56,5 +56,6 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_LIBAVB=y
 CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/vexpress_aemv8a_juno_defconfig 
b/configs/vexpress_aemv8a_juno_defconfig
index 977e3270453b..cf3ffc773182 100644
--- a/configs/vexpress_aemv8a_juno_defconfig
+++ b/configs/vexpress_aemv8a_juno_defconfig
@@ -33,6 +33,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=259
 CONFIG_DM_ETH=y
 CONFIG_PCI=y
 CONFIG_USB=y
diff --git a/configs/vexpress_aemv8a_semi_defconfig 
b/configs/vexpress_aemv8a_semi_defconfig
index 71b3caa9224f..39d96fe35990 100644
--- a/configs/vexpress_aemv8a_semi_defconfig
+++ b/configs/vexpress_aemv8a_semi_defconfig
@@ -30,4 +30,5 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=256
 CONFIG_VIRTIO_MMIO=y
diff --git a/configs/vexpress_ca9x4_defconfig b/configs/vexpress_ca9x4_defconfig
index fbb6448480f0..8817c4e46f59 100644
--- a/configs/vexpress_ca9x4_defconfig
+++ b/configs/vexpress_ca9x4_defconfig
@@ -48,6 +48,7 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=259
 CONFIG_SYS_MAX_FLASH_BANKS=2
 CONFIG_DM_ETH=y
 CONFIG_SMC911X=y
diff --git a/configs/xtfpga_defconfig b/configs/xtfpga_defconfig
index c3c634e263ce..966b0eb6538c 100644
--- a/configs/xtfpga_defconfig
+++ b/configs/xtfpga_defconfig
@@ -42,6 +42,7 @@ CONFIG_SYS_FLASH_CFI_WIDTH_16BIT=y
 CONFIG_SYS_FLASH_EMPTY_INFO=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_SYS_MAX_FLASH_SECT=1027
 CONFIG_PHYLIB=y
 CONFIG_DM_ETH=y
 CONFIG_ETHOC=y
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 431168d12ee5..828ec9758207 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -171,6 +171,11 @@ config STM32_FLASH
         This is the driver of embedded flash for some STMicroelectronics
         STM32 MCU.
 
+config SYS_MAX_FLASH_SECT
+       int "Maximumm number of sectors on a flash chip"
+       depends on MTD_NOR_FLASH || FLASH_CFI_DRIVER
+       default 512
+
 config SAMSUNG_ONENAND
        bool "Samsung OneNAND driver support"
 
diff --git a/include/configs/10m50_devboard.h b/include/configs/10m50_devboard.h
index 9b4f5fcf1b8e..35560ab68351 100644
--- a/include/configs/10m50_devboard.h
+++ b/include/configs/10m50_devboard.h
@@ -20,7 +20,6 @@
 /*
  * Flash
  */
-#define CONFIG_SYS_MAX_FLASH_SECT      1024
 
 /*
  * BOOTP options
diff --git a/include/configs/3c120_devboard.h b/include/configs/3c120_devboard.h
index 2d52dc6f6608..69fa1c1b7681 100644
--- a/include/configs/3c120_devboard.h
+++ b/include/configs/3c120_devboard.h
@@ -19,7 +19,6 @@
 /*
  * CFI Flash
  */
-#define CONFIG_SYS_MAX_FLASH_SECT      512
 
 /*
  * MEMORY ORGANIZATION
diff --git a/include/configs/M5208EVBE.h b/include/configs/M5208EVBE.h
index c773164c869b..6c6469b0d4b8 100644
--- a/include/configs/M5208EVBE.h
+++ b/include/configs/M5208EVBE.h
@@ -82,7 +82,6 @@
 /* FLASH organization */
 #ifdef CONFIG_SYS_FLASH_CFI
 #      define CONFIG_SYS_FLASH_SIZE            0x800000        /* Max size 
that the board might have */
-#      define CONFIG_SYS_MAX_FLASH_SECT        254     /* max number of 
sectors on one chip */
 #endif
 
 #define CONFIG_SYS_FLASH_BASE          CONFIG_SYS_CS0_BASE
diff --git a/include/configs/M5235EVB.h b/include/configs/M5235EVB.h
index 79448cf44048..54116413230b 100644
--- a/include/configs/M5235EVB.h
+++ b/include/configs/M5235EVB.h
@@ -90,7 +90,6 @@
  */
 #ifdef CONFIG_SYS_FLASH_CFI
 #      define CONFIG_SYS_FLASH_SIZE            0x800000        /* Max size 
that the board might have */
-#      define CONFIG_SYS_MAX_FLASH_SECT        137     /* max number of 
sectors on one chip */
 #endif
 
 #define CONFIG_SYS_FLASH_BASE          (CONFIG_SYS_CS0_BASE)
diff --git a/include/configs/M5249EVB.h b/include/configs/M5249EVB.h
index 39bffc29ff22..42c62b4d684a 100644
--- a/include/configs/M5249EVB.h
+++ b/include/configs/M5249EVB.h
@@ -77,7 +77,6 @@
 #ifdef CONFIG_SYS_FLASH_CFI
 
 #      define CONFIG_SYS_FLASH_SIZE            0x1000000       /* Max size 
that the board might have */
-#      define CONFIG_SYS_MAX_FLASH_SECT        137     /* max number of 
sectors on one chip */
 #      define CONFIG_SYS_FLASH_BANKS_LIST      { CONFIG_SYS_FLASH_BASE }
 #endif
 
diff --git a/include/configs/M5253DEMO.h b/include/configs/M5253DEMO.h
index b88280c90cdf..9f648342ea33 100644
--- a/include/configs/M5253DEMO.h
+++ b/include/configs/M5253DEMO.h
@@ -93,7 +93,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 FLASH_SST6401B         0x200
 #define SST_ID_xF6401B         0x236D236D
diff --git a/include/configs/M5272C3.h b/include/configs/M5272C3.h
index 2fa1e4356e3e..356ad3e9da1e 100644
--- a/include/configs/M5272C3.h
+++ b/include/configs/M5272C3.h
@@ -91,7 +91,6 @@
  */
 #ifdef CONFIG_SYS_FLASH_CFI
 #      define CONFIG_SYS_FLASH_SIZE            0x800000        /* Max size 
that the board might have */
-#      define CONFIG_SYS_MAX_FLASH_SECT        137     /* max number of 
sectors on one chip */
 #endif
 
 /*-----------------------------------------------------------------------
diff --git a/include/configs/M5275EVB.h b/include/configs/M5275EVB.h
index 80d079a48995..1fd51212d637 100644
--- a/include/configs/M5275EVB.h
+++ b/include/configs/M5275EVB.h
@@ -91,7 +91,6 @@
 /*-----------------------------------------------------------------------
  * FLASH organization
  */
-#define CONFIG_SYS_MAX_FLASH_SECT      11      /* max number of sectors on one 
chip */
 
 #define CONFIG_SYS_FLASH_SIZE          0x200000
 
diff --git a/include/configs/M5282EVB.h b/include/configs/M5282EVB.h
index c476b0c4475a..900b0b53434b 100644
--- a/include/configs/M5282EVB.h
+++ b/include/configs/M5282EVB.h
@@ -95,7 +95,6 @@
 #ifdef CONFIG_SYS_FLASH_CFI
 
 #      define CONFIG_SYS_FLASH_SIZE            0x1000000       /* Max size 
that the board might have */
-#      define CONFIG_SYS_MAX_FLASH_SECT        137     /* max number of 
sectors on one chip */
 #      define CONFIG_SYS_FLASH_BANKS_LIST      { CONFIG_SYS_FLASH_BASE }
 #endif
 
diff --git a/include/configs/M53017EVB.h b/include/configs/M53017EVB.h
index 4d8f752777d0..4f82389cedfa 100644
--- a/include/configs/M53017EVB.h
+++ b/include/configs/M53017EVB.h
@@ -99,7 +99,6 @@
 #ifdef CONFIG_SYS_FLASH_CFI
 #      define CONFIG_FLASH_SPANSION_S29WS_N    1
 #      define CONFIG_SYS_FLASH_SIZE            0x1000000       /* Max size 
that the board might have */
-#      define CONFIG_SYS_MAX_FLASH_SECT        137     /* max number of 
sectors on one chip */
 #endif
 
 #define CONFIG_SYS_FLASH_BASE          CONFIG_SYS_CS0_BASE
diff --git a/include/configs/M5329EVB.h b/include/configs/M5329EVB.h
index 87d3e8fb153b..a6c953f1a46c 100644
--- a/include/configs/M5329EVB.h
+++ b/include/configs/M5329EVB.h
@@ -92,7 +92,6 @@
  */
 #ifdef CONFIG_SYS_FLASH_CFI
 #      define CONFIG_SYS_FLASH_SIZE            0x800000        /* Max size 
that the board might have */
-#      define CONFIG_SYS_MAX_FLASH_SECT        137     /* max number of 
sectors on one chip */
 #endif
 
 #ifdef CONFIG_CMD_NAND
diff --git a/include/configs/M5373EVB.h b/include/configs/M5373EVB.h
index d920587c3790..f519bef24744 100644
--- a/include/configs/M5373EVB.h
+++ b/include/configs/M5373EVB.h
@@ -94,7 +94,6 @@
  */
 #ifdef CONFIG_SYS_FLASH_CFI
 #      define CONFIG_SYS_FLASH_SIZE            0x800000        /* Max size 
that the board might have */
-#      define CONFIG_SYS_MAX_FLASH_SECT        137     /* max number of 
sectors on one chip */
 #endif
 
 #      define CONFIG_SYS_MAX_NAND_DEVICE       1
diff --git a/include/configs/MCR3000.h b/include/configs/MCR3000.h
index f6854cb8c985..9d0683829ecb 100644
--- a/include/configs/MCR3000.h
+++ b/include/configs/MCR3000.h
@@ -69,7 +69,6 @@
 
 /* FLASH organization */
 #define CONFIG_SYS_FLASH_BASE          CONFIG_SYS_TEXT_BASE
-#define CONFIG_SYS_MAX_FLASH_SECT      35
 
 /*
  * For booting Linux, the board info and command line data
diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h
index a25bf7464514..c2f4f2bee2c0 100644
--- a/include/configs/MPC837XERDB.h
+++ b/include/configs/MPC837XERDB.h
@@ -141,9 +141,6 @@
 #define CONFIG_SYS_FLASH_BASE          0xFE000000 /* FLASH base address */
 #define CONFIG_SYS_FLASH_SIZE          8 /* max FLASH size is 32M */
 
-
-#define CONFIG_SYS_MAX_FLASH_SECT      256 /* max sectors per device */
-
 /*
  * NAND Flash on the Local Bus
  */
diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h
index d4a2b0184f64..0c710ef8865c 100644
--- a/include/configs/MPC8548CDS.h
+++ b/include/configs/MPC8548CDS.h
@@ -124,7 +124,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_HWCONFIG                        /* enable hwconfig */
 
diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h
index a057d59177e5..9a7f7d5464bf 100644
--- a/include/configs/P1010RDB.h
+++ b/include/configs/P1010RDB.h
@@ -137,7 +137,6 @@ extern unsigned long get_sdram_size(void);
 /* NOR Flash on IFC */
 
 #define CONFIG_SYS_FLASH_BASE          0xee000000
-#define CONFIG_SYS_MAX_FLASH_SECT      256     /* 32M */
 
 #ifdef CONFIG_PHYS_64BIT
 #define CONFIG_SYS_FLASH_BASE_PHYS     (0xf00000000ull | CONFIG_SYS_FLASH_BASE)
diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h
index b4a7b4688113..45ce78a5e73c 100644
--- a/include/configs/P2041RDB.h
+++ b/include/configs/P2041RDB.h
@@ -123,8 +123,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #define CONFIG_FLASH_SHOW_PROGRESS     45 /* count down from 45/5: 9..1 */
 
-#define CONFIG_SYS_MAX_FLASH_SECT      1024            /* sectors per device */
-
 /* Nand Flash */
 #ifdef CONFIG_NAND_FSL_ELBC
 #define CONFIG_SYS_NAND_BASE           0xffa00000
diff --git a/include/configs/T102xRDB.h b/include/configs/T102xRDB.h
index 7c5fbbba5926..2bdb54522316 100644
--- a/include/configs/T102xRDB.h
+++ b/include/configs/T102xRDB.h
@@ -168,8 +168,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_BANKS_LIST    {CONFIG_SYS_FLASH_BASE_PHYS}
 
 #ifdef CONFIG_TARGET_T1024RDB
diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h
index 39b04b204e58..96a84706f7cc 100644
--- a/include/configs/T104xRDB.h
+++ b/include/configs/T104xRDB.h
@@ -130,8 +130,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_BANKS_LIST    {CONFIG_SYS_FLASH_BASE_PHYS}
 
 /* CPLD on IFC */
diff --git a/include/configs/T208xQDS.h b/include/configs/T208xQDS.h
index 0cb8d394d11c..321c306a04e9 100644
--- a/include/configs/T208xQDS.h
+++ b/include/configs/T208xQDS.h
@@ -133,8 +133,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_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 bccc3385cb21..677cc80d146d 100644
--- a/include/configs/T208xRDB.h
+++ b/include/configs/T208xRDB.h
@@ -123,7 +123,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_BANKS_LIST    {CONFIG_SYS_FLASH_BASE_PHYS }
 
 /* CPLD on IFC */
diff --git a/include/configs/T4240RDB.h b/include/configs/T4240RDB.h
index 181b5fe2a44b..28755203ebfe 100644
--- a/include/configs/T4240RDB.h
+++ b/include/configs/T4240RDB.h
@@ -204,8 +204,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_BANKS_LIST    {CONFIG_SYS_FLASH_BASE_PHYS \
                                        + 0x8000000, CONFIG_SYS_FLASH_BASE_PHYS}
 
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 4b59759f818e..bd7e2f1bf503 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -223,7 +223,6 @@
  * 0x4C0000 - 0xFFFFFF : Userland (11 MiB + 256 KiB)
  */
 #if defined(CONFIG_NOR)
-#define CONFIG_SYS_MAX_FLASH_SECT      128
 #define CONFIG_SYS_FLASH_BASE          (0x08000000)
 #define CONFIG_SYS_FLASH_SIZE          0x01000000
 #endif  /* NOR support */
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index 93beed4ad736..02a5e94c4f48 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -88,7 +88,6 @@
 /* FLASH and environment organization */
 
 /* **** PISMO SUPPORT *** */
-#define CONFIG_SYS_MAX_FLASH_SECT      520     /* max number of sectors */
                                                /* on one chip */
 #define CONFIG_SYS_MONITOR_LEN         (256 << 10)     /* Reserve 2 sectors */
 
diff --git a/include/configs/amcore.h b/include/configs/amcore.h
index 89b94b29306f..3f3b399ed7d9 100644
--- a/include/configs/amcore.h
+++ b/include/configs/amcore.h
@@ -36,7 +36,6 @@
 #define CONFIG_SYS_SDRAM_BASE          0x00000000
 #define CONFIG_SYS_SDRAM_SIZE          0x1000000
 #define CONFIG_SYS_FLASH_BASE          0xffc00000
-#define CONFIG_SYS_MAX_FLASH_SECT      1024
 
 /* 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 d54cadd41eeb..da02a96889bc 100644
--- a/include/configs/armadillo-800eva.h
+++ b/include/configs/armadillo-800eva.h
@@ -47,7 +47,6 @@
 
 /* FLASH */
 #define CONFIG_SYS_FLASH_BASE          0x00000000
-#define CONFIG_SYS_MAX_FLASH_SECT      512
 #define CONFIG_SYS_FLASH_BANKS_LIST    { (CONFIG_SYS_FLASH_BASE) }
 
 /* ENV setting */
diff --git a/include/configs/astro_mcf5373l.h b/include/configs/astro_mcf5373l.h
index f48f7902a002..dde30eab5ed9 100644
--- a/include/configs/astro_mcf5373l.h
+++ b/include/configs/astro_mcf5373l.h
@@ -207,7 +207,6 @@
                                                (CONFIG_SYS_SDRAM_SIZE << 20))
 
 /* FLASH organization */
-#define CONFIG_SYS_MAX_FLASH_SECT      259
 
 #define CONFIG_SYS_FLASH_SIZE          0x2000000
 #define CONFIG_SYS_FLASH_CFI_NONBLOCK  1
diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
index 9497f055035d..8c6d1cd1d9d4 100644
--- a/include/configs/at91sam9263ek.h
+++ b/include/configs/at91sam9263ek.h
@@ -40,7 +40,6 @@
 #ifdef CONFIG_SYS_USE_NORFLASH
 #define PHYS_FLASH_1                           0x10000000
 #define CONFIG_SYS_FLASH_BASE                  PHYS_FLASH_1
-#define CONFIG_SYS_MAX_FLASH_SECT              256
 
 #define CONFIG_SYS_MONITOR_SEC 1:0-3
 #define CONFIG_SYS_MONITOR_LEN (256 << 10)
diff --git a/include/configs/ax25-ae350.h b/include/configs/ax25-ae350.h
index 653acdc9aff1..cf5125fdfa63 100644
--- a/include/configs/ax25-ae350.h
+++ b/include/configs/ax25-ae350.h
@@ -55,7 +55,6 @@
 
 /* max number of sectors on one chip */
 #define CONFIG_FLASH_SECTOR_SIZE       (0x10000*2)
-#define CONFIG_SYS_MAX_FLASH_SECT      512
 
 /* environments */
 
diff --git a/include/configs/blanche.h b/include/configs/blanche.h
index 76271ebe2e68..959c521b6c91 100644
--- a/include/configs/blanche.h
+++ b/include/configs/blanche.h
@@ -30,7 +30,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS     45
 #define CONFIG_SYS_FLASH_BASE          0x00000000
 #define CONFIG_SYS_FLASH_SIZE          0x04000000      /* 64 MB */
-#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) }
 #endif
diff --git a/include/configs/boston.h b/include/configs/boston.h
index 8b04492753a8..5d6da772059d 100644
--- a/include/configs/boston.h
+++ b/include/configs/boston.h
@@ -34,12 +34,6 @@
  * Console
  */
 
-/*
- * Flash
- */
-
-#define CONFIG_SYS_MAX_FLASH_SECT              1024
-
 /*
  * Environment
  */
diff --git a/include/configs/cobra5272.h b/include/configs/cobra5272.h
index 5e364b4990a8..c29abd15b39e 100644
--- a/include/configs/cobra5272.h
+++ b/include/configs/cobra5272.h
@@ -186,11 +186,6 @@ enter a valid image address in flash */
  */
 #define CONFIG_SYS_BOOTMAPSZ           (8 << 20)       /* Initial Memory map 
for Linux */
 
-/*-----------------------------------------------------------------------
- * FLASH organization
- */
-#define CONFIG_SYS_MAX_FLASH_SECT      11      /* max number of sectors on one 
chip    */
-
 /*-----------------------------------------------------------------------
  * Cache Configuration
  */
diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h
index c12cdd413291..84712d16d0f7 100644
--- a/include/configs/corenet_ds.h
+++ b/include/configs/corenet_ds.h
@@ -113,8 +113,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #define CONFIG_FLASH_SHOW_PROGRESS     45 /* count down from 45/5: 9..1 */
 
-#define CONFIG_SYS_MAX_FLASH_SECT      1024            /* sectors per device */
-
 /* Nand Flash */
 #ifdef CONFIG_NAND_FSL_ELBC
 #define CONFIG_SYS_NAND_BASE           0xffa00000
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 3db97205dab8..f699cb107800 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -137,8 +137,6 @@
 #define CONFIG_SYS_FLASH_SECT_SZ       (128 << 10) /* 128KB */
 #define CONFIG_SYS_FLASH_BASE          DAVINCI_ASYNC_EMIF_DATA_CE2_BASE
 #define PHYS_FLASH_SIZE                        (8 << 20) /* Flash size 8MB */
-#define CONFIG_SYS_MAX_FLASH_SECT ((PHYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ)\
-              + 3)
 #endif
 
 /*
diff --git a/include/configs/devkit3250.h b/include/configs/devkit3250.h
index 328e4958f86a..7916ca8a6cd4 100644
--- a/include/configs/devkit3250.h
+++ b/include/configs/devkit3250.h
@@ -29,7 +29,6 @@
 /*
  * NOR Flash
  */
-#define CONFIG_SYS_MAX_FLASH_SECT      71
 #define CONFIG_SYS_FLASH_BASE          EMC_CS0_BASE
 #define CONFIG_SYS_FLASH_SIZE          SZ_4M
 
diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h
index 9247720f8b6d..6cf716e293d6 100644
--- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h
@@ -89,7 +89,6 @@
 /* Parallel NOR Support */
 #if defined(CONFIG_NOR)
 /* NOR: device related configs */
-#define CONFIG_SYS_MAX_FLASH_SECT      512
 #define CONFIG_SYS_FLASH_SIZE          (64 * 1024 * 1024) /* 64 MB */
 #define CONFIG_SYS_FLASH_BASE          (0x08000000)
 /* Reduce SPL size by removing unlikey targets */
diff --git a/include/configs/draak.h b/include/configs/draak.h
index a38e48634835..8bfba78dc8e4 100644
--- a/include/configs/draak.h
+++ b/include/configs/draak.h
@@ -15,7 +15,6 @@
 
 #define CONFIG_FLASH_SHOW_PROGRESS     45
 #define CONFIG_SYS_FLASH_BANKS_LIST    { 0x08000000 }
-#define CONFIG_SYS_MAX_FLASH_SECT      256
 #define CONFIG_SYS_WRITE_SWAPPED_DATA
 
 #endif /* __DRAAK_H */
diff --git a/include/configs/eb_cpu5282.h b/include/configs/eb_cpu5282.h
index 1a05914c1b88..249da66237b5 100644
--- a/include/configs/eb_cpu5282.h
+++ b/include/configs/eb_cpu5282.h
@@ -94,8 +94,6 @@
 #define        CONFIG_SYS_INT_FLASH_BASE       0xF0000000
 #define CONFIG_SYS_INT_FLASH_ENABLE    0x21
 
-#define        CONFIG_SYS_MAX_FLASH_SECT       128
-
 #define CONFIG_SYS_FLASH_SIZE          16*1024*1024
 
 #define CONFIG_SYS_FLASH_BANKS_LIST    { CONFIG_SYS_FLASH_BASE }
diff --git a/include/configs/ebisu.h b/include/configs/ebisu.h
index 3dc111f5248d..5e2dc04e253d 100644
--- a/include/configs/ebisu.h
+++ b/include/configs/ebisu.h
@@ -18,7 +18,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS     45
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #define CONFIG_SYS_FLASH_BANKS_LIST    { 0x08000000 }
-#define CONFIG_SYS_MAX_FLASH_SECT      256
 #define CONFIG_SYS_WRITE_SWAPPED_DATA
 
 #endif /* __EBISU_H */
diff --git a/include/configs/edminiv2.h b/include/configs/edminiv2.h
index 86257016824f..d2f1cd5d5c8c 100644
--- a/include/configs/edminiv2.h
+++ b/include/configs/edminiv2.h
@@ -79,7 +79,6 @@
  * FLASH configuration
  */
 
-#define CONFIG_SYS_MAX_FLASH_SECT      11 /* max num of sects on one chip */
 #define CONFIG_SYS_FLASH_BASE          0xfff80000
 
 /* auto boot */
diff --git a/include/configs/ethernut5.h b/include/configs/ethernut5.h
index 88a702f1af27..7a3c800dca9c 100644
--- a/include/configs/ethernut5.h
+++ b/include/configs/ethernut5.h
@@ -31,7 +31,6 @@
 
 /* 512kB on-chip NOR flash */
 # define CONFIG_SYS_FLASH_BASE         0x00200000 /* AT91SAM9XE_FLASH_BASE */
-# define CONFIG_SYS_MAX_FLASH_SECT     32
 
 
 /* bootstrap + u-boot + env + linux in dataflash on CS0 */
diff --git a/include/configs/gazerbeam.h b/include/configs/gazerbeam.h
index 25095e192f0b..e592dc44e4d7 100644
--- a/include/configs/gazerbeam.h
+++ b/include/configs/gazerbeam.h
@@ -40,8 +40,6 @@
 #define CONFIG_SYS_FLASH_BASE          0xFE000000 /* FLASH base address */
 #define CONFIG_SYS_FLASH_SIZE          8 /* FLASH size is up to 8M */
 
-#define CONFIG_SYS_MAX_FLASH_SECT      135
-
 #define CONFIG_SYS_BAUDRATE_TABLE  \
        {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
 
diff --git a/include/configs/ids8313.h b/include/configs/ids8313.h
index 3dbd141a7699..1b97e54be7f6 100644
--- a/include/configs/ids8313.h
+++ b/include/configs/ids8313.h
@@ -109,9 +109,6 @@
 #define CONFIG_SYS_FLASH_BASE          0xFF800000
 #define CONFIG_SYS_FLASH_SIZE          8
 
-
-#define CONFIG_SYS_MAX_FLASH_SECT      128
-
 /*
  * NAND FLASH setup
  */
diff --git a/include/configs/imx27lite-common.h 
b/include/configs/imx27lite-common.h
index 17430f15d139..6ebdc3d6f976 100644
--- a/include/configs/imx27lite-common.h
+++ b/include/configs/imx27lite-common.h
@@ -81,8 +81,6 @@
 #define PHYS_FLASH_1                   0xc0000000
 /* Flash Base for U-Boot */
 #define CONFIG_SYS_FLASH_BASE          PHYS_FLASH_1
-#define CONFIG_SYS_MAX_FLASH_SECT      (PHYS_FLASH_SIZE / \
-               CONFIG_SYS_FLASH_SECT_SZ)
 #define CONFIG_SYS_MONITOR_LEN         0x40000         /* Reserve 256KiB */
 /* Address and size of Redundant Environment Sector    */
 
diff --git a/include/configs/integratorap.h b/include/configs/integratorap.h
index 49f07e997d83..c8457d97161a 100644
--- a/include/configs/integratorap.h
+++ b/include/configs/integratorap.h
@@ -21,7 +21,6 @@
 
 /* Flash settings */
 #define CONFIG_SYS_FLASH_SIZE          0x02000000 /* 32 MiB */
-#define CONFIG_SYS_MAX_FLASH_SECT      128
 
 /*-----------------------------------------------------------------------
  * PCI definitions
diff --git a/include/configs/integratorcp.h b/include/configs/integratorcp.h
index 288014c5b82e..2752152f68ee 100644
--- a/include/configs/integratorcp.h
+++ b/include/configs/integratorcp.h
@@ -34,7 +34,6 @@
  * Miscellaneous configurable options
  */
 #define PHYS_FLASH_SIZE                        0x01000000      /* 16MB */
-#define CONFIG_SYS_MAX_FLASH_SECT      64
 #define CONFIG_SYS_MONITOR_LEN         0x00100000
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/km/km-mpc83xx.h b/include/configs/km/km-mpc83xx.h
index 3c23715a7721..04192d86b700 100644
--- a/include/configs/km/km-mpc83xx.h
+++ b/include/configs/km/km-mpc83xx.h
@@ -49,7 +49,6 @@
  */
 #define CONFIG_SYS_FLASH_SIZE          256 /* max FLASH size is 256M */
 
-#define CONFIG_SYS_MAX_FLASH_SECT      512 /* max num of sects on one chip */
 #define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE }
 
 /* I2C */
diff --git a/include/configs/km/pg-wcom-ls102xa.h 
b/include/configs/km/pg-wcom-ls102xa.h
index 1d9e0b6551e6..0cc90070c244 100644
--- a/include/configs/km/pg-wcom-ls102xa.h
+++ b/include/configs/km/pg-wcom-ls102xa.h
@@ -64,8 +64,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_BANKS_LIST    { CONFIG_SYS_FLASH_BASE_PHYS }
 
 #define CONFIG_SYS_WRITE_SWAPPED_DATA
diff --git a/include/configs/kmcent2.h b/include/configs/kmcent2.h
index dc369d431893..375c6e2bfccf 100644
--- a/include/configs/kmcent2.h
+++ b/include/configs/kmcent2.h
@@ -234,8 +234,6 @@
 /* More NOR Flash params */
 #define CONFIG_SYS_FLASH_QUIET_TEST
 
-#define CONFIG_SYS_MAX_FLASH_SECT      512     /* sectors per device */
-
 #define CONFIG_SYS_FLASH_BANKS_LIST    {CONFIG_SYS_FLASH_BASE_PHYS}
 
 /* NAND Flash on IFC CS1*/
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index 9147a726e592..203381b0e7bd 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -19,7 +19,6 @@
 /* NOR Flash */
 #define KZM_FLASH_BASE (0x00000000)
 #define CONFIG_SYS_FLASH_BASE          (KZM_FLASH_BASE)
-#define CONFIG_SYS_MAX_FLASH_SECT      (512)
 
 /* prompt */
 #define CONFIG_SYS_BAUDRATE_TABLE      { 115200 }
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index f3e694c3c8cd..7df99cad6aa9 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -69,8 +69,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS     45
 #define CONFIG_SYS_WRITE_SWAPPED_DATA
 
-#define CONFIG_SYS_MAX_FLASH_SECT      1024    /* sectors per device */
-
 #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 8681417eb038..72acc9ab62c9 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -98,8 +98,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_BANKS_LIST    { CONFIG_SYS_FLASH_BASE_PHYS }
 
 #define CONFIG_SYS_WRITE_SWAPPED_DATA
diff --git a/include/configs/ls1043aqds.h b/include/configs/ls1043aqds.h
index e265b1a48eaf..49f6cd6be11b 100644
--- a/include/configs/ls1043aqds.h
+++ b/include/configs/ls1043aqds.h
@@ -74,8 +74,6 @@
                                        FTIM2_NOR_TWP(0x1c))
 #define CONFIG_SYS_NOR_FTIM3           0
 
-#define CONFIG_SYS_MAX_FLASH_SECT      1024    /* sectors per device */
-
 #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 352b7dbdd8d2..d36b2c7e557b 100644
--- a/include/configs/ls1043ardb.h
+++ b/include/configs/ls1043ardb.h
@@ -42,8 +42,6 @@
 #define CONFIG_SYS_NOR_FTIM3           0
 #define CONFIG_SYS_IFC_CCR             0x01000000
 
-#define CONFIG_SYS_MAX_FLASH_SECT      1024    /* sectors per device */
-
 #define CONFIG_SYS_FLASH_BANKS_LIST    { CONFIG_SYS_FLASH_BASE_PHYS }
 
 #define CONFIG_SYS_WRITE_SWAPPED_DATA
diff --git a/include/configs/ls1046aqds.h b/include/configs/ls1046aqds.h
index 261646fe703e..c2bbc5fec313 100644
--- a/include/configs/ls1046aqds.h
+++ b/include/configs/ls1046aqds.h
@@ -91,8 +91,6 @@
                                        FTIM2_NOR_TWP(0x1c))
 #define CONFIG_SYS_NOR_FTIM3           0
 
-#define CONFIG_SYS_MAX_FLASH_SECT      1024    /* sectors per device */
-
 #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 c02acfb85806..0106456284c2 100644
--- a/include/configs/ls1088aqds.h
+++ b/include/configs/ls1088aqds.h
@@ -65,8 +65,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_BANKS_LIST    { CONFIG_SYS_FLASH_BASE,\
                                         CONFIG_SYS_FLASH_BASE + 0x40000000}
 #endif
diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
index 61df2a4253ca..36abd0868135 100644
--- a/include/configs/ls1088ardb.h
+++ b/include/configs/ls1088ardb.h
@@ -50,8 +50,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_BANKS_LIST    { CONFIG_SYS_FLASH_BASE }
 #endif
 #endif
diff --git a/include/configs/ls2080aqds.h b/include/configs/ls2080aqds.h
index c7146314dfee..a8f876c54a5d 100644
--- a/include/configs/ls2080aqds.h
+++ b/include/configs/ls2080aqds.h
@@ -67,8 +67,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_BANKS_LIST    { CONFIG_SYS_FLASH_BASE,\
                                         CONFIG_SYS_FLASH_BASE + 0x40000000}
 #endif
diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index d20eaec7527f..cd34698e5613 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -64,8 +64,6 @@
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #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_BANKS_LIST    { CONFIG_SYS_FLASH_BASE,\
                                         CONFIG_SYS_FLASH_BASE + 0x40000000}
 #endif
diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h
index 81c93375e2ef..e1108619f21b 100644
--- a/include/configs/lsxl.h
+++ b/include/configs/lsxl.h
@@ -18,9 +18,6 @@
 /*
  *  Environment variables configurations
  */
-#ifdef CONFIG_SPI_FLASH
-#define CONFIG_SYS_MAX_FLASH_SECT      8
-#endif
 
 /*
  * Default environment variables
diff --git a/include/configs/malta.h b/include/configs/malta.h
index 98ea860655ea..5a42ceef2121 100644
--- a/include/configs/malta.h
+++ b/include/configs/malta.h
@@ -47,7 +47,6 @@
 #else
 # define CONFIG_SYS_FLASH_BASE         0xbe000000
 #endif
-#define CONFIG_SYS_MAX_FLASH_SECT      128
 
 /*
  * Environment
diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 9f34d2aea7ef..8eaac4f8bc22 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -16,13 +16,6 @@
 # define CONFIG_SYS_BAUDRATE_TABLE \
        {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
 
-#ifdef CONFIG_CFI_FLASH
-/* ?empty sector */
-/* max number of memory banks */
-/* max number of sectors on one chip */
-# define CONFIG_SYS_MAX_FLASH_SECT     2048
-#endif
-
 #define        CONFIG_HOSTNAME         "microblaze-generic"
 
 /* architecture dependent code */
diff --git a/include/configs/mx6sabreauto.h b/include/configs/mx6sabreauto.h
index 5fc3acded305..7bfc04ff18f7 100644
--- a/include/configs/mx6sabreauto.h
+++ b/include/configs/mx6sabreauto.h
@@ -32,7 +32,6 @@
 #ifdef CONFIG_MTD_NOR_FLASH
 #define CONFIG_SYS_FLASH_BASE           WEIM_ARB_BASE_ADDR
 #define CONFIG_SYS_FLASH_SECT_SIZE      (128 * 1024)
-#define CONFIG_SYS_MAX_FLASH_SECT 256   /* max number of sectors on one chip */
 #endif
 
 #define CONFIG_SYS_FSL_USDHC_NUM       2
diff --git a/include/configs/octeon_ebb7304.h b/include/configs/octeon_ebb7304.h
index 5df1a2a755f3..5479bdedee5d 100644
--- a/include/configs/octeon_ebb7304.h
+++ b/include/configs/octeon_ebb7304.h
@@ -9,11 +9,6 @@
 
 #include "octeon_common.h"
 
-/*
- * CFI flash
- */
-#define CONFIG_SYS_MAX_FLASH_SECT      256
-
 #define PHY_ANEG_TIMEOUT       8000    /* PHY needs a longer aneg time */
 
 #endif /* __CONFIG_H__ */
diff --git a/include/configs/omap3_logic.h b/include/configs/omap3_logic.h
index 38dc7ea88f7b..81c1692055d9 100644
--- a/include/configs/omap3_logic.h
+++ b/include/configs/omap3_logic.h
@@ -150,7 +150,6 @@
 #define CONFIG_SYS_FLASH_BASE          0x10000000
 #endif
 
-#define CONFIG_SYS_MAX_FLASH_SECT      256
 #define CONFIG_SYS_FLASH_SIZE          0x4000000
 
 #define CONFIG_SYS_ENV_SECT_SIZE       (128 << 10)     /* 128 KiB */
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index 1c5ef78fc927..5071959278d6 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -176,10 +176,8 @@
  * Local Bus Definitions
  */
 #if defined(CONFIG_TARGET_P1020RDB_PD)
-#define CONFIG_SYS_MAX_FLASH_SECT      512     /* 64M */
 #define CONFIG_SYS_FLASH_BASE          0xec000000
 #else
-#define CONFIG_SYS_MAX_FLASH_SECT      128     /* 16M */
 #define CONFIG_SYS_FLASH_BASE          0xef000000
 #endif
 
diff --git a/include/configs/pm9261.h b/include/configs/pm9261.h
index 7374514698f9..797e44f844de 100644
--- a/include/configs/pm9261.h
+++ b/include/configs/pm9261.h
@@ -149,7 +149,6 @@
 /* NOR flash */
 #define PHYS_FLASH_1                           0x10000000
 #define CONFIG_SYS_FLASH_BASE                  PHYS_FLASH_1
-#define CONFIG_SYS_MAX_FLASH_SECT              256
 
 /* USB */
 #define CONFIG_SYS_USB_OHCI_REGS_BASE          0x00500000
diff --git a/include/configs/pm9263.h b/include/configs/pm9263.h
index 7a6d817926c7..bb5bd8b60646 100644
--- a/include/configs/pm9263.h
+++ b/include/configs/pm9263.h
@@ -149,7 +149,6 @@
 /* NOR flash, if populated */
 #define PHYS_FLASH_1                   0x10000000
 #define CONFIG_SYS_FLASH_BASE          PHYS_FLASH_1
-#define CONFIG_SYS_MAX_FLASH_SECT      256
 
 /* NAND flash */
 #ifdef CONFIG_CMD_NAND
diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
index e9f756b13edb..dd2faebbbb26 100644
--- a/include/configs/qemu-arm.h
+++ b/include/configs/qemu-arm.h
@@ -74,6 +74,4 @@
        "ramdisk_addr_r=0x44000000\0" \
        BOOTENV
 
-#define CONFIG_SYS_MAX_FLASH_SECT      256 /* Sector: 256K, Bank: 64M */
-
 #endif /* __CONFIG_H */
diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h
index 409d5af0241d..f0dfba3fd49f 100644
--- a/include/configs/r2dplus.h
+++ b/include/configs/r2dplus.h
@@ -17,7 +17,6 @@
  * NOR Flash ( Spantion S29GL256P )
  */
 #define CONFIG_SYS_FLASH_BASE          (0xA0000000)
-#define CONFIG_SYS_MAX_FLASH_SECT  256
 #define CONFIG_SYS_FLASH_BANKS_LIST    { CONFIG_SYS_FLASH_BASE }
 
 /*
diff --git a/include/configs/salvator-x.h b/include/configs/salvator-x.h
index 4b0f20e89b7c..fd68761ce8f4 100644
--- a/include/configs/salvator-x.h
+++ b/include/configs/salvator-x.h
@@ -16,7 +16,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS     45
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #define CONFIG_SYS_FLASH_BANKS_LIST    { 0x08000000 }
-#define CONFIG_SYS_MAX_FLASH_SECT      256
 #define CONFIG_SYS_WRITE_SWAPPED_DATA
 
 #endif /* __SALVATOR_X_H */
diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h
index 7bc3f91e77a8..b48e40bee440 100644
--- a/include/configs/sama5d3xek.h
+++ b/include/configs/sama5d3xek.h
@@ -31,7 +31,6 @@
 /* NOR flash */
 #ifdef CONFIG_MTD_NOR_FLASH
 #define CONFIG_SYS_FLASH_BASE          0x10000000
-#define CONFIG_SYS_MAX_FLASH_SECT      131
 #endif
 
 /* SDRAM */
diff --git a/include/configs/socrates.h b/include/configs/socrates.h
index 185da975fc2f..0d9a336b4e2c 100644
--- a/include/configs/socrates.h
+++ b/include/configs/socrates.h
@@ -88,8 +88,6 @@
 #define CONFIG_SYS_LBC_FLASH_BASE      CONFIG_SYS_FLASH1       /* Localbus 
flash start */
 #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_LBC_LCRR            0x00030004    /* LB clock ratio reg     
*/
 #define CONFIG_SYS_LBC_LBCR            0x00000000    /* LB config reg          
*/
 #define CONFIG_SYS_LBC_LSRT            0x20000000    /* LB sdram refresh timer 
*/
diff --git a/include/configs/stm32f429-discovery.h 
b/include/configs/stm32f429-discovery.h
index 18c9e5bfb6eb..51f69010b179 100644
--- a/include/configs/stm32f429-discovery.h
+++ b/include/configs/stm32f429-discovery.h
@@ -13,8 +13,6 @@
  * Configuration of the external SDRAM memory
  */
 
-#define CONFIG_SYS_MAX_FLASH_SECT      12
-
 #define CONFIG_SYS_HZ_CLOCK            1000000 /* Timer is clocked at 1MHz */
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
diff --git a/include/configs/stm32f429-evaluation.h 
b/include/configs/stm32f429-evaluation.h
index 6849477beafb..221b7abe1ad7 100644
--- a/include/configs/stm32f429-evaluation.h
+++ b/include/configs/stm32f429-evaluation.h
@@ -18,8 +18,6 @@
  * Configuration of the external SDRAM memory
  */
 
-#define CONFIG_SYS_MAX_FLASH_SECT      12
-
 #define CONFIG_SYS_HZ_CLOCK            1000000 /* Timer is clocked at 1MHz */
 
 #define BOOT_TARGET_DEVICES(func) \
diff --git a/include/configs/stm32f469-discovery.h 
b/include/configs/stm32f469-discovery.h
index 2d8b2d27c925..55e70ce92508 100644
--- a/include/configs/stm32f469-discovery.h
+++ b/include/configs/stm32f469-discovery.h
@@ -18,8 +18,6 @@
  * Configuration of the external SDRAM memory
  */
 
-#define CONFIG_SYS_MAX_FLASH_SECT      12
-
 #define CONFIG_SYS_HZ_CLOCK            1000000 /* Timer is clocked at 1MHz */
 
 #define BOOT_TARGET_DEVICES(func) \
diff --git a/include/configs/stm32f746-disco.h 
b/include/configs/stm32f746-disco.h
index df05ee4892a5..64c1bc7d43ff 100644
--- a/include/configs/stm32f746-disco.h
+++ b/include/configs/stm32f746-disco.h
@@ -18,8 +18,6 @@
  * Configuration of the external SDRAM memory
  */
 
-#define CONFIG_SYS_MAX_FLASH_SECT      8
-
 #define CONFIG_SYS_HZ_CLOCK            1000000 /* Timer is clocked at 1MHz */
 
 #define BOOT_TARGET_DEVICES(func) \
diff --git a/include/configs/total_compute.h b/include/configs/total_compute.h
index 5a1eed3f2170..7c77a8d53690 100644
--- a/include/configs/total_compute.h
+++ b/include/configs/total_compute.h
@@ -44,9 +44,5 @@
  */
 
 #define CONFIG_SYS_FLASH_BASE          0x0C000000
-/* 256 x 256KiB sectors */
-#define CONFIG_SYS_MAX_FLASH_SECT      256
-
-#define FLASH_MAX_SECTOR_SIZE          0x00040000
 
 #endif /* __TOTAL_COMPUTE_H */
diff --git a/include/configs/ulcb.h b/include/configs/ulcb.h
index 578873295fb9..f2e787cad89d 100644
--- a/include/configs/ulcb.h
+++ b/include/configs/ulcb.h
@@ -16,7 +16,6 @@
 #define CONFIG_FLASH_SHOW_PROGRESS     45
 #define CONFIG_SYS_FLASH_QUIET_TEST
 #define CONFIG_SYS_FLASH_BANKS_LIST    { 0x08000000 }
-#define CONFIG_SYS_MAX_FLASH_SECT      256
 #define CONFIG_SYS_WRITE_SWAPPED_DATA
 
 #endif /* __ULCB_H */
diff --git a/include/configs/vexpress_aemv8.h b/include/configs/vexpress_aemv8.h
index 6b65fcf37ec9..077428f50040 100644
--- a/include/configs/vexpress_aemv8.h
+++ b/include/configs/vexpress_aemv8.h
@@ -261,17 +261,8 @@
 
 #ifdef CONFIG_TARGET_VEXPRESS64_JUNO
 #define CONFIG_SYS_FLASH_BASE          0x08000000
-/* 255 x 256KiB sectors + 4 x 64KiB sectors at the end = 259 */
-#define CONFIG_SYS_MAX_FLASH_SECT      259
-/* Store environment at top of flash in the same location as blank.img */
-/* in the Juno firmware. */
 #else
 #define CONFIG_SYS_FLASH_BASE          (V2M_PA_BASE + 0x0C000000)
-/* 256 x 256KiB sectors */
-#define CONFIG_SYS_MAX_FLASH_SECT      256
-/* Store environment at top of flash */
 #endif
 
-#define FLASH_MAX_SECTOR_SIZE          0x00040000
-
 #endif /* __VEXPRESS_AEMV8_H */
diff --git a/include/configs/vexpress_common.h 
b/include/configs/vexpress_common.h
index 572a5171fc5c..d3eb01bae624 100644
--- a/include/configs/vexpress_common.h
+++ b/include/configs/vexpress_common.h
@@ -174,10 +174,6 @@
 
 /* Timeout values in ticks */
 
-/* 255 0x40000 sectors + first or last sector may have 4 erase regions = 259 */
-#define CONFIG_SYS_MAX_FLASH_SECT      259             /* Max sectors */
-#define FLASH_MAX_SECTOR_SIZE          0x00040000      /* 256 KB sectors */
-
 /* Room required on the stack for the environment data */
 
 /*
diff --git a/include/configs/xtfpga.h b/include/configs/xtfpga.h
index 67ba8af71f85..526165cf1028 100644
--- a/include/configs/xtfpga.h
+++ b/include/configs/xtfpga.h
@@ -180,9 +180,6 @@
 # define CONFIG_SYS_FLASH_PARMSECT_SZ  0x8000          /* param size 32KB */
 # define CONFIG_SYS_FLASH_BASE         IOADDR(0x08000000)
 #endif
-#define CONFIG_SYS_MAX_FLASH_SECT      \
-       (CONFIG_SYS_FLASH_SECT_SZ/CONFIG_SYS_FLASH_PARMSECT_SZ + \
-        CONFIG_SYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ - 1)
 
 /*
  * Put environment in top block (64kB)
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index cb4f4209728d..f6abacf2fac7 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -38,7 +38,6 @@
 
 /* NOR */
 #ifdef CONFIG_MTD_NOR_FLASH
-# define CONFIG_SYS_MAX_FLASH_SECT     512
 # define CONFIG_FLASH_SHOW_PROGRESS    10
 # define CONFIG_SYS_FLASH_QUIET_TEST
 #endif
-- 
2.25.1

Reply via email to