From: Andrew F. Davis <afd@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] arm: K3: am654: Add support for getting boot mode
Date: Wed, 3 Oct 2018 10:03:23 -0500 [thread overview]
Message-ID: <20181003150323.19923-2-afd@ti.com> (raw)
In-Reply-To: <20181003150323.19923-1-afd@ti.com>
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>
---
arch/arm/mach-k3/am6_init.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
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) >>
--
2.18.0
next prev parent reply other threads:[~2018-10-03 15:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 15:03 [U-Boot] [PATCH 1/2] arm: K3: am654: Choose MMC boot device based on boot port Andrew F. Davis
2018-10-03 15:03 ` Andrew F. Davis [this message]
2018-10-03 15:06 ` [U-Boot] [PATCH 2/2] arm: K3: am654: Add support for getting boot mode Tom Rini
2018-10-03 15:13 ` Lokesh Vutla
2018-10-11 14:12 ` [U-Boot] [U-Boot, " Tom Rini
2018-10-03 15:06 ` [U-Boot] [PATCH 1/2] arm: K3: am654: Choose MMC boot device based on boot port Tom Rini
2018-10-03 15:13 ` Lokesh Vutla
2018-10-11 14:12 ` [U-Boot] [U-Boot, " Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181003150323.19923-2-afd@ti.com \
--to=afd@ti.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.