* [PATCH 0/2] Add support for eCSPI boot on i.MX8M
@ 2025-06-10 15:30 Jonas Rebmann
2025-06-10 15:30 ` [PATCH 1/2] ARM: i.MX8M: Add support for eCSPI boot Jonas Rebmann
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jonas Rebmann @ 2025-06-10 15:30 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX; +Cc: Jonas Rebmann
Add support for atf loading of barebox proper from eCSPI NOR, similar to
existing eCSPI support for imx6, add
imx8m_bbu_internal_spi_i2c_register_handler.
Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
Jonas Rebmann (2):
ARM: i.MX8M: Add support for eCSPI boot
ARM: i.MX8M: Add bbu support for eCSPI boot
arch/arm/mach-imx/atf.c | 4 ++++
arch/arm/mach-imx/imx-bbu-internal.c | 9 +++++++++
arch/arm/mach-imx/xload-spi.c | 38 ++++++++++++++++++++++++++++++++++++
include/mach/imx/bbu.h | 3 +++
include/mach/imx/xload.h | 1 +
5 files changed, 55 insertions(+)
---
base-commit: 95aeb8d47d1050b0f767bc48679f5295b229b8d7
change-id: 20250610-imx8mp_ecspi-07c7bff979ea
Best regards,
--
Jonas Rebmann <jre@pengutronix.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] ARM: i.MX8M: Add support for eCSPI boot
2025-06-10 15:30 [PATCH 0/2] Add support for eCSPI boot on i.MX8M Jonas Rebmann
@ 2025-06-10 15:30 ` Jonas Rebmann
2025-06-11 8:13 ` Ahmad Fatoum
2025-06-10 15:30 ` [PATCH 2/2] ARM: i.MX8M: Add bbu " Jonas Rebmann
2025-06-11 7:04 ` [PATCH 0/2] Add support for eCSPI boot on i.MX8M Sascha Hauer
2 siblings, 1 reply; 5+ messages in thread
From: Jonas Rebmann @ 2025-06-10 15:30 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX; +Cc: Jonas Rebmann
Load and boot barebox via eCSPI when started so via bootrom.
Only tested on i.MX8MP
Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
arch/arm/mach-imx/atf.c | 4 ++++
arch/arm/mach-imx/xload-spi.c | 38 ++++++++++++++++++++++++++++++++++++++
include/mach/imx/xload.h | 1 +
3 files changed, 43 insertions(+)
diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c
index 6dc80cb70054eca2aa70b0cfc989baf2a5b75232..6993e33baa39c87afa15ee7302e574d096fde7a5 100644
--- a/arch/arm/mach-imx/atf.c
+++ b/arch/arm/mach-imx/atf.c
@@ -16,6 +16,7 @@
#include <soc/fsl/caam.h>
#include <tee/optee.h>
#include <mach/imx/ele.h>
+#include <mach/imx/xload.h>
/**
* imx8m_atf_load_bl31 - Load ATF BL31 blob and transfer control to it
@@ -193,6 +194,9 @@ void imx8mp_load_bl33(void *bl33)
case BOOTSOURCE_SPI:
imx8mp_qspi_load_image(instance, bl33);
break;
+ case BOOTSOURCE_SPI_NOR:
+ imx8m_ecspi_load_image(instance, bl33);
+ break;
default:
printf("Unhandled bootsource BOOTSOURCE_%d\n", src);
hang();
diff --git a/arch/arm/mach-imx/xload-spi.c b/arch/arm/mach-imx/xload-spi.c
index 621e9557be0c54b24eb004deeea85fd5cb9434f4..0bdcce8659f744f54e88aa3a69e1d06f4ab95689 100644
--- a/arch/arm/mach-imx/xload-spi.c
+++ b/arch/arm/mach-imx/xload-spi.c
@@ -4,6 +4,7 @@
#include <io.h>
#include <spi/imx-spi.h>
#include <mach/imx/imx6-regs.h>
+#include <mach/imx/imx8mq-regs.h>
#include <mach/imx/generic.h>
#include <bootsource.h>
#include <asm/sections.h>
@@ -136,3 +137,40 @@ int imx6_spi_start_image(int instance)
bb();
}
+
+/**
+ * imx8m_spi_load_image - load an image from SPI NOR
+ * @instance: The SPI controller instance (0..2)
+ * @bl33: The buffer to load the bl33 barebox image to
+ *
+ * This function loads data from SPI NOR flash. This assumes the
+ * SPI controller has already been initialized and the pinctrl / clocks are
+ * configured correctly. This is the case when the ROM has loaded the initial
+ * portion of the boot loader from exactly this controller.
+ *
+ * Return: 0 if successful, negative error code otherwise
+ */
+
+int imx8m_ecspi_load_image(int instance, void *bl33)
+{
+ void *base;
+
+ /* Base Adresses are the same for i.MX8M[QM] */
+ switch (instance) {
+ case 0:
+ base = IOMEM(MX8MQ_ECSPI1_BASE_ADDR);
+ break;
+ case 1:
+ base = IOMEM(MX8MQ_ECSPI2_BASE_ADDR);
+ break;
+ case 2:
+ base = IOMEM(MX8MQ_ECSPI3_BASE_ADDR);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ cspi_2_3_load(base, SZ_8K, bl33, imx_image_size());
+
+ return 0;
+}
diff --git a/include/mach/imx/xload.h b/include/mach/imx/xload.h
index 62b853f585e5a504a853d3da05deecaa1d7b04ad..396c728547614091fc710de50dc1583c6b6e2a68 100644
--- a/include/mach/imx/xload.h
+++ b/include/mach/imx/xload.h
@@ -16,6 +16,7 @@ int imx7_esdhc_start_image(int instance);
int imx7_nand_start_image(void);
/* Below functions only load and don't start the image */
+int imx8m_ecspi_load_image(int instance, void *bl33);
int imx8m_esdhc_load_image(int instance, void *bl33);
int imx8mn_esdhc_load_image(int instance, void *bl33);
int imx8mp_esdhc_load_image(int instance, void *bl33);
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] ARM: i.MX8M: Add bbu support for eCSPI boot
2025-06-10 15:30 [PATCH 0/2] Add support for eCSPI boot on i.MX8M Jonas Rebmann
2025-06-10 15:30 ` [PATCH 1/2] ARM: i.MX8M: Add support for eCSPI boot Jonas Rebmann
@ 2025-06-10 15:30 ` Jonas Rebmann
2025-06-11 7:04 ` [PATCH 0/2] Add support for eCSPI boot on i.MX8M Sascha Hauer
2 siblings, 0 replies; 5+ messages in thread
From: Jonas Rebmann @ 2025-06-10 15:30 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX; +Cc: Jonas Rebmann
Adds a barebox-update handler for i.MX8M eCSPI NOR flash
Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
arch/arm/mach-imx/imx-bbu-internal.c | 9 +++++++++
include/mach/imx/bbu.h | 3 +++
2 files changed, 12 insertions(+)
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 66a8ae10e507b601429526afc0122adca31ce4d6..8ed447f68808eb4ab923328318d814363f906e32 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -627,6 +627,15 @@ int imx6_bbu_internal_spi_i2c_register_handler(const char *name,
unsigned long flags)
__alias(imx53_bbu_internal_spi_i2c_register_handler);
+int imx8m_bbu_internal_spi_i2c_register_handler(const char *name,
+ const char *devicefile,
+ unsigned long flags)
+{
+ flags |= IMX_BBU_FLAG_PARTITION_STARTS_AT_HEADER;
+
+ return imx53_bbu_internal_spi_i2c_register_handler(name, devicefile, flags);
+}
+
/*
* Register an VFxxx internal boot update handler for i2c/spi
* EEPROMs / flashes. Nearly the same as MMC/SD, but we do not need to
diff --git a/include/mach/imx/bbu.h b/include/mach/imx/bbu.h
index 9a35b0074dd42575d06995d491d9fd2b22305cd5..81ee9c8698d907d70aa807c1320a19ba43a96e68 100644
--- a/include/mach/imx/bbu.h
+++ b/include/mach/imx/bbu.h
@@ -69,6 +69,9 @@ int imx7_bbu_internal_mmcboot_register_handler(const char *name, const char *dev
int imx6_bbu_internal_spi_i2c_register_handler(const char *name, const char *devicefile,
unsigned long flags);
+int imx8m_bbu_internal_spi_i2c_register_handler(const char *name, const char *devicefile,
+ unsigned long flags);
+
int vf610_bbu_internal_mmc_register_handler(const char *name, const char *devicefile,
unsigned long flags);
--
2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Add support for eCSPI boot on i.MX8M
2025-06-10 15:30 [PATCH 0/2] Add support for eCSPI boot on i.MX8M Jonas Rebmann
2025-06-10 15:30 ` [PATCH 1/2] ARM: i.MX8M: Add support for eCSPI boot Jonas Rebmann
2025-06-10 15:30 ` [PATCH 2/2] ARM: i.MX8M: Add bbu " Jonas Rebmann
@ 2025-06-11 7:04 ` Sascha Hauer
2 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2025-06-11 7:04 UTC (permalink / raw)
To: BAREBOX, Jonas Rebmann
On Tue, 10 Jun 2025 17:30:54 +0200, Jonas Rebmann wrote:
> Add support for atf loading of barebox proper from eCSPI NOR, similar to
> existing eCSPI support for imx6, add
> imx8m_bbu_internal_spi_i2c_register_handler.
>
>
Applied, thanks!
[1/2] ARM: i.MX8M: Add support for eCSPI boot
https://git.pengutronix.de/cgit/barebox/commit/?id=a64bec85091f (link may not be stable)
[2/2] ARM: i.MX8M: Add bbu support for eCSPI boot
https://git.pengutronix.de/cgit/barebox/commit/?id=c312b49617f0 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ARM: i.MX8M: Add support for eCSPI boot
2025-06-10 15:30 ` [PATCH 1/2] ARM: i.MX8M: Add support for eCSPI boot Jonas Rebmann
@ 2025-06-11 8:13 ` Ahmad Fatoum
0 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2025-06-11 8:13 UTC (permalink / raw)
To: Jonas Rebmann, Sascha Hauer, BAREBOX
Hello Jonas,
On 6/10/25 17:30, Jonas Rebmann wrote:
> Load and boot barebox via eCSPI when started so via bootrom.
>
> Only tested on i.MX8MP
>
> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
> ---
> arch/arm/mach-imx/atf.c | 4 ++++
> arch/arm/mach-imx/xload-spi.c | 38 ++++++++++++++++++++++++++++++++++++++
> include/mach/imx/xload.h | 1 +
> 3 files changed, 43 insertions(+)
>
> diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c
> index 6dc80cb70054eca2aa70b0cfc989baf2a5b75232..6993e33baa39c87afa15ee7302e574d096fde7a5 100644
> --- a/arch/arm/mach-imx/atf.c
> +++ b/arch/arm/mach-imx/atf.c
> @@ -16,6 +16,7 @@
> #include <soc/fsl/caam.h>
> #include <tee/optee.h>
> #include <mach/imx/ele.h>
> +#include <mach/imx/xload.h>
>
> /**
> * imx8m_atf_load_bl31 - Load ATF BL31 blob and transfer control to it
> @@ -193,6 +194,9 @@ void imx8mp_load_bl33(void *bl33)
> case BOOTSOURCE_SPI:
> imx8mp_qspi_load_image(instance, bl33);
> break;
> + case BOOTSOURCE_SPI_NOR:
> + imx8m_ecspi_load_image(instance, bl33);
Can you send a fixup enabling this for all imx8m*_ variants?
Thanks,
Ahmad
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-06-11 8:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-10 15:30 [PATCH 0/2] Add support for eCSPI boot on i.MX8M Jonas Rebmann
2025-06-10 15:30 ` [PATCH 1/2] ARM: i.MX8M: Add support for eCSPI boot Jonas Rebmann
2025-06-11 8:13 ` Ahmad Fatoum
2025-06-10 15:30 ` [PATCH 2/2] ARM: i.MX8M: Add bbu " Jonas Rebmann
2025-06-11 7:04 ` [PATCH 0/2] Add support for eCSPI boot on i.MX8M Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox