]> git.sur5r.net Git - u-boot/commitdiff
arm, at91: add icache support
authorHeiko Schocher <hs@denx.de>
Wed, 17 Aug 2016 07:13:25 +0000 (09:13 +0200)
committerAndreas Bießmann <andreas@biessmann.org>
Fri, 28 Oct 2016 16:37:13 +0000 (18:37 +0200)
add at least icache support for at91 based boards.
This speeds up NOR flash access on an at91sam9g15
based board from 15.2 seconds reading 8 MiB from
a SPI NOR flash to 5.7 seconds.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
arch/arm/mach-at91/arm926ejs/Makefile
arch/arm/mach-at91/arm926ejs/cache.c [new file with mode: 0644]
board/bluewater/gurnard/gurnard.c

index ddc323f6415dd5c16093754ca3a0c9e070bbaf54..d36e15a51cc04d667a0e0e9f6874e9c8f4dd3adf 100644 (file)
@@ -18,6 +18,7 @@ obj-$(CONFIG_AT91SAM9N12)     += at91sam9n12_devices.o
 obj-$(CONFIG_AT91SAM9X5)       += at91sam9x5_devices.o
 obj-$(CONFIG_AT91_EFLASH)      += eflash.o
 obj-$(CONFIG_AT91_LED) += led.o
+obj-y += cache.o
 obj-y += clock.o
 obj-y += cpu.o
 obj-y  += reset.o
diff --git a/arch/arm/mach-at91/arm926ejs/cache.c b/arch/arm/mach-at91/arm926ejs/cache.c
new file mode 100644 (file)
index 0000000..8813706
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * (C) Copyright 2016
+ * Heiko Schocher, DENX Software Engineering, hs@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+#include <linux/types.h>
+#include <common.h>
+
+void enable_caches(void)
+{
+#ifndef CONFIG_SYS_ICACHE_OFF
+       icache_enable();
+#endif
+}
+
+#ifndef CONFIG_SYS_ICACHE_OFF
+/* Invalidate entire I-cache and branch predictor array */
+void invalidate_icache_all(void)
+{
+       unsigned long i = 0;
+
+       asm ("mcr p15, 0, %0, c7, c5, 0" : : "r" (i));
+}
+#else
+void invalidate_icache_all(void)
+{
+}
+#endif
index 2a36d29788c631a57b91e126ced45b666796142c..08b1401372c9fb2034db9e2f47d44b9bc3a88c56 100644 (file)
@@ -414,12 +414,6 @@ void reset_phy(void)
 {
 }
 
-/* This breaks the Ethernet MAC at present */
-void enable_caches(void)
-{
-       dcache_enable();
-}
-
 /* SPI chip select control - only used for FPGA programming */
 #ifdef CONFIG_ATMEL_SPI