Skip to content

Commit

Permalink
sunxi: support loading with SPL > 32KB
Browse files Browse the repository at this point in the history
H616 supports and needs bigger SPL than 32 KiB, mostly due to big DRAM
driver and need for PMIC configuration, which pull several drivers which
are not needed otherwise.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
  • Loading branch information
Andre-ARM authored and jernejsk committed Nov 29, 2020
1 parent 3d5c058 commit fab8023
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions arch/arm/mach-sunxi/board.c
Expand Up @@ -277,6 +277,14 @@ uint32_t sunxi_get_boot_device(void)
}

#ifdef CONFIG_SPL_BUILD
static u32 sunxi_get_spl_size(void)
{
if (!is_boot0_magic(SPL_ADDR + 4)) /* eGON.BT0 */
return 32768;

return readl(SPL_ADDR + 0x10);
}

/*
* The eGON SPL image can be located at 8KB or at 128KB into an SD card or
* an eMMC device. The boot source has bit 4 set in the latter case.
Expand All @@ -286,6 +294,7 @@ uint32_t sunxi_get_boot_device(void)
unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
{
unsigned long sector = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
u32 spl_size = sunxi_get_spl_size();

switch (sunxi_get_boot_source()) {
case SUNXI_BOOTED_FROM_MMC0_HIGH:
Expand All @@ -294,6 +303,9 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
break;
}

if (spl_size > 32768)
sector += (spl_size - 32768) / 512;

return sector;
}

Expand Down

0 comments on commit fab8023

Please sign in to comment.