Convert CONFIG_SYS_NAND_BAD_BLOCK_POS to Kconfig
authorTom Rini <trini@konsulko.com>
Wed, 22 Sep 2021 18:50:32 +0000 (14:50 -0400)
committerTom Rini <trini@konsulko.com>
Wed, 6 Oct 2021 13:16:23 +0000 (09:16 -0400)
This converts the following to Kconfig:
   CONFIG_SYS_NAND_BAD_BLOCK_POS

In order to do this, introduce a choice for HAS_LARGE/SMALL_BADBLOCK_POS
as those are the only valid values.  Use LARGE as the default as no
in-tree boards use SMALL, but it is possible.

Signed-off-by: Tom Rini <trini@konsulko.com>
39 files changed:
arch/arm/include/asm/arch-lpc32xx/config.h
drivers/mtd/nand/raw/Kconfig
include/configs/am335x_evm.h
include/configs/am335x_guardian.h
include/configs/am335x_igep003x.h
include/configs/am3517_evm.h
include/configs/am43xx_evm.h
include/configs/at91sam9m10g45ek.h
include/configs/at91sam9n12ek.h
include/configs/at91sam9x5ek.h
include/configs/baltos.h
include/configs/brppt1.h
include/configs/chiliboard.h
include/configs/cm_t335.h
include/configs/cm_t43.h
include/configs/corvus.h
include/configs/da850evm.h
include/configs/devkit8000.h
include/configs/dra7xx_evm.h
include/configs/gardena-smart-gateway-at91sam.h
include/configs/m53menlo.h
include/configs/omap3_beagle.h
include/configs/omap3_evm.h
include/configs/omap3_igep00x0.h
include/configs/omap3_logic.h
include/configs/omapl138_lcdk.h
include/configs/phycore_am335x_r2.h
include/configs/pm9g45.h
include/configs/sama5d3_xplained.h
include/configs/sama5d3xek.h
include/configs/sama5d4_xplained.h
include/configs/sama5d4ek.h
include/configs/siemens-am33x-common.h
include/configs/smartweb.h
include/configs/socfpga_common.h
include/configs/tam3517-common.h
include/configs/taurus.h
include/configs/ti816x_evm.h
include/configs/uniphier.h

index 22f39ca..653792c 100644 (file)
 #define CONFIG_SYS_NAND_ECCPOS         { 40, 41, 42, 43, 44, 45, 46, 47, \
                                          48, 49, 50, 51, 52, 53, 54, 55, \
                                          56, 57, 58, 59, 60, 61, 62, 63, }
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #elif (CONFIG_SYS_NAND_PAGE_SIZE == NAND_SMALL_BLOCK_PAGE_SIZE)
 #define CONFIG_SYS_NAND_ECCPOS         { 10, 11, 12, 13, 14, 15, }
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
 #else
 #error "CONFIG_SYS_NAND_PAGE_SIZE set to an invalid value"
 #endif
index 8739f3e..dab392e 100644 (file)
@@ -425,6 +425,27 @@ config SYS_NAND_MAX_CHIPS
 
 if SPL
 
+choice
+       prompt "NAND bad block marker/indicator positon in the OOB"
+       depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || \
+               SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC)
+       default HAS_NAND_LARGE_BADBLOCK_POS
+       help
+         In the OOB, which position contains the badblock information.
+
+config HAS_NAND_LARGE_BADBLOCK_POS
+       bool "Set the bad block marker/indicator to the 'large' position"
+
+config HAS_NAND_SMALL_BADBLOCK_POS
+       bool "Set the bad block marker/indicator to the 'small' position"
+
+endchoice
+
+config SYS_NAND_BAD_BLOCK_POS
+       int
+       default 0 if HAS_NAND_LARGE_BADBLOCK_POS
+       default 5 if HAS_NAND_SMALL_BADBLOCK_POS
+
 config SYS_NAND_U_BOOT_LOCATIONS
        bool "Define U-boot binaries locations in NAND"
        help
index c6ef96e..a8ee559 100644 (file)
 /* NAND: device related configs */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 /* NAND: driver related configs */
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2, 3, 4, 5, 6, 7, 8, 9, \
                                         10, 11, 12, 13, 14, 15, 16, 17, \
                                         18, 19, 20, 21, 22, 23, 24, 25, \
index 903543c..087b2d0 100644 (file)
 #define CONFIG_NAND_OMAP_ECCSCHEME      OMAP_ECC_BCH16_CODE_HW
 #define MTDIDS_DEFAULT                  "nand0=nand.0"
 
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS   NAND_LARGE_BADBLOCK_POS
-
 #endif /* CONFIG_MTD_RAW_NAND */
 
 #define CONFIG_AM335X_USB0
index 10a0ed6..71ecd55 100644 (file)
 
 /* NAND config */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2, 3, 4, 5, 6, 7, 8, 9, \
                                         10, 11, 12, 13, 14, 15, 16, 17, \
                                         18, 19, 20, 21, 22, 23, 24, 25, \
index 4c1b812..e36cf25 100644 (file)
@@ -20,7 +20,6 @@
 /* Board NAND Info. */
 #ifdef CONFIG_MTD_RAW_NAND
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2,  3,  4,  5,  6,  7,  8,  9, 10, \
                                         11, 12, 13, 14, 16, 17, 18, 19, 20, \
                                         21, 22, 23, 24, 25, 26, 27, 28, 30, \
index 5c3070d..ea2b564 100644 (file)
 /* NAND: driver related configs */
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 #define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_BCH16_CODE_HW
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
                                10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \
                                20, 21, 22, 23, 24, 25, 26, 27, 28, 29, \
index d322e81..7147103 100644 (file)
@@ -97,7 +97,6 @@
 #define CONFIG_SYS_NAND_U_BOOT_SIZE    0x80000
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCSIZE                256
 #define CONFIG_SYS_NAND_ECCBYTES       3
 #define CONFIG_SYS_NAND_ECCPOS         { 40, 41, 42, 43, 44, 45, 46, 47, \
index 6fe1a83..2611f5b 100644 (file)
 #endif
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x40000
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0x0
 
 #endif
index dc52656..08ce67a 100644 (file)
@@ -99,6 +99,5 @@
 #endif
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x40000
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0x0
 
 #endif
index 31aa110..8c5d1e7 100644 (file)
 
 #ifdef CONFIG_MTD_RAW_NAND
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2, 3, 4, 5, 6, 7, 8, 9, \
                                         10, 11, 12, 13, 14, 15, 16, 17, \
                                         18, 19, 20, 21, 22, 23, 24, 25, \
index a9b37ab..2f499b3 100644 (file)
@@ -147,7 +147,6 @@ NANDTGTS \
 /* don't change OMAP_ELM, ECCSCHEME. ROM code only supports this */
 #define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_BCH8_CODE_HW
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         {2, 3, 4, 5, 6, 7, 8, 9, \
                                        10, 11, 12, 13, 14, 15, 16, 17, \
                                        18, 19, 20, 21, 22, 23, 24, 25, \
index 36dad6c..704b2e6 100644 (file)
 /* NAND: device related configs */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 /* NAND: driver related configs */
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2, 3, 4, 5, 6, 7, 8, 9, \
                                         10, 11, 12, 13, 14, 15, 16, 17, \
                                         18, 19, 20, 21, 22, 23, 24, 25, \
index 2a0b1dd..7cb56cb 100644 (file)
@@ -86,7 +86,6 @@
 
 /* NAND support */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2, 3, 4, 5, 6, 7, 8, 9, \
                                         10, 11, 12, 13, 14, 15, 16, 17, \
                                         18, 19, 20, 21, 22, 23, 24, 25, \
index 5563bea..f5521c5 100644 (file)
@@ -24,7 +24,6 @@
 /* NAND support */
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       14
 #define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_BCH8_CODE_HW
index b8411c7..027a1c3 100644 (file)
@@ -99,7 +99,6 @@
 #define CONFIG_SYS_NAND_U_BOOT_DST     CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCSIZE                256
 #define CONFIG_SYS_NAND_ECCBYTES       3
 #define CONFIG_SYS_NAND_ECCPOS         { 40, 41, 42, 43, 44, 45, 46, 47, \
index 8d5831d..068e5f6 100644 (file)
                                39, 40, 41, 42, 43, 44, 45, 46, 47, 48, \
                                49, 50, 51, 52, 53, 54, 55, 56, 57, 58, \
                                59, 60, 61, 62, 63 }
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       10
 
