From 49ad0c8eee151187235fc54f9c4ea1368bededf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 9 Feb 2024 22:15:35 +0100 Subject: [PATCH 1/4] clk: renesas: Fix broken clocks on all Gen2 boards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To prepare support for multiple register layouts pointers to register tables where added to struct cpg_mssr_info. These pointers are suppose to be filled in at probe time and no intended change in behavior was intended. However the new pointers where only filled in by some paths of the driver implemented in clk-rcar-gen3.c. The path implemented in clk-rcar-gen2.c was not updated leaving the pointers uninitialized leading to a crash when trying to probe the clocks. Fix this by filling in the pointers in the Gen2 code path with the values used before they where moved to struct cpg_mssr_info. Fixes: d413214fb748 ("clk: renesas: Add register pointers into struct cpg_mssr_info") Signed-off-by: Niklas Söderlund Acked-by: Marek Vasut Tested-by: Marek Vasut # R8A7791 Porter Reviewed-by: Geert Uytterhoeven --- drivers/clk/renesas/clk-rcar-gen2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/clk/renesas/clk-rcar-gen2.c b/drivers/clk/renesas/clk-rcar-gen2.c index 66ffef96b69..89f2d966746 100644 --- a/drivers/clk/renesas/clk-rcar-gen2.c +++ b/drivers/clk/renesas/clk-rcar-gen2.c @@ -298,6 +298,15 @@ int gen2_clk_probe(struct udevice *dev) if (!priv->cpg_pll_config->extal_div) return -EINVAL; + if (info->reg_layout == CLK_REG_LAYOUT_RCAR_GEN2_AND_GEN3) { + priv->info->status_regs = mstpsr; + priv->info->control_regs = smstpcr; + priv->info->reset_regs = srcr; + priv->info->reset_clear_regs = srstclr; + } else { + return -EINVAL; + } + ret = clk_get_by_name(dev, "extal", &priv->clk_extal); if (ret < 0) return ret; From e4c2f0f78646e179632d0e8bcadfaab5c6077cc0 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 11 Feb 2024 18:34:28 +0100 Subject: [PATCH 2/4] ARM: renesas: Disable EFI on R-Car Gen2 These systems are unlikely to use EFI as this functionality has not been enabled until it got pulled in by Kconfig default. This functionality does add some 60-70 kiB to the u-boot.img size, which overflows the size limit. Disable it. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- configs/alt_defconfig | 2 ++ configs/blanche_defconfig | 2 ++ configs/gose_defconfig | 2 ++ configs/koelsch_defconfig | 2 ++ configs/lager_defconfig | 2 ++ configs/porter_defconfig | 2 ++ configs/silk_defconfig | 2 ++ configs/stout_defconfig | 2 ++ 8 files changed, 16 insertions(+) diff --git a/configs/alt_defconfig b/configs/alt_defconfig index 31f38bd3a5b..35707a65960 100644 --- a/configs/alt_defconfig +++ b/configs/alt_defconfig @@ -68,6 +68,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=spi0.0" CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k(u-boot-env2),768k(u-boot),-(user)" +CONFIG_PARTITION_UUIDS=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y @@ -106,3 +107,4 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_STORAGE=y CONFIG_SYS_TIMER_COUNTS_DOWN=y +# CONFIG_EFI_LOADER is not set diff --git a/configs/blanche_defconfig b/configs/blanche_defconfig index 59e9b3af846..f328af84dfa 100644 --- a/configs/blanche_defconfig +++ b/configs/blanche_defconfig @@ -44,6 +44,7 @@ CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y +CONFIG_PARTITION_UUIDS=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_FLASH=y @@ -82,3 +83,4 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_STORAGE=y CONFIG_SYS_TIMER_COUNTS_DOWN=y +# CONFIG_EFI_LOADER is not set diff --git a/configs/gose_defconfig b/configs/gose_defconfig index 4220b9349b7..92bb5911765 100644 --- a/configs/gose_defconfig +++ b/configs/gose_defconfig @@ -68,6 +68,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=spi0.0" CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k(u-boot-env2),768k(u-boot),-(user)" +CONFIG_PARTITION_UUIDS=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y @@ -104,3 +105,4 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_STORAGE=y CONFIG_SYS_TIMER_COUNTS_DOWN=y +# CONFIG_EFI_LOADER is not set diff --git a/configs/koelsch_defconfig b/configs/koelsch_defconfig index d39533cc393..8d9c3b94499 100644 --- a/configs/koelsch_defconfig +++ b/configs/koelsch_defconfig @@ -68,6 +68,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=spi0.0" CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k(u-boot-env2),768k(u-boot),-(user)" +CONFIG_PARTITION_UUIDS=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y @@ -104,3 +105,4 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_STORAGE=y CONFIG_SYS_TIMER_COUNTS_DOWN=y +# CONFIG_EFI_LOADER is not set diff --git a/configs/lager_defconfig b/configs/lager_defconfig index da2ba58c6b0..d00314c60e4 100644 --- a/configs/lager_defconfig +++ b/configs/lager_defconfig @@ -68,6 +68,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=spi0.0" CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k(u-boot-env2),768k(u-boot),-(user)" +CONFIG_PARTITION_UUIDS=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y @@ -106,3 +107,4 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_STORAGE=y CONFIG_SYS_TIMER_COUNTS_DOWN=y +# CONFIG_EFI_LOADER is not set diff --git a/configs/porter_defconfig b/configs/porter_defconfig index 0a805deff65..a343c8e83de 100644 --- a/configs/porter_defconfig +++ b/configs/porter_defconfig @@ -68,6 +68,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=spi0.0" CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k(u-boot-env2),768k(u-boot),-(user)" +CONFIG_PARTITION_UUIDS=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y @@ -104,3 +105,4 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_STORAGE=y CONFIG_SYS_TIMER_COUNTS_DOWN=y +# CONFIG_EFI_LOADER is not set diff --git a/configs/silk_defconfig b/configs/silk_defconfig index 7c6b5b59c93..5f08ae0fcf9 100644 --- a/configs/silk_defconfig +++ b/configs/silk_defconfig @@ -68,6 +68,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=spi0.0" CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k(u-boot-env2),768k(u-boot),-(user)" +CONFIG_PARTITION_UUIDS=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y @@ -106,3 +107,4 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_STORAGE=y CONFIG_SYS_TIMER_COUNTS_DOWN=y +# CONFIG_EFI_LOADER is not set diff --git a/configs/stout_defconfig b/configs/stout_defconfig index 8fad272cf55..0375630adea 100644 --- a/configs/stout_defconfig +++ b/configs/stout_defconfig @@ -68,6 +68,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=spi0.0" CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:256k(u-boot-spl),512k(u-boot-env1),512k(u-boot-env2),768k(u-boot),-(user)" +CONFIG_PARTITION_UUIDS=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y @@ -105,3 +106,4 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_STORAGE=y CONFIG_SYS_TIMER_COUNTS_DOWN=y +# CONFIG_EFI_LOADER is not set From 1c987e6fb4df31edde25d7517cfdcddce2f639c8 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 11 Feb 2024 18:34:29 +0100 Subject: [PATCH 3/4] ARM: renesas: Set R-Car Gen2 board size limit to 512 kiB The maximum size of u-boot.img on R-Car Gen2 is 0x80000 or 512 kiB, set the limit to avoid overflows as new functionality gets pulled in. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kconfig b/Kconfig index 00ed1ecc173..5710934000f 100644 --- a/Kconfig +++ b/Kconfig @@ -500,13 +500,14 @@ config BUILD_TARGET config HAS_BOARD_SIZE_LIMIT bool "Define a maximum size for the U-Boot image" - default y if RCAR_64 + default y if RCAR_32 || RCAR_64 help In some cases, we need to enforce a hard limit on how big the U-Boot image itself can be. config BOARD_SIZE_LIMIT int "Maximum size of the U-Boot image in bytes" + default 524288 if RCAR_32 default 1048576 if RCAR_64 depends on HAS_BOARD_SIZE_LIMIT help From 87f9ffbef5e894bbcea99614520c8afd216bbf1a Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 11 Feb 2024 18:34:30 +0100 Subject: [PATCH 4/4] ARM: renesas: Enable LTO on R-Car Enable LTO globally on Renesas R-Car platforms. This has been enabled on a subset of boards already, but at this point it is safe to enable it globally. This saves units or tens of kiB from the resulting build. Signed-off-by: Marek Vasut Reviewed-by: Paul Barker --- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 6b072be2463..fde85dc0d53 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1076,6 +1076,7 @@ config ARCH_RMOBILE select DM select DM_SERIAL select GPIO_EXTRA_HEADER + select LTO imply BOARD_EARLY_INIT_F imply CMD_DM imply FAT_WRITE