All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 00/26] sunxi: Allwinner A64: SPL support
@ 2017-01-02 11:48 Andre Przywara
  2017-01-02 11:48 ` [U-Boot] [PATCH v4 01/26] sun6i: Restrict some register initialization to Allwinner A31 SoC Andre Przywara
                   ` (27 more replies)
  0 siblings, 28 replies; 48+ messages in thread
From: Andre Przywara @ 2017-01-02 11:48 UTC (permalink / raw)
  To: u-boot

Hi,

hopefully the final version of the SPL support series for the Allwinner A64
SoC. Actually no real code changes this time, just rebased on top of recent
master, adding some comments in patches 16/26 and 19/26 following Maxime's
suggestions and adding Acked-by:s and Reviewed-by:s.
I left the final patch 26/26 in for the sake of completeness, but don't expect
it to be merged. We need a clever solution to unify 32-bit and 64-bit board
configurations, but that shouldn't hold back this series for now.
Merging everything until and including patch 21/26 (sunxi: A64: enable SPL)
would be great, the other patches until 25/26 can go in as well, I think.

-------------
As the previous versions this one includes support for both AArch64 and
AArch32 SPL builds. The FIT support is still missing, which means the
functionality is limited. Due to the missing ARM Trusted Firmware (ATF)
in this firmware chain we lose Ethernet and SMP, among other minor things.
A full 64-bit build can be written to an SD card as expected and will
boot the U-Boot proper prompt. However Linux will crash on boot, as
PSCI is missing.
Building the 32-bit version of the SPL and combining this with an ATF
build and the 64-bit U-Boot proper allows to use FEL booting now:
# sunxi-fel spl sunxi-spl.bin write 0x4a000000 u-boot-dtb.bin \
  write 0x44000 bl31.bin reset64 0x44000
This way of booting the board gives full functionality.

The first patch is a rather simple fix (with no changes to v2).
Patches 2-8 prepare the SPL code to be compiled for 64-bit in general and
AArch64 in particular.
Patches 9-11 refactor the existing boot0 header functionality to be used
by patch 12, which introduces the 64-bit switch in the first SPL
instructions.
Patches 13-20 then introduce the actual core of the SPL support: the DRAM
initialization, courtesy of Jens. This piggy backs on the existing
H3 DRAM code, deviating where needed. This has been reworked compared to
v2: I added a patch from Philipp to replace the rather uninspired
register writes in the MBUS priority setup function with some meaningful
code, explaining the various bits. Also the actual A64 DRAM code is no
longer #ifdef'ed into the H3 driver, but uses parameters to (static)
functions. The compiler detects this and removes the dead code from
the other variant, resulting in the same binary size for the H3.

Patch 21 finally enables the 64-bit SPL support. So now building the
existing pine64_plus_defconfig will generate a sunxi-spl.bin, which
can be prepended to the U-Boot proper image (not .bin) to boot from
an SD card. Due to the missing ATF support this is of limited usability
at the moment, though. Also FEL support requires more love - to switch
back to AArch32 before returning to FEL (without crashing, that is ;-),
so this is disabled.
On my setup this results in a 26KB SPL binary, which is close to the
28K limit mksunxiboot imposes at the moment. Adding anything (like
FIT support or DEBUG) will exceed this, and although I have patches
to let mksunxiboot get close to 32KB, this is the ulimate frontier.

So patches 22-25 then teach the SPL how to detect an U-Boot image file
of a different bitness and do the RMR switch from AArch32 to AArch64,
if needed.
This is used by the final patch 26, which creates another _defconfig
to let the SPL compile for AArch32 using the Thumb2 encoding. This
results in a binary of less than 17KB in my case, so has plenty of
room for extensions.

Cheers,
Andre.

Changelog v3 .. v4:
- rebased on top of latest HEAD
- add various Reviewed-by: and Acked-by: tags
- add comments about register bit meanings in non-ODT-setting fix
- clarify meaning of delay values in single bit delay support patch
- removing stray semicolons from boot0.h header

