public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/6] arm, at91: add icache support
Date: Wed, 17 Aug 2016 09:13:25 +0200	[thread overview]
Message-ID: <1471418009-12660-4-git-send-email-hs@denx.de> (raw)
In-Reply-To: <1471418009-12660-1-git-send-email-hs@denx.de>

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>

---
removed the dcache enable in the gurnard board. Comment
says that enabling dcache breaks Ethernet MAC ... why
is it then enabled?

@Simon: If you need dache enabled for the gurnard board,
arch/arm/mach-at91/arm926ejs/cache.c is the correct place
for doing this, I think. Please add there the common functions
needed for dcache support on at91 plattforms and undef in
the gurnard board configuration CONFIG_SYS_DCACHE_OFF.

 arch/arm/mach-at91/arm926ejs/Makefile |  1 +
 arch/arm/mach-at91/arm926ejs/cache.c  | 29 +++++++++++++++++++++++++++++
 board/bluewater/gurnard/gurnard.c     |  6 ------
 3 files changed, 30 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-at91/arm926ejs/cache.c

diff --git a/arch/arm/mach-at91/arm926ejs/Makefile b/arch/arm/mach-at91/arm926ejs/Makefile
index ddc323f..d36e15a 100644
--- a/arch/arm/mach-at91/arm926ejs/Makefile
+++ b/arch/arm/mach-at91/arm926ejs/Makefile
@@ -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
index 0000000..8813706
--- /dev/null
+++ b/arch/arm/mach-at91/arm926ejs/cache.c
@@ -0,0 +1,29 @@
+/*
+ * (C) Copyright 2016
+ * Heiko Schocher, DENX Software Engineering, hs at 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
diff --git a/board/bluewater/gurnard/gurnard.c b/board/bluewater/gurnard/gurnard.c
index 2a36d29..08b1401 100644
--- a/board/bluewater/gurnard/gurnard.c
+++ b/board/bluewater/gurnard/gurnard.c
@@ -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
 
-- 
2.5.5

  parent reply	other threads:[~2016-08-17  7:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17  7:13 [U-Boot] [PATCH 0/6] at91: at91sam9g15 improvements Heiko Schocher
2016-08-17  7:13 ` [U-Boot] [PATCH 1/6] arm: at91: mpddrc: add missing MPDDRC_MD defines Heiko Schocher
2016-09-18  2:07   ` Wenyou.Yang at microchip.com
2016-10-06 21:07   ` Andreas Bießmann
2016-10-28 16:49   ` [U-Boot] [U-Boot, " Andreas Bießmann
2016-08-17  7:13 ` [U-Boot] [PATCH 2/6] ARM: at91: clock: correct PRES offset for at91sam9x5 Heiko Schocher
2016-09-18  2:11   ` Wenyou.Yang at microchip.com
2016-10-06 21:40   ` Andreas Bießmann
2016-10-28  9:47   ` [U-Boot] [U-Boot, " Andreas Bießmann
2016-10-28 16:49   ` Andreas Bießmann
2016-08-17  7:13 ` Heiko Schocher [this message]
2016-08-18  3:45   ` [U-Boot] [PATCH 3/6] arm, at91: add icache support Simon Glass
2016-10-06 21:58   ` Andreas Bießmann
2016-10-28 16:49   ` [U-Boot] [U-Boot,3/6] " Andreas Bießmann
2016-08-17  7:13 ` [U-Boot] [PATCH 4/6] arm, at91: add some missing fields in PIO struct Heiko Schocher
2016-09-18  2:09   ` Wenyou.Yang at microchip.com
2016-10-06 22:06   ` Andreas Bießmann
2016-08-17  7:13 ` [U-Boot] [PATCH 5/6] at91: add function to set IO drive Heiko Schocher
2016-09-18  2:05   ` Wenyou.Yang at microchip.com
2016-10-06 22:11   ` Andreas Bießmann
2016-08-17  7:13 ` [U-Boot] [PATCH 6/6] [RFC] at91: SPL clock fix for AT91SAM9G15 based boards Heiko Schocher
2016-09-18  2:19   ` Wenyou.Yang at microchip.com
2016-10-06 22:34   ` Andreas Bießmann
2016-09-30  5:14 ` [U-Boot] [PATCH 0/6] at91: at91sam9g15 improvements Heiko Schocher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471418009-12660-4-git-send-email-hs@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox