From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH] cmd: go: Flush cache before jumping to app/image
Date: Wed, 12 Feb 2020 13:21:51 +0100 [thread overview]
Message-ID: <20200212122151.28591-1-sr@denx.de> (raw)
It has been noticed on MT7628/88 platforms, that booting the RAM image
does not work reliably. Sometimes it works and sometimes not. Debugging
showed that this "might" be a cache related issue as very strange
errors occured (output corrupted etc).
This patch adds a cache flush for the complete SDRAM area to the go cmd
before jumping to the entry point. The complete area is flushed as we
don't know at this point, how big the area of the "application" really
is.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Mauro Condarelli <mc5686@mclink.it>
Cc: Weijie Gao <weijie.gao@mediatek.com>
---
cmd/boot.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/cmd/boot.c b/cmd/boot.c
index 9150fce80b..968522face 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -9,10 +9,13 @@
*/
#include <common.h>
#include <command.h>
+#include <cpu_func.h>
#include <net.h>
#ifdef CONFIG_CMD_GO
+DECLARE_GLOBAL_DATA_PTR;
+
/* Allow ports to override the default behavior */
__attribute__((weak))
unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
@@ -33,6 +36,13 @@ static int do_go(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf ("## Starting application at 0x%08lX ...\n", addr);
+ /*
+ * Flush cache before jumping to application. Let's flush the
+ * whole SDRAM area, since we don't know the size of the image
+ * that was loaded.
+ */
+ flush_cache(gd->bd->bi_memstart, gd->bd->bi_memsize);
+
/*
* pass address parameter as argv[0] (aka command name),
* and all remaining args
--
2.25.0
next reply other threads:[~2020-02-12 12:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 12:21 Stefan Roese [this message]
2020-02-12 13:00 ` [PATCH] cmd: go: Flush cache before jumping to app/image Daniel Schwierzeck
2020-02-12 13:09 ` Mauro Condarelli
2020-02-12 13:22 ` Stefan
2020-02-12 13:50 ` Mauro Condarelli
2020-02-12 14:24 ` Stefan
2020-02-12 13:17 ` Stefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200212122151.28591-1-sr@denx.de \
--to=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox