summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/cache.c
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2018-05-14 09:44:29 -0300
committerStefano Babic <sbabic@denx.de>2018-06-18 16:21:25 +0200
commitc5437e5b8aff9c952ebaab9be7670439c141e4e7 (patch)
treef7c79c497e2159cea8306c7a0d343039b31e455a /arch/arm/mach-imx/cache.c
parent2c09dbf4250be1f6c8fc391cc1882df35b47a421 (diff)
downloadu-boot-c5437e5b8aff9c952ebaab9be7670439c141e4e7.tar.gz
u-boot-c5437e5b8aff9c952ebaab9be7670439c141e4e7.tar.xz
u-boot-c5437e5b8aff9c952ebaab9be7670439c141e4e7.zip
imx: Enable ACTLR.SMP bit for all i.MX cortex-a7 platforms
According to the Cortex-A7 TRM, for ACTLR.SMP bit "You must ensure this bit is set to 1 before the caches and MMU are enabled, or any cache and TLB maintenance operations are performed". ROM sets this bit in normal boot flow, but when in serial download mode, it is not set. Here we add it in u-boot as a common flow for all i.MX cortex-a7 platforms, including mx7d, mx6ul/ull and mx7ulp. Signed-off-by: Ye Li <ye.li@nxp.com> [fabio: adapted to U-Boot mainline codebase and make checkpatch happy] Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Diffstat (limited to 'arch/arm/mach-imx/cache.c')
-rw-r--r--arch/arm/mach-imx/cache.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/cache.c b/arch/arm/mach-imx/cache.c
index 11f90ed8a2..82257f3280 100644
--- a/arch/arm/mach-imx/cache.c
+++ b/arch/arm/mach-imx/cache.c
@@ -9,6 +9,34 @@
#include <asm/io.h>
#include <asm/mach-imx/sys_proto.h>
+static void enable_ca7_smp(void)
+{
+ u32 val;
+
+ /* Read MIDR */
+ asm volatile ("mrc p15, 0, %0, c0, c0, 0\n\t" : "=r"(val));
+ val = (val >> 4);
+ val &= 0xf;
+
+ /* Only set the SMP for Cortex A7 */
+ if (val == 0x7) {
+ /* Read auxiliary control register */
+ asm volatile ("mrc p15, 0, %0, c1, c0, 1\n\t" : "=r"(val));
+
+ if (val & (1 << 6))
+ return;
+
+ /* Enable SMP */
+ val |= (1 << 6);
+
+ /* Write auxiliary control register */
+ asm volatile ("mcr p15, 0, %0, c1, c0, 1\n\t" : : "r"(val));
+
+ DSB;
+ ISB;
+ }
+}
+
#ifndef CONFIG_SYS_DCACHE_OFF
void enable_caches(void)
{
@@ -20,6 +48,9 @@ void enable_caches(void)
/* Avoid random hang when download by usb */
invalidate_dcache_all();
+ /* Set ACTLR.SMP bit for Cortex-A7 */
+ enable_ca7_smp();
+
/* Enable D-cache. I-cache is already enabled in start.S */
dcache_enable();
@@ -31,6 +62,17 @@ void enable_caches(void)
IRAM_SIZE,
option);
}
+#else
+void enable_caches(void)
+{
+ /*
+ * Set ACTLR.SMP bit for Cortex-A7, even if the caches are
+ * disabled by u-boot
+ */
+ enable_ca7_smp();
+
+ puts("WARNING: Caches not enabled\n");
+}
#endif
#ifndef CONFIG_SYS_L2CACHE_OFF