[PATCH 1/8] ARM: renesas: Rename board/renesas/rcar-common to board/renesas/common

Rename directory board/renesas/rcar-common to board/renesas/common and move files. This allows the build system to use HAVE_VENDOR_COMMON_LIB which automatically includes board/$(VENDOR)/common/Makefile . This is a preparatory patch for board Makefile simplification. No functional change so far.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org --- Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de --- board/beacon/beacon-rzg2m/Makefile | 2 +- board/hoperun/hihope-rzg2/Makefile | 2 +- board/renesas/{rcar-common => common}/common.c | 2 +- board/renesas/{rcar-common => common}/gen3-common.c | 2 +- board/renesas/{rcar-common => common}/gen3-spl.c | 0 board/renesas/{rcar-common => common}/gen4-common.c | 2 +- board/renesas/{rcar-common => common}/gen4-spl.c | 0 board/renesas/{rcar-common => common}/v3-common.c | 0 board/renesas/condor/Makefile | 4 ++-- board/renesas/draak/Makefile | 4 ++-- board/renesas/eagle/Makefile | 4 ++-- board/renesas/ebisu/Makefile | 4 ++-- board/renesas/falcon/Makefile | 4 ++-- board/renesas/grayhawk/Makefile | 2 +- board/renesas/salvator-x/Makefile | 4 ++-- board/renesas/spider/Makefile | 2 +- board/renesas/ulcb/Makefile | 4 ++-- board/renesas/v3hsk/Makefile | 4 ++-- board/renesas/v3msk/Makefile | 4 ++-- board/renesas/whitehawk/Makefile | 4 ++-- board/silinux/ek874/Makefile | 4 ++-- 21 files changed, 29 insertions(+), 29 deletions(-) rename board/renesas/{rcar-common => common}/common.c (97%) rename board/renesas/{rcar-common => common}/gen3-common.c (99%) rename board/renesas/{rcar-common => common}/gen3-spl.c (100%) rename board/renesas/{rcar-common => common}/gen4-common.c (97%) rename board/renesas/{rcar-common => common}/gen4-spl.c (100%) rename board/renesas/{rcar-common => common}/v3-common.c (100%)
diff --git a/board/beacon/beacon-rzg2m/Makefile b/board/beacon/beacon-rzg2m/Makefile index 332b41f35c0..6a6ae94def8 100644 --- a/board/beacon/beacon-rzg2m/Makefile +++ b/board/beacon/beacon-rzg2m/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y := beacon-rzg2m.o ../../renesas/rcar-common/gen3-common.o ../../renesas/rcar-common/common.o +obj-y := beacon-rzg2m.o ../../renesas/common/gen3-common.o ../../renesas/common/common.o diff --git a/board/hoperun/hihope-rzg2/Makefile b/board/hoperun/hihope-rzg2/Makefile index 700e26daa2b..a42c55b9d00 100644 --- a/board/hoperun/hihope-rzg2/Makefile +++ b/board/hoperun/hihope-rzg2/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y := hihope-rzg2.o ../../renesas/rcar-common/gen3-common.o ../../renesas/rcar-common/common.o +obj-y := hihope-rzg2.o ../../renesas/common/gen3-common.o ../../renesas/common/common.o diff --git a/board/renesas/rcar-common/common.c b/board/renesas/common/common.c similarity index 97% rename from board/renesas/rcar-common/common.c rename to board/renesas/common/common.c index 90eb468e4c4..7fba8d10ff5 100644 --- a/board/renesas/rcar-common/common.c +++ b/board/renesas/common/common.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * board/renesas/rcar-common/common.c + * board/renesas/common/common.c * * Copyright (C) 2013 Renesas Electronics Corporation * Copyright (C) 2013 Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com diff --git a/board/renesas/rcar-common/gen3-common.c b/board/renesas/common/gen3-common.c similarity index 99% rename from board/renesas/rcar-common/gen3-common.c rename to board/renesas/common/gen3-common.c index 4291e1d5bcb..549bec9e137 100644 --- a/board/renesas/rcar-common/gen3-common.c +++ b/board/renesas/common/gen3-common.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * board/renesas/rcar-common/gen3-common.c + * board/renesas/common/gen3-common.c * * Copyright (C) 2013 Renesas Electronics Corporation * Copyright (C) 2013 Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj@renesas.com diff --git a/board/renesas/rcar-common/gen3-spl.c b/board/renesas/common/gen3-spl.c similarity index 100% rename from board/renesas/rcar-common/gen3-spl.c rename to board/renesas/common/gen3-spl.c diff --git a/board/renesas/rcar-common/gen4-common.c b/board/renesas/common/gen4-common.c similarity index 97% rename from board/renesas/rcar-common/gen4-common.c rename to board/renesas/common/gen4-common.c index 2abe9660cf8..52a0639073b 100644 --- a/board/renesas/rcar-common/gen4-common.c +++ b/board/renesas/common/gen4-common.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * board/renesas/rcar-common/gen4-common.c + * board/renesas/common/gen4-common.c * * Copyright (C) 2021-2024 Renesas Electronics Corp. */ diff --git a/board/renesas/rcar-common/gen4-spl.c b/board/renesas/common/gen4-spl.c similarity index 100% rename from board/renesas/rcar-common/gen4-spl.c rename to board/renesas/common/gen4-spl.c diff --git a/board/renesas/rcar-common/v3-common.c b/board/renesas/common/v3-common.c similarity index 100% rename from board/renesas/rcar-common/v3-common.c rename to board/renesas/common/v3-common.c diff --git a/board/renesas/condor/Makefile b/board/renesas/condor/Makefile index fe3a2fd3b7a..3b1756b44cd 100644 --- a/board/renesas/condor/Makefile +++ b/board/renesas/condor/Makefile @@ -7,7 +7,7 @@ #
ifdef CONFIG_XPL_BUILD -obj-y := ../rcar-common/gen3-spl.o +obj-y := ../common/gen3-spl.o else -obj-y := ../rcar-common/gen3-common.o ../rcar-common/common.o +obj-y := ../common/gen3-common.o ../common/common.o endif diff --git a/board/renesas/draak/Makefile b/board/renesas/draak/Makefile index 3ed7800b0e9..6ce05bcd649 100644 --- a/board/renesas/draak/Makefile +++ b/board/renesas/draak/Makefile @@ -7,7 +7,7 @@ #
ifdef CONFIG_XPL_BUILD -obj-y := ../rcar-common/gen3-spl.o +obj-y := ../common/gen3-spl.o else -obj-y := draak.o ../rcar-common/gen3-common.o ../rcar-common/common.o +obj-y := draak.o ../common/gen3-common.o ../common/common.o endif diff --git a/board/renesas/eagle/Makefile b/board/renesas/eagle/Makefile index 3f5fdab1bc2..a5c18d81eef 100644 --- a/board/renesas/eagle/Makefile +++ b/board/renesas/eagle/Makefile @@ -7,7 +7,7 @@ #
ifdef CONFIG_XPL_BUILD -obj-y := ../rcar-common/gen3-spl.o +obj-y := ../common/gen3-spl.o else -obj-y := ../rcar-common/v3-common.o ../rcar-common/gen3-common.o ../rcar-common/common.o +obj-y := ../common/v3-common.o ../common/gen3-common.o ../common/common.o endif diff --git a/board/renesas/ebisu/Makefile b/board/renesas/ebisu/Makefile index 8139391029d..72130b76234 100644 --- a/board/renesas/ebisu/Makefile +++ b/board/renesas/ebisu/Makefile @@ -7,7 +7,7 @@ #
ifdef CONFIG_XPL_BUILD -obj-y := ../rcar-common/gen3-spl.o +obj-y := ../common/gen3-spl.o else -obj-y := ../rcar-common/gen3-common.o ../rcar-common/common.o +obj-y := ../common/gen3-common.o ../common/common.o endif diff --git a/board/renesas/falcon/Makefile b/board/renesas/falcon/Makefile index 48fcfac9105..949953f6981 100644 --- a/board/renesas/falcon/Makefile +++ b/board/renesas/falcon/Makefile @@ -7,7 +7,7 @@ #
ifdef CONFIG_XPL_BUILD -obj-y := ../rcar-common/gen3-spl.o +obj-y := ../common/gen3-spl.o else -obj-y := ../rcar-common/gen4-common.o ../rcar-common/common.o +obj-y := ../common/gen4-common.o ../common/common.o endif diff --git a/board/renesas/grayhawk/Makefile b/board/renesas/grayhawk/Makefile index 7414b773326..a70bd3739f1 100644 --- a/board/renesas/grayhawk/Makefile +++ b/board/renesas/grayhawk/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y := ../rcar-common/gen4-common.o ../rcar-common/common.o +obj-y := ../common/gen4-common.o ../common/common.o diff --git a/board/renesas/salvator-x/Makefile b/board/renesas/salvator-x/Makefile index fe7c78ef2ff..fe53366829c 100644 --- a/board/renesas/salvator-x/Makefile +++ b/board/renesas/salvator-x/Makefile @@ -7,7 +7,7 @@ #
ifdef CONFIG_XPL_BUILD -obj-y := ../rcar-common/gen3-spl.o +obj-y := ../common/gen3-spl.o else -obj-y := salvator-x.o ../rcar-common/gen3-common.o ../rcar-common/common.o +obj-y := salvator-x.o ../common/gen3-common.o ../common/common.o endif diff --git a/board/renesas/spider/Makefile b/board/renesas/spider/Makefile index 9489917278c..e0f403d5fcc 100644 --- a/board/renesas/spider/Makefile +++ b/board/renesas/spider/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y := ../rcar-common/gen4-common.o ../rcar-common/common.o +obj-y := ../common/gen4-common.o ../common/common.o diff --git a/board/renesas/ulcb/Makefile b/board/renesas/ulcb/Makefile index c3c2f391e55..6b2aa8c29f6 100644 --- a/board/renesas/ulcb/Makefile +++ b/board/renesas/ulcb/Makefile @@ -7,7 +7,7 @@ #
ifdef CONFIG_XPL_BUILD -obj-y := ../rcar-common/gen3-spl.o +obj-y := ../common/gen3-spl.o else -obj-y := ulcb.o cpld.o ../rcar-common/gen3-common.o ../rcar-common/common.o +obj-y := ulcb.o cpld.o ../common/gen3-common.o ../common/common.o endif diff --git a/board/renesas/v3hsk/Makefile b/board/renesas/v3hsk/Makefile index ee04f67d986..936047cb3d5 100644 --- a/board/renesas/v3hsk/Makefile +++ b/board/renesas/v3hsk/Makefile @@ -8,8 +8,8 @@ #
ifdef CONFIG_XPL_BUILD -obj-y := ../rcar-common/gen3-spl.o +obj-y := ../common/gen3-spl.o else -obj-y := ../rcar-common/v3-common.o ../rcar-common/gen3-common.o ../rcar-common/common.o +obj-y := ../common/v3-common.o ../common/gen3-common.o ../common/common.o obj-$(CONFIG_SYSRESET) += cpld.o endif diff --git a/board/renesas/v3msk/Makefile b/board/renesas/v3msk/Makefile index 63e06a4b5fd..21eaddb6c28 100644 --- a/board/renesas/v3msk/Makefile +++ b/board/renesas/v3msk/Makefile @@ -8,8 +8,8 @@ #
ifdef CONFIG_XPL_BUILD -obj-y := ../rcar-common/gen3-spl.o +obj-y := ../common/gen3-spl.o else -obj-y := ../rcar-common/v3-common.o ../rcar-common/gen3-common.o ../rcar-common/common.o +obj-y := ../common/v3-common.o ../common/gen3-common.o ../common/common.o obj-$(CONFIG_SYSRESET) += cpld.o endif diff --git a/board/renesas/whitehawk/Makefile b/board/renesas/whitehawk/Makefile index 80f92e6b041..f10eb82d221 100644 --- a/board/renesas/whitehawk/Makefile +++ b/board/renesas/whitehawk/Makefile @@ -7,7 +7,7 @@ #
ifdef CONFIG_SPL_BUILD -obj-y := ../rcar-common/gen4-spl.o +obj-y := ../common/gen4-spl.o else -obj-y := ../rcar-common/gen4-common.o ../rcar-common/common.o +obj-y := ../common/gen4-common.o ../common/common.o endif diff --git a/board/silinux/ek874/Makefile b/board/silinux/ek874/Makefile index 879da9edacf..c1cab6fa788 100644 --- a/board/silinux/ek874/Makefile +++ b/board/silinux/ek874/Makefile @@ -7,7 +7,7 @@ #
ifdef CONFIG_XPL_BUILD -obj-y := ../../renesas/rcar-common/gen3-spl.o +obj-y := ../../renesas/common/gen3-spl.o else -obj-y := ek874.o ../../renesas/rcar-common/gen3-common.o ../../renesas/rcar-common/common.o +obj-y := ek874.o ../../renesas/common/gen3-common.o ../../renesas/common/common.o endif

