ARM: i.MX: external NAND boot: Fix passing boarddata
We used to pass a device tree pointer to
imx*_barebox_boot_nand_external(). This no longer works since we compile
barebox with -fPIE.

The problem is that we only have the first 2KiB of the image available
when we start from NAND. The pointer to the device tree is not valid
yet. This hasn't been a problem because the pointer is only used later
when we have the full image in SDRAM. With -fPIE though the actual
pointer is derived indirectly through another pointer, and that pointer
to the pointer is also not valid which causes an invalid pointer to
the device tree later.

This is solved by splitting the NAND boot functions up into two
functions. With imx*_nand_relocate_to_sdram() the board code relocates
the image out of the NFC SRAM into SDRAM. From that point on the device
tree pointer can be accessed and the board can load the image using
imx*_nand_load_image() and can afterwards pass control to barebox
passing whatever device tee pointer it likes.

Fixes: b0348d677b ("ARM: Compile with -fPIE")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 07199ce commit 104f5a22d61480fb275d05298ea185c95fbcb5b7
@Sascha Hauer Sascha Hauer authored on 18 Feb 2020
Showing 11 changed files
View
arch/arm/boards/eukrea_cpuimx25/lowlevel.c
View
arch/arm/boards/eukrea_cpuimx35/lowlevel.c
View
arch/arm/boards/guf-cupid/lowlevel.c
View
arch/arm/boards/guf-neso/lowlevel.c
View
arch/arm/boards/karo-tx25/lowlevel.c
View
arch/arm/boards/phytec-phycard-imx27/lowlevel.c
View
arch/arm/boards/phytec-phycore-imx27/lowlevel.c
View
arch/arm/boards/phytec-phycore-imx31/lowlevel.c
View
arch/arm/boards/phytec-phycore-imx35/lowlevel.c
View
arch/arm/mach-imx/external-nand-boot.c
View
arch/arm/mach-imx/include/mach/imx-nand.h