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

Signed-off-by: Sascha Hauer <s.ha...@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to