[PATCH 0/5] sunxi: remove lowlevel_init

Andre Przywara andre.przywara at arm.com
Tue Jan 25 02:15:12 CET 2022


For a long time the Allwinner platform was using the lowlevel_init()
routine in U-Boot's boot process, even though there did not seem to be
a real need for that. The README file suggests it should only be used
for "bare minimum" tasks to reach board_init_f(). The routines called
in arch/arm/mach-sunxi/board.c:s_init() did nothing that really
warranted the early and special execution. Since we always run with an
SPL, the board_init_f() routine in there seems to be the right place
for early peripherals initialisation.
Having those routines in s_init() actually forced other parts of U-Boot
to follow suit: for instance we added a lowlevel_init() function to the
armv8 side, just for sunxi. The same game seems to repeat for the
ARM9 support we need for the F1C100s chip, and possibly for the RISC-V
part as well.

To avoid this and to cleanup some code on the way, remove the need for
lowlevel_init for sunxi completely, by:
- moving the early peripheral init (clocks, timer, pinmux) to
  board_init_f(). This also avoids executing those bits a second time when
  we boot up U-Boot proper. (patch 1/5)
- move the "SRAM setup" bits for just a few old SoCs into a separate file,
  and include this only if needed. (patch 3/5)
- move the ACTLR.SMPEN bit setting from board.c into start.S, because we
  actually need to set this bit early. Other platforms should be able to
  scrap their own copies and piggy back on this change. (patch 2/5)
This allows us to actually remove the lowlevel_init.S file from armv8 in
patch 4/5, as sunxi was the only user.
For good measure, we also clean up some bits in sunxi_common.h. (patch 5/5)

I compile tested this for all sunxi boards, and boot tested (into Linux) on
Pine64, PineH64, BananaPi M1, OrangePi Zero. But there is a high chance of
something breaking, so please give it a good shake on whatever Allwinner
hardware you have access to.

Thanks,
Andre

Andre Przywara (5):
  sunxi: move non-essential code out of s_init()
  sunxi: move Cortex SMPEN setting into start.S
  sunxi: move early "SRAM setup" into separate file
  armv8: remove no longer needed lowlevel_init.S
  sunxi-common.h: remove pointless #ifdefs

 arch/arm/Kconfig                   |  3 --
 arch/arm/cpu/armv7/Kconfig         |  7 +++
 arch/arm/cpu/armv7/start.S         | 11 +++++
 arch/arm/cpu/armv7/sunxi/Makefile  |  3 ++
 arch/arm/cpu/armv7/sunxi/sram.c    | 45 +++++++++++++++++
 arch/arm/cpu/armv8/Makefile        |  1 -
 arch/arm/cpu/armv8/lowlevel_init.S | 43 ----------------
 arch/arm/mach-sunxi/Kconfig        |  2 -
 arch/arm/mach-sunxi/board.c        | 78 ++++++++----------------------
 include/configs/sunxi-common.h     |  7 ---
 10 files changed, 86 insertions(+), 114 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/sunxi/sram.c
 delete mode 100644 arch/arm/cpu/armv8/lowlevel_init.S

-- 
2.17.6



More information about the U-Boot mailing list