From 4cf712a3be84de9c4bc8273b6734684e2b0b4e49 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 18 Jan 2025 07:14:35 +0100 Subject: [PATCH 01/12] net: miiphybb: configs: Drop CONFIG_BITBANGMII_MULTI It seems that every remaining system which enables BITBANGMII also enables BITBANGMII_MULTI . Remove the BITBANGMII_MULTI symbol and assume it is always enabled. This allows removal of a bit of legacy code. No functional change intended. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- configs/alt_defconfig | 1 - configs/controlcenterdc_defconfig | 1 - configs/gose_defconfig | 1 - configs/grpeach_defconfig | 1 - configs/koelsch_defconfig | 1 - configs/lager_defconfig | 1 - configs/porter_defconfig | 1 - configs/r8a779a0_falcon_defconfig | 1 - configs/r8a779g0_whitehawk_defconfig | 1 - configs/r8a779h0_grayhawk_defconfig | 1 - configs/renesas_rcar3.config | 1 - configs/silk_defconfig | 1 - configs/stout_defconfig | 1 - doc/README.bitbangMII | 25 ++------ drivers/net/phy/Kconfig | 4 -- drivers/net/phy/miiphybb.c | 89 ---------------------------- include/miiphy.h | 2 - 17 files changed, 4 insertions(+), 129 deletions(-) diff --git a/configs/alt_defconfig b/configs/alt_defconfig index 488115d9a5c..7b16923e34d 100644 --- a/configs/alt_defconfig +++ b/configs/alt_defconfig @@ -38,7 +38,6 @@ CONFIG_SH_MMCIF=y CONFIG_DM_MTD=y CONFIG_SPI_FLASH_MTD=y CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ8XXX=y CONFIG_SH_ETHER=y diff --git a/configs/controlcenterdc_defconfig b/configs/controlcenterdc_defconfig index 2d6c83a5d5f..e6242e22509 100644 --- a/configs/controlcenterdc_defconfig +++ b/configs/controlcenterdc_defconfig @@ -85,7 +85,6 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_MV=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_ANEG_TIMEOUT=8000 CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y diff --git a/configs/gose_defconfig b/configs/gose_defconfig index d212f91bf83..b53f2f37409 100644 --- a/configs/gose_defconfig +++ b/configs/gose_defconfig @@ -36,7 +36,6 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k CONFIG_DM_MTD=y CONFIG_SPI_FLASH_MTD=y CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ8XXX=y CONFIG_SH_ETHER=y diff --git a/configs/grpeach_defconfig b/configs/grpeach_defconfig index a4005438c19..d2cc1cf7981 100644 --- a/configs/grpeach_defconfig +++ b/configs/grpeach_defconfig @@ -52,7 +52,6 @@ CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_SMSC=y CONFIG_DM_ETH_PHY=y CONFIG_SH_ETHER=y diff --git a/configs/koelsch_defconfig b/configs/koelsch_defconfig index 9bce9e33104..eeb97474b2a 100644 --- a/configs/koelsch_defconfig +++ b/configs/koelsch_defconfig @@ -36,7 +36,6 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k CONFIG_DM_MTD=y CONFIG_SPI_FLASH_MTD=y CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ8XXX=y CONFIG_SH_ETHER=y diff --git a/configs/lager_defconfig b/configs/lager_defconfig index 0d4eed0ddf7..b5682526c8c 100644 --- a/configs/lager_defconfig +++ b/configs/lager_defconfig @@ -38,7 +38,6 @@ CONFIG_SH_MMCIF=y CONFIG_DM_MTD=y CONFIG_SPI_FLASH_MTD=y CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ8XXX=y CONFIG_SH_ETHER=y diff --git a/configs/porter_defconfig b/configs/porter_defconfig index 98a67bee3e0..cb18024da12 100644 --- a/configs/porter_defconfig +++ b/configs/porter_defconfig @@ -36,7 +36,6 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k CONFIG_DM_MTD=y CONFIG_SPI_FLASH_MTD=y CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ8XXX=y CONFIG_SH_ETHER=y diff --git a/configs/r8a779a0_falcon_defconfig b/configs/r8a779a0_falcon_defconfig index aae4406bf04..f4f5c57451f 100644 --- a/configs/r8a779a0_falcon_defconfig +++ b/configs/r8a779a0_falcon_defconfig @@ -17,7 +17,6 @@ CONFIG_DEFAULT_FDT_FILE="r8a779a0-falcon.dtb" CONFIG_SYS_PBSIZE=2068 CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_RENESAS_RAVB=y diff --git a/configs/r8a779g0_whitehawk_defconfig b/configs/r8a779g0_whitehawk_defconfig index c74051d1af9..b49a81dcd49 100644 --- a/configs/r8a779g0_whitehawk_defconfig +++ b/configs/r8a779g0_whitehawk_defconfig @@ -19,7 +19,6 @@ CONFIG_SYS_CBSIZE=2048 CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_MMC_ENV_PART=2 CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_RENESAS_RAVB=y diff --git a/configs/r8a779h0_grayhawk_defconfig b/configs/r8a779h0_grayhawk_defconfig index ef709214f03..5b9ad93a596 100644 --- a/configs/r8a779h0_grayhawk_defconfig +++ b/configs/r8a779h0_grayhawk_defconfig @@ -16,7 +16,6 @@ CONFIG_SYS_CBSIZE=2048 CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_MMC_ENV_PART=2 CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_RENESAS_RAVB=y diff --git a/configs/renesas_rcar3.config b/configs/renesas_rcar3.config index 7f7fab7df1d..9f2413ae928 100644 --- a/configs/renesas_rcar3.config +++ b/configs/renesas_rcar3.config @@ -1,5 +1,4 @@ #include CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_SYS_PBSIZE=2068 diff --git a/configs/silk_defconfig b/configs/silk_defconfig index 53597e9dd4d..1c70a16bf5b 100644 --- a/configs/silk_defconfig +++ b/configs/silk_defconfig @@ -38,7 +38,6 @@ CONFIG_SH_MMCIF=y CONFIG_DM_MTD=y CONFIG_SPI_FLASH_MTD=y CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ8XXX=y CONFIG_SH_ETHER=y diff --git a/configs/stout_defconfig b/configs/stout_defconfig index a25a5627c2c..59bb7075013 100644 --- a/configs/stout_defconfig +++ b/configs/stout_defconfig @@ -36,7 +36,6 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k CONFIG_DM_MTD=y CONFIG_SPI_FLASH_MTD=y CONFIG_BITBANGMII=y -CONFIG_BITBANGMII_MULTI=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ8XXX=y CONFIG_SH_ETHER=y diff --git a/doc/README.bitbangMII b/doc/README.bitbangMII index 0a2fa48a56f..05ab20376f3 100644 --- a/doc/README.bitbangMII +++ b/doc/README.bitbangMII @@ -7,28 +7,11 @@ The driver requires that the following macros should be defined into the board configuration file: CONFIG_BITBANGMII - Enable the miiphybb driver -CONFIG_BITBANGMII_MULTI - Enable the multi bus support -If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs -to define at least the following macros: - -MII_INIT - Generic code to enable the MII bus (optional) -MDIO_DECLARE - Declaration needed to access to the MDIO pin (optional) -MDIO_ACTIVE - Activate the MDIO pin as out pin -MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin -MDIO_READ - Read the MDIO pin -MDIO(v) - Write v on the MDIO pin -MDC_DECLARE - Declaration needed to access to the MDC pin (optional) -MDC(v) - Write v on the MDC pin - -The previous macros make the driver compatible with the previous version -(that didn't support the multi-bus). - -When the CONFIG_BITBANGMII_MULTI is also defined, the board code needs to fill -the bb_miiphy_buses[] array with a record for each required bus and declare -the bb_miiphy_buses_num variable with the number of mii buses. -The record (struct bb_miiphy_bus) has the following fields/callbacks (see -miiphy.h for details): +The board code needs to fill the bb_miiphy_buses[] array with a record for +each required bus and declare the bb_miiphy_buses_num variable with the +number of mii buses. The record (struct bb_miiphy_bus) has the following +fields/callbacks (see miiphy.h for details): char name[] - The symbolic name that must be equal to the MII bus registered name diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 13e73810ad6..3132718e4f8 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -2,10 +2,6 @@ config BITBANGMII bool "Bit-banged ethernet MII management channel support" -config BITBANGMII_MULTI - bool "Enable the multi bus support" - depends on BITBANGMII - config MV88E6352_SWITCH bool "Marvell 88E6352 switch support" diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c index b143137893f..171c1719b5b 100644 --- a/drivers/net/phy/miiphybb.c +++ b/drivers/net/phy/miiphybb.c @@ -17,90 +17,6 @@ #include #include -#ifndef CONFIG_BITBANGMII_MULTI - -/* - * If CONFIG_BITBANGMII_MULTI is not defined we use a - * compatibility layer with the previous miiphybb implementation - * based on macros usage. - * - */ -static int bb_mii_init_wrap(struct bb_miiphy_bus *bus) -{ -#ifdef MII_INIT - MII_INIT; -#endif - return 0; -} - -static int bb_mdio_active_wrap(struct bb_miiphy_bus *bus) -{ -#ifdef MDIO_DECLARE - MDIO_DECLARE; -#endif - MDIO_ACTIVE; - return 0; -} - -static int bb_mdio_tristate_wrap(struct bb_miiphy_bus *bus) -{ -#ifdef MDIO_DECLARE - MDIO_DECLARE; -#endif - MDIO_TRISTATE; - return 0; -} - -static int bb_set_mdio_wrap(struct bb_miiphy_bus *bus, int v) -{ -#ifdef MDIO_DECLARE - MDIO_DECLARE; -#endif - MDIO(v); - return 0; -} - -static int bb_get_mdio_wrap(struct bb_miiphy_bus *bus, int *v) -{ -#ifdef MDIO_DECLARE - MDIO_DECLARE; -#endif - *v = MDIO_READ; - return 0; -} - -static int bb_set_mdc_wrap(struct bb_miiphy_bus *bus, int v) -{ -#ifdef MDC_DECLARE - MDC_DECLARE; -#endif - MDC(v); - return 0; -} - -static int bb_delay_wrap(struct bb_miiphy_bus *bus) -{ - MIIDELAY; - return 0; -} - -struct bb_miiphy_bus bb_miiphy_buses[] = { - { - .name = BB_MII_DEVNAME, - .init = bb_mii_init_wrap, - .mdio_active = bb_mdio_active_wrap, - .mdio_tristate = bb_mdio_tristate_wrap, - .set_mdio = bb_set_mdio_wrap, - .get_mdio = bb_get_mdio_wrap, - .set_mdc = bb_set_mdc_wrap, - .delay = bb_delay_wrap, - } -}; - -int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) / - sizeof(bb_miiphy_buses[0]); -#endif - int bb_miiphy_init(void) { int i; @@ -114,7 +30,6 @@ int bb_miiphy_init(void) static inline struct bb_miiphy_bus *bb_miiphy_getbus(const char *devname) { -#ifdef CONFIG_BITBANGMII_MULTI int i; /* Search the correct bus */ @@ -124,10 +39,6 @@ static inline struct bb_miiphy_bus *bb_miiphy_getbus(const char *devname) } } return NULL; -#else - /* We have just one bitbanging bus */ - return &bb_miiphy_buses[0]; -#endif } /***************************************************************************** diff --git a/include/miiphy.h b/include/miiphy.h index 5abffd8fb6b..2bb4f62ea76 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -72,9 +72,7 @@ struct bb_miiphy_bus { int (*get_mdio)(struct bb_miiphy_bus *bus, int *v); int (*set_mdc)(struct bb_miiphy_bus *bus, int v); int (*delay)(struct bb_miiphy_bus *bus); -#ifdef CONFIG_BITBANGMII_MULTI void *priv; -#endif }; extern struct bb_miiphy_bus bb_miiphy_buses[]; From 25f19f4158bcaa0cb85abb49e32c52b9a95201aa Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 18 Jan 2025 07:12:47 +0100 Subject: [PATCH 02/12] net: ravb: Staticize bb_miiphy functions These functions can be static as they are referenced only in this file. Make them static. No functional change. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- drivers/net/ravb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c index 231764e60b5..7286ad19598 100644 --- a/drivers/net/ravb.c +++ b/drivers/net/ravb.c @@ -560,12 +560,12 @@ static int ravb_remove(struct udevice *dev) return 0; } -int ravb_bb_init(struct bb_miiphy_bus *bus) +static int ravb_bb_init(struct bb_miiphy_bus *bus) { return 0; } -int ravb_bb_mdio_active(struct bb_miiphy_bus *bus) +static int ravb_bb_mdio_active(struct bb_miiphy_bus *bus) { struct ravb_priv *eth = bus->priv; @@ -574,7 +574,7 @@ int ravb_bb_mdio_active(struct bb_miiphy_bus *bus) return 0; } -int ravb_bb_mdio_tristate(struct bb_miiphy_bus *bus) +static int ravb_bb_mdio_tristate(struct bb_miiphy_bus *bus) { struct ravb_priv *eth = bus->priv; @@ -583,7 +583,7 @@ int ravb_bb_mdio_tristate(struct bb_miiphy_bus *bus) return 0; } -int ravb_bb_set_mdio(struct bb_miiphy_bus *bus, int v) +static int ravb_bb_set_mdio(struct bb_miiphy_bus *bus, int v) { struct ravb_priv *eth = bus->priv; @@ -595,7 +595,7 @@ int ravb_bb_set_mdio(struct bb_miiphy_bus *bus, int v) return 0; } -int ravb_bb_get_mdio(struct bb_miiphy_bus *bus, int *v) +static int ravb_bb_get_mdio(struct bb_miiphy_bus *bus, int *v) { struct ravb_priv *eth = bus->priv; @@ -604,7 +604,7 @@ int ravb_bb_get_mdio(struct bb_miiphy_bus *bus, int *v) return 0; } -int ravb_bb_set_mdc(struct bb_miiphy_bus *bus, int v) +static int ravb_bb_set_mdc(struct bb_miiphy_bus *bus, int v) { struct ravb_priv *eth = bus->priv; @@ -616,7 +616,7 @@ int ravb_bb_set_mdc(struct bb_miiphy_bus *bus, int v) return 0; } -int ravb_bb_delay(struct bb_miiphy_bus *bus) +static int ravb_bb_delay(struct bb_miiphy_bus *bus) { udelay(10); From d624a3e9abcb363e647f9bb6d4ba03de39091416 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 25 Jan 2025 13:17:57 +0100 Subject: [PATCH 03/12] net: miiphybb: Fix short name length Multiple drivers copy the MDIO instance name from struct mii_phy to struct bb_miiphy_bus, but the name field in these two structs have different lengths, the bb_miiphy_bus one is 16 bytes, the source one is 32 bytes. Make sure these two lengths are always synchronized, use MDIO_NAME_LEN for both. Reviewed-by: Paul Barker Signed-off-by: Marek Vasut --- include/miiphy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/miiphy.h b/include/miiphy.h index 2bb4f62ea76..1e6c7041fdc 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -64,7 +64,7 @@ void mdio_list_devices(void); #define BB_MII_DEVNAME "bb_miiphy" struct bb_miiphy_bus { - char name[16]; + char name[MDIO_NAME_LEN]; int (*init)(struct bb_miiphy_bus *bus); int (*mdio_active)(struct bb_miiphy_bus *bus); int (*mdio_tristate)(struct bb_miiphy_bus *bus); From 68abd1c3083ead0f79aa9f5e3e9951a769af66d7 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 29 Jan 2025 18:04:26 +0100 Subject: [PATCH 04/12] 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 . Create temporarily empty board/renesas/common/Makefile to be extended with actual content later in this series. This is a preparatory patch for board Makefile simplification. No functional change so far. Reviewed-by: Quentin Schulz Signed-off-by: Marek Vasut --- board/beacon/beacon-rzg2m/Makefile | 2 +- board/hoperun/hihope-rzg2/Makefile | 2 +- board/renesas/common/Makefile | 0 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 ++-- 22 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 board/renesas/common/Makefile 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/common/Makefile b/board/renesas/common/Makefile new file mode 100644 index 00000000000..e69de29bb2d 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 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 004feca6180..05b01c846c6 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 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 From 5a287cf07aed6a60e25af903ea24bc0030d493b1 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 29 Jan 2025 18:04:27 +0100 Subject: [PATCH 05/12] ARM: renesas: Drop R8A779A0 V3U Falcon SPL Makefile entry The SPL on R-Car V3U Falcon is never built, remove the Makefile entry. Signed-off-by: Marek Vasut Reviewed-by: Quentin Schulz --- board/renesas/falcon/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/board/renesas/falcon/Makefile b/board/renesas/falcon/Makefile index 949953f6981..430a842081a 100644 --- a/board/renesas/falcon/Makefile +++ b/board/renesas/falcon/Makefile @@ -6,8 +6,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -ifdef CONFIG_XPL_BUILD -obj-y := ../common/gen3-spl.o -else +ifndef CONFIG_XPL_BUILD obj-y := ../common/gen4-common.o ../common/common.o endif From c7d2d7f90a91f43f5609d021e966e04d45da2c1f Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 29 Jan 2025 18:04:28 +0100 Subject: [PATCH 06/12] ARM: renesas: Simplify board Makefiles 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. The board/renesas/common/Makefile is now also used when building RZG2L targets which also set CONFIG_RCAR_64 symbol and 32bit R-Car Gen2 targets, however, this common code is specific to 64bit R-Car only. Inhibit the build of this common code for RZG2L using extra ifndef CONFIG_RZG2L and do not include any code for R-Car Gen2 so far. Signed-off-by: Marek Vasut Reviewed-by: Quentin Schulz --- board/renesas/common/Makefile | 47 ++++++++++++++++++++++++++++++ board/renesas/common/common.c | 4 --- board/renesas/common/gen3-common.c | 3 -- board/renesas/condor/Makefile | 13 --------- board/renesas/draak/Makefile | 6 ++-- board/renesas/eagle/Makefile | 13 --------- board/renesas/ebisu/Makefile | 13 --------- board/renesas/falcon/Makefile | 11 ------- board/renesas/grayhawk/Makefile | 9 ------ board/renesas/salvator-x/Makefile | 6 ++-- board/renesas/spider/Makefile | 9 ------ board/renesas/ulcb/Makefile | 6 ++-- board/renesas/v3hsk/Makefile | 5 +--- board/renesas/v3msk/Makefile | 5 +--- board/renesas/whitehawk/Makefile | 13 --------- 15 files changed, 55 insertions(+), 108 deletions(-) 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 index e69de29bb2d..c531738b22e 100644 --- a/board/renesas/common/Makefile +++ b/board/renesas/common/Makefile @@ -0,0 +1,47 @@ +# +# board/renesas/whitehawk/Makefile +# +# Copyright (C) 2024 Marek Vasut +# +# SPDX-License-Identifier: GPL-2.0+ +# + +# R-Car SoCs +ifndef CONFIG_RZG2L + +# 32 bit SoCs +ifdef CONFIG_RCAR_32 +ifdef CONFIG_RCAR_GEN2 +endif +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/common.c b/board/renesas/common/common.c index 7fba8d10ff5..74ec0a46e6f 100644 --- a/board/renesas/common/common.c +++ b/board/renesas/common/common.c @@ -18,8 +18,6 @@ #include #include -#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/renesas/common/gen3-common.c b/board/renesas/common/gen3-common.c index 05b01c846c6..94da00985d3 100644 --- a/board/renesas/common/gen3-common.c +++ b/board/renesas/common/gen3-common.c @@ -18,8 +18,6 @@ #include #include -#ifdef CONFIG_RCAR_64 - DECLARE_GLOBAL_DATA_PTR; /* If the firmware passed a device tree use it for e.g. U-Boot DRAM setup. */ @@ -178,4 +176,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..0a6a325d761 100644 --- a/board/renesas/draak/Makefile +++ b/board/renesas/draak/Makefile @@ -6,8 +6,6 @@ # 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 +ifndef CONFIG_XPL_BUILD +obj-y += draak.o 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 430a842081a..00000000000 --- a/board/renesas/falcon/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# -# board/renesas/falcon/Makefile -# -# Copyright (C) 2020 Renesas Electronics Corp. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -ifndef CONFIG_XPL_BUILD -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..538bbdddf76 100644 --- a/board/renesas/salvator-x/Makefile +++ b/board/renesas/salvator-x/Makefile @@ -6,8 +6,6 @@ # 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 +ifndef CONFIG_XPL_BUILD +obj-y += salvator-x.o 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..4f2dd1ca211 100644 --- a/board/renesas/ulcb/Makefile +++ b/board/renesas/ulcb/Makefile @@ -6,8 +6,6 @@ # 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 +ifndef CONFIG_XPL_BUILD +obj-y += ulcb.o cpld.o endif diff --git a/board/renesas/v3hsk/Makefile b/board/renesas/v3hsk/Makefile index 936047cb3d5..e6db77468e6 100644 --- a/board/renesas/v3hsk/Makefile +++ b/board/renesas/v3hsk/Makefile @@ -7,9 +7,6 @@ # 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 +ifndef CONFIG_XPL_BUILD obj-$(CONFIG_SYSRESET) += cpld.o endif diff --git a/board/renesas/v3msk/Makefile b/board/renesas/v3msk/Makefile index 21eaddb6c28..211b8a32489 100644 --- a/board/renesas/v3msk/Makefile +++ b/board/renesas/v3msk/Makefile @@ -7,9 +7,6 @@ # 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 +ifndef CONFIG_XPL_BUILD obj-$(CONFIG_SYSRESET) += cpld.o 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 From 2e5e4e251a0948438cc4d6a4316603cb2938291d Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 29 Jan 2025 18:04:29 +0100 Subject: [PATCH 07/12] ARM: renesas: Rename common/common.c to common/rcar64-common.c 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. Reviewed-by: Quentin Schulz Signed-off-by: Marek Vasut --- 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} | 0 board/silinux/ek874/Makefile | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename board/renesas/common/{common.c => rcar64-common.c} (100%) 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 c531738b22e..8c26c0afd90 100644 --- a/board/renesas/common/Makefile +++ b/board/renesas/common/Makefile @@ -18,7 +18,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 100% rename from board/renesas/common/common.c rename to board/renesas/common/rcar64-common.c 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 From caae2d7025816e3e8eb387e02095a2e90b849a95 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 29 Jan 2025 18:04:30 +0100 Subject: [PATCH 08/12] arm64: renesas: Drop unused code and clean up headers on R-Car D3 Draak 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 --- 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 a51bf65674f..85213497ce4 100644 --- a/board/renesas/draak/draak.c +++ b/board/renesas/draak/draak.c @@ -6,43 +6,17 @@ * Copyright (C) 2017 Marek Vasut */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include #include -#include -#include - -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 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) From b76268ad326ccfd2b449ab5cd06c3253bbd8cf76 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 29 Jan 2025 18:04:31 +0100 Subject: [PATCH 09/12] arm64: renesas: Drop unused code and clean up headers on Salvator-X boards 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 --- 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 2c8860bcee4..60f8b94e54a 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -7,41 +7,18 @@ * Copyright (C) 2015 Nobuhiro Iwamatsu */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include #include -#include -#include - -DECLARE_GLOBAL_DATA_PTR; - -#define DVFS_MSTP926 BIT(26) -#define HSUSB_MSTP704 BIT(4) /* HSUSB */ +#include +#include 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) @@ -65,13 +42,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) { From 4d12216904f8a600fe975e1127cfa77d7e9e27bc Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 29 Jan 2025 18:04:32 +0100 Subject: [PATCH 10/12] arm64: renesas: Drop unused code and clean up headers on ULCB boards 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 --- 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 64f01b123cb..3f6db0ec3fa 100644 --- a/board/renesas/ulcb/ulcb.c +++ b/board/renesas/ulcb/ulcb.c @@ -6,37 +6,15 @@ * Copyright (C) 2017 Renesas Electronics Corporation */ -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include #include -#include -#include +#include +#include -DECLARE_GLOBAL_DATA_PTR; - -#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; } From a75792914fdf72314c739ecc6db5b73b41c595f9 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 29 Jan 2025 18:04:33 +0100 Subject: [PATCH 11/12] arm64: renesas: Deduplicate board_early_init_f() 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. Reviewed-by: Quentin Schulz Signed-off-by: Marek Vasut --- 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 85213497ce4..564cf439aa6 100644 --- a/board/renesas/draak/draak.c +++ b/board/renesas/draak/draak.c @@ -10,11 +10,6 @@ #include #include -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 60f8b94e54a..6d33d005b4c 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -12,11 +12,6 @@ #include #include -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 3f6db0ec3fa..d02e5d0bfc5 100644 --- a/board/renesas/ulcb/ulcb.c +++ b/board/renesas/ulcb/ulcb.c @@ -13,11 +13,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) From e0df073bc0df843e0a3c5f9990defcbf2207c8b9 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 29 Jan 2025 18:04:34 +0100 Subject: [PATCH 12/12] arm64: renesas: Deduplicate R-Car Gen3 and Gen4 SPL 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. Reviewed-by: Quentin Schulz Signed-off-by: Marek Vasut --- 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 8c26c0afd90..347be5cc93c 100644 --- a/board/renesas/common/Makefile +++ b/board/renesas/common/Makefile @@ -17,7 +17,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 */ -#include -#include #include -#include #include #include -#include #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 + */ + +#include +#include + +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(); + } +}