mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] ARM: i.MX25: Fix restoring of volatile register
Date: Fri,  9 Feb 2018 10:47:40 +0100	[thread overview]
Message-ID: <20180209094740.13128-1-s.hauer@pengutronix.de> (raw)

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/imx25.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/imx25.c b/arch/arm/mach-imx/imx25.c
index a4e27dd913..d27680e428 100644
--- a/arch/arm/mach-imx/imx25.c
+++ b/arch/arm/mach-imx/imx25.c
@@ -67,14 +67,16 @@ int imx25_init(void)
 	 * To still be able to use the GPR for its intended purpose, copy the
 	 * saved SRAM value back manually.
 	 */
-	val = readl(MX25_IRAM_BASE_ADDR + 0x1734);
 
 	/*
-	 * When there is a different value in SRAM than the magic value
-	 * it must be a value saved to the GPR.
+	 * When the value in the GPR matches the value the ROM has written there then
+	 * we have to copy back the value from the SRAM back to the GPR.
 	 */
-	if (val != MX25_BOOTROM_HAB_MAGIC)
+	val = readl(MX25_DRYICE_BASE_ADDR + MX25_DRYICE_GPR);
+	if (val == MX25_BOOTROM_HAB_MAGIC) {
+		val = readl(MX25_IRAM_BASE_ADDR + 0x1734);
 		writel(val, MX25_DRYICE_BASE_ADDR + MX25_DRYICE_GPR);
+	}
 
 	return 0;
 }
-- 
2.15.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2018-02-09  9:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180209094740.13128-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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