diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-10-12 16:10:53 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-10-17 20:22:58 +0200 |
commit | 7b84676763a16167ce141cbb693d441664ffbb23 (patch) | |
tree | 3d1c809edc558e852aee4f059ede83b15438e7d7 /arch/arm/mach-imx/boot.c | |
parent | 3bbe8a9ea432be24d2d4743e5fca5795963ae32a (diff) | |
download | barebox-7b84676763a16167ce141cbb693d441664ffbb23.tar.gz barebox-7b84676763a16167ce141cbb693d441664ffbb23.tar.xz |
ARM i.MX53: set bootsource location
To be able to set the environment location based on the
bootsource.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx/boot.c')
-rw-r--r-- | arch/arm/mach-imx/boot.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c index 409c237403..cdddbe5824 100644 --- a/arch/arm/mach-imx/boot.c +++ b/arch/arm/mach-imx/boot.c @@ -28,6 +28,7 @@ static const char *bootsource_str[] = { [bootsource_spi] = "spi", [bootsource_serial] = "serial", [bootsource_onenand] = "onenand", + [bootsource_hd] = "harddisk", }; static enum imx_bootsource bootsource; @@ -183,3 +184,37 @@ int imx51_boot_save_loc(void __iomem *src_base) return 0; } + +#define IMX53_SRC_SBMR 0x4 +int imx53_boot_save_loc(void __iomem *src_base) +{ + enum imx_bootsource src = bootsource_unknown; + uint32_t cfg1 = readl(src_base + IMX53_SRC_SBMR) & 0xff; + + switch (cfg1 >> 4) { + case 2: + src = bootsource_hd; + break; + case 3: + if (cfg1 & (1 << 3)) + src = bootsource_spi; + else + src = bootsource_i2c; + break; + case 4: + case 5: + case 6: + case 7: + src = bootsource_mmc; + break; + default: + break; + } + + if (cfg1 & (1 << 7)) + src = bootsource_nand; + + imx_set_bootsource(src); + + return 0; +} |