Changelog v2 .. v3:
- add various Reviewed-by: and Acked-by: tags
- split tiny-printf fix to handle "-" separately
- add various comments and extend commit messages
- add assembly file to re-create the embedded RMR switch code
- add patch 14/26 to explain the MBUS priority setup
- move DRAM r/w delay values into #defines to simplify re-usablity
- replace #ifdef'ed addition of A64 support to the H3 DRAM driver with an
  approach using static parameters

Changelog v1 .. v2:
- drop SPI build fix (already merged)
- confine A31 register init change to H3 and A64
- use IS_ENABLED() instead of #idef to guard MBUS2 clock init
- fix tiny-printf (proper sign extension for 32-bit integers)
- add "size" output in commit msg to document tiny-printf size impact
- fix sdelay(): use only one register, add "cc" clobber
- update RMR switch code to provide easy access to RVBAR register address
- drop redundant DRAM frequency setting from Pine64 defconfig
- minor changes as requested by reviewers

Andre Przywara (21):
  sun6i: Restrict some register initialization to Allwinner A31 SoC
  armv8: prevent using THUMB
  armv8: add lowlevel_init.S
  SPL: tiny-printf: add "l" modifier
  SPL: tiny-printf: ignore "-" modifier
  move UL() macro from armv8/mmu.h into common.h
  SPL: make struct spl_image 64-bit safe
  armv8: add simple sdelay implementation
  armv8: move reset branch into boot hook
  ARM: boot0 hook: remove macro, include whole header file
  sunxi: introduce extra config option for boot0 header
  sunxi: A64: do an RMR switch if started in AArch32 mode
  sunxi: provide default DRAM config for sun50i in Kconfig
  sunxi: H3/A64: fix non-ODT setting
  sunxi: DRAM: fix H3 DRAM size display on aarch64
  sunxi: A64: enable SPL
  SPL: read and store arch property from U-Boot image
  Makefile: use "arm64" architecture for U-Boot image files
  ARM: SPL/FIT: differentiate between arm and arm64 arch properties
  sunxi: introduce RMR switch to enter payloads in 64-bit mode
  sunxi: A64: add 32-bit SPL support

Jens Kuske (3):
  sunxi: H3: add and rename some DRAM contoller registers
  sunxi: H3: add DRAM controller single bit delay support
  sunxi: A64: use H3 DRAM initialization code for A64 as well

Philipp Tomsich (2):
  sunxi: H3: Rework MBUS priority setup
  sunxi: clocks: Use the correct pattern register for PLL11

 Makefile                                        |   9 +-
 arch/arm/cpu/armv8/Makefile                     |   1 +
 arch/arm/cpu/armv8/cpu.c                        |  14 +
 arch/arm/cpu/armv8/lowlevel_init.S              |  44 +++
 arch/arm/cpu/armv8/start.S                      |   5 +-
 arch/arm/include/asm/arch-bcm235xx/boot0.h      |   8 +-
 arch/arm/include/asm/arch-bcm281xx/boot0.h      |   8 +-
 arch/arm/include/asm/arch-sunxi/boot0.h         |  37 ++-
 arch/arm/include/asm/arch-sunxi/clock_sun6i.h   |   1 +
 arch/arm/include/asm/arch-sunxi/cpu.h           |   3 +
 arch/arm/include/asm/arch-sunxi/dram.h          |   2 +-
 arch/arm/include/asm/arch-sunxi/dram_sun8i_h3.h |  53 ++--
 arch/arm/include/asm/armv8/mmu.h                |   8 -
 arch/arm/lib/Makefile                           |   2 +
 arch/arm/lib/spl.c                              |  15 +
 arch/arm/lib/vectors.S                          |   1 -
 arch/arm/mach-omap2/boot-common.c               |   2 +-
 arch/arm/mach-sunxi/Makefile                    |   2 +
 arch/arm/mach-sunxi/board.c                     |   2 +-
 arch/arm/mach-sunxi/clock_sun6i.c               |  10 +-
 arch/arm/mach-sunxi/dram_sun8i_h3.c             | 400 +++++++++++++++++-------
 arch/arm/mach-sunxi/rmr_switch.S                |  41 +++
 arch/arm/mach-sunxi/spl_switch.c                |  81 +++++
 arch/arm/mach-tegra/spl.c                       |   2 +-
 board/sunxi/Kconfig                             |  41 ++-
 common/spl/spl.c                                |   9 +-
 common/spl/spl_fit.c                            |   8 +
 common/spl/spl_mmc.c                            |   2 +-
 configs/pine64_plus_defconfig                   |   7 +-
 configs/sun50i_spl32_defconfig                  |  10 +
 include/common.h                                |  13 +-
 include/configs/sunxi-common.h                  |   4 +-
 include/spl.h                                   |  19 +-
 lib/tiny-printf.c                               |  50 ++-
 34 files changed, 713 insertions(+), 201 deletions(-)
 create mode 100644 arch/arm/cpu/armv8/lowlevel_init.S
 create mode 100644 arch/arm/mach-sunxi/rmr_switch.S
 create mode 100644 arch/arm/mach-sunxi/spl_switch.c
 create mode 100644 configs/sun50i_spl32_defconfig

-- 
2.8.2

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2017-08-11 11:29 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-02 11:48 [U-Boot] [PATCH v4 00/26] sunxi: Allwinner A64: SPL support Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 01/26] sun6i: Restrict some register initialization to Allwinner A31 SoC Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 02/26] armv8: prevent using THUMB Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 03/26] armv8: add lowlevel_init.S Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 04/26] SPL: tiny-printf: add "l" modifier Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 05/26] SPL: tiny-printf: ignore "-" modifier Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 06/26] move UL() macro from armv8/mmu.h into common.h Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 07/26] SPL: make struct spl_image 64-bit safe Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 08/26] armv8: add simple sdelay implementation Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 09/26] armv8: move reset branch into boot hook Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 10/26] ARM: boot0 hook: remove macro, include whole header file Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 11/26] sunxi: introduce extra config option for boot0 header Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 12/26] sunxi: A64: do an RMR switch if started in AArch32 mode Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 13/26] sunxi: provide default DRAM config for sun50i in Kconfig Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 14/26] sunxi: H3: Rework MBUS priority setup Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 15/26] sunxi: H3: add and rename some DRAM contoller registers Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 16/26] sunxi: H3: add DRAM controller single bit delay support Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 17/26] sunxi: clocks: Use the correct pattern register for PLL11 Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 18/26] sunxi: A64: use H3 DRAM initialization code for A64 as well Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 19/26] sunxi: H3/A64: fix non-ODT setting Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 20/26] sunxi: DRAM: fix H3 DRAM size display on aarch64 Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 21/26] sunxi: A64: enable SPL Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 22/26] SPL: read and store arch property from U-Boot image Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 23/26] Makefile: use "arm64" architecture for U-Boot image files Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 24/26] ARM: SPL/FIT: differentiate between arm and arm64 arch properties Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 25/26] sunxi: introduce RMR switch to enter payloads in 64-bit mode Andre Przywara
2017-01-02 11:48 ` [U-Boot] [PATCH v4 26/26] sunxi: A64: add 32-bit SPL support Andre Przywara
2017-01-13  2:19   ` Simon Glass
2017-01-13  9:42     ` Andre Przywara
2017-01-16  8:55       ` Maxime Ripard
2017-01-16  9:47         ` André Przywara
2017-01-16 13:41           ` Maxime Ripard
2017-01-03  2:38 ` [U-Boot] [linux-sunxi] [PATCH v4 00/26] sunxi: Allwinner A64: " jonsmirl at gmail.com
2017-01-03 10:41   ` Jagan Teki
2017-01-03 13:52     ` jonsmirl at gmail.com
2017-01-04 10:28       ` Jagan Teki
2017-01-04 11:25         ` Chen-Yu Tsai
2017-01-04 13:36           ` André Przywara
2017-01-04 16:40             ` jonsmirl at gmail.com
2017-01-04 17:29               ` André Przywara
2017-01-04 19:00                 ` jonsmirl at gmail.com
2017-01-04 22:36                   ` André Przywara
2017-01-04 22:59                     ` jonsmirl at gmail.com
2017-01-04 23:41                       ` André Przywara
2017-06-15  6:48                     ` BongHo Lee
2017-01-04 19:03                 ` jonsmirl at gmail.com
2017-01-04 15:50 ` [U-Boot] " Jagan Teki
2017-08-11 11:29   ` Jagan Teki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.