Convert CONFIG_BCH to Kconfig
This converts the following to Kconfig:
CONFIG_BCH
Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
index d03850b..27ea7a4 100644
--- a/configs/am3517_evm_defconfig
+++ b/configs/am3517_evm_defconfig
@@ -41,4 +41,5 @@
CONFIG_USB=y
CONFIG_USB_MUSB_HOST=y
CONFIG_USB_STORAGE=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/igep0032_defconfig b/configs/igep0032_defconfig
index 990b749..6e3dcb0 100644
--- a/configs/igep0032_defconfig
+++ b/configs/igep0032_defconfig
@@ -34,5 +34,6 @@
CONFIG_SYS_NS16550=y
CONFIG_OMAP3_SPI=y
CONFIG_FAT_WRITE=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/igep00x0_defconfig b/configs/igep00x0_defconfig
index 6b71b3b..c504e75 100644
--- a/configs/igep00x0_defconfig
+++ b/configs/igep00x0_defconfig
@@ -35,5 +35,6 @@
CONFIG_SYS_NS16550=y
CONFIG_OMAP3_SPI=y
CONFIG_FAT_WRITE=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/km_kirkwood_128m16_defconfig b/configs/km_kirkwood_128m16_defconfig
index 886a5df..dd67dcd4 100644
--- a/configs/km_kirkwood_128m16_defconfig
+++ b/configs/km_kirkwood_128m16_defconfig
@@ -28,4 +28,5 @@
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/km_kirkwood_defconfig b/configs/km_kirkwood_defconfig
index 4197c8a..223479c 100644
--- a/configs/km_kirkwood_defconfig
+++ b/configs/km_kirkwood_defconfig
@@ -28,4 +28,5 @@
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/km_kirkwood_pci_defconfig b/configs/km_kirkwood_pci_defconfig
index 93fc00d..f9d04d0 100644
--- a/configs/km_kirkwood_pci_defconfig
+++ b/configs/km_kirkwood_pci_defconfig
@@ -28,4 +28,5 @@
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/kmcoge4_defconfig b/configs/kmcoge4_defconfig
index b8faced..2c0d7a0 100644
--- a/configs/kmcoge4_defconfig
+++ b/configs/kmcoge4_defconfig
@@ -39,4 +39,5 @@
CONFIG_E1000=y
CONFIG_SYS_NS16550=y
CONFIG_FSL_ESPI=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/kmcoge5ne_defconfig b/configs/kmcoge5ne_defconfig
index 4f38ea1..5165496 100644
--- a/configs/kmcoge5ne_defconfig
+++ b/configs/kmcoge5ne_defconfig
@@ -24,4 +24,5 @@
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/kmcoge5un_defconfig b/configs/kmcoge5un_defconfig
index aed373b..31c5718 100644
--- a/configs/kmcoge5un_defconfig
+++ b/configs/kmcoge5un_defconfig
@@ -28,4 +28,5 @@
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/kmlion1_defconfig b/configs/kmlion1_defconfig
index d5470a5..d715053 100644
--- a/configs/kmlion1_defconfig
+++ b/configs/kmlion1_defconfig
@@ -39,4 +39,5 @@
CONFIG_E1000=y
CONFIG_SYS_NS16550=y
CONFIG_FSL_ESPI=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/kmnusa_defconfig b/configs/kmnusa_defconfig
index 303d3df..42becd9 100644
--- a/configs/kmnusa_defconfig
+++ b/configs/kmnusa_defconfig
@@ -28,4 +28,5 @@
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/kmsugp1_defconfig b/configs/kmsugp1_defconfig
index 5bd889f..c6924d5 100644
--- a/configs/kmsugp1_defconfig
+++ b/configs/kmsugp1_defconfig
@@ -28,4 +28,5 @@
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/kmsuv31_defconfig b/configs/kmsuv31_defconfig
index 87b6987..aad7b4d 100644
--- a/configs/kmsuv31_defconfig
+++ b/configs/kmsuv31_defconfig
@@ -28,4 +28,5 @@
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/kmtegr1_defconfig b/configs/kmtegr1_defconfig
index 650c96f..5547920 100644
--- a/configs/kmtegr1_defconfig
+++ b/configs/kmtegr1_defconfig
@@ -25,4 +25,5 @@
CONFIG_MTD_NOR_FLASH=y
# CONFIG_PCI is not set
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/mgcoge3un_defconfig b/configs/mgcoge3un_defconfig
index 4a9feee..910d09e 100644
--- a/configs/mgcoge3un_defconfig
+++ b/configs/mgcoge3un_defconfig
@@ -28,4 +28,5 @@
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/omap3_evm_defconfig b/configs/omap3_evm_defconfig
index d9e636a..9977e8e 100644
--- a/configs/omap3_evm_defconfig
+++ b/configs/omap3_evm_defconfig
@@ -57,6 +57,7 @@
CONFIG_G_DNL_VENDOR_NUM=0x0451
CONFIG_G_DNL_PRODUCT_NUM=0x5678
CONFIG_FAT_WRITE=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_SPL_OF_LIBFDT=y
diff --git a/configs/omap3_logic_defconfig b/configs/omap3_logic_defconfig
index dd4e237..ffb325e 100644
--- a/configs/omap3_logic_defconfig
+++ b/configs/omap3_logic_defconfig
@@ -47,3 +47,4 @@
CONFIG_G_DNL_MANUFACTURER="TI"
CONFIG_G_DNL_VENDOR_NUM=0x0451
CONFIG_G_DNL_PRODUCT_NUM=0xd022
+CONFIG_BCH=y
diff --git a/configs/omap3_overo_defconfig b/configs/omap3_overo_defconfig
index 20542e9..5d1cbe9 100644
--- a/configs/omap3_overo_defconfig
+++ b/configs/omap3_overo_defconfig
@@ -50,4 +50,5 @@
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_STORAGE=y
CONFIG_FAT_WRITE=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/portl2_defconfig b/configs/portl2_defconfig
index e272232..351f16b 100644
--- a/configs/portl2_defconfig
+++ b/configs/portl2_defconfig
@@ -28,4 +28,5 @@
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/tricorder_defconfig b/configs/tricorder_defconfig
index 16e3011..1a07489 100644
--- a/configs/tricorder_defconfig
+++ b/configs/tricorder_defconfig
@@ -36,4 +36,5 @@
CONFIG_LED_STATUS_CMD=y
CONFIG_MMC_OMAP_HS=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/tricorder_flash_defconfig b/configs/tricorder_flash_defconfig
index 43f1860..dba3b1d 100644
--- a/configs/tricorder_flash_defconfig
+++ b/configs/tricorder_flash_defconfig
@@ -35,4 +35,5 @@
CONFIG_LED_STATUS_CMD=y
CONFIG_MMC_OMAP_HS=y
CONFIG_SYS_NS16550=y
+CONFIG_BCH=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/x600_defconfig b/configs/x600_defconfig
index 91cf93f..bcb20fa 100644
--- a/configs/x600_defconfig
+++ b/configs/x600_defconfig
@@ -44,6 +44,7 @@
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_STORAGE=y
+CONFIG_BCH=y
CONFIG_USE_TINY_PRINTF=y
CONFIG_OF_LIBFDT=y
# CONFIG_EFI_LOADER is not set
diff --git a/doc/README.nand b/doc/README.nand
index 2295bb2..362b8d8 100644
--- a/doc/README.nand
+++ b/doc/README.nand
@@ -180,12 +180,6 @@
And fetching device parameters flashed on device, by parsing
ONFI parameter page.
- CONFIG_BCH
- Enables software based BCH ECC algorithm present in lib/bch.c
- This is used by SoC platforms which do not have built-in ELM
- hardware engine required for BCH ECC correction.
-
-
Platform specific options
=========================
CONFIG_NAND_OMAP_GPMC
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index 0dd6cea..e7ef3dd 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -105,7 +105,6 @@
#ifdef CONFIG_NAND
#define CONFIG_NAND_OMAP_GPMC
#define CONFIG_NAND_OMAP_GPMC_PREFETCH
-#define CONFIG_BCH
#define CONFIG_SYS_NAND_ADDR NAND_BASE /* physical address */
/* to access nand */
#define CONFIG_SYS_NAND_BASE NAND_BASE /* physical address */
diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index 42a6032..8866658 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -31,7 +31,6 @@
#define CONFIG_MACH_TYPE MACH_TYPE_KM_KIRKWOOD
#define CONFIG_NAND_ECC_BCH
-#define CONFIG_BCH
/* include common defines/options for all Keymile boards */
#include "keymile-common.h"
diff --git a/include/configs/km/kmp204x-common.h b/include/configs/km/kmp204x-common.h
index 0727106..ff3bce8 100644
--- a/include/configs/km/kmp204x-common.h
+++ b/include/configs/km/kmp204x-common.h
@@ -154,8 +154,6 @@
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#define CONFIG_SYS_NAND_BLOCK_SIZE (128 * 1024)
-#define CONFIG_BCH
-
/* NAND flash config */
#define CONFIG_SYS_NAND_BR_PRELIM (BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \
| BR_PS_8 /* Port Size = 8 bit */ \
diff --git a/include/configs/km8360.h b/include/configs/km8360.h
index 9c1c158..f482e2c 100644
--- a/include/configs/km8360.h
+++ b/include/configs/km8360.h
@@ -22,7 +22,6 @@
#define CONFIG_KM_BOARD_NAME "kmcoge5ne"
#define CONFIG_KM_DEF_NETDEV "netdev=eth1\0"
#define CONFIG_NAND_ECC_BCH
-#define CONFIG_BCH
#define CONFIG_NAND_KMETER1
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#define NAND_MAX_CHIPS 1
diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
index 3f48242..dd7ea5c 100644
--- a/include/configs/omap3_evm.h
+++ b/include/configs/omap3_evm.h
@@ -52,7 +52,6 @@
#define CONFIG_NAND_OMAP_GPMC
#define CONFIG_SYS_FLASH_BASE NAND_BASE
#define CONFIG_SYS_MAX_NAND_DEVICE 1
-#define CONFIG_BCH
#define CONFIG_SYS_NAND_BUSWIDTH_16BIT
#define CONFIG_SYS_NAND_5_ADDR_CYCLE
#define CONFIG_SYS_NAND_PAGE_COUNT 64
diff --git a/include/configs/omap3_igep00x0.h b/include/configs/omap3_igep00x0.h
index c75027b..5118b934 100644
--- a/include/configs/omap3_igep00x0.h
+++ b/include/configs/omap3_igep00x0.h
@@ -137,7 +137,6 @@
#define CONFIG_SYS_NAND_ECCBYTES 14
#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
#define CONFIG_NAND_OMAP_GPMC
-#define CONFIG_BCH
/* UBI configuration */
#define CONFIG_SPL_UBI 1
diff --git a/include/configs/omap3_logic.h b/include/configs/omap3_logic.h
index bdd4bb6..b8821d1 100644
--- a/include/configs/omap3_logic.h
+++ b/include/configs/omap3_logic.h
@@ -88,7 +88,6 @@
#define CONFIG_SYS_NAND_ECCSIZE 512
#define CONFIG_SYS_NAND_ECCBYTES 13
#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
-#define CONFIG_BCH
#define CONFIG_SYS_NAND_MAX_OOBFREE 2
#define CONFIG_SYS_NAND_MAX_ECCPOS 56
#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000
diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
index f7dda87..d53657f 100644
--- a/include/configs/omap3_overo.h
+++ b/include/configs/omap3_overo.h
@@ -17,8 +17,6 @@
#undef CONFIG_SPL_TEXT_BASE
#define CONFIG_SPL_TEXT_BASE 0x40200000
-#define CONFIG_BCH
-
/* call misc_init_r */
#define CONFIG_MISC_INIT_R
diff --git a/include/configs/suvd3.h b/include/configs/suvd3.h
index 7b3b050..00deed6 100644
--- a/include/configs/suvd3.h
+++ b/include/configs/suvd3.h
@@ -58,7 +58,6 @@
#define CONFIG_ENV_OFFSET 0x100000
#define CONFIG_NAND_ECC_BCH
-#define CONFIG_BCH
#define CONFIG_NAND_KMETER1
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#define NAND_MAX_CHIPS 1
diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h
index 77f8cbd..3820096 100644
--- a/include/configs/tricorder.h
+++ b/include/configs/tricorder.h
@@ -92,7 +92,6 @@
/* CS0 */
#define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND */
/* devices */
-#define CONFIG_BCH
#define CONFIG_SYS_NAND_MAX_OOBFREE 2
#define CONFIG_SYS_NAND_MAX_ECCPOS 56
diff --git a/include/configs/x600.h b/include/configs/x600.h
index 1255edd..93c3637 100644
--- a/include/configs/x600.h
+++ b/include/configs/x600.h
@@ -64,7 +64,6 @@
#define CONFIG_SYS_FSMC_NAND_8BIT
#define CONFIG_SYS_NAND_ONFI_DETECTION
#define CONFIG_NAND_ECC_BCH
-#define CONFIG_BCH
/* UBI/UBI config options */
#define CONFIG_MTD_DEVICE
diff --git a/lib/Kconfig b/lib/Kconfig
index d73052d..fe337ac 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -1,5 +1,12 @@
menu "Library routines"
+config BCH
+ bool "Enable Software based BCH ECC"
+ help
+ Enables software based BCH ECC algorithm present in lib/bch.c
+ This is used by SoC platforms which do not have built-in ELM
+ hardware engine required for BCH ECC correction.
+
config CC_OPTIMIZE_LIBS_FOR_SPEED
bool "Optimize libraries for speed"
help
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 648f83c..84dc5c9 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -150,7 +150,6 @@
CONFIG_BAT_CMD
CONFIG_BAT_PAIR
CONFIG_BAT_RW
-CONFIG_BCH
CONFIG_BCH_CONST_M
CONFIG_BCH_CONST_PARAMS
CONFIG_BCH_CONST_T