diff options
author | Andrew F. Davis <afd@ti.com> | 2018-10-03 10:03:23 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-10-10 13:35:08 -0400 |
commit | 81089a54300df5fa5b4a22e3bf4df6b521438f68 (patch) | |
tree | 3eac94c6a3a190224c7ac35e0560d4fb08460f3c /arch/arm/mach-k3 | |
parent | b5700efbc863669bc4e11283917aa9965c5fc8e8 (diff) |
arm: K3: am654: Add support for getting boot mode
Read the boot mode register to find the boot mode. Only use eMMC boot0
mode when the mode is eMMC boot (called BOOT_DEVICE_MMC1 currently due
to current conflating of boot mode and boot device), and not iff the
boot device is MMC port 0.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'arch/arm/mach-k3')
-rw-r--r-- | arch/arm/mach-k3/am6_init.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/mach-k3/am6_init.c b/arch/arm/mach-k3/am6_init.c index b2388b98ec..68f0b8c011 100644 --- a/arch/arm/mach-k3/am6_init.c +++ b/arch/arm/mach-k3/am6_init.c @@ -72,6 +72,29 @@ void board_init_f(ulong dummy) preloader_console_init(); } +u32 spl_boot_mode(const u32 boot_device) +{ +#if defined(CONFIG_SUPPORT_EMMC_BOOT) + u32 devstat = readl(CTRLMMR_MAIN_DEVSTAT); + u32 bootindex = readl(K3_BOOT_PARAM_TABLE_INDEX_VAL); + + u32 bootmode = (devstat & CTRLMMR_MAIN_DEVSTAT_BOOTMODE_MASK) >> + CTRLMMR_MAIN_DEVSTAT_BOOTMODE_SHIFT; + + /* eMMC boot0 mode is only supported for primary boot */ + if (bootindex == K3_PRIMARY_BOOTMODE && + bootmode == BOOT_DEVICE_MMC1) + return MMCSD_MODE_EMMCBOOT; +#endif + + /* Everything else use filesystem if available */ +#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT) + return MMCSD_MODE_FS; +#else + return MMCSD_MODE_RAW; +#endif +} + static u32 __get_backup_bootmedia(u32 devstat) { u32 bkup_boot = (devstat & CTRLMMR_MAIN_DEVSTAT_BKUP_BOOTMODE_MASK) >> |