Introduce board/renesas/common/Makefile and remove the multiple duplicate copies of obj := ../common/*.o from board Makefiles. Let the build system include the common Makefile using the HAVE_VENDOR_COMMON_LIB and build the common objects that are shared by all the boards that way. No functional change intended.
Some of the remaining board files which include board specific settings have been updated to use obj-y += to avoid rewriting the board obj-y target and avoid dropping object files from the build.
Board Makefiles cannot be empty, else they do not generate built-in.o, move the CONFIG_XPL_BUILD ifdeffery from Makefiles into .c files to make sure there is always a built-in.o generated from the remaining minimal Makefiles. This will be further cleaned up in follow up patches.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org --- Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de --- board/renesas/common/Makefile | 45 +++++++++++++++++++++++++++ board/renesas/common/gen3-common.c | 3 -- board/renesas/condor/Makefile | 13 -------- board/renesas/draak/Makefile | 6 +--- board/renesas/draak/draak.c | 4 +++ board/renesas/eagle/Makefile | 13 -------- board/renesas/ebisu/Makefile | 13 -------- board/renesas/falcon/Makefile | 13 -------- board/renesas/grayhawk/Makefile | 9 ------ board/renesas/salvator-x/Makefile | 6 +--- board/renesas/salvator-x/salvator-x.c | 4 +++ board/renesas/spider/Makefile | 9 ------ board/renesas/ulcb/Makefile | 6 +--- board/renesas/ulcb/cpld.c | 4 +++ board/renesas/ulcb/ulcb.c | 4 +++ board/renesas/v3hsk/Makefile | 5 --- board/renesas/v3hsk/cpld.c | 4 +++ board/renesas/v3msk/Makefile | 5 --- board/renesas/v3msk/cpld.c | 4 +++ board/renesas/whitehawk/Makefile | 13 -------- 20 files changed, 72 insertions(+), 111 deletions(-) create mode 100644 board/renesas/common/Makefile delete mode 100644 board/renesas/condor/Makefile delete mode 100644 board/renesas/eagle/Makefile delete mode 100644 board/renesas/ebisu/Makefile delete mode 100644 board/renesas/falcon/Makefile delete mode 100644 board/renesas/grayhawk/Makefile delete mode 100644 board/renesas/spider/Makefile delete mode 100644 board/renesas/whitehawk/Makefile
diff --git a/board/renesas/common/Makefile b/board/renesas/common/Makefile new file mode 100644 index 00000000000..2072338ea05 --- /dev/null +++ b/board/renesas/common/Makefile @@ -0,0 +1,45 @@ +# +# board/renesas/whitehawk/Makefile +# +# Copyright (C) 2024 Marek Vasut marek.vasut+renesas@mailbox.org +# +# SPDX-License-Identifier: GPL-2.0+ +# + +# R-Car SoCs +ifndef CONFIG_RZG2L + +# 32 bit SoCs +ifdef CONFIG_RCAR_GEN2 +endif + +# 64 bit SoCs +ifdef CONFIG_RCAR_64 +ifndef CONFIG_XPL_BUILD +obj-y += common.o +endif + +ifdef CONFIG_RCAR_GEN3 +ifdef CONFIG_XPL_BUILD +obj-y += gen3-spl.o +else +obj-y += gen3-common.o +ifdef CONFIG_R8A77970 +obj-y += v3-common.o +endif +ifdef CONFIG_R8A77980 +obj-y += v3-common.o +endif +endif +endif + +ifdef CONFIG_RCAR_GEN4 +ifdef CONFIG_XPL_BUILD +obj-y += gen4-spl.o +else +obj-y += gen4-common.o +endif +endif +endif + +endif diff --git a/board/renesas/common/gen3-common.c b/board/renesas/common/gen3-common.c index 549bec9e137..840ea6d7820 100644 --- a/board/renesas/common/gen3-common.c +++ b/board/renesas/common/gen3-common.c @@ -17,8 +17,6 @@ #include <asm/arch/renesas.h> #include <linux/libfdt.h>
-#ifdef CONFIG_RCAR_64 - DECLARE_GLOBAL_DATA_PTR;
/* If the firmware passed a device tree use it for e.g. U-Boot DRAM setup. */ @@ -182,4 +180,3 @@ int ft_board_setup(void *blob, struct bd_info *bd) return 0; } #endif -#endif diff --git a/board/renesas/condor/Makefile b/board/renesas/condor/Makefile deleted file mode 100644 index 3b1756b44cd..00000000000 --- a/board/renesas/condor/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/condor/Makefile -# -# Copyright (C) 2019 Renesas Electronics Corporation -# -# SPDX-License-Identifier: GPL-2.0+ -# - -ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/gen3-common.o ../common/common.o -endif diff --git a/board/renesas/draak/Makefile b/board/renesas/draak/Makefile index 6ce05bcd649..945cc2134e8 100644 --- a/board/renesas/draak/Makefile +++ b/board/renesas/draak/Makefile @@ -6,8 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := draak.o ../common/gen3-common.o ../common/common.o -endif +obj-y += draak.o diff --git a/board/renesas/draak/draak.c b/board/renesas/draak/draak.c index a51bf65674f..b742b8d6220 100644 --- a/board/renesas/draak/draak.c +++ b/board/renesas/draak/draak.c @@ -6,6 +6,8 @@ * Copyright (C) 2017 Marek Vasut marek.vasut+renesas@gmail.com */
+#if !IS_ENABLED(CONFIG_XPL_BUILD) + #include <cpu_func.h> #include <hang.h> #include <init.h> @@ -65,3 +67,5 @@ int board_init(void)
return 0; } + +#endif diff --git a/board/renesas/eagle/Makefile b/board/renesas/eagle/Makefile deleted file mode 100644 index a5c18d81eef..00000000000 --- a/board/renesas/eagle/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/eagle/Makefile -# -# Copyright (C) 2015 Renesas Electronics Corporation -# -# SPDX-License-Identifier: GPL-2.0+ -# - -ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/v3-common.o ../common/gen3-common.o ../common/common.o -endif diff --git a/board/renesas/ebisu/Makefile b/board/renesas/ebisu/Makefile deleted file mode 100644 index 72130b76234..00000000000 --- a/board/renesas/ebisu/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/ebisu/Makefile -# -# Copyright (C) 2018 Renesas Electronics Corporation -# -# SPDX-License-Identifier: GPL-2.0+ -# - -ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/gen3-common.o ../common/common.o -endif diff --git a/board/renesas/falcon/Makefile b/board/renesas/falcon/Makefile deleted file mode 100644 index 949953f6981..00000000000 --- a/board/renesas/falcon/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/falcon/Makefile -# -# Copyright (C) 2020 Renesas Electronics Corp. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/gen4-common.o ../common/common.o -endif diff --git a/board/renesas/grayhawk/Makefile b/board/renesas/grayhawk/Makefile deleted file mode 100644 index a70bd3739f1..00000000000 --- a/board/renesas/grayhawk/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# -# board/renesas/grayhawk/Makefile -# -# Copyright (C) 2023 Renesas Electronics Corp. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -obj-y := ../common/gen4-common.o ../common/common.o diff --git a/board/renesas/salvator-x/Makefile b/board/renesas/salvator-x/Makefile index fe53366829c..daea3e6838f 100644 --- a/board/renesas/salvator-x/Makefile +++ b/board/renesas/salvator-x/Makefile @@ -6,8 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := salvator-x.o ../common/gen3-common.o ../common/common.o -endif +obj-y += salvator-x.o diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index 2c8860bcee4..b6fb106ca5d 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -7,6 +7,8 @@ * Copyright (C) 2015 Nobuhiro Iwamatsu iwamatsu@nigauri.org */
+#if !IS_ENABLED(CONFIG_XPL_BUILD) + #include <cpu_func.h> #include <image.h> #include <init.h> @@ -93,3 +95,5 @@ int board_fit_config_name_match(const char *name) return -1; } #endif + +#endif diff --git a/board/renesas/spider/Makefile b/board/renesas/spider/Makefile deleted file mode 100644 index e0f403d5fcc..00000000000 --- a/board/renesas/spider/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# -# board/renesas/spider/Makefile -# -# Copyright (C) 2020 Renesas Electronics Corp. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -obj-y := ../common/gen4-common.o ../common/common.o diff --git a/board/renesas/ulcb/Makefile b/board/renesas/ulcb/Makefile index 6b2aa8c29f6..4f608613c15 100644 --- a/board/renesas/ulcb/Makefile +++ b/board/renesas/ulcb/Makefile @@ -6,8 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ulcb.o cpld.o ../common/gen3-common.o ../common/common.o -endif +obj-y += ulcb.o cpld.o diff --git a/board/renesas/ulcb/cpld.c b/board/renesas/ulcb/cpld.c index e72e45e3fb4..6a708d86cc8 100644 --- a/board/renesas/ulcb/cpld.c +++ b/board/renesas/ulcb/cpld.c @@ -6,6 +6,8 @@ * Copyright (C) 2017 Cogent Embedded, Inc. */
+#if !IS_ENABLED(CONFIG_XPL_BUILD) + #include <command.h> #include <asm/gpio.h> #include <asm/io.h> @@ -189,3 +191,5 @@ U_BOOT_DRIVER(sysreset_renesas_ulcb) = { .of_match = renesas_ulcb_sysreset_ids, .priv_auto = sizeof(struct renesas_ulcb_sysreset_priv), }; + +#endif diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c index 64f01b123cb..e1445adbb69 100644 --- a/board/renesas/ulcb/ulcb.c +++ b/board/renesas/ulcb/ulcb.c @@ -6,6 +6,8 @@ * Copyright (C) 2017 Renesas Electronics Corporation */
+#if !IS_ENABLED(CONFIG_XPL_BUILD) + #include <image.h> #include <init.h> #include <malloc.h> @@ -84,3 +86,5 @@ int board_fit_config_name_match(const char *name) return -1; } #endif + +#endif diff --git a/board/renesas/v3hsk/Makefile b/board/renesas/v3hsk/Makefile index 936047cb3d5..0091bc9cd5b 100644 --- a/board/renesas/v3hsk/Makefile +++ b/board/renesas/v3hsk/Makefile @@ -7,9 +7,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/v3-common.o ../common/gen3-common.o ../common/common.o obj-$(CONFIG_SYSRESET) += cpld.o -endif diff --git a/board/renesas/v3hsk/cpld.c b/board/renesas/v3hsk/cpld.c index 1272aec7302..b82622f9c54 100644 --- a/board/renesas/v3hsk/cpld.c +++ b/board/renesas/v3hsk/cpld.c @@ -7,6 +7,8 @@ * */
+#if !IS_ENABLED(CONFIG_XPL_BUILD) + #include <dm.h> #include <errno.h> #include <i2c.h> @@ -177,3 +179,5 @@ U_BOOT_DRIVER(sysreset_renesas_v3hsk) = { .probe = renesas_v3hsk_sysreset_probe, .of_match = renesas_v3hsk_sysreset_ids, }; + +#endif diff --git a/board/renesas/v3msk/Makefile b/board/renesas/v3msk/Makefile index 21eaddb6c28..fe8bf1ed1ae 100644 --- a/board/renesas/v3msk/Makefile +++ b/board/renesas/v3msk/Makefile @@ -7,9 +7,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/v3-common.o ../common/gen3-common.o ../common/common.o obj-$(CONFIG_SYSRESET) += cpld.o -endif diff --git a/board/renesas/v3msk/cpld.c b/board/renesas/v3msk/cpld.c index 260755ac746..93f3bf391cd 100644 --- a/board/renesas/v3msk/cpld.c +++ b/board/renesas/v3msk/cpld.c @@ -7,6 +7,8 @@ * */
+#if !IS_ENABLED(CONFIG_XPL_BUILD) + #include <asm/gpio.h> #include <asm/io.h> #include <dm.h> @@ -365,3 +367,5 @@ U_BOOT_DRIVER(sysreset_renesas_v3msk) = { .of_match = renesas_v3msk_sysreset_ids, .priv_auto = sizeof(struct renesas_v3msk_sysreset_priv), }; + +#endif diff --git a/board/renesas/whitehawk/Makefile b/board/renesas/whitehawk/Makefile deleted file mode 100644 index f10eb82d221..00000000000 --- a/board/renesas/whitehawk/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/whitehawk/Makefile -# -# Copyright (C) 2021 Renesas Electronics Corp. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -ifdef CONFIG_SPL_BUILD -obj-y := ../common/gen4-spl.o -else -obj-y := ../common/gen4-common.o ../common/common.o -endif

Hi Marek,
On 1/12/25 11:34 PM, Marek Vasut wrote:
Introduce board/renesas/common/Makefile and remove the multiple duplicate copies of obj := ../common/*.o from board Makefiles. Let the build system include the common Makefile using the HAVE_VENDOR_COMMON_LIB and build the common objects that are shared by all the boards that way. No functional change intended.
Thanks for highlighting this HAVE_VENDOR_COMMON_LIB mechanism, I'm now planning on migrating the Theobroma boards to that :) (I would need https://lore.kernel.org/u-boot/20250112223252.179123-1-marek.vasut+renesas@m... though :) ).
Some of the remaining board files which include board specific settings have been updated to use obj-y += to avoid rewriting the board obj-y target and avoid dropping object files from the build.
Board Makefiles cannot be empty, else they do not generate built-in.o, move the CONFIG_XPL_BUILD ifdeffery from Makefiles into .c files to make sure there is always a built-in.o generated from the remaining minimal Makefiles. This will be further cleaned up in follow up patches.
Unrelated, but I misread the commit log and was wondering whether this patch series would work without the additional patch from https://lore.kernel.org/u-boot/20250112223252.179123-1-marek.vasut+renesas@m... so wanted to build an Rcar defconfig to verify but I'm unable to build r8a779f0_spider_defconfig from master:
/usr/bin/aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/14/libgcc.a(lse-init.o): in function `init_have_lse_atomics': /builddir/build/BUILD/cross-gcc-14.2.1-build/gcc-14.2.1-20240912/aarch64-linux-gnu/aarch64-linux-gnu/libgcc/../../../gcc-14.2.1-20240912/libgcc/config/aarch64/lse-init.c:46:(.text.startup+0xc): undefined reference to `__getauxval' /usr/bin/aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/14/libgcc.a(__aarch64_have_sme.o): in function `sme_accessible': /builddir/build/BUILD/cross-gcc-14.2.1-build/gcc-14.2.1-20240912/aarch64-linux-gnu/aarch64-linux-gnu/libgcc/../../../gcc-14.2.1-20240912/libgcc/config/aarch64/__aarch64_have_sme.c:49:(.text.startup+0xc): undefined reference to `__getauxval' /usr/bin/aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/14/libgcc.a(__arm_tpidr2_restore.o): in function `__arm_tpidr2_restore': /builddir/build/BUILD/cross-gcc-14.2.1-build/gcc-14.2.1-20240912/aarch64-linux-gnu/aarch64-linux-gnu/libgcc/../../../gcc-14.2.1-20240912/libgcc/config/aarch64/__arm_tpidr2_restore.S:88:(.text+0x90): undefined reference to `abort' /usr/bin/aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/14/libgcc.a(__arm_tpidr2_save.o): in function `__libgcc_arm_tpidr2_save': /builddir/build/BUILD/cross-gcc-14.2.1-build/gcc-14.2.1-20240912/aarch64-linux-gnu/aarch64-linux-gnu/libgcc/../../../gcc-14.2.1-20240912/libgcc/config/aarch64/__arm_tpidr2_save.S:95:(.text+0x9c): undefined reference to `abort' collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped compilation terminated. make: *** [Makefile:1812: u-boot] Error 1 make: *** Deleting file 'u-boot'
so cannot check myself.
I'm running Fedora 41.
$ aarch64-linux-gnu-gcc --version aarch64-linux-gnu-gcc (GCC) 14.2.1 20240912 (Red Hat Cross 14.2.1-1)
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org
Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de
board/renesas/common/Makefile | 45 +++++++++++++++++++++++++++ board/renesas/common/gen3-common.c | 3 -- board/renesas/condor/Makefile | 13 -------- board/renesas/draak/Makefile | 6 +--- board/renesas/draak/draak.c | 4 +++ board/renesas/eagle/Makefile | 13 -------- board/renesas/ebisu/Makefile | 13 -------- board/renesas/falcon/Makefile | 13 -------- board/renesas/grayhawk/Makefile | 9 ------ board/renesas/salvator-x/Makefile | 6 +--- board/renesas/salvator-x/salvator-x.c | 4 +++ board/renesas/spider/Makefile | 9 ------ board/renesas/ulcb/Makefile | 6 +--- board/renesas/ulcb/cpld.c | 4 +++ board/renesas/ulcb/ulcb.c | 4 +++ board/renesas/v3hsk/Makefile | 5 --- board/renesas/v3hsk/cpld.c | 4 +++ board/renesas/v3msk/Makefile | 5 --- board/renesas/v3msk/cpld.c | 4 +++ board/renesas/whitehawk/Makefile | 13 -------- 20 files changed, 72 insertions(+), 111 deletions(-) create mode 100644 board/renesas/common/Makefile delete mode 100644 board/renesas/condor/Makefile delete mode 100644 board/renesas/eagle/Makefile delete mode 100644 board/renesas/ebisu/Makefile delete mode 100644 board/renesas/falcon/Makefile delete mode 100644 board/renesas/grayhawk/Makefile delete mode 100644 board/renesas/spider/Makefile delete mode 100644 board/renesas/whitehawk/Makefile
diff --git a/board/renesas/common/Makefile b/board/renesas/common/Makefile new file mode 100644 index 00000000000..2072338ea05 --- /dev/null +++ b/board/renesas/common/Makefile @@ -0,0 +1,45 @@ +# +# board/renesas/whitehawk/Makefile +# +# Copyright (C) 2024 Marek Vasut marek.vasut+renesas@mailbox.org +# +# SPDX-License-Identifier: GPL-2.0+ +#
+# R-Car SoCs +ifndef CONFIG_RZG2L
This is a bit out of context, can you explain why this suddenly is here?
+# 32 bit SoCs +ifdef CONFIG_RCAR_GEN2 +endif
Not sure we need this noop?
Also this probably should rather be CONFIG_RCAR_32 instead?
+# 64 bit SoCs +ifdef CONFIG_RCAR_64 +ifndef CONFIG_XPL_BUILD +obj-y += common.o +endif
+ifdef CONFIG_RCAR_GEN3 +ifdef CONFIG_XPL_BUILD +obj-y += gen3-spl.o +else +obj-y += gen3-common.o +ifdef CONFIG_R8A77970 +obj-y += v3-common.o +endif +ifdef CONFIG_R8A77980 +obj-y += v3-common.o +endif +endif +endif
+ifdef CONFIG_RCAR_GEN4 +ifdef CONFIG_XPL_BUILD +obj-y += gen4-spl.o +else +obj-y += gen4-common.o +endif +endif +endif
+endif diff --git a/board/renesas/common/gen3-common.c b/board/renesas/common/gen3-common.c index 549bec9e137..840ea6d7820 100644 --- a/board/renesas/common/gen3-common.c +++ b/board/renesas/common/gen3-common.c @@ -17,8 +17,6 @@ #include <asm/arch/renesas.h> #include <linux/libfdt.h>
-#ifdef CONFIG_RCAR_64
DECLARE_GLOBAL_DATA_PTR;
/* If the firmware passed a device tree use it for e.g. U-Boot DRAM setup. */
@@ -182,4 +180,3 @@ int ft_board_setup(void *blob, struct bd_info *bd) return 0; } #endif -#endif diff --git a/board/renesas/condor/Makefile b/board/renesas/condor/Makefile deleted file mode 100644 index 3b1756b44cd..00000000000 --- a/board/renesas/condor/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/condor/Makefile -# -# Copyright (C) 2019 Renesas Electronics Corporation -# -# SPDX-License-Identifier: GPL-2.0+ -#
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/gen3-common.o ../common/common.o -endif diff --git a/board/renesas/draak/Makefile b/board/renesas/draak/Makefile index 6ce05bcd649..945cc2134e8 100644 --- a/board/renesas/draak/Makefile +++ b/board/renesas/draak/Makefile @@ -6,8 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := draak.o ../common/gen3-common.o ../common/common.o -endif +obj-y += draak.o diff --git a/board/renesas/draak/draak.c b/board/renesas/draak/draak.c index a51bf65674f..b742b8d6220 100644 --- a/board/renesas/draak/draak.c +++ b/board/renesas/draak/draak.c @@ -6,6 +6,8 @@
- Copyright (C) 2017 Marek Vasut marek.vasut+renesas@gmail.com
*/
+#if !IS_ENABLED(CONFIG_XPL_BUILD)
- #include <cpu_func.h> #include <hang.h> #include <init.h>
@@ -65,3 +67,5 @@ int board_init(void)
return 0; }
+#endif diff --git a/board/renesas/eagle/Makefile b/board/renesas/eagle/Makefile deleted file mode 100644 index a5c18d81eef..00000000000 --- a/board/renesas/eagle/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/eagle/Makefile -# -# Copyright (C) 2015 Renesas Electronics Corporation -# -# SPDX-License-Identifier: GPL-2.0+ -#
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/v3-common.o ../common/gen3-common.o ../common/common.o -endif diff --git a/board/renesas/ebisu/Makefile b/board/renesas/ebisu/Makefile deleted file mode 100644 index 72130b76234..00000000000 --- a/board/renesas/ebisu/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/ebisu/Makefile -# -# Copyright (C) 2018 Renesas Electronics Corporation -# -# SPDX-License-Identifier: GPL-2.0+ -#
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/gen3-common.o ../common/common.o -endif diff --git a/board/renesas/falcon/Makefile b/board/renesas/falcon/Makefile deleted file mode 100644 index 949953f6981..00000000000 --- a/board/renesas/falcon/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/falcon/Makefile -# -# Copyright (C) 2020 Renesas Electronics Corp. -# -# SPDX-License-Identifier: GPL-2.0+ -#
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/gen4-common.o ../common/common.o -endif diff --git a/board/renesas/grayhawk/Makefile b/board/renesas/grayhawk/Makefile deleted file mode 100644 index a70bd3739f1..00000000000 --- a/board/renesas/grayhawk/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# -# board/renesas/grayhawk/Makefile -# -# Copyright (C) 2023 Renesas Electronics Corp. -# -# SPDX-License-Identifier: GPL-2.0+ -#
-obj-y := ../common/gen4-common.o ../common/common.o diff --git a/board/renesas/salvator-x/Makefile b/board/renesas/salvator-x/Makefile index fe53366829c..daea3e6838f 100644 --- a/board/renesas/salvator-x/Makefile +++ b/board/renesas/salvator-x/Makefile @@ -6,8 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := salvator-x.o ../common/gen3-common.o ../common/common.o -endif +obj-y += salvator-x.o diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index 2c8860bcee4..b6fb106ca5d 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -7,6 +7,8 @@
- Copyright (C) 2015 Nobuhiro Iwamatsu iwamatsu@nigauri.org
*/
+#if !IS_ENABLED(CONFIG_XPL_BUILD)
- #include <cpu_func.h> #include <image.h> #include <init.h>
@@ -93,3 +95,5 @@ int board_fit_config_name_match(const char *name) return -1; } #endif
+#endif diff --git a/board/renesas/spider/Makefile b/board/renesas/spider/Makefile deleted file mode 100644 index e0f403d5fcc..00000000000 --- a/board/renesas/spider/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# -# board/renesas/spider/Makefile -# -# Copyright (C) 2020 Renesas Electronics Corp. -# -# SPDX-License-Identifier: GPL-2.0+ -#
-obj-y := ../common/gen4-common.o ../common/common.o diff --git a/board/renesas/ulcb/Makefile b/board/renesas/ulcb/Makefile index 6b2aa8c29f6..4f608613c15 100644 --- a/board/renesas/ulcb/Makefile +++ b/board/renesas/ulcb/Makefile @@ -6,8 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ulcb.o cpld.o ../common/gen3-common.o ../common/common.o -endif +obj-y += ulcb.o cpld.o diff --git a/board/renesas/ulcb/cpld.c b/board/renesas/ulcb/cpld.c index e72e45e3fb4..6a708d86cc8 100644 --- a/board/renesas/ulcb/cpld.c +++ b/board/renesas/ulcb/cpld.c @@ -6,6 +6,8 @@
- Copyright (C) 2017 Cogent Embedded, Inc.
*/
+#if !IS_ENABLED(CONFIG_XPL_BUILD)
- #include <command.h> #include <asm/gpio.h> #include <asm/io.h>
@@ -189,3 +191,5 @@ U_BOOT_DRIVER(sysreset_renesas_ulcb) = { .of_match = renesas_ulcb_sysreset_ids, .priv_auto = sizeof(struct renesas_ulcb_sysreset_priv), };
+#endif diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c index 64f01b123cb..e1445adbb69 100644 --- a/board/renesas/ulcb/ulcb.c +++ b/board/renesas/ulcb/ulcb.c @@ -6,6 +6,8 @@
- Copyright (C) 2017 Renesas Electronics Corporation
*/
+#if !IS_ENABLED(CONFIG_XPL_BUILD)
- #include <image.h> #include <init.h> #include <malloc.h>
@@ -84,3 +86,5 @@ int board_fit_config_name_match(const char *name) return -1; } #endif
+#endif diff --git a/board/renesas/v3hsk/Makefile b/board/renesas/v3hsk/Makefile index 936047cb3d5..0091bc9cd5b 100644 --- a/board/renesas/v3hsk/Makefile +++ b/board/renesas/v3hsk/Makefile @@ -7,9 +7,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/v3-common.o ../common/gen3-common.o ../common/common.o obj-$(CONFIG_SYSRESET) += cpld.o -endif diff --git a/board/renesas/v3hsk/cpld.c b/board/renesas/v3hsk/cpld.c index 1272aec7302..b82622f9c54 100644 --- a/board/renesas/v3hsk/cpld.c +++ b/board/renesas/v3hsk/cpld.c @@ -7,6 +7,8 @@
*/
+#if !IS_ENABLED(CONFIG_XPL_BUILD)
- #include <dm.h> #include <errno.h> #include <i2c.h>
@@ -177,3 +179,5 @@ U_BOOT_DRIVER(sysreset_renesas_v3hsk) = { .probe = renesas_v3hsk_sysreset_probe, .of_match = renesas_v3hsk_sysreset_ids, };
+#endif diff --git a/board/renesas/v3msk/Makefile b/board/renesas/v3msk/Makefile index 21eaddb6c28..fe8bf1ed1ae 100644 --- a/board/renesas/v3msk/Makefile +++ b/board/renesas/v3msk/Makefile @@ -7,9 +7,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else -obj-y := ../common/v3-common.o ../common/gen3-common.o ../common/common.o obj-$(CONFIG_SYSRESET) += cpld.o -endif diff --git a/board/renesas/v3msk/cpld.c b/board/renesas/v3msk/cpld.c index 260755ac746..93f3bf391cd 100644 --- a/board/renesas/v3msk/cpld.c +++ b/board/renesas/v3msk/cpld.c @@ -7,6 +7,8 @@
*/
+#if !IS_ENABLED(CONFIG_XPL_BUILD)
- #include <asm/gpio.h> #include <asm/io.h> #include <dm.h>
@@ -365,3 +367,5 @@ U_BOOT_DRIVER(sysreset_renesas_v3msk) = { .of_match = renesas_v3msk_sysreset_ids, .priv_auto = sizeof(struct renesas_v3msk_sysreset_priv), };
+#endif diff --git a/board/renesas/whitehawk/Makefile b/board/renesas/whitehawk/Makefile deleted file mode 100644 index f10eb82d221..00000000000 --- a/board/renesas/whitehawk/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/whitehawk/Makefile -# -# Copyright (C) 2021 Renesas Electronics Corp. -# -# SPDX-License-Identifier: GPL-2.0+ -#
-ifdef CONFIG_SPL_BUILD -obj-y := ../common/gen4-spl.o -else -obj-y := ../common/gen4-common.o ../common/common.o -endif
This honestly was a bit difficult to review and felt like more than one change was made at once.
The #if !IS_ENABLED(CONFIG_XPL_BUILD) changes could have been made in a separate commit I believe.
In any case, makes sense to me:
Reviewed-by: Quentin Schulz quentin.schulz@cherry.de
Would have liked a link to https://lore.kernel.org/u-boot/20250112223252.179123-1-marek.vasut+renesas@m... to explain why the Makefile cannot be empty in the commit log, but fine like it is.
Thanks! Quentin

