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.

SK-AM62P-LP: SK-AM62P-LP u-boot env params

Part Number: SK-AM62P-LP

SK-AM62P-LP has a 64MB ospi-nor flash.  I want to start linux system from ospi_nor flash.

But in u-boot environment directory, there is no ospi_nor.env.

When boot from ospi ,u-boot uses ospi_nand.env as its env, and passes wrong mtdpart info to kernel /proc/cmdline.

Will ospi_nor.env be included in subsequent SDK updates? And how long it will update?

My SDK version: ti-processor-sdk-linux-am62pxx-evm-09.01.00.08-Linux-x86-Install.bin

  • But in u-boot environment directory, there is no ospi_nor.env.

    When boot from ospi ,u-boot uses ospi_nand.env as its env, and passes wrong mtdpart info to kernel /proc/cmdline.

    Will ospi_nor.env be included in subsequent SDK updates? And how long it will update?

    There are no immediate plans to add such OSPI NOR boot support to the SDK. However I just looked into this a bit closer and was able to create the below patch that should enable such boot, or at least get you on the way to doing so (I say that because I've only dome some basic sanity testing on a U-Boot level rather than a full boot).

    $ git show
    commit 9e87b616351f06c9efa1717d2d450656f0f950c1 (HEAD -> ti-u-boot-2023.04-ethernet-boot-dev)
    Author: Andreas Dannenberg <dannenberg@ti.com>
    Date:   Mon Jan 22 14:09:42 2024 -0600
    
        board: ti: am62p: Add support for OSPI NOR boot via mtd
    
        Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
    
    diff --git a/board/ti/am62px/am62px.env b/board/ti/am62px/am62px.env
    index 2e49ebfa27..e857fce0cf 100644
    --- a/board/ti/am62px/am62px.env
    +++ b/board/ti/am62px/am62px.env
    @@ -1,7 +1,7 @@
     #include <environment/ti/ti_armv7_common.env>
     #include <environment/ti/mmc.env>
     #include <environment/ti/k3_dfu.env>
    -#include <environment/ti/ospi_nand.env>
    +#include <environment/ti/ospi_nor.env>
     #if CONFIG_CMD_REMOTEPROC
     #include <environment/ti/k3_rproc.env>
     #endif
    diff --git a/configs/am62px_evm_a53_defconfig b/configs/am62px_evm_a53_defconfig
    index da9274baab..bee6721281 100644
    --- a/configs/am62px_evm_a53_defconfig
    +++ b/configs/am62px_evm_a53_defconfig
    @@ -144,6 +144,7 @@ CONFIG_SPI_FLASH_SOFT_RESET=y
     CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y
     CONFIG_SPI_FLASH_SPANSION=y
     CONFIG_SPI_FLASH_S28HX_T=y
    +CONFIG_SPI_FLASH_MTD=y
     CONFIG_PHY_TI_DP83867=y
     CONFIG_TI_AM65_CPSW_NUSS=y
     CONFIG_PINCTRL=y
    diff --git a/include/environment/ti/ospi_nor.env b/include/environment/ti/ospi_nor.env
    new file mode 100644
    index 0000000000..cffb85399e
    --- /dev/null
    +++ b/include/environment/ti/ospi_nor.env
    @@ -0,0 +1,21 @@
    +mtdids=nor0=s28hs512t
    +mtdparts=nor0:512k(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),256k(ospi.env.backup),57088k@8m(ospi.rootfs),256k@65280k(ospi.phypattern)
    +
    +ospi_bootpart=ospi.rootfs
    +ospi_bootvolume=ubi0:rootfs
    +ospi_ubi_init=ubi part ${ospi_bootpart}; ubifsmount ${ospi_bootvolume};
    +args_ospi=setenv bootargs console=${console}
    +       ${optargs} ubi.mtd=${ospi_bootpart}
    +       root=${ospi_bootvolume} rootfstype=ubifs
    +init_ospi=run args_all args_ospi ospi_ubi_init
    +get_fdt_ospi=ubifsload ${fdtaddr} ${bootdir}/dtb/${fdtfile};
    +get_overlay_ospi=
    +        fdt address ${fdtaddr}
    +        fdt resize 0x100000;
    +        for overlay in $name_overlays;
    +        do;
    +        ubifsload ${dtboaddr} ${bootdir}/dtb/${overlay} &&
    +        fdt apply ${dtboaddr};
    +        done;
    +get_kern_ospi=ubifsload ${loadaddr} ${bootdir}/${name_kern}
    +get_fit_ospi=ubifsload ${addr_fit} ${bootdir}/${name_fit}

    With this patch in place, basic functionality appears to be working:

    U-Boot 2023.04-00035-g9e87b61635 (Jan 22 2024 - 14:10:31 -0600)
    
    SoC:   AM62PX SR1.0 HS-FS
    Model: Texas Instruments AM62P5 SK
    DRAM:  2 GiB (effective 8 GiB)
    Core:  79 devices, 30 uclasses, devicetree: separate
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from nowhere... OK
    In:    serial@2800000
    Out:   serial@2800000
    Err:   serial@2800000
    Net:   eth0: ethernet@8000000port@1, eth1: ethernet@8000000port@2
    => mtd list
    SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB
    List of MTD devices:
    * nor0
      - device: flash@0
      - parent: spi@fc40000
      - driver: jedec_spi_nor
      - path: /bus@f0000/bus@fc00000/spi@fc40000/flash@0
      - type: NOR flash
      - block size: 0x40000 bytes
      - min I/O: 0x1 bytes
      - 0x000000000000-0x000004000000 : "nor0"
              - 0x000000000000-0x000000080000 : "ospi.tiboot3"
              - 0x000000080000-0x000000280000 : "ospi.tispl"
              - 0x000000280000-0x000000680000 : "ospi.u-boot"
              - 0x000000680000-0x0000006c0000 : "ospi.env"
              - 0x0000006c0000-0x000000700000 : "ospi.env.backup"
              - 0x000000800000-0x000003fc0000 : "ospi.rootfs"
              - 0x000003fc0000-0x000004000000 : "ospi.phypattern"
    
    => env set boot ospi
    => boot
    switch to partitions #0, OK
    mmc1 is current device
    SD/MMC found on device 1
    Failed to load 'boot.scr'
    574 bytes read in 19 ms (29.3 KiB/s)
    Loaded env from uEnv.txt
    Importing environment from mmc1 ...
    ubi0: attaching mtd6
    ubi0: scanning is finished
    ubi0: empty MTD device detected
    ubi0: attached mtd6 (name "ospi.rootfs", size 55 MiB)
    ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 262016 bytes
    ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
    ubi0: VID header offset: 64 (aligned 64), data offset: 128
    ubi0: good PEBs: 223, bad PEBs: 0, corrupted PEBs: 0
    ubi0: user volume: 0, internal volumes: 1, max. volumes count: 128
    ubi0: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 0
    ubi0: available PEBs: 219, total reserved PEBs: 4, PEBs reserved for bad PEB handling: 0

    Can you please give this a try on your side.

    Regards, Andreas

  • Thanks for your help!

    I follow your instruction to merge the git diff, and re-generate uboot ,it works with my board.

    But I encountered another problem about booting from ospi_nor.

    After I generate ubifs image for rootfs, and use sf command to write rootfs ubi image to mtd6, I cannot use ubi part commands normally.

    It seems like there is some errors with spi_nor.

    Here is the log.

    U-Boot SPL 2023.04 (Jan 23 2024 - 10:04:59 +0800)
    
    SYSFW ABI: 3.1 (firmware rev 0x0009 '9.1.8--v09.01.08 (Kool Koala)')
    
    SPL initial stack usage: 17040 bytes
    
    Trying to boot from SPI
    
    Authentication passed
    
    Authentication passed
    
    Authentication passed
    
    Authentication passed
    
    Authentication passed
    
    Starting ATF on ARM64 core...
    
    
    
    NOTICE:  BL31: v2.9(release):v2.9.0-614-gd7a7135d32-dirty
    
    NOTICE:  BL31: Built : 09:34:15, Aug 24 2023
    
    
    
    U-Boot SPL 2023.04 (Jan 23 2024 - 10:05:24 +0800)
    
    SYSFW ABI: 3.1 (firmware rev 0x0009 '9.1.8--v09.01.08 (Kool Koala)')
    
    Trying to boot from SPI
    
    Authentication passed
    
    Authentication passed
    
    
    
    
    
    U-Boot 2023.04 (Jan 23 2024 - 10:05:24 +0800)
    
    
    
    SoC:   AM62PX SR1.0 HS-FS
    
    Model: Texas Instruments AM62P5 SK
    
    DRAM:  2 GiB (effective 8 GiB)
    
    Core:  80 devices, 30 uclasses, devicetree: separate
    
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    
    Loading Environment from nowhere... OK
    
    In:    serial@2800000
    
    Out:   serial@2800000
    
    Err:   serial@2800000
    
    Net:   
    
    Warning: ethernet@8000000port@1 (eth0) using random MAC address - 5a:ed:cf:06:98:45
    
    eth0: ethernet@8000000port@1
    
    Warning: ethernet@8000000port@2 (eth1) using random MAC address - be:e5:c7:2d:aa:ec
    
    , eth1: ethernet@8000000port@2
    
    Hit any key to stop autoboot:  0 
    
    => 
    
    => 
    
    => 
    
    => 
    
    => 
    
    => 
    
    => 
    
    => sf probe 
    
    SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB
    
    => mtd list
    
    List of MTD devices:
    
    * nor0
    
      - device: flash@0
    
      - parent: spi@fc40000
    
      - driver: jedec_spi_nor
    
      - path: /bus@f0000/bus@fc00000/spi@fc40000/flash@0
    
      - type: NOR flash
    
      - block size: 0x40000 bytes
    
      - min I/O: 0x1 bytes
    
      - 0x000000000000-0x000004000000 : "nor0"
    
              - 0x000000000000-0x000000080000 : "ospi.tiboot3"
    
              - 0x000000080000-0x000000280000 : "ospi.tispl"
    
              - 0x000000280000-0x000000680000 : "ospi.u-boot"
    
              - 0x000000680000-0x0000006c0000 : "ospi.env"
    
              - 0x0000006c0000-0x000000700000 : "ospi.env.backup"
    
              - 0x000000800000-0x000003fc0000 : "ospi.rootfs"
    
              - 0x000003fc0000-0x000004000000 : "ospi.phypattern"
    
    => sf probe ; ubi part ospi.rootfs
    
    SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB
    
    ubi0: attaching mtd6
    
    ubi0: scanning is finished
    
    ubi0: attached mtd6 (name "ospi.rootfs", size 55 MiB)
    
    ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 262016 bytes
    
    ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
    
    ubi0: VID header offset: 64 (aligned 64), data offset: 128
    
    ubi0: good PEBs: 223, bad PEBs: 0, corrupted PEBs: 0
    
    ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
    
    ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 734870720
    
    ubi0: available PEBs: 0, total reserved PEBs: 223, PEBs reserved for bad PEB handling: 0
    
    jedec_spi_nor flash@0: flash operation timed out
    
    ubi0 error: nor_erase_prepare: cannot invalidate PEB 0, write returned -110
    
    ubi0: dumping 262144 bytes of data from PEB 0, offset 0
    
    ubi0 error: erase_worker: failed to erase PEB 0, error -5
    
    ubi0 error: erase_worker: bad physical eraseblock 0 detected
    
    ubi0 error: do_work: work failed with error code -5
    
    ubi0 error: ubi_do_worker: ubi_bgt0d: work failed with error code -5
    
    ubi0 error: ubi_io_sync_erase: read-only mode
    
    ubi0 error: erase_worker: failed to erase PEB 1, error -30
    
    ubi0 error: do_work: work failed with error code -30
    
    ubi0 error: ubi_do_worker: ubi_bgt0d: work failed with error code -30
    
    

    Looking forward to your reply.

    Best wishes.

  • and use sf command to write rootfs ubi image to mtd6

    How did you write the image? You might want to double check this. You must use either:

    1. Erase the area ('sf erase') you want to write to, and then write ('sf write'), or
    2. Use the 'sf update' command, which will erase as needed, automatically

    If you only do a 'sf write' you may have unintentionally combined/mingled old/new contents, resulting in a corrupted flash contents.

    Regards, Andreas