DistroKit Mailinglist
 help / color / mirror / Atom feed
* [DistroKit] [PATCH v1 0/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board
@ 2024-01-11 15:01 Leonard Göhrs
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 1/5] tf-a: add patch to auto-detect the correct UART on i.MX8M Leonard Göhrs
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Leonard Göhrs @ 2024-01-11 15:01 UTC (permalink / raw)
  To: distrokit

This adds support for the i.MX8MP based MBa8MPxL[1] by TQ.

This board uses another UART than e.g. the NXP EVK boards
for debug output. This is why we need a tf-a patch that
automatically selects the UART at runtime based on which one
is already enabled. 

While at it I've also added a barebox state partition for all
other i.MX8M images, to prepare them for RAUC support
and added RAUC support for the MBa8MPxL.

This patch series is built upon Ahmads series[2] that
updates barebox and cleans up its configuration,
so that should be merged first to prevent conflicts.

[1]: https://www.tq-group.com/en/products/tq-embedded/arm-architecture/mba8mpxl/
[2]: https://lore.distrokit.org/distrokit/20240102154603.3678357-1-a.fatoum@pengutronix.de/T/#t





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [DistroKit] [PATCH v1 1/5] tf-a: add patch to auto-detect the correct UART on i.MX8M
  2024-01-11 15:01 [DistroKit] [PATCH v1 0/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board Leonard Göhrs
@ 2024-01-11 15:01 ` Leonard Göhrs
  2024-01-11 18:03   ` Ahmad Fatoum
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 2/5] v8a: images: imx8m: add barebox state partition Leonard Göhrs
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Leonard Göhrs @ 2024-01-11 15:01 UTC (permalink / raw)
  To: distrokit; +Cc: Leonard Göhrs

This helps us on the TQ MBa8MPxL i.MX8MP development board,
that uses a different UART for debug output than the EVKs we
currently support.

Other i.MX8M boards should not be affected by the
IMX_BOOT_UART_BASE=0 configuration option because the automatic
selection will choose the correct UART.

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
---
 configs/platform-v8a/platformconfig           |   2 +-
 ...t-console-base-address-during-runtim.patch | 254 ++++++++++++++++++
 ...MX_BOOT_UART_BASE-autodetection-opti.patch | 133 +++++++++
 ...mers-pengutronix-distrokit-20240111.patch} |  10 +-
 patches/tf-a-v2.8/series                      |  13 +-
 5 files changed, 402 insertions(+), 10 deletions(-)
 create mode 100644 patches/tf-a-v2.8/0201-feat-imx8m-detect-console-base-address-during-runtim.patch
 create mode 100644 patches/tf-a-v2.8/0202-fix-imx8m-make-IMX_BOOT_UART_BASE-autodetection-opti.patch
 rename patches/tf-a-v2.8/{0201-Release-2.8-customers-pengutronix-distrokit-20230210.patch => 0301-Release-2.8-customers-pengutronix-distrokit-20240111.patch} (76%)

diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
index b71b361..6925dac 100644
--- a/configs/platform-v8a/platformconfig
+++ b/configs/platform-v8a/platformconfig
@@ -216,7 +216,7 @@ PTXCONF_TF_A_ARM_ARCH_MAJOR_8=y
 PTXCONF_TF_A_ARM_ARCH_MAJOR=8
 PTXCONF_TF_A_PLATFORMS="imx8mq imx8mm imx8mn imx8mp"
 PTXCONF_TF_A_ARM_ARCH_MINOR=0
-PTXCONF_TF_A_EXTRA_ARGS=""
+PTXCONF_TF_A_EXTRA_ARGS="IMX_BOOT_UART_BASE=0"
 PTXCONF_TF_A_ARTIFACTS="bl31.bin"
 
 #
diff --git a/patches/tf-a-v2.8/0201-feat-imx8m-detect-console-base-address-during-runtim.patch b/patches/tf-a-v2.8/0201-feat-imx8m-detect-console-base-address-during-runtim.patch
new file mode 100644
index 0000000..09c4d79
--- /dev/null
+++ b/patches/tf-a-v2.8/0201-feat-imx8m-detect-console-base-address-during-runtim.patch
@@ -0,0 +1,254 @@
+From: Marco Felsch <m.felsch@pengutronix.de>
+Date: Mon, 24 Jul 2023 15:05:58 +0200
+Subject: [PATCH] feat(imx8m): detect console base address during runtime
+
+Provide a helper to detect the enabled UART device during runtime. This
+lower the integration effort and make it more straight forward for
+'simple' use-cases with a single UART enabled. If multiple UARTs are
+enabled the first enabled is returned.
+
+The auto-detection is enabled by setting IMX_BOOT_UART_BASE=0 to keep
+the backward compatibility. For more advanced use-cases (multiple UARTs
+are enabled) the user still has to provide the correct base address.
+
+Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
+Change-Id: I300a167e1a10f9aa991c8d1c3efe2c6b23f56c47
+---
+ plat/imx/imx8m/imx8m_ccm.c                | 58 +++++++++++++++++++++++++++++++
+ plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c | 11 +++++-
+ plat/imx/imx8m/imx8mm/platform.mk         |  1 +
+ plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c | 11 +++++-
+ plat/imx/imx8m/imx8mn/platform.mk         |  1 +
+ plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c | 11 +++++-
+ plat/imx/imx8m/imx8mp/platform.mk         |  1 +
+ plat/imx/imx8m/include/imx8m_ccm.h        | 12 +++++++
+ 8 files changed, 103 insertions(+), 3 deletions(-)
+ create mode 100644 plat/imx/imx8m/imx8m_ccm.c
+ create mode 100644 plat/imx/imx8m/include/imx8m_ccm.h
+
+diff --git a/plat/imx/imx8m/imx8m_ccm.c b/plat/imx/imx8m/imx8m_ccm.c
+new file mode 100644
+index 000000000000..10a00c990031
+--- /dev/null
++++ b/plat/imx/imx8m/imx8m_ccm.c
+@@ -0,0 +1,58 @@
++/*
++ * Copyright (c) 2023, Pengutronix. All rights reserved.
++ *
++ * SPDX-License-Identifier: BSD-3-Clause
++ */
++
++#include <lib/mmio.h>
++#include <platform_def.h>
++
++#define UCR1    		0x80
++#define UCR1_UARTEN		BIT(0)
++#define DOMAIN0_RUNNING(d)	(((d) & 0x3) != 0)
++
++static struct imx_uart {
++	unsigned int ccm_reg;
++	unsigned int uart_base;
++} imx8m_uart_info[] = {
++	{	/* UART 1 */
++		.ccm_reg = 0x4490,
++		.uart_base = 0x30860000,
++	}, {	/* UART 2 */
++		.ccm_reg = 0x44a0,
++		.uart_base = 0x30890000,
++	}, {	/* UART 3 */
++		.ccm_reg = 0x44b0,
++		.uart_base = 0x30880000,
++	}, {	/* UART 4 */
++		.ccm_reg = 0x44c0,
++		.uart_base = 0x30a60000,
++	}
++};
++
++unsigned int imx8m_uart_get_base(void)
++{
++	unsigned int i;
++
++	for (i = 0; i < ARRAY_SIZE(imx8m_uart_info); i++) {
++		uint32_t val;
++
++		/*
++		 * At least check that the clock-gate is ungated before we
++		 * access the UART register.
++		 */
++		val = mmio_read_32(IMX_CCM_BASE + imx8m_uart_info[i].ccm_reg);
++		if (DOMAIN0_RUNNING(val)) {
++			val = mmio_read_32(imx8m_uart_info[i].uart_base + UCR1);
++			if (val & UCR1_UARTEN) {
++				return imx8m_uart_info[i].uart_base;
++			}
++		}
++	}
++
++	/*
++	 * We should return an error and inform the user but we can't do it
++	 * this early.
++	 */
++	return 0;
++}
+diff --git a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
+index 67bfd3651dfe..8e6636147438 100644
+--- a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
++++ b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
+@@ -27,6 +27,7 @@
+ #include <imx_uart.h>
+ #include <imx_rdc.h>
+ #include <imx8m_caam.h>
++#include <imx8m_ccm.h>
+ #include <imx8m_csu.h>
+ #include <plat_imx8.h>
+ 
+@@ -130,6 +131,7 @@ void bl31_tzc380_setup(void)
+ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 		u_register_t arg2, u_register_t arg3)
+ {
++	unsigned int console_base = 0U;
+ 	static console_t console;
+ 	int i;
+ 
+@@ -144,7 +146,14 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 
+ 	imx_csu_init(csu_cfg);
+ 
+-	console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
++#if IMX_BOOT_UART_BASE
++	console_base = IMX_BOOT_UART_BASE;
++#endif
++	if (console_base == 0U) {
++		console_base = imx8m_uart_get_base();
++	}
++
++	console_imx_uart_register(console_base, IMX_BOOT_UART_CLK_IN_HZ,
+ 		IMX_CONSOLE_BAUDRATE, &console);
+ 	/* This console is only used for boot stage */
+ 	console_set_scope(&console, CONSOLE_FLAG_BOOT);
+diff --git a/plat/imx/imx8m/imx8mm/platform.mk b/plat/imx/imx8m/imx8mm/platform.mk
+index 7a42554f5739..22791fda4c2c 100644
+--- a/plat/imx/imx8m/imx8mm/platform.mk
++++ b/plat/imx/imx8m/imx8mm/platform.mk
+@@ -37,6 +37,7 @@ BL31_SOURCES		+=	plat/imx/common/imx8_helpers.S			\
+ 				plat/imx/imx8m/imx_rdc.c			\
+ 				plat/imx/imx8m/imx8m_csu.c			\
+ 				plat/imx/imx8m/imx8m_caam.c			\
++				plat/imx/imx8m/imx8m_ccm.c			\
+ 				plat/imx/imx8m/imx8m_psci_common.c		\
+ 				plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c	\
+ 				plat/imx/imx8m/imx8mm/imx8mm_psci.c		\
+diff --git a/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c b/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c
+index eff198dd741c..aeb1cbf2945f 100644
+--- a/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c
++++ b/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c
+@@ -25,6 +25,7 @@
+ #include <imx_uart.h>
+ #include <imx_rdc.h>
+ #include <imx8m_caam.h>
++#include <imx8m_ccm.h>
+ #include <imx8m_csu.h>
+ #include <platform_def.h>
+ #include <plat_imx8.h>
+@@ -121,6 +122,7 @@ static void bl31_tzc380_setup(void)
+ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 		u_register_t arg2, u_register_t arg3)
+ {
++	unsigned int console_base = 0U;
+ 	static console_t console;
+ 	unsigned int val;
+ 	int i;
+@@ -141,7 +143,14 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 	val = mmio_read_32(IMX_IOMUX_GPR_BASE + 0x2c);
+ 	mmio_write_32(IMX_IOMUX_GPR_BASE + 0x2c, val | 0x3DFF0000);
+ 
+-	console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
++#if IMX_BOOT_UART_BASE
++	console_base = IMX_BOOT_UART_BASE;
++#endif
++	if (console_base == 0U) {
++		console_base = imx8m_uart_get_base();
++	}
++
++	console_imx_uart_register(console_base, IMX_BOOT_UART_CLK_IN_HZ,
+ 		IMX_CONSOLE_BAUDRATE, &console);
+ 	/* This console is only used for boot stage */
+ 	console_set_scope(&console, CONSOLE_FLAG_BOOT);
+diff --git a/plat/imx/imx8m/imx8mn/platform.mk b/plat/imx/imx8m/imx8mn/platform.mk
+index 1c0ad4f3bc23..46516104f16d 100644
+--- a/plat/imx/imx8m/imx8mn/platform.mk
++++ b/plat/imx/imx8m/imx8mn/platform.mk
+@@ -31,6 +31,7 @@ BL31_SOURCES		+=	plat/imx/common/imx8_helpers.S			\
+ 				plat/imx/imx8m/imx_aipstz.c			\
+ 				plat/imx/imx8m/imx_rdc.c			\
+ 				plat/imx/imx8m/imx8m_caam.c			\
++				plat/imx/imx8m/imx8m_ccm.c			\
+ 				plat/imx/imx8m/imx8m_csu.c			\
+ 				plat/imx/imx8m/imx8m_psci_common.c		\
+ 				plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c	\
+diff --git a/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c b/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
+index 4c31fa28dab7..e25668b879b3 100644
+--- a/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
++++ b/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
+@@ -25,6 +25,7 @@
+ #include <imx_uart.h>
+ #include <imx_rdc.h>
+ #include <imx8m_caam.h>
++#include <imx8m_ccm.h>
+ #include <imx8m_csu.h>
+ #include <platform_def.h>
+ #include <plat_imx8.h>
+@@ -117,6 +118,7 @@ static void bl31_tzc380_setup(void)
+ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 		u_register_t arg2, u_register_t arg3)
+ {
++	unsigned int console_base = 0U;
+ 	static console_t console;
+ 	unsigned int val;
+ 	unsigned int i;
+@@ -137,7 +139,14 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 	val = mmio_read_32(IMX_IOMUX_GPR_BASE + 0x2c);
+ 	mmio_write_32(IMX_IOMUX_GPR_BASE + 0x2c, val | 0x3DFF0000);
+ 
+-	console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
++#if IMX_BOOT_UART_BASE
++	console_base = IMX_BOOT_UART_BASE;
++#endif
++	if (console_base == 0U) {
++		console_base = imx8m_uart_get_base();
++	}
++
++	console_imx_uart_register(console_base, IMX_BOOT_UART_CLK_IN_HZ,
+ 		IMX_CONSOLE_BAUDRATE, &console);
+ 	/* This console is only used for boot stage */
+ 	console_set_scope(&console, CONSOLE_FLAG_BOOT);
+diff --git a/plat/imx/imx8m/imx8mp/platform.mk b/plat/imx/imx8m/imx8mp/platform.mk
+index 5414c0a5732d..cdb504de0f3d 100644
+--- a/plat/imx/imx8m/imx8mp/platform.mk
++++ b/plat/imx/imx8m/imx8mp/platform.mk
+@@ -32,6 +32,7 @@ BL31_SOURCES		+=	plat/imx/common/imx8_helpers.S			\
+ 				plat/imx/imx8m/imx_aipstz.c			\
+ 				plat/imx/imx8m/imx_rdc.c			\
+ 				plat/imx/imx8m/imx8m_caam.c			\
++				plat/imx/imx8m/imx8m_ccm.c			\
+ 				plat/imx/imx8m/imx8m_csu.c			\
+ 				plat/imx/imx8m/imx8m_psci_common.c		\
+ 				plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c	\
+diff --git a/plat/imx/imx8m/include/imx8m_ccm.h b/plat/imx/imx8m/include/imx8m_ccm.h
+new file mode 100644
+index 000000000000..acbd135cb314
+--- /dev/null
++++ b/plat/imx/imx8m/include/imx8m_ccm.h
+@@ -0,0 +1,12 @@
++/*
++ * Copyright (c) 2023, Pengutronix. All rights reserved.
++ *
++ * SPDX-License-Identifier: BSD-3-Clause
++ */
++
++#ifndef IMX8M_CCM_H
++#define IMX8M_CCM_H
++
++unsigned int imx8m_uart_get_base(void);
++
++#endif /* IMX8M_CCM_H */
diff --git a/patches/tf-a-v2.8/0202-fix-imx8m-make-IMX_BOOT_UART_BASE-autodetection-opti.patch b/patches/tf-a-v2.8/0202-fix-imx8m-make-IMX_BOOT_UART_BASE-autodetection-opti.patch
new file mode 100644
index 0000000..88d9921
--- /dev/null
+++ b/patches/tf-a-v2.8/0202-fix-imx8m-make-IMX_BOOT_UART_BASE-autodetection-opti.patch
@@ -0,0 +1,133 @@
+From: Marco Felsch <m.felsch@pengutronix.de>
+Date: Wed, 2 Aug 2023 08:11:35 +0200
+Subject: [PATCH] fix(imx8m): make IMX_BOOT_UART_BASE autodetection option more
+ obvious
+
+Switch from IMX_BOOT_UART_BASE=0 to IMX_BOOT_UART_BASE=auto to make it
+more obvious that the detection is based on the runtime autodetection.
+
+In addition this moves the evaluation of IMX_BOOT_UART_BASE into the
+makefile which removes the ugly conditional compilation as well.
+
+Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
+Change-Id: I92c13607bf81c6267f4b6aee829d74902b7f72d2
+---
+ plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c | 5 +----
+ plat/imx/imx8m/imx8mm/platform.mk         | 3 +++
+ plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c | 5 +----
+ plat/imx/imx8m/imx8mn/platform.mk         | 3 +++
+ plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c | 5 +----
+ plat/imx/imx8m/imx8mp/platform.mk         | 3 +++
+ 6 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
+index 8e6636147438..c8a3adf8f333 100644
+--- a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
++++ b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
+@@ -131,7 +131,7 @@ void bl31_tzc380_setup(void)
+ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 		u_register_t arg2, u_register_t arg3)
+ {
+-	unsigned int console_base = 0U;
++	unsigned int console_base = IMX_BOOT_UART_BASE;
+ 	static console_t console;
+ 	int i;
+ 
+@@ -146,9 +146,6 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 
+ 	imx_csu_init(csu_cfg);
+ 
+-#if IMX_BOOT_UART_BASE
+-	console_base = IMX_BOOT_UART_BASE;
+-#endif
+ 	if (console_base == 0U) {
+ 		console_base = imx8m_uart_get_base();
+ 	}
+diff --git a/plat/imx/imx8m/imx8mm/platform.mk b/plat/imx/imx8m/imx8mm/platform.mk
+index 22791fda4c2c..1b4a1f2f37c7 100644
+--- a/plat/imx/imx8m/imx8mm/platform.mk
++++ b/plat/imx/imx8m/imx8mm/platform.mk
+@@ -159,6 +159,9 @@ BL32_SIZE		?=	0x2000000
+ $(eval $(call add_define,BL32_SIZE))
+ 
+ IMX_BOOT_UART_BASE	?=	0x30890000
++ifeq (${IMX_BOOT_UART_BASE},auto)
++    override IMX_BOOT_UART_BASE	:=	0
++endif
+ $(eval $(call add_define,IMX_BOOT_UART_BASE))
+ 
+ EL3_EXCEPTION_HANDLING := $(SDEI_SUPPORT)
+diff --git a/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c b/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c
+index aeb1cbf2945f..147249ee5e56 100644
+--- a/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c
++++ b/plat/imx/imx8m/imx8mn/imx8mn_bl31_setup.c
+@@ -122,7 +122,7 @@ static void bl31_tzc380_setup(void)
+ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 		u_register_t arg2, u_register_t arg3)
+ {
+-	unsigned int console_base = 0U;
++	unsigned int console_base = IMX_BOOT_UART_BASE;
+ 	static console_t console;
+ 	unsigned int val;
+ 	int i;
+@@ -143,9 +143,6 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 	val = mmio_read_32(IMX_IOMUX_GPR_BASE + 0x2c);
+ 	mmio_write_32(IMX_IOMUX_GPR_BASE + 0x2c, val | 0x3DFF0000);
+ 
+-#if IMX_BOOT_UART_BASE
+-	console_base = IMX_BOOT_UART_BASE;
+-#endif
+ 	if (console_base == 0U) {
+ 		console_base = imx8m_uart_get_base();
+ 	}
+diff --git a/plat/imx/imx8m/imx8mn/platform.mk b/plat/imx/imx8m/imx8mn/platform.mk
+index 46516104f16d..a6b43f213506 100644
+--- a/plat/imx/imx8m/imx8mn/platform.mk
++++ b/plat/imx/imx8m/imx8mn/platform.mk
+@@ -65,6 +65,9 @@ BL32_SIZE		?=	0x2000000
+ $(eval $(call add_define,BL32_SIZE))
+ 
+ IMX_BOOT_UART_BASE	?=	0x30890000
++ifeq (${IMX_BOOT_UART_BASE},auto)
++    override IMX_BOOT_UART_BASE	:=	0
++endif
+ $(eval $(call add_define,IMX_BOOT_UART_BASE))
+ 
+ EL3_EXCEPTION_HANDLING := $(SDEI_SUPPORT)
+diff --git a/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c b/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
+index e25668b879b3..b0a41c741c17 100644
+--- a/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
++++ b/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
+@@ -118,7 +118,7 @@ static void bl31_tzc380_setup(void)
+ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 		u_register_t arg2, u_register_t arg3)
+ {
+-	unsigned int console_base = 0U;
++	unsigned int console_base = IMX_BOOT_UART_BASE;
+ 	static console_t console;
+ 	unsigned int val;
+ 	unsigned int i;
+@@ -139,9 +139,6 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
+ 	val = mmio_read_32(IMX_IOMUX_GPR_BASE + 0x2c);
+ 	mmio_write_32(IMX_IOMUX_GPR_BASE + 0x2c, val | 0x3DFF0000);
+ 
+-#if IMX_BOOT_UART_BASE
+-	console_base = IMX_BOOT_UART_BASE;
+-#endif
+ 	if (console_base == 0U) {
+ 		console_base = imx8m_uart_get_base();
+ 	}
+diff --git a/plat/imx/imx8m/imx8mp/platform.mk b/plat/imx/imx8m/imx8mp/platform.mk
+index cdb504de0f3d..0169144f4a1a 100644
+--- a/plat/imx/imx8m/imx8mp/platform.mk
++++ b/plat/imx/imx8m/imx8mp/platform.mk
+@@ -156,6 +156,9 @@ BL32_SIZE		?=	0x2000000
+ $(eval $(call add_define,BL32_SIZE))
+ 
+ IMX_BOOT_UART_BASE	?=	0x30890000
++ifeq (${IMX_BOOT_UART_BASE},auto)
++    override IMX_BOOT_UART_BASE	:=	0
++endif
+ $(eval $(call add_define,IMX_BOOT_UART_BASE))
+ 
+ EL3_EXCEPTION_HANDLING := $(SDEI_SUPPORT)
diff --git a/patches/tf-a-v2.8/0201-Release-2.8-customers-pengutronix-distrokit-20230210.patch b/patches/tf-a-v2.8/0301-Release-2.8-customers-pengutronix-distrokit-20240111.patch
similarity index 76%
rename from patches/tf-a-v2.8/0201-Release-2.8-customers-pengutronix-distrokit-20230210.patch
rename to patches/tf-a-v2.8/0301-Release-2.8-customers-pengutronix-distrokit-20240111.patch
index f230656..d8e0796 100644
--- a/patches/tf-a-v2.8/0201-Release-2.8-customers-pengutronix-distrokit-20230210.patch
+++ b/patches/tf-a-v2.8/0301-Release-2.8-customers-pengutronix-distrokit-20240111.patch
@@ -1,13 +1,13 @@
-From: Marco Felsch <m.felsch@pengutronix.de>
-Date: Fri, 10 Feb 2023 12:51:49 +0100
-Subject: [PATCH] Release 2.8/customers/pengutronix/distrokit/20230210-1
+From: =?UTF-8?q?Leonard=20G=C3=B6hrs?= <l.goehrs@pengutronix.de>
+Date: Thu, 11 Jan 2024 07:41:25 +0100
+Subject: [PATCH] Release 2.8/customers/pengutronix/distrokit/20240111-1
 
 ---
  Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/Makefile b/Makefile
-index 1bfff716485a..cf80e5cac8f3 100644
+index 1bfff716485a..e796cff20e4a 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -327,7 +327,7 @@ endif
@@ -15,7 +15,7 @@ index 1bfff716485a..cf80e5cac8f3 100644
          BUILD_STRING  :=  $(shell git describe --always --dirty --tags 2> /dev/null)
  endif
 -VERSION_STRING    :=  v${VERSION}(${BUILD_TYPE}):${BUILD_STRING}
-+VERSION_STRING    :=  v${VERSION}(${BUILD_TYPE}):${BUILD_STRING}-20230210-1
++VERSION_STRING    :=  v${VERSION}(${BUILD_TYPE}):${BUILD_STRING}-20240111-1
  
  ifeq (${AARCH32_INSTRUCTION_SET},A32)
  TF_CFLAGS_aarch32	+=	-marm
diff --git a/patches/tf-a-v2.8/series b/patches/tf-a-v2.8/series
index a29319d..ba47166 100644
--- a/patches/tf-a-v2.8/series
+++ b/patches/tf-a-v2.8/series
@@ -1,6 +1,6 @@
 # umpf-base: v2.8
 # umpf-name: 2.8/customers/pengutronix/distrokit
-# umpf-version: 2.8/customers/pengutronix/distrokit/20230210-1
+# umpf-version: 2.8/customers/pengutronix/distrokit/20240111-1
 # umpf-topic: v2.8/topic/fix-build-warnings
 # umpf-hashinfo: 4730b4b80206cf2fc27787f43cefd3169a6f8a2f
 # umpf-topic-range: 9881bb93a3bc0a3ea37e9f093e09ab4b360a9e48..da1b5e74dc7c2b3e7a2d9a1adb7e23beeba079e3
@@ -16,7 +16,12 @@
 0105-refactor-imx8mq-introduce-BL31_SIZE.patch
 0106-feat-imx8mq-add-BL31-PIE-support.patch
 0107-feat-imx8mq-add-support-for-gcc-12.x.patch
-# umpf-release: 2.8/customers/pengutronix/distrokit/20230210-1
-# umpf-topic-range: be7bcbebf5b22958e8b88564ca0865b4591263e7..827865ee983d0c7cd4bb99d85d46f972386e5ea9
-0201-Release-2.8-customers-pengutronix-distrokit-20230210.patch
+# umpf-topic: v2.8/topic/uart-runtime-detection
+# umpf-hashinfo: 6779c0c04fddf637567b2a3a2fef3dbea7b192b5
+# umpf-topic-range: be7bcbebf5b22958e8b88564ca0865b4591263e7..844a61329bf4e262a18da834cf38d7ae483b6923
+0201-feat-imx8m-detect-console-base-address-during-runtim.patch
+0202-fix-imx8m-make-IMX_BOOT_UART_BASE-autodetection-opti.patch
+# umpf-release: 2.8/customers/pengutronix/distrokit/20240111-1
+# umpf-topic-range: 844a61329bf4e262a18da834cf38d7ae483b6923..fdbd2dd6296701b615fc6cc70a90eae4242c6ad8
+0301-Release-2.8-customers-pengutronix-distrokit-20240111.patch
 # umpf-end

base-commit: 593eec995f082b6ca7caab0e9da4ce95f0c78477
-- 
2.39.2




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [DistroKit] [PATCH v1 2/5] v8a: images: imx8m: add barebox state partition
  2024-01-11 15:01 [DistroKit] [PATCH v1 0/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board Leonard Göhrs
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 1/5] tf-a: add patch to auto-detect the correct UART on i.MX8M Leonard Göhrs
@ 2024-01-11 15:01 ` Leonard Göhrs
  2024-01-11 17:07   ` Jan Lübbe
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 3/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board Leonard Göhrs
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Leonard Göhrs @ 2024-01-11 15:01 UTC (permalink / raw)
  To: distrokit; +Cc: Leonard Göhrs

Having a place to store state allows us to use RAUC on i.MX8M based boards.

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
---
 configs/platform-v8a/config/images/imx8m.config | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/configs/platform-v8a/config/images/imx8m.config b/configs/platform-v8a/config/images/imx8m.config
index 59cdac1..fcb3c07 100644
--- a/configs/platform-v8a/config/images/imx8m.config
+++ b/configs/platform-v8a/config/images/imx8m.config
@@ -9,8 +9,13 @@ image @IMAGE@ {
                in-partition-table = false
                holes = {"(440; 32K)"}
        }
-       partition root-A {
+       partition barebox-state {
                offset = 2M
+               size = 1M
+               partition-type-uuid = 4778ed65-bf42-45fa-9c5b-287a1dc4aab1 # barebox-state
+               image = /dev/null
+       }
+       partition root-A {
                image = "root.ext2"
                partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
        }
-- 
2.39.2




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [DistroKit] [PATCH v1 3/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board
  2024-01-11 15:01 [DistroKit] [PATCH v1 0/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board Leonard Göhrs
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 1/5] tf-a: add patch to auto-detect the correct UART on i.MX8M Leonard Göhrs
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 2/5] v8a: images: imx8m: add barebox state partition Leonard Göhrs
@ 2024-01-11 15:01 ` Leonard Göhrs
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 4/5] v8a: imx8m: enable image generation for TQ MBa8MPxL Leonard Göhrs
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 5/5] v8a: imx8m: enable barebox state " Leonard Göhrs
  4 siblings, 0 replies; 12+ messages in thread
From: Leonard Göhrs @ 2024-01-11 15:01 UTC (permalink / raw)
  To: distrokit; +Cc: Leonard Göhrs

The generated image can be used to boot the board via SD card.

The dev.mmc1.broken_cd barebox environment entry is required because
the board's card detect does not reliably detect an inserted USB-SD-Mux,
resulting in the board failing to boot.
This should not (negatively) affect the other v8a machines.

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
---
 .../nv/dev.mmc1.broken_cd                     |  1 +
 configs/platform-v8a/barebox.config           |  4 +--
 configs/platform-v8a/kernelconfig             |  2 +-
 .../platforms/image-tq-mba8mpxl.in            | 10 ++++++
 .../platform-v8a/rules/image-tq-mba8mpxl.make | 36 +++++++++++++++++++
 5 files changed, 50 insertions(+), 3 deletions(-)
 create mode 100644 configs/platform-v8a/barebox-common-defaultenv/nv/dev.mmc1.broken_cd
 create mode 100644 configs/platform-v8a/platforms/image-tq-mba8mpxl.in
 create mode 100644 configs/platform-v8a/rules/image-tq-mba8mpxl.make

diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/dev.mmc1.broken_cd b/configs/platform-v8a/barebox-common-defaultenv/nv/dev.mmc1.broken_cd
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/configs/platform-v8a/barebox-common-defaultenv/nv/dev.mmc1.broken_cd
@@ -0,0 +1 @@
+1
diff --git a/configs/platform-v8a/barebox.config b/configs/platform-v8a/barebox.config
index 02d314f..fc4f643 100644
--- a/configs/platform-v8a/barebox.config
+++ b/configs/platform-v8a/barebox.config
@@ -60,7 +60,7 @@ CONFIG_MACH_PHYTEC_SOM_IMX8MQ=y
 # CONFIG_MACH_POLYHEX_DEBIX is not set
 # CONFIG_MACH_PROTONIC_IMX8M is not set
 # CONFIG_MACH_SKOV_IMX8MP is not set
-# CONFIG_MACH_TQ_MBA8MPXL is not set
+CONFIG_MACH_TQ_MBA8MPXL=y
 # CONFIG_MACH_VARISCITE_DT8MCUSTOMBOARD_IMX8MP is not set
 # CONFIG_MACH_ZII_IMX8MQ_DEV is not set
 
@@ -762,7 +762,7 @@ CONFIG_MFD_SYSCON=y
 # CONFIG_MFD_TWL6030 is not set
 # CONFIG_RAVE_SP_CORE is not set
 # CONFIG_MFD_STPMIC1 is not set
-# CONFIG_MFD_PCA9450 is not set
+CONFIG_MFD_PCA9450=y
 # CONFIG_MFD_RN568PMIC is not set
 # CONFIG_MFD_ATMEL_FLEXCOM is not set
 CONFIG_MFD_RK808=y
diff --git a/configs/platform-v8a/kernelconfig b/configs/platform-v8a/kernelconfig
index a37fd1e..079c6ac 100644
--- a/configs/platform-v8a/kernelconfig
+++ b/configs/platform-v8a/kernelconfig
@@ -2381,7 +2381,7 @@ CONFIG_SMSC_PHY=m
 # CONFIG_DP83822_PHY is not set
 # CONFIG_DP83TC811_PHY is not set
 # CONFIG_DP83848_PHY is not set
-# CONFIG_DP83867_PHY is not set
+CONFIG_DP83867_PHY=y
 # CONFIG_DP83869_PHY is not set
 # CONFIG_DP83TD510_PHY is not set
 CONFIG_VITESSE_PHY=y
diff --git a/configs/platform-v8a/platforms/image-tq-mba8mpxl.in b/configs/platform-v8a/platforms/image-tq-mba8mpxl.in
new file mode 100644
index 0000000..956063a
--- /dev/null
+++ b/configs/platform-v8a/platforms/image-tq-mba8mpxl.in
@@ -0,0 +1,10 @@
+## SECTION=image
+
+config IMAGE_TQ_MBA8MPXL
+	tristate
+	select HOST_GENIMAGE
+	select IMAGE_ROOT_EXT
+	select BAREBOX
+	prompt "Generate images/tq-mba8mpxl.img"
+	help
+	  Generate a bootable SD card image to deploy on a TQ MBa8MPxL board.
diff --git a/configs/platform-v8a/rules/image-tq-mba8mpxl.make b/configs/platform-v8a/rules/image-tq-mba8mpxl.make
new file mode 100644
index 0000000..65c50cc
--- /dev/null
+++ b/configs/platform-v8a/rules/image-tq-mba8mpxl.make
@@ -0,0 +1,36 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2020 by Sascha Hauer <s.hauer@pengutronix.de>
+# Copyright (C) 2024 by Leonard Göhrs <l.goehrs@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+IMAGE_PACKAGES-$(PTXCONF_IMAGE_TQ_MBA8MPXL) += image-tq-mba8mpxl
+
+#
+# Paths and names
+#
+IMAGE_TQ_MBA8MPXL		:= image-tq-mba8mpxl
+IMAGE_TQ_MBA8MPXL_DIR	:= $(BUILDDIR)/$(IMAGE_TQ_MBA8MPXL)
+IMAGE_TQ_MBA8MPXL_IMAGE	:= $(IMAGEDIR)/tq-mba8mpxl.img
+IMAGE_TQ_MBA8MPXL_FILES	:= $(IMAGEDIR)/root.tgz
+IMAGE_TQ_MBA8MPXL_CONFIG	:= imx8m.config
+
+# ----------------------------------------------------------------------------
+# Image
+# ----------------------------------------------------------------------------
+
+IMAGE_TQ_MBA8MPXL_ENV := \
+        BAREBOX_IMAGE=barebox-tqma8mpxl.img
+
+$(IMAGE_TQ_MBA8MPXL_IMAGE):
+	@$(call targetinfo)
+	@$(call image/genimage, IMAGE_TQ_MBA8MPXL)
+	@$(call finish)
+
+# vim: syntax=make
-- 
2.39.2




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [DistroKit] [PATCH v1 4/5] v8a: imx8m: enable image generation for TQ MBa8MPxL
  2024-01-11 15:01 [DistroKit] [PATCH v1 0/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board Leonard Göhrs
                   ` (2 preceding siblings ...)
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 3/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board Leonard Göhrs
@ 2024-01-11 15:01 ` Leonard Göhrs
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 5/5] v8a: imx8m: enable barebox state " Leonard Göhrs
  4 siblings, 0 replies; 12+ messages in thread
From: Leonard Göhrs @ 2024-01-11 15:01 UTC (permalink / raw)
  To: distrokit; +Cc: Leonard Göhrs

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
---
 configs/platform-v8a/platformconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
index 6925dac..6f713e3 100644
--- a/configs/platform-v8a/platformconfig
+++ b/configs/platform-v8a/platformconfig
@@ -135,7 +135,7 @@ PTXCONF_KERNEL_IMAGE_RAW=y
 PTXCONF_KERNEL_IMAGE="Image"
 PTXCONF_KERNEL_DTB=y
 PTXCONF_KERNEL_DTS_PATH="${PTXDIST_PLATFORMCONFIG_SUBDIR}/dts:${KERNEL_DIR}/arch/${GENERIC_KERNEL_ARCH}/boot/dts"
-PTXCONF_KERNEL_DTS="armada-3720-community.dts freescale/imx8mm-evk.dts freescale/imx8mn-ddr4-evk.dts freescale/imx8mn-ddr4-evk.dts freescale/imx8mp-evk.dts freescale/imx8mq-evk.dts rockchip/rk3568-rock-3a.dts"
+PTXCONF_KERNEL_DTS="armada-3720-community.dts freescale/imx8mm-evk.dts freescale/imx8mn-ddr4-evk.dts freescale/imx8mn-ddr4-evk.dts freescale/imx8mp-evk.dts freescale/imx8mq-evk.dts rockchip/rk3568-rock-3a.dts freescale/imx8mp-tqma8mpql-mba8mpxl.dts"
 # PTXCONF_KERNEL_DTBO is not set
 # PTXCONF_KERNEL_CODE_SIGNING is not set
 # PTXCONF_KERNEL_ZSTD is not set
@@ -289,6 +289,7 @@ PTXCONF_IMAGE_ROOT_TGZ=y
 PTXCONF_IMAGE_ROOT_TGZ_LABEL=""
 # PTXCONF_IMAGE_ROOT_UBI is not set
 # PTXCONF_IMAGE_ROOT_UBIFS is not set
+PTXCONF_IMAGE_TQ_MBA8MPXL=y
 
 #
 # ipkg options                  
-- 
2.39.2




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [DistroKit] [PATCH v1 5/5] v8a: imx8m: enable barebox state for TQ MBa8MPxL
  2024-01-11 15:01 [DistroKit] [PATCH v1 0/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board Leonard Göhrs
                   ` (3 preceding siblings ...)
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 4/5] v8a: imx8m: enable image generation for TQ MBa8MPxL Leonard Göhrs
@ 2024-01-11 15:01 ` Leonard Göhrs
  2024-01-11 18:08   ` Ahmad Fatoum
  4 siblings, 1 reply; 12+ messages in thread
From: Leonard Göhrs @ 2024-01-11 15:01 UTC (permalink / raw)
  To: distrokit; +Cc: Leonard Göhrs

This allows updating the root filesystem via RAUC.

The magic value was selected by fair dice roll.

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
---
 .../barebox-common-defaultenv/init/bootsource |  2 +-
 configs/platform-v8a/dts/bootstate.dtsi       | 21 +++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/configs/platform-v8a/barebox-common-defaultenv/init/bootsource b/configs/platform-v8a/barebox-common-defaultenv/init/bootsource
index af47c82..b621fb2 100644
--- a/configs/platform-v8a/barebox-common-defaultenv/init/bootsource
+++ b/configs/platform-v8a/barebox-common-defaultenv/init/bootsource
@@ -10,7 +10,7 @@ if [ "$bootsource" = mmc ]; then
 	global.boot.default="mmc$bootsource_instance net"
 fi
 
-if of_compatible -k radxa,rock3a; then
+if of_compatible -k radxa,rock3a || of_compatible -k tq,imx8mp-tqma8mpql-mba8mpxl; then
 	global.boot.default="bootchooser net"
 	global bootchooser.state_prefix="state.bootstate"
 	global bootchooser.targets="system0 system1"
diff --git a/configs/platform-v8a/dts/bootstate.dtsi b/configs/platform-v8a/dts/bootstate.dtsi
index d5dee2c..1a8fe3f 100644
--- a/configs/platform-v8a/dts/bootstate.dtsi
+++ b/configs/platform-v8a/dts/bootstate.dtsi
@@ -19,6 +19,27 @@
 
 #endif
 
+/** TQ-Systems i.MX8MPlus TQMa8MPxL on MBa8MPxL *******************************/
+#ifdef imx8mp_tqma8mpql_mba8mpxl_dts
+/ {
+	aliases {
+		state = &state_sd;
+	};
+
+	state_sd: state {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "barebox,state";
+		magic = <0x5e4d20bf>;
+		backend = <&usdhc2>;   // via GPT Type UUID
+		backend-type = "raw";
+		backend-storage-type = "direct";
+		backend-stridesize = <0x40>;
+	};
+};
+
+#endif
+
 /** Generic bootstate node for all platforms **********************************/
 / {
 	state: state {
-- 
2.39.2




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [DistroKit] [PATCH v1 2/5] v8a: images: imx8m: add barebox state partition
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 2/5] v8a: images: imx8m: add barebox state partition Leonard Göhrs
@ 2024-01-11 17:07   ` Jan Lübbe
  2024-01-11 18:06     ` Ahmad Fatoum
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Lübbe @ 2024-01-11 17:07 UTC (permalink / raw)
  To: Leonard Göhrs, distrokit

On Thu, 2024-01-11 at 16:01 +0100, Leonard Göhrs wrote:
> Having a place to store state allows us to use RAUC on i.MX8M based boards.
> 
> Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
> ---
>  configs/platform-v8a/config/images/imx8m.config | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/configs/platform-v8a/config/images/imx8m.config b/configs/platform-v8a/config/images/imx8m.config
> index 59cdac1..fcb3c07 100644
> --- a/configs/platform-v8a/config/images/imx8m.config
> +++ b/configs/platform-v8a/config/images/imx8m.config
> @@ -9,8 +9,13 @@ image @IMAGE@ {
>                 in-partition-table = false
>                 holes = {"(440; 32K)"}
>         }
> -       partition root-A {
> +       partition barebox-state {
>                 offset = 2M
> +               size = 1M

There's no need to use 1MB for the state partition, a few sectors should be
enough (i.e. 32KB).

> +               partition-type-uuid = 4778ed65-bf42-45fa-9c5b-287a1dc4aab1 # barebox-state
> +               image = /dev/null
> +       }
> +       partition root-A {

Keep the root-A partition @ 2M and add a small state partition before the
rootfs.

>                 image = "root.ext2"
>                 partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
>         }

Similar to the rock3a.config, we should have a barebox env partition as well.

Jan
-- 
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] 12+ messages in thread

* Re: [DistroKit] [PATCH v1 1/5] tf-a: add patch to auto-detect the correct UART on i.MX8M
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 1/5] tf-a: add patch to auto-detect the correct UART on i.MX8M Leonard Göhrs
@ 2024-01-11 18:03   ` Ahmad Fatoum
  2024-01-16 10:50     ` Leonard Göhrs
  0 siblings, 1 reply; 12+ messages in thread
From: Ahmad Fatoum @ 2024-01-11 18:03 UTC (permalink / raw)
  To: Leonard Göhrs, distrokit

Hello Leonard,

On 11.01.24 16:01, Leonard Göhrs wrote:
> diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
> index b71b361..6925dac 100644
> --- a/configs/platform-v8a/platformconfig
> +++ b/configs/platform-v8a/platformconfig
> @@ -216,7 +216,7 @@ PTXCONF_TF_A_ARM_ARCH_MAJOR_8=y
>  PTXCONF_TF_A_ARM_ARCH_MAJOR=8
>  PTXCONF_TF_A_PLATFORMS="imx8mq imx8mm imx8mn imx8mp"
>  PTXCONF_TF_A_ARM_ARCH_MINOR=0
> -PTXCONF_TF_A_EXTRA_ARGS=""
> +PTXCONF_TF_A_EXTRA_ARGS="IMX_BOOT_UART_BASE=0"

Patches below add auto as alias for 0. I think that would be better as to be
more descriptive.

> +diff --git a/plat/imx/imx8m/imx8mm/platform.mk b/plat/imx/imx8m/imx8mm/platform.mk
> +index 22791fda4c2c..1b4a1f2f37c7 100644
> +--- a/plat/imx/imx8m/imx8mm/platform.mk
> ++++ b/plat/imx/imx8m/imx8mm/platform.mk
> +@@ -159,6 +159,9 @@ BL32_SIZE		?=	0x2000000
> + $(eval $(call add_define,BL32_SIZE))
> + 
> + IMX_BOOT_UART_BASE	?=	0x30890000
> ++ifeq (${IMX_BOOT_UART_BASE},auto)
> ++    override IMX_BOOT_UART_BASE	:=	0
> ++endif

Here ^.

Cheers,
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] 12+ messages in thread

