[U-Boot] [PATCH 1/4] mx6: add function to determine boot device
Edward Lin
edward.lin at technexion.com
Fri Nov 8 10:34:13 CET 2013
During boot the boot pin configuration is copied to the SBMR registers.
This patch adds a function to read the boot device from SBMR.
Signed-off-by: Edward Lin <edward.lin at technexion.com>
Signed-off-by: Richard Hu <richard.hu at technexion.com>
---
arch/arm/cpu/armv7/mx6/soc.c | 43
+++++++++++++++++++++++++++++++
arch/arm/include/asm/arch-mx6/sys_proto.h | 17 ++++++++++++
2 files changed, 60 insertions(+)
diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index a390296..6bacdab 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -243,6 +243,49 @@ void s_init(void)
writel(mask528, &anatop->pfd_528_clr);
}
+enum mx6_boot_device imx_get_boot_device(void)
+{
+ uint soc_sbmr = readl(SRC_BASE_ADDR + 0x4);
+ uint bt_mem_ctl = (soc_sbmr & 0x000000FF) >> 4 ;
+ uint bt_mem_type = (soc_sbmr & 0x00000008) >> 3;
+ uint bt_mem_mmc = (soc_sbmr & 0x00001000) >> 12;
+
+ switch (bt_mem_ctl) {
+ case 0x0:
+ if (bt_mem_type)
+ return MX6_ONE_NAND_BOOT;
+ else
+ return MX6_WEIM_NOR_BOOT;
+ break;
+ case 0x2:
+ return MX6_SATA_BOOT;
+ break;
+ case 0x3:
+ if (bt_mem_type)
+ return MX6_I2C_BOOT;
+ else
+ return MX6_SPI_NOR_BOOT;
+ break;
+ case 0x4:
+ case 0x5:
+ if (bt_mem_mmc)
+ return MX6_SD0_BOOT;
+ else
+ return MX6_SD1_BOOT;
+ break;
+ case 0x6:
+ case 0x7:
+ return MX6_MMC_BOOT;
+ break;
+ case 0x8 ... 0xf:
+ return MX6_NAND_BOOT;
+ break;
+ default:
+ return MX6_UNKNOWN_BOOT;
+ break;
+ }
+}
+
#ifdef CONFIG_IMX_HDMI
void imx_enable_hdmi_phy(void)
{
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h
b/arch/arm/include/asm/arch-mx6/sys_proto.h
index 8c21364..b26955e 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -17,6 +17,21 @@
#define MXC_CPU_MX6SOLO 0x62
#define MXC_CPU_MX6Q 0x63
+enum mx6_boot_device {
+ MX6_SD0_BOOT,
+ MX6_SD1_BOOT,
+ MX6_MMC_BOOT,
+ MX6_NAND_BOOT,
+ MX6_SATA_BOOT,
+ MX6_WEIM_NOR_BOOT,
+ MX6_ONE_NAND_BOOT,
+ MX6_PATA_BOOT,
+ MX6_I2C_BOOT,
+ MX6_SPI_NOR_BOOT,
+ MX6_UNKNOWN_BOOT,
+ MX6_BOOT_DEV_NUM = MX6_UNKNOWN_BOOT,
+};
+
#define is_soc_rev(rev) ((get_cpu_rev() & 0xFF) - rev)
u32 get_cpu_rev(void);
@@ -31,6 +46,8 @@ unsigned imx_ddr_size(void);
void set_vddsoc(u32 mv);
+enum mx6_boot_device imx_get_boot_device(void);
+
/*
* Initializes on-chip ethernet controllers.
* to override, implement board_eth_init()
--
1.8.0
More information about the U-Boot
mailing list