From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 7/8] ARM: i.MX8: Fix piggydata loading
Date: Thu, 22 Aug 2019 14:51:57 +0200 [thread overview]
Message-ID: <20190822125158.10296-8-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20190822125158.10296-1-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mci/imx-esdhc-pbl.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/mci/imx-esdhc-pbl.c b/drivers/mci/imx-esdhc-pbl.c
index fb27c84163..aa93af656c 100644
--- a/drivers/mci/imx-esdhc-pbl.c
+++ b/drivers/mci/imx-esdhc-pbl.c
@@ -428,14 +428,12 @@ int imx8_esdhc_start_image(int instance)
int imx8_esdhc_load_piggy(int instance)
{
- void *buf = (void *)MX8MQ_ATF_BL33_BASE_ADDR;
+ void *buf, *piggy;
struct imx_flash_header_v2 *hdr = NULL;
- void *bb = 0;
struct esdhc esdhc;
int ret, len;
int offset = SZ_32K;
-
switch (instance) {
case 0:
esdhc.regs = IOMEM(MX8MQ_USDHC1_BASE_ADDR);
@@ -450,6 +448,13 @@ int imx8_esdhc_load_piggy(int instance)
esdhc.is_be = 0;
esdhc.is_mx6 = 1;
+ /*
+ * We expect to be running at MX8MQ_ATF_BL33_BASE_ADDR where the atf
+ * has jumped to. Use a temporary buffer where we won't overwrite
+ * ourselves.
+ */
+ buf = (void *)MX8MQ_ATF_BL33_BASE_ADDR + SZ_32M;
+
ret = esdhc_search_header(&esdhc, &hdr, buf, &offset);
if (ret)
return ret;
@@ -462,13 +467,13 @@ int imx8_esdhc_load_piggy(int instance)
/*
* Calculate location of the piggydata at the offset loaded into RAM
*/
- buf = buf + offset + hdr->boot_data.size;
+ piggy = buf + offset + hdr->boot_data.size;
+
/*
- * Barebox expects the piggydata right behind the PBL in the beginning
- * of RAM.
+ * Copy the piggydata where the uncompressing code expects it
*/
- bb = (void *) MX8MQ_DDR_CSD1_BASE_ADDR + barebox_pbl_size;
- memcpy(bb, buf, piggydata_size());
+ memcpy(input_data, piggy, piggydata_size());
+
return ret;
}
#endif
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-08-22 12:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-22 12:51 [PATCH 0/8] i.MX8 EVK patches Sascha Hauer
2019-08-22 12:51 ` [PATCH 1/8] ARM: aarch64: Fixup relocation table for the second relocation Sascha Hauer
2019-08-22 13:09 ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 2/8] ARM: aarch64: Fix get_runtime_offset after relocation Sascha Hauer
2019-08-22 13:08 ` Rouven Czerwinski
2019-08-22 20:14 ` Andrey Smirnov
2019-08-23 8:11 ` Sascha Hauer
2019-08-22 12:51 ` [PATCH 3/8] pbl: Move piggy verification into pbl_barebox_uncompress() Sascha Hauer
2019-08-22 13:07 ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 4/8] ARM: i.MX: imx8-ddrc: Remove debug code Sascha Hauer
2019-08-22 13:04 ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 5/8] ARM: nxp-imx8mq-evk: Remove duplicate call to imx8mq_cpu_lowlevel_init() Sascha Hauer
2019-08-22 13:03 ` Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 6/8] ARM: nxp-imx8mq-evk: Replace trampoline Sascha Hauer
2019-08-22 13:03 ` Rouven Czerwinski
2019-08-22 12:51 ` Sascha Hauer [this message]
2019-08-22 13:02 ` [PATCH 7/8] ARM: i.MX8: Fix piggydata loading Rouven Czerwinski
2019-08-22 12:51 ` [PATCH 8/8] ARM: nxp-imx8mq-evk: Update comments Sascha Hauer
2019-08-22 12:59 ` Rouven Czerwinski
2019-08-22 13:19 ` [PATCH 0/8] i.MX8 EVK patches Rouven Czerwinski
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=20190822125158.10296-8-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