From 31d430d8db335b7c3fea08b6aa8309b90b8f2cb9 Mon Sep 17 00:00:00 2001
From: Tom Rini <trini@ti.com>
Date: Tue, 8 Nov 2011 08:07:47 +0100
Subject: [PATCH 8/8] HACK: am335x evm: turn d-cache on globally, turn it off when doing nfs stuff

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
 board/ti/am335x/evm.c        |   12 ++++++++++++
 include/configs/am335x_evm.h |    1 +
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/board/ti/am335x/evm.c b/board/ti/am335x/evm.c
index bc1119e..e64626a 100644
--- a/board/ti/am335x/evm.c
+++ b/board/ti/am335x/evm.c
@@ -1041,3 +1041,15 @@ U_BOOT_CMD(
 
 #endif /* CONFIG_NAND_TI81XX */
 #endif /* CONFIG_SPL_BUILD */
+
+/*
+ * Not all drivers we use (such as ethernet) are dcache safe.  But
+ * we need cache on to boot quickly enough.
+ */
+#ifndef CONFIG_SYS_DCACHE_OFF
+void enable_caches(void)
+{
+	/* Enable D-cache. I-cache is already enabled in start.S */
+	dcache_enable();
+}
+#endif
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 8bf3ff1..58fa2f6 100755
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -119,6 +119,7 @@
 		"bootm ${loadaddr}\0" \
 	"net_boot=echo Booting from network ...; " \
 		"setenv autoload no; " \
+		"dcache off; " \
 		"dhcp; " \
 		"tftp ${loadaddr} ${bootfile}; " \
 		"run net_args; " \
-- 
1.7.2.5

