From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] OMAP3/4/5/AM33xx: Correct logic for checking FAT or RAW MMC
Date: Fri, 5 Apr 2013 12:21:44 -0400 [thread overview]
Message-ID: <1365178906-22652-2-git-send-email-trini@ti.com> (raw)
In-Reply-To: <1365178906-22652-1-git-send-email-trini@ti.com>
In the case of booting from certain peripherals, such as UART, we must
not see what the device descriptor says for RAW or FAT mode because in
addition to being nonsensical, it leads to a hang. This is why we have
a test currently for the boot mode being within range. The problem
however is that on some platforms we get MMC2_2 as the boot mode and not
the defined value for MMC2, and in others we get the value for MMC2_2.
This is required to fix eMMC booting on omap5_uevm.
Tested on am335x_evm (UART, NAND, SD), omap3_beagle (NAND, SD on
classic, SD only on xM rev C5) and omap5_uevm (SD, eMMC).
Signed-off-by: Tom Rini <trini@ti.com>
---
arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 10 +++++++---
arch/arm/include/asm/arch-am33xx/spl.h | 3 +++
arch/arm/include/asm/arch-omap3/spl.h | 3 +++
arch/arm/include/asm/arch-omap4/spl.h | 2 ++
arch/arm/include/asm/arch-omap5/spl.h | 2 ++
5 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
index b933fe8..90b3c8a 100644
--- a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
@@ -60,10 +60,14 @@ ENTRY(save_boot_params)
ldr r3, =boot_params
strb r2, [r3, #BOOT_DEVICE_OFFSET] @ spl_boot_device <- r1
- /* boot mode is passed only for devices that can raw/fat mode */
- cmp r2, #BOOT_DEVICE_XIP
+ /*
+ * boot mode is only valid for device that can be raw or FAT booted.
+ * in other cases it may be fatal to look. While platforms differ
+ * in the values used for each MMC slot, they are contiguous.
+ */
+ cmp r2, #MMC_BOOT_DEVICES_START
blt 2f
- cmp r2, #BOOT_DEVICE_MMC2
+ cmp r2, #MMC_BOOT_DEVICES_END
bgt 2f
/* Store the boot mode (raw/FAT) in omap_bootmode */
ldr r2, [r0, #DEV_DESC_PTR_OFFSET] @ get the device descriptor ptr
diff --git a/arch/arm/include/asm/arch-am33xx/spl.h b/arch/arm/include/asm/arch-am33xx/spl.h
index f60b086..14a2c7c 100644
--- a/arch/arm/include/asm/arch-am33xx/spl.h
+++ b/arch/arm/include/asm/arch-am33xx/spl.h
@@ -37,4 +37,7 @@
#define BOOT_DEVICE_USBETH 68
#define BOOT_DEVICE_CPGMAC 70
#define BOOT_DEVICE_MMC2_2 0xFF
+
+#define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC1
+#define MMC_BOOT_DEVICES_END BOOT_DEVICE_MMC2
#endif
diff --git a/arch/arm/include/asm/arch-omap3/spl.h b/arch/arm/include/asm/arch-omap3/spl.h
index dec4dac..84e6d7b 100644
--- a/arch/arm/include/asm/arch-omap3/spl.h
+++ b/arch/arm/include/asm/arch-omap3/spl.h
@@ -31,4 +31,7 @@
#define BOOT_DEVICE_MMC1 6
#define BOOT_DEVICE_XIPWAIT 7
#define BOOT_DEVICE_MMC2_2 0xFF
+
+#define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC2
+#define MMC_BOOT_DEVICES_END BOOT_DEVICE_MMC1
#endif
diff --git a/arch/arm/include/asm/arch-omap4/spl.h b/arch/arm/include/asm/arch-omap4/spl.h
index 4e094f9..f61627f 100644
--- a/arch/arm/include/asm/arch-omap4/spl.h
+++ b/arch/arm/include/asm/arch-omap4/spl.h
@@ -32,4 +32,6 @@
#define BOOT_DEVICE_MMC2 6
#define BOOT_DEVICE_MMC2_2 0xFF
+#define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC1
+#define MMC_BOOT_DEVICES_END BOOT_DEVICE_MMC2
#endif
diff --git a/arch/arm/include/asm/arch-omap5/spl.h b/arch/arm/include/asm/arch-omap5/spl.h
index 323cd63..d4d353c 100644
--- a/arch/arm/include/asm/arch-omap5/spl.h
+++ b/arch/arm/include/asm/arch-omap5/spl.h
@@ -32,4 +32,6 @@
#define BOOT_DEVICE_MMC2 6
#define BOOT_DEVICE_MMC2_2 7
+#define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC1
+#define MMC_BOOT_DEVICES_END BOOT_DEVICE_MMC2_2
#endif
--
1.7.9.5
next prev parent reply other threads:[~2013-04-05 16:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-05 16:21 [U-Boot] [PATCH 0/3] OMAP5: Improve uEVM support Tom Rini
2013-04-05 16:21 ` Tom Rini [this message]
2013-04-08 10:44 ` [U-Boot] [PATCH 1/3] OMAP3/4/5/AM33xx: Correct logic for checking FAT or RAW MMC Sricharan R
2013-04-09 14:52 ` Peter Korsgaard
2013-04-09 15:39 ` Tom Rini
2013-04-05 16:21 ` [U-Boot] [PATCH 2/3] omap5_evm.h: Move uEVM-specific choices to omap5_evm.h Tom Rini
2013-04-08 16:34 ` Tom Rini
2013-04-05 16:21 ` [U-Boot] [PATCH 3/3] omap5_common.h: Use fallback CONFIG_SYS_BAUDRATE_TABLE Tom Rini
2013-04-08 16:35 ` [U-Boot] [PATCH 0/3] OMAP5: Improve uEVM support Tom Rini
2013-04-08 16:55 ` 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=1365178906-22652-2-git-send-email-trini@ti.com \
--to=trini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox