mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Anees Rehman <anees.r3hman@gmail.com>
To: barebox@lists.infradead.org
Cc: Anees Rehman <anees.rehman@atlascopco.com>,
	Anees Rehman <anees.r3hman@gmail.com>
Subject: [PATCH v2 1/2] mci: imx-esdhc-pbl: Add support for IMX7
Date: Tue,  4 Aug 2020 23:41:57 +0200	[thread overview]
Message-ID: <20200804214158.25721-2-anees.r3hman@gmail.com> (raw)
In-Reply-To: <20200804214158.25721-1-anees.r3hman@gmail.com>

From: Anees Rehman <anees.rehman@atlascopco.com>

Signed-off-by: Anees Rehman <anees.r3hman@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-08-04 21:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 21:41 [PATCH v2 0/2] ARM: i.MX: Add support for IMX7 based board Anees Rehman
2020-08-04 21:41 ` Anees Rehman [this message]
2020-08-04 21:41 ` [PATCH v2 2/2] ARM: i.MX: Add atlascopco sxb board Anees Rehman
2020-08-06 12:41   ` Marco Felsch
2020-08-10  8:31     ` Anees Rehman
2020-08-10  9:01       ` Marco Felsch
2020-08-10  9:33 ` [PATCH v2 0/2] ARM: i.MX: Add support for IMX7 based board 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=20200804214158.25721-2-anees.r3hman@gmail.com \
    --to=anees.r3hman@gmail.com \
    --cc=anees.rehman@atlascopco.com \
    --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