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.

AM6442: U-BOOT not detecting NAND

Part Number: AM6442


Hello,

I'm using a ONFI 2.2 compliant NAND with page size of 8KB and total size of 4GB which is larger than what the TRM specifies (4.4.10 GPMC NAND boot max 4KB page and 2GB total). Disabling ELM and using software ECC allows proper functionality both in u-boot and kernel when booting from SD card.

The problem I'm seeing is that when trying to boot from GPMC-NAND, the chip goes directly to secondary boot option without any message or errors regarding NAND. Is this normal and the expected behavior given the larger size NAND or there's still hope from booting from it?

Thank you.

  • Hi Mehdi,
    What do we have when you run "nand info" @u-boot prompt when u-boot booted from any working boot media on your board?
    Best,
    -Hong

  • Hi Hong,

    here's the output, also added mtd list:

    SoC: AM64X SR1.0
    DRAM: 512 MiB
    NAND: 4096 MiB
    MMC: mmc@fa00000: 1
    In: serial@2800000
    Out: serial@2800000
    Err: serial@2800000
    Net: eth0: ethernet@8000000port@1, eth1: ethernet@8000000port@2
    Hit any key to stop autoboot: 0
    => nand info

    Device 0: nand0, sector size 1024 KiB
    Page size 8192 b
    OOB size 448 b
    Erase size 1048576 b
    subpagesize 2048 b
    options 0x0000400c
    bbt options 0x00000000
    =>
    => mtd list
    List of MTD devices:
    * nand0
    - type: NAND flash
    - block size: 0x100000 bytes
    - min I/O: 0x2000 bytes
    - OOB size: 448 bytes
    - OOB available: 238 bytes
    - ECC strength: 8 bits
    - ECC step size: 512 bytes
    - bitflip threshold: 6 bits
    - 0x000000000000-0x000100000000 : "nand0"
    - 0x000000000000-0x000000200000 : "NAND.tiboot3"
    - 0x000000200000-0x000000400000 : "NAND.tispl"
    - 0x000000400000-0x000000600000 : "NAND.tiboot3.backup"
    - 0x000000600000-0x000000a00000 : "NAND.u-boot"
    - 0x000000a00000-0x000000b00000 : "NAND.u-boot-env"
    - 0x000000b00000-0x000000c00000 : "NAND.u-boot-env.backup"
    - 0x000000c00000-0x000100000000 : "NAND.file-system"
    =>

    Regards,

    Mehdi

  • Hi,

    It looks like the ROM Boot loader enables ELM for NAND usage, could this be what is stopping the boot from this large page NAND?, if this is the case, why there is no error messages on the UART0 console?

    Thank you.

  • Hi Mehdi,
    I'm looping in my colleague on bootrom policy on NAND BCH scheme.
    Best,
    -Hong

  • Hi Mehdi,
    As you tested, it looks functional to support the NAND in u-boot and kernel. But it seems like not-compatible with bootrom as stated in the TRM.
    >>>> 4.4.10 GPMC NAND Boot in AM64xx TRM
    GPMC NAND Boot Configuration Fields
    AM64x ROM only supports boot from ONFI 1.0 compatible 8 bit parallel NAND memory up to 2Gbytes in size connected to GPMC CS0 with the following geometries:
    • 2Kbyte page and spare area of at least 64 bytes or
    • 4Kbyte page size and spare area of at least 128 bytes.
    >>>>

    Best,
    -Hong

  • Hi Hong,

    Is it normal that ROM boot loader is not issuing any messages wrt not being able to boot from NAND?.

    Also, I hope TI upgrades its ELM silicon IP that is very limited: only 4K pages and only BCH16. Nowadays even small microcontrollers have higher capabilities for HW NAND support (page sizes and ECC HW algos).

    Thank you. 

  • Hi Mehdi, the ROM bootloader does not issue any error messages via UART.  The raw NAND boot support is intentionally limited in favor of more popular boot methods such as OSPI or eMMC.  I don't think you will be able to boot from this device since it is outside the listed limitations for device capacity.

    Regards,

    james  

  • Understood, thank you James for confirming this.

  • James,

    I'm trying to make sure by replacing the NAND with smaller size I will be bale to boot from it. Looking at uboot arch/arm/mach-k3/sysfw-loader.c, in function k3_sysfw_loader, it does not seem to support NAND, I see MMC, SPI, UART, DFU and USB only.

    Am I understanding this correctly: TI does not support booting from NAND?. I suppose we can add within the switch case of sysfw-loader.c the case for NAND and call spl_ubi_load_image in common/spl/spl_ubi.c: is TI planning to add this in the future mod to sysfw-loader.c?

    Thank you,

    Mehdi

  • Hi Mehdi,
    R5 SPL booting from the primary boot media, i.e., NAND, needs to be compliant to bootrom as stated in 4.4.10 GPMC NAND Boot of the TRM.
    In fact, NAND booting support is added in Linux SDK 8.2.
    I'm attaching two log files I captured using SDK 8.2 on AM64x GP EVM + TI NAND daughter card for your reference.

    NAND:  1024 MiB
    
    => nand info
    Device 0: nand0, sector size 256 KiB
      Page size       4096 b
      OOB size         256 b
      Erase size    262144 b
      subpagesize     1024 b
      options     0x0000400c
      bbt options 0x00000000

    Best,

    -Hong

    U-Boot SPL 2021.01-g44a87e3ab8 (Mar 30 2022 - 16:29:38 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0016 '22.1.1--v2022.01 (Terrific Llam')
    SPL initial stack usage: 13392 bytes
    Reading daughtercard EEPROM at 0x52 failed -1
    Trying to boot from MMC2
    Starting ATF on ARM64 core...
    
    NOTICE:  BL31: v2.5(release):08.01.00.006-dirty
    NOTICE:  BL31: Built : 16:24:35, Mar 30 2022
    
    U-Boot SPL 2021.01-g44a87e3ab8 (Mar 30 2022 - 16:28:20 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0016 '22.1.1--v2022.01 (Terrific Llam')
    Reading daughtercard EEPROM at 0x52 failed -1
    Trying to boot from MMC2
    
    
    U-Boot 2021.01-g44a87e3ab8 (Mar 30 2022 - 16:28:20 +0000)
    
    SoC:   AM64X SR1.0
    Model: Texas Instruments AM642 EVM
    Board: AM64-GPEVM rev E2
    DRAM:  2 GiB
    NAND:  1024 MiB
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    In:    serial@2800000
    Out:   serial@2800000
    Err:   serial@2800000
    Reading daughtercard EEPROM at 0x52 failed -1
    Net:   eth0: ethernet@8000000port@1
    Hit any key to stop autoboot:  2  0 
    => mmc rescan
    => ls mmc 1
       569866   tiboot3.bin
       687616   FSCK0000.REC
       848243   tispl.bin
         1532   uEnv.txt
       131072   uboot.env
            1   .psdk_setup
                System Volume Information/
                8.1_gp/
         1490   uEnv_bkup.txt
                8.0_gp/
      1116639   u-boot.img
                7.3.0_gp/
                .Trash-1000/
                8.2_gp/
                7.3.1_gp/
    
    8 file(s), 7 dir(s)
    
    => nand info
    
    Device 0: nand0, sector size 256 KiB
      Page size       4096 b
      OOB size         256 b
      Erase size    262144 b
      subpagesize     1024 b
      options     0x0000400c
      bbt options 0x00000000
    => nand erase.chip
    
    NAND erase.chip: device 0 whole chip
    Erasing at 0x0 --   0% complete.Erasing at 0xa00000 --   1% complete.Erasing at 0x1440000 --   2% complete.Erasing at 0x1e80000 --   3% complete.Erasing at 0x28c0000 --   4% complete.Erasing at 0x3300000 --   5% complete.Erasing at 0x3d40000 --   6% complete.Erasing at 0x4780000 --   7% complete.Erasing at 0x51c0000 --   8% complete.Erasing at 0x5c00000 --   9% complete.Erasing at 0x6640000 --  10% complete.Erasing at 0x7080000 --  11% complete.Erasing at 0x7ac0000 --  12% complete.Erasing at 0x8500000 --  13% complete.Erasing at 0x8f40000 --  14% complete.Erasing at 0x9980000 --  15% complete.Erasing at 0xa3c0000 --  16% complete.Erasing at 0xae00000 --  17% complete.Erasing at 0xb840000 --  18% complete.Erasing at 0xc280000 --  19% complete.Erasing at 0xccc0000 --  20% complete.Erasing at 0xd700000 --  21% complete.Erasing at 0xe140000 --  22% complete.Erasing at 0xeb80000 --  23% complete.Erasing at 0xf5c0000 --  24% complete.Erasing at 0xffc0000 --  25% complete.Erasing at 0x10a00000 --  26% complete.Erasing at 0x11440000 --  27% complete.Erasing at 0x11e80000 --  28% complete.Erasing at 0x128c0000 --  29% complete.Erasing at 0x13300000 --  30% complete.Erasing at 0x13d40000 --  31% complete.Erasing at 0x14780000 --  32% complete.Erasing at 0x151c0000 --  33% complete.Erasing at 0x15c00000 --  34% complete.Erasing at 0x16640000 --  35% complete.Erasing at 0x17080000 --  36% complete.Erasing at 0x17ac0000 --  37% complete.Erasing at 0x18500000 --  38% complete.Erasing at 0x18f40000 --  39% complete.Erasing at 0x19980000 --  40% complete.Erasing at 0x1a3c0000 --  41% complete.Erasing at 0x1ae00000 --  42% complete.Erasing at 0x1b840000 --  43% complete.Erasing at 0x1c280000 --  44% complete.Erasing at 0x1ccc0000 --  45% complete.Erasing at 0x1d700000 --  46% complete.Erasing at 0x1e140000 --  47% complete.Erasing at 0x1eb80000 --  48% complete.Erasing at 0x1f5c0000 --  49% complete.Erasing at 0x1ffc0000 --  50% complete.Erasing at 0x20a00000 --  51% complete.Erasing at 0x21440000 --  52% complete.Erasing at 0x21e80000 --  53% complete.Erasing at 0x228c0000 --  54% complete.Erasing at 0x23300000 --  55% complete.Erasing at 0x23d40000 --  56% complete.Erasing at 0x24780000 --  57% complete.Erasing at 0x251c0000 --  58% complete.Erasing at 0x25c00000 --  59% complete.Erasing at 0x26640000 --  60% complete.Erasing at 0x27080000 --  61% complete.Erasing at 0x27ac0000 --  62% complete.Erasing at 0x28500000 --  63% complete.Erasing at 0x28f40000 --  64% complete.Erasing at 0x29980000 --  65% complete.Erasing at 0x2a3c0000 --  66% complete.Erasing at 0x2ae00000 --  67% complete.Erasing at 0x2b840000 --  68% complete.Erasing at 0x2c280000 --  69% complete.Erasing at 0x2ccc0000 --  70% complete.Erasing at 0x2d700000 --  71% complete.Erasing at 0x2e140000 --  72% complete.Erasing at 0x2eb80000 --  73% complete.Erasing at 0x2f5c0000 --  74% complete.Erasing at 0x2ffc0000 --  75% complete.Erasing at 0x30a00000 --  76% complete.Erasing at 0x31440000 --  77% complete.Erasing at 0x31e80000 --  78% complete.Erasing at 0x328c0000 --  79% complete.Erasing at 0x33300000 --  80% complete.Erasing at 0x33d40000 --  81% complete.Erasing at 0x34780000 --  82% complete.Erasing at 0x351c0000 --  83% complete.Erasing at 0x35c00000 --  84% complete.Erasing at 0x36640000 --  85% complete.Erasing at 0x37080000 --  86% complete.Erasing at 0x37ac0000 --  87% complete.Erasing at 0x38500000 --  88% complete.Erasing at 0x38f40000 --  89% complete.Erasing at 0x39980000 --  90% complete.Erasing at 0x3a3c0000 --  91% complete.Erasing at 0x3ae00000 --  92% complete.Erasing at 0x3b840000 --  93% complete.Erasing at 0x3c280000 --  94% complete.Erasing at 0x3ccc0000 --  95% complete.Erasing at 0x3d700000 --  96% complete.Erasing at 0x3e140000 --  97% complete.Erasing at 0x3eb80000 --  98% complete.Erasing at 0x3f5c0000 --  99% complete.Erasing at 0x3ffc0000 -- 100% complete.
    OK
    => load mmc 1 ${loadaddr} tiboot3.bin
    569866 bytes read in 28 ms (19.4 MiB/s)
    => nand write ${loadaddr} 0x0 ${filesize}
    
    NAND write: device 0 offset 0x0, size 0x8b20a
     569866 bytes written: OK
    => load mmc 1 ${loadaddr} tispl.bin
    848243 bytes read in 41 ms (19.7 MiB/s)
    => nand write ${loadaddr} 0x200000 ${filesize}
    
    NAND write: device 0 offset 0x200000, size 0xcf173
     848243 bytes written: OK
    => load mmc 1 ${loadaddr} u-boot.img
    1116639 bytes read in 54 ms (19.7 MiB/s)
    => nand write ${loadaddr} 0x600000 ${filesize}
    
    NAND write: device 0 offset 0x600000, size 0x1109df
     1116639 bytes written: OK
    => 

    U-Boot SPL 2021.01-g44a87e3ab8 (Mar 30 2022 - 16:29:38 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0016 '22.1.1--v2022.01 (Terrific Llam')
    SPL initial stack usage: 13392 bytes
    Reading daughtercard EEPROM at 0x52 failed -1
    Trying to boot from NAND
    init_env from device 11 not supported!
    Starting ATF on ARM64 core...
    
    NOTICE:  BL31: v2.5(release):08.01.00.006-dirty
    NOTICE:  BL31: Built : 16:24:35, Mar 30 2022
    
    U-Boot SPL 2021.01-g44a87e3ab8 (Mar 30 2022 - 16:28:20 +0000)
    SYSFW ABI: 3.1 (firmware rev 0x0016 '22.1.1--v2022.01 (Terrific Llam')
    Reading daughtercard EEPROM at 0x52 failed -1
    Trying to boot from NAND
    
    
    U-Boot 2021.01-g44a87e3ab8 (Mar 30 2022 - 16:28:20 +0000)
    
    SoC:   AM64X SR1.0
    Model: Texas Instruments AM642 EVM
    Board: AM64-GPEVM rev E2
    DRAM:  2 GiB
    NAND:  1024 MiB
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    In:    serial@2800000
    Out:   serial@2800000
    Err:   serial@2800000
    Reading daughtercard EEPROM at 0x52 failed -1
    Net:   eth0: ethernet@8000000port@1
    Hit any key to stop autoboot:  2  0 
    => 

  • Hello Hong,

    Understood. I really appreciate the time you took to run this on your setup. I got worried when I looked at the code in uboot's sysfw-loader.c, but from what you showed above it is being loaded from NAND.

    Thank you for all your help guys.

  • Hi Mehdi,
    For your reference, here is AM64x boot flow
    software-dl.ti.com/.../UG-General-Info.html
    - tiboot3.bin = R5 SPL.bin + DTBs + sysfw.bin + cfg
    - tiboot3.bin loading from boot media (i.e. NAND) to onchip RAM is done by bootrom, and for this step, NAND layout has to compliant 4.4.10 GPMC NAND Boot of the TRM.
    Best,
    -Hong

  • Thank you Hong, that was my confusing indeed: all of tiboot3.bin is loaded at once. OK, we will proceed with replacing the NAND with a smaller page part and it should work. Thanks again.