summaryrefslogtreecommitdiff
path: root/arch/arm/mach-k3/am6_init.c
diff options
context:
space:
mode:
authorAndrew F. Davis <afd@ti.com>2018-10-03 10:03:22 -0500
committerTom Rini <trini@konsulko.com>2018-10-10 13:35:08 -0400
commitb5700efbc863669bc4e11283917aa9965c5fc8e8 (patch)
tree1bae02ea62aefc16317b6f617cf41704bca8b450 /arch/arm/mach-k3/am6_init.c
parent0f3cf2b3e5d1116321eaf7d16338d91a5811143d (diff)
downloadu-boot-b5700efbc863669bc4e11283917aa9965c5fc8e8.tar.gz
arm: K3: am654: Choose MMC boot device based on boot port
For most devices the boot mode maps directly to the boot device. For MMC this is not the case as we have two MMC boot modes and two MMC boot devices (ports). Check the boot port to determine which MMC device was our boot device. Make this change for both primary and secondary boot modes. 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/am6_init.c')
-rw-r--r--arch/arm/mach-k3/am6_init.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/arch/arm/mach-k3/am6_init.c b/arch/arm/mach-k3/am6_init.c
index 8a3a99f23a..b2388b98ec 100644
--- a/arch/arm/mach-k3/am6_init.c
+++ b/arch/arm/mach-k3/am6_init.c
@@ -85,7 +85,13 @@ static u32 __get_backup_bootmedia(u32 devstat)
case BACKUP_BOOT_DEVICE_ETHERNET:
return BOOT_DEVICE_ETHERNET;
case BACKUP_BOOT_DEVICE_MMC2:
+ {
+ u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_MASK) >>
+ CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT;
+ if (port == 0x0)
+ return BOOT_DEVICE_MMC1;
return BOOT_DEVICE_MMC2;
+ }
case BACKUP_BOOT_DEVICE_SPI:
return BOOT_DEVICE_SPI;
case BACKUP_BOOT_DEVICE_HYPERFLASH:
@@ -99,11 +105,24 @@ static u32 __get_backup_bootmedia(u32 devstat)
static u32 __get_primary_bootmedia(u32 devstat)
{
- u32 bootmode = devstat & CTRLMMR_MAIN_DEVSTAT_BOOTMODE_MASK;
+ u32 bootmode = (devstat & CTRLMMR_MAIN_DEVSTAT_BOOTMODE_MASK) >>
+ CTRLMMR_MAIN_DEVSTAT_BOOTMODE_SHIFT;
if (bootmode == BOOT_DEVICE_OSPI || bootmode == BOOT_DEVICE_QSPI)
bootmode = BOOT_DEVICE_SPI;
+ if (bootmode == BOOT_DEVICE_MMC2) {
+ u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_MMC_PORT_MASK) >>
+ CTRLMMR_MAIN_DEVSTAT_MMC_PORT_SHIFT;
+ if (port == 0x0)
+ bootmode = BOOT_DEVICE_MMC1;
+ } else if (bootmode == BOOT_DEVICE_MMC1) {
+ u32 port = (devstat & CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_MASK) >>
+ CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT;
+ if (port == 0x1)
+ bootmode = BOOT_DEVICE_MMC2;
+ }
+
return bootmode;
}