imx8m: Configure trustzone region 0 for non-secure access
[oweals/u-boot.git] / arch / arm / mach-imx / imx8m / soc.c
index dd393b581be9b713cff64dad1c163e72beba19a9..a33ca356532760a6695de7571ee7c5e188d0af3c 100644 (file)
@@ -55,6 +55,14 @@ void enable_tzc380(void)
        /* Enable TZASC and lock setting */
        setbits_le32(&gpr->gpr[10], GPR_TZASC_EN);
        setbits_le32(&gpr->gpr[10], GPR_TZASC_EN_LOCK);
+       if (IS_ENABLED(CONFIG_IMX8MM))
+               setbits_le32(&gpr->gpr[10], BIT(1));
+       /*
+        * set Region 0 attribute to allow secure and non-secure
+        * read/write permission. Found some masters like usb dwc3
+        * controllers can't work with secure memory.
+        */
+       writel(0xf0000000, TZASC_BASE_ADDR + 0x108);
 }
 
 void set_wdog_reset(struct wdog_regs *wdog)