index c87d9e3..89221a8 100644 (file)
 
 /* NAND boot config */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
 #define CONFIG_SYS_NAND_ECCPOS         {2, 3, 4, 5, 6, 7, 8, 9,\
                                                10, 11, 12, 13}
 
index 1c0cb3d..975e1cd 100644 (file)
@@ -84,7 +84,6 @@
 /* NAND: driver related configs */
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 #define CONFIG_NAND_OMAP_ECCSCHEME     OMAP_ECC_BCH8_CODE_HW
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2, 3, 4, 5, 6, 7, 8, 9, \
                                         10, 11, 12, 13, 14, 15, 16, 17, \
                                         18, 19, 20, 21, 22, 23, 24, 25, \
index b721ac4..d69f2a0 100644 (file)
@@ -61,7 +61,6 @@
 #define CONFIG_SYS_NAND_U_BOOT_DST     CONFIG_SYS_TEXT_BASE
 
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0x0
 
 #define CONFIG_SPL_PAD_TO              CONFIG_SYS_NAND_U_BOOT_OFFS
 #define CONFIG_SYS_SPL_LEN             CONFIG_SPL_PAD_TO
index 5a3eb1e..6d107a9 100644 (file)
 
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    CONFIG_SPL_PAD_TO
 #define CONFIG_SYS_NAND_SIZE           (256 * 1024 * 1024)
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
 
 /*
  * Extra Environments
index d568dcd..7ba1902 100644 (file)
@@ -23,7 +23,6 @@
 #define CONFIG_SYS_FLASH_BASE          NAND_BASE
 #define CONFIG_SYS_MAX_NAND_DEVICE      1
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS   NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS          {2, 3, 4, 5, 6, 7, 8, 9,\
                                          10, 11, 12, 13}
 #define CONFIG_SYS_NAND_ECCSIZE         512
index 6e087fb..88590ef 100644 (file)
@@ -28,7 +28,6 @@
 #define CONFIG_SYS_FLASH_BASE          NAND_BASE
 #define CONFIG_SYS_MAX_NAND_DEVICE      1
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS   NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS          {2, 3, 4, 5, 6, 7, 8, 9,\
                                          10, 11, 12, 13}
 #define CONFIG_SYS_NAND_ECCSIZE         512
index 99d6172..8f3c7d1 100644 (file)
@@ -76,7 +76,6 @@
 
 /* NAND config */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2,  3,  4,  5,  6,  7,  8,  9, \
                                         10, 11, 12, 13, 14, 15, 16, 17, \
                                         18, 19, 20, 21, 22, 23, 24, 25, \
index b6e6759..50ff5f8 100644 (file)
@@ -19,7 +19,6 @@
 #define CONFIG_SYS_MAX_NAND_DEVICE     1         /* Max number of */
                                                  /* NAND devices */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \
                                         13, 14, 16, 17, 18, 19, 20, 21, 22, \
                                         23, 24, 25, 26, 27, 28, 30, 31, 32, \
index f1ca57e..056cf90 100644 (file)
                                22, 23, 24, 25, 26, 27, 28, 29, 30, 31, \
                                38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \
                                54, 55, 56, 57, 58, 59, 60, 61, 62, 63 }
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
 #define CONFIG_SYS_NAND_ECCSIZE                512
 #define CONFIG_SYS_NAND_ECCBYTES       10
 #endif
