diff mbox

[U-Boot,v3,4/7] ARM: vf610: Enable caches

Message ID fd30bd6b306ea74f194b8dd4c59ec1d55f749ba4.1429092214.git.maitysanchayan@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Sanchayan Maity April 15, 2015, 10:54 a.m. UTC
From: Stefan Agner <stefan@agner.ch>

Enables caches which provides a rather huge speedup of the boot loader.
Also mark the on-chip RAM as cachable since this is the area U-Boot runs
from.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
---
 arch/arm/cpu/armv7/vf610/generic.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Tom Rini April 23, 2015, 10:04 p.m. UTC | #1
On Wed, Apr 15, 2015 at 04:24:25PM +0530, Sanchayan Maity wrote:

> From: Stefan Agner <stefan@agner.ch>
> 
> Enables caches which provides a rather huge speedup of the boot loader.
> Also mark the on-chip RAM as cachable since this is the area U-Boot runs
> from.
> 
> Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c
index 3bdc221..1bb9b8e 100644
--- a/arch/arm/cpu/armv7/vf610/generic.c
+++ b/arch/arm/cpu/armv7/vf610/generic.c
@@ -342,3 +342,19 @@  int get_clocks(void)
 #endif
 	return 0;
 }
+
+#ifndef CONFIG_SYS_DCACHE_OFF
+void enable_caches(void)
+{
+#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
+	enum dcache_option option = DCACHE_WRITETHROUGH;
+#else
+	enum dcache_option option = DCACHE_WRITEBACK;
+#endif
+	dcache_enable();
+	icache_enable();
+
+    /* Enable caching on OCRAM */
+	mmu_set_region_dcache_behaviour(IRAM_BASE_ADDR, IRAM_SIZE, option);
+}
+#endif