rockchip-linux / u-boot

U-Boot tree for pending commits
126 stars 86 forks source link

Uboot not rebooting right when boot from SPI #77

Open MarcinWad opened 1 year ago

MarcinWad commented 1 year ago

I have NanoPi R2S RK3328 based board. I compiled Uboot to support booting from SPI chip that i soldered on the board. SPI works, board works, Uboot works - almost.

There is a problem with reseting the board.

If board boots from SPI Flash Chip to command line, reset command will bring board to MASKROM mode like no SPI chip is soldered. What helps, is a complete power cut and plug back - then it will work again.

Interesing part is that my Uboot is TPL+SPL with ATF compiled. Same happens with Mainline Uboot.

U-Boot TPL 2023.01-rc3 (Dec 16 2022 - 12:02:25)
DDR4, 333MHz
BW=32 Col=10 Bk=4 BG=2 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2023.01-rc3 (Dec 16 2022 - 12:02:25 +0100)
board_spl_was_booted_from: brom_bootdevice_id 3 maps to '/spi@ff190000'
   -boot node spi@ff190000
rockchip_spi_of_to_plat: base=ff190000, max-frequency=50000000, deactivate_delay=0
rockchip_spi_probe: probe
rockchip_spi_probe: rate = 750000
UCLASS_SPI1
   -boot node spi@ff190000
UCLASS_SPI1
Trying to boot from SPI
NOTICE:  BL31: v2.8(release):10f4d1a
NOTICE:  BL31: Built : 10:04:12, Dec  2 2022
NOTICE:  BL31:Rockchip release version: v1.2
ns16550_serial serial@ff130000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

U-Boot 2023.01-rc3 (Dec 16 2022 - 12:02:33 +0100)

Model: FriendlyElec NanoPi R2S
DRAM:  1 GiB (effective 1022 MiB)
PMIC:  RK8050 (on=0x40, off=0x00)
Core:  228 devices, 21 uclasses, devicetree: separate
MMC:
Loading Environment from SPIFlash... rockchip_spi_of_to_plat: base=ff190000, max-frequency=50000000, deactivate_delay=0
rockchip_spi_probe: probe
rockchip_spi_probe: rate = 750000

In:    serial@ff130000
Out:   serial@ff130000
Err:   serial@ff130000
Model: FriendlyElec NanoPi R2S
Net:   eth0: ethernet@ff540000
Hit any key to stop autoboot:  0

If i hit reset button before "NOTICE: BL31: v2.8(release):10f4d1a" appears - it will reset without problems.

Same happens in Linux Kernel 4.4, reboot command brings board to MASKROM mode.

Having a working SD card in slot will bring board from SDCARD. Then SDCard continues to Boot from SPI well.

Where to search for a problem? Looks like Uboot is messing with some CPU registers and powering it down resets all back to normal.