[PATCH u-boot 0/3] renesas: Fix RPC-IF enablement

Hi all,
On Renesas R-Car Gen3 platforms, the SPI Multi I/O Bus Controllers (RPC-IF) provide access to HyperFlash or QSPI storage. On production systems, they are typically locked by the TF-A firmware, unless TF-A is built with RCAR_RPC_HYPERFLASH_LOCKED=0. When unlocked, TF-A communicates this to subsequent software by passing a DT fragment that sets the "status" property of the RPC-IF device node to "okay".
Unfortunately there are several issues preventing this from working all the way to Linux: 1. TF-A (and U-Boot on the receiving side) uses a device node name that does not conform to the DT specification nor the DT bindings for RPC-IF, 2. While U-Boot receives the RPC-IF enablement from TF-A, it does not propagate it to Linux yet, 3. The DTS files that are part of Linux do not have RPC HyperFlash support yet.
The first issue in TF-A is handled by [1].
This patch series takes care of the first and second issue in U-Boot, by renaming the RPC-IF device node, and by propagating the enablement from TF-A, if present, to Linux. The third patch updates the RPC-IF compatible values to match the actual DT bindings, but this is not critical for operation, and can be postponed (e.g. by syncing DTS with Linux v5.19).
Patches to enable RPC-IF support in Linux are available at [2].
Thanks for your comments!
[1] "[PATCH TF-A] fix(plat/rcar3): Fix RPC-IF device node name" https://lore.kernel.org/r/3685623bed84674039adb61e723288d359ab0a50.164854419... [2] "[PATCH 0/5] arm64: dts: renesas: rcar-gen3: Enable HyperFlash support" https://lore.kernel.org/r/cover.1648548339.git.geert+renesas@glider.be
Geert Uytterhoeven (3): ARM: dts: rmobile: Fix RPC-IF device node names ARM: renesas: Propagate RPC-IF enablement to subsequent software [RFC] renesas: Fix RPC-IF compatible values
arch/arm/dts/r7s72100-gr-peach-u-boot.dts | 4 +- arch/arm/dts/r8a774c0-u-boot.dtsi | 4 +- arch/arm/dts/r8a77950-u-boot.dtsi | 4 +- arch/arm/dts/r8a77960-u-boot.dtsi | 4 +- arch/arm/dts/r8a77965-u-boot.dtsi | 4 +- arch/arm/dts/r8a77970-u-boot.dtsi | 4 +- arch/arm/dts/r8a77980-u-boot.dtsi | 4 +- arch/arm/dts/r8a77990-u-boot.dtsi | 4 +- arch/arm/dts/r8a77995-u-boot.dtsi | 4 +- arch/arm/dts/r8a779a0-u-boot.dtsi | 2 +- board/renesas/rcar-common/common.c | 46 ++++++++++++++++++++++- drivers/mtd/renesas_rpc_hf.c | 3 +- drivers/spi/renesas_rpc_spi.c | 9 +---- 13 files changed, 67 insertions(+), 29 deletions(-)