On 1/15/25 11:22 AM, Quentin Schulz wrote:
Hi Marek,
On 1/12/25 11:34 PM, Marek Vasut wrote:
Introduce board/renesas/common/Makefile and remove the multiple duplicate copies of obj := ../common/*.o from board Makefiles. Let the build system include the common Makefile using the HAVE_VENDOR_COMMON_LIB and build the common objects that are shared by all the boards that way. No functional change intended.
Thanks for highlighting this HAVE_VENDOR_COMMON_LIB mechanism, I'm now planning on migrating the Theobroma boards to that :) (I would need https://lore.kernel.org/u-boot/20250112223252.179123-1- marek.vasut+renesas@mailbox.org/ though :) ).
Some of the remaining board files which include board specific settings have been updated to use obj-y += to avoid rewriting the board obj-y target and avoid dropping object files from the build.
Board Makefiles cannot be empty, else they do not generate built-in.o, move the CONFIG_XPL_BUILD ifdeffery from Makefiles into .c files to make sure there is always a built-in.o generated from the remaining minimal Makefiles. This will be further cleaned up in follow up patches.
Unrelated, but I misread the commit log and was wondering whether this patch series would work without the additional patch from https:// lore.kernel.org/u-boot/20250112223252.179123-1- marek.vasut+renesas@mailbox.org/ so wanted to build an Rcar defconfig to verify but I'm unable to build r8a779f0_spider_defconfig from master:
/usr/bin/aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/14/ libgcc.a(lse-init.o): in function `init_have_lse_atomics': /builddir/build/BUILD/cross-gcc-14.2.1-build/gcc-14.2.1-20240912/ aarch64-linux-gnu/aarch64-linux-gnu/libgcc/../../../gcc-14.2.1-20240912/ libgcc/config/aarch64/lse-init.c:46:(.text.startup+0xc): undefined reference to `__getauxval'
[...]
collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped compilation terminated. make: *** [Makefile:1812: u-boot] Error 1 make: *** Deleting file 'u-boot'
so cannot check myself.
I'm running Fedora 41.
$ aarch64-linux-gnu-gcc --version aarch64-linux-gnu-gcc (GCC) 14.2.1 20240912 (Red Hat Cross 14.2.1-1)
Debian testing/unstable is at 14.2.0 and spider builds just fine. Do you observe this failure with or without these patches applied ?
[...]
+++ b/board/renesas/common/Makefile @@ -0,0 +1,45 @@ +# +# board/renesas/whitehawk/Makefile +# +# Copyright (C) 2024 Marek Vasut marek.vasut+renesas@mailbox.org +# +# SPDX-License-Identifier: GPL-2.0+ +#
+# R-Car SoCs +ifndef CONFIG_RZG2L
This is a bit out of context, can you explain why this suddenly is here?
Fixed in V2
+# 32 bit SoCs +ifdef CONFIG_RCAR_GEN2 +endif
Not sure we need this noop?
This is preparation for R-Car Gen2 deduplication which might happen sometimes.
Also this probably should rather be CONFIG_RCAR_32 instead?
R-Car Gen2 is the only supported 32bit R-Car . I will have to add both
ifdef RCAR_32 ifdef RCAR_GEN2
[...]
--- a/board/renesas/whitehawk/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# board/renesas/whitehawk/Makefile -# -# Copyright (C) 2021 Renesas Electronics Corp. -# -# SPDX-License-Identifier: GPL-2.0+ -#
-ifdef CONFIG_SPL_BUILD -obj-y := ../common/gen4-spl.o -else -obj-y := ../common/gen4-common.o ../common/common.o -endif
This honestly was a bit difficult to review and felt like more than one change was made at once.
The #if !IS_ENABLED(CONFIG_XPL_BUILD) changes could have been made in a separate commit I believe.
This is actually bogus, so I dropped the whole thing.
The rest is fixed, thanks .

The common.c content is specific to 64-bit R-Car SoCs, rename the file to rcar64-common.c and remove R-Car 64-bit ifdeffery in the file. No functional change.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org --- Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de --- board/beacon/beacon-rzg2m/Makefile | 2 +- board/hoperun/hihope-rzg2/Makefile | 2 +- board/renesas/common/Makefile | 2 +- board/renesas/common/{common.c => rcar64-common.c} | 4 ---- board/silinux/ek874/Makefile | 2 +- 5 files changed, 4 insertions(+), 8 deletions(-) rename board/renesas/common/{common.c => rcar64-common.c} (97%)
diff --git a/board/beacon/beacon-rzg2m/Makefile b/board/beacon/beacon-rzg2m/Makefile index 6a6ae94def8..10b7a7fbfa9 100644 --- a/board/beacon/beacon-rzg2m/Makefile +++ b/board/beacon/beacon-rzg2m/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y := beacon-rzg2m.o ../../renesas/common/gen3-common.o ../../renesas/common/common.o +obj-y := beacon-rzg2m.o ../../renesas/common/gen3-common.o ../../renesas/common/rcar64-common.o diff --git a/board/hoperun/hihope-rzg2/Makefile b/board/hoperun/hihope-rzg2/Makefile index a42c55b9d00..299769c9cb6 100644 --- a/board/hoperun/hihope-rzg2/Makefile +++ b/board/hoperun/hihope-rzg2/Makefile @@ -6,4 +6,4 @@ # SPDX-License-Identifier: GPL-2.0+ #
-obj-y := hihope-rzg2.o ../../renesas/common/gen3-common.o ../../renesas/common/common.o +obj-y := hihope-rzg2.o ../../renesas/common/gen3-common.o ../../renesas/common/rcar64-common.o diff --git a/board/renesas/common/Makefile b/board/renesas/common/Makefile index 2072338ea05..e6dde3c2597 100644 --- a/board/renesas/common/Makefile +++ b/board/renesas/common/Makefile @@ -16,7 +16,7 @@ endif # 64 bit SoCs ifdef CONFIG_RCAR_64 ifndef CONFIG_XPL_BUILD -obj-y += common.o +obj-y += rcar64-common.o endif
ifdef CONFIG_RCAR_GEN3 diff --git a/board/renesas/common/common.c b/board/renesas/common/rcar64-common.c similarity index 97% rename from board/renesas/common/common.c rename to board/renesas/common/rcar64-common.c index 7fba8d10ff5..74ec0a46e6f 100644 --- a/board/renesas/common/common.c +++ b/board/renesas/common/rcar64-common.c @@ -18,8 +18,6 @@ #include <asm/system.h> #include <linux/libfdt.h>
-#ifdef CONFIG_RCAR_64 - DECLARE_GLOBAL_DATA_PTR;
int dram_init(void) @@ -67,5 +65,3 @@ int __weak board_init(void) { return 0; } - -#endif diff --git a/board/silinux/ek874/Makefile b/board/silinux/ek874/Makefile index c1cab6fa788..0beda63d115 100644 --- a/board/silinux/ek874/Makefile +++ b/board/silinux/ek874/Makefile @@ -9,5 +9,5 @@ ifdef CONFIG_XPL_BUILD obj-y := ../../renesas/common/gen3-spl.o else -obj-y := ek874.o ../../renesas/common/gen3-common.o ../../renesas/common/common.o +obj-y := ek874.o ../../renesas/common/gen3-common.o ../../renesas/common/rcar64-common.o endif

Hi Marek,
On 1/12/25 11:34 PM, Marek Vasut wrote:
The common.c content is specific to 64-bit R-Car SoCs, rename the file to rcar64-common.c and remove R-Car 64-bit ifdeffery in the file. No functional change.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org
Reviewed-by: Quentin Schulz quentin.schulz@cherry.de
Thanks! Quentin

On 1/15/25 11:27 AM, Quentin Schulz wrote:
Hi Marek,
Hi,
On 1/12/25 11:34 PM, Marek Vasut wrote:
The common.c content is specific to 64-bit R-Car SoCs, rename the file to rcar64-common.c and remove R-Car 64-bit ifdeffery in the file. No functional change.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org
Reviewed-by: Quentin Schulz quentin.schulz@cherry.de
Since there are going to be significant changes to this series, I'll send a V2 later today, and please give it a once over.

CONFIG_IS_ENABLED(SYS_I2C_LEGACY) is not set on this board, remove the code and also remove all unnecessary headers that are included in this file.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org --- Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de --- board/renesas/draak/draak.c | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-)
diff --git a/board/renesas/draak/draak.c b/board/renesas/draak/draak.c index b742b8d6220..a8c40ff1f07 100644 --- a/board/renesas/draak/draak.c +++ b/board/renesas/draak/draak.c @@ -8,43 +8,17 @@
#if !IS_ENABLED(CONFIG_XPL_BUILD)
-#include <cpu_func.h> -#include <hang.h> -#include <init.h> -#include <malloc.h> -#include <netdev.h> -#include <dm.h> -#include <asm/global_data.h> -#include <dm/platform_data/serial_sh.h> -#include <asm/processor.h> -#include <asm/mach-types.h> #include <asm/io.h> -#include <linux/bitops.h> -#include <linux/errno.h> -#include <asm/arch/sys_proto.h> -#include <asm/gpio.h> -#include <asm/arch/gpio.h> -#include <asm/arch/renesas.h> #include <asm/arch/rcar-mstp.h> -#include <i2c.h> -#include <mmc.h> - -DECLARE_GLOBAL_DATA_PTR; - -#define GSX_MSTP112 BIT(12) /* 3DG */ -#define SCIF2_MSTP310 BIT(10) /* SCIF2 */ -#define DVFS_MSTP926 BIT(26) -#define HSUSB_MSTP704 BIT(4) /* HSUSB */ +#include <asm/arch/renesas.h>
int board_early_init_f(void) { -#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH) - /* DVFS for reset */ - mstp_clrbits_le32(SMSTPCR9, SMSTPCR9, DVFS_MSTP926); -#endif return 0; }
+#define HSUSB_MSTP704 BIT(4) /* HSUSB */ + /* HSUSB block registers */ #define HSUSB_REG_LPSTS 0xE6590102 #define HSUSB_REG_LPSTS_SUSPM_NORMAL BIT(14)

CONFIG_IS_ENABLED(SYS_I2C_LEGACY) is not set on this board, remove the code and also remove all unnecessary headers that are included in this file.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org --- Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de --- board/renesas/salvator-x/salvator-x.c | 38 +++------------------------ 1 file changed, 4 insertions(+), 34 deletions(-)
diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index b6fb106ca5d..abb17c3fdc5 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -9,41 +9,18 @@
#if !IS_ENABLED(CONFIG_XPL_BUILD)
-#include <cpu_func.h> -#include <image.h> -#include <init.h> -#include <malloc.h> -#include <netdev.h> -#include <dm.h> -#include <asm/global_data.h> -#include <dm/platform_data/serial_sh.h> -#include <asm/processor.h> -#include <asm/mach-types.h> #include <asm/io.h> -#include <linux/bitops.h> -#include <linux/errno.h> -#include <asm/arch/sys_proto.h> -#include <asm/gpio.h> -#include <asm/arch/gpio.h> -#include <asm/arch/renesas.h> #include <asm/arch/rcar-mstp.h> -#include <i2c.h> -#include <mmc.h> - -DECLARE_GLOBAL_DATA_PTR; - -#define DVFS_MSTP926 BIT(26) -#define HSUSB_MSTP704 BIT(4) /* HSUSB */ +#include <asm/arch/renesas.h> +#include <init.h>
int board_early_init_f(void) { -#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH) - /* DVFS for reset */ - mstp_clrbits_le32(SMSTPCR9, SMSTPCR9, DVFS_MSTP926); -#endif return 0; }
+#define HSUSB_MSTP704 BIT(4) /* HSUSB */ + /* HSUSB block registers */ #define HSUSB_REG_LPSTS 0xE6590102 #define HSUSB_REG_LPSTS_SUSPM_NORMAL BIT(14) @@ -67,13 +44,6 @@ int board_init(void) return 0; }
-#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH) -void reset_cpu(void) -{ - i2c_reg_write(CONFIG_SYS_I2C_POWERIC_ADDR, 0x20, 0x80); -} -#endif - #ifdef CONFIG_MULTI_DTB_FIT int board_fit_config_name_match(const char *name) {

CONFIG_IS_ENABLED(SYS_I2C_LEGACY) is not set on this board, remove the code and also remove all unnecessary headers that are included in this file.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org --- Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de --- board/renesas/ulcb/ulcb.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-)
diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c index e1445adbb69..a441ff0e0d8 100644 --- a/board/renesas/ulcb/ulcb.c +++ b/board/renesas/ulcb/ulcb.c @@ -8,37 +8,15 @@
#if !IS_ENABLED(CONFIG_XPL_BUILD)
-#include <image.h> -#include <init.h> -#include <malloc.h> -#include <netdev.h> -#include <dm.h> -#include <asm/global_data.h> -#include <dm/platform_data/serial_sh.h> -#include <asm/processor.h> -#include <asm/mach-types.h> #include <asm/io.h> -#include <linux/bitops.h> -#include <linux/errno.h> -#include <asm/arch/sys_proto.h> -#include <asm/gpio.h> -#include <asm/arch/gpio.h> -#include <asm/arch/renesas.h> #include <asm/arch/rcar-mstp.h> -#include <i2c.h> -#include <mmc.h> - -DECLARE_GLOBAL_DATA_PTR; +#include <asm/arch/renesas.h> +#include <init.h>
-#define DVFS_MSTP926 BIT(26) #define HSUSB_MSTP704 BIT(4) /* HSUSB */
int board_early_init_f(void) { -#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) && defined(CONFIG_SYS_I2C_SH) - /* DVFS for reset */ - mstp_clrbits_le32(SMSTPCR9, SMSTPCR9, DVFS_MSTP926); -#endif return 0; }

Introduce common weak board_early_init_f() in rcar64-common.c which is the default implementation in case there is no other board specific board_early_init_f(). Remove board_early_init_f() from Salvator-X, ULCB and Draak boards where this function is empty.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org --- Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de --- board/renesas/common/rcar64-common.c | 5 +++++ board/renesas/draak/draak.c | 5 ----- board/renesas/salvator-x/salvator-x.c | 5 ----- board/renesas/ulcb/ulcb.c | 5 ----- 4 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/board/renesas/common/rcar64-common.c b/board/renesas/common/rcar64-common.c index 74ec0a46e6f..69229ea3cb0 100644 --- a/board/renesas/common/rcar64-common.c +++ b/board/renesas/common/rcar64-common.c @@ -65,3 +65,8 @@ int __weak board_init(void) { return 0; } + +int __weak board_early_init_f(void) +{ + return 0; +} diff --git a/board/renesas/draak/draak.c b/board/renesas/draak/draak.c index a8c40ff1f07..6caa63d553f 100644 --- a/board/renesas/draak/draak.c +++ b/board/renesas/draak/draak.c @@ -12,11 +12,6 @@ #include <asm/arch/rcar-mstp.h> #include <asm/arch/renesas.h>
-int board_early_init_f(void) -{ - return 0; -} - #define HSUSB_MSTP704 BIT(4) /* HSUSB */
/* HSUSB block registers */ diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index abb17c3fdc5..9bfcf0d66ad 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -14,11 +14,6 @@ #include <asm/arch/renesas.h> #include <init.h>
-int board_early_init_f(void) -{ - return 0; -} - #define HSUSB_MSTP704 BIT(4) /* HSUSB */
/* HSUSB block registers */ diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c index a441ff0e0d8..bd06db23b16 100644 --- a/board/renesas/ulcb/ulcb.c +++ b/board/renesas/ulcb/ulcb.c @@ -15,11 +15,6 @@
#define HSUSB_MSTP704 BIT(4) /* HSUSB */
-int board_early_init_f(void) -{ - return 0; -} - /* HSUSB block registers */ #define HSUSB_REG_LPSTS 0xE6590102 #define HSUSB_REG_LPSTS_SUSPM_NORMAL BIT(14)

On Sun, Jan 12, 2025 at 4:36 PM Marek Vasut marek.vasut+renesas@mailbox.org wrote:
Introduce common weak board_early_init_f() in rcar64-common.c which is the default implementation in case there is no other board specific board_early_init_f(). Remove board_early_init_f() from Salvator-X, ULCB and Draak boards where this function is empty.
Isn't there a config option to enable/disable board_early_init_f? If they are do-nothing functions, can the config option be disabled?
adam
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org
Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de
board/renesas/common/rcar64-common.c | 5 +++++ board/renesas/draak/draak.c | 5 ----- board/renesas/salvator-x/salvator-x.c | 5 ----- board/renesas/ulcb/ulcb.c | 5 ----- 4 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/board/renesas/common/rcar64-common.c b/board/renesas/common/rcar64-common.c index 74ec0a46e6f..69229ea3cb0 100644 --- a/board/renesas/common/rcar64-common.c +++ b/board/renesas/common/rcar64-common.c @@ -65,3 +65,8 @@ int __weak board_init(void) { return 0; }
+int __weak board_early_init_f(void) +{
return 0;
+} diff --git a/board/renesas/draak/draak.c b/board/renesas/draak/draak.c index a8c40ff1f07..6caa63d553f 100644 --- a/board/renesas/draak/draak.c +++ b/board/renesas/draak/draak.c @@ -12,11 +12,6 @@ #include <asm/arch/rcar-mstp.h> #include <asm/arch/renesas.h>
-int board_early_init_f(void) -{
return 0;
-}
#define HSUSB_MSTP704 BIT(4) /* HSUSB */
/* HSUSB block registers */ diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index abb17c3fdc5..9bfcf0d66ad 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -14,11 +14,6 @@ #include <asm/arch/renesas.h> #include <init.h>
-int board_early_init_f(void) -{
return 0;
-}
#define HSUSB_MSTP704 BIT(4) /* HSUSB */
/* HSUSB block registers */ diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c index a441ff0e0d8..bd06db23b16 100644 --- a/board/renesas/ulcb/ulcb.c +++ b/board/renesas/ulcb/ulcb.c @@ -15,11 +15,6 @@
#define HSUSB_MSTP704 BIT(4) /* HSUSB */
-int board_early_init_f(void) -{
return 0;
-}
/* HSUSB block registers */ #define HSUSB_REG_LPSTS 0xE6590102
#define HSUSB_REG_LPSTS_SUSPM_NORMAL BIT(14)
2.45.2

On 1/13/25 4:40 PM, Adam Ford wrote:
On Sun, Jan 12, 2025 at 4:36 PM Marek Vasut marek.vasut+renesas@mailbox.org wrote:
Introduce common weak board_early_init_f() in rcar64-common.c which is the default implementation in case there is no other board specific board_early_init_f(). Remove board_early_init_f() from Salvator-X, ULCB and Draak boards where this function is empty.
Isn't there a config option to enable/disable board_early_init_f? If they are do-nothing functions, can the config option be disabled?
There is , but I am still on the fence whether it wouldn't be better to remove it in favor of weak symbol, which would get optimized out. I think it is more user friendly as user does not have to fiddle with any config options, only fill in the non-weak symbol with content in their board file and it automatically takes effect.

Move R-Car Gen3 and Gen4 jump_to_image_no_args() into dedicated rcar64-spl.c file. The implementation of jump_to_image_no_args() is identical. No functional change.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org --- Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de --- board/renesas/common/Makefile | 4 +++- board/renesas/common/gen3-spl.c | 21 --------------------- board/renesas/common/gen4-spl.c | 17 ----------------- board/renesas/common/rcar64-spl.c | 24 ++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 39 deletions(-) create mode 100644 board/renesas/common/rcar64-spl.c
diff --git a/board/renesas/common/Makefile b/board/renesas/common/Makefile index e6dde3c2597..7a9f3a25440 100644 --- a/board/renesas/common/Makefile +++ b/board/renesas/common/Makefile @@ -15,7 +15,9 @@ endif
# 64 bit SoCs ifdef CONFIG_RCAR_64 -ifndef CONFIG_XPL_BUILD +ifdef CONFIG_XPL_BUILD +obj-y += rcar64-spl.o +else obj-y += rcar64-common.o endif
diff --git a/board/renesas/common/gen3-spl.c b/board/renesas/common/gen3-spl.c index 44a20cef2df..9590b5d6a2e 100644 --- a/board/renesas/common/gen3-spl.c +++ b/board/renesas/common/gen3-spl.c @@ -5,13 +5,9 @@ * Copyright (C) 2019 Marek Vasut marek.vasut@gmail.com */
-#include <cpu_func.h> -#include <image.h> #include <init.h> -#include <log.h> #include <asm/io.h> #include <spl.h> -#include <linux/bitops.h>
#define RCAR_CNTC_BASE 0xE6080000 #define CNTCR_EN BIT(0) @@ -33,23 +29,6 @@ u32 spl_boot_device(void) return BOOT_DEVICE_UART; }
-void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) -{ - debug("image entry point: 0x%lx\n", spl_image->entry_point); - if (spl_image->os == IH_OS_ARM_TRUSTED_FIRMWARE) { - typedef void (*image_entry_arg_t)(int, int, int, int) - __attribute__ ((noreturn)); - image_entry_arg_t image_entry = - (image_entry_arg_t)(uintptr_t) spl_image->entry_point; - image_entry(IH_MAGIC, CONFIG_SPL_TEXT_BASE, 0, 0); - } else { - typedef void __noreturn (*image_entry_noargs_t)(void); - image_entry_noargs_t image_entry = - (image_entry_noargs_t)spl_image->entry_point; - image_entry(); - } -} - void s_init(void) { } diff --git a/board/renesas/common/gen4-spl.c b/board/renesas/common/gen4-spl.c index 2aca8baf3dd..e46ef0a3075 100644 --- a/board/renesas/common/gen4-spl.c +++ b/board/renesas/common/gen4-spl.c @@ -76,23 +76,6 @@ struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size) return map_sysmem(CONFIG_SYS_LOAD_ADDR + offset, 0); }
-void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) -{ - debug("image entry point: 0x%lx\n", spl_image->entry_point); - if (spl_image->os == IH_OS_ARM_TRUSTED_FIRMWARE) { - typedef void (*image_entry_arg_t)(int, int, int, int) - __attribute__ ((noreturn)); - image_entry_arg_t image_entry = - (image_entry_arg_t)(uintptr_t) spl_image->entry_point; - image_entry(IH_MAGIC, CONFIG_SPL_TEXT_BASE, 0, 0); - } else { - typedef void __noreturn (*image_entry_noargs_t)(void); - image_entry_noargs_t image_entry = - (image_entry_noargs_t)spl_image->entry_point; - image_entry(); - } -} - #define APMU_BASE 0xe6170000U #define CL0GRP3_BIT BIT(3) #define CL1GRP3_BIT BIT(7) diff --git a/board/renesas/common/rcar64-spl.c b/board/renesas/common/rcar64-spl.c new file mode 100644 index 00000000000..76f2bde924e --- /dev/null +++ b/board/renesas/common/rcar64-spl.c @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2024 Marek Vasut marek.vasut+renesas@mailbox.org + */ + +#include <image.h> +#include <spl.h> + +void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) +{ + debug("image entry point: 0x%lx\n", spl_image->entry_point); + if (spl_image->os == IH_OS_ARM_TRUSTED_FIRMWARE) { + typedef void (*image_entry_arg_t)(int, int, int, int) + __attribute__ ((noreturn)); + image_entry_arg_t image_entry = + (image_entry_arg_t)(uintptr_t) spl_image->entry_point; + image_entry(IH_MAGIC, CONFIG_SPL_TEXT_BASE, 0, 0); + } else { + typedef void __noreturn (*image_entry_noargs_t)(void); + image_entry_noargs_t image_entry = + (image_entry_noargs_t)spl_image->entry_point; + image_entry(); + } +}

Hi Marek,
On 1/12/25 11:34 PM, Marek Vasut wrote:
Move R-Car Gen3 and Gen4 jump_to_image_no_args() into dedicated rcar64-spl.c file. The implementation of jump_to_image_no_args() is identical. No functional change.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org
This is just factoring code and looks fine to me,
Reviewed-by: Quentin Schulz quentin.schulz@cherry.de
Cc: Adam Ford aford173@gmail.com Cc: Biju Das biju.das.jz@bp.renesas.com Cc: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org Cc: Paul Barker paul.barker.ct@bp.renesas.com Cc: Simon Glass sjg@chromium.org Cc: Tom Rini trini@konsulko.com Cc: u-boot@lists.denx.de
board/renesas/common/Makefile | 4 +++- board/renesas/common/gen3-spl.c | 21 --------------------- board/renesas/common/gen4-spl.c | 17 ----------------- board/renesas/common/rcar64-spl.c | 24 ++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 39 deletions(-) create mode 100644 board/renesas/common/rcar64-spl.c
diff --git a/board/renesas/common/Makefile b/board/renesas/common/Makefile index e6dde3c2597..7a9f3a25440 100644 --- a/board/renesas/common/Makefile +++ b/board/renesas/common/Makefile @@ -15,7 +15,9 @@ endif
# 64 bit SoCs ifdef CONFIG_RCAR_64 -ifndef CONFIG_XPL_BUILD +ifdef CONFIG_XPL_BUILD +obj-y += rcar64-spl.o +else obj-y += rcar64-common.o endif
Wondering if we couldn't use variables to make the Makefile a bit easier on the eye (though not necessarily more readable)?
Something like
ifdef CONFIG_XPL_BUILD SPL_COMMON := spl else SPL_COMMON := common endif
obj-y += rcar64-$(SPL_COMMON).o
Then we could use it for gen3 and gen4 object files as well for example.
I really struggle to parse Makefile/C code when there are a lot of ifdefs especially once they get nested, but maybe that's just me :)
Thanks! Quentin

