mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] imx/esdctl: reorder some function declarations to be sorted by SoC
@ 2020-09-17 20:17 Uwe Kleine-König
  2020-09-17 20:17 ` [PATCH 2/4] imx/esdctl: Define new helper macros to reduce board entry boilerplate Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2020-09-17 20:17 UTC (permalink / raw)
  To: barebox

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/mach-imx/include/mach/esdctl.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/include/mach/esdctl.h b/arch/arm/mach-imx/include/mach/esdctl.h
index e6bbc3145a4e..8073b7f40937 100644
--- a/arch/arm/mach-imx/include/mach/esdctl.h
+++ b/arch/arm/mach-imx/include/mach/esdctl.h
@@ -137,13 +137,14 @@ void __noreturn imx35_barebox_entry(void *boarddata);
 void __noreturn imx51_barebox_entry(void *boarddata);
 void __noreturn imx53_barebox_entry(void *boarddata);
 void __noreturn imx6q_barebox_entry(void *boarddata);
+#define imx6sx_barebox_entry(boarddata) imx6ul_barebox_entry(boarddata)
 void __noreturn imx6ul_barebox_entry(void *boarddata);
-void __noreturn vf610_barebox_entry(void *boarddata);
+void __noreturn imx7d_barebox_entry(void *boarddata);
 void __noreturn imx8mm_barebox_entry(void *boarddata);
 void __noreturn imx8mp_barebox_entry(void *boarddata);
 void __noreturn imx8mq_barebox_entry(void *boarddata);
-void __noreturn imx7d_barebox_entry(void *boarddata);
-#define imx6sx_barebox_entry(boarddata) imx6ul_barebox_entry(boarddata)
+void __noreturn vf610_barebox_entry(void *boarddata);
+
 void imx_esdctl_disable(void);
 #endif
 
-- 
2.27.0


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

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

* [PATCH 2/4] imx/esdctl: Define new helper macros to reduce board entry boilerplate
  2020-09-17 20:17 [PATCH 1/4] imx/esdctl: reorder some function declarations to be sorted by SoC Uwe Kleine-König
@ 2020-09-17 20:17 ` Uwe Kleine-König
  2020-09-18 10:32   ` Sascha Hauer
  2020-09-17 20:17 ` [PATCH 3/4] arm/boards: Convert a few boards to the new entry macros Uwe Kleine-König
  2020-09-17 20:17 ` [PATCH 4/4] arm/boards: Add IMD_USED_OF for a few boards Uwe Kleine-König
  2 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2020-09-17 20:17 UTC (permalink / raw)
  To: barebox

The macro provides the extern declaration of the devicetree variable, calls
IMD_USED_OF to add metadata to the resulting barebox image and then calls
the right entry function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/mach-imx/include/mach/esdctl.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/mach-imx/include/mach/esdctl.h b/arch/arm/mach-imx/include/mach/esdctl.h
index 8073b7f40937..506dda2d5a1c 100644
--- a/arch/arm/mach-imx/include/mach/esdctl.h
+++ b/arch/arm/mach-imx/include/mach/esdctl.h
@@ -145,6 +145,27 @@ void __noreturn imx8mp_barebox_entry(void *boarddata);
 void __noreturn imx8mq_barebox_entry(void *boarddata);
 void __noreturn vf610_barebox_entry(void *boarddata);
 
+#include <image-metadata.h>
+
+#define IMX_BAREBOX__ENTRY(_fdtname, _suffix, _compressed) ({ extern char __dtb_ ## _compressed ## _fdtname ## _start[]; IMD_USED_OF(_fdtname); imx ## _suffix ## _barebox_entry(__dtb_ ## _compressed ## _fdtname ## _start + get_runtime_offset()); })
+#define IMX_BAREBOX_ENTRY(_fdtname, _suffix) IMX_BAREBOX__ENTRY(_fdtname, _suffix, )
+#define IMX_BAREBOX_ZENTRY(_fdtname, _suffix) IMX_BAREBOX__ENTRY(_fdtname, _suffix, z_)
+
+#define IMX53_BAREBOX_ENTRY(_fdtname) IMX_BAREBOX_ENTRY(_fdtname, 53)
+#define IMX53_BAREBOX_ZENTRY(_fdtname) IMX_BAREBOX_ZENTRY(_fdtname, 53)
+
+#define IMX6Q_BAREBOX_ENTRY(_fdtname) IMX_BAREBOX_ENTRY(_fdtname, 6q)
+#define IMX6Q_BAREBOX_ZENTRY(_fdtname) IMX_BAREBOX_ZENTRY(_fdtname, 6q)
+
+#define IMX6SX_BAREBOX_ENTRY(_fdtname) IMX_BAREBOX_ENTRY(_fdtname, 6sx)
+#define IMX6SX_BAREBOX_ZENTRY(_fdtname) IMX_BAREBOX_ZENTRY(_fdtname, 6sx)
+
+#define IMX6UL_BAREBOX_ENTRY(_fdtname) IMX_BAREBOX_ENTRY(_fdtname, 6ul)
+#define IMX6UL_BAREBOX_ZENTRY(_fdtname) IMX_BAREBOX_ZENTRY(_fdtname, 6ul)
+
+#define IMX7D_BAREBOX_ENTRY(_fdtname) IMX_BAREBOX_ENTRY(_fdtname, 7d)
+#define IMX7D_BAREBOX_ZENTRY(_fdtname) IMX_BAREBOX_ZENTRY(_fdtname, 7d)
+
 void imx_esdctl_disable(void);
 #endif
 
-- 
2.27.0


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

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

* [PATCH 3/4] arm/boards: Convert a few boards to the new entry macros
  2020-09-17 20:17 [PATCH 1/4] imx/esdctl: reorder some function declarations to be sorted by SoC Uwe Kleine-König
  2020-09-17 20:17 ` [PATCH 2/4] imx/esdctl: Define new helper macros to reduce board entry boilerplate Uwe Kleine-König
@ 2020-09-17 20:17 ` Uwe Kleine-König
  2020-09-17 20:17 ` [PATCH 4/4] arm/boards: Add IMD_USED_OF for a few boards Uwe Kleine-König
  2 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2020-09-17 20:17 UTC (permalink / raw)
  To: barebox

Some boards don't add get_runtime_offset() to the device tree address,
while the now used macro does it. This is ok as get_runtime_offset()
returns 0 after relocate_to_current_adr().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/boards/ac-sxb/lowlevel.c             |  4 +--
 arch/arm/boards/advantech-mx6/lowlevel.c      |  4 +--
 .../boundarydevices-nitrogen6/lowlevel.c      | 36 +++----------------
 arch/arm/boards/cm-fx6/lowlevel.c             | 14 +++-----
 arch/arm/boards/embest-marsboard/lowlevel.c   |  8 +----
 arch/arm/boards/freescale-mx53-qsb/lowlevel.c | 16 ++-------
 .../boards/freescale-mx7-sabresd/lowlevel.c   |  2 +-
 arch/arm/boards/nxp-imx6ull-evk/lowlevel.c    |  4 +--
 arch/arm/boards/udoo-neo/lowlevel.c           |  8 +----
 arch/arm/boards/zii-imx6q-rdu2/lowlevel.c     |  9 ++---
 10 files changed, 19 insertions(+), 86 deletions(-)

diff --git a/arch/arm/boards/ac-sxb/lowlevel.c b/arch/arm/boards/ac-sxb/lowlevel.c
index a910555f9bd7..c0cdf0617f7d 100644
--- a/arch/arm/boards/ac-sxb/lowlevel.c
+++ b/arch/arm/boards/ac-sxb/lowlevel.c
@@ -89,8 +89,6 @@ static inline void write_regs(const struct reginit *initvals, int count)
 		writel(initvals[i].value, initvals[i].address);
 }
 
-extern char __dtb_z_ac_sxb_start[];
-
 static inline void setup_uart(void)
 {
 	imx7_early_setup_uart_clock();
@@ -127,5 +125,5 @@ ENTRY_FUNCTION(start_ac_sxb, r0, r1, r2)
 	if (get_pc() < 0x80000000)
 		imx7d_sxb_sram_setup();
 
-	imx7d_barebox_entry(__dtb_z_ac_sxb_start + get_runtime_offset());
+	IMX7D_BAREBOX_ZENTRY(ac_sxb);
 }
diff --git a/arch/arm/boards/advantech-mx6/lowlevel.c b/arch/arm/boards/advantech-mx6/lowlevel.c
index d762f0e9a745..11cebfa27353 100644
--- a/arch/arm/boards/advantech-mx6/lowlevel.c
+++ b/arch/arm/boards/advantech-mx6/lowlevel.c
@@ -24,8 +24,6 @@ static inline void setup_uart(void)
 	putc_ll('>');
 }
 
-extern char __dtb_imx6dl_advantech_rom_7421_start[];
-
 ENTRY_FUNCTION(start_advantech_imx6dl_rom_7421, r0, r1, r2)
 {
 	imx6_cpu_lowlevel_init();
@@ -37,5 +35,5 @@ ENTRY_FUNCTION(start_advantech_imx6dl_rom_7421, r0, r1, r2)
 	if (IS_ENABLED(CONFIG_DEBUG_LL))
 		setup_uart();
 
-	imx6q_barebox_entry(__dtb_imx6dl_advantech_rom_7421_start);
+	IMX6Q_BAREBOX_ENTRY(imx6dl_advantech_rom_7421);
 }
diff --git a/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c b/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c
index 74ff71fc246a..5d663cde5cc4 100644
--- a/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c
+++ b/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c
@@ -3,63 +3,37 @@
 #include <mach/esdctl.h>
 #include <asm/barebox-arm.h>
 
-extern char __dtb_imx6q_nitrogen6x_start[];
-
 ENTRY_FUNCTION(start_imx6q_nitrogen6x_1g, r0, r1, r2)
 {
-	void *fdt;
-
 	imx6_cpu_lowlevel_init();
 
-	fdt = __dtb_imx6q_nitrogen6x_start + get_runtime_offset();
-
-	imx6q_barebox_entry(fdt);
+	IMX6Q_BAREBOX_ENTRY(imx6q_nitrogen6x);
 }
 
 ENTRY_FUNCTION(start_imx6q_nitrogen6x_2g, r0, r1, r2)
 {
-	void *fdt;
-
 	imx6_cpu_lowlevel_init();
 
-	fdt = __dtb_imx6q_nitrogen6x_start + get_runtime_offset();
-
-	imx6q_barebox_entry(fdt);
+	IMX6Q_BAREBOX_ENTRY(imx6q_nitrogen6x);
 }
 
-extern char __dtb_imx6dl_nitrogen6x_start[];
-
 ENTRY_FUNCTION(start_imx6dl_nitrogen6x_1g, r0, r1, r2)
 {
-	void *fdt;
-
 	imx6_cpu_lowlevel_init();
 
-	fdt = __dtb_imx6dl_nitrogen6x_start + get_runtime_offset();
-
-	imx6q_barebox_entry(fdt);
+	IMX6Q_BAREBOX_ENTRY(imx6dl_nitrogen6x);
 }
 
 ENTRY_FUNCTION(start_imx6dl_nitrogen6x_2g, r0, r1, r2)
 {
-	void *fdt;
-
 	imx6_cpu_lowlevel_init();
 
-	fdt = __dtb_imx6dl_nitrogen6x_start + get_runtime_offset();
-
-	imx6q_barebox_entry(fdt);
+	IMX6Q_BAREBOX_ENTRY(imx6dl_nitrogen6x);
 }
 
