aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/imx-common/spl.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/imx-common/spl.c')
-rw-r--r--arch/arm/imx-common/spl.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c
index 46325ec344b..f392941f03e 100644
--- a/arch/arm/imx-common/spl.c
+++ b/arch/arm/imx-common/spl.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
+#include <asm/arch/sys_proto.h>
#include <asm/spl.h>
#include <spl.h>
#include <asm/imx-common/hab.h>
@@ -18,10 +19,8 @@
/* determine boot device from SRC_SBMR1 (BOOT_CFG[4:1]) or SRC_GPR9 register */
u32 spl_boot_device(void)
{
- struct src *psrc = (struct src *)SRC_BASE_ADDR;
- unsigned int gpr10_boot = readl(&psrc->gpr10) & (1 << 28);
- unsigned reg = gpr10_boot ? readl(&psrc->gpr9) : readl(&psrc->sbmr1);
- unsigned int bmode = readl(&psrc->sbmr2);
+ unsigned int bmode = readl(&src_base->sbmr2);
+ u32 reg = imx6_src_get_boot_mode();
/*
* Check for BMODE if serial downloader is enabled
@@ -29,42 +28,52 @@ u32 spl_boot_device(void)
*/
if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */
return BOOT_DEVICE_UART;
+
/* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
- switch ((reg & 0x000000FF) >> 4) {
+ switch ((reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT) {
/* EIM: See 8.5.1, Table 8-9 */
- case 0x0:
+ case IMX6_BMODE_EMI:
/* BOOT_CFG1[3]: NOR/OneNAND Selection */
- if ((reg & 0x00000008) >> 3)
+ switch ((reg & IMX6_BMODE_EMI_MASK) >> IMX6_BMODE_EMI_SHIFT) {
+ case IMX6_BMODE_ONENAND:
return BOOT_DEVICE_ONENAND;
- else
+ case IMX6_BMODE_NOR:
return BOOT_DEVICE_NOR;
break;
+ }
/* Reserved: Used to force Serial Downloader */
- case 0x1:
+ case IMX6_BMODE_UART:
return BOOT_DEVICE_UART;
/* SATA: See 8.5.4, Table 8-20 */
- case 0x2:
+ case IMX6_BMODE_SATA:
return BOOT_DEVICE_SATA;
/* Serial ROM: See 8.5.5.1, Table 8-22 */
- case 0x3:
+ case IMX6_BMODE_SERIAL_ROM:
/* BOOT_CFG4[2:0] */
- switch ((reg & 0x07000000) >> 24) {
- case 0x0 ... 0x4:
+ switch ((reg & IMX6_BMODE_SERIAL_ROM_MASK) >>
+ IMX6_BMODE_SERIAL_ROM_SHIFT) {
+ case IMX6_BMODE_ECSPI1:
+ case IMX6_BMODE_ECSPI2:
+ case IMX6_BMODE_ECSPI3:
+ case IMX6_BMODE_ECSPI4:
+ case IMX6_BMODE_ECSPI5:
return BOOT_DEVICE_SPI;
- case 0x5 ... 0x7:
+ case IMX6_BMODE_I2C1:
+ case IMX6_BMODE_I2C2:
+ case IMX6_BMODE_I2C3:
return BOOT_DEVICE_I2C;
}
break;
/* SD/eSD: 8.5.3, Table 8-15 */
- case 0x4:
- case 0x5:
+ case IMX6_BMODE_SD:
+ case IMX6_BMODE_ESD:
return BOOT_DEVICE_MMC1;
/* MMC/eMMC: 8.5.3 */
- case 0x6:
- case 0x7:
+ case IMX6_BMODE_MMC:
+ case IMX6_BMODE_EMMC:
return BOOT_DEVICE_MMC1;
- /* NAND Flash: 8.5.2 */
- case 0x8 ... 0xf:
+ /* NAND Flash: 8.5.2, Table 8-10 */
+ case IMX6_BMODE_NAND:
return BOOT_DEVICE_NAND;
}
return BOOT_DEVICE_NONE;