On 1/15/25 11:34 AM, Quentin Schulz wrote:
[...]
Wondering if we couldn't use variables to make the Makefile a bit easier on the eye (though not necessarily more readable)?
Something like
ifdef CONFIG_XPL_BUILD SPL_COMMON := spl else SPL_COMMON := common endif
obj-y += rcar64-$(SPL_COMMON).o
Then we could use it for gen3 and gen4 object files as well for example.
I really struggle to parse Makefile/C code when there are a lot of ifdefs especially once they get nested, but maybe that's just me :)
What I would like even a bit more would be:
obj-$(!SYMBOL) +=
An inverted match, add stuff into build if symbol is not set.

Hi Marek,
On 1/12/25 11:34 PM, Marek Vasut wrote:
Rename directory board/renesas/rcar-common to board/renesas/common and move files. This allows the build system to use HAVE_VENDOR_COMMON_LIB which automatically includes board/$(VENDOR)/common/Makefile . This is
Please mention this is NOT sufficient to make use of HAVE_VENDOR_COMMON_LIB as board/renesas/common is missing a Makefile.
Something like:
This will allow the build system to use HAVE_VENDOR_COMMON_LIB once a Makefile is added in a later commit. This mechanism automatically includes board/$(VENDOR)/common/Makefile.
or something like that.
a preparatory patch for board Makefile simplification. No functional change so far.
Signed-off-by: Marek Vasut marek.vasut+renesas@mailbox.org
The change is fine, but please make the commit log a bit less confusing around the use of HAVE_VENDOR_COMMON_LIB in this commit.
Reviewed-by: Quentin Schulz quentin.schulz@cherry.de
Thanks! Quentin
participants (4)
-
Adam Ford
-
Marek Vasut
-
Marek Vasut
-
Quentin Schulz