[PATCH 1/2] mci: imx-esdhc-pbl: Add support for IMX7
Anees Rehman
anees.r3hman at gmail.com
Mon Aug 3 18:11:07 EDT 2020
From: Anees Rehman <anees.rehman at atlascopco.com>
Signed-off-by: Anees Rehman <anees.r3hman at gmail.com>
---
arch/arm/mach-imx/include/mach/xload.h | 1 +
drivers/mci/imx-esdhc-pbl.c | 37 ++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/arch/arm/mach-imx/include/mach/xload.h b/arch/arm/mach-imx/include/mach/xload.h
index 05022e9d0..94b2f3761 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 imx7_esdhc_start_image(int instance);
int imx8m_esdhc_load_image(int instance, bool start);
int imx8mp_esdhc_load_image(int instance, bool start);
diff --git a/drivers/mci/imx-esdhc-pbl.c b/drivers/mci/imx-esdhc-pbl.c
index 5c382bbcc..10a008280 100644
--- a/drivers/mci/imx-esdhc-pbl.c
+++ b/drivers/mci/imx-esdhc-pbl.c
@@ -21,6 +21,7 @@
#ifdef CONFIG_ARCH_IMX
#include <mach/atf.h>
#include <mach/imx6-regs.h>
+#include <mach/imx7-regs.h>
#include <mach/imx8mq-regs.h>
#include <mach/imx8mm-regs.h>
#include <mach/imx-header.h>
@@ -265,6 +266,42 @@ int imx6_esdhc_start_image(int instance)
return esdhc_load_image(&host, 0x10000000, 0x10000000, 0, SZ_1K, true);
}
+/**
+ * imx7_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 imx7_esdhc_start_image(int instance)
+{
+ struct esdhc_soc_data data;
+ struct fsl_esdhc_host host;
+
+ switch (instance) {
+ case 0:
+ host.regs = IOMEM(MX7_USDHC1_BASE_ADDR);
+ break;
+ case 1:
+ host.regs = IOMEM(MX7_USDHC2_BASE_ADDR);
+ break;
+ case 2:
+ host.regs = IOMEM(MX7_USDHC3_BASE_ADDR);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ imx_esdhc_init(&host, &data);
+
+ return esdhc_load_image(&host, 0x80000000, 0x80000000, 0, SZ_1K, true);
+}
+
/**
* imx8m_esdhc_load_image - Load and optionally start an image from USDHC controller
* @instance: The USDHC controller instance (0..2)
--
2.28.0
More information about the barebox
mailing list