From: Kuo-Jung Su Date: Mon, 29 Apr 2013 10:53:08 +0800 Subject: [U-Boot] [PATCH v2] cmd_boot: cleanup for 'go' command In-Reply-To: <1366963312-2901-1-git-send-email-dantesu@gmail.com> References: <1366963312-2901-1-git-send-email-dantesu@gmail.com> Message-ID: <1367203988-5829-1-git-send-email-dantesu@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Kuo-Jung Su With MMU/D-Cache enabled, data might be retained at d-cache rather than at DRAM when we execute 'go' command, and some of the bare-metal softwares would always invalidate the entire data cache at start-up, and then leads to a data lost issue. Furthermore, the U-Boot not only relocates itself but also updates symbol table at start-up, which means the i-cache might also be dirty, so it would be better to invalidates the i-cache alone with d-cache flush. This patch is designed to fix the issues above. It has been verified at ARM based systems, and should also work at other platforms. Signed-off-by: Kuo-Jung Su CC: Wolfgang Denk --- Changes for v2: - Update the commit log to state that i-cache is also invalidated. - DO NOT disable interrupts. common/cmd_boot.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/cmd_boot.c b/common/cmd_boot.c index d3836fd..9e66364 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -50,6 +50,13 @@ static int do_go(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf ("## Starting application at 0x%08lX ...\n", addr); +#ifndef CONFIG_SYS_DCACHE_OFF + flush_dcache_all(); +#endif +#ifndef CONFIG_SYS_ICACHE_OFF + invalidate_icache_all(); +#endif + /* * pass address parameter as argv[0] (aka command name), * and all remaining args -- 1.7.9.5