* [U-Boot] [PATCH] arm: imx: make bmode command work with SPL/U-Boot combo
@ 2014-10-29 17:28 Nikita Kiryanov
2014-11-11 15:29 ` Nikita Kiryanov
2014-11-12 8:05 ` Stefano Babic
0 siblings, 2 replies; 3+ messages in thread
From: Nikita Kiryanov @ 2014-10-29 17:28 UTC (permalink / raw)
To: u-boot
The bmode command forces the SoC to use a specific boot device
by writing its boot mode into SRC_GPR9, and notifying the SoC of
the change using SRC_GPR10[28] bit: if the bit is on, bootROM
uses the value in SRC_GPR9 instead of SRC_SMBR1 to determine
the boot device.
SPL on the other hand is oblivious to this distinction, so once
the bootROM loads SPL from the device configured in SRC_GPR10,
SPL will attempt to load U-Boot from the device configured in
SRC_SMBR1, which is not updated by the bootROM to the value in
SRC_GPR9.
The result is that the selected boot device is not used across all
the boot stages.
Update spl_boot_device() to look at gpr9 when necessary.
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Troy Kisky <troy.kisky@boundarydevices.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Heiko Schocher <hs@denx.de>
---
arch/arm/cpu/armv7/mx6/soc.c | 4 ++--
arch/arm/imx-common/spl.c | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index dd5aaa2..07ae79e 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -333,8 +333,8 @@ void boot_mode_apply(unsigned cfg_val)
/*
* cfg_val will be used for
* Boot_cfg4[7:0]:Boot_cfg3[7:0]:Boot_cfg2[7:0]:Boot_cfg1[7:0]
- * After reset, if GPR10[28] is 1, ROM will copy GPR9[25:0]
- * to SBMR1, which will determine the boot device.
+ * After reset, if GPR10[28] is 1, ROM will use GPR9[25:0]
+ * instead of SBMR1 to determine the boot device.
*/
const struct boot_mode soc_boot_modes[] = {
{"normal", MAKE_CFGVAL(0x00, 0x00, 0x00, 0x00)},
diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c
index 9d3c31a..477c38c 100644
--- a/arch/arm/imx-common/spl.c
+++ b/arch/arm/imx-common/spl.c
@@ -14,11 +14,12 @@
#include <spl.h>
#if defined(CONFIG_MX6)
-/* determine boot device from SRC_SBMR1 register (BOOT_CFG[4:1]) */
+/* 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 reg = readl(&psrc->sbmr1);
+ unsigned int gpr10_boot = readl(&psrc->gpr10) & (1 << 28);
+ unsigned reg = gpr10_boot ? readl(&psrc->gpr9) : readl(&psrc->sbmr1);
/* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
switch ((reg & 0x000000FF) >> 4) {
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot] [PATCH] arm: imx: make bmode command work with SPL/U-Boot combo
2014-10-29 17:28 [U-Boot] [PATCH] arm: imx: make bmode command work with SPL/U-Boot combo Nikita Kiryanov
@ 2014-11-11 15:29 ` Nikita Kiryanov
2014-11-12 8:05 ` Stefano Babic
1 sibling, 0 replies; 3+ messages in thread
From: Nikita Kiryanov @ 2014-11-11 15:29 UTC (permalink / raw)
To: u-boot
Gentle ping.
On 10/29/2014 07:28 PM, Nikita Kiryanov wrote:
> The bmode command forces the SoC to use a specific boot device
> by writing its boot mode into SRC_GPR9, and notifying the SoC of
> the change using SRC_GPR10[28] bit: if the bit is on, bootROM
> uses the value in SRC_GPR9 instead of SRC_SMBR1 to determine
> the boot device.
>
> SPL on the other hand is oblivious to this distinction, so once
> the bootROM loads SPL from the device configured in SRC_GPR10,
> SPL will attempt to load U-Boot from the device configured in
> SRC_SMBR1, which is not updated by the bootROM to the value in
> SRC_GPR9.
>
> The result is that the selected boot device is not used across all
> the boot stages.
>
> Update spl_boot_device() to look at gpr9 when necessary.
>
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Troy Kisky <troy.kisky@boundarydevices.com>
> Cc: Tim Harvey <tharvey@gateworks.com>
> Cc: Eric Nelson <eric.nelson@boundarydevices.com>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: Heiko Schocher <hs@denx.de>
> ---
> arch/arm/cpu/armv7/mx6/soc.c | 4 ++--
> arch/arm/imx-common/spl.c | 5 +++--
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
> index dd5aaa2..07ae79e 100644
> --- a/arch/arm/cpu/armv7/mx6/soc.c
> +++ b/arch/arm/cpu/armv7/mx6/soc.c
> @@ -333,8 +333,8 @@ void boot_mode_apply(unsigned cfg_val)
> /*
> * cfg_val will be used for
> * Boot_cfg4[7:0]:Boot_cfg3[7:0]:Boot_cfg2[7:0]:Boot_cfg1[7:0]
> - * After reset, if GPR10[28] is 1, ROM will copy GPR9[25:0]
> - * to SBMR1, which will determine the boot device.
> + * After reset, if GPR10[28] is 1, ROM will use GPR9[25:0]
> + * instead of SBMR1 to determine the boot device.
> */
> const struct boot_mode soc_boot_modes[] = {
> {"normal", MAKE_CFGVAL(0x00, 0x00, 0x00, 0x00)},
> diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c
> index 9d3c31a..477c38c 100644
> --- a/arch/arm/imx-common/spl.c
> +++ b/arch/arm/imx-common/spl.c
> @@ -14,11 +14,12 @@
> #include <spl.h>
>
> #if defined(CONFIG_MX6)
> -/* determine boot device from SRC_SBMR1 register (BOOT_CFG[4:1]) */
> +/* 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 reg = readl(&psrc->sbmr1);
> + unsigned int gpr10_boot = readl(&psrc->gpr10) & (1 << 28);
> + unsigned reg = gpr10_boot ? readl(&psrc->gpr9) : readl(&psrc->sbmr1);
>
> /* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
> switch ((reg & 0x000000FF) >> 4) {
>
--
Regards,
Nikita Kiryanov
^ permalink raw reply [flat|nested] 3+ messages in thread* [U-Boot] [PATCH] arm: imx: make bmode command work with SPL/U-Boot combo
2014-10-29 17:28 [U-Boot] [PATCH] arm: imx: make bmode command work with SPL/U-Boot combo Nikita Kiryanov
2014-11-11 15:29 ` Nikita Kiryanov
@ 2014-11-12 8:05 ` Stefano Babic
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Babic @ 2014-11-12 8:05 UTC (permalink / raw)
To: u-boot
Hi Nikita,
On 29/10/2014 18:28, Nikita Kiryanov wrote:
> The bmode command forces the SoC to use a specific boot device
> by writing its boot mode into SRC_GPR9, and notifying the SoC of
> the change using SRC_GPR10[28] bit: if the bit is on, bootROM
> uses the value in SRC_GPR9 instead of SRC_SMBR1 to determine
> the boot device.
>
> SPL on the other hand is oblivious to this distinction, so once
> the bootROM loads SPL from the device configured in SRC_GPR10,
> SPL will attempt to load U-Boot from the device configured in
> SRC_SMBR1, which is not updated by the bootROM to the value in
> SRC_GPR9.
>
> The result is that the selected boot device is not used across all
> the boot stages.
>
> Update spl_boot_device() to look at gpr9 when necessary.
>
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Troy Kisky <troy.kisky@boundarydevices.com>
> Cc: Tim Harvey <tharvey@gateworks.com>
> Cc: Eric Nelson <eric.nelson@boundarydevices.com>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: Heiko Schocher <hs@denx.de>
> ---
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-12 8:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-29 17:28 [U-Boot] [PATCH] arm: imx: make bmode command work with SPL/U-Boot combo Nikita Kiryanov
2014-11-11 15:29 ` Nikita Kiryanov
2014-11-12 8:05 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox