From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: [PATCH] ARM: i.MX25: fixup broken DryIce GPR
Date: Wed, 3 Feb 2016 11:49:03 +0100 [thread overview]
Message-ID: <1454496543-15791-1-git-send-email-s.trumtrar@pengutronix.de> (raw)
Fixup the DryIce Non-Non-Volatile-Memory GPR register.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
arch/arm/mach-imx/imx25.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/arch/arm/mach-imx/imx25.c b/arch/arm/mach-imx/imx25.c
index 8761d636820f..3cfeebbe9348 100644
--- a/arch/arm/mach-imx/imx25.c
+++ b/arch/arm/mach-imx/imx25.c
@@ -20,6 +20,9 @@
#include <mach/generic.h>
#include <linux/sizes.h>
+#define MX25_BOOTROM_HAB_MAGIC 0x3c95cac6
+#define MX25_DRYICE_GPR 0x3c
+
void imx25_setup_weimcs(size_t cs, unsigned upper, unsigned lower,
unsigned additional)
{
@@ -55,9 +58,32 @@ u64 imx_uid(void)
int imx25_init(void)
{
+ int val;
+
imx25_boot_save_loc((void *)MX25_CCM_BASE_ADDR);
add_generic_device("imx25-esdctl", 0, NULL, MX25_ESDCTL_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
+ /*
+ * When the i.MX25 is used with internal boot, the boot ROM always
+ * performs some HAB actions. These will copy the value from DryIce
+ * GPR (0x53ffc03c) to a location in SRAM (0x78001734) and then overwrites
+ * the GPR with 0x3c95cac6.
+ * After the HAB routine is done, the boot ROM should copy the previously
+ * saved value from SRAM back to the GPR. The last step is not done.
+ * The boot ROM is officially broken in this regard.
+ * This renders the Non-volatile memory to a Non-Non-volatile memory.
+ * 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.
+ */
+ if (val != MX25_BOOTROM_HAB_MAGIC)
+ writel(val, MX25_DRYICE_BASE_ADDR + MX25_DRYICE_GPR);
+
return 0;
}
--
2.7.0.rc3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2016-02-03 10:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 10:49 Steffen Trumtrar [this message]
2016-02-04 7:45 ` Sascha Hauer
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=1454496543-15791-1-git-send-email-s.trumtrar@pengutronix.de \
--to=s.trumtrar@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