[PATCH 13/16] L2x0: i.MX6: Replace magic numbers with constants

Andrey Smirnov andrew.smirnov at gmail.com
Tue Mar 15 20:33:48 PDT 2016


Use constants instead of magic numbers for PL301 registers bits in
imx6_mmu_init()

Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
 arch/arm/include/asm/cache-l2x0.h | 8 ++++++++
 arch/arm/mach-imx/imx6.c          | 9 ++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/cache-l2x0.h b/arch/arm/include/asm/cache-l2x0.h
index 963dd99..9bb245b 100644
--- a/arch/arm/include/asm/cache-l2x0.h
+++ b/arch/arm/include/asm/cache-l2x0.h
@@ -56,6 +56,14 @@
 #define L2X0_LINE_TAG			0xF30
 #define L2X0_DEBUG_CTRL			0xF40
 #define L2X0_PREFETCH_CTRL		0xF60
+#define   L2X0_DOUBLE_LINEFILL_EN			(1 << 30)
+#define   L2X0_INSTRUCTION_PREFETCH_EN			(1 << 29)
+#define   L2X0_DATA_PREFETCH_EN				(1 << 28)
+#define   L2X0_DOUBLE_LINEFILL_ON_WRAP_READ_DIS		(1 << 27)
+#define   L2X0_PREFETCH_DROP_EN				(1 << 24)
+#define   L2X0_INCR_DOUBLE_LINEFILL_EN			(1 << 23)
+#define   L2X0_ESCLUSIVE_SEQUENCE_EN			(1 << 21)
+
 #define L2X0_POWER_CTRL			0xF80
 #define   L2X0_DYNAMIC_CLK_GATING_EN	(1 << 1)
 #define   L2X0_STNDBY_MODE_EN		(1 << 0)
diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index f80334d..db1530c 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -217,8 +217,10 @@ static int imx6_mmu_init(void)
 
 	/* configure the PREFETCH register */
 	val = readl(l2x0_base + L2X0_PREFETCH_CTRL);
-	val |= 0x70800000;
-
+	val |=  L2X0_DOUBLE_LINEFILL_EN |
+		L2X0_INSTRUCTION_PREFETCH_EN |
+		L2X0_DATA_PREFETCH_EN |
+		L2X0_INCR_DOUBLE_LINEFILL_EN;
 	/*
 	 * The L2 cache controller(PL310) version on the i.MX6D/Q is r3p1-50rel0
 	 * The L2 cache controller(PL310) version on the i.MX6DL/SOLO/SL is r3p2
@@ -229,7 +231,8 @@ static int imx6_mmu_init(void)
 	 * double linefill feature. This is the default behavior.
 	 */
 	if (cpu_is_mx6q())
-		val &= ~(1 << 30 | 1 << 23);
+		val &= ~(L2X0_DOUBLE_LINEFILL_EN |
+			 L2X0_INCR_DOUBLE_LINEFILL_EN);
 
 	writel(val, l2x0_base + L2X0_PREFETCH_CTRL);
 
-- 
2.5.0




More information about the barebox mailing list