* Re: [DistroKit] [PATCH v1 2/5] v8a: images: imx8m: add barebox state partition
  2024-01-11 17:07   ` Jan Lübbe
@ 2024-01-11 18:06     ` Ahmad Fatoum
  0 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2024-01-11 18:06 UTC (permalink / raw)
  To: Jan Lübbe, Leonard Göhrs, distrokit; +Cc: Michael Tretter

On 11.01.24 18:07, Jan Lübbe wrote:
> On Thu, 2024-01-11 at 16:01 +0100, Leonard Göhrs wrote:
>> Having a place to store state allows us to use RAUC on i.MX8M based boards.
>>
>> Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
>> ---
>>  configs/platform-v8a/config/images/imx8m.config | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/configs/platform-v8a/config/images/imx8m.config b/configs/platform-v8a/config/images/imx8m.config
>> index 59cdac1..fcb3c07 100644
>> --- a/configs/platform-v8a/config/images/imx8m.config
>> +++ b/configs/platform-v8a/config/images/imx8m.config
>> @@ -9,8 +9,13 @@ image @IMAGE@ {
>>                 in-partition-table = false
>>                 holes = {"(440; 32K)"}

If you are changing the partitioning, please increase the barebox
partition size too. As we are adding more boards to the same binary,
this area will get more crowded and we are already nearly at the
limit.

>>         }
>> -       partition root-A {
>> +       partition barebox-state {
>>                 offset = 2M
>> +               size = 1M
> 
> There's no need to use 1MB for the state partition, a few sectors should be
> enough (i.e. 32KB).
> 
>> +               partition-type-uuid = 4778ed65-bf42-45fa-9c5b-287a1dc4aab1 # barebox-state
>> +               image = /dev/null
>> +       }
>> +       partition root-A {
> 
> Keep the root-A partition @ 2M and add a small state partition before the
> rootfs.
> 
>>                 image = "root.ext2"
>>                 partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
>>         }
> 
> Similar to the rock3a.config, we should have a barebox env partition as well.

@Michael, as we are touching partitioning, should we increase the partition
size in the same go? What size would you suggest?

Cheers,
Ahmad

> 
> Jan

-- 
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] 12+ messages in thread

* Re: [DistroKit] [PATCH v1 5/5] v8a: imx8m: enable barebox state for TQ MBa8MPxL
  2024-01-11 15:01 ` [DistroKit] [PATCH v1 5/5] v8a: imx8m: enable barebox state " Leonard Göhrs
@ 2024-01-11 18:08   ` Ahmad Fatoum
  0 siblings, 0 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2024-01-11 18:08 UTC (permalink / raw)
  To: Leonard Göhrs, distrokit

On 11.01.24 16:01, Leonard Göhrs wrote:
> This allows updating the root filesystem via RAUC.
> 
> The magic value was selected by fair dice roll.
> 
> Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
> ---
>  .../barebox-common-defaultenv/init/bootsource |  2 +-
>  configs/platform-v8a/dts/bootstate.dtsi       | 21 +++++++++++++++++++
>  2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/configs/platform-v8a/barebox-common-defaultenv/init/bootsource b/configs/platform-v8a/barebox-common-defaultenv/init/bootsource
> index af47c82..b621fb2 100644
> --- a/configs/platform-v8a/barebox-common-defaultenv/init/bootsource
> +++ b/configs/platform-v8a/barebox-common-defaultenv/init/bootsource
> @@ -10,7 +10,7 @@ if [ "$bootsource" = mmc ]; then
>  	global.boot.default="mmc$bootsource_instance net"
>  fi
>  
> -if of_compatible -k radxa,rock3a; then
> +if of_compatible -k radxa,rock3a || of_compatible -k tq,imx8mp-tqma8mpql-mba8mpxl; then

of_compatible supports multiple arguments to match against, so you can
drop the ||.

>  	global.boot.default="bootchooser net"
>  	global bootchooser.state_prefix="state.bootstate"
>  	global bootchooser.targets="system0 system1"
> diff --git a/configs/platform-v8a/dts/bootstate.dtsi b/configs/platform-v8a/dts/bootstate.dtsi
> index d5dee2c..1a8fe3f 100644
> --- a/configs/platform-v8a/dts/bootstate.dtsi
> +++ b/configs/platform-v8a/dts/bootstate.dtsi
> @@ -19,6 +19,27 @@
>  
>  #endif
>  
> +/** TQ-Systems i.MX8MPlus TQMa8MPxL on MBa8MPxL *******************************/
> +#ifdef imx8mp_tqma8mpql_mba8mpxl_dts
> +/ {
> +	aliases {
> +		state = &state_sd;
> +	};
> +
> +	state_sd: state {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		compatible = "barebox,state";
> +		magic = <0x5e4d20bf>;
> +		backend = <&usdhc2>;   // via GPT Type UUID
> +		backend-type = "raw";
> +		backend-storage-type = "direct";
> +		backend-stridesize = <0x40>;
> +	};
> +};
> +
> +#endif
> +
>  /** Generic bootstate node for all platforms **********************************/
>  / {
>  	state: state {

-- 
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] 12+ messages in thread

* Re: [DistroKit] [PATCH v1 1/5] tf-a: add patch to auto-detect the correct UART on i.MX8M
  2024-01-11 18:03   ` Ahmad Fatoum
@ 2024-01-16 10:50     ` Leonard Göhrs
  2024-01-16 11:08       ` Marco Felsch
  0 siblings, 1 reply; 12+ messages in thread
From: Leonard Göhrs @ 2024-01-16 10:50 UTC (permalink / raw)
  To: Ahmad Fatoum, distrokit, Marco Felsch

Hi,

On 11.01.24 19:03, Ahmad Fatoum wrote:
> Hello Leonard,
> 
> On 11.01.24 16:01, Leonard Göhrs wrote:
>> diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
>> index b71b361..6925dac 100644
>> --- a/configs/platform-v8a/platformconfig
>> +++ b/configs/platform-v8a/platformconfig
>> @@ -216,7 +216,7 @@ PTXCONF_TF_A_ARM_ARCH_MAJOR_8=y
>>   PTXCONF_TF_A_ARM_ARCH_MAJOR=8
>>   PTXCONF_TF_A_PLATFORMS="imx8mq imx8mm imx8mn imx8mp"
>>   PTXCONF_TF_A_ARM_ARCH_MINOR=0
>> -PTXCONF_TF_A_EXTRA_ARGS=""
>> +PTXCONF_TF_A_EXTRA_ARGS="IMX_BOOT_UART_BASE=0"
> 
> Patches below add auto as alias for 0. I think that would be better as to be
> more descriptive.

I tried that, but it makes the build fail:


   --------------------
   target: tf-a.compile
   --------------------

   make: Entering directory '…/DistroKit/platform-v8a/build-target/tf-a-v2.8'
   Building imx8mq
     CC      lib/libc/abort.c
     …
     CC      plat/common/plat_bl_common.c
   plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c: In function 'bl31_early_platform_setup2':
   <command-line>: error: expected expression before 'auto'
   plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:136:35: note: in expansion of macro 'IMX_BOOT_UART_BASE'
     136 |         console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
         |                                   ^~~~~~~~~~~~~~~~~~
   plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:136:9: error: too few arguments to function 'console_imx_uart_register'
     136 |         console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:26:
   plat/imx/common/include/imx_uart.h:14:5: note: declared here
      14 | int console_imx_uart_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~
   make: *** [Makefile:1347: …/DistroKit/platform-v8a/build-target/tf-a-v2.8/build/imx8mq/release/bl31/imx8mq_bl31_setup.o] Error 1
   make: *** Waiting for unfinished jobs....
   make: Leaving directory '…/DistroKit/platform-v8a/build-target/tf-a-v2.8'
   make: *** [/usr/lib/x86_64-linux-gnu/ptxdist/ptxdist-2023.12.0/rules/tf-a.make:81: …/DistroKit/platform-v8a/state/tf-a.compile] Error 2


I first dismissed it as some hickup between make and the override,
but the error is actually totally valid and the version with IMX_BOOT_UART_BASE=0
instead of IMX_BOOT_UART_BASE=auto would have silently broken support for i.MX8MQ,
because the automatic UART discovery is not implemented yet for that SoC.

@Marco: do you know why auto discovery was not implemented for i.MX8MQ along
with the others?

Leonard



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [DistroKit] [PATCH v1 1/5] tf-a: add patch to auto-detect the correct UART on i.MX8M
  2024-01-16 10:50     ` Leonard Göhrs
@ 2024-01-16 11:08       ` Marco Felsch
  0 siblings, 0 replies; 12+ messages in thread
From: Marco Felsch @ 2024-01-16 11:08 UTC (permalink / raw)
  To: Leonard Göhrs; +Cc: distrokit, Ahmad Fatoum

Hi Leonard,

On 24-01-16, Leonard Göhrs wrote:
> Hi,
> 
> On 11.01.24 19:03, Ahmad Fatoum wrote:
> > Hello Leonard,
> > 
> > On 11.01.24 16:01, Leonard Göhrs wrote:
> > > diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
> > > index b71b361..6925dac 100644
> > > --- a/configs/platform-v8a/platformconfig
> > > +++ b/configs/platform-v8a/platformconfig
> > > @@ -216,7 +216,7 @@ PTXCONF_TF_A_ARM_ARCH_MAJOR_8=y
> > >   PTXCONF_TF_A_ARM_ARCH_MAJOR=8
> > >   PTXCONF_TF_A_PLATFORMS="imx8mq imx8mm imx8mn imx8mp"
> > >   PTXCONF_TF_A_ARM_ARCH_MINOR=0
> > > -PTXCONF_TF_A_EXTRA_ARGS=""
> > > +PTXCONF_TF_A_EXTRA_ARGS="IMX_BOOT_UART_BASE=0"
> > 
> > Patches below add auto as alias for 0. I think that would be better as to be
> > more descriptive.
> 
> I tried that, but it makes the build fail:
> 
> 
>   --------------------
>   target: tf-a.compile
>   --------------------
> 
>   make: Entering directory '…/DistroKit/platform-v8a/build-target/tf-a-v2.8'
>   Building imx8mq
>     CC      lib/libc/abort.c
>     …
>     CC      plat/common/plat_bl_common.c
>   plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c: In function 'bl31_early_platform_setup2':
>   <command-line>: error: expected expression before 'auto'
>   plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:136:35: note: in expansion of macro 'IMX_BOOT_UART_BASE'
>     136 |         console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
>         |                                   ^~~~~~~~~~~~~~~~~~
>   plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:136:9: error: too few arguments to function 'console_imx_uart_register'
>     136 |         console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
>         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
>   In file included from plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:26:
>   plat/imx/common/include/imx_uart.h:14:5: note: declared here
>      14 | int console_imx_uart_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
>         |     ^~~~~~~~~~~~~~~~~~~~~~~~~
>   make: *** [Makefile:1347: …/DistroKit/platform-v8a/build-target/tf-a-v2.8/build/imx8mq/release/bl31/imx8mq_bl31_setup.o] Error 1
>   make: *** Waiting for unfinished jobs....
>   make: Leaving directory '…/DistroKit/platform-v8a/build-target/tf-a-v2.8'
>   make: *** [/usr/lib/x86_64-linux-gnu/ptxdist/ptxdist-2023.12.0/rules/tf-a.make:81: …/DistroKit/platform-v8a/state/tf-a.compile] Error 2
> 
> 
> I first dismissed it as some hickup between make and the override,
> but the error is actually totally valid and the version with IMX_BOOT_UART_BASE=0
> instead of IMX_BOOT_UART_BASE=auto would have silently broken support for i.MX8MQ,
> because the automatic UART discovery is not implemented yet for that SoC.
> 
> @Marco: do you know why auto discovery was not implemented for i.MX8MQ along
> with the others?

I didn't enable it for i.MX8MQ since I couldn't test it.

Regards,
  Marco

> 
> Leonard
> 



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-01-16 11:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-11 15:01 [DistroKit] [PATCH v1 0/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board Leonard Göhrs
2024-01-11 15:01 ` [DistroKit] [PATCH v1 1/5] tf-a: add patch to auto-detect the correct UART on i.MX8M Leonard Göhrs
2024-01-11 18:03   ` Ahmad Fatoum
2024-01-16 10:50     ` Leonard Göhrs
2024-01-16 11:08       ` Marco Felsch
2024-01-11 15:01 ` [DistroKit] [PATCH v1 2/5] v8a: images: imx8m: add barebox state partition Leonard Göhrs
2024-01-11 17:07   ` Jan Lübbe
2024-01-11 18:06     ` Ahmad Fatoum
2024-01-11 15:01 ` [DistroKit] [PATCH v1 3/5] v8a: imx8m: add i.MX8MP based TQ MBa8MPxL board Leonard Göhrs
2024-01-11 15:01 ` [DistroKit] [PATCH v1 4/5] v8a: imx8m: enable image generation for TQ MBa8MPxL Leonard Göhrs
2024-01-11 15:01 ` [DistroKit] [PATCH v1 5/5] v8a: imx8m: enable barebox state " Leonard Göhrs
2024-01-11 18:08   ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox