AM6422: TI AM64 u-boot DFU 模式下无法访问SPI flash

Part Number: AM6422

在使用AM64u-boot过程中,遇到一个奇怪的现象:

我如果将 u-boot的环境变量配置成存储在SPI Flash,那么在DFU升级的过程中,会出现SPI flash初始化失败,导致无法在之后的CLI环境下将u-boot镜像写入SPI flash.

 

我尝试分析解决这个问题,发现在设备树文件 "k3-am642-evm-u-boot.dtsi"里,将ospi0节点的power-domainsassigned-clock-parentsassigned-clock-rates (后续附录里设备树标红的3个属性)移除后,就可以成功检测到SPI Flash

 

虽然暂时解决了DFU模式下访问SPI flash的问题,但目前我还有如下不确定,还请帮忙看一下:

  1. 出现无法检测到SPI flash这个问题的root cause是什么?
  2. 移除ospi0节点属性的解法,是否合理,是否有别的什么副作用?
  3. 麻烦提供更合理或更正确的解法?

 

 

附录:

  1. 目前使用的还是TI SDK9.0
  2. ospi0节点移除如下3个标红属性,可以规避问题。

 

&ospi0 {

        bootph-pre-ram;

        /delete-property/ power-domains;

        /delete-property/ assigned-clock-parents;

        /delete-property/ assigned-clock-rates;

        flash@0 {

                bootph-pre-ram;

                partitions {

                        bootph-pre-ram;

                        #address-cells = <1>;

                        #size-cells = <1>;

                        partition@3fc0000 {

                                bootph-pre-ram;

                                reg = <0x3fc0000 0x40000>;

                        };

                };

        };

};

 

  1. u-boo配置环境变量存在SPI flash里:

  1 CONFIG_ENV_SIZE=0x40000

  2 CONFIG_ENV_OFFSET=0x700000

  3 CONFIG_ENV_SECT_SIZE=0x200

  4 CONFIG_ENV_ADDR=0x0

  5 # CONFIG_ENV_IS_IN_MMC is not set

  6 CONFIG_ENV_IS_IN_SPI_FLASH=y

  7 CONFIG_ENV_SECT_SIZE_AUTO=y

  8 CONFIG_ENV_SPI_BUS=0

  9 CONFIG_ENV_SPI_CS=0

10 CONFIG_ENV_SPI_MAX_HZ=25000000

11 CONFIG_ENV_SPI_MODE=0

  1. ONFIG_SPL_ENV_IS_IN_SPI_FLASH=y

 

  1. 移除ospi0节点前的u-boot 失败log:

 

U-Boot SPL 2023.04-g24098ea90d (Jul 06 2023 - 12:59:40 +0000) V1.0.0

EEPROM not available at 0x50, trying to read at 0x51

Reading on-board EEPROM at 0x51 failed -19

Resetting on cold boot to workaround ErrataID:i2331

Please resend tiboot3.bin in case of UART/DFU boot

resetting ...

 

U-Boot SPL 2023.04-g24098ea90d (Jul 06 2023 - 12:59:40 +0000) V1.0.0

EEPROM not available at 0x50, trying to read at 0x51

Reading on-board EEPROM at 0x51 failed -19

SYSFW ABI: 3.1 (firmware rev 0x0009 '9.0.5--v09.00.05 (Kool Koala)')

SPL initial stack usage: 13376 bytes

Trying to boot from DFU

##########################################DOWNLOAD ... OK

Ctrl+C to exit ...

########################################################DOWNLOAD ... OK

Ctrl+C to exit ...

Warning: Detected image signing certificate on none HS-SE device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted

Warning: Detected image signing certificate on none HS-SE device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted

Warning: Detected image signing certificate on none HS-SE device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted

Warning: Detected image signing certificate on none HS-SE device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted

Loading Environment from SPIFlash... OK

init_env from device 10 not supported!

Starting ATF on ARM64 core...

 

NOTICE:  BL31: v2.8(release):v2.8-226-g2fcd408bb3-dirty

NOTICE:  BL31: Built : 00:42:57, Jan 13 2023

I/TC:

I/TC: OP-TEE version: 3.20.0 (gcc version 11.4.0 (GCC)) #1 Fri Jan 20 15:42:54 UTC 2023 aarch64

I/TC: WARNING: This OP-TEE configuration might be insecure!

I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html

I/TC: Primary CPU initializing

I/TC: SYSFW ABI: 3.1 (firmware rev 0x0009 '9.0.5--v09.00.05 (Kool Koala)')

I/TC: HUK Initialized

I/TC: Activated SA2UL device

I/TC: Enabled firewalls for SA2UL TRNG device

I/TC: SA2UL TRNG initialized

I/TC: SA2UL Drivers initialized

I/TC: Primary CPU switching to normal world boot

 

U-Boot SPL 2023.04-g24098ea90d (Jul 06 2023 - 12:59:40 +0000) V1.0.0

EEPROM not available at 0x50, trying to read at 0x51

Reading on-board EEPROM at 0x51 failed -19

SYSFW ABI: 3.1 (firmware rev 0x0009 '9.0.5--v09.00.05 (Kool Koala)')

Trying to boot from DFU

Warning: Detected image signing certificate on none HS-SE device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted

Warning: Detected image signing certificate on none HS-SE device. Skipping certificate to prevent boot failure. This will fail if the image was also encrypted

 

 

U-Boot 2023.04-g24098ea90d (Jul 06 2023 - 12:59:40 +0000) V1.0.0

 

SoC:   AM64X SR2.0 HS-FS

Model: Texas Instruments AM642 EVM

EEPROM not available at 0x50, trying to read at 0x51

Reading on-board EEPROM at 0x51 failed -19

DRAM:  1 GiB

Core:  63 devices, 29 uclasses, devicetree: separate

WDT:   Started gpio-wdt with servicing every 2500ms (10s timeout)

MMC:   mmc@fa10000: 0, mmc@fa00000: 1

Loading Environment from SPIFlash... ti_sci system-controller@44043000: Message not acknowledgedti-sci-pm-domains power-controller: ti_sci_power_domain_on: get_device(75) failed (-19)

Invalid bus 0 (err=-19)

*** Warning - spi_flash_probe_bus_cs() failed, using default environment

 

 

=> sf probe

ti_sci system-controller@44043000: Message not acknowledgedti-sci-pm-domains power-controller: ti_sci_power_domain_on: get_device(75) failed (-19)

Invalid bus 0 (err=-19)

Failed to initialize SPI flash at 0:0 (error 0)