[U-Boot] PATCH Nios2 kernel bootstrap error due to missing processor data cache flush: fix

Renato Andreola
2009-04-10T12:21:33Z

From b75bd27f89ac6c105cebb6507cf082b6f5fffc7d Mon Sep 17 00:00:00 2001
From: Renato Andreola <renato.andreola@imagos.it>
Date: Fri, 10 Apr 2009 12:32:29 +0200
Subject: Nios2: do_boom_linux(): kernel gunzip input data integrity
problem due to mi
ssing cache flush

Added instruction and data caches flush

Signed-off-by: Renato Andreola <renato.andreola@imagos.it>
---
lib_nios2/bootm.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lib_nios2/bootm.c b/lib_nios2/bootm.c
index 53fd569..1e8034b 100644
--- a/lib_nios2/bootm.c
+++ b/lib_nios2/bootm.c
@@ -2,6 +2,9 @@
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
* Scott McNutt <smcnutt@psyent.com>
*
+ * (C) Copyright 2009, Imagos sas <www.imagos.it>
+ * Renato Andreola <renato.andreola@imagos.it>
+ *
* See file CREDITS for list of people who contributed to this
* project.
*
@@ -24,6 +27,7 @@
#include <common.h>
#include <command.h>
#include <asm/byteorder.h>
+#include <asm/cache.h>

int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t
*images)
{
@@ -31,7 +35,9 @@ int do_bootm_linux(int flag, int argc, char *argv[],
bootm_headers_t *images)

if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
return 1;
-
+ /* flushes data and instruction caches before calling the kernel */
+ flush_dcache (0,CONFIG_SYS_DCACHE_SIZE );
+ flush_icache (0,CONFIG_SYS_ICACHE_SIZE);
/* For now we assume the Microtronix linux ... which only
* needs to be called ;-)
*/
--
1.5.5