[PATCH v2 6/7] ARM: i.MX53: Add bootsource instance information

Marc Kleine-Budde mkl at pengutronix.de
Wed Apr 3 04:12:15 EDT 2013


From: Sascha Hauer <s.hauer at pengutronix.de>

The i.MX53 has the bootsource instance information stored
in SBMR[21:22], expose it to the environment.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
---
 arch/arm/mach-imx/boot.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 7824206..bd0cb84 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -169,9 +169,10 @@ void imx51_boot_save_loc(void __iomem *src_base)
 void imx53_boot_save_loc(void __iomem *src_base)
 {
 	enum bootsource src = BOOTSOURCE_UNKNOWN;
-	uint32_t cfg1 = readl(src_base + IMX53_SRC_SBMR) & 0xff;
+	int instance;
+	uint32_t cfg1 = readl(src_base + IMX53_SRC_SBMR);
 
-	switch (cfg1 >> 4) {
+	switch ((cfg1 & 0xff) >> 4) {
 	case 2:
 		src = BOOTSOURCE_HD;
 		break;
@@ -194,7 +195,20 @@ void imx53_boot_save_loc(void __iomem *src_base)
 	if (cfg1 & (1 << 7))
 		src = BOOTSOURCE_NAND;
 
+
+	switch (src) {
+	case BOOTSOURCE_MMC:
+	case BOOTSOURCE_SPI:
+	case BOOTSOURCE_I2C:
+		instance = (cfg1 >> 21) & 0x3;
+		break;
+	default:
+		instance = 0;
+		break;
+	}
+
 	bootsource_set(src);
+	bootsource_set_instance(instance);
 }
 
 #define IMX6_SRC_SBMR1	0x04
-- 
1.8.2.rc2




More information about the barebox mailing list