summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-06-07 06:00:41 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2018-06-11 08:54:10 +0200
commitee44a5c62076416ff040299e18f6e8ffc0f6f495 (patch)
tree3dcec79fb56e7a5d3ab13fe1008599bdc6a383e2 /arch
parentceb7bc504b6eb80c2fc152d3e21311d01ba918b4 (diff)
downloadbarebox-ee44a5c62076416ff040299e18f6e8ffc0f6f495.tar.gz
barebox-ee44a5c62076416ff040299e18f6e8ffc0f6f495.tar.xz
ARM: i.MX: xload-esdhc: Add support for i.MX8
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/include/mach/xload.h1
-rw-r--r--arch/arm/mach-imx/xload-esdhc.c33
2 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/include/mach/xload.h b/arch/arm/mach-imx/include/mach/xload.h
index 4e38ac7e2f..8f141bc37e 100644
--- a/arch/arm/mach-imx/include/mach/xload.h
+++ b/arch/arm/mach-imx/include/mach/xload.h
@@ -5,6 +5,7 @@ int imx53_nand_start_image(void);
int imx6_spi_load_image(int instance, unsigned int flash_offset, void *buf, int len);
int imx6_spi_start_image(int instance);
int imx6_esdhc_start_image(int instance);
+int imx8_esdhc_start_image(int instance);
int imx_image_size(void);
diff --git a/arch/arm/mach-imx/xload-esdhc.c b/arch/arm/mach-imx/xload-esdhc.c
index 6ab4cabb77..08ba9b08dc 100644
--- a/arch/arm/mach-imx/xload-esdhc.c
+++ b/arch/arm/mach-imx/xload-esdhc.c
@@ -15,6 +15,7 @@
#include <io.h>
#include <mci.h>
#include <mach/imx6-regs.h>
+#include <mach/imx8mq-regs.h>
#include <mach/xload.h>
#include <linux/sizes.h>
#include "../../../drivers/mci/sdhci.h"
@@ -292,3 +293,35 @@ int imx6_esdhc_start_image(int instance)
return esdhc_start_image(&esdhc, 0x10000000, 0);
}
+
+/**
+ * imx8_esdhc_start_image - Load and start an image from USDHC controller
+ * @instance: The USDHC controller instance (0..2)
+ *
+ * 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.
+ */
+int imx8_esdhc_start_image(int instance)
+{
+ struct esdhc esdhc;
+
+ switch (instance) {
+ case 0:
+ esdhc.regs = IOMEM(MX8MQ_USDHC1_BASE_ADDR);
+ break;
+ case 1:
+ esdhc.regs = IOMEM(MX8MQ_USDHC2_BASE_ADDR);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ esdhc.is_mx6 = 1;
+
+ return esdhc_start_image(&esdhc, MX8MQ_DDR_CSD1_BASE_ADDR, SZ_32K);
+} \ No newline at end of file