* [U-Boot] [PATCH 1/4] mx6: add function to determine boot device
[not found] <1383902813.3157.481.camel@edward-x220-laptop>
@ 2013-11-08 9:34 ` Edward Lin
2013-11-08 23:09 ` Eric Nelson
0 siblings, 1 reply; 2+ messages in thread
From: Edward Lin @ 2013-11-08 9:34 UTC (permalink / raw)
To: u-boot
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@technexion.com>
Signed-off-by: Richard Hu <richard.hu@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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH 1/4] mx6: add function to determine boot device
2013-11-08 9:34 ` [U-Boot] [PATCH 1/4] mx6: add function to determine boot device Edward Lin
@ 2013-11-08 23:09 ` Eric Nelson
0 siblings, 0 replies; 2+ messages in thread
From: Eric Nelson @ 2013-11-08 23:09 UTC (permalink / raw)
To: u-boot
Hi Edward,
On 11/08/2013 02:34 AM, Edward Lin wrote:
> 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@technexion.com>
> Signed-off-by: Richard Hu <richard.hu@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);
(struct src)->sbmr1? (from imx-regs.h)
> + uint bt_mem_ctl = (soc_sbmr & 0x000000FF) >> 4 ;
You may want a macro here, but certainly don't need the
low four bits set.
> + 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;
> + }
> +}
> +
These magic values are the same as those used in
arch/arm/cpu/armv7/mx6/soc.c for the "bmode" command,
so I'd personally like to see some constants...
I'd also like to know where the definitive reference
for these is. I have a spreadsheet of dubious ancestry,
and the current RM has the very helpful comment
"Refer to the fusemap", and the fuse map is similarly
opaque.
Troy? Anyone?
> #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,
> +};
> +
It might make sense to just place these into the
soc_boot_modes table, gain "bmode" support for all
of them, and have imx_get_boot_device() walk the
table.
At the moment, it appears that only USB, SATA,
SPI-NOR, and SD card are supported by "bmode".
Regards,
Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-08 23:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1383902813.3157.481.camel@edward-x220-laptop>
2013-11-08 9:34 ` [U-Boot] [PATCH 1/4] mx6: add function to determine boot device Edward Lin
2013-11-08 23:09 ` Eric Nelson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox