Skip to contentSkip to conversation

ARM: imx: Fix bmode detection from grp10

PATCH RESEND New Claudius Heine 2 participants 4 messages Oct 29, 2019 – Nov 4, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND v3 1/2 ARM: imx: Fix bmode detection from grp10

imx6_is_bmode_from_gpr9 always returns false, because IMX6_SRC_GPR10_BMODE is 1<<28 and gets casted to u8 on return.

This moves the function body into imx6_src_get_boot_mode, since that is the only one using it and it is on the same abstraction level (accessing registers directly).

---
 arch/arm/include/asm/mach-imx/sys_proto.h | 5 -----
 arch/arm/mach-imx/init.c                  | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)
arch/arm/include/asm/mach-imx/sys_proto.h +0 -5
index 4925dd7894..041f93f484 100644
@@ -89,11 +89,6 @@ enum imx6_bmode {
 	IMX6_BMODE_NAND_MAX = 0xf,
 };
 
-static inline u8 imx6_is_bmode_from_gpr9(void)
-{
-	return readl(&src_base->gpr10) & IMX6_SRC_GPR10_BMODE;
-}
-
 u32 imx6_src_get_boot_mode(void);
 void gpr_init(void);
 
arch/arm/mach-imx/init.c +1 -1
index b8d8d12372..d18e3c740a 100644
@@ -118,7 +118,7 @@ void boot_mode_apply(unsigned cfg_val)
 #if defined(CONFIG_MX6)
 u32 imx6_src_get_boot_mode(void)
 {
-	if (imx6_is_bmode_from_gpr9())
+	if (readl(&src_base->gpr10) & IMX6_SRC_GPR10_BMODE)
 		return readl(&src_base->gpr9);
 	else
 		return readl(&src_base->sbmr1);
Signature · 1 line
2.21.0
#1 lore raw

PATCH RESEND v3 2/2 ARM: imx: Use IMX6_SRC_GPR10_BMODE instead of magic number

---
 arch/arm/mach-imx/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/init.c +2 -2
index d18e3c740a..693b724429 100644
@@ -108,9 +108,9 @@ void boot_mode_apply(unsigned cfg_val)
 	writel(cfg_val, &psrc->gpr9);
 	reg = readl(&psrc->gpr10);
 	if (cfg_val)
-		reg |= 1 << 28;
+		reg |= IMX6_SRC_GPR10_BMODE;
 	else
-		reg &= ~(1 << 28);
+		reg &= ~IMX6_SRC_GPR10_BMODE;
 	writel(reg, &psrc->gpr10);
 }
 #endif
Signature · 1 line
2.21.0
#2 lore raw

PATCH RESEND v3 2/2 ARM: imx: Use IMX6_SRC_GPR10_BMODE instead of magic number

Quoted 1 line

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
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
=====================================================================
#3 lore raw

PATCH RESEND v3 1/2 ARM: imx: Fix bmode detection from grp10

In reply to Claudius Heine
Quoted 6 lines

imx6_is_bmode_from_gpr9 always returns false, because IMX6_SRC_GPR10_BMODE is 1<<28 and gets casted to u8 on return. This moves the function body into imx6_src_get_boot_mode, since that is the only one using it and it is on the same abstraction level (accessing registers directly).

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
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
=====================================================================