-extern char __dtb_imx6qp_nitrogen6_max_start[];
-
 ENTRY_FUNCTION(start_imx6qp_nitrogen6_max, r0, r1, r2)
 {
-	void *fdt;
-
 	imx6_cpu_lowlevel_init();
 
-	fdt = __dtb_imx6qp_nitrogen6_max_start + get_runtime_offset();
-
-	imx6q_barebox_entry(fdt);
+	IMX6Q_BAREBOX_ENTRY(imx6qp_nitrogen6_max);
 }
diff --git a/arch/arm/boards/cm-fx6/lowlevel.c b/arch/arm/boards/cm-fx6/lowlevel.c
index fd86e159aaae..9a4b012b338f 100644
--- a/arch/arm/boards/cm-fx6/lowlevel.c
+++ b/arch/arm/boards/cm-fx6/lowlevel.c
@@ -315,9 +315,6 @@ static void cm_fx6_init(void)
 	imx6_spi_start_image(0);
 }
 
-extern char __dtb_imx6q_cm_fx6_start[];
-extern char __dtb_imx6dl_cm_fx6_start[];
-
 static noinline void cm_fx6_start(void)
 {
 	int cpu_type = __imx6_cpu_type();
@@ -325,9 +322,9 @@ static noinline void cm_fx6_start(void)
 	cm_fx6_init();
 
 	if (cpu_type == IMX6_CPUTYPE_IMX6S)
-		imx6q_barebox_entry(__dtb_imx6dl_cm_fx6_start);
+		IMX6Q_BAREBOX_ENTRY(imx6dl_cm_fx6);
 	else
-		imx6q_barebox_entry(__dtb_imx6q_cm_fx6_start);
+		IMX6Q_BAREBOX_ENTRY(imx6q_cm_fx6);
 }
 
 ENTRY_FUNCTION(start_imx6_cm_fx6, r0, r1, r2)
@@ -341,9 +338,6 @@ ENTRY_FUNCTION(start_imx6_cm_fx6, r0, r1, r2)
 	cm_fx6_start();
 }
 
-extern char __dtb_imx6q_utilite_start[];
-extern char __dtb_imx6dl_utilite_value_start[];
-
 static noinline void utilite_start(void)
 {
 	int cpu_type = __imx6_cpu_type();
@@ -352,9 +346,9 @@ static noinline void utilite_start(void)
 
 	if (cpu_type == IMX6_CPUTYPE_IMX6S)
 		/* FIXME: This needs a specialized utilite value dts */
-		imx6q_barebox_entry(__dtb_imx6dl_cm_fx6_start);
+		IMX6Q_BAREBOX_ENTRY(imx6dl_cm_fx6);
 	else
-		imx6q_barebox_entry(__dtb_imx6q_utilite_start);
+		IMX6Q_BAREBOX_ENTRY(imx6q_utilite);
 }
 
 ENTRY_FUNCTION(start_imx6_utilite, r0, r1, r2)
diff --git a/arch/arm/boards/embest-marsboard/lowlevel.c b/arch/arm/boards/embest-marsboard/lowlevel.c
index 9e20a2ec0645..a2e6727a4bbb 100644
--- a/arch/arm/boards/embest-marsboard/lowlevel.c
+++ b/arch/arm/boards/embest-marsboard/lowlevel.c
@@ -24,18 +24,12 @@ static inline void setup_uart(void)
 	putc_ll('>');
 }
 
-extern char __dtb_z_imx6q_marsboard_start[];
-
 ENTRY_FUNCTION(start_imx6q_marsboard, r0, r1, r2)
 {
-	void *fdt;
-
 	imx6_cpu_lowlevel_init();
 
 	if (IS_ENABLED(CONFIG_DEBUG_LL))
 		setup_uart();
 
-	fdt = __dtb_z_imx6q_marsboard_start + get_runtime_offset();
-
-	imx6q_barebox_entry(fdt);
+	IMX6Q_BAREBOX_ZENTRY(imx6q_marsboard);
 }
