From c1bde2378a7673c992783b4c00729a52ba18e830 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 11 Apr 2020 20:43:07 +0200 Subject: libfdt: Export overlay_apply_node() as fdt_overlay_apply_node() This function is useful to merge a subset of DT into another DT, for example if some prior-stage firmware passes a DT fragment to U-Boot and U-Boot needs to merge it into its own DT. Export this function to permit implementing such functionality. Reviewed-by: Simon Glass Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu Cc: Simon Glass Cc: Tom Rini --- scripts/dtc/libfdt/fdt_overlay.c | 5 +++++ scripts/dtc/libfdt/libfdt.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/scripts/dtc/libfdt/fdt_overlay.c b/scripts/dtc/libfdt/fdt_overlay.c index be71873366..c090e6991e 100644 --- a/scripts/dtc/libfdt/fdt_overlay.c +++ b/scripts/dtc/libfdt/fdt_overlay.c @@ -879,3 +879,8 @@ err: return ret; } + +int fdt_overlay_apply_node(void *fdt, int target, void *fdto, int node) +{ + return overlay_apply_node(fdt, target, fdto, node); +} diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h index fa63fffe28..421f90ad93 100644 --- a/scripts/dtc/libfdt/libfdt.h +++ b/scripts/dtc/libfdt/libfdt.h @@ -2032,6 +2032,13 @@ int fdt_del_node(void *fdt, int nodeoffset); */ int fdt_overlay_apply(void *fdt, void *fdto); +/** + * fdt_overlay_apply_node - Merges a node into the base device tree + * + * See overlay_apply_node() for details. + */ +int fdt_overlay_apply_node(void *fdt, int target, void *fdto, int node); + /**********************************************************************/ /* Debugging / informational functions */ /**********************************************************************/ -- cgit v1.2.1 From 0e2afc8368b632ffb195d588ec2315ffbbf0a7e9 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 11 Apr 2020 21:18:59 +0200 Subject: fdtdec: Add weak function to patch U-Boot DT right after fdtdec_setup() Add weak function which is called right after fdtdec_setup() configured the U-Boot DT. This permits board-specific adjustments to the U-Boot DT before U-Boot starts parsing the DT. This could be used e.g. to patch in various custom nodes or merge in DT fragments from prior-stage firmware. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu Cc: Simon Glass Cc: Tom Rini --- include/fdtdec.h | 5 +++++ lib/fdtdec.c | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/fdtdec.h b/include/fdtdec.h index 166f29c55b..abd6d42671 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -1155,6 +1155,11 @@ int fdtdec_set_carveout(void *blob, const char *node, const char *prop_name, */ int fdtdec_setup(void); +/** + * Perform board-specific early DT adjustments + */ +int fdtdec_board_setup(const void *fdt_blob); + #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) /** * fdtdec_resetup() - Set up the device tree again diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 9c4d5713e1..1f2b763acc 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1474,8 +1474,14 @@ int fdtdec_set_carveout(void *blob, const char *node, const char *prop_name, return 0; } +__weak int fdtdec_board_setup(const void *fdt_blob) +{ + return 0; +} + int fdtdec_setup(void) { + int ret; #if CONFIG_IS_ENABLED(OF_CONTROL) # if CONFIG_IS_ENABLED(MULTI_DTB_FIT) void *fdt_blob; @@ -1528,7 +1534,10 @@ int fdtdec_setup(void) # endif #endif - return fdtdec_prepare_fdt(); + ret = fdtdec_prepare_fdt(); + if (!ret) + ret = fdtdec_board_setup(gd->fdt_blob); + return ret; } #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) -- cgit v1.2.1 From 5d17a1691b2ec49edf989a195e2b534b58a5dbf7 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 11 Apr 2020 20:49:49 +0200 Subject: ARM: dts: rmobile: Reserve space in R-Car Gen3 DTs Reserve 4 kiB of space in R-Car Gen3 DTs when those DTs are compiled to permit patching in OpTee-OS /firmware node, /reserved-memory node and possibly also additional /memory@ nodes. Reviewed-by: Simon Glass Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu Cc: Simon Glass Cc: Tom Rini --- arch/arm/dts/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index ca663a86f2..480ef4c4b2 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -766,6 +766,10 @@ dtb-$(CONFIG_RCAR_GEN3) += \ r8a77990-ebisu-u-boot.dtb \ r8a77995-draak-u-boot.dtb +ifdef CONFIG_RCAR_GEN3 +DTC_FLAGS += -R 4 -p 0x1000 +endif + dtb-$(CONFIG_RZA1) += \ r7s72100-gr-peach-u-boot.dtb -- cgit v1.2.1 From 361377dbdbc9f0f59b954248a696ad46ad5036b7 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 11 Apr 2020 20:50:24 +0200 Subject: ARM: rmobile: Merge prior-stage firmware DT fragment into U-Boot DT on Gen3 The prior-stage firmware generates DT fragment containing the /firmware node, /reserved-memory node and /memory@ nodes. Merge these nodes into the U-Boot DT, so U-Boot can use this information. Reviewed-by: Simon Glass Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu Cc: Simon Glass Cc: Tom Rini --- board/renesas/rcar-common/common.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c index b9e8cb4ce7..46dcea1f90 100644 --- a/board/renesas/rcar-common/common.c +++ b/board/renesas/rcar-common/common.c @@ -21,32 +21,24 @@ DECLARE_GLOBAL_DATA_PTR; /* If the firmware passed a device tree use it for U-Boot DRAM setup. */ extern u64 rcar_atf_boot_args[]; -int dram_init(void) +int fdtdec_board_setup(const void *fdt_blob) { - const void *atf_fdt_blob = (const void *)(rcar_atf_boot_args[1]); - const void *blob; + void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]); - /* Check if ATF passed us DTB. If not, fall back to builtin DTB. */ if (fdt_magic(atf_fdt_blob) == FDT_MAGIC) - blob = atf_fdt_blob; - else - blob = gd->fdt_blob; + fdt_overlay_apply_node((void *)fdt_blob, 0, atf_fdt_blob, 0); - return fdtdec_setup_mem_size_base_fdt(blob); + return 0; } -int dram_init_banksize(void) +int dram_init(void) { - const void *atf_fdt_blob = (const void *)(rcar_atf_boot_args[1]); - const void *blob; - - /* Check if ATF passed us DTB. If not, fall back to builtin DTB. */ - if (fdt_magic(atf_fdt_blob) == FDT_MAGIC) - blob = atf_fdt_blob; - else - blob = gd->fdt_blob; + return fdtdec_setup_mem_size_base_fdt(gd->fdt_blob); +} - fdtdec_setup_memory_banksize_fdt(blob); +int dram_init_banksize(void) +{ + fdtdec_setup_memory_banksize_fdt(gd->fdt_blob); return 0; } -- cgit v1.2.1 From d3928baa81ee04a550a38c11c0257480026b0ed9 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 11 Apr 2020 20:54:02 +0200 Subject: ARM: rmobile: Enable support for OpTee on Gen3 Enable OpTee support on R-Car Gen3, so that U-Boot would copy the OpTee /firmware and /reserved-memory nodes into the Linux DT. Reviewed-by: Simon Glass Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu Cc: Simon Glass Cc: Tom Rini --- configs/r8a77970_eagle_defconfig | 2 ++ configs/r8a77980_condor_defconfig | 2 ++ configs/r8a77990_ebisu_defconfig | 2 ++ configs/r8a77995_draak_defconfig | 2 ++ configs/rcar3_salvator-x_defconfig | 2 ++ configs/rcar3_ulcb_defconfig | 2 ++ 6 files changed, 12 insertions(+) diff --git a/configs/r8a77970_eagle_defconfig b/configs/r8a77970_eagle_defconfig index 78bfb9a032..2a53f16ee9 100644 --- a/configs/r8a77970_eagle_defconfig +++ b/configs/r8a77970_eagle_defconfig @@ -57,6 +57,8 @@ CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_SCIF_CONSOLE=y +CONFIG_TEE=y +CONFIG_OPTEE=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_RENESAS_RPC_SPI=y diff --git a/configs/r8a77980_condor_defconfig b/configs/r8a77980_condor_defconfig index 83d6a75670..d9272b85c4 100644 --- a/configs/r8a77980_condor_defconfig +++ b/configs/r8a77980_condor_defconfig @@ -61,6 +61,8 @@ CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_SCIF_CONSOLE=y +CONFIG_TEE=y +CONFIG_OPTEE=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_RENESAS_RPC_SPI=y diff --git a/configs/r8a77990_ebisu_defconfig b/configs/r8a77990_ebisu_defconfig index cc9257b81b..e4a017aa23 100644 --- a/configs/r8a77990_ebisu_defconfig +++ b/configs/r8a77990_ebisu_defconfig @@ -55,6 +55,8 @@ CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_SCIF_CONSOLE=y +CONFIG_TEE=y +CONFIG_OPTEE=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y diff --git a/configs/r8a77995_draak_defconfig b/configs/r8a77995_draak_defconfig index 89b0f15c76..b2dc167b9f 100644 --- a/configs/r8a77995_draak_defconfig +++ b/configs/r8a77995_draak_defconfig @@ -63,6 +63,8 @@ CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_SCIF_CONSOLE=y +CONFIG_TEE=y +CONFIG_OPTEE=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y diff --git a/configs/rcar3_salvator-x_defconfig b/configs/rcar3_salvator-x_defconfig index 3031fdde2d..6944edcd01 100644 --- a/configs/rcar3_salvator-x_defconfig +++ b/configs/rcar3_salvator-x_defconfig @@ -61,6 +61,8 @@ CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_SCIF_CONSOLE=y +CONFIG_TEE=y +CONFIG_OPTEE=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y diff --git a/configs/rcar3_ulcb_defconfig b/configs/rcar3_ulcb_defconfig index 53ea93801b..4be3e0b345 100644 --- a/configs/rcar3_ulcb_defconfig +++ b/configs/rcar3_ulcb_defconfig @@ -58,6 +58,8 @@ CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_SCIF_CONSOLE=y +CONFIG_TEE=y +CONFIG_OPTEE=y CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_DM_USB=y -- cgit v1.2.1 From 03578d940dd3c19893c66e08be72f9ff1aa3d5c9 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 8 Mar 2020 18:25:09 +0100 Subject: ARM: dts: rmobile: Enable eMMC DDR52 modes on Gen3 Salvator-X(S),ULCB,Ebisu Enable DDR52 modes, since the SD core supports correct switching now. For completeness, list HS200 modes, however those were already enabled. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- arch/arm/dts/r8a77950-salvator-x-u-boot.dts | 2 ++ arch/arm/dts/r8a77950-ulcb-u-boot.dts | 2 ++ arch/arm/dts/r8a77960-salvator-x-u-boot.dts | 2 ++ arch/arm/dts/r8a77960-ulcb-u-boot.dts | 2 ++ arch/arm/dts/r8a77965-salvator-x-u-boot.dts | 2 ++ arch/arm/dts/r8a77965-ulcb-u-boot.dts | 2 ++ arch/arm/dts/r8a77990-ebisu.dts | 1 + 7 files changed, 13 insertions(+) diff --git a/arch/arm/dts/r8a77950-salvator-x-u-boot.dts b/arch/arm/dts/r8a77950-salvator-x-u-boot.dts index 6e5c271d3c..e039e33d59 100644 --- a/arch/arm/dts/r8a77950-salvator-x-u-boot.dts +++ b/arch/arm/dts/r8a77950-salvator-x-u-boot.dts @@ -16,6 +16,8 @@ }; &sdhi2 { + mmc-ddr-1_8v; + mmc-hs200-1_8v; mmc-hs400-1_8v; max-frequency = <200000000>; }; diff --git a/arch/arm/dts/r8a77950-ulcb-u-boot.dts b/arch/arm/dts/r8a77950-ulcb-u-boot.dts index fb9bbe1439..b7f26c11b1 100644 --- a/arch/arm/dts/r8a77950-ulcb-u-boot.dts +++ b/arch/arm/dts/r8a77950-ulcb-u-boot.dts @@ -27,6 +27,8 @@ }; &sdhi2 { + mmc-ddr-1_8v; + mmc-hs200-1_8v; mmc-hs400-1_8v; max-frequency = <200000000>; }; diff --git a/arch/arm/dts/r8a77960-salvator-x-u-boot.dts b/arch/arm/dts/r8a77960-salvator-x-u-boot.dts index a3f2d74150..d3b09246f5 100644 --- a/arch/arm/dts/r8a77960-salvator-x-u-boot.dts +++ b/arch/arm/dts/r8a77960-salvator-x-u-boot.dts @@ -16,6 +16,8 @@ }; &sdhi2 { + mmc-ddr-1_8v; + mmc-hs200-1_8v; mmc-hs400-1_8v; max-frequency = <200000000>; }; diff --git a/arch/arm/dts/r8a77960-ulcb-u-boot.dts b/arch/arm/dts/r8a77960-ulcb-u-boot.dts index 04023d9597..bd1d634574 100644 --- a/arch/arm/dts/r8a77960-ulcb-u-boot.dts +++ b/arch/arm/dts/r8a77960-ulcb-u-boot.dts @@ -27,6 +27,8 @@ }; &sdhi2 { + mmc-ddr-1_8v; + mmc-hs200-1_8v; mmc-hs400-1_8v; max-frequency = <200000000>; }; diff --git a/arch/arm/dts/r8a77965-salvator-x-u-boot.dts b/arch/arm/dts/r8a77965-salvator-x-u-boot.dts index e4bd2d3e4f..d6f0708555 100644 --- a/arch/arm/dts/r8a77965-salvator-x-u-boot.dts +++ b/arch/arm/dts/r8a77965-salvator-x-u-boot.dts @@ -17,6 +17,8 @@ }; &sdhi2 { + mmc-ddr-1_8v; + mmc-hs200-1_8v; mmc-hs400-1_8v; max-frequency = <200000000>; status = "okay"; diff --git a/arch/arm/dts/r8a77965-ulcb-u-boot.dts b/arch/arm/dts/r8a77965-ulcb-u-boot.dts index 28fb30e9a9..954d8b685c 100644 --- a/arch/arm/dts/r8a77965-ulcb-u-boot.dts +++ b/arch/arm/dts/r8a77965-ulcb-u-boot.dts @@ -28,6 +28,8 @@ }; &sdhi2 { + mmc-ddr-1_8v; + mmc-hs200-1_8v; mmc-hs400-1_8v; max-frequency = <200000000>; status = "okay"; diff --git a/arch/arm/dts/r8a77990-ebisu.dts b/arch/arm/dts/r8a77990-ebisu.dts index 4fd2b14fbb..07a4c9bbae 100644 --- a/arch/arm/dts/r8a77990-ebisu.dts +++ b/arch/arm/dts/r8a77990-ebisu.dts @@ -713,6 +713,7 @@ vmmc-supply = <®_3p3v>; vqmmc-supply = <®_1p8v>; + mmc-ddr-1_8v; mmc-hs200-1_8v; mmc-hs400-1_8v; bus-width = <8>; -- cgit v1.2.1 From 56f01746ab5c6950bd0f76d02252ee4450f86659 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 3 May 2020 17:22:43 +0200 Subject: sh: Enable ffunction-sections and fdata-sections Enable these two options to let compiler eliminate unused code. On R2Dplus, this results in considerable amount of saved space: text data bss dec hex filename - 266580 13196 39076 318852 4dd84 u-boot + 220214 12797 38745 271756 4258c u-boot Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu Cc: Tom Rini --- arch/sh/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sh/config.mk b/arch/sh/config.mk index 6ef44638ab..85dab383e7 100644 --- a/arch/sh/config.mk +++ b/arch/sh/config.mk @@ -13,6 +13,6 @@ LDFLAGS_STANDALONE += -EB endif PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__ -PLATFORM_RELFLAGS += -fpic +PLATFORM_RELFLAGS += -fpic -ffunction-sections -fdata-sections LDFLAGS_FINAL = --gc-sections PLATFORM_RELFLAGS += -ffixed-r13 -- cgit v1.2.1