ARM: imx: Add bmode support for iMX7
Subsystems (3)
PATCH 1/4 ARM: imx: Add bmode support for iMX7
Add the basic differentiation between i.MX6 and i.MX7 into the bmode command, the mechanism really works almost the same on both platforms.
--- arch/arm/include/asm/mach-imx/sys_proto.h | 6 +++++- arch/arm/mach-imx/Kconfig | 2 +- arch/arm/mach-imx/init.c | 12 +++++++++--- arch/arm/mach-imx/mx7/soc.c | 8 ++++++++ 4 files changed, 23 insertions(+), 5 deletions(-)
arch/arm/include/asm/mach-imx/sys_proto.h +5 -1
@@ -78,7 +78,7 @@ struct bd_info;#define is_imx8qxp () (is_cpu_type(MXC_CPU_IMX8QXP))#ifdef CONFIG_MX6 -#define IMX6_SRC_GPR10_BMODE BIT(28) +#define IMX6_SRC_GPR10_BMODE BIT(28)#define IMX6_BMODE_MASK GENMASK(7, 0)#define IMX6_BMODE_SHIFT 4
@@ -126,6 +126,10 @@ void gpr_init(void);#endif /* CONFIG_MX6 */ +#ifdef CONFIG_MX7 +#define IMX7_SRC_GPR10_BMODE BIT(28) +#endif +/* address translation table */ struct rproc_att {u32 da;/* device address (From Cortex M4 view) */
arch/arm/mach-imx/Kconfig +1 -1
@@ -62,7 +62,7 @@ config CSF_SIZE config CMD_BMODE bool "Support the 'bmode' command" default y - depends on ARCH_MX6 || ARCH_MX5 + depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX5 help This enables the 'bmode' (bootmode) command for forcing a boot from specific media.
arch/arm/mach-imx/init.c +9 -3
@@ -103,14 +103,20 @@ void init_src(void)#ifdef CONFIG_CMD_BMODE void boot_mode_apply (unsigned cfg_val) { -unsigned reg; +#ifdef CONFIG_MX6 +const u32 bmode =IMX6_SRC_GPR10_BMODE ; +#elif CONFIG_MX7 +const u32 bmode =IMX7_SRC_GPR10_BMODE ; +#endif struct src *psrc = (struct src *)SRC_BASE_ADDR ; +unsigned reg; +writel (cfg_val, &psrc->gpr9); reg =readl (&psrc->gpr10);if (cfg_val) - reg |=IMX6_SRC_GPR10_BMODE ; + reg |= bmode;else - reg &= ~IMX6_SRC_GPR10_BMODE ; + reg &= ~bmode;writel (reg, &psrc->gpr10); }#endif
arch/arm/mach-imx/mx7/soc.c +8 -0
@@ -13,6 +13,7 @@#include <asm/mach-imx/hab.h> #include <asm/mach-imx/rdc-sema.h> #include <asm/arch/imx-rdc.h> +#include <asm/mach-imx/boot_mode.h> #include <asm/arch/crm_regs.h> #include <dm.h> #include <env.h>
@@ -411,6 +412,13 @@ void s_init(void)return ; } +#ifndef CONFIG_SPL_BUILD +const struct boot_mode soc_boot_modes[] = { + {"normal" ,MAKE_CFGVAL (0x00 ,0x00 ,0x00 ,0x00 )}, + {NULL ,0 }, +}; +#endif +void reset_misc (void ) {#ifndef CONFIG_SPL_BUILD
Signature · 1 line
2.27.0
PATCH 2/4 ARM: imx: Add support for switching primary/secondary boot mode to bmode
The i.MX6/i.MX7 is capable of booting a secondary "redundant" system image in case the primary one is corrupted. The user can force this boot mode as well by explicitly setting SRC GPR10 bit 30. This can be potentially useful when upgrading the bootloader itself. Expose this functionality to the user.
--- arch/arm/include/asm/mach-imx/boot_mode.h | 2 ++ arch/arm/include/asm/mach-imx/sys_proto.h | 2 ++ arch/arm/mach-imx/init.c | 22 +++++++++++++++------- arch/arm/mach-imx/mx7/soc.c | 2 ++ 4 files changed, 21 insertions(+), 7 deletions(-)
arch/arm/include/asm/mach-imx/boot_mode.h +2 -0
@@ -7,6 +7,8 @@#define _ASM_BOOT_MODE_H#define MAKE_CFGVAL (cfg1, cfg2, cfg3, cfg4) \ ((cfg4) << 24) | ((cfg3) << 16) | ((cfg2) << 8) | (cfg1) +#define MAKE_CFGVAL_PRIMARY_BOOT 0xfffffff0 +#define MAKE_CFGVAL_SECONDARY_BOOT 0xffffffffenum boot_device {WEIM_NOR_BOOT ,
arch/arm/include/asm/mach-imx/sys_proto.h +2 -0
@@ -79,6 +79,7 @@ struct bd_info;#ifdef CONFIG_MX6 #define IMX6_SRC_GPR10_BMODE BIT(28) +#define IMX6_SRC_GPR10_PERSIST_SECONDARY_BOOT BIT(30)#define IMX6_BMODE_MASK GENMASK(7, 0)#define IMX6_BMODE_SHIFT 4
@@ -128,6 +129,7 @@ void gpr_init(void);#ifdef CONFIG_MX7 #define IMX7_SRC_GPR10_BMODE BIT(28) +#define IMX7_SRC_GPR10_PERSIST_SECONDARY_BOOT BIT(30)#endif /* address translation table */
arch/arm/mach-imx/init.c +15 -7
@@ -104,20 +104,28 @@ void init_src(void)void boot_mode_apply (unsigned cfg_val) {#ifdef CONFIG_MX6 +const u32 persist_sec =IMX6_SRC_GPR10_PERSIST_SECONDARY_BOOT ;const u32 bmode =IMX6_SRC_GPR10_BMODE ;#elif CONFIG_MX7 +const u32 persist_sec =IMX7_SRC_GPR10_PERSIST_SECONDARY_BOOT ;const u32 bmode =IMX7_SRC_GPR10_BMODE ;#endif struct src *psrc = (struct src *)SRC_BASE_ADDR ;unsigned reg; -writel (cfg_val, &psrc->gpr9); - reg =readl (&psrc->gpr10); -if (cfg_val) - reg |= bmode; -else - reg &= ~bmode; -writel (reg, &psrc->gpr10); +if (cfg_val ==MAKE_CFGVAL_PRIMARY_BOOT ) +clrbits_le32 (&psrc->gpr10, persist_sec); +else if (cfg_val ==MAKE_CFGVAL_SECONDARY_BOOT ) +setbits_le32 (&psrc->gpr10, persist_sec); +else { +writel (cfg_val, &psrc->gpr9); + reg =readl (&psrc->gpr10); +if (cfg_val) + reg |= bmode; +else + reg &= ~bmode; +writel (reg, &psrc->gpr10); + } }#endif
arch/arm/mach-imx/mx7/soc.c +2 -0
@@ -415,6 +415,8 @@ void s_init(void)#ifndef CONFIG_SPL_BUILD const struct boot_mode soc_boot_modes[] = { {"normal" ,MAKE_CFGVAL (0x00 ,0x00 ,0x00 ,0x00 )}, + {"primary" ,MAKE_CFGVAL_PRIMARY_BOOT }, + {"secondary" ,MAKE_CFGVAL_SECONDARY_BOOT }, {NULL ,0 }, };#endif
Signature · 1 line
2.27.0
PATCH 2/4 ARM: imx: Add support for switching primary/secondary boot mode to bmode
Quoted 97 lines · Marek Vasut
The i.MX6/i.MX7 is capable of booting a secondary "redundant" system image in case the primary one is corrupted. The user can force this boot mode as well by explicitly setting SRC GPR10 bit 30. This can be potentially useful when upgrading the bootloader itself. Expose this functionality to the user.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP i.MX U-Boot Team <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/include/asm/mach-imx/boot_mode.h | 2 ++ arch/arm/include/asm/mach-imx/sys_proto.h | 2 ++ arch/arm/mach-imx/init.c | 22 +++++++++++++++------- arch/arm/mach-imx/mx7/soc.c | 2 ++ 4 files changed, 21 insertions(+), 7 deletions(-)arch/arm/include/asm/mach-imx/boot_mode.h +2
-0@@ -7,6 +7,8 @@#define _ASM_BOOT_MODE_H#define MAKE_CFGVAL (cfg1, cfg2, cfg3, cfg4) \ ((cfg4) << 24) | ((cfg3) << 16) | ((cfg2) << 8) | (cfg1) +#define MAKE_CFGVAL_PRIMARY_BOOT 0xfffffff0 +#define MAKE_CFGVAL_SECONDARY_BOOT 0xffffffffenum boot_device {WEIM_NOR_BOOT ,arch/arm/include/asm/mach-imx/sys_proto.h +2
-0@@ -79,6 +79,7 @@ struct bd_info;#ifdef CONFIG_MX6 #define IMX6_SRC_GPR10_BMODE BIT(28) +#define IMX6_SRC_GPR10_PERSIST_SECONDARY_BOOT BIT(30)#define IMX6_BMODE_MASK GENMASK(7, 0)#define IMX6_BMODE_SHIFT 4@@ -128,6 +129,7 @@ void gpr_init(void);#ifdef CONFIG_MX7 #define IMX7_SRC_GPR10_BMODE BIT(28) +#define IMX7_SRC_GPR10_PERSIST_SECONDARY_BOOT BIT(30)#endif /* address translation table */ arch/arm/mach-imx/init.c +15
-7@@ -104,20 +104,28 @@ void init_src(void)void boot_mode_apply (unsigned cfg_val) {#ifdef CONFIG_MX6 +const u32 persist_sec =IMX6_SRC_GPR10_PERSIST_SECONDARY_BOOT ;const u32 bmode =IMX6_SRC_GPR10_BMODE ;#elif CONFIG_MX7 +const u32 persist_sec =IMX7_SRC_GPR10_PERSIST_SECONDARY_BOOT ;const u32 bmode =IMX7_SRC_GPR10_BMODE ;#endif struct src *psrc = (struct src *)SRC_BASE_ADDR ;unsigned reg; -writel (cfg_val, &psrc->gpr9); - reg =readl (&psrc->gpr10); -if (cfg_val) - reg |= bmode; -else - reg &= ~bmode; -writel (reg, &psrc->gpr10); +if (cfg_val ==MAKE_CFGVAL_PRIMARY_BOOT ) +clrbits_le32 (&psrc->gpr10, persist_sec); +else if (cfg_val ==MAKE_CFGVAL_SECONDARY_BOOT ) +setbits_le32 (&psrc->gpr10, persist_sec); +else { +writel (cfg_val, &psrc->gpr9); + reg =readl (&psrc->gpr10); +if (cfg_val) + reg |= bmode; +else + reg &= ~bmode; +writel (reg, &psrc->gpr10); + } }#endif arch/arm/mach-imx/mx7/soc.c +0
-0
arch/arm/mach-imx/mx7/soc.c void s_init(void) · line 422
Quoted 8 lines
arch/arm/mach-imx/mx7/soc.c +2
-0@@ -415,6 +415,8 @@ void s_init(void)#ifndef CONFIG_SPL_BUILD const struct boot_mode soc_boot_modes[] = { {"normal" ,MAKE_CFGVAL (0x00 ,0x00 ,0x00 ,0x00 )}, + {"primary" ,MAKE_CFGVAL_PRIMARY_BOOT }, + {"secondary" ,MAKE_CFGVAL_SECONDARY_BOOT }, {NULL ,0 }, };#endif
Regards,
Stefano
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 =====================================================================
PATCH 2/4 ARM: imx: Add support for switching primary/secondary boot mode to bmode
In reply to Marek VasutQuoted 11 lines
The i.MX6/i.MX7 is capable of booting a secondary "redundant" system image in case the primary one is corrupted. The user can force this boot mode as well by explicitly setting SRC GPR10 bit 30. This can be potentially useful when upgrading the bootloader itself. Expose this functionality to the user.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP i.MX U-Boot Team <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>Reviewed-by Stefano Babic <[email protected]>
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 =====================================================================
PATCH 3/4 ARM: imx: Add support for reading out the primary/secondary bmode
In reply to Marek VasutAdd new 'getprisec' subcommand to 'bmode' command, which sets the return value of the 'bmode' command to either 0 if the system booted from primary copy or to 1 if the system booted from secondary copy. This can be used e.g. in 'test' command to determine which copy of the system is running.
--- arch/arm/mach-imx/cmd_bmode.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/mach-imx/cmd_bmode.c +12 -0
@@ -51,9 +51,19 @@ static int create_usage(char *dest)if (dest)memcpy (dest -1 ," [noreset]" ,11 );/* include trailing 0 */ size +=10 ; + +if (dest) +memcpy (dest -1 ,"\nbmode - getprisec" ,19 ); + size +=18 ; +return size; } +__weak int boot_mode_getprisec (void ) +{ +return 0 ; +} +static int do_boot_mode (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {
@@ -62,6 +72,8 @@ static int do_boot_mode(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <2 )return CMD_RET_USAGE ; +if (!strcmp (argv[1 ],"getprisec" )) +return boot_mode_getprisec (); p =search_modes (argv[1 ]);if (!p)return CMD_RET_USAGE ;
Signature · 1 line
2.27.0
PATCH 3/4 ARM: imx: Add support for reading out the primary/secondary bmode
Quoted 40 lines · Marek Vasut
Add new 'getprisec' subcommand to 'bmode' command, which sets the return value of the 'bmode' command to either 0 if the system booted from primary copy or to 1 if the system booted from secondary copy. This can be used e.g. in 'test' command to determine which copy of the system is running.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP i.MX U-Boot Team <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/mach-imx/cmd_bmode.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)arch/arm/mach-imx/cmd_bmode.c +10
-0@@ -51,9 +51,19 @@ static int create_usage(char *dest)if (dest)memcpy (dest -1 ," [noreset]" ,11 );/* include trailing 0 */ size +=10 ; + +if (dest) +memcpy (dest -1 ,"\nbmode - getprisec" ,19 ); + size +=18 ; +return size; } +__weak int boot_mode_getprisec (void ) +{ +return 0 ; +} +static int do_boot_mode (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) {
arch/arm/mach-imx/cmd_bmode.c static int do_boot_mode(struct cmd_tbl *cmdtp, int flag, int argc, · line 79
Quoted 8 lines
arch/arm/mach-imx/cmd_bmode.c +2
-0@@ -62,6 +72,8 @@ static int do_boot_mode(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <2 )return CMD_RET_USAGE ; +if (!strcmp (argv[1 ],"getprisec" )) +return boot_mode_getprisec (); p =search_modes (argv[1 ]);if (!p)return CMD_RET_USAGE ;
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 =====================================================================
PATCH 3/4 ARM: imx: Add support for reading out the primary/secondary bmode
In reply to Marek VasutQuoted 10 lines
Add new 'getprisec' subcommand to 'bmode' command, which sets the return value of the 'bmode' command to either 0 if the system booted from primary copy or to 1 if the system booted from secondary copy. This can be used e.g. in 'test' command to determine which copy of the system is running.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP i.MX U-Boot Team <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>Reviewed-by Stefano Babic <[email protected]>
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 =====================================================================
PATCH 4/4 ARM: imx: Add support for reading out the primary/secondary bmode to MX7
In reply to Marek VasutImplement the 'getprisec' subcommand of 'bmode' command for i.MX7 by reading out the SRC GPR10 bit 30. This bit is either set by the BootROM if it switched to the secondary copy due to primary copy being corrupted OR it can be overridden by the user.
--- arch/arm/mach-imx/mx7/soc.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/mach-imx/mx7/soc.c +7 -0
@@ -419,6 +419,13 @@ const struct boot_mode soc_boot_modes[] = { {"secondary", MAKE_CFGVAL_SECONDARY_BOOT}, {NULL, 0}, }; + +int boot_mode_getprisec(void) +{ + struct src *psrc = (struct src *)SRC_BASE_ADDR; + + return !!(readl(&psrc->gpr10) & IMX7_SRC_GPR10_PERSIST_SECONDARY_BOOT); +} #endif void reset_misc(void)
Signature · 1 line
2.27.0
PATCH 4/4 ARM: imx: Add support for reading out the primary/secondary bmode to MX7
Quoted 23 lines · Marek Vasut
Implement the 'getprisec' subcommand of 'bmode' command for i.MX7 by reading out the SRC GPR10 bit 30. This bit is either set by the BootROM if it switched to the secondary copy due to primary copy being corrupted OR it can be overridden by the user.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP i.MX U-Boot Team <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/mach-imx/mx7/soc.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/mach-imx/mx7/soc.c +0
-0@@ -419,6 +419,13 @@ const struct boot_mode soc_boot_modes[] = { {"secondary", MAKE_CFGVAL_SECONDARY_BOOT}, {NULL, 0}, };
arch/arm/mach-imx/mx7/soc.c const struct boot_mode soc_boot_modes[] = { · line 431
Quoted 10 lines
arch/arm/mach-imx/mx7/soc.c +7
-0+ +int boot_mode_getprisec (void ) +{ +struct src *psrc = (struct src *)SRC_BASE_ADDR ; + +return !!(readl (&psrc->gpr10) &IMX7_SRC_GPR10_PERSIST_SECONDARY_BOOT ); +}#endif void reset_misc (void )
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 =====================================================================
PATCH 4/4 ARM: imx: Add support for reading out the primary/secondary bmode to MX7
In reply to Marek VasutQuoted 10 lines
Implement the 'getprisec' subcommand of 'bmode' command for i.MX7 by reading out the SRC GPR10 bit 30. This bit is either set by the BootROM if it switched to the secondary copy due to primary copy being corrupted OR it can be overridden by the user.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP i.MX U-Boot Team <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>Reviewed-by Stefano Babic <[email protected]>
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 =====================================================================
PATCH 1/4 ARM: imx: Add bmode support for iMX7
In reply to Marek VasutHi Marek,
Quoted 29 lines · Marek Vasut
Add the basic differentiation between i.MX6 and i.MX7 into the bmode command, the mechanism really works almost the same on both platforms.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP i.MX U-Boot Team <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/include/asm/mach-imx/sys_proto.h | 6 +++++- arch/arm/mach-imx/Kconfig | 2 +- arch/arm/mach-imx/init.c | 12 +++++++++--- arch/arm/mach-imx/mx7/soc.c | 8 ++++++++ 4 files changed, 23 insertions(+), 5 deletions(-)arch/arm/include/asm/mach-imx/sys_proto.h +1
-1@@ -78,7 +78,7 @@ struct bd_info;#define is_imx8qxp () (is_cpu_type(MXC_CPU_IMX8QXP))#ifdef CONFIG_MX6 -#define IMX6_SRC_GPR10_BMODE BIT(28) +#define IMX6_SRC_GPR10_BMODE BIT(28)#define IMX6_BMODE_MASK GENMASK(7, 0)#define IMX6_BMODE_SHIFT 4
arch/arm/include/asm/mach-imx/sys_proto.h void gpr_init(void); · line 132
Quoted 7 lines
arch/arm/include/asm/mach-imx/sys_proto.h +4
-0@@ -126,6 +126,10 @@ void gpr_init(void);#endif /* CONFIG_MX6 */ +#ifdef CONFIG_MX7 +#define IMX7_SRC_GPR10_BMODE BIT(28) +#endif +
It is questionable why we need two different defines, that also have exactly the same definition. Do we really need to differentiate and to use #ifdef ?
Quoted 21 lines
arch/arm/include/asm/mach-imx/sys_proto.h +0
-0/* address translation table */ struct rproc_att {u32 da;/* device address (From Cortex M4 view) */ arch/arm/mach-imx/Kconfig +1
-1@@ -62,7 +62,7 @@ config CSF_SIZE config CMD_BMODE bool "Support the 'bmode' command" default y - depends on ARCH_MX6 || ARCH_MX5 + depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX5 help This enables the 'bmode' (bootmode) command for forcing a boot from specific media.arch/arm/mach-imx/init.c +0
-0
arch/arm/mach-imx/init.c void init_src(void) · line 110
Quoted 9 lines
arch/arm/mach-imx/init.c +5
-1@@ -103,14 +103,20 @@ void init_src(void)#ifdef CONFIG_CMD_BMODE void boot_mode_apply (unsigned cfg_val) { -unsigned reg; +#ifdef CONFIG_MX6 +const u32 bmode =IMX6_SRC_GPR10_BMODE ; +#elif CONFIG_MX7 +const u32 bmode =IMX7_SRC_GPR10_BMODE ; +#endif
Ditto.
Quoted 31 lines
arch/arm/mach-imx/init.c +4
-2struct src *psrc = (struct src *)SRC_BASE_ADDR ; +unsigned reg; +writel (cfg_val, &psrc->gpr9); reg =readl (&psrc->gpr10);if (cfg_val) - reg |=IMX6_SRC_GPR10_BMODE ; + reg |= bmode;else - reg &= ~IMX6_SRC_GPR10_BMODE ; + reg &= ~bmode; writel(reg, &psrc->gpr10); }#endif arch/arm/mach-imx/mx7/soc.c +1
-0@@ -13,6 +13,7 @@#include <asm/mach-imx/hab.h> #include <asm/mach-imx/rdc-sema.h> #include <asm/arch/imx-rdc.h> +#include <asm/mach-imx/boot_mode.h> #include <asm/arch/crm_regs.h> #include <dm.h> #include <env.h> @@ -411,6 +412,13 @@ void s_init(void)return ; }
arch/arm/mach-imx/mx7/soc.c void s_init(void) · line 424
Quoted 10 lines
arch/arm/mach-imx/mx7/soc.c +7
-0+#ifndef CONFIG_SPL_BUILD +const struct boot_mode soc_boot_modes[] = { + {"normal" ,MAKE_CFGVAL (0x00 ,0x00 ,0x00 ,0x00 )}, + {NULL ,0 }, +}; +#endif +void reset_misc (void ) {#ifndef CONFIG_SPL_BUILD
Regards,
Stefano
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 =====================================================================
PATCH 1/4 ARM: imx: Add bmode support for iMX7
Quoted 1 line · Stefano Babic
Hi Marek,
Hi,
Quoted 33 lines · Marek Vasut
Quoted 32 lines
Add the basic differentiation between i.MX6 and i.MX7 into the bmode command, the mechanism really works almost the same on both platforms.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP i.MX U-Boot Team <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/include/asm/mach-imx/sys_proto.h | 6 +++++- arch/arm/mach-imx/Kconfig | 2 +- arch/arm/mach-imx/init.c | 12 +++++++++--- arch/arm/mach-imx/mx7/soc.c | 8 ++++++++ 4 files changed, 23 insertions(+), 5 deletions(-)arch/arm/include/asm/mach-imx/sys_proto.h +1
-1@@ -78,7 +78,7 @@ struct bd_info;#define is_imx8qxp () (is_cpu_type(MXC_CPU_IMX8QXP))#ifdef CONFIG_MX6 -#define IMX6_SRC_GPR10_BMODE BIT(28) +#define IMX6_SRC_GPR10_BMODE BIT(28)#define IMX6_BMODE_MASK GENMASK(7, 0)#define IMX6_BMODE_SHIFT 4@@ -126,6 +126,10 @@ void gpr_init(void);#endif /* CONFIG_MX6 */
Quoted 8 lines
arch/arm/include/asm/mach-imx/sys_proto.h void gpr_init(void); · line 132
Quoted 4 lines
arch/arm/include/asm/mach-imx/sys_proto.h +4
-0+#ifdef CONFIG_MX7 +#define IMX7_SRC_GPR10_BMODE BIT(28) +#endif +It is questionable why we need two different defines, that also have exactly the same definition. Do we really need to differentiate and to use #ifdef ?
Yes, because this file is also used by iMXes which are not 6/7 .
PATCH 1/4 ARM: imx: Add bmode support for iMX7
Quoted 47 lines · Marek Vasut
Quoted 1 line · Stefano Babic
Hi Marek,
Hi,
Quoted 33 lines · Marek Vasut
Quoted 32 lines
Add the basic differentiation between i.MX6 and i.MX7 into the bmode command, the mechanism really works almost the same on both platforms.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP i.MX U-Boot Team <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/include/asm/mach-imx/sys_proto.h | 6 +++++- arch/arm/mach-imx/Kconfig | 2 +- arch/arm/mach-imx/init.c | 12 +++++++++--- arch/arm/mach-imx/mx7/soc.c | 8 ++++++++ 4 files changed, 23 insertions(+), 5 deletions(-)arch/arm/include/asm/mach-imx/sys_proto.h +1
-1@@ -78,7 +78,7 @@ struct bd_info;#define is_imx8qxp () (is_cpu_type(MXC_CPU_IMX8QXP))#ifdef CONFIG_MX6 -#define IMX6_SRC_GPR10_BMODE BIT(28) +#define IMX6_SRC_GPR10_BMODE BIT(28)#define IMX6_BMODE_MASK GENMASK(7, 0)#define IMX6_BMODE_SHIFT 4@@ -126,6 +126,10 @@ void gpr_init(void);#endif /* CONFIG_MX6 */ Quoted 8 lines
arch/arm/include/asm/mach-imx/sys_proto.h void gpr_init(void); · line 132
Quoted 4 lines
arch/arm/include/asm/mach-imx/sys_proto.h +4
-0+#ifdef CONFIG_MX7 +#define IMX7_SRC_GPR10_BMODE BIT(28) +#endif +It is questionable why we need two different defines, that also have exactly the same definition. Do we really need to differentiate and to use #ifdef ?
Quoted 1 line
Yes, because this file is also used by iMXes which are not 6/7 .
Yes, but does it disturb ? There should be a define SRC_GPR10_BMODE that is not used at all if we build for mx3/mx5. I just prefer to reduce the number of #ifdef, when they are not strictly required.
Regards,
Stefano
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 =====================================================================
PATCH 1/4 ARM: imx: Add bmode support for iMX7
On 8/5/20 4:54 PM, Stefano Babic wrote:
[...]
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 9 lines
#define
is_imx8qxp()(is_cpu_type(MXC_CPU_IMX8QXP))#ifdef
CONFIG_MX6arch/arm/include/asm/mach-imx/sys_proto.h +1
-1-#define IMX6_SRC_GPR10_BMODE BIT(28) +#define IMX6_SRC_GPR10_BMODE BIT(28)#define IMX6_BMODE_MASK GENMASK(7, 0)#define IMX6_BMODE_SHIFT 4arch/arm/include/asm/mach-imx/sys_proto.h void gpr_init(void); · line 132
Quoted 7 lines
arch/arm/include/asm/mach-imx/sys_proto.h +4
-0@@ -126,6 +126,10 @@ void gpr_init(void);#endif /* CONFIG_MX6 */ +#ifdef CONFIG_MX7 +#define IMX7_SRC_GPR10_BMODE BIT(28) +#endif +It is questionable why we need two different defines, that also have exactly the same definition. Do we really need to differentiate and to use #ifdef ?
Quoted 5 lines
Quoted 1 line
Yes, because this file is also used by iMXes which are not 6/7 .
Yes, but does it disturb ? There should be a define
SRC_GPR10_BMODEthat is not used at all if we build for mx3/mx5. I just prefer to reduce the number of #ifdef, when they are not strictly required.
Its putting macros into the preprocessor which don't need to be there. Otherwise, it is inline with the style in the rest of the file.
PATCH 1/4 ARM: imx: Add bmode support for iMX7
In reply to Marek VasutQuoted 7 lines
Add the basic differentiation between i.MX6 and i.MX7 into the bmode command, the mechanism really works almost the same on both platforms.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP i.MX U-Boot Team <[email protected]>Cc Peng Fan <[email protected]>Cc Stefano Babic <[email protected]>
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 =====================================================================