diff options
author | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2016-09-16 10:29:04 +0200 |
---|---|---|
committer | Klaus Goger <klaus.goger@theobroma-systems.com> | 2016-09-18 20:22:05 +0200 |
commit | ec5a2b9d59dce5b6e6099766423e9f9acc7ad698 (patch) | |
tree | 27aaa2e35d3e0c6c6f8f6c9875676e9dcc76c28c /arch | |
parent | 8c52e6d902990517fe67cbd7d8581df45c8335a1 (diff) |
sunxi: Set probing order for SPL via board_boot_order() for sun9i
As SPL can probe multiple interfaces, we can let it do the work for
FIT images and simply provide the board_boot_order hook.
This mechanism is fully implemented for sun9i (i.e. A80) platforms
and falls back to the old mechanism of determining a single boot
device for older/other platforms for now.
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/cpu/armv7/sunxi/board.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c index 1bc71af863..99ec4b7225 100644 --- a/arch/arm/cpu/armv7/sunxi/board.c +++ b/arch/arm/cpu/armv7/sunxi/board.c @@ -163,6 +163,53 @@ void s_init(void) #ifdef CONFIG_SPL_BUILD DECLARE_GLOBAL_DATA_PTR; + +/* Override the weak board_boot_order to support SPL probing multiple + * interfaces in a defined order + */ + +static void sun9i_boot_order(u32 *spl_boot_list) +{ + struct sunxi_sysctl_reg *const sysctl = + (struct sunxi_sysctl_reg *)SUNXI_SYSCTL_BASE; + u32 reg = readl(&sysctl->version); + u32 bootsel = (reg >> 8) & 0x3; + + /* + * This checks for the signature and if it is not found returns to + * the FEL code in the BROM to wait and receive the main u-boot + * binary over USB. If it is found, it determines where SPL was + * read from. + */ + spl_boot_list[0] = BOOT_DEVICE_BOARD; + + if (!is_boot0_magic(SPL_ADDR + 4)) /* eGON.BT0 */ + return; + + switch (bootsel) { + case 0b00: /* 'BIOS Disable' setting on A80-Q7 */ + spl_boot_list[0] = BOOT_DEVICE_MMC1; /* microSD card */ + spl_boot_list[1] = BOOT_DEVICE_MMC2; /* eMMC */ + spl_boot_list[2] = BOOT_DEVICE_SPI; + break; + + case 0b10: /* 'Normal BOOT' setting on A80-Q7 */ + default: + spl_boot_list[0] = BOOT_DEVICE_MMC2; /* eMMC */ + spl_boot_list[1] = BOOT_DEVICE_MMC1; + break; + } +} + +void board_boot_order(u32 *spl_boot_list) +{ +#ifdef CONFIG_MACH_SUN9I + sun9i_boot_order(spl_boot_list); +#else + spl_boot_list[0] = spl_boot_device(); +#endif +} + /* The sunxi internal brom will try to loader external bootloader * from mmc0, nand flash, mmc2. */ |