This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

NAND code in Processor SDK

Hi,

                     How to enable NAND driver in u-boot in Processor SDK. I have enabled CONFIG_NAND and added the below lines in ti_armv7_common.h

#define CONFIG_NAND_OMAP_GPMC
#ifndef CONFIG_SYS_NAND_BASE
#define CONFIG_SYS_NAND_BASE        0x8000000
#endif
#define CONFIG_SYS_MAX_NAND_DEVICE    1
#define CONFIG_CMD_NAND
#define CONFIG_MTD_DEVICE        /* Required for mtdparts */
#define CONFIG_CMD_MTDPARTS

But still in u-boot prompt when i am executing mtdparts command i am getting nothing.

Thanks & Regards,

Ganesh

  • Hi Ganesh,

    I can not see in your code configuration of maximum number of NAND chips per device CONFIG_SYS_NAND_MAX_CHIPS but you can find more details about how to init NAND device in the ./doc/README.nand file of u-boot documentation.

    BR
    Tsvetolin Shulev
  • Hi,
    I am using this am57xx_evm_defconfig config file for building, in which file i need to set the macros is it ti_armv7_common.h file only in processor SDK?


    Thanks & Regards,
    Ganesh

  • Hi,

    I have enabled NAND but by adding all these macros

    #define CONFIG_AM57XX
    #ifndef CONFIG_SYS_NAND_BASE
    #define CONFIG_SYS_NAND_BASE 0x8000000
    #endif
    #define CONFIG_SYS_MAX_NAND_DEVICE 1
    #define CONFIG_SYS_NAND_MAX_CHIPS 1
    #define CONFIG_MTD_DEVICE /* Required for mtdparts */
    #define CONFIG_CMD_MTDPARTS
    #define CONFIG_BCH
    #define CONFIG_CMD_SPL_NAND_OFS 0x00080000 /* os-boot params*/
    #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */
    #define CONFIG_CMD_SPL_WRITE_SIZE 0x2000


    #define CONFIG_SPL_NAND_SUPPORT
    #define CONFIG_SPL_NAND_BASE
    #define CONFIG_SPL_NAND_DRIVERS
    #define CONFIG_SPL_NAND_ECC
    #define CONFIG_SPL_MTD_SUPPORT
    #ifdef CONFIG_SPL_BUILD
    #define CONFIG_IODELAY_RECALIBRATION
    #endif

    /* NAND support */
    /* NAND: device related configs */
    #define CONFIG_SYS_NAND_PAGE_SIZE 2048
    #define CONFIG_SYS_NAND_OOBSIZE 64
    #define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
    #define CONFIG_SYS_NAND_BUSWIDTH_16BIT
    #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
    CONFIG_SYS_NAND_PAGE_SIZE)
    #define CONFIG_SYS_NAND_5_ADDR_CYCLE
    /* NAND: driver related configs */
    #define CONFIG_NAND_OMAP_GPMC
    #define CONFIG_NAND_OMAP_ELM
    #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, \
    26, 27, 28, 29, 30, 31, 32, 33, \
    34, 35, 36, 37, 38, 39, 40, 41, \
    42, 43, 44, 45, 46, 47, 48, 49, \
    50, 51, 52, 53, 54, 55, 56, 57, }
    #define CONFIG_SYS_NAND_ECCSIZE 512
    #define CONFIG_SYS_NAND_ECCBYTES 14
    #define MTDIDS_DEFAULT "nand0=nand.0"
    #define MTDPARTS_DEFAULT "mtdparts=nand.0:" \
    "128k(NAND.SPL)," \
    "128k(NAND.SPL.backup1)," \
    "128k(NAND.SPL.backup2)," \
    "128k(NAND.SPL.backup3)," \
    "256k(NAND.u-boot-spl-os)," \
    "1m(NAND.u-boot)," \
    "128k(NAND.u-boot-env)," \
    "128k(NAND.u-boot-env.backup1)," \
    "8m(NAND.kernel)," \
    "-(NAND.file-system)"
    #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x000c0000
    /* NAND: SPL related configs */
    #ifdef CONFIG_SPL_NAND_SUPPORT
    #define CONFIG_SPL_NAND_AM33XX_BCH
    #endif
    /* NAND: SPL falcon mode configs */
    #ifdef CONFIG_SPL_OS_BOOT
    #define CONFIG_CMD_SPL_NAND_OFS 0x00080000 /* os-boot params*/
    #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */
    #define CONFIG_CMD_SPL_WRITE_SIZE 0x2000
    #endif
    /* !CONFIG_NAND */


    But while accessing nand i am getting problems like these,

    U-Boot# mtdparts
    mtdparts variable not set, see 'help mtdparts'
    no partitions defined

    defaults:
    mtdids : nand0=nand.0
    mtdparts: mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND)


    U-Boot# nand write 0x81000000 NAND.SPL

    NAND write: mtdparts variable not set, see 'help mtdparts'
    incorrect device type in NAND.SPL


    Thanks & Regards,
    Ganesh