sunxi: Allow booting from 128KB SD/eMMC offset
Subsystems (3)
PATCH 1/1 sunxi: Allow booting from 128KB SD/eMMC offset
On modern Allwinner SoCs (tested: H2+, A64, H5, H6) the BootROM can actually load the SPL also from sector 256 (128KB) of an SD card or eMMC chip. For more details, see [1].
In this case the boot source indicator (written at offset 0x28 of SRAM A1) has bit 4 set, so it's 0x10 for SD card and 0x12 for eMMC.
Add those new values to the existing boot source check to allow booting the SPL from those "high" disk offsets as well. For this to work, the value of CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR needs to be adjusted, for instance to 0x140 (right after the high SPL). Doing this dynamically sounds desirable, but looks nasty to implement.
[1] https://groups.google.com/forum/#!topic/linux-sunxi/MaiijyaAFjk
--- arch/arm/include/asm/arch-sunxi/spl.h | 2 ++ arch/arm/mach-sunxi/board.c | 2 ++ 2 files changed, 4 insertions(+)
arch/arm/include/asm/arch-sunxi/spl.h +2 -0
@@ -28,6 +28,8 @@#define SUNXI_BOOTED_FROM_NAND 1#define SUNXI_BOOTED_FROM_MMC2 2#define SUNXI_BOOTED_FROM_SPI 3 +#define SUNXI_BOOTED_FROM_MMC0_HIGH 0x10 +#define SUNXI_BOOTED_FROM_MMC2_HIGH 0x12/* boot head definition from sun4i boot code */ struct boot_file_head {
arch/arm/mach-sunxi/board.c +2 -0
@@ -240,10 +240,12 @@ uint32_t sunxi_get_boot_device(void) boot_source =readb (SPL_ADDR +0x28 );switch (boot_source) {case SUNXI_BOOTED_FROM_MMC0 : +case SUNXI_BOOTED_FROM_MMC0_HIGH :return BOOT_DEVICE_MMC1 ;case SUNXI_BOOTED_FROM_NAND :return BOOT_DEVICE_NAND ;case SUNXI_BOOTED_FROM_MMC2 : +case SUNXI_BOOTED_FROM_MMC2_HIGH :return BOOT_DEVICE_MMC2 ;case SUNXI_BOOTED_FROM_SPI :return BOOT_DEVICE_SPI ;
Signature · 1 line
2.14.5
PATCH 1/1 sunxi: Allow booting from 128KB SD/eMMC offset
Quoted 12 lines · Andre Przywara
On modern Allwinner SoCs (tested: H2+, A64, H5, H6) the BootROM can actually load the SPL also from sector 256 (128KB) of an SD card or eMMC chip. For more details, see [1].
In this case the boot source indicator (written at offset0x28of SRAM A1) has bit 4 set, so it's0x10for SD card and0x12for eMMC.Add those new values to the existing boot source check to allow booting the SPL from those "high" disk offsets as well. For this to work, the value of
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTORneeds to be adjusted, for instance to0x140(right after the high SPL). Doing this dynamically sounds desirable, but looks nasty to implement.
Quoted 3 lines
[1] https://groups.google.com/forum/#!topic/linux-sunxi/MaiijyaAFjk
Signed-off-by Andre Przywara <[email protected]>
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 228 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181217/e4bc56f2/attachment.sig>