This patch adds CONFIG_SPL_NAND_DEVICE_WIDTH to specify bus-width of NAND device CONFIG_SPL_NAND_DEVICE_WIDTH == 16: NAND device with x16 bus-width CONFIG_SPL_NAND_DEVICE_WIDTH == 8: NAND device with x8 bus-width
Need for a separate CONFIG_xx arise from following situations. (1) SPL NAND drivers does not have framework to parse ONFI parameter page. (2) if !defined(CONFIG_SYS_NAND_SELF_INIT) |- board_nand_init() |- nand_scan() |- nand_scan_ident() |- nand_scan_tail() This means board_nand_init() is called before nand_scan_ident(). So NAND controller is initialized before the actual probing of NAND device. However some controller (like GPMC) need to be specifically configured for bus-width of NAND device. In such cases, bus-width of the NAND device should be known in advance of actual device probing. Hence, CONFIG_SPL_NAND_DEVICE_WIDTH is useful. (3) Non-ONFI compliant devices need some mechanism to specify device bus-width to driver. Signed-off-by: Pekon Gupta <pe...@ti.com> --- doc/README.nand | 9 +++++++++ drivers/mtd/nand/omap_gpmc.c | 14 ++++++++++---- include/configs/am335x_evm.h | 1 + include/configs/am335x_igep0033.h | 1 + include/configs/am3517_crane.h | 1 + include/configs/am3517_evm.h | 1 + include/configs/cm_t35.h | 1 + include/configs/devkit8000.h | 1 + include/configs/dig297.h | 1 + include/configs/mcx.h | 1 + include/configs/omap3_beagle.h | 1 + include/configs/omap3_evm_common.h | 2 +- include/configs/omap3_igep00x0.h | 1 + include/configs/omap3_logic.h | 1 + include/configs/omap3_overo.h | 1 + include/configs/omap3_pandora.h | 2 +- include/configs/omap3_zoom1.h | 1 + include/configs/omap3_zoom2.h | 1 + include/configs/siemens-am33x-common.h | 1 + include/configs/tam3517-common.h | 1 + include/configs/tricorder.h | 1 + 21 files changed, 38 insertions(+), 6 deletions(-) diff --git a/doc/README.nand b/doc/README.nand index b91f198..a07863a 100644 --- a/doc/README.nand +++ b/doc/README.nand @@ -190,6 +190,15 @@ Configuration Options: This is used by SoC platforms which do not have built-in ELM hardware engine required for BCH ECC correction. + CONFIG_SPL_NAND_DEVICE_WIDTH + Specifies bus-width of the default NAND device connected to SoC. + This config is useful for driver which cannot self initialize or + parse ONFI parameter (like SPL drivers), or for supporting non-ONFI + compliant devices. + This config can take following values: + - 8: x8 NAND devices is connected + - 16: x16 NAND device is connected + Platform specific options ========================= diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c index fae00be..1870152 100644 --- a/drivers/mtd/nand/omap_gpmc.c +++ b/drivers/mtd/nand/omap_gpmc.c @@ -861,13 +861,19 @@ int board_nand_init(struct nand_chip *nand) nand->priv = &bch_priv; nand->cmd_ctrl = omap_nand_hwcontrol; nand->options |= NAND_NO_PADDING | NAND_CACHEPRG; - /* If we are 16 bit dev, our gpmc config tells us that */ - if ((readl(&gpmc_cfg->cs[cs].config1) & 0x3000) == 0x1000) - nand->options |= NAND_BUSWIDTH_16; - nand->chip_delay = 100; nand->ecc.layout = &omap_ecclayout; + /* configure driver and controller based on NAND device bus-width */ + gpmc_config = readl(&gpmc_cfg->cs[cs].config1); + if (CONFIG_SPL_NAND_DEVICE_WIDTH == 16) { + nand->options |= NAND_BUSWIDTH_16; + writel(gpmc_config | (0x1 << 12), &gpmc_cfg->cs[cs].config1); + } else { + nand->options &= ~NAND_BUSWIDTH_16; + writel(gpmc_config & ~(0x1 << 12), &gpmc_cfg->cs[cs].config1); + } + /* select ECC scheme */ #if defined(CONFIG_NAND_OMAP_ECCSCHEME) err = omap_select_ecc_scheme(nand, CONFIG_NAND_OMAP_ECCSCHEME, diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 9ccbc20..5f5804e 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -228,6 +228,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 8 #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, \ diff --git a/include/configs/am335x_igep0033.h b/include/configs/am335x_igep0033.h index c00d54f..a776707 100644 --- a/include/configs/am335x_igep0033.h +++ b/include/configs/am335x_igep0033.h @@ -252,6 +252,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 8 #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, \ diff --git a/include/configs/am3517_crane.h b/include/configs/am3517_crane.h index 4407b45..9537bc5 100644 --- a/include/configs/am3517_crane.h +++ b/include/configs/am3517_crane.h @@ -334,6 +334,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 16 #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} diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h index 7f52ce4..47e0f0f 100644 --- a/include/configs/am3517_evm.h +++ b/include/configs/am3517_evm.h @@ -328,6 +328,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 8 #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} diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h index 52a1f05..0789bad 100644 --- a/include/configs/cm_t35.h +++ b/include/configs/cm_t35.h @@ -167,6 +167,7 @@ /* CS0 */ #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND */ /* devices */ +#define CONFIG_SPL_NAND_DEVICE_WIDTH 8 /* Environment information */ #define CONFIG_BOOTDELAY 3 #define CONFIG_ZERO_BOOTDELAY_CHECK diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h index 16a00eb..9379d39 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -319,6 +319,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 16 #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} diff --git a/include/configs/dig297.h b/include/configs/dig297.h index af6f56b..3333460 100644 --- a/include/configs/dig297.h +++ b/include/configs/dig297.h @@ -143,6 +143,7 @@ #define CONFIG_SYS_NAND_BASE NAND_BASE /* physical address */ /* to access nand at */ /* CS0 */ +#define CONFIG_SPL_NAND_DEVICE_WIDTH 16 #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND */ #if defined(CONFIG_CMD_NET) diff --git a/include/configs/mcx.h b/include/configs/mcx.h index dd4afb8..8074008 100644 --- a/include/configs/mcx.h +++ b/include/configs/mcx.h @@ -386,6 +386,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 8 #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,\ diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index 8127f87..0d36105 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -424,6 +424,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 16 #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} diff --git a/include/configs/omap3_evm_common.h b/include/configs/omap3_evm_common.h index 7f3424b..8a16d09 100644 --- a/include/configs/omap3_evm_common.h +++ b/include/configs/omap3_evm_common.h @@ -120,7 +120,7 @@ /* Max number of NAND devices */ #define CONFIG_SYS_MAX_NAND_DEVICE 1 - +#define CONFIG_SPL_NAND_DEVICE_WIDTH 16 /* Timeout values (in ticks) */ #define CONFIG_SYS_FLASH_ERASE_TOUT (100 * CONFIG_SYS_HZ) #define CONFIG_SYS_FLASH_WRITE_TOUT (100 * CONFIG_SYS_HZ) diff --git a/include/configs/omap3_igep00x0.h b/include/configs/omap3_igep00x0.h index 172c3a3..474c1c8 100644 --- a/include/configs/omap3_igep00x0.h +++ b/include/configs/omap3_igep00x0.h @@ -356,6 +356,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 8 #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} diff --git a/include/configs/omap3_logic.h b/include/configs/omap3_logic.h index 0d03c75..9f9035e 100644 --- a/include/configs/omap3_logic.h +++ b/include/configs/omap3_logic.h @@ -295,6 +295,7 @@ #if defined(CONFIG_CMD_NAND) #define CONFIG_NAND_OMAP_GPMC +#define CONFIG_SPL_NAND_DEVICE_WIDTH 16 #define CONFIG_ENV_IS_IN_NAND #define CONFIG_ENV_OFFSET SMNAND_ENV_OFFSET #endif diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h index 007e27f..e131d23 100644 --- a/include/configs/omap3_overo.h +++ b/include/configs/omap3_overo.h @@ -317,6 +317,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 16 #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} diff --git a/include/configs/omap3_pandora.h b/include/configs/omap3_pandora.h index da67787..de03a7e 100644 --- a/include/configs/omap3_pandora.h +++ b/include/configs/omap3_pandora.h @@ -133,7 +133,7 @@ /* at CS0 */ #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND */ /* devices */ - +#define CONFIG_SPL_NAND_DEVICE_WIDTH 8 #ifdef CONFIG_CMD_NAND #define CONFIG_CMD_MTDPARTS #define CONFIG_MTD_PARTITIONS diff --git a/include/configs/omap3_zoom1.h b/include/configs/omap3_zoom1.h index f0fa96e..82f16fb 100644 --- a/include/configs/omap3_zoom1.h +++ b/include/configs/omap3_zoom1.h @@ -140,6 +140,7 @@ /* CS0 */ #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND */ /* devices */ +#define CONFIG_SPL_NAND_DEVICE_WIDTH 16 #define CONFIG_JFFS2_NAND /* nand device jffs2 lives on */ #define CONFIG_JFFS2_DEV "nand0" diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h index 8b0ac3d..f145daa 100644 --- a/include/configs/omap3_zoom2.h +++ b/include/configs/omap3_zoom2.h @@ -159,6 +159,7 @@ /* to access nand at */ /* CS0 */ #define CONFIG_SYS_MAX_NAND_DEVICE 1 +#define CONFIG_SPL_NAND_DEVICE_WIDTH 16 /* Environment information */ #define CONFIG_BOOTDELAY 10 diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h index 018e22b..5200a5f 100644 --- a/include/configs/siemens-am33x-common.h +++ b/include/configs/siemens-am33x-common.h @@ -184,6 +184,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 8 #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, \ diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h index d3f9a4e..7e2ce8f 100644 --- a/include/configs/tam3517-common.h +++ b/include/configs/tam3517-common.h @@ -252,6 +252,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128 * 1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 16 #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,\ diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h index 62f97d2..d9a6215 100644 --- a/include/configs/tricorder.h +++ b/include/configs/tricorder.h @@ -364,6 +364,7 @@ #define CONFIG_SYS_NAND_PAGE_SIZE 2048 #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024) +#define CONFIG_SPL_NAND_DEVICE_WIDTH 8 #define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS #define CONFIG_SYS_NAND_ECCPOS {12, 13, 14, 15, 16, 17, 18, 19, 20,\ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,\ -- 1.8.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot