[PATCH 2/4] imx/esdctl: Define new helper macros to reduce board entry boilerplate
Sascha Hauer
s.hauer at pengutronix.de
Fri Sep 18 06:32:04 EDT 2020
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 at 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 |
More information about the barebox
mailing list