summaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2020-07-09 13:39:26 +0800
committerPeng Fan <peng.fan@nxp.com>2020-07-14 15:23:47 +0800
commit2f3c92060dcd6bc9cfd3e2e344a3e1745ca39f09 (patch)
treea6af98124654efeae10a2b50f1e93dfe6c7e583e /arch/arm
parent3c9221ad27b10d649ff46e5ee89d0d54f86745eb (diff)
downloadu-boot-2f3c92060dcd6bc9cfd3e2e344a3e1745ca39f09.tar.gz
u-boot-2f3c92060dcd6bc9cfd3e2e344a3e1745ca39f09.tar.xz
u-boot-2f3c92060dcd6bc9cfd3e2e344a3e1745ca39f09.zip
imx8m: workaround ROM serror
ROM SError happens on two cases: 1. ERR050342, on iMX8MQ HDCP enabled parts ROM writes to GPV1 register, but when ROM patch lock is fused, this write will cause SError. 2. ERR050350, on iMX8MQ/MM/MN, when the field return fuse is burned, HAB is field return mode, but the last 4K of ROM is still protected and cause SError. Since ROM mask SError until ATF unmask it, so then ATF always meets the exception. This patch works around the issue in SPL by enabling SPL Exception vectors table and the SError exception, take the exception to eret immediately to clear the SError. Signed-off-by: Ye Li <ye.li@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-imx/imx8m/soc.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index fae69be1c7..9caf08e86c 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -16,8 +16,10 @@
#include <asm/mach-imx/hab.h>
#include <asm/mach-imx/boot_mode.h>
#include <asm/mach-imx/syscounter.h>
+#include <asm/ptrace.h>
#include <asm/armv8/mmu.h>
#include <dm/uclass.h>
+#include <efi_loader.h>
#include <errno.h>
#include <fdt_support.h>
#include <fsl_wdog.h>
@@ -527,3 +529,39 @@ void imx_tmu_arch_init(void *reg_base)
writel(tca40[0] | (tca40[1] << 16), (ulong)reg_base + 0x38);
#endif
}
+
+#if defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_IMX8MQ) || defined(CONFIG_IMX8MM) || defined(CONFIG_IMX8MN)
+bool serror_need_skip = true;
+
+void do_error(struct pt_regs *pt_regs, unsigned int esr)
+{
+ /*
+ * If stack is still in ROM reserved OCRAM not switch to SPL,
+ * it is the ROM SError
+ */
+ ulong sp;
+
+ asm volatile("mov %0, sp" : "=r"(sp) : );
+
+ if (serror_need_skip && sp < 0x910000 && sp >= 0x900000) {
+ /* Check for ERR050342, imx8mq HDCP enabled parts */
+ if (is_imx8mq() && !(readl(OCOTP_BASE_ADDR + 0x450) & 0x08000000)) {
+ serror_need_skip = false;
+ return; /* Do nothing skip the SError in ROM */
+ }
+
+ /* Check for ERR050350, field return mode for imx8mq, mm and mn */
+ if (readl(OCOTP_BASE_ADDR + 0x630) & 0x1) {
+ serror_need_skip = false;
+ return; /* Do nothing skip the SError in ROM */
+ }
+ }
+
+ efi_restore_gd();
+ printf("\"Error\" handler, esr 0x%08x\n", esr);
+ show_regs(pt_regs);
+ panic("Resetting CPU ...\n");
+}
+#endif
+#endif