
From: Kuo-Jung Su dantesu@faraday-tech.com
With MMU/D-Cache enabled, data might be retained at 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 causes data lost issue.
This patch is designed to fixed this issue. It has been verified at ARM based systems, and should also work at other platforms.
Signed-off-by: Kuo-Jung Su dantesu@faraday-tech.com --- common/cmd_boot.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/common/cmd_boot.c b/common/cmd_boot.c index d3836fd..1a1a532 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -50,6 +50,16 @@ static int do_go(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf ("## Starting application at 0x%08lX ...\n", addr);
+#ifdef CONFIG_USE_IRQ + disable_interrupts(); +#endif +#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