From: Marek Vasut Date: Wed, 5 Aug 2020 13:34:07 +0000 (+0200) Subject: ARM: imx: Add support for reading out the primary/secondary bmode to MX7 X-Git-Tag: v2025.01-rc5-pxa1908~2237^2~9 X-Git-Url: http://git.dujemihanovic.xyz/%7B%7B%20%24style.RelPermalink%20%7D%7D?a=commitdiff_plain;h=4b44bea701a67e3b83cb82f44fa40485b111d394;p=u-boot.git ARM: imx: Add support for reading out the primary/secondary bmode to MX7 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 Cc: Fabio Estevam Cc: NXP i.MX U-Boot Team Cc: Peng Fan Cc: Stefano Babic Reviewed-by: Stefano Babic --- diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c index b70ef80131..d0385b36e4 100644 --- a/arch/arm/mach-imx/mx7/soc.c +++ b/arch/arm/mach-imx/mx7/soc.c @@ -418,6 +418,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)