According to the Generic Names Recommendation in the Devicetree Specification Release v0.3, and the DT Bindings for the Renesas Reduced Pin Count Interface, the node name for a Renesas RPC-IF device should be "spi". Especially on R-Car Gen3 and RZ/G2, the node name matters, as the node is enabled by passing a DT fragment from TF-A to U-Boot, and from U-Boot to subsequent software.
Fix this by renaming the device nodes from "rpc" to "spi".
Signed-off-by: Geert Uytterhoeven geert+renesas@glider.be --- Needs a similar patch to TF-A. --- arch/arm/dts/r7s72100-gr-peach-u-boot.dts | 2 +- arch/arm/dts/r8a774c0-u-boot.dtsi | 2 +- arch/arm/dts/r8a77950-u-boot.dtsi | 2 +- arch/arm/dts/r8a77960-u-boot.dtsi | 2 +- arch/arm/dts/r8a77965-u-boot.dtsi | 2 +- arch/arm/dts/r8a77970-u-boot.dtsi | 2 +- arch/arm/dts/r8a77980-u-boot.dtsi | 2 +- arch/arm/dts/r8a77990-u-boot.dtsi | 2 +- arch/arm/dts/r8a77995-u-boot.dtsi | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/arm/dts/r7s72100-gr-peach-u-boot.dts b/arch/arm/dts/r7s72100-gr-peach-u-boot.dts index f48121a9a812b481..3f532eced23d354b 100644 --- a/arch/arm/dts/r7s72100-gr-peach-u-boot.dts +++ b/arch/arm/dts/r7s72100-gr-peach-u-boot.dts @@ -46,7 +46,7 @@ };
- rpc: rpc@ee200000 { + rpc: spi@ee200000 { compatible = "renesas,rpc-r7s72100", "renesas,rpc"; reg = <0x3fefa000 0x100>, <0x18000000 0x08000000>; bank-width = <2>; diff --git a/arch/arm/dts/r8a774c0-u-boot.dtsi b/arch/arm/dts/r8a774c0-u-boot.dtsi index af1c86171b601330..f50816a360dc5912 100644 --- a/arch/arm/dts/r8a774c0-u-boot.dtsi +++ b/arch/arm/dts/r8a774c0-u-boot.dtsi @@ -10,7 +10,7 @@
/ { soc { - rpc: rpc@ee200000 { + rpc: spi@ee200000 { compatible = "renesas,rcar-gen3-rpc", "renesas,rpc-r8a774c0"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0x04000000>; clocks = <&cpg CPG_MOD 917>; diff --git a/arch/arm/dts/r8a77950-u-boot.dtsi b/arch/arm/dts/r8a77950-u-boot.dtsi index 5a11651464655134..5e449a3553cb9712 100644 --- a/arch/arm/dts/r8a77950-u-boot.dtsi +++ b/arch/arm/dts/r8a77950-u-boot.dtsi @@ -13,7 +13,7 @@
/ { soc { - rpc: rpc@ee200000 { + rpc: spi@ee200000 { compatible = "renesas,rpc-r8a7795", "renesas,rpc"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; diff --git a/arch/arm/dts/r8a77960-u-boot.dtsi b/arch/arm/dts/r8a77960-u-boot.dtsi index f1cae1c35931e78a..9013c291f5ffca8a 100644 --- a/arch/arm/dts/r8a77960-u-boot.dtsi +++ b/arch/arm/dts/r8a77960-u-boot.dtsi @@ -13,7 +13,7 @@
/ { soc { - rpc: rpc@ee200000 { + rpc: spi@ee200000 { compatible = "renesas,rpc-r8a7796", "renesas,rpc"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; diff --git a/arch/arm/dts/r8a77965-u-boot.dtsi b/arch/arm/dts/r8a77965-u-boot.dtsi index 9cc6f205375135dc..f3c99ac99cbc581a 100644 --- a/arch/arm/dts/r8a77965-u-boot.dtsi +++ b/arch/arm/dts/r8a77965-u-boot.dtsi @@ -13,7 +13,7 @@
/ { soc { - rpc: rpc@ee200000 { + rpc: spi@ee200000 { compatible = "renesas,rpc-r8a77965", "renesas,rpc"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; diff --git a/arch/arm/dts/r8a77970-u-boot.dtsi b/arch/arm/dts/r8a77970-u-boot.dtsi index ac3c6be4adb885f3..904fc48b2282b52a 100644 --- a/arch/arm/dts/r8a77970-u-boot.dtsi +++ b/arch/arm/dts/r8a77970-u-boot.dtsi @@ -13,7 +13,7 @@
/ { soc { - rpc: rpc@ee200000 { + rpc: spi@ee200000 { compatible = "renesas,rpc-r8a77970", "renesas,rpc"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; diff --git a/arch/arm/dts/r8a77980-u-boot.dtsi b/arch/arm/dts/r8a77980-u-boot.dtsi index 365d40ac49b65b05..34d6fcd2f013d762 100644 --- a/arch/arm/dts/r8a77980-u-boot.dtsi +++ b/arch/arm/dts/r8a77980-u-boot.dtsi @@ -13,7 +13,7 @@
/ { soc { - rpc: rpc@ee200000 { + rpc: spi@ee200000 { compatible = "renesas,rpc-r8a77980", "renesas,rpc"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; diff --git a/arch/arm/dts/r8a77990-u-boot.dtsi b/arch/arm/dts/r8a77990-u-boot.dtsi index 6655abe8752f5d78..8c75f62f5abec4cf 100644 --- a/arch/arm/dts/r8a77990-u-boot.dtsi +++ b/arch/arm/dts/r8a77990-u-boot.dtsi @@ -9,7 +9,7 @@
/ { soc { - rpc: rpc@ee200000 { + rpc: spi@ee200000 { compatible = "renesas,rpc-r8a77990", "renesas,rpc"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; diff --git a/arch/arm/dts/r8a77995-u-boot.dtsi b/arch/arm/dts/r8a77995-u-boot.dtsi index 0917a80f09630875..cd9466625e27d57c 100644 --- a/arch/arm/dts/r8a77995-u-boot.dtsi +++ b/arch/arm/dts/r8a77995-u-boot.dtsi @@ -9,7 +9,7 @@
/ { soc { - rpc: rpc@ee200000 { + rpc: spi@ee200000 { compatible = "renesas,rpc-r8a77995", "renesas,rpc"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>;

As the Renesas Reduced Pin Count Interface may be locked by TF-A, it is disabled by default[1]. When unlocked, TF-A passes a DT fragment to enable it, which is applied to the U-Boot DT[2].
Unlike the memory layout, the RPC-IF enablement is not propagated to subsequent software. Hence e.g. Linux cannot know if the RPC-IF is locked or not, and will lock-up when trying to access the RPC-IF when locked.
Fix this by checking if the RPC-IF is enabled in the TF-A DT fragment, and setting the status of the RPC-IF device node in the target DT, if present, to "okay". Do this only when a "flash" subnode is found, to avoid errors in subsequent software when the RPC-IF is not intended to be used.
Note that this requires the status of the RPC-IF node to be set to "disabled" in the target DT, just like in the U-Boot DT.
[1] commit 3d5f45c95c9db73d ("ARM: dts: rmobile: Disable RPC HF by default") [2] commit 361377dbdbc9f0f5 ("ARM: rmobile: Merge prior-stage firmware DT fragment into U-Boot DT on Gen3")
Signed-off-by: Geert Uytterhoeven geert+renesas@glider.be --- board/renesas/rcar-common/common.c | 46 ++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c index 0352d341e757bed9..daa1beb14f807800 100644 --- a/board/renesas/rcar-common/common.c +++ b/board/renesas/rcar-common/common.c @@ -9,6 +9,7 @@
#include <common.h> #include <dm.h> +#include <fdt_support.h> #include <init.h> #include <asm/global_data.h> #include <dm/uclass-internal.h> @@ -19,9 +20,11 @@
DECLARE_GLOBAL_DATA_PTR;
-/* If the firmware passed a device tree use it for U-Boot DRAM setup. */ +/* If the firmware passed a device tree use it for e.g. U-Boot DRAM setup. */ extern u64 rcar_atf_boot_args[];
+#define FDT_RPC_PATH "/soc/spi@ee200000" + int fdtdec_board_setup(const void *fdt_blob) { void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]); @@ -81,7 +84,7 @@ static int is_mem_overlap(void *blob, int first_mem_node, int curr_mem_node) return 0; }
-int ft_board_setup(void *blob, struct bd_info *bd) +static void scrub_duplicate_memory(void *blob) { /* * Scrub duplicate /memory@* node entries here. Some R-Car DTs might @@ -119,6 +122,45 @@ int ft_board_setup(void *blob, struct bd_info *bd) first_mem_node = 0; mem = 0; } +} + +static void update_rpc_status(void *blob) +{ + void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]); + int offset, enabled; + + /* + * Check if the DT fragment received from TF-A had its RPC-IF device node + * enabled. + */ + if (fdt_magic(atf_fdt_blob) != FDT_MAGIC) + return; + + offset = fdt_path_offset(atf_fdt_blob, FDT_RPC_PATH); + if (offset < 0) + return; + + enabled = fdtdec_get_is_enabled(atf_fdt_blob, offset); + if (!enabled) + return; + + /* + * Find the RPC-IF device node, and enable it if it has a flash subnode. + */ + offset = fdt_path_offset(blob, FDT_RPC_PATH); + if (offset < 0) + return; + + if (fdt_subnode_offset(blob, offset, "flash") < 0) + return; + + fdt_status_okay(blob, offset); +} + +int ft_board_setup(void *blob, struct bd_info *bd) +{ + scrub_duplicate_memory(blob); + update_rpc_status(blob);
return 0; }

The compatible values used for device nodes representing Renesas Reduced Pin Count Interfaces were based on preliminary versions of the Device Tree Bindings.
Correct them in both DTSi files and drivers, to match the final DT Bindings.
Note that there are no DT bindings for RPC-IF on RZ/A1 yet, hence the most logical SoC-specific value is used, without specifying a family-specific value.
Signed-off-by: Geert Uytterhoeven geert+renesas@glider.be --- Not strictly necessary.
Perhaps you prefer to do this in a future DTS sync with e.g. Linux v5.19, to take care of the other differences in the RPC device nodes? --- arch/arm/dts/r7s72100-gr-peach-u-boot.dts | 2 +- arch/arm/dts/r8a774c0-u-boot.dtsi | 2 +- arch/arm/dts/r8a77950-u-boot.dtsi | 2 +- arch/arm/dts/r8a77960-u-boot.dtsi | 2 +- arch/arm/dts/r8a77965-u-boot.dtsi | 2 +- arch/arm/dts/r8a77970-u-boot.dtsi | 2 +- arch/arm/dts/r8a77980-u-boot.dtsi | 2 +- arch/arm/dts/r8a77990-u-boot.dtsi | 2 +- arch/arm/dts/r8a77995-u-boot.dtsi | 2 +- arch/arm/dts/r8a779a0-u-boot.dtsi | 2 +- drivers/mtd/renesas_rpc_hf.c | 3 ++- drivers/spi/renesas_rpc_spi.c | 9 ++------- 12 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/arch/arm/dts/r7s72100-gr-peach-u-boot.dts b/arch/arm/dts/r7s72100-gr-peach-u-boot.dts index 3f532eced23d354b..5b176a9acd75b62f 100644 --- a/arch/arm/dts/r7s72100-gr-peach-u-boot.dts +++ b/arch/arm/dts/r7s72100-gr-peach-u-boot.dts @@ -47,7 +47,7 @@
rpc: spi@ee200000 { - compatible = "renesas,rpc-r7s72100", "renesas,rpc"; + compatible = "renesas,r7s72100-rpc-if"; reg = <0x3fefa000 0x100>, <0x18000000 0x08000000>; bank-width = <2>; num-cs = <1>; diff --git a/arch/arm/dts/r8a774c0-u-boot.dtsi b/arch/arm/dts/r8a774c0-u-boot.dtsi index f50816a360dc5912..d29610676cacb7f6 100644 --- a/arch/arm/dts/r8a774c0-u-boot.dtsi +++ b/arch/arm/dts/r8a774c0-u-boot.dtsi @@ -11,7 +11,7 @@ / { soc { rpc: spi@ee200000 { - compatible = "renesas,rcar-gen3-rpc", "renesas,rpc-r8a774c0"; + compatible = "renesas,r8a774c0-rpc-if", "renesas,rcar-gen3-rpc-if"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0x04000000>; clocks = <&cpg CPG_MOD 917>; bank-width = <2>; diff --git a/arch/arm/dts/r8a77950-u-boot.dtsi b/arch/arm/dts/r8a77950-u-boot.dtsi index 5e449a3553cb9712..2306c7bab8489eb4 100644 --- a/arch/arm/dts/r8a77950-u-boot.dtsi +++ b/arch/arm/dts/r8a77950-u-boot.dtsi @@ -14,7 +14,7 @@ / { soc { rpc: spi@ee200000 { - compatible = "renesas,rpc-r8a7795", "renesas,rpc"; + compatible = "renesas,r8a7795-rpc-if", "renesas,rcar-gen3-rpc-if"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; bank-width = <2>; diff --git a/arch/arm/dts/r8a77960-u-boot.dtsi b/arch/arm/dts/r8a77960-u-boot.dtsi index 9013c291f5ffca8a..f64e5a416b0c18a6 100644 --- a/arch/arm/dts/r8a77960-u-boot.dtsi +++ b/arch/arm/dts/r8a77960-u-boot.dtsi @@ -14,7 +14,7 @@ / { soc { rpc: spi@ee200000 { - compatible = "renesas,rpc-r8a7796", "renesas,rpc"; + compatible = "renesas,r8a7796-rpc-if", "renesas,rcar-gen3-rpc-if"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; bank-width = <2>; diff --git a/arch/arm/dts/r8a77965-u-boot.dtsi b/arch/arm/dts/r8a77965-u-boot.dtsi index f3c99ac99cbc581a..c4abcc5a9b72b544 100644 --- a/arch/arm/dts/r8a77965-u-boot.dtsi +++ b/arch/arm/dts/r8a77965-u-boot.dtsi @@ -14,7 +14,7 @@ / { soc { rpc: spi@ee200000 { - compatible = "renesas,rpc-r8a77965", "renesas,rpc"; + compatible = "renesas,r8a77965-rpc-if", "renesas,rcar-gen3-rpc-if"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; bank-width = <2>; diff --git a/arch/arm/dts/r8a77970-u-boot.dtsi b/arch/arm/dts/r8a77970-u-boot.dtsi index 904fc48b2282b52a..614caa9e9c250f7a 100644 --- a/arch/arm/dts/r8a77970-u-boot.dtsi +++ b/arch/arm/dts/r8a77970-u-boot.dtsi @@ -14,7 +14,7 @@ / { soc { rpc: spi@ee200000 { - compatible = "renesas,rpc-r8a77970", "renesas,rpc"; + compatible = "renesas,r8a77970-rpc-if", "renesas,rcar-gen3-rpc-if"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; bank-width = <2>; diff --git a/arch/arm/dts/r8a77980-u-boot.dtsi b/arch/arm/dts/r8a77980-u-boot.dtsi index 34d6fcd2f013d762..54f01c926dcc1c14 100644 --- a/arch/arm/dts/r8a77980-u-boot.dtsi +++ b/arch/arm/dts/r8a77980-u-boot.dtsi @@ -14,7 +14,7 @@ / { soc { rpc: spi@ee200000 { - compatible = "renesas,rpc-r8a77980", "renesas,rpc"; + compatible = "renesas,r8a77980-rpc-if", "renesas,rcar-gen3-rpc-if"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; bank-width = <2>; diff --git a/arch/arm/dts/r8a77990-u-boot.dtsi b/arch/arm/dts/r8a77990-u-boot.dtsi index 8c75f62f5abec4cf..50bbbe186471e1a5 100644 --- a/arch/arm/dts/r8a77990-u-boot.dtsi +++ b/arch/arm/dts/r8a77990-u-boot.dtsi @@ -10,7 +10,7 @@ / { soc { rpc: spi@ee200000 { - compatible = "renesas,rpc-r8a77990", "renesas,rpc"; + compatible = "renesas,r8a77990-rpc-if", "renesas,rcar-gen3-rpc-if"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; bank-width = <2>; diff --git a/arch/arm/dts/r8a77995-u-boot.dtsi b/arch/arm/dts/r8a77995-u-boot.dtsi index cd9466625e27d57c..347b59ac42c058b6 100644 --- a/arch/arm/dts/r8a77995-u-boot.dtsi +++ b/arch/arm/dts/r8a77995-u-boot.dtsi @@ -10,7 +10,7 @@ / { soc { rpc: spi@ee200000 { - compatible = "renesas,rpc-r8a77995", "renesas,rpc"; + compatible = "renesas,r8a77995-rpc-if", "renesas,rcar-gen3-rpc-if"; reg = <0 0xee200000 0 0x100>, <0 0x08000000 0 0>; clocks = <&cpg CPG_MOD 917>; bank-width = <2>; diff --git a/arch/arm/dts/r8a779a0-u-boot.dtsi b/arch/arm/dts/r8a779a0-u-boot.dtsi index 83dbe3f20ef06824..9f2772a948581c01 100644 --- a/arch/arm/dts/r8a779a0-u-boot.dtsi +++ b/arch/arm/dts/r8a779a0-u-boot.dtsi @@ -10,7 +10,7 @@ / { soc { rpc: spi@ee200000 { - compatible = "renesas,rpc-r8a779a0", "renesas,rcar-gen3-rpc"; + compatible = "renesas,r8a779a0-rpc-if", "renesas,rcar-gen3-rpc-if"; reg = <0 0xee200000 0 0x200>, <0 0x08000000 0 0x04000000>; clocks = <&cpg CPG_MOD 629>; bank-width = <2>; diff --git a/drivers/mtd/renesas_rpc_hf.c b/drivers/mtd/renesas_rpc_hf.c index 2c61ce7b6e69326e..aca7a6cdd25b54eb 100644 --- a/drivers/mtd/renesas_rpc_hf.c +++ b/drivers/mtd/renesas_rpc_hf.c @@ -388,7 +388,8 @@ static int rpc_hf_probe(struct udevice *dev) }
static const struct udevice_id rpc_hf_ids[] = { - { .compatible = "renesas,rpc" }, + { .compatible = "renesas,r7s72100-rpc-if" }, + { .compatible = "renesas,rcar-gen3-rpc-if" }, {} };
diff --git a/drivers/spi/renesas_rpc_spi.c b/drivers/spi/renesas_rpc_spi.c index 26b6aa85c92bb711..cb2b8fb64def8266 100644 --- a/drivers/spi/renesas_rpc_spi.c +++ b/drivers/spi/renesas_rpc_spi.c @@ -449,13 +449,8 @@ static const struct dm_spi_ops rpc_spi_ops = { };
static const struct udevice_id rpc_spi_ids[] = { - { .compatible = "renesas,rpc-r7s72100" }, - { .compatible = "renesas,rpc-r8a7795" }, - { .compatible = "renesas,rpc-r8a7796" }, - { .compatible = "renesas,rpc-r8a77965" }, - { .compatible = "renesas,rpc-r8a77970" }, - { .compatible = "renesas,rpc-r8a77995" }, - { .compatible = "renesas,rcar-gen3-rpc" }, + { .compatible = "renesas,r7s72100-rpc-if" }, + { .compatible = "renesas,rcar-gen3-rpc-if" }, { } };

On Tue, Mar 29, 2022 at 2:19 PM Geert Uytterhoeven geert+renesas@glider.be wrote:
On Renesas R-Car Gen3 platforms, the SPI Multi I/O Bus Controllers (RPC-IF) provide access to HyperFlash or QSPI storage. On production systems, they are typically locked by the TF-A firmware, unless TF-A is built with RCAR_RPC_HYPERFLASH_LOCKED=0. When unlocked, TF-A communicates this to subsequent software by passing a DT fragment that sets the "status" property of the RPC-IF device node to "okay".
Unfortunately there are several issues preventing this from working all the way to Linux:
- TF-A (and U-Boot on the receiving side) uses a device node name that does not conform to the DT specification nor the DT bindings for RPC-IF,
- While U-Boot receives the RPC-IF enablement from TF-A, it does not propagate it to Linux yet,
- The DTS files that are part of Linux do not have RPC HyperFlash support yet.
The first issue in TF-A is handled by [1].
This patch series takes care of the first and second issue in U-Boot, by renaming the RPC-IF device node, and by propagating the enablement from TF-A, if present, to Linux. The third patch updates the RPC-IF compatible values to match the actual DT bindings, but this is not critical for operation, and can be postponed (e.g. by syncing DTS with Linux v5.19).
Patches to enable RPC-IF support in Linux are available at [2].
The patches to enable RPC HyperFlash support in Linux are now in v5.19-rc1. What needs to be done to accept the U-Boot counterpart?
Thanks!
Thanks for your comments!
[1] "[PATCH TF-A] fix(plat/rcar3): Fix RPC-IF device node name" https://lore.kernel.org/r/3685623bed84674039adb61e723288d359ab0a50.164854419... [2] "[PATCH 0/5] arm64: dts: renesas: rcar-gen3: Enable HyperFlash support" https://lore.kernel.org/r/cover.1648548339.git.geert+renesas@glider.be
Geert Uytterhoeven (3): ARM: dts: rmobile: Fix RPC-IF device node names ARM: renesas: Propagate RPC-IF enablement to subsequent software [RFC] renesas: Fix RPC-IF compatible values
arch/arm/dts/r7s72100-gr-peach-u-boot.dts | 4 +- arch/arm/dts/r8a774c0-u-boot.dtsi | 4 +- arch/arm/dts/r8a77950-u-boot.dtsi | 4 +- arch/arm/dts/r8a77960-u-boot.dtsi | 4 +- arch/arm/dts/r8a77965-u-boot.dtsi | 4 +- arch/arm/dts/r8a77970-u-boot.dtsi | 4 +- arch/arm/dts/r8a77980-u-boot.dtsi | 4 +- arch/arm/dts/r8a77990-u-boot.dtsi | 4 +- arch/arm/dts/r8a77995-u-boot.dtsi | 4 +- arch/arm/dts/r8a779a0-u-boot.dtsi | 2 +- board/renesas/rcar-common/common.c | 46 ++++++++++++++++++++++- drivers/mtd/renesas_rpc_hf.c | 3 +- drivers/spi/renesas_rpc_spi.c | 9 +---- 13 files changed, 67 insertions(+), 29 deletions(-)
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

Hi Iwamatsu-san, Marek,
On Wed, Jun 15, 2022 at 4:34 PM Geert Uytterhoeven geert@linux-m68k.org wrote:
On Tue, Mar 29, 2022 at 2:19 PM Geert Uytterhoeven geert+renesas@glider.be wrote:
On Renesas R-Car Gen3 platforms, the SPI Multi I/O Bus Controllers (RPC-IF) provide access to HyperFlash or QSPI storage. On production systems, they are typically locked by the TF-A firmware, unless TF-A is built with RCAR_RPC_HYPERFLASH_LOCKED=0. When unlocked, TF-A communicates this to subsequent software by passing a DT fragment that sets the "status" property of the RPC-IF device node to "okay".
Unfortunately there are several issues preventing this from working all the way to Linux:
- TF-A (and U-Boot on the receiving side) uses a device node name that does not conform to the DT specification nor the DT bindings for RPC-IF,
- While U-Boot receives the RPC-IF enablement from TF-A, it does not propagate it to Linux yet,
- The DTS files that are part of Linux do not have RPC HyperFlash support yet.
The first issue in TF-A is handled by [1].
This patch series takes care of the first and second issue in U-Boot, by renaming the RPC-IF device node, and by propagating the enablement from TF-A, if present, to Linux. The third patch updates the RPC-IF compatible values to match the actual DT bindings, but this is not critical for operation, and can be postponed (e.g. by syncing DTS with Linux v5.19).
Patches to enable RPC-IF support in Linux are available at [2].
The patches to enable RPC HyperFlash support in Linux are now in v5.19-rc1. What needs to be done to accept the U-Boot counterpart?
The Linux counterpart is now in v5.19. Can you please apply at least the first two patches to U-Boot? Thanks!
Thanks for your comments!
[1] "[PATCH TF-A] fix(plat/rcar3): Fix RPC-IF device node name" https://lore.kernel.org/r/3685623bed84674039adb61e723288d359ab0a50.164854419... [2] "[PATCH 0/5] arm64: dts: renesas: rcar-gen3: Enable HyperFlash support" https://lore.kernel.org/r/cover.1648548339.git.geert+renesas@glider.be
Geert Uytterhoeven (3): ARM: dts: rmobile: Fix RPC-IF device node names ARM: renesas: Propagate RPC-IF enablement to subsequent software [RFC] renesas: Fix RPC-IF compatible values
arch/arm/dts/r7s72100-gr-peach-u-boot.dts | 4 +- arch/arm/dts/r8a774c0-u-boot.dtsi | 4 +- arch/arm/dts/r8a77950-u-boot.dtsi | 4 +- arch/arm/dts/r8a77960-u-boot.dtsi | 4 +- arch/arm/dts/r8a77965-u-boot.dtsi | 4 +- arch/arm/dts/r8a77970-u-boot.dtsi | 4 +- arch/arm/dts/r8a77980-u-boot.dtsi | 4 +- arch/arm/dts/r8a77990-u-boot.dtsi | 4 +- arch/arm/dts/r8a77995-u-boot.dtsi | 4 +- arch/arm/dts/r8a779a0-u-boot.dtsi | 2 +- board/renesas/rcar-common/common.c | 46 ++++++++++++++++++++++- drivers/mtd/renesas_rpc_hf.c | 3 +- drivers/spi/renesas_rpc_spi.c | 9 +---- 13 files changed, 67 insertions(+), 29 deletions(-)
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
participants (2)
-
Geert Uytterhoeven
-
Geert Uytterhoeven