summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2020-01-07 11:25:13 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-01-09 08:53:59 +0100
commit9cede726c6f74af359090fe2c602f244be343c02 (patch)
treec41f7808d8216132d79dcb5d7ff30d4497a5a4c9 /drivers
parent8ebc87ee196dc0b88723b5544a746f1b8dbe838f (diff)
downloadbarebox-9cede726c6f74af359090fe2c602f244be343c02.tar.gz
barebox-9cede726c6f74af359090fe2c602f244be343c02.tar.xz
esdhc-pbl: allow to skip starting i.MX8 image
Add an option that allows to just load the image into memory, but return to the calling function instead of directly jumping to the loaded image. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mci/imx-esdhc-pbl.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/mci/imx-esdhc-pbl.c b/drivers/mci/imx-esdhc-pbl.c
index c0d27fb7eb..a1daf32d8b 100644
--- a/drivers/mci/imx-esdhc-pbl.c
+++ b/drivers/mci/imx-esdhc-pbl.c
@@ -121,8 +121,8 @@ static int esdhc_search_header(struct fsl_esdhc_host *host,
}
static int
-esdhc_start_image(struct fsl_esdhc_host *host, ptrdiff_t address, ptrdiff_t entry,
- u32 offset)
+esdhc_load_image(struct fsl_esdhc_host *host, ptrdiff_t address,
+ ptrdiff_t entry, u32 offset, bool start)
{
void *buf = (void *)address;
@@ -177,6 +177,9 @@ esdhc_start_image(struct fsl_esdhc_host *host, ptrdiff_t address, ptrdiff_t entr
pr_debug("Image loaded successfully\n");
+ if (!start)
+ return 0;
+
bb = buf + ofs;
sync_caches_for_execution();
@@ -254,22 +257,23 @@ int imx6_esdhc_start_image(int instance)
imx_esdhc_init(&host, &data);
- return esdhc_start_image(&host, 0x10000000, 0x10000000, 0);
+ return esdhc_load_image(&host, 0x10000000, 0x10000000, 0, true);
}
/**
- * imx8_esdhc_start_image - Load and start an image from USDHC controller
+ * imx8_esdhc_load_image - Load and optionally start an image from USDHC controller
* @instance: The USDHC controller instance (0..2)
+ * @start: Whether to directly start the loaded image
*
* This uses esdhc_start_image() to load an image from SD/MMC. It is
* assumed that the image is the currently running barebox image (This
* information is used to calculate the length of the image). The
* image is started afterwards.
*
- * Return: If successful, this function does not return. A negative error
- * code is returned when this function fails.
+ * Return: If successful, this function does not return (if directly started)
+ * or 0. A negative error code is returned when this function fails.
*/
-int imx8_esdhc_start_image(int instance)
+int imx8_esdhc_load_image(int instance, bool start)
{
struct esdhc_soc_data data;
struct fsl_esdhc_host host;
@@ -279,8 +283,8 @@ int imx8_esdhc_start_image(int instance)
if (ret)
return ret;
- return esdhc_start_image(&host, MX8MQ_DDR_CSD1_BASE_ADDR,
- MX8MQ_ATF_BL33_BASE_ADDR, SZ_32K);
+ return esdhc_load_image(&host, MX8MQ_DDR_CSD1_BASE_ADDR,
+ MX8MQ_ATF_BL33_BASE_ADDR, SZ_32K, start);
}
int imx8_esdhc_load_piggy(int instance)