summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/cpu/armv7/mx7/soc.c8
-rw-r--r--arch/arm/imx-common/cache.c40
2 files changed, 41 insertions, 7 deletions
diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c
index 580e127..ad8ca49 100644
--- a/arch/arm/cpu/armv7/mx7/soc.c
+++ b/arch/arm/cpu/armv7/mx7/soc.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright (C) 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -448,13 +449,6 @@ int mmc_get_env_dev(void)
void s_init(void)
{
-#if !defined CONFIG_SPL_BUILD
- /* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */
- asm volatile(
- "mrc p15, 0, r0, c1, c0, 1\n"
- "orr r0, r0, #1 << 6\n"
- "mcr p15, 0, r0, c1, c0, 1\n");
-#endif
/* clock configuration. */
clock_init();
diff --git a/arch/arm/imx-common/cache.c b/arch/arm/imx-common/cache.c
index f379e5c..b849c3d 100644
--- a/arch/arm/imx-common/cache.c
+++ b/arch/arm/imx-common/cache.c
@@ -1,5 +1,6 @@
/*
* Copyright 2015-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -9,6 +10,34 @@
#include <asm/pl310.h>
#include <asm/io.h>
+static void enable_ca7_smp(void)
+{
+ uint32_t 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 +49,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 +63,14 @@ void enable_caches(void)
IRAM_SIZE,
option);
}
+#else
+void enable_caches(void)
+{
+ /* Set ACTLR.SMP bit for Cortex-A7, even the caches are disabled by u-boot */
+ enable_ca7_smp();
+
+ puts("WARNING: Caches not enabled\n");
+}
#endif
#ifndef CONFIG_SYS_L2CACHE_OFF