index 099c210..02d1245 100644 (file)
@@ -87,7 +87,6 @@
 /* NAND: device related configs */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 /* NAND: driver related configs */
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2, 3, 4, 5, 6, 7, 8, 9, \
                                         10, 11, 12, 13, 14, 15, 16, 17, \
                                         18, 19, 20, 21, 22, 23, 24, 25, \
index f6fd9a2..029a7cb 100644 (file)
@@ -87,7 +87,6 @@
 #define CONFIG_SYS_NAND_U_BOOT_SIZE    0x80000
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCSIZE                256
 #define CONFIG_SYS_NAND_ECCBYTES       3
 #define CONFIG_SYS_NAND_ECCPOS         { 40, 41, 42, 43, 44, 45, 46, 47, \
index 74cfa93..44fc164 100644 (file)
@@ -71,7 +71,6 @@
 #endif
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x40000
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0x0
 
 /* Falcon boot support on raw MMC */
 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR  0x100  /* 128 KiB */
index 1cada66..b54e639 100644 (file)
@@ -83,6 +83,5 @@
 #endif
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x40000
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0x0
 
 #endif
index 185128e..4aba68e 100644 (file)
@@ -47,6 +47,5 @@
 #endif
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x40000
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0x0
 
 #endif
index e9cf542..64113b4 100644 (file)
@@ -47,6 +47,5 @@
 #endif
 #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x40000
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0x0
 
 #endif
index aed0ce2..4d613c4 100644 (file)
@@ -74,7 +74,6 @@
 
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2, 3, 4, 5, 6, 7, 8, 9, \
                                         10, 11, 12, 13, 14, 15, 16, 17, \
                                         18, 19, 20, 21, 22, 23, 24, 25, \
index ad8937c..41881ea 100644 (file)
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 
 #define CONFIG_SYS_NAND_SIZE           (SZ_256M)
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCSIZE                256
 #define CONFIG_SYS_NAND_ECCBYTES       3
 #define CONFIG_SYS_NAND_ECCPOS         { 40, 41, 42, 43, 44, 45, 46, 47, \
index ed3aac7..187d0bb 100644 (file)
  * NAND Support
  */
 #ifdef CONFIG_NAND_DENALI
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 #define CONFIG_SYS_NAND_REGS_BASE      SOCFPGA_NANDREGS_ADDRESS
index ade467c..9176f1c 100644 (file)
 
 /* NAND boot config */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0
 #define CONFIG_SYS_NAND_ECCPOS         {40, 41, 42, 43, 44, 45, 46, 47,\
                                         48, 49, 50, 51, 52, 53, 54, 55,\
                                         56, 57, 58, 59, 60, 61, 62, 63}
index 197458e..fef55d8 100644 (file)
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 
 #define CONFIG_SYS_NAND_SIZE           (256 * SZ_1M)
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCSIZE                256
 #define CONFIG_SYS_NAND_ECCBYTES       3
 #define CONFIG_SYS_NAND_ECCPOS         { 40, 41, 42, 43, 44, 45, 46, 47, \
index 4d07a05..74dc9fe 100644 (file)
@@ -59,7 +59,6 @@
 /* NAND: device related configs */
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 /* NAND: driver related configs */
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS  NAND_LARGE_BADBLOCK_POS
 #define CONFIG_SYS_NAND_ECCPOS         { 2, 3, 4, 5, 6, 7, 8, 9, \
                                         10, 11, 12, 13, 14, 15, 16, 17, \
                                         18, 19, 20, 21, 22, 23, 24, 25, \
index d419db1..88dac39 100644 (file)
@@ -57,7 +57,6 @@
 #define CONFIG_SYS_NAND_ONFI_DETECTION
 #define CONFIG_SYS_NAND_REGS_BASE                      0x68100000
 #define CONFIG_SYS_NAND_DATA_BASE                      0x68000000
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS                  0
 
 /*
  * Network Configuration