浏览代码

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 <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Marek Vasut 3 年之前
父节点
当前提交
4b44bea701
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      arch/arm/mach-imx/mx7/soc.c

+ 7 - 0
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)