diff --git a/arch/arm/boards/freescale-mx53-qsb/lowlevel.c b/arch/arm/boards/freescale-mx53-qsb/lowlevel.c
index c9044011d599..c67feab9be58 100644
--- a/arch/arm/boards/freescale-mx53-qsb/lowlevel.c
+++ b/arch/arm/boards/freescale-mx53-qsb/lowlevel.c
@@ -6,30 +6,18 @@
 #include <asm/barebox-arm.h>
 #include <image-metadata.h>
 
-extern char __dtb_imx53_qsb_start[];
-
 ENTRY_FUNCTION(start_imx53_loco, r0, r1, r2)
 {
-	void *fdt;
-
 	imx5_cpu_lowlevel_init();
 	arm_setup_stack(MX53_IRAM_BASE_ADDR + MX53_IRAM_SIZE);
 
-	fdt = __dtb_imx53_qsb_start + get_runtime_offset();
-
-	imx53_barebox_entry(fdt);
+	IMX53_BAREBOX_ENTRY(imx53_qsb);
 }
 
-extern char __dtb_imx53_qsrb_start[];
-
 ENTRY_FUNCTION(start_imx53_loco_r, r0, r1, r2)
 {
-	void *fdt;
-
 	imx5_cpu_lowlevel_init();
 	arm_setup_stack(MX53_IRAM_BASE_ADDR + MX53_IRAM_SIZE);
 
-	fdt = __dtb_imx53_qsrb_start + get_runtime_offset();
-
-	imx53_barebox_entry(fdt);
+	IMX53_BAREBOX_ENTRY(imx53_qsrb);
 }
diff --git a/arch/arm/boards/freescale-mx7-sabresd/lowlevel.c b/arch/arm/boards/freescale-mx7-sabresd/lowlevel.c
index 8db46ca69624..0256a8782250 100644
--- a/arch/arm/boards/freescale-mx7-sabresd/lowlevel.c
+++ b/arch/arm/boards/freescale-mx7-sabresd/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_imx7d_sabresd, r0, r1, r2)
 	if (IS_ENABLED(CONFIG_DEBUG_LL))
 		setup_uart();
 
-	imx7d_barebox_entry(__dtb_imx7d_sdb_start + get_runtime_offset());
+	IMX7D_BAREBOX_ENTRY(imx7d_sdb);
 }
diff --git a/arch/arm/boards/nxp-imx6ull-evk/lowlevel.c b/arch/arm/boards/nxp-imx6ull-evk/lowlevel.c
index afef4c449851..93fc8ef0d671 100644
--- a/arch/arm/boards/nxp-imx6ull-evk/lowlevel.c
+++ b/arch/arm/boards/nxp-imx6ull-evk/lowlevel.c
@@ -35,11 +35,9 @@ static inline void setup_uart(void)
 	putc_ll('>');
 }
 
-extern char __dtb_imx6ull_14x14_evk_start[];
-
 static noinline void nxp_imx6_ull(void)
 {
-	imx6ul_barebox_entry(__dtb_imx6ull_14x14_evk_start);
+	IMX6UL_BAREBOX_ENTRY(imx6ull_14x14_evk);
 }
 
 ENTRY_FUNCTION(start_nxp_imx6ull_evk, r0, r1, r2)
diff --git a/arch/arm/boards/udoo-neo/lowlevel.c b/arch/arm/boards/udoo-neo/lowlevel.c
index bb6b7d833278..5d80de941b89 100644
--- a/arch/arm/boards/udoo-neo/lowlevel.c
+++ b/arch/arm/boards/udoo-neo/lowlevel.c
@@ -22,18 +22,12 @@ static inline void setup_uart(void)
 	putc_ll('>');
 }
 
-extern char __dtb_imx6sx_udoo_neo_full_start[];
-
 ENTRY_FUNCTION(start_imx6sx_udoo_neo, r0, r1, r2)
 {
-	void *fdt;
-
 	imx6_cpu_lowlevel_init();
 
 	if (IS_ENABLED(CONFIG_DEBUG_LL))
 		setup_uart();
 
-	fdt = __dtb_imx6sx_udoo_neo_full_start + get_runtime_offset();
-
-	imx6sx_barebox_entry(fdt);
+	IMX6SX_BAREBOX_ENTRY(imx6sx_udoo_neo_full);
 }
diff --git a/arch/arm/boards/zii-imx6q-rdu2/lowlevel.c b/arch/arm/boards/zii-imx6q-rdu2/lowlevel.c
index a80ce0afc511..6c3da03ca866 100644
--- a/arch/arm/boards/zii-imx6q-rdu2/lowlevel.c
+++ b/arch/arm/boards/zii-imx6q-rdu2/lowlevel.c
@@ -253,9 +253,6 @@ static inline void setup_uart(void)
 	putc_ll('>');
 }
 
-extern char __dtb_z_imx6q_zii_rdu2_start[];
-extern char __dtb_z_imx6qp_zii_rdu2_start[];
-
 static noinline void rdu2_sram_setup(void)
 {
 	enum bootsource bootsrc;
@@ -294,9 +291,7 @@ ENTRY_FUNCTION(start_imx6_zii_rdu2, r0, r1, r2)
 		rdu2_sram_setup();
 
 	if (__imx6_cpu_type() == IMX6_CPUTYPE_IMX6QP)
-		imx6q_barebox_entry(__dtb_z_imx6qp_zii_rdu2_start +
-				    get_runtime_offset());
+		IMX6Q_BAREBOX_ZENTRY(imx6qp_zii_rdu2);
 	else
-		imx6q_barebox_entry(__dtb_z_imx6q_zii_rdu2_start +
-				    get_runtime_offset());
+		IMX6Q_BAREBOX_ZENTRY(imx6q_zii_rdu2);
 }
-- 
2.27.0


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

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

* [PATCH 4/4] arm/boards: Add IMD_USED_OF for a few boards
  2020-09-17 20:17 [PATCH 1/4] imx/esdctl: reorder some function declarations to be sorted by SoC Uwe Kleine-König
  2020-09-17 20:17 ` [PATCH 2/4] imx/esdctl: Define new helper macros to reduce board entry boilerplate Uwe Kleine-König
  2020-09-17 20:17 ` [PATCH 3/4] arm/boards: Convert a few boards to the new entry macros Uwe Kleine-König
@ 2020-09-17 20:17 ` Uwe Kleine-König
  2020-09-18 10:03   ` Sascha Hauer
  2 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2020-09-17 20:17 UTC (permalink / raw)
  To: barebox

Not all boards can make use of the helper macros introduced in the previous
commits, for these add an explicit call to IMD_USED_OF to add meta data
to the barebox image.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/boards/embest-riotboard/lowlevel.c     | 1 +
 arch/arm/boards/technexion-wandboard/lowlevel.c | 2 ++
 arch/arm/boards/zii-imx51-rdu1/lowlevel.c       | 3 +++
 3 files changed, 6 insertions(+)

diff --git a/arch/arm/boards/embest-riotboard/lowlevel.c b/arch/arm/boards/embest-riotboard/lowlevel.c
index 07f669fc0309..b0f5339b0a70 100644
--- a/arch/arm/boards/embest-riotboard/lowlevel.c
+++ b/arch/arm/boards/embest-riotboard/lowlevel.c
@@ -23,6 +23,7 @@ ENTRY_FUNCTION(start_imx6s_riotboard, r0, r1, r2)
 		putc_ll('a');
 	}
 
+	IMD_USED_OF(imx6s_riotboard);
 	fdt = __dtb_imx6s_riotboard_start + get_runtime_offset();
 	barebox_arm_entry(0x10000000, SZ_1G, fdt);
 }
diff --git a/arch/arm/boards/technexion-wandboard/lowlevel.c b/arch/arm/boards/technexion-wandboard/lowlevel.c
index 33babbbb2feb..5c1b5d6ed292 100644
--- a/arch/arm/boards/technexion-wandboard/lowlevel.c
+++ b/arch/arm/boards/technexion-wandboard/lowlevel.c
@@ -334,9 +334,11 @@ static noinline void wandboard_start(void)
 	switch (cpu_type) {
 	case IMX6_CPUTYPE_IMX6S:
 	case IMX6_CPUTYPE_IMX6DL:
+		IMD_USED_OF(imx6dl_wandboard);
 		dtb = __dtb_z_imx6dl_wandboard_start;
 		break;
 	case IMX6_CPUTYPE_IMX6Q:
+		IMD_USED_OF(imx6q_wandboard);
 		dtb = __dtb_z_imx6q_wandboard_start;
 		break;
 	default:
diff --git a/arch/arm/boards/zii-imx51-rdu1/lowlevel.c b/arch/arm/boards/zii-imx51-rdu1/lowlevel.c
index c7bb044e0d59..530d6a2f57e1 100644
--- a/arch/arm/boards/zii-imx51-rdu1/lowlevel.c
+++ b/arch/arm/boards/zii-imx51-rdu1/lowlevel.c
@@ -96,12 +96,15 @@ ENTRY_FUNCTION(start_imx51_zii_rdu1, r0, r1, r2)
 		/* FALLTHROUGH */
 	case ZII_PLATFORM_IMX51_RDU_REV_B:
 	case ZII_PLATFORM_IMX51_RDU_REV_C:
+		IMD_USED_OF(imx51_zii_rdu1);
 		fdt = __dtb_z_imx51_zii_rdu1_start;
 		break;
 	case ZII_PLATFORM_IMX51_SCU2_MEZZ:
+		IMD_USED_OF(imx51_zii_scu2_mezz);
 		fdt = __dtb_z_imx51_zii_scu2_mezz_start;
 		break;
 	case ZII_PLATFORM_IMX51_SCU3_ESB:
+		IMD_USED_OF(imx51_zii_scu3_esb);
 		fdt = __dtb_z_imx51_zii_scu3_esb_start;
 		break;
 	}
-- 
2.27.0


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

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

* Re: [PATCH 4/4] arm/boards: Add IMD_USED_OF for a few boards
  2020-09-17 20:17 ` [PATCH 4/4] arm/boards: Add IMD_USED_OF for a few boards Uwe Kleine-König
@ 2020-09-18 10:03   ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2020-09-18 10:03 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox

On Thu, Sep 17, 2020 at 10:17:08PM +0200, Uwe Kleine-König wrote:
> Not all boards can make use of the helper macros introduced in the previous
> commits, for these add an explicit call to IMD_USED_OF to add meta data
> to the barebox image.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  arch/arm/boards/embest-riotboard/lowlevel.c     | 1 +
>  arch/arm/boards/technexion-wandboard/lowlevel.c | 2 ++
>  arch/arm/boards/zii-imx51-rdu1/lowlevel.c       | 3 +++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/arch/arm/boards/embest-riotboard/lowlevel.c b/arch/arm/boards/embest-riotboard/lowlevel.c
> index 07f669fc0309..b0f5339b0a70 100644
> --- a/arch/arm/boards/embest-riotboard/lowlevel.c
> +++ b/arch/arm/boards/embest-riotboard/lowlevel.c
> @@ -23,6 +23,7 @@ ENTRY_FUNCTION(start_imx6s_riotboard, r0, r1, r2)
>  		putc_ll('a');
>  	}
>  
> +	IMD_USED_OF(imx6s_riotboard);
>  	fdt = __dtb_imx6s_riotboard_start + get_runtime_offset();
>  	barebox_arm_entry(0x10000000, SZ_1G, fdt);
>  }
> diff --git a/arch/arm/boards/technexion-wandboard/lowlevel.c b/arch/arm/boards/technexion-wandboard/lowlevel.c
> index 33babbbb2feb..5c1b5d6ed292 100644
> --- a/arch/arm/boards/technexion-wandboard/lowlevel.c
> +++ b/arch/arm/boards/technexion-wandboard/lowlevel.c
> @@ -334,9 +334,11 @@ static noinline void wandboard_start(void)
>  	switch (cpu_type) {
>  	case IMX6_CPUTYPE_IMX6S:
>  	case IMX6_CPUTYPE_IMX6DL:
> +		IMD_USED_OF(imx6dl_wandboard);
>  		dtb = __dtb_z_imx6dl_wandboard_start;
>  		break;
>  	case IMX6_CPUTYPE_IMX6Q:
> +		IMD_USED_OF(imx6q_wandboard);
>  		dtb = __dtb_z_imx6q_wandboard_start;
>  		break;
>  	default:

This doesn't work like you might expect. IMD_USED_OF uses imd_used().
This fake function only has the effect that
__barebox_imd_OF_imx6q_wandboard appears to be used and thus doesn't get
discarded by the linker. By putting imd_used() multiple times into code
which ends up in the same binary you'll get all tags in the binary, no
matter where in the code you put IMD_USED_OF.

Having two tags is fine, because you really have a binary that is
compatible to both wand,imx6dl-wandboard and wand,imx6q-wandboard, but
please put them side by side into the ENTRY_FUNCTION.

Have you compile tested this patch? It seems an #include
<image-metadata.h> is missing at least in this file.

Sascha

-- 
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 |

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

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

* Re: [PATCH 2/4] imx/esdctl: Define new helper macros to reduce board entry boilerplate
  2020-09-17 20:17 ` [PATCH 2/4] imx/esdctl: Define new helper macros to reduce board entry boilerplate Uwe Kleine-König
@ 2020-09-18 10:32   ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2020-09-18 10:32 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox

On Thu, Sep 17, 2020 at 10:17:06PM +0200, Uwe Kleine-König wrote:
> The macro provides the extern declaration of the devicetree variable, calls
> IMD_USED_OF to add metadata to the resulting barebox image and then calls
> the right entry function.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  arch/arm/mach-imx/include/mach/esdctl.h | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/include/mach/esdctl.h b/arch/arm/mach-imx/include/mach/esdctl.h
> index 8073b7f40937..506dda2d5a1c 100644
> --- a/arch/arm/mach-imx/include/mach/esdctl.h
> +++ b/arch/arm/mach-imx/include/mach/esdctl.h
> @@ -145,6 +145,27 @@ void __noreturn imx8mp_barebox_entry(void *boarddata);
>  void __noreturn imx8mq_barebox_entry(void *boarddata);
>  void __noreturn vf610_barebox_entry(void *boarddata);
>  
> +#include <image-metadata.h>
> +
> +#define IMX_BAREBOX__ENTRY(_fdtname, _suffix, _compressed) ({ extern char __dtb_ ## _compressed ## _fdtname ## _start[]; IMD_USED_OF(_fdtname); imx ## _suffix ## _barebox_entry(__dtb_ ## _compressed ## _fdtname ## _start + get_runtime_offset()); })

I think this macro does a bit too much.

How about this one first:

#define GET_DTB(name) ({					\
	extern char __dtb_ ## name ## _start[];			\
	__dtb_ ## name ## _start + get_runtime_offset();	\
});

and an analog GET_DTBZ? This would be generally userful and not only on
i.MX.

I am not sure I would put the IMD_USED_OF into this macro. My gut
feeling is that I would rather make it explicit in the board code.

Sascha

-- 
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 |

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

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

end of thread, other threads:[~2020-09-18 10:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 20:17 [PATCH 1/4] imx/esdctl: reorder some function declarations to be sorted by SoC Uwe Kleine-König
2020-09-17 20:17 ` [PATCH 2/4] imx/esdctl: Define new helper macros to reduce board entry boilerplate Uwe Kleine-König
2020-09-18 10:32   ` Sascha Hauer
2020-09-17 20:17 ` [PATCH 3/4] arm/boards: Convert a few boards to the new entry macros Uwe Kleine-König
2020-09-17 20:17 ` [PATCH 4/4] arm/boards: Add IMD_USED_OF for a few boards Uwe Kleine-König
2020-09-18 10:03   ` Sascha Hauer

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