mtd: nand: omap: add CONFIG_SPL_NAND_DEVICE_WIDTH to determine NAND device bus-width
Subsystems (2)
PATCH 1/1 mtd: nand: omap: add CONFIG_SPL_NAND_DEVICE_WIDTH to determine NAND device bus-width
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.
--- 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(-)
doc/README.nand +9 -0
@@ -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 =========================
drivers/mtd/nand/omap_gpmc.c +10 -4
@@ -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,
include/configs/am335x_evm.h +1 -0
@@ -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, \
include/configs/am335x_igep0033.h +1 -0
@@ -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, \
include/configs/am3517_crane.h +1 -0
@@ -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}
include/configs/am3517_evm.h +1 -0
@@ -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}
include/configs/cm_t35.h +1 -0
@@ -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
include/configs/devkit8000.h +1 -0
@@ -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}
include/configs/dig297.h +1 -0
@@ -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 )
include/configs/mcx.h +1 -0
@@ -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,\
include/configs/omap3_beagle.h +1 -0
@@ -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}
include/configs/omap3_evm_common.h +1 -1
@@ -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)
include/configs/omap3_igep00x0.h +1 -0
@@ -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}
include/configs/omap3_logic.h +1 -0
@@ -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
include/configs/omap3_overo.h +1 -0
@@ -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}
include/configs/omap3_pandora.h +1 -1
@@ -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
include/configs/omap3_zoom1.h +1 -0
@@ -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"
include/configs/omap3_zoom2.h +1 -0
@@ -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
include/configs/siemens-am33x-common.h +1 -0
@@ -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, \
include/configs/tam3517-common.h +1 -0
@@ -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,\
include/configs/tricorder.h +1 -0
@@ -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,\
Signature · 1 line
1.8.1
PATCH 1/1 mtd: nand: omap: add CONFIG_SPL_NAND_DEVICE_WIDTH to determine NAND device bus-width
Hi Pekon,
Just a comment for OMAP3-based IGEP boards, see below ...
2013/12/5 Pekon Gupta <[email protected]>:
Quoted 221 lines
This patch adds
CONFIG_SPL_NAND_DEVICE_WIDTHto specify bus-width of NAND device
CONFIG_SPL_NAND_DEVICE_WIDTH== 16: NAND device with x16 bus-widthCONFIG_SPL_NAND_DEVICE_WIDTH== 8: NAND device with x8 bus-widthNeed for a separate
CONFIG_xxarise 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 beforenand_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_WIDTHis useful.(3) Non-ONFI compliant devices need some mechanism to specify device bus-width to driver.
Signed-off-by Pekon Gupta <[email protected]>--- 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(-)doc/README.nand +9
-0@@ -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 =========================drivers/mtd/nand/omap_gpmc.c +10
-4@@ -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,include/configs/am335x_evm.h +1
-0@@ -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, \include/configs/am335x_igep0033.h +1
-0@@ -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, \include/configs/am3517_crane.h +1
-0@@ -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}include/configs/am3517_evm.h +1
-0@@ -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}include/configs/cm_t35.h +1
-0@@ -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 include/configs/devkit8000.h +1
-0@@ -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}include/configs/dig297.h +1
-0@@ -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 )include/configs/mcx.h +1
-0@@ -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,\include/configs/omap3_beagle.h +1
-0@@ -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}include/configs/omap3_evm_common.h +1
-1@@ -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)include/configs/omap3_igep00x0.h +0
-0
include/configs/omap3_igep00x0.h line 359
Quoted 4 lines
include/configs/omap3_igep00x0.h +1
-0@@ -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
The device width for OMAP3-based IGEP boards is 16 not 8
Quoted 103 lines
include/configs/omap3_igep00x0.h +0
-0#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}include/configs/omap3_logic.h +1
-0@@ -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 include/configs/omap3_overo.h +1
-0@@ -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}include/configs/omap3_pandora.h +1
-1@@ -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 include/configs/omap3_zoom1.h +1
-0@@ -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"include/configs/omap3_zoom2.h +1
-0@@ -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 10include/configs/siemens-am33x-common.h +1
-0@@ -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, \include/configs/tam3517-common.h +1
-0@@ -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,\include/configs/tricorder.h +1
-1@@ -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
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Best regards,
Enric
PATCH 1/1 mtd: nand: omap: add CONFIG_SPL_NAND_DEVICE_WIDTH to determine NAND device bus-width
In reply to Pekon GuptaQuoted 6 lines · Pekon Gupta
This patch adds
CONFIG_SPL_NAND_DEVICE_WIDTHto specify bus-width of NAND device
CONFIG_SPL_NAND_DEVICE_WIDTH== 16: NAND device with x16 bus-widthCONFIG_SPL_NAND_DEVICE_WIDTH== 8: NAND device with x8 bus-widthNeed for a separate
CONFIG_xxarise from following situations.
(1) SPL NAND drivers does not have framework to parse ONFI parameter page.
Yes, at least for smaller SPLs.
Quoted 11 lines
(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 beforenand_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_WIDTHis useful.
See below.
Quoted 2 lines
(3) Non-ONFI compliant devices need some mechanism to specify device bus-width to driver.
Does an x8 "READ ID" work with non-ONFI devices? If not, you need something, and I suppose you need to hardcode whether an ONFI device is present -- but for non-SPL it's better to do it in a way that is per-device, such as having board code initialize certain registers. If you really want to do it this way, though, there's already a variable for this: CONFIG_SYS_NAND_BUSWIDTH_16BIT
Just be sure to update the documentation to add to the list of drivers that care about that symbol.
Quoted 31 lines
Signed-off-by Pekon Gupta <[email protected]>--- 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(-)doc/README.nand +0
-0@@ -190,6 +190,15 @@ Configuration Options: This is used by SoC platforms which do not have built-in ELM
doc/README.nand Configuration Options: · line 200
Quoted 10 lines
doc/README.nand +8
-0hardware 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
I don't understand "cannot self initialize". I understand "doesn't currently self initialize", but if that's causing a problem then why not convert the driver to use self-init?
SPL is a different situation as it typically doesn't have dynamic ID code at all (as opposed to the question of whether driver code can be inserted between nand_scan_ident and nand_scan_tail).
Quoted 16 lines
doc/README.nand +0
-0Platform specific options =========================drivers/mtd/nand/omap_gpmc.c +0
-4@@ -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;
drivers/mtd/nand/omap_gpmc.c int board_nand_init(struct nand_chip *nand) · line 875
Quoted 10 lines
drivers/mtd/nand/omap_gpmc.c +9
-0+/* 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); + }
This doesn't appear to be limited to SPL, or even to (SPL || non-ONFI).
-Scott