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