arm64: renesas: r8a77980a: Add support for CANFD2
Subsystems (5)
Geert Uytterhoeven
maintainercover arm64: renesas: r8a77980a: Add support for CANFD2
Hi all,
This patch series is an attempt to add support for the third CAN-FD channel on R-Car V3H2. It consists of three parts:
1. Extend Pin Function Control for the third CAN-FD pin group,
2. Extend the R-Car CAN-FD driver for third CAN-FD channel,
3. Update DTS.
Unfortunately full testing requires local access to a (modified) Condor-I board:
- CANFD2 can be made available on GP1_19 and GP1_20, which are routed to test points CP4 and CP5, and to EXIO connector A after populating two zero-ohm resistors,
- The ADV7511W node must be disabled, as its interrupt pin is shared with CANFD2_RX,
- An external CAN transceiver must be added.
Alternatively, perhaps some testing can be performed by adding support for the various test modes (External/Internal Loopback Mode, Inter-Channel Communication Test) to the CAN-FD driver?
I still have to look into that...
Thanks for your comments!
Geert Uytterhoeven (6):
dt-bindings: pinctrl: renesas: Document R-Car V3H2 support
pinctrl: renesas: r8a77980: Add R-Car V3H2 support
dt-bindings: can: renesas,rcar-canfd: Document R-Car V3H2 support
can: rcar_canfd: Increase number of channels to 3 on R-Car Gen3
arm64: dts: renesas: r8a77980a: Update PFC compatible
arm64: dts: renesas: r8a77980a: Add support for CAN-FD channel 2
.../bindings/net/can/renesas,rcar-canfd.yaml | 18 +- .../bindings/pinctrl/renesas,pfc.yaml | 72 +-- arch/arm64/boot/dts/renesas/r8a77980a.dtsi | 12 + drivers/net/can/rcar/rcar_canfd.c | 2 +- drivers/pinctrl/renesas/core.c | 4 + drivers/pinctrl/renesas/pfc-r8a77980.c | 457 ++++++++++-------- drivers/pinctrl/renesas/sh_pfc.h | 1 + 7 files changed, 326 insertions(+), 240 deletions(-)
Signature · 12 lines
2.43.0
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
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 TorvaldsGeert Uytterhoeven
maintainerPATCH 1/6 dt-bindings: pinctrl: renesas: Document R-Car V3H2 support
Document support for the Pin Function Controller in the Renesas R-Car V3H2 (R8A77980A) SoC, which is an extension of the PFC in R-Car V3H.
--- .../bindings/pinctrl/renesas,pfc.yaml | 72 ++++++++++--------- 1 file changed, 38 insertions(+), 34 deletions(-)
Documentation/devicetree/bindings/pinctrl/renesas,pfc.yaml +38 -34
@@ -15,40 +15,44 @@ description: properties: compatible: - enum: - - renesas,pfc-emev2 # EMMA Mobile EV2 - - renesas,pfc-r8a73a4 # R-Mobile APE6 - - renesas,pfc-r8a7740 # R-Mobile A1 - - renesas,pfc-r8a7742 # RZ/G1H - - renesas,pfc-r8a7743 # RZ/G1M - - renesas,pfc-r8a7744 # RZ/G1N - - renesas,pfc-r8a7745 # RZ/G1E - - renesas,pfc-r8a77470 # RZ/G1C - - renesas,pfc-r8a774a1 # RZ/G2M - - renesas,pfc-r8a774a3 # RZ/G2M v3.0 - - renesas,pfc-r8a774b1 # RZ/G2N - - renesas,pfc-r8a774c0 # RZ/G2E - - renesas,pfc-r8a774e1 # RZ/G2H - - renesas,pfc-r8a7778 # R-Car M1 - - renesas,pfc-r8a7779 # R-Car H1 - - renesas,pfc-r8a7790 # R-Car H2 - - renesas,pfc-r8a7791 # R-Car M2-W - - renesas,pfc-r8a7792 # R-Car V2H - - renesas,pfc-r8a7793 # R-Car M2-N - - renesas,pfc-r8a7794 # R-Car E2 - - renesas,pfc-r8a7795 # R-Car H3 - - renesas,pfc-r8a7796 # R-Car M3-W - - renesas,pfc-r8a77961 # R-Car M3-W+ - - renesas,pfc-r8a77965 # R-Car M3-N - - renesas,pfc-r8a77970 # R-Car V3M - - renesas,pfc-r8a77980 # R-Car V3H - - renesas,pfc-r8a77990 # R-Car E3 - - renesas,pfc-r8a77995 # R-Car D3 - - renesas,pfc-r8a779a0 # R-Car V3U - - renesas,pfc-r8a779f0 # R-Car S4-8 - - renesas,pfc-r8a779g0 # R-Car V4H - - renesas,pfc-r8a779h0 # R-Car V4M - - renesas,pfc-sh73a0 # SH-Mobile AG5 + oneOf: + - enum: + - renesas,pfc-emev2 # EMMA Mobile EV2 + - renesas,pfc-r8a73a4 # R-Mobile APE6 + - renesas,pfc-r8a7740 # R-Mobile A1 + - renesas,pfc-r8a7742 # RZ/G1H + - renesas,pfc-r8a7743 # RZ/G1M + - renesas,pfc-r8a7744 # RZ/G1N + - renesas,pfc-r8a7745 # RZ/G1E + - renesas,pfc-r8a77470 # RZ/G1C + - renesas,pfc-r8a774a1 # RZ/G2M + - renesas,pfc-r8a774a3 # RZ/G2M v3.0 + - renesas,pfc-r8a774b1 # RZ/G2N + - renesas,pfc-r8a774c0 # RZ/G2E + - renesas,pfc-r8a774e1 # RZ/G2H + - renesas,pfc-r8a7778 # R-Car M1 + - renesas,pfc-r8a7779 # R-Car H1 + - renesas,pfc-r8a7790 # R-Car H2 + - renesas,pfc-r8a7791 # R-Car M2-W + - renesas,pfc-r8a7792 # R-Car V2H + - renesas,pfc-r8a7793 # R-Car M2-N + - renesas,pfc-r8a7794 # R-Car E2 + - renesas,pfc-r8a7795 # R-Car H3 + - renesas,pfc-r8a7796 # R-Car M3-W + - renesas,pfc-r8a77961 # R-Car M3-W+ + - renesas,pfc-r8a77965 # R-Car M3-N + - renesas,pfc-r8a77970 # R-Car V3M + - renesas,pfc-r8a77980 # R-Car V3H + - renesas,pfc-r8a77990 # R-Car E3 + - renesas,pfc-r8a77995 # R-Car D3 + - renesas,pfc-r8a779a0 # R-Car V3U + - renesas,pfc-r8a779f0 # R-Car S4-8 + - renesas,pfc-r8a779g0 # R-Car V4H + - renesas,pfc-r8a779h0 # R-Car V4M + - renesas,pfc-sh73a0 # SH-Mobile AG5 + - items: + - const: renesas,pfc-r8a77980a # R-Car V3H2 + - const: renesas,pfc-r8a77980 # Fallback reg: minItems: 1
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 2/6 pinctrl: renesas: r8a77980: Add R-Car V3H2 support
In reply to Geert UytterhoevenAdd support for the Pin Function Controller in the Renesas R-Car V3H2 (R8A77980A) SoC, which contains a third CAN-FD pin group.
--- drivers/pinctrl/renesas/core.c | 4 + drivers/pinctrl/renesas/pfc-r8a77980.c | 457 ++++++++++++++----------- drivers/pinctrl/renesas/sh_pfc.h | 1 + 3 files changed, 261 insertions(+), 201 deletions(-)
drivers/pinctrl/renesas/core.c +4 -0
@@ -607,6 +607,10 @@ static const struct of_device_id sh_pfc_of_table[] = { .compatible = "renesas,pfc-r8a77980", .data = &r8a77980_pinmux_info, }, + { + .compatible = "renesas,pfc-r8a77980a", + .data = &r8a77980a_pinmux_info, + },#endif #ifdef CONFIG_PINCTRL_PFC_R8A77990 {
drivers/pinctrl/renesas/pfc-r8a77980.c +256 -201
503 lines not on this page · raw message
drivers/pinctrl/renesas/sh_pfc.h +1 -0
@@ -317,6 +317,7 @@ extern const struct sh_pfc_soc_info r8a77961_pinmux_info;extern const struct sh_pfc_soc_info r8a77965_pinmux_info;extern const struct sh_pfc_soc_info r8a77970_pinmux_info;extern const struct sh_pfc_soc_info r8a77980_pinmux_info; +extern const struct sh_pfc_soc_info r8a77980a_pinmux_info;extern const struct sh_pfc_soc_info r8a77990_pinmux_info;extern const struct sh_pfc_soc_info r8a77995_pinmux_info;extern const struct sh_pfc_soc_info r8a779a0_pinmux_info;
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 3/6 dt-bindings: can: renesas,rcar-canfd: Document R-Car V3H2 support
In reply to Geert UytterhoevenDocument support for the CAN-FD Controller in the Renesas R-Car V3H2 (R8A77980A) SoC, which is similar to CAN-FD on R-Car V3H, but supports a third channel.
---
As "renesas,r8a77980a-canfd" already uses "renesas,rcar-gen3-canfd" as a fallback (which lets us use two channels with existing drivers), and the driver doesn't have special handling for "renesas,r8a77980-canfd", I see no need to complicate the bindings with "renesas,r8a77980-canfd" as a second fallback like:
- items:
- const: renesas,r8a77980a-canfd # R-Car V3H2
- const: renesas,r8a77980-canfd # R-Car V3H
- const: renesas,rcar-gen3-canfd # R-Car Gen3 and RZ/G2
--- .../bindings/net/can/renesas,rcar-canfd.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml +14 -4
@@ -24,6 +24,7 @@ properties: - renesas,r8a77965-canfd # R-Car M3-N - renesas,r8a77970-canfd # R-Car V3M - renesas,r8a77980-canfd # R-Car V3H + - renesas,r8a77980a-canfd # R-Car V3H2 - renesas,r8a77990-canfd # R-Car E3 - renesas,r8a77995-canfd # R-Car D3 - const: renesas,rcar-gen3-canfd # R-Car Gen3 and RZ/G2
@@ -242,12 +243,21 @@ allOf: properties: compatible: contains: - enum: - - renesas,rcar-gen3-canfd - - renesas,rzg2l-canfd + const: renesas,r8a77980a-canfd then: patternProperties: - "^channel[2-7]$": false + "^channel[3-7]$": false + else: + if: + properties: + compatible: + contains: + enum: + - renesas,rcar-gen3-canfd + - renesas,rzg2l-canfd + then: + patternProperties: + "^channel[2-7]$": false - if: properties:
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 4/6 can: rcar_canfd: Increase number of channels on R-Car Gen3
In reply to Geert UytterhoevenThe CAN-FD Controller in the Renesas R-Car V3H2 (R8A77980A) SoC is very similar to CAN-FD on other R-Car Gen3 SoCs, but supports a third channel.
Commit e9ffa12e02e19339 ("can: rcar_canfd: Add rnc_field_width variable to struct rcar_canfd_hw_info") removed the assumption of a maximum of two channels on controllers using the R-Car Gen3 register layout. Hence add support for a third channel by increasing the maximum number of channels on R-Car Gen3 to three.
Just like on R-Car Gen4, the applicable maximum numbers of channels is enforced by SoC-specific rules in the DT bindings, and the "dtbs_check" make target.
--- drivers/net/can/rcar/rcar_canfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/rcar/rcar_canfd.c +1 -1
@@ -715,7 +715,7 @@ static const struct rcar_canfd_hw_info rcar_gen3_hw_info = { .rnc_field_width = 8, .max_aflpn = 31, .max_cftml = 15, - .max_channels = 2, + .max_channels = 3, .postdiv = 2, .shared_global_irqs = 1, .ch_interface_mode = 0,
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 5/6 arm64: dts: renesas: r8a77980a: Update PFC compatible
In reply to Geert UytterhoevenThe Pin Function Controller in R-Car V3H2 is an extension of the PFC in R-Car V3H. Override the compatible property to reflect this.
--- arch/arm64/boot/dts/renesas/r8a77980a.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/renesas/r8a77980a.dtsi +4 -0
@@ -9,3 +9,7 @@ / { compatible = "renesas,r8a77980a", "renesas,r8a77980"; }; + +&pfc { + compatible = "renesas,pfc-r8a77980a", "renesas,pfc-r8a77980"; +};
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 6/6 arm64: dts: renesas: r8a77980a: Add support for CAN-FD channel 2
In reply to Geert UytterhoevenR-Car V3H2 supports one more CAN-FD channel than R-Car V3H. Add support for this third channel by overriding the compatible property in the CAN-FD node, and adding a subnode representing the third channel.
--- arch/arm64/boot/dts/renesas/r8a77980a.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/renesas/r8a77980a.dtsi +8 -0
@@ -10,6 +10,14 @@ / { compatible = "renesas,r8a77980a", "renesas,r8a77980"; }; +&canfd { + compatible = "renesas,r8a77980a-canfd", "renesas,rcar-gen3-canfd"; + + channel2 { + status = "disabled"; + }; +}; + &pfc { compatible = "renesas,pfc-r8a77980a", "renesas,pfc-r8a77980"; };
Signature · 1 line
2.43.0