On Fri, 30 Jan 2015 13:58:46 +0200 Siarhei Siamashka <siarhei.siamas...@gmail.com> wrote:
> The commit f630974ccb3ce93e9607a3354e9acb266a8b7e95 > 'sunxi: Move SPL s_init() code to board_init_f()' > broke the FEL boot mode. > > This patch moves the DRAM initialization back to s_init() and > introduces an assembly entry point for FEL in order to provide > guaranteed initialization of the gdata pointer (r9). The assembly > entry point is also needed to ensure that the SPL code starts > executing in ARM mode. > > Because the sunxi board_init_f() does not contain anything that > is not already done by the default board_init_f(), it is removed > too. > > Signed-off-by: Siarhei Siamashka <siarhei.siamas...@gmail.com> > --- > arch/arm/cpu/armv7/sunxi/Makefile | 1 + > arch/arm/cpu/armv7/sunxi/board.c | 26 ++++++++++---------------- > arch/arm/cpu/armv7/sunxi/start_fel.S | 16 ++++++++++++++++ > arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds | 3 ++- > 4 files changed, 29 insertions(+), 17 deletions(-) > create mode 100644 arch/arm/cpu/armv7/sunxi/start_fel.S [...] > +++ b/arch/arm/cpu/armv7/sunxi/start_fel.S > @@ -0,0 +1,16 @@ > +/* > + * Entry point of the FEL mode SPL. > + * > + * Copyright (c) 2015 Siarhei Siamashka <siarhei.siamas...@gmail.com> > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include <asm-offsets.h> > +#include <config.h> > +#include <linux/linkage.h> > + > +ENTRY(_start_fel) > + ldr r9, =gdata > + b s_init > +ENDPROC(_start_fel) In fact, we probably need to save/restore the r9 register and do it as: push {r9, lr} ldr r9, =gdata bl s_init pop {r9, pc} And maybe save some other registers, depending on the calling conventions expected by the FEL code in BROM. As a side note, corrupting r9 mimics the old u-boot sunxi behaviour. And it used not to cause any visible problems so far, at least when working with the BROM code in the current Allwinner SoCs. Also as I see it, the ".bss" sections is supposed to be in DRAM, and cleared only after the DRAM is initialized. This violates the C standard a little bit and enforces some sort of u-boot specific coding tricks. Such as explicitly placing gdata in the ".data" section instead of ".bss". This is ugly, but probably justified. I'll submit a fixed v2 version of this patch later, but will first wait for additional comments from the other people. -- Best regards, Siarhei Siamashka _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot