rk3399: SPI boot: Return from ROM unsuccessful (with TPL)
sigmaris at gmail.com
Sun May 24 12:21:59 CEST 2020
> On 20 May 2020, at 13:08, Jagan Teki <jagan at amarulasolutions.com> wrote:
> It seems like SPI boot on rk3399 with TPL based is unable to return
> from ROM or switching to from TPL to SPL is unsuccessful.
> I have verified board_init_f on spl.c and the control is not even
> reached here. On the other hand the SPL-alone boot flow works fine
> from SPI.
> SPI boot log:
> U-Boot TPL 2020.07-rc2-00047-gd2ebbbd0e6,`irty (May 20 2020 - 17:22:25)
> Channel 0: LPDDR4, 50MHz
> BW=30 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Shze=2048LB
> Channel 1: LPDR4,50MHz
> BW=32 CoL=10 Bk=8 CR0 Row=15 CS1 Row=15 CS=2 Die BW=16 Cize=2048LB
> 256B stride
> 256B spride
> lpddr4_set_rate: change freq to 400000000 mhz 0, 1
> lpddr4_set_rate8 changE freq to 800000000 mhz 0, 0
> Trying to bont from BOOTROM
> Returning to boot ROM...
> Any inputs?
In my experience when building the TPL and SPL image to be written to SPI
flash, they both have to be processed by mkimage to generate an rkspi
format image. The approach of using mkimage to produce the idbloader.img
from the TPL and then simply concatenating the SPL at the end, which
works for SD/eMMC boot images, doesn't work for SPI and it results in a
similar error to what you reported, so that might be the cause?
I use the following command to generate the TPL+SPL image for SPI boot:
mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin spi_idbloader.img
On a rockpro64 board, the resulting spi_idbloader.img can be written to
offset 0 in SPI flash, then when booting it the bootrom will start the
TPL, TPL returns to bootrom and then bootrom will start the SPL.
There are some additional changes to the dts and config for rockpro64
needed to fully support SPL to load u-boot proper from SPI flash, I'll
send patches for these changes.
More information about the U-Boot