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.

[FAQ] How to flash and boot u-boot from parallel GPMC NAND on AM62x

Part Number: AM625
Other Parts Discussed in Thread: SK-AM62-LP

Tool/software:

AM62x boot rom supports booting from parallel GPMC NAND.
From "5.4.9.1 GPMC NAND Bootloader Operation" in AM62x TRM
"GPMC NAND boot 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.
• Non-ECC part only:
– ROM uses ELM to handle ECC
– ECC is BCH8 using D[7:0] for data
– The param page CRC is checked and in case of failure the redundant page is used"

Please refer to AM62x TRM "Chapter 5 Initialization" for details on GPMC NAND support by boot rom.

The FAQ lists how to flash and boot u-boot from GPMC NAND on SK-AM62-LP board [1] and [2] with AM62x Linux SDK 10.0.7.4 [3]
[1]. SK-AM62-LP board https://www.ti.com/tool/SK-AM62-LP
[2]. TI internal NAND card (PROC143E1)
[3]. https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-AM62X/10.00.07.04

  • Flashing u-boot to NAND:
    - configure BOOTMODE pins as MMC boot mode: BOOTMODE[15:0] = 0243
    - power on the board
    - stop @u-boot prompt
    - run u-boot cmds as listed in the log file to flash u-boot binary (tiboot3.bin/tispl.bin/u-boot.img) to NAND
    - the log file: am62-lpsk_10.0.7.4_nand_flash.log

    Special note on building R5-SPL for booting it from NAND
    - build R5-SPL with the "am62x_lpsk_r5_gpmc_defconfig" as the default defconfig "am62x_lpsk_r5_defconfig" cannot be extended to support NAND due to SRAM size limitations.
    - I renamed it as "tiboot3-gpmc.bin" which was built with "am62x_lpsk_r5_gpmc_defconfig", and flashed it to NAND as shown in the log.

    Booting u-boot from NAND:
    - reconfigure BOOTMODE pins as NAND boot mode: BOOTMODE[15:0] = 025B
    - power on the board
    - the log file: am62-lpsk_10.0.7.4_nand_boot.log

     

    am62-lpsk_10.0.7.4_nand_flash.log
    U-Boot SPL 2024.04-ti-gfda88f8bcea3 (Jul 26 2024 - 11:00:12 +0000)
    SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
    SPL initial stack usage: 13392 bytes
    Trying to boot from MMC2
    Authentication passed
    Authentication passed
    Authentication passed
    Authentication passed
    Authentication passed
    Starting ATF on ARM64 core...
    
    NOTICE:  BL31: v2.10.0(release):v2.10.0-367-g00f1ec6b87-dirty
    NOTICE:  BL31: Built : 16:09:05, Feb  9 2024
    
    U-Boot SPL 2024.04-ti-gfda88f8bcea3 (Jul 26 2024 - 11:00:12 +0000)
    SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
    SPL initial stack usage: 1904 bytes
    Trying to boot from MMC2
    Authentication passed
    Authentication passed
    
    
    U-Boot 2024.04-ti-gfda88f8bcea3 (Jul 26 2024 - 11:00:12 +0000)
    
    SoC:   AM62X SR1.0 HS-FS
    Model: Texas Instruments AM62x LP SK
    EEPROM not available at 0x50, trying to read at 0x51
    Board: AM62-LP-SKEVM rev E2
    DRAM:  2 GiB
    Core:  83 devices, 32 uclasses, devicetree: separate
    NAND:  1024 MiB
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from nowhere... OK
    In:    serial
    Out:   serial
    Err:   serial
    Net:   eth0: ethernet@8000000port@1
    Hit any key to stop autoboot:  2  0 
    => md.l 0x43000030 1
    43000030: 00000243                             C...
    => mtd list
    List of MTD devices:
    * nand0
      - device: nand@0,0
      - parent: memory-controller@3b000000
      - driver: gpmc-nand
      - path: /bus@f0000/memory-controller@3b000000/nand@0,0
      - type: NAND flash
      - block size: 0x40000 bytes
      - min I/O: 0x1000 bytes
      - OOB size: 128 bytes
      - OOB available: 142 bytes
      - ECC strength: 8 bits
      - ECC step size: 512 bytes
      - bitflip threshold: 6 bits
      - 0x000000000000-0x000040000000 : "nand0"
    	  - 0x000000000000-0x000000200000 : "NAND.tiboot3"
    	  - 0x000000200000-0x000000400000 : "NAND.tispl"
    	  - 0x000000400000-0x000000600000 : "NAND.tiboot3.backup"
    	  - 0x000000600000-0x000000a00000 : "NAND.u-boot"
    	  - 0x000000a00000-0x000000a40000 : "NAND.u-boot-env"
    	  - 0x000000a40000-0x000000a80000 : "NAND.u-boot-env.backup"
    	  - 0x000000a80000-0x000040000000 : "NAND.file-system"
    * spi-nand0
      - device: flash@0
      - parent: spi@fc40000
      - driver: spi_nand
      - path: /bus@f0000/bus@fc00000/spi@fc40000/flash@0
      - type: NAND flash
      - block size: 0x40000 bytes
      - min I/O: 0x1000 bytes
      - OOB size: 128 bytes
      - OOB available: 80 bytes
      - 0x000000000000-0x000008000000 : "spi-nand0"
    	  - 0x000000000000-0x000000080000 : "ospi_nand.tiboot3"
    	  - 0x000000080000-0x000000280000 : "ospi_nand.tispl"
    	  - 0x000000280000-0x000000680000 : "ospi_nand.u-boot"
    	  - 0x000000680000-0x0000006c0000 : "ospi_nand.env"
    	  - 0x0000006c0000-0x000000700000 : "ospi_nand.env.backup"
    	  - 0x000002000000-0x000007fc0000 : "ospi_nand.rootfs"
    	  - 0x000007fc0000-0x000008000000 : "ospi_nand.phypattern"
    => nand info
    
    Device 0: nand0, sector size 256 KiB
      Page size         4096 b
      OOB size           128 b
      Erase size      262144 b
      ecc strength         8 bits
      ecc step size      512 b
      subpagesize       1024 b
      options       0x4000400c
      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
    => ls mmc 1
      1207371   tispl.bin
       310821   tiboot3-am62x-gp-evm.bin
       313410   tiboot3-am62x-hs-evm.bin
       313410   tiboot3-am62x-hs-fs-evm-am62xx-lp-evm-k3r5-2024.04+git-r0_tisdk_5_edgeai_4.bin
       313410   tiboot3-am62x-hs-fs-evm.bin
       313410   tiboot3.bin
        12285   ti_logo_414x97_32bpp.bmp.gz
      1295899   u-boot.img
          574   uEnv.txt
                am62-lpsk_10.0.7.4_prebuilt/
                am62-lpsk-gpmc/
                .Trash-1000/
       324358   tiboot3-gpmc.bin
    
    10 file(s), 3 dir(s)
    
    => load mmc 1 ${loadaddr} tiboot3-gpmc.bin
    324358 bytes read in 38 ms (8.1 MiB/s)
    => nand write ${loadaddr} 0x0 ${filesize}
    
    NAND write: device 0 offset 0x0, size 0x4f306
     324358 bytes written: OK
    => load mmc 1 ${loadaddr} tispl.bin
    1207371 bytes read in 74 ms (15.6 MiB/s)
    => nand write ${loadaddr} 0x200000 ${filesize}
    
    NAND write: device 0 offset 0x200000, size 0x126c4b
     1207371 bytes written: OK
    => load mmc 1 ${loadaddr} u-boot.img
    1295899 bytes read in 79 ms (15.6 MiB/s)
    => nand write ${loadaddr} 0x600000 ${filesize}
    
    NAND write: device 0 offset 0x600000, size 0x13c61b
     1295899 bytes written: OK
    => 

    am62-lpsk_10.0.7.4_nand_boot.log
    U-Boot SPL 2024.04-dirty (Aug 16 2024 - 15:51:36 -0500)
    SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
    SPL initial stack usage: 13392 bytes
    Trying to boot from NAND
    Authentication passed
    Authentication passed
    Authentication passed
    Loading Environment from nowhere... OK
    init_env from device 11 not supported!
    Authentication passed
    Authentication passed
    Starting ATF on ARM64 core...
    
    NOTICE:  BL31: v2.10.0(release):v2.10.0-367-g00f1ec6b87-dirty
    NOTICE:  BL31: Built : 16:09:05, Feb  9 2024
    
    U-Boot SPL 2024.04-ti-gfda88f8bcea3 (Jul 26 2024 - 11:00:12 +0000)
    SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)')
    SPL initial stack usage: 1904 bytes
    Trying to boot from NAND
    Authentication passed
    Authentication passed
    
    
    U-Boot 2024.04-ti-gfda88f8bcea3 (Jul 26 2024 - 11:00:12 +0000)
    
    SoC:   AM62X SR1.0 HS-FS
    Model: Texas Instruments AM62x LP SK
    EEPROM not available at 0x50, trying to read at 0x51
    Board: AM62-LP-SKEVM rev E2
    DRAM:  2 GiB
    Core:  83 devices, 32 uclasses, devicetree: separate
    NAND:  1024 MiB
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from nowhere... OK
    In:    serial
    Out:   serial
    Err:   serial
    Net:   eth0: ethernet@8000000port@1
    Hit any key to stop autoboot:  2  0 
    => md.l 0x43000030 1
    43000030: 0000025b                             [...
    => mtd list
    List of MTD devices:
    * nand0
      - device: nand@0,0
      - parent: memory-controller@3b000000
      - driver: gpmc-nand
      - path: /bus@f0000/memory-controller@3b000000/nand@0,0
      - type: NAND flash
      - block size: 0x40000 bytes
      - min I/O: 0x1000 bytes
      - OOB size: 128 bytes
      - OOB available: 142 bytes
      - ECC strength: 8 bits
      - ECC step size: 512 bytes
      - bitflip threshold: 6 bits
      - 0x000000000000-0x000040000000 : "nand0"
    	  - 0x000000000000-0x000000200000 : "NAND.tiboot3"
    	  - 0x000000200000-0x000000400000 : "NAND.tispl"
    	  - 0x000000400000-0x000000600000 : "NAND.tiboot3.backup"
    	  - 0x000000600000-0x000000a00000 : "NAND.u-boot"
    	  - 0x000000a00000-0x000000a40000 : "NAND.u-boot-env"
    	  - 0x000000a40000-0x000000a80000 : "NAND.u-boot-env.backup"
    	  - 0x000000a80000-0x000040000000 : "NAND.file-system"
    * spi-nand0
      - device: flash@0
      - parent: spi@fc40000
      - driver: spi_nand
      - path: /bus@f0000/bus@fc00000/spi@fc40000/flash@0
      - type: NAND flash
      - block size: 0x40000 bytes
      - min I/O: 0x1000 bytes
      - OOB size: 128 bytes
      - OOB available: 80 bytes
      - 0x000000000000-0x000008000000 : "spi-nand0"
    	  - 0x000000000000-0x000000080000 : "ospi_nand.tiboot3"
    	  - 0x000000080000-0x000000280000 : "ospi_nand.tispl"
    	  - 0x000000280000-0x000000680000 : "ospi_nand.u-boot"
    	  - 0x000000680000-0x0000006c0000 : "ospi_nand.env"
    	  - 0x0000006c0000-0x000000700000 : "ospi_nand.env.backup"
    	  - 0x000002000000-0x000007fc0000 : "ospi_nand.rootfs"
    	  - 0x000007fc0000-0x000008000000 : "ospi_nand.phypattern"
    => nand info
    
    Device 0: nand0, sector size 256 KiB
      Page size         4096 b
      OOB size           128 b
      Erase size      262144 b
      ecc strength         8 bits
      ecc step size      512 b
      subpagesize       1024 b
      options       0x4000400c
      bbt options   0x00000000
    =>