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.

configuring u-boot and linux for NAND device

Other Parts Discussed in Thread: AM3352

I'm getting ready to bring up a new board AM3352 based board with the following NAND device. 

Macronix MX30LF2G28AB 

Datasheet: http://www.macronix.com/Lists/DataSheet/Attachments/1697/MX30LF2G28AB,%203V,%202Gb,%20v1.1.pdf

The device is ONFI compliant and it's unclear to me what if anything I need to do to my u-boot configuration to support this device. 

For instance do I need to configure any of these defines in my board configuration header file? 

CONFIG_SYS_NAND_BAD_BLOCK_POS
CONFIG_SYS_NAND_ECCPOS
CONFIG_SYS_NAND_ECCSIZE
CONFIG_SYS_NAND_ECCBYTES 

Since the device has an oob area of 112b which appears to be non-standard it would seem that I do need to configure something but it's not really clear to me what. 

Thanks, 
Matt S. 

  • Hi Matthew,

    I give you a steps which way to flash the NAND on the AM335x GP EVM with the SDK 07.00.00.00:
    You have to run the board from sd-card and stop on the u-boot. The "Boot Switch Settings" you can switch to sd-card.

    U-Boot# nand erase.chip

    NAND erase.chip: device 0 whole chip
    Erasing at 0xffe0000 -- 100% complete.
    OK
    U-Boot# mmc rescan
    U-Boot# fatls mmc 0
       107920   mlo
       389768   u-boot.img
           13   .ipaddr
        41564   devicetree-zimage-am335x-evm.dtb
      4117616   zimage
     32768000   arago-base-tisdk-image-am335x-evm.ubi

    6 file(s), 0 dir(s)

    U-Boot# fatload mmc 0 0x81000000 MLO
    reading MLO
    107920 bytes read in 10 ms (10.3 MiB/s)
    U-Boot# cp.b 0x81000000 0x81020000 20000; cp.b 0x81000000 0x81040000 20000; cp.b 0x81000000 0x81060000 20000
    U-Boot# fatload mmc 0 0x81080000 devicetree-zimage-am335x-evm.dtb
    reading devicetree-zimage-am335x-evm.dtb
    41564 bytes read in 8 ms (5 MiB/s)
    U-Boot# fatload mmc 0 0x810c0000 u-boot.img
    reading u-boot.img
    389768 bytes read in 28 ms (13.3 MiB/s)
    U-Boot# fatload mmc 0 0x81200000 zImage
    reading zImage
    4117616 bytes read in 258 ms (15.2 MiB/s)
    U-Boot# fatload mmc 0 0x81a00000 arago-base-tisdk-image-am335x-evm.ubi
    reading arago-base-tisdk-image-am335x-evm.ubi
    32768000 bytes read in 2039 ms (15.3 MiB/s)
    U-Boot# nand write 0x81000000 0x0 0x2950000

    NAND write: device 0 offset 0x0, size 0x2950000
     43319296 bytes written: OK

    Now the "Boot Switch Settings" you can switch to nand boot.

    BR

    Ivan

  • Thanks for trying Ivan but your response has nothing to do with my question, could you please reread the question and try to answer it or forwarding it on to someone that can. 

    To reiterate I'm looking for advice on how to modify U-boot and Linux to support a new flash part on a custom board. 

    Thanks,

    Matt

  • NAND should be supported without any software modifications.

  • Biser,

    Not all NAND is the same. 

    The NAND that has been chosen for this board has an out of bound region size of 112 bytes which is different from that of the EVM, this affects the ECC scheme and some of the configuration options for U-BOOT, the SPL, and I think the MTD drivers for Linux. 

    Specifically the defines I listed, which can be found in the board config files e.g. u-boot/include/configs/am335x_evm.h, appear to affect how the SPL stores or interprets the ECC data in the OOB area. 

    There is additional code in u-boot/drivers/mtd/nand_base.c that I think also needs to be modified and possibly something in the linux code. 

    I think I've figured out that CONFIG_SYS_NAND_BAD_BLOCK_POS should be NAND_LARGE_BADBLOCK_POS. 

    Also I believe that CONFIG_SYS_NAND_ECCSIZE should be 512. 

    What I'm not sure about is CONFIG_SYS_NAND_ECCBYTES and CONFIG_SYS_NAND_ECCPOS, I think these have to do with how many bytes or bits need to be allocated to ECC but I don't know how to figure them out. Basically I think these 2 parameters describe how many bytes of the OOB region are for ECC and where they are located in the region. 

    There are similar parameters in u-boot/drivers/mtd/nand/nand_base.c, in structure form, but what's interesting is the locations of the ECC data don't seem to match, at least not for the AM335x_EVM configuration. 

    I did notice that the data data sheet for the part states "The product family requires 8-bit ECC per (512+28)B" but I'm not sure how to relate that to these settings. 

    This tech note from Macronix seems to answer part of the puzzle but the numbers don't seem to add up and I'd like to understand whats going on. 

    http://www.macronix.com/Lists/ApplicationNote/Attachments/761/AN0296V2-How%20to%20handle%20the%20spare-byte%20area%20of%20Macronix%20N36%20NAND%20Flash-0918-new.pdf

    One thing that might help is if I had the part number for the NAND used on the AM335x_EVM, but I have had trouble finding that. 

    Thanks,
    Matt S. 

  • So you can't give any useful advice? 

    Matt S.