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>
This commit is contained in:
parent
3bbe8a9ea4
commit
7b84676763
|
@ -28,6 +28,7 @@ static const char *bootsource_str[] = {
|
||||||
[bootsource_spi] = "spi",
|
[bootsource_spi] = "spi",
|
||||||
[bootsource_serial] = "serial",
|
[bootsource_serial] = "serial",
|
||||||
[bootsource_onenand] = "onenand",
|
[bootsource_onenand] = "onenand",
|
||||||
|
[bootsource_hd] = "harddisk",
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum imx_bootsource bootsource;
|
static enum imx_bootsource bootsource;
|
||||||
|
@ -183,3 +184,37 @@ int imx51_boot_save_loc(void __iomem *src_base)
|
||||||
|
|
||||||
return 0;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <mach/imx53-regs.h>
|
#include <mach/imx53-regs.h>
|
||||||
#include <mach/revision.h>
|
#include <mach/revision.h>
|
||||||
#include <mach/clock-imx51_53.h>
|
#include <mach/clock-imx51_53.h>
|
||||||
|
#include <mach/generic.h>
|
||||||
|
|
||||||
#define SI_REV 0x48
|
#define SI_REV 0x48
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ static int imx53_silicon_revision(void)
|
||||||
static int imx53_init(void)
|
static int imx53_init(void)
|
||||||
{
|
{
|
||||||
imx53_silicon_revision();
|
imx53_silicon_revision();
|
||||||
|
imx53_boot_save_loc((void *)MX53_SRC_BASE_ADDR);
|
||||||
|
|
||||||
add_generic_device("imx_iim", 0, NULL, MX53_IIM_BASE_ADDR, SZ_4K,
|
add_generic_device("imx_iim", 0, NULL, MX53_IIM_BASE_ADDR, SZ_4K,
|
||||||
IORESOURCE_MEM, NULL);
|
IORESOURCE_MEM, NULL);
|
||||||
|
|
|
@ -10,6 +10,7 @@ enum imx_bootsource {
|
||||||
bootsource_spi,
|
bootsource_spi,
|
||||||
bootsource_serial,
|
bootsource_serial,
|
||||||
bootsource_onenand,
|
bootsource_onenand,
|
||||||
|
bootsource_hd,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum imx_bootsource imx_bootsource(void);
|
enum imx_bootsource imx_bootsource(void);
|
||||||
|
@ -18,6 +19,7 @@ void imx_set_bootsource(enum imx_bootsource src);
|
||||||
int imx_25_35_boot_save_loc(unsigned int ctrl, unsigned int type);
|
int imx_25_35_boot_save_loc(unsigned int ctrl, unsigned int type);
|
||||||
void imx_27_boot_save_loc(void __iomem *sysctrl_base);
|
void imx_27_boot_save_loc(void __iomem *sysctrl_base);
|
||||||
int imx51_boot_save_loc(void __iomem *src_base);
|
int imx51_boot_save_loc(void __iomem *src_base);
|
||||||
|
int imx53_boot_save_loc(void __iomem *src_base);
|
||||||
|
|
||||||
/* There's a off-by-one betweem the gpio bank number and the gpiochip */
|
/* There's a off-by-one betweem the gpio bank number and the gpiochip */
|
||||||
/* range e.g. GPIO_1_5 is gpio 5 under linux */
|
/* range e.g. GPIO_1_5 is gpio 5 under linux */
|
||||||
|
|
Loading…
Reference in New Issue