diff mbox series

[U-Boot,v3,RESEND,1/2] ARM: imx: Fix bmode detection from grp10

Message ID 20191029120847.3581884-1-ch@denx.de
State Accepted
Commit e01c8cfe5769353f520fe99db80dd588fa357f44
Delegated to: Stefano Babic
Headers show
Series [U-Boot,v3,RESEND,1/2] ARM: imx: Fix bmode detection from grp10 | expand

Commit Message

Claudius Heine Oct. 29, 2019, 12:08 p.m. UTC
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).

Signed-off-by: Claudius Heine <ch@denx.de>
---
 arch/arm/include/asm/mach-imx/sys_proto.h | 5 -----
 arch/arm/mach-imx/init.c                  | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

Comments

Stefano Babic Nov. 4, 2019, 8:53 a.m. UTC | #1
> 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).
> Signed-off-by: Claudius Heine <ch@denx.de>

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

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h b/arch/arm/include/asm/mach-imx/sys_proto.h
index 4925dd7894..041f93f484 100644
--- a/arch/arm/include/asm/mach-imx/sys_proto.h
+++ b/arch/arm/include/asm/mach-imx/sys_proto.h
@@ -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);
 
diff --git a/arch/arm/mach-imx/init.c b/arch/arm/mach-imx/init.c
index b8d8d12372..d18e3c740a 100644
--- a/arch/arm/mach-imx/init.c
+++ b/arch/arm/mach-imx/init.c
@@ -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);