mbox series

[0/2] sunxi: Support automated booting from 128KB

Message ID 20200110014732.4185-1-andre.przywara@arm.com
Headers show
Series sunxi: Support automated booting from 128KB | expand

Message

Andre Przywara Jan. 10, 2020, 1:47 a.m. UTC
The Allwinner Boot ROM on all later SoCs can load the initial SPL code
from offset 128KB or from offset 8KB of an SD card or eMMC.
We support this in the SPL for a while now, but so far needed to manually
adjust the U-Boot image MMC load sector during compile time.

Since the Boot ROM writes a different boot source ID into the SRAM when
loaded from the higher offset, we can check this value and dynamically
adjust the raw MMC load sector for the U-Boot proper image.

This allows to generate *one* image file, which can be written to either
offset 8KB or to offset 128KB. The latter has the advantange of not
overlapping with a standard GPT partition table.

Tested on Bananapi M2 Berry (R40), Orangepi Zero (H2+), Orangepi PC 2 (H5),
Pine64-LTS (A64), Bananapi-M64 (A64, both SD card and eMMC) and
Pine H64 (H6), on all boards writing the same image to both 8K and 128K.

Cheers,
Andre.

Andre Przywara (2):
  sunxi: SPL: Factor out sunxi_get_boot_source()
  sunxi: Automate loading from 128KB MMC offset

 arch/arm/mach-sunxi/board.c | 38 +++++++++++++++++++++++++++++++++-----
 1 file changed, 33 insertions(+), 5 deletions(-)

Comments

Jagan Teki Jan. 26, 2020, 3:31 p.m. UTC | #1
On Fri, Jan 10, 2020 at 7:17 AM Andre Przywara <andre.przywara at arm.com> wrote:
>
> The Allwinner Boot ROM on all later SoCs can load the initial SPL code
> from offset 128KB or from offset 8KB of an SD card or eMMC.
> We support this in the SPL for a while now, but so far needed to manually
> adjust the U-Boot image MMC load sector during compile time.
>
> Since the Boot ROM writes a different boot source ID into the SRAM when
> loaded from the higher offset, we can check this value and dynamically
> adjust the raw MMC load sector for the U-Boot proper image.
>
> This allows to generate *one* image file, which can be written to either
> offset 8KB or to offset 128KB. The latter has the advantange of not
> overlapping with a standard GPT partition table.
>
> Tested on Bananapi M2 Berry (R40), Orangepi Zero (H2+), Orangepi PC 2 (H5),
> Pine64-LTS (A64), Bananapi-M64 (A64, both SD card and eMMC) and
> Pine H64 (H6), on all boards writing the same image to both 8K and 128K.
>
> Cheers,
> Andre.
>
> Andre Przywara (2):
>   sunxi: SPL: Factor out sunxi_get_boot_source()
>   sunxi: Automate loading from 128KB MMC offset

Applied to u-boot-sunxi/master