All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems
@ 2023-01-23 18:56 Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4 Geert Uytterhoeven
                   ` (16 more replies)
  0 siblings, 17 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

	Hi all,

This patch series adds support for the CAN-FD interface on the Renesas
R-Car V4H (R8A779G0) SoC and support for CAN transceivers described as
PHYs to the R-Car CAN-FD driver.  It includes several fixes for issues
(some minor) detected while adding the support and during testing.
More details can be found in the individual patches.

Note that the last patch depends on "[PATCH 1/7] phy: Add
devm_of_phy_optional_get() helper"[1].

This has been tested on the Renesas White-Hawk development board using
cansend, candump, and canfdtest:
  - Channel 0 uses an NXP TJR1443AT CAN transceiver, and works fine,
  - Channels 1-7 use Microchip MCP2558FD-H/SN CAN transceivers (not
    mounted for channels 4-7), which do not need explicit description.
    While channel 1 works fine, channels 2-3 do not seem to work.

Hence despite the new fixes, the test results are similar to what Ulrich
Hecht reported for R-Car V3U on the Falcon development board before,
i.e. only channels 0 and 1 work (FTR, [2] does not help).
Whether this is a CAN-FD driver issue, a pin control issue, an IP core
issue, or an SoC integration issue is still to be seen...


Thanks for your comments!

[1] https://lore.kernel.org/all/f53a1bcca637ceeafb04ce3540a605532d3bc34a.1674036164.git.geert+renesas@glider.be
[2] commit e3e5bccc92446048 ("can: rcar_canfd:
    rcar_canfd_configure_afl_rules(): Fix Rx FIFO entry setting") in
    renesas-bsp/v5.10.147/rcar-5.2.0.rc3.

Geert Uytterhoeven (12):
  dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4
  dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support
  dt-bindings: can: renesas,rcar-canfd: Add transceiver support
  can: rcar_canfd: Fix R-Car V3U CAN mode selection
  can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses
  can: rcar_canfd: Abstract out DCFG address differences
  can: rcar_canfd: Add support for R-Car Gen4
  can: rcar_canfd: Fix R-Car Gen4 DCFG.DSJW field width
  can: rcar_canfd: Fix R-Car Gen4 CFCC.CFTML field width
  can: rcar_canfd: Sort included header files
  can: rcar_canfd: Add helper variable dev
  can: rcar_canfd: Add transceiver support

 .../bindings/net/can/renesas,rcar-canfd.yaml  |  16 +-
 drivers/net/can/rcar/rcar_canfd.c             | 255 ++++++++++--------
 2 files changed, 148 insertions(+), 123 deletions(-)

-- 
2.34.1

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-31 17:17   ` Rob Herring
  2023-01-23 18:56 ` [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support Geert Uytterhoeven
                   ` (15 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

Despite the name, R-Car V3U is the first member of the R-Car Gen4
family.  Hence generalize this by introducing a family-specific
compatible value for R-Car Gen4.

While at it, replace "both channels" by "all channels", as the numbers
of channels may differ from two.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 .../bindings/net/can/renesas,rcar-canfd.yaml          | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
index 1eb98c9a1a2602bc..899efa8a0614e229 100644
--- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
@@ -28,6 +28,11 @@ properties:
               - renesas,r8a77995-canfd     # R-Car D3
           - const: renesas,rcar-gen3-canfd # R-Car Gen3 and RZ/G2
 
+      - items:
+          - enum:
+              - renesas,r8a779a0-canfd     # R-Car V3U
+          - const: renesas,rcar-gen4-canfd # R-Car Gen4
+
       - items:
           - enum:
               - renesas,r9a07g043-canfd    # RZ/G2UL and RZ/Five
@@ -35,8 +40,6 @@ properties:
               - renesas,r9a07g054-canfd    # RZ/V2L
           - const: renesas,rzg2l-canfd     # RZ/G2L family
 
-      - const: renesas,r8a779a0-canfd      # R-Car V3U
-
   reg:
     maxItems: 1
 
@@ -60,7 +63,7 @@ properties:
     $ref: /schemas/types.yaml#/definitions/flag
     description:
       The controller can operate in either CAN FD only mode (default) or
-      Classical CAN only mode.  The mode is global to both the channels.
+      Classical CAN only mode.  The mode is global to all channels.
       Specify this property to put the controller in Classical CAN only mode.
 
   assigned-clocks:
@@ -159,7 +162,7 @@ allOf:
         properties:
           compatible:
             contains:
-              const: renesas,r8a779a0-canfd
+              const: renesas,rcar-gen4-canfd
     then:
       patternProperties:
         "^channel[2-7]$": false
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4 Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-31 17:18   ` Rob Herring
  2023-01-23 18:56 ` [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support Geert Uytterhoeven
                   ` (14 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

Document support for the CAN-FD Interface on the Renesas R-Car V4H
(R8A779G0) SoC.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 .../devicetree/bindings/net/can/renesas,rcar-canfd.yaml          | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
index 899efa8a0614e229..04b7f0afdce1e3c6 100644
--- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
@@ -31,6 +31,7 @@ properties:
       - items:
           - enum:
               - renesas,r8a779a0-canfd     # R-Car V3U
+              - renesas,r8a779g0-canfd     # R-Car V4H
           - const: renesas,rcar-gen4-canfd # R-Car Gen4
 
       - items:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4 Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-31 17:18   ` Rob Herring
  2023-01-23 18:56 ` [PATCH 04/12] can: rcar_canfd: Fix R-Car V3U CAN mode selection Geert Uytterhoeven
                   ` (13 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

Add support for describing CAN transceivers as PHYs.

While simple CAN transceivers can do without, this is needed for CAN
transceivers like NXP TJR1443 that need a configuration step (like
pulling standby or enable lines), and/or impose a bitrate limit.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 .../devicetree/bindings/net/can/renesas,rcar-canfd.yaml       | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
index 04b7f0afdce1e3c6..d3f45d29fa0a550a 100644
--- a/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/renesas,rcar-canfd.yaml
@@ -84,6 +84,10 @@ patternProperties:
       The controller supports multiple channels and each is represented as a
       child node.  Each channel can be enabled/disabled individually.
 
+    properties:
+      phys:
+        maxItems: 1
+
     additionalProperties: false
 
 required:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 04/12] can: rcar_canfd: Fix R-Car V3U CAN mode selection
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2023-01-23 18:56 ` [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 05/12] can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses Geert Uytterhoeven
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

When adding support for R-Car V3U, the Global FD Configuration register
(CFDGFDCFG) and the Channel-specific CAN-FD Configuration Registers
(CFDCmFDCFG) were mixed up.  Use the correct register, and apply the
selected CAN mode to all available channels.

Annotate the corresponding register bits, to make it clear they do
not exist on older variants.

Fixes: 45721c406dcf50d4 ("can: rcar_canfd: Add support for r8a779a0 SoC")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Currently the selected CAN mode is a global setting (controlled through
the "renesas,no-can-fd" DT property), but the variant on R-Car V3U and
later seems to support configuring this per-channel.  Whether
"renesas,no-can-fd" can be made channel-specific is still to be seen, as
the driver performs some global configuration based on the selected CAN
mode.
---
 drivers/net/can/rcar/rcar_canfd.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index f6fa7157b99b07da..88de17d0bd79d627 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -197,8 +197,8 @@
 #define RCANFD_DCFG_DBRP(x)		(((x) & 0xff) << 0)
 
 /* RSCFDnCFDCmFDCFG */
-#define RCANFD_FDCFG_CLOE		BIT(30)
-#define RCANFD_FDCFG_FDOE		BIT(28)
+#define RCANFD_V3U_FDCFG_CLOE		BIT(30)
+#define RCANFD_V3U_FDCFG_FDOE		BIT(28)
 #define RCANFD_FDCFG_TDCE		BIT(9)
 #define RCANFD_FDCFG_TDCOC		BIT(8)
 #define RCANFD_FDCFG_TDCO(x)		(((x) & 0x7f) >> 16)
@@ -429,8 +429,8 @@
 #define RCANFD_C_RPGACC(r)		(0x1900 + (0x04 * (r)))
 
 /* R-Car V3U Classical and CAN FD mode specific register map */
-#define RCANFD_V3U_CFDCFG		(0x1314)
 #define RCANFD_V3U_DCFG(m)		(0x1400 + (0x20 * (m)))
+#define RCANFD_V3U_FDCFG(m)		(0x1404 + (0x20 * (m)))
 
 #define RCANFD_V3U_GAFL_OFFSET		(0x1800)
 
@@ -689,12 +689,13 @@ static void rcar_canfd_tx_failure_cleanup(struct net_device *ndev)
 static void rcar_canfd_set_mode(struct rcar_canfd_global *gpriv)
 {
 	if (is_v3u(gpriv)) {
-		if (gpriv->fdmode)
-			rcar_canfd_set_bit(gpriv->base, RCANFD_V3U_CFDCFG,
-					   RCANFD_FDCFG_FDOE);
-		else
-			rcar_canfd_set_bit(gpriv->base, RCANFD_V3U_CFDCFG,
-					   RCANFD_FDCFG_CLOE);
+		u32 ch, val = gpriv->fdmode ? RCANFD_V3U_FDCFG_FDOE
+					    : RCANFD_V3U_FDCFG_CLOE;
+
+		for_each_set_bit(ch, &gpriv->channels_mask,
+				 gpriv->info->max_channels)
+			rcar_canfd_set_bit(gpriv->base, RCANFD_V3U_FDCFG(ch),
+					   val);
 	} else {
 		if (gpriv->fdmode)
 			rcar_canfd_set_bit(gpriv->base, RCANFD_GRMCFG,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 05/12] can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2023-01-23 18:56 ` [PATCH 04/12] can: rcar_canfd: Fix R-Car V3U CAN mode selection Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 06/12] can: rcar_canfd: Abstract out DCFG address differences Geert Uytterhoeven
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

Each Global Acceptance Filter List Configuration Register (GAFLCFG)
contains two fields, and stores the number of channel rules for one
channel pair.

As R-Car V3U and later can have more than 2 channels, the field
selection should be based on the LSB (even or odd) of the channel
number, instead of on the full channel number.

Fixes: 45721c406dcf50d4 ("can: rcar_canfd: Add support for r8a779a0 SoC")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/can/rcar/rcar_canfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 88de17d0bd79d627..77b21c82faf38ee1 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -92,10 +92,10 @@
 /* RSCFDnCFDGAFLCFG0 / RSCFDnGAFLCFG0 */
 #define RCANFD_GAFLCFG_SETRNC(gpriv, n, x) \
 	(((x) & reg_v3u(gpriv, 0x1ff, 0xff)) << \
-	 (reg_v3u(gpriv, 16, 24) - (n) * reg_v3u(gpriv, 16, 8)))
+	 (reg_v3u(gpriv, 16, 24) - ((n) & 1) * reg_v3u(gpriv, 16, 8)))
 
 #define RCANFD_GAFLCFG_GETRNC(gpriv, n, x) \
-	(((x) >> (reg_v3u(gpriv, 16, 24) - (n) * reg_v3u(gpriv, 16, 8))) & \
+	(((x) >> (reg_v3u(gpriv, 16, 24) - ((n) & 1) * reg_v3u(gpriv, 16, 8))) & \
 	 reg_v3u(gpriv, 0x1ff, 0xff))
 
 /* RSCFDnCFDGAFLECTR / RSCFDnGAFLECTR */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/12] can: rcar_canfd: Abstract out DCFG address differences
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2023-01-23 18:56 ` [PATCH 05/12] can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 07/12] can: rcar_canfd: Add support for R-Car Gen4 Geert Uytterhoeven
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

Abstract the different addresses for the Channel n Data Bitrate
Configuration Register (DCFG) in the definition of the register macro,
like is already done for other register definitions, to simplify code
accessing this register.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/can/rcar/rcar_canfd.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 77b21c82faf38ee1..6bf80cefc307893b 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -429,7 +429,6 @@
 #define RCANFD_C_RPGACC(r)		(0x1900 + (0x04 * (r)))
 
 /* R-Car V3U Classical and CAN FD mode specific register map */
-#define RCANFD_V3U_DCFG(m)		(0x1400 + (0x20 * (m)))
 #define RCANFD_V3U_FDCFG(m)		(0x1404 + (0x20 * (m)))
 
 #define RCANFD_V3U_GAFL_OFFSET		(0x1800)
@@ -437,7 +436,7 @@
 /* CAN FD mode specific register map */
 
 /* RSCFDnCFDCmXXX -> RCANFD_F_XXX(m) */
-#define RCANFD_F_DCFG(m)		(0x0500 + (0x20 * (m)))
+#define RCANFD_F_DCFG(gpriv, m)		(reg_v3u(gpriv, 0x1400, 0x0500) + (0x20 * (m)))
 #define RCANFD_F_CFDCFG(m)		(0x0504 + (0x20 * (m)))
 #define RCANFD_F_CFDCTR(m)		(0x0508 + (0x20 * (m)))
 #define RCANFD_F_CFDSTS(m)		(0x050c + (0x20 * (m)))
@@ -1346,10 +1345,7 @@ static void rcar_canfd_set_bittiming(struct net_device *dev)
 		cfg = (RCANFD_DCFG_DTSEG1(gpriv, tseg1) | RCANFD_DCFG_DBRP(brp) |
 		       RCANFD_DCFG_DSJW(sjw) | RCANFD_DCFG_DTSEG2(gpriv, tseg2));
 
-		if (is_v3u(gpriv))
-			rcar_canfd_write(priv->base, RCANFD_V3U_DCFG(ch), cfg);
-		else
-			rcar_canfd_write(priv->base, RCANFD_F_DCFG(ch), cfg);
+		rcar_canfd_write(priv->base, RCANFD_F_DCFG(gpriv, ch), cfg);
 		netdev_dbg(priv->ndev, "drate: brp %u, sjw %u, tseg1 %u, tseg2 %u\n",
 			   brp, sjw, tseg1, tseg2);
 	} else {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 07/12] can: rcar_canfd: Add support for R-Car Gen4
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (5 preceding siblings ...)
  2023-01-23 18:56 ` [PATCH 06/12] can: rcar_canfd: Abstract out DCFG address differences Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 08/12] can: rcar_canfd: Fix R-Car Gen4 DCFG.DSJW field width Geert Uytterhoeven
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

Despite the name, R-Car V3U (R8A779A0) was the first member of the R-Car
Gen4 family.  Generalize the support for R-Car V3U to other SoCs in the
R-Car Gen4 family by adding a family-specific compatible value, and by
replacing all references to "V3U" by "Gen4".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/can/rcar/rcar_canfd.c | 99 ++++++++++++++++---------------
 1 file changed, 50 insertions(+), 49 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 6bf80cefc307893b..aa7fcd4a47d38bc9 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -82,8 +82,8 @@
 #define RCANFD_GERFL_DEF		BIT(0)
 
 #define RCANFD_GERFL_ERR(gpriv, x) \
-	((x) & (reg_v3u(gpriv, RCANFD_GERFL_EEF0_7, \
-			RCANFD_GERFL_EEF(0) | RCANFD_GERFL_EEF(1)) | \
+	((x) & (reg_gen4(gpriv, RCANFD_GERFL_EEF0_7, \
+			 RCANFD_GERFL_EEF(0) | RCANFD_GERFL_EEF(1)) | \
 		RCANFD_GERFL_MES | \
 		((gpriv)->fdmode ? RCANFD_GERFL_CMPOF : 0)))
 
@@ -91,16 +91,16 @@
 
 /* RSCFDnCFDGAFLCFG0 / RSCFDnGAFLCFG0 */
 #define RCANFD_GAFLCFG_SETRNC(gpriv, n, x) \
-	(((x) & reg_v3u(gpriv, 0x1ff, 0xff)) << \
-	 (reg_v3u(gpriv, 16, 24) - ((n) & 1) * reg_v3u(gpriv, 16, 8)))
+	(((x) & reg_gen4(gpriv, 0x1ff, 0xff)) << \
+	 (reg_gen4(gpriv, 16, 24) - ((n) & 1) * reg_gen4(gpriv, 16, 8)))
 
 #define RCANFD_GAFLCFG_GETRNC(gpriv, n, x) \
-	(((x) >> (reg_v3u(gpriv, 16, 24) - ((n) & 1) * reg_v3u(gpriv, 16, 8))) & \
-	 reg_v3u(gpriv, 0x1ff, 0xff))
+	(((x) >> (reg_gen4(gpriv, 16, 24) - ((n) & 1) * reg_gen4(gpriv, 16, 8))) & \
+	 reg_gen4(gpriv, 0x1ff, 0xff))
 
 /* RSCFDnCFDGAFLECTR / RSCFDnGAFLECTR */
 #define RCANFD_GAFLECTR_AFLDAE		BIT(8)
-#define RCANFD_GAFLECTR_AFLPN(gpriv, x)	((x) & reg_v3u(gpriv, 0x7f, 0x1f))
+#define RCANFD_GAFLECTR_AFLPN(gpriv, x)	((x) & reg_gen4(gpriv, 0x7f, 0x1f))
 
 /* RSCFDnCFDGAFLIDj / RSCFDnGAFLIDj */
 #define RCANFD_GAFLID_GAFLLB		BIT(29)
@@ -118,13 +118,13 @@
 
 /* RSCFDnCFDCmNCFG - CAN FD only */
 #define RCANFD_NCFG_NTSEG2(gpriv, x) \
-	(((x) & reg_v3u(gpriv, 0x7f, 0x1f)) << reg_v3u(gpriv, 25, 24))
+	(((x) & reg_gen4(gpriv, 0x7f, 0x1f)) << reg_gen4(gpriv, 25, 24))
 
 #define RCANFD_NCFG_NTSEG1(gpriv, x) \
-	(((x) & reg_v3u(gpriv, 0xff, 0x7f)) << reg_v3u(gpriv, 17, 16))
+	(((x) & reg_gen4(gpriv, 0xff, 0x7f)) << reg_gen4(gpriv, 17, 16))
 
 #define RCANFD_NCFG_NSJW(gpriv, x) \
-	(((x) & reg_v3u(gpriv, 0x7f, 0x1f)) << reg_v3u(gpriv, 10, 11))
+	(((x) & reg_gen4(gpriv, 0x7f, 0x1f)) << reg_gen4(gpriv, 10, 11))
 
 #define RCANFD_NCFG_NBRP(x)		(((x) & 0x3ff) << 0)
 
@@ -189,16 +189,16 @@
 #define RCANFD_DCFG_DSJW(x)		(((x) & 0x7) << 24)
 
 #define RCANFD_DCFG_DTSEG2(gpriv, x) \
-	(((x) & reg_v3u(gpriv, 0x0f, 0x7)) << reg_v3u(gpriv, 16, 20))
+	(((x) & reg_gen4(gpriv, 0x0f, 0x7)) << reg_gen4(gpriv, 16, 20))
 
 #define RCANFD_DCFG_DTSEG1(gpriv, x) \
-	(((x) & reg_v3u(gpriv, 0x1f, 0xf)) << reg_v3u(gpriv, 8, 16))
+	(((x) & reg_gen4(gpriv, 0x1f, 0xf)) << reg_gen4(gpriv, 8, 16))
 
 #define RCANFD_DCFG_DBRP(x)		(((x) & 0xff) << 0)
 
 /* RSCFDnCFDCmFDCFG */
-#define RCANFD_V3U_FDCFG_CLOE		BIT(30)
-#define RCANFD_V3U_FDCFG_FDOE		BIT(28)
+#define RCANFD_GEN4_FDCFG_CLOE		BIT(30)
+#define RCANFD_GEN4_FDCFG_FDOE		BIT(28)
 #define RCANFD_FDCFG_TDCE		BIT(9)
 #define RCANFD_FDCFG_TDCOC		BIT(8)
 #define RCANFD_FDCFG_TDCO(x)		(((x) & 0x7f) >> 16)
@@ -233,10 +233,10 @@
 /* Common FIFO bits */
 
 /* RSCFDnCFDCFCCk */
-#define RCANFD_CFCC_CFTML(gpriv, x)	(((x) & 0xf) << reg_v3u(gpriv, 16, 20))
-#define RCANFD_CFCC_CFM(gpriv, x)	(((x) & 0x3) << reg_v3u(gpriv,  8, 16))
+#define RCANFD_CFCC_CFTML(gpriv, x)	(((x) & 0xf) << reg_gen4(gpriv, 16, 20))
+#define RCANFD_CFCC_CFM(gpriv, x)	(((x) & 0x3) << reg_gen4(gpriv,  8, 16))
 #define RCANFD_CFCC_CFIM		BIT(12)
-#define RCANFD_CFCC_CFDC(gpriv, x)	(((x) & 0x7) << reg_v3u(gpriv, 21,  8))
+#define RCANFD_CFCC_CFDC(gpriv, x)	(((x) & 0x7) << reg_gen4(gpriv, 21,  8))
 #define RCANFD_CFCC_CFPLS(x)		(((x) & 0x7) << 4)
 #define RCANFD_CFCC_CFTXIE		BIT(2)
 #define RCANFD_CFCC_CFE			BIT(0)
@@ -304,7 +304,7 @@
 #define RCANFD_RMND(y)			(0x00a8 + (0x04 * (y)))
 
 /* RSCFDnCFDRFCCx / RSCFDnRFCCx */
-#define RCANFD_RFCC(gpriv, x)		(reg_v3u(gpriv, 0x00c0, 0x00b8) + (0x04 * (x)))
+#define RCANFD_RFCC(gpriv, x)		(reg_gen4(gpriv, 0x00c0, 0x00b8) + (0x04 * (x)))
 /* RSCFDnCFDRFSTSx / RSCFDnRFSTSx */
 #define RCANFD_RFSTS(gpriv, x)		(RCANFD_RFCC(gpriv, x) + 0x20)
 /* RSCFDnCFDRFPCTRx / RSCFDnRFPCTRx */
@@ -314,13 +314,13 @@
 
 /* RSCFDnCFDCFCCx / RSCFDnCFCCx */
 #define RCANFD_CFCC(gpriv, ch, idx) \
-	(reg_v3u(gpriv, 0x0120, 0x0118) + (0x0c * (ch)) + (0x04 * (idx)))
+	(reg_gen4(gpriv, 0x0120, 0x0118) + (0x0c * (ch)) + (0x04 * (idx)))
 /* RSCFDnCFDCFSTSx / RSCFDnCFSTSx */
 #define RCANFD_CFSTS(gpriv, ch, idx) \
-	(reg_v3u(gpriv, 0x01e0, 0x0178) + (0x0c * (ch)) + (0x04 * (idx)))
+	(reg_gen4(gpriv, 0x01e0, 0x0178) + (0x0c * (ch)) + (0x04 * (idx)))
 /* RSCFDnCFDCFPCTRx / RSCFDnCFPCTRx */
 #define RCANFD_CFPCTR(gpriv, ch, idx) \
-	(reg_v3u(gpriv, 0x0240, 0x01d8) + (0x0c * (ch)) + (0x04 * (idx)))
+	(reg_gen4(gpriv, 0x0240, 0x01d8) + (0x0c * (ch)) + (0x04 * (idx)))
 
 /* RSCFDnCFDFESTS / RSCFDnFESTS */
 #define RCANFD_FESTS			(0x0238)
@@ -428,15 +428,15 @@
 /* RSCFDnRPGACCr */
 #define RCANFD_C_RPGACC(r)		(0x1900 + (0x04 * (r)))
 
-/* R-Car V3U Classical and CAN FD mode specific register map */
-#define RCANFD_V3U_FDCFG(m)		(0x1404 + (0x20 * (m)))
+/* R-Car Gen4 Classical and CAN FD mode specific register map */
+#define RCANFD_GEN4_FDCFG(m)		(0x1404 + (0x20 * (m)))
 
-#define RCANFD_V3U_GAFL_OFFSET		(0x1800)
+#define RCANFD_GEN4_GAFL_OFFSET		(0x1800)
 
 /* CAN FD mode specific register map */
 
 /* RSCFDnCFDCmXXX -> RCANFD_F_XXX(m) */
-#define RCANFD_F_DCFG(gpriv, m)		(reg_v3u(gpriv, 0x1400, 0x0500) + (0x20 * (m)))
+#define RCANFD_F_DCFG(gpriv, m)		(reg_gen4(gpriv, 0x1400, 0x0500) + (0x20 * (m)))
 #define RCANFD_F_CFDCFG(m)		(0x0504 + (0x20 * (m)))
 #define RCANFD_F_CFDCTR(m)		(0x0508 + (0x20 * (m)))
 #define RCANFD_F_CFDSTS(m)		(0x050c + (0x20 * (m)))
@@ -452,7 +452,7 @@
 #define RCANFD_F_RMDF(q, b)		(0x200c + (0x04 * (b)) + (0x20 * (q)))
 
 /* RSCFDnCFDRFXXx -> RCANFD_F_RFXX(x) */
-#define RCANFD_F_RFOFFSET(gpriv)	reg_v3u(gpriv, 0x6000, 0x3000)
+#define RCANFD_F_RFOFFSET(gpriv)	reg_gen4(gpriv, 0x6000, 0x3000)
 #define RCANFD_F_RFID(gpriv, x)		(RCANFD_F_RFOFFSET(gpriv) + (0x80 * (x)))
 #define RCANFD_F_RFPTR(gpriv, x)	(RCANFD_F_RFOFFSET(gpriv) + 0x04 + (0x80 * (x)))
 #define RCANFD_F_RFFDSTS(gpriv, x)	(RCANFD_F_RFOFFSET(gpriv) + 0x08 + (0x80 * (x)))
@@ -460,7 +460,7 @@
 	(RCANFD_F_RFOFFSET(gpriv) + 0x0c + (0x80 * (x)) + (0x04 * (df)))
 
 /* RSCFDnCFDCFXXk -> RCANFD_F_CFXX(ch, k) */
-#define RCANFD_F_CFOFFSET(gpriv)	reg_v3u(gpriv, 0x6400, 0x3400)
+#define RCANFD_F_CFOFFSET(gpriv)	reg_gen4(gpriv, 0x6400, 0x3400)
 
 #define RCANFD_F_CFID(gpriv, ch, idx) \
 	(RCANFD_F_CFOFFSET(gpriv) + (0x180 * (ch)) + (0x80 * (idx)))
@@ -596,28 +596,28 @@ static const struct rcar_canfd_hw_info rcar_gen3_hw_info = {
 	.shared_global_irqs = 1,
 };
 
+static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
+	.max_channels = 8,
+	.postdiv = 2,
+	.shared_global_irqs = 1,
+};
+
 static const struct rcar_canfd_hw_info rzg2l_hw_info = {
 	.max_channels = 2,
 	.postdiv = 1,
 	.multi_channel_irqs = 1,
 };
 
-static const struct rcar_canfd_hw_info r8a779a0_hw_info = {
-	.max_channels = 8,
-	.postdiv = 2,
-	.shared_global_irqs = 1,
-};
-
 /* Helper functions */
-static inline bool is_v3u(struct rcar_canfd_global *gpriv)
+static inline bool is_gen4(struct rcar_canfd_global *gpriv)
 {
-	return gpriv->info == &r8a779a0_hw_info;
+	return gpriv->info == &rcar_gen4_hw_info;
 }
 
-static inline u32 reg_v3u(struct rcar_canfd_global *gpriv,
-			  u32 v3u, u32 not_v3u)
+static inline u32 reg_gen4(struct rcar_canfd_global *gpriv,
+			   u32 gen4, u32 not_gen4)
 {
-	return is_v3u(gpriv) ? v3u : not_v3u;
+	return is_gen4(gpriv) ? gen4 : not_gen4;
 }
 
 static inline void rcar_canfd_update(u32 mask, u32 val, u32 __iomem *reg)
@@ -687,13 +687,13 @@ static void rcar_canfd_tx_failure_cleanup(struct net_device *ndev)
 
 static void rcar_canfd_set_mode(struct rcar_canfd_global *gpriv)
 {
-	if (is_v3u(gpriv)) {
-		u32 ch, val = gpriv->fdmode ? RCANFD_V3U_FDCFG_FDOE
-					    : RCANFD_V3U_FDCFG_CLOE;
+	if (is_gen4(gpriv)) {
+		u32 ch, val = gpriv->fdmode ? RCANFD_GEN4_FDCFG_FDOE
+					    : RCANFD_GEN4_FDCFG_CLOE;
 
 		for_each_set_bit(ch, &gpriv->channels_mask,
 				 gpriv->info->max_channels)
-			rcar_canfd_set_bit(gpriv->base, RCANFD_V3U_FDCFG(ch),
+			rcar_canfd_set_bit(gpriv->base, RCANFD_GEN4_FDCFG(ch),
 					   val);
 	} else {
 		if (gpriv->fdmode)
@@ -814,8 +814,8 @@ static void rcar_canfd_configure_afl_rules(struct rcar_canfd_global *gpriv,
 	/* Write number of rules for channel */
 	rcar_canfd_set_bit(gpriv->base, RCANFD_GAFLCFG(ch),
 			   RCANFD_GAFLCFG_SETRNC(gpriv, ch, num_rules));
-	if (is_v3u(gpriv))
-		offset = RCANFD_V3U_GAFL_OFFSET;
+	if (is_gen4(gpriv))
+		offset = RCANFD_GEN4_GAFL_OFFSET;
 	else if (gpriv->fdmode)
 		offset = RCANFD_F_GAFL_OFFSET;
 	else
@@ -1350,7 +1350,7 @@ static void rcar_canfd_set_bittiming(struct net_device *dev)
 			   brp, sjw, tseg1, tseg2);
 	} else {
 		/* Classical CAN only mode */
-		if (is_v3u(gpriv)) {
+		if (is_gen4(gpriv)) {
 			cfg = (RCANFD_NCFG_NTSEG1(gpriv, tseg1) |
 			       RCANFD_NCFG_NBRP(brp) |
 			       RCANFD_NCFG_NSJW(gpriv, sjw) |
@@ -1507,7 +1507,7 @@ static netdev_tx_t rcar_canfd_start_xmit(struct sk_buff *skb,
 
 	dlc = RCANFD_CFPTR_CFDLC(can_fd_len2dlc(cf->len));
 
-	if ((priv->can.ctrlmode & CAN_CTRLMODE_FD) || is_v3u(gpriv)) {
+	if ((priv->can.ctrlmode & CAN_CTRLMODE_FD) || is_gen4(gpriv)) {
 		rcar_canfd_write(priv->base,
 				 RCANFD_F_CFID(gpriv, ch, RCANFD_CFFIFO_IDX), id);
 		rcar_canfd_write(priv->base,
@@ -1566,7 +1566,7 @@ static void rcar_canfd_rx_pkt(struct rcar_canfd_channel *priv)
 	u32 ch = priv->channel;
 	u32 ridx = ch + RCANFD_RFFIFO_IDX;
 
-	if ((priv->can.ctrlmode & CAN_CTRLMODE_FD) || is_v3u(gpriv)) {
+	if ((priv->can.ctrlmode & CAN_CTRLMODE_FD) || is_gen4(gpriv)) {
 		id = rcar_canfd_read(priv->base, RCANFD_F_RFID(gpriv, ridx));
 		dlc = rcar_canfd_read(priv->base, RCANFD_F_RFPTR(gpriv, ridx));
 
@@ -1617,7 +1617,7 @@ static void rcar_canfd_rx_pkt(struct rcar_canfd_channel *priv)
 		cf->len = can_cc_dlc2len(RCANFD_RFPTR_RFDLC(dlc));
 		if (id & RCANFD_RFID_RFRTR)
 			cf->can_id |= CAN_RTR_FLAG;
-		else if (is_v3u(gpriv))
+		else if (is_gen4(gpriv))
 			rcar_canfd_get_data(priv, cf, RCANFD_F_RFDF(gpriv, ridx, 0));
 		else
 			rcar_canfd_get_data(priv, cf, RCANFD_C_RFDF(ridx, 0));
@@ -2096,9 +2096,10 @@ static SIMPLE_DEV_PM_OPS(rcar_canfd_pm_ops, rcar_canfd_suspend,
 			 rcar_canfd_resume);
 
 static const __maybe_unused struct of_device_id rcar_canfd_of_table[] = {
+	{ .compatible = "renesas,r8a779a0-canfd", .data = &rcar_gen4_hw_info },
 	{ .compatible = "renesas,rcar-gen3-canfd", .data = &rcar_gen3_hw_info },
+	{ .compatible = "renesas,rcar-gen4-canfd", .data = &rcar_gen4_hw_info },
 	{ .compatible = "renesas,rzg2l-canfd", .data = &rzg2l_hw_info },
-	{ .compatible = "renesas,r8a779a0-canfd", .data = &r8a779a0_hw_info },
 	{ }
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 08/12] can: rcar_canfd: Fix R-Car Gen4 DCFG.DSJW field width
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (6 preceding siblings ...)
  2023-01-23 18:56 ` [PATCH 07/12] can: rcar_canfd: Add support for R-Car Gen4 Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 09/12] can: rcar_canfd: Fix R-Car Gen4 CFCC.CFTML " Geert Uytterhoeven
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

On R-Car Gen4 CAN_FD variants, the Data Bit Rate Resynchronization Jump
Width Control (DSJW) field in the Channel n Data Bitrate Configuration
Register (DCFG) register is one bit wider than on older variants.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/can/rcar/rcar_canfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index aa7fcd4a47d38bc9..ee7bbd9d1151201b 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -186,7 +186,7 @@
 #define RCANFD_CERFL_ERR(x)		((x) & (0x7fff)) /* above bits 14:0 */
 
 /* RSCFDnCFDCmDCFG */
-#define RCANFD_DCFG_DSJW(x)		(((x) & 0x7) << 24)
+#define RCANFD_DCFG_DSJW(gpriv, x)	(((x) & reg_gen4(gpriv, 0xf, 0x7)) << 24)
 
 #define RCANFD_DCFG_DTSEG2(gpriv, x) \
 	(((x) & reg_gen4(gpriv, 0x0f, 0x7)) << reg_gen4(gpriv, 16, 20))
@@ -1343,7 +1343,7 @@ static void rcar_canfd_set_bittiming(struct net_device *dev)
 		tseg2 = dbt->phase_seg2 - 1;
 
 		cfg = (RCANFD_DCFG_DTSEG1(gpriv, tseg1) | RCANFD_DCFG_DBRP(brp) |
-		       RCANFD_DCFG_DSJW(sjw) | RCANFD_DCFG_DTSEG2(gpriv, tseg2));
+		       RCANFD_DCFG_DSJW(gpriv, sjw) | RCANFD_DCFG_DTSEG2(gpriv, tseg2));
 
 		rcar_canfd_write(priv->base, RCANFD_F_DCFG(gpriv, ch), cfg);
 		netdev_dbg(priv->ndev, "drate: brp %u, sjw %u, tseg1 %u, tseg2 %u\n",
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 09/12] can: rcar_canfd: Fix R-Car Gen4 CFCC.CFTML field width
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (7 preceding siblings ...)
  2023-01-23 18:56 ` [PATCH 08/12] can: rcar_canfd: Fix R-Car Gen4 DCFG.DSJW field width Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 10/12] can: rcar_canfd: Sort included header files Geert Uytterhoeven
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

On R-Car Gen4 CAN_FD variants, the Common FIFO TX Message Buffer Link
(CFTML) field in the Common FIFO Configuration / Control Register (CCFC)
register is one bit wider than on older variants.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/can/rcar/rcar_canfd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index ee7bbd9d1151201b..376a5d606acc66c2 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -233,7 +233,8 @@
 /* Common FIFO bits */
 
 /* RSCFDnCFDCFCCk */
-#define RCANFD_CFCC_CFTML(gpriv, x)	(((x) & 0xf) << reg_gen4(gpriv, 16, 20))
+#define RCANFD_CFCC_CFTML(gpriv, x)	\
+	(((x) & reg_gen4(gpriv, 0x1f, 0xf)) << reg_gen4(gpriv, 16, 20))
 #define RCANFD_CFCC_CFM(gpriv, x)	(((x) & 0x3) << reg_gen4(gpriv,  8, 16))
 #define RCANFD_CFCC_CFIM		BIT(12)
 #define RCANFD_CFCC_CFDC(gpriv, x)	(((x) & 0x7) << reg_gen4(gpriv, 21,  8))
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 10/12] can: rcar_canfd: Sort included header files
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (8 preceding siblings ...)
  2023-01-23 18:56 ` [PATCH 09/12] can: rcar_canfd: Fix R-Car Gen4 CFCC.CFTML " Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 11/12] can: rcar_canfd: Add helper variable dev Geert Uytterhoeven
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

This may avoid conflicts when adding or removing files in the future.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/can/rcar/rcar_canfd.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 376a5d606acc66c2..cfcf1a93fb58c36f 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -21,23 +21,23 @@
  * wherever it is modified to a readable name.
  */
 
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
+#include <linux/bitmap.h>
+#include <linux/bitops.h>
+#include <linux/can/dev.h>
+#include <linux/clk.h>
 #include <linux/errno.h>
 #include <linux/ethtool.h>
+#include <linux/interrupt.h>
+#include <linux/iopoll.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/netdevice.h>
-#include <linux/platform_device.h>
-#include <linux/can/dev.h>
-#include <linux/clk.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
-#include <linux/bitmap.h>
-#include <linux/bitops.h>
-#include <linux/iopoll.h>
+#include <linux/platform_device.h>
 #include <linux/reset.h>
+#include <linux/types.h>
 
 #define RCANFD_DRV_NAME			"rcar_canfd"
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 11/12] can: rcar_canfd: Add helper variable dev
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (9 preceding siblings ...)
  2023-01-23 18:56 ` [PATCH 10/12] can: rcar_canfd: Sort included header files Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-23 18:56 ` [PATCH 12/12] can: rcar_canfd: Add transceiver support Geert Uytterhoeven
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

rcar_canfd_channel_probe() and rcar_canfd_probe() have many users of
"pdev->dev".  Introduce shorthands to simplify the code.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/can/rcar/rcar_canfd.c | 86 +++++++++++++++----------------
 1 file changed, 42 insertions(+), 44 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index cfcf1a93fb58c36f..ef4e1b9a9e1ee280 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -1715,13 +1715,14 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
 {
 	const struct rcar_canfd_hw_info *info = gpriv->info;
 	struct platform_device *pdev = gpriv->pdev;
+	struct device *dev = &pdev->dev;
 	struct rcar_canfd_channel *priv;
 	struct net_device *ndev;
 	int err = -ENODEV;
 
 	ndev = alloc_candev(sizeof(*priv), RCANFD_FIFO_DEPTH);
 	if (!ndev) {
-		dev_err(&pdev->dev, "alloc_candev() failed\n");
+		dev_err(dev, "alloc_candev() failed\n");
 		return -ENOMEM;
 	}
 	priv = netdev_priv(ndev);
@@ -1734,7 +1735,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
 	priv->channel = ch;
 	priv->gpriv = gpriv;
 	priv->can.clock.freq = fcan_freq;
-	dev_info(&pdev->dev, "can_clk rate is %u\n", priv->can.clock.freq);
+	dev_info(dev, "can_clk rate is %u\n", priv->can.clock.freq);
 
 	if (info->multi_channel_irqs) {
 		char *irq_name;
@@ -1753,31 +1754,31 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
 			goto fail;
 		}
 
-		irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
-					  "canfd.ch%d_err", ch);
+		irq_name = devm_kasprintf(dev, GFP_KERNEL, "canfd.ch%d_err",
+					  ch);
 		if (!irq_name) {
 			err = -ENOMEM;
 			goto fail;
 		}
-		err = devm_request_irq(&pdev->dev, err_irq,
+		err = devm_request_irq(dev, err_irq,
 				       rcar_canfd_channel_err_interrupt, 0,
 				       irq_name, priv);
 		if (err) {
-			dev_err(&pdev->dev, "devm_request_irq CH Err(%d) failed, error %d\n",
+			dev_err(dev, "devm_request_irq CH Err(%d) failed, error %d\n",
 				err_irq, err);
 			goto fail;
 		}
-		irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
-					  "canfd.ch%d_trx", ch);
+		irq_name = devm_kasprintf(dev, GFP_KERNEL, "canfd.ch%d_trx",
+					  ch);
 		if (!irq_name) {
 			err = -ENOMEM;
 			goto fail;
 		}
-		err = devm_request_irq(&pdev->dev, tx_irq,
+		err = devm_request_irq(dev, tx_irq,
 				       rcar_canfd_channel_tx_interrupt, 0,
 				       irq_name, priv);
 		if (err) {
-			dev_err(&pdev->dev, "devm_request_irq Tx (%d) failed, error %d\n",
+			dev_err(dev, "devm_request_irq Tx (%d) failed, error %d\n",
 				tx_irq, err);
 			goto fail;
 		}
@@ -1801,7 +1802,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
 
 	priv->can.do_set_mode = rcar_canfd_do_set_mode;
 	priv->can.do_get_berr_counter = rcar_canfd_get_berr_counter;
-	SET_NETDEV_DEV(ndev, &pdev->dev);
+	SET_NETDEV_DEV(ndev, dev);
 
 	netif_napi_add_weight(ndev, &priv->napi, rcar_canfd_rx_poll,
 			      RCANFD_NAPI_WEIGHT);
@@ -1809,11 +1810,10 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
 	gpriv->ch[priv->channel] = priv;
 	err = register_candev(ndev);
 	if (err) {
-		dev_err(&pdev->dev,
-			"register_candev() failed, error %d\n", err);
+		dev_err(dev, "register_candev() failed, error %d\n", err);
 		goto fail_candev;
 	}
-	dev_info(&pdev->dev, "device registered (channel %u)\n", priv->channel);
+	dev_info(dev, "device registered (channel %u)\n", priv->channel);
 	return 0;
 
 fail_candev:
@@ -1837,6 +1837,7 @@ static void rcar_canfd_channel_remove(struct rcar_canfd_global *gpriv, u32 ch)
 static int rcar_canfd_probe(struct platform_device *pdev)
 {
 	const struct rcar_canfd_hw_info *info;
+	struct device *dev = &pdev->dev;
 	void __iomem *addr;
 	u32 sts, ch, fcan_freq;
 	struct rcar_canfd_global *gpriv;
@@ -1848,14 +1849,14 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	char name[9] = "channelX";
 	int i;
 
-	info = of_device_get_match_data(&pdev->dev);
+	info = of_device_get_match_data(dev);
 
-	if (of_property_read_bool(pdev->dev.of_node, "renesas,no-can-fd"))
+	if (of_property_read_bool(dev->of_node, "renesas,no-can-fd"))
 		fdmode = false;			/* Classical CAN only mode */
 
 	for (i = 0; i < info->max_channels; ++i) {
 		name[7] = '0' + i;
-		of_child = of_get_child_by_name(pdev->dev.of_node, name);
+		of_child = of_get_child_by_name(dev->of_node, name);
 		if (of_child && of_device_is_available(of_child))
 			channels_mask |= BIT(i);
 		of_node_put(of_child);
@@ -1888,7 +1889,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	}
 
 	/* Global controller context */
-	gpriv = devm_kzalloc(&pdev->dev, sizeof(*gpriv), GFP_KERNEL);
+	gpriv = devm_kzalloc(dev, sizeof(*gpriv), GFP_KERNEL);
 	if (!gpriv)
 		return -ENOMEM;
 
@@ -1897,32 +1898,30 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	gpriv->fdmode = fdmode;
 	gpriv->info = info;
 
-	gpriv->rstc1 = devm_reset_control_get_optional_exclusive(&pdev->dev,
-								 "rstp_n");
+	gpriv->rstc1 = devm_reset_control_get_optional_exclusive(dev, "rstp_n");
 	if (IS_ERR(gpriv->rstc1))
-		return dev_err_probe(&pdev->dev, PTR_ERR(gpriv->rstc1),
+		return dev_err_probe(dev, PTR_ERR(gpriv->rstc1),
 				     "failed to get rstp_n\n");
 
-	gpriv->rstc2 = devm_reset_control_get_optional_exclusive(&pdev->dev,
-								 "rstc_n");
+	gpriv->rstc2 = devm_reset_control_get_optional_exclusive(dev, "rstc_n");
 	if (IS_ERR(gpriv->rstc2))
-		return dev_err_probe(&pdev->dev, PTR_ERR(gpriv->rstc2),
+		return dev_err_probe(dev, PTR_ERR(gpriv->rstc2),
 				     "failed to get rstc_n\n");
 
 	/* Peripheral clock */
-	gpriv->clkp = devm_clk_get(&pdev->dev, "fck");
+	gpriv->clkp = devm_clk_get(dev, "fck");
 	if (IS_ERR(gpriv->clkp))
-		return dev_err_probe(&pdev->dev, PTR_ERR(gpriv->clkp),
+		return dev_err_probe(dev, PTR_ERR(gpriv->clkp),
 				     "cannot get peripheral clock\n");
 
 	/* fCAN clock: Pick External clock. If not available fallback to
 	 * CANFD clock
 	 */
-	gpriv->can_clk = devm_clk_get(&pdev->dev, "can_clk");
+	gpriv->can_clk = devm_clk_get(dev, "can_clk");
 	if (IS_ERR(gpriv->can_clk) || (clk_get_rate(gpriv->can_clk) == 0)) {
-		gpriv->can_clk = devm_clk_get(&pdev->dev, "canfd");
+		gpriv->can_clk = devm_clk_get(dev, "canfd");
 		if (IS_ERR(gpriv->can_clk))
-			return dev_err_probe(&pdev->dev, PTR_ERR(gpriv->can_clk),
+			return dev_err_probe(dev, PTR_ERR(gpriv->can_clk),
 					     "cannot get canfd clock\n");
 
 		gpriv->fcan = RCANFD_CANFDCLK;
@@ -1945,39 +1944,38 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 
 	/* Request IRQ that's common for both channels */
 	if (info->shared_global_irqs) {
-		err = devm_request_irq(&pdev->dev, ch_irq,
+		err = devm_request_irq(dev, ch_irq,
 				       rcar_canfd_channel_interrupt, 0,
 				       "canfd.ch_int", gpriv);
 		if (err) {
-			dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n",
+			dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
 				ch_irq, err);
 			goto fail_dev;
 		}
 
-		err = devm_request_irq(&pdev->dev, g_irq,
-				       rcar_canfd_global_interrupt, 0,
-				       "canfd.g_int", gpriv);
+		err = devm_request_irq(dev, g_irq, rcar_canfd_global_interrupt,
+				       0, "canfd.g_int", gpriv);
 		if (err) {
-			dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n",
+			dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
 				g_irq, err);
 			goto fail_dev;
 		}
 	} else {
-		err = devm_request_irq(&pdev->dev, g_recc_irq,
+		err = devm_request_irq(dev, g_recc_irq,
 				       rcar_canfd_global_receive_fifo_interrupt, 0,
 				       "canfd.g_recc", gpriv);
 
 		if (err) {
-			dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n",
+			dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
 				g_recc_irq, err);
 			goto fail_dev;
 		}
 
-		err = devm_request_irq(&pdev->dev, g_err_irq,
+		err = devm_request_irq(dev, g_err_irq,
 				       rcar_canfd_global_err_interrupt, 0,
 				       "canfd.g_err", gpriv);
 		if (err) {
-			dev_err(&pdev->dev, "devm_request_irq(%d) failed, error %d\n",
+			dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
 				g_err_irq, err);
 			goto fail_dev;
 		}
@@ -1995,14 +1993,14 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	/* Enable peripheral clock for register access */
 	err = clk_prepare_enable(gpriv->clkp);
 	if (err) {
-		dev_err(&pdev->dev,
-			"failed to enable peripheral clock, error %d\n", err);
+		dev_err(dev, "failed to enable peripheral clock, error %d\n",
+			err);
 		goto fail_reset;
 	}
 
 	err = rcar_canfd_reset_controller(gpriv);
 	if (err) {
-		dev_err(&pdev->dev, "reset controller failed\n");
+		dev_err(dev, "reset controller failed\n");
 		goto fail_clk;
 	}
 
@@ -2032,7 +2030,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	err = readl_poll_timeout((gpriv->base + RCANFD_GSTS), sts,
 				 !(sts & RCANFD_GSTS_GNOPM), 2, 500000);
 	if (err) {
-		dev_err(&pdev->dev, "global operational mode failed\n");
+		dev_err(dev, "global operational mode failed\n");
 		goto fail_mode;
 	}
 
@@ -2043,7 +2041,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	}
 
 	platform_set_drvdata(pdev, gpriv);
-	dev_info(&pdev->dev, "global operational state (clk %d, fdmode %d)\n",
+	dev_info(dev, "global operational state (clk %d, fdmode %d)\n",
 		 gpriv->fcan, gpriv->fdmode);
 	return 0;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 12/12] can: rcar_canfd: Add transceiver support
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (10 preceding siblings ...)
  2023-01-23 18:56 ` [PATCH 11/12] can: rcar_canfd: Add helper variable dev Geert Uytterhoeven
@ 2023-01-23 18:56 ` Geert Uytterhoeven
  2023-01-23 21:25   ` kernel test robot
                     ` (2 more replies)
  2023-01-23 19:28 ` [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Wolfram Sang
                   ` (4 subsequent siblings)
  16 siblings, 3 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 18:56 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro
  Cc: Philipp Zabel, Ulrich Hecht, linux-can, netdev, devicetree,
	linux-renesas-soc, Geert Uytterhoeven

Add support for CAN transceivers described as PHYs.

While simple CAN transceivers can do without, this is needed for CAN
transceivers like NXP TJR1443 that need a configuration step (like
pulling standby or enable lines), and/or impose a bitrate limit.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This depends on "[PATCH 1/7] phy: Add devm_of_phy_optional_get() helper".
https://lore.kernel.org/all/f53a1bcca637ceeafb04ce3540a605532d3bc34a.1674036164.git.geert+renesas@glider.be
---
 drivers/net/can/rcar/rcar_canfd.c | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index ef4e1b9a9e1ee280..6df9a259e5e4f92c 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -35,6 +35,7 @@
 #include <linux/netdevice.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 #include <linux/reset.h>
 #include <linux/types.h>
@@ -530,6 +531,7 @@ struct rcar_canfd_channel {
 	struct net_device *ndev;
 	struct rcar_canfd_global *gpriv;	/* Controller reference */
 	void __iomem *base;			/* Register base address */
+	struct phy *transceiver;		/* Optional transceiver */
 	struct napi_struct napi;
 	u32 tx_head;				/* Incremented on xmit */
 	u32 tx_tail;				/* Incremented on xmit done */
@@ -1413,11 +1415,17 @@ static int rcar_canfd_open(struct net_device *ndev)
 	struct rcar_canfd_global *gpriv = priv->gpriv;
 	int err;
 
+	err = phy_power_on(priv->transceiver);
+	if (err) {
+		netdev_err(ndev, "failed to power on PHY, error %d\n", err);
+		return err;
+	}
+
 	/* Peripheral clock is already enabled in probe */
 	err = clk_prepare_enable(gpriv->can_clk);
 	if (err) {
 		netdev_err(ndev, "failed to enable CAN clock, error %d\n", err);
-		goto out_clock;
+		goto out_phy;
 	}
 
 	err = open_candev(ndev);
@@ -1437,7 +1445,8 @@ static int rcar_canfd_open(struct net_device *ndev)
 	close_candev(ndev);
 out_can_clock:
 	clk_disable_unprepare(gpriv->can_clk);
-out_clock:
+out_phy:
+	phy_power_off(priv->transceiver);
 	return err;
 }
 
@@ -1480,6 +1489,7 @@ static int rcar_canfd_close(struct net_device *ndev)
 	napi_disable(&priv->napi);
 	clk_disable_unprepare(gpriv->can_clk);
 	close_candev(ndev);
+	phy_power_off(priv->transceiver);
 	return 0;
 }
 
@@ -1711,7 +1721,7 @@ static const struct ethtool_ops rcar_canfd_ethtool_ops = {
 };
 
 static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
-				    u32 fcan_freq)
+				    u32 fcan_freq, struct phy *transceiver)
 {
 	const struct rcar_canfd_hw_info *info = gpriv->info;
 	struct platform_device *pdev = gpriv->pdev;
@@ -1732,8 +1742,11 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
 	ndev->flags |= IFF_ECHO;
 	priv->ndev = ndev;
 	priv->base = gpriv->base;
+	priv->transceiver = transceiver;
 	priv->channel = ch;
 	priv->gpriv = gpriv;
+	if (transceiver)
+		priv->can.bitrate_max = transceiver->attrs.max_link_rate;
 	priv->can.clock.freq = fcan_freq;
 	dev_info(dev, "can_clk rate is %u\n", priv->can.clock.freq);
 
@@ -1836,6 +1849,7 @@ static void rcar_canfd_channel_remove(struct rcar_canfd_global *gpriv, u32 ch)
 
 static int rcar_canfd_probe(struct platform_device *pdev)
 {
+	struct phy *transceivers[RCANFD_NUM_CHANNELS] = { 0, };
 	const struct rcar_canfd_hw_info *info;
 	struct device *dev = &pdev->dev;
 	void __iomem *addr;
@@ -1857,9 +1871,14 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	for (i = 0; i < info->max_channels; ++i) {
 		name[7] = '0' + i;
 		of_child = of_get_child_by_name(dev->of_node, name);
-		if (of_child && of_device_is_available(of_child))
+		if (of_child && of_device_is_available(of_child)) {
 			channels_mask |= BIT(i);
+			transceivers[i] = devm_of_phy_optional_get(dev,
+							of_child, NULL);
+		}
 		of_node_put(of_child);
+		if (IS_ERR(transceivers[i]))
+			return PTR_ERR(transceivers[i]);
 	}
 
 	if (info->shared_global_irqs) {
@@ -2035,7 +2054,8 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 	}
 
 	for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels) {
-		err = rcar_canfd_channel_probe(gpriv, ch, fcan_freq);
+		err = rcar_canfd_channel_probe(gpriv, ch, fcan_freq,
+					       transceivers[ch]);
 		if (err)
 			goto fail_channel;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (11 preceding siblings ...)
  2023-01-23 18:56 ` [PATCH 12/12] can: rcar_canfd: Add transceiver support Geert Uytterhoeven
@ 2023-01-23 19:28 ` Wolfram Sang
  2023-01-23 19:37   ` Geert Uytterhoeven
  2023-01-24 11:02 ` Simon Horman
                   ` (3 subsequent siblings)
  16 siblings, 1 reply; 30+ messages in thread
From: Wolfram Sang @ 2023-01-23 19:28 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro, Philipp Zabel,
	Ulrich Hecht, linux-can, netdev, devicetree, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

Hi Geert,

thanks for this work! You not only added V4H support bu fixed/improved
quite some things on the way.

> Hence despite the new fixes, the test results are similar to what Ulrich
> Hecht reported for R-Car V3U on the Falcon development board before,
> i.e. only channels 0 and 1 work (FTR, [2] does not help).

IIRC Ulrich reported that the other channels did not even work with the
BSP on V3U.

Happy hacking,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems
  2023-01-23 19:28 ` [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Wolfram Sang
@ 2023-01-23 19:37   ` Geert Uytterhoeven
  0 siblings, 0 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-23 19:37 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro, Philipp Zabel,
	Ulrich Hecht, linux-can, netdev,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux-Renesas

Hi Wolfram,

On Mon, Jan 23, 2023 at 8:29 PM Wolfram Sang <wsa@kernel.org> wrote:
> > Hence despite the new fixes, the test results are similar to what Ulrich
> > Hecht reported for R-Car V3U on the Falcon development board before,
> > i.e. only channels 0 and 1 work (FTR, [2] does not help).
>
> IIRC Ulrich reported that the other channels did not even work with the
> BSP on V3U.

Same on V4H.  In fact I'm not surprised, due to lingering bugs like the one
fixed by "can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses".

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 12/12] can: rcar_canfd: Add transceiver support
  2023-01-23 18:56 ` [PATCH 12/12] can: rcar_canfd: Add transceiver support Geert Uytterhoeven
@ 2023-01-23 21:25   ` kernel test robot
  2023-01-24 18:41   ` Geert Uytterhoeven
  2023-01-25  6:34   ` kernel test robot
  2 siblings, 0 replies; 30+ messages in thread
From: kernel test robot @ 2023-01-23 21:25 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: oe-kbuild-all

Hi Geert,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.2-rc5 next-20230123]
[cannot apply to mkl-can-next/testing]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Geert-Uytterhoeven/dt-bindings-can-renesas-rcar-canfd-R-Car-V3U-is-R-Car-Gen4/20230124-030354
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/e825b50a843ffe40e33f34e4d858c07c1b2ff259.1674499048.git.geert%2Brenesas%40glider.be
patch subject: [PATCH 12/12] can: rcar_canfd: Add transceiver support
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230124/202301240503.znwPtr2z-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/d2ab7bc9940c2cb09888ee0f253ca39cadccbc60
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Geert-Uytterhoeven/dt-bindings-can-renesas-rcar-canfd-R-Car-V3U-is-R-Car-Gen4/20230124-030354
        git checkout d2ab7bc9940c2cb09888ee0f253ca39cadccbc60
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/net/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/net/can/rcar/rcar_canfd.c: In function 'rcar_canfd_probe':
   drivers/net/can/rcar/rcar_canfd.c:1876:43: error: implicit declaration of function 'devm_of_phy_optional_get'; did you mean 'devm_phy_optional_get'? [-Werror=implicit-function-declaration]
    1876 |                         transceivers[i] = devm_of_phy_optional_get(dev,
         |                                           ^~~~~~~~~~~~~~~~~~~~~~~~
         |                                           devm_phy_optional_get
>> drivers/net/can/rcar/rcar_canfd.c:1876:41: warning: assignment to 'struct phy *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    1876 |                         transceivers[i] = devm_of_phy_optional_get(dev,
         |                                         ^
   cc1: some warnings being treated as errors


vim +1876 drivers/net/can/rcar/rcar_canfd.c

  1849	
  1850	static int rcar_canfd_probe(struct platform_device *pdev)
  1851	{
  1852		struct phy *transceivers[RCANFD_NUM_CHANNELS] = { 0, };
  1853		const struct rcar_canfd_hw_info *info;
  1854		struct device *dev = &pdev->dev;
  1855		void __iomem *addr;
  1856		u32 sts, ch, fcan_freq;
  1857		struct rcar_canfd_global *gpriv;
  1858		struct device_node *of_child;
  1859		unsigned long channels_mask = 0;
  1860		int err, ch_irq, g_irq;
  1861		int g_err_irq, g_recc_irq;
  1862		bool fdmode = true;			/* CAN FD only mode - default */
  1863		char name[9] = "channelX";
  1864		int i;
  1865	
  1866		info = of_device_get_match_data(dev);
  1867	
  1868		if (of_property_read_bool(dev->of_node, "renesas,no-can-fd"))
  1869			fdmode = false;			/* Classical CAN only mode */
  1870	
  1871		for (i = 0; i < info->max_channels; ++i) {
  1872			name[7] = '0' + i;
  1873			of_child = of_get_child_by_name(dev->of_node, name);
  1874			if (of_child && of_device_is_available(of_child)) {
  1875				channels_mask |= BIT(i);
> 1876				transceivers[i] = devm_of_phy_optional_get(dev,
  1877								of_child, NULL);
  1878			}
  1879			of_node_put(of_child);
  1880			if (IS_ERR(transceivers[i]))
  1881				return PTR_ERR(transceivers[i]);
  1882		}
  1883	
  1884		if (info->shared_global_irqs) {
  1885			ch_irq = platform_get_irq_byname_optional(pdev, "ch_int");
  1886			if (ch_irq < 0) {
  1887				/* For backward compatibility get irq by index */
  1888				ch_irq = platform_get_irq(pdev, 0);
  1889				if (ch_irq < 0)
  1890					return ch_irq;
  1891			}
  1892	
  1893			g_irq = platform_get_irq_byname_optional(pdev, "g_int");
  1894			if (g_irq < 0) {
  1895				/* For backward compatibility get irq by index */
  1896				g_irq = platform_get_irq(pdev, 1);
  1897				if (g_irq < 0)
  1898					return g_irq;
  1899			}
  1900		} else {
  1901			g_err_irq = platform_get_irq_byname(pdev, "g_err");
  1902			if (g_err_irq < 0)
  1903				return g_err_irq;
  1904	
  1905			g_recc_irq = platform_get_irq_byname(pdev, "g_recc");
  1906			if (g_recc_irq < 0)
  1907				return g_recc_irq;
  1908		}
  1909	
  1910		/* Global controller context */
  1911		gpriv = devm_kzalloc(dev, sizeof(*gpriv), GFP_KERNEL);
  1912		if (!gpriv)
  1913			return -ENOMEM;
  1914	
  1915		gpriv->pdev = pdev;
  1916		gpriv->channels_mask = channels_mask;
  1917		gpriv->fdmode = fdmode;
  1918		gpriv->info = info;
  1919	
  1920		gpriv->rstc1 = devm_reset_control_get_optional_exclusive(dev, "rstp_n");
  1921		if (IS_ERR(gpriv->rstc1))
  1922			return dev_err_probe(dev, PTR_ERR(gpriv->rstc1),
  1923					     "failed to get rstp_n\n");
  1924	
  1925		gpriv->rstc2 = devm_reset_control_get_optional_exclusive(dev, "rstc_n");
  1926		if (IS_ERR(gpriv->rstc2))
  1927			return dev_err_probe(dev, PTR_ERR(gpriv->rstc2),
  1928					     "failed to get rstc_n\n");
  1929	
  1930		/* Peripheral clock */
  1931		gpriv->clkp = devm_clk_get(dev, "fck");
  1932		if (IS_ERR(gpriv->clkp))
  1933			return dev_err_probe(dev, PTR_ERR(gpriv->clkp),
  1934					     "cannot get peripheral clock\n");
  1935	
  1936		/* fCAN clock: Pick External clock. If not available fallback to
  1937		 * CANFD clock
  1938		 */
  1939		gpriv->can_clk = devm_clk_get(dev, "can_clk");
  1940		if (IS_ERR(gpriv->can_clk) || (clk_get_rate(gpriv->can_clk) == 0)) {
  1941			gpriv->can_clk = devm_clk_get(dev, "canfd");
  1942			if (IS_ERR(gpriv->can_clk))
  1943				return dev_err_probe(dev, PTR_ERR(gpriv->can_clk),
  1944						     "cannot get canfd clock\n");
  1945	
  1946			gpriv->fcan = RCANFD_CANFDCLK;
  1947	
  1948		} else {
  1949			gpriv->fcan = RCANFD_EXTCLK;
  1950		}
  1951		fcan_freq = clk_get_rate(gpriv->can_clk);
  1952	
  1953		if (gpriv->fcan == RCANFD_CANFDCLK)
  1954			/* CANFD clock is further divided by (1/2) within the IP */
  1955			fcan_freq /= info->postdiv;
  1956	
  1957		addr = devm_platform_ioremap_resource(pdev, 0);
  1958		if (IS_ERR(addr)) {
  1959			err = PTR_ERR(addr);
  1960			goto fail_dev;
  1961		}
  1962		gpriv->base = addr;
  1963	
  1964		/* Request IRQ that's common for both channels */
  1965		if (info->shared_global_irqs) {
  1966			err = devm_request_irq(dev, ch_irq,
  1967					       rcar_canfd_channel_interrupt, 0,
  1968					       "canfd.ch_int", gpriv);
  1969			if (err) {
  1970				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1971					ch_irq, err);
  1972				goto fail_dev;
  1973			}
  1974	
  1975			err = devm_request_irq(dev, g_irq, rcar_canfd_global_interrupt,
  1976					       0, "canfd.g_int", gpriv);
  1977			if (err) {
  1978				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1979					g_irq, err);
  1980				goto fail_dev;
  1981			}
  1982		} else {
  1983			err = devm_request_irq(dev, g_recc_irq,
  1984					       rcar_canfd_global_receive_fifo_interrupt, 0,
  1985					       "canfd.g_recc", gpriv);
  1986	
  1987			if (err) {
  1988				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1989					g_recc_irq, err);
  1990				goto fail_dev;
  1991			}
  1992	
  1993			err = devm_request_irq(dev, g_err_irq,
  1994					       rcar_canfd_global_err_interrupt, 0,
  1995					       "canfd.g_err", gpriv);
  1996			if (err) {
  1997				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1998					g_err_irq, err);
  1999				goto fail_dev;
  2000			}
  2001		}
  2002	
  2003		err = reset_control_reset(gpriv->rstc1);
  2004		if (err)
  2005			goto fail_dev;
  2006		err = reset_control_reset(gpriv->rstc2);
  2007		if (err) {
  2008			reset_control_assert(gpriv->rstc1);
  2009			goto fail_dev;
  2010		}
  2011	
  2012		/* Enable peripheral clock for register access */
  2013		err = clk_prepare_enable(gpriv->clkp);
  2014		if (err) {
  2015			dev_err(dev, "failed to enable peripheral clock, error %d\n",
  2016				err);
  2017			goto fail_reset;
  2018		}
  2019	
  2020		err = rcar_canfd_reset_controller(gpriv);
  2021		if (err) {
  2022			dev_err(dev, "reset controller failed\n");
  2023			goto fail_clk;
  2024		}
  2025	
  2026		/* Controller in Global reset & Channel reset mode */
  2027		rcar_canfd_configure_controller(gpriv);
  2028	
  2029		/* Configure per channel attributes */
  2030		for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels) {
  2031			/* Configure Channel's Rx fifo */
  2032			rcar_canfd_configure_rx(gpriv, ch);
  2033	
  2034			/* Configure Channel's Tx (Common) fifo */
  2035			rcar_canfd_configure_tx(gpriv, ch);
  2036	
  2037			/* Configure receive rules */
  2038			rcar_canfd_configure_afl_rules(gpriv, ch);
  2039		}
  2040	
  2041		/* Configure common interrupts */
  2042		rcar_canfd_enable_global_interrupts(gpriv);
  2043	
  2044		/* Start Global operation mode */
  2045		rcar_canfd_update_bit(gpriv->base, RCANFD_GCTR, RCANFD_GCTR_GMDC_MASK,
  2046				      RCANFD_GCTR_GMDC_GOPM);
  2047	
  2048		/* Verify mode change */
  2049		err = readl_poll_timeout((gpriv->base + RCANFD_GSTS), sts,
  2050					 !(sts & RCANFD_GSTS_GNOPM), 2, 500000);
  2051		if (err) {
  2052			dev_err(dev, "global operational mode failed\n");
  2053			goto fail_mode;
  2054		}
  2055	
  2056		for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels) {
  2057			err = rcar_canfd_channel_probe(gpriv, ch, fcan_freq,
  2058						       transceivers[ch]);
  2059			if (err)
  2060				goto fail_channel;
  2061		}
  2062	
  2063		platform_set_drvdata(pdev, gpriv);
  2064		dev_info(dev, "global operational state (clk %d, fdmode %d)\n",
  2065			 gpriv->fcan, gpriv->fdmode);
  2066		return 0;
  2067	
  2068	fail_channel:
  2069		for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels)
  2070			rcar_canfd_channel_remove(gpriv, ch);
  2071	fail_mode:
  2072		rcar_canfd_disable_global_interrupts(gpriv);
  2073	fail_clk:
  2074		clk_disable_unprepare(gpriv->clkp);
  2075	fail_reset:
  2076		reset_control_assert(gpriv->rstc1);
  2077		reset_control_assert(gpriv->rstc2);
  2078	fail_dev:
  2079		return err;
  2080	}
  2081	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (12 preceding siblings ...)
  2023-01-23 19:28 ` [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Wolfram Sang
@ 2023-01-24 11:02 ` Simon Horman
  2023-01-25 19:15 ` [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4 Rob Herring
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 30+ messages in thread
From: Simon Horman @ 2023-01-24 11:02 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfgang Grandegger, Marc Kleine-Budde, Rob Herring,
	Krzysztof Kozlowski, Fabrizio Castro, Philipp Zabel,
	Ulrich Hecht, linux-can, netdev, devicetree, linux-renesas-soc

On Mon, Jan 23, 2023 at 07:56:02PM +0100, Geert Uytterhoeven wrote:
> 	Hi all,
> 
> This patch series adds support for the CAN-FD interface on the Renesas
> R-Car V4H (R8A779G0) SoC and support for CAN transceivers described as
> PHYs to the R-Car CAN-FD driver.  It includes several fixes for issues
> (some minor) detected while adding the support and during testing.
> More details can be found in the individual patches.
> 
> Note that the last patch depends on "[PATCH 1/7] phy: Add
> devm_of_phy_optional_get() helper"[1].
> 
> This has been tested on the Renesas White-Hawk development board using
> cansend, candump, and canfdtest:
>   - Channel 0 uses an NXP TJR1443AT CAN transceiver, and works fine,
>   - Channels 1-7 use Microchip MCP2558FD-H/SN CAN transceivers (not
>     mounted for channels 4-7), which do not need explicit description.
>     While channel 1 works fine, channels 2-3 do not seem to work.
> 
> Hence despite the new fixes, the test results are similar to what Ulrich
> Hecht reported for R-Car V3U on the Falcon development board before,
> i.e. only channels 0 and 1 work (FTR, [2] does not help).
> Whether this is a CAN-FD driver issue, a pin control issue, an IP core
> issue, or an SoC integration issue is still to be seen...
> 
> 
> Thanks for your comments!

FWIIW this series looks clean to me:

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 12/12] can: rcar_canfd: Add transceiver support
  2023-01-23 18:56 ` [PATCH 12/12] can: rcar_canfd: Add transceiver support Geert Uytterhoeven
  2023-01-23 21:25   ` kernel test robot
@ 2023-01-24 18:41   ` Geert Uytterhoeven
  2023-02-02 14:40     ` Marc Kleine-Budde
  2023-01-25  6:34   ` kernel test robot
  2 siblings, 1 reply; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-01-24 18:41 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde
  Cc: Rob Herring, Krzysztof Kozlowski, Fabrizio Castro, Philipp Zabel,
	Ulrich Hecht, linux-can, netdev, devicetree, linux-renesas-soc,
	Geert Uytterhoeven

On Mon, Jan 23, 2023 at 7:56 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Add support for CAN transceivers described as PHYs.
>
> While simple CAN transceivers can do without, this is needed for CAN
> transceivers like NXP TJR1443 that need a configuration step (like
> pulling standby or enable lines), and/or impose a bitrate limit.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This depends on "[PATCH 1/7] phy: Add devm_of_phy_optional_get() helper".
> https://lore.kernel.org/all/f53a1bcca637ceeafb04ce3540a605532d3bc34a.1674036164.git.geert+renesas@glider.be

v2: "[PATCH v2 3/9] phy: Add devm_of_phy_optional_get() helper"
    https://lore.kernel.org/all/4cd0069bcff424ffc5c3a102397c02370b91985b.1674584626.git.geert+renesas@glider.be

I'll keep you updated when/if this ends up on an immutable branch.

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 12/12] can: rcar_canfd: Add transceiver support
  2023-01-23 18:56 ` [PATCH 12/12] can: rcar_canfd: Add transceiver support Geert Uytterhoeven
  2023-01-23 21:25   ` kernel test robot
  2023-01-24 18:41   ` Geert Uytterhoeven
@ 2023-01-25  6:34   ` kernel test robot
  2 siblings, 0 replies; 30+ messages in thread
From: kernel test robot @ 2023-01-25  6:34 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: oe-kbuild-all

Hi Geert,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on linus/master v6.2-rc5 next-20230124]
[cannot apply to mkl-can-next/testing]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Geert-Uytterhoeven/dt-bindings-can-renesas-rcar-canfd-R-Car-V3U-is-R-Car-Gen4/20230124-030354
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/e825b50a843ffe40e33f34e4d858c07c1b2ff259.1674499048.git.geert%2Brenesas%40glider.be
patch subject: [PATCH 12/12] can: rcar_canfd: Add transceiver support
config: arc-allmodconfig (https://download.01.org/0day-ci/archive/20230125/202301251409.gmw3J0Da-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/d2ab7bc9940c2cb09888ee0f253ca39cadccbc60
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Geert-Uytterhoeven/dt-bindings-can-renesas-rcar-canfd-R-Car-V3U-is-R-Car-Gen4/20230124-030354
        git checkout d2ab7bc9940c2cb09888ee0f253ca39cadccbc60
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/net/can/rcar/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   drivers/net/can/rcar/rcar_canfd.c: In function 'rcar_canfd_probe':
>> drivers/net/can/rcar/rcar_canfd.c:1876:43: error: implicit declaration of function 'devm_of_phy_optional_get'; did you mean 'devm_phy_optional_get'? [-Werror=implicit-function-declaration]
    1876 |                         transceivers[i] = devm_of_phy_optional_get(dev,
         |                                           ^~~~~~~~~~~~~~~~~~~~~~~~
         |                                           devm_phy_optional_get
>> drivers/net/can/rcar/rcar_canfd.c:1876:41: warning: assignment to 'struct phy *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    1876 |                         transceivers[i] = devm_of_phy_optional_get(dev,
         |                                         ^
   cc1: some warnings being treated as errors


vim +1876 drivers/net/can/rcar/rcar_canfd.c

  1849	
  1850	static int rcar_canfd_probe(struct platform_device *pdev)
  1851	{
  1852		struct phy *transceivers[RCANFD_NUM_CHANNELS] = { 0, };
  1853		const struct rcar_canfd_hw_info *info;
  1854		struct device *dev = &pdev->dev;
  1855		void __iomem *addr;
  1856		u32 sts, ch, fcan_freq;
  1857		struct rcar_canfd_global *gpriv;
  1858		struct device_node *of_child;
  1859		unsigned long channels_mask = 0;
  1860		int err, ch_irq, g_irq;
  1861		int g_err_irq, g_recc_irq;
  1862		bool fdmode = true;			/* CAN FD only mode - default */
  1863		char name[9] = "channelX";
  1864		int i;
  1865	
  1866		info = of_device_get_match_data(dev);
  1867	
  1868		if (of_property_read_bool(dev->of_node, "renesas,no-can-fd"))
  1869			fdmode = false;			/* Classical CAN only mode */
  1870	
  1871		for (i = 0; i < info->max_channels; ++i) {
  1872			name[7] = '0' + i;
  1873			of_child = of_get_child_by_name(dev->of_node, name);
  1874			if (of_child && of_device_is_available(of_child)) {
  1875				channels_mask |= BIT(i);
> 1876				transceivers[i] = devm_of_phy_optional_get(dev,
  1877								of_child, NULL);
  1878			}
  1879			of_node_put(of_child);
  1880			if (IS_ERR(transceivers[i]))
  1881				return PTR_ERR(transceivers[i]);
  1882		}
  1883	
  1884		if (info->shared_global_irqs) {
  1885			ch_irq = platform_get_irq_byname_optional(pdev, "ch_int");
  1886			if (ch_irq < 0) {
  1887				/* For backward compatibility get irq by index */
  1888				ch_irq = platform_get_irq(pdev, 0);
  1889				if (ch_irq < 0)
  1890					return ch_irq;
  1891			}
  1892	
  1893			g_irq = platform_get_irq_byname_optional(pdev, "g_int");
  1894			if (g_irq < 0) {
  1895				/* For backward compatibility get irq by index */
  1896				g_irq = platform_get_irq(pdev, 1);
  1897				if (g_irq < 0)
  1898					return g_irq;
  1899			}
  1900		} else {
  1901			g_err_irq = platform_get_irq_byname(pdev, "g_err");
  1902			if (g_err_irq < 0)
  1903				return g_err_irq;
  1904	
  1905			g_recc_irq = platform_get_irq_byname(pdev, "g_recc");
  1906			if (g_recc_irq < 0)
  1907				return g_recc_irq;
  1908		}
  1909	
  1910		/* Global controller context */
  1911		gpriv = devm_kzalloc(dev, sizeof(*gpriv), GFP_KERNEL);
  1912		if (!gpriv)
  1913			return -ENOMEM;
  1914	
  1915		gpriv->pdev = pdev;
  1916		gpriv->channels_mask = channels_mask;
  1917		gpriv->fdmode = fdmode;
  1918		gpriv->info = info;
  1919	
  1920		gpriv->rstc1 = devm_reset_control_get_optional_exclusive(dev, "rstp_n");
  1921		if (IS_ERR(gpriv->rstc1))
  1922			return dev_err_probe(dev, PTR_ERR(gpriv->rstc1),
  1923					     "failed to get rstp_n\n");
  1924	
  1925		gpriv->rstc2 = devm_reset_control_get_optional_exclusive(dev, "rstc_n");
  1926		if (IS_ERR(gpriv->rstc2))
  1927			return dev_err_probe(dev, PTR_ERR(gpriv->rstc2),
  1928					     "failed to get rstc_n\n");
  1929	
  1930		/* Peripheral clock */
  1931		gpriv->clkp = devm_clk_get(dev, "fck");
  1932		if (IS_ERR(gpriv->clkp))
  1933			return dev_err_probe(dev, PTR_ERR(gpriv->clkp),
  1934					     "cannot get peripheral clock\n");
  1935	
  1936		/* fCAN clock: Pick External clock. If not available fallback to
  1937		 * CANFD clock
  1938		 */
  1939		gpriv->can_clk = devm_clk_get(dev, "can_clk");
  1940		if (IS_ERR(gpriv->can_clk) || (clk_get_rate(gpriv->can_clk) == 0)) {
  1941			gpriv->can_clk = devm_clk_get(dev, "canfd");
  1942			if (IS_ERR(gpriv->can_clk))
  1943				return dev_err_probe(dev, PTR_ERR(gpriv->can_clk),
  1944						     "cannot get canfd clock\n");
  1945	
  1946			gpriv->fcan = RCANFD_CANFDCLK;
  1947	
  1948		} else {
  1949			gpriv->fcan = RCANFD_EXTCLK;
  1950		}
  1951		fcan_freq = clk_get_rate(gpriv->can_clk);
  1952	
  1953		if (gpriv->fcan == RCANFD_CANFDCLK)
  1954			/* CANFD clock is further divided by (1/2) within the IP */
  1955			fcan_freq /= info->postdiv;
  1956	
  1957		addr = devm_platform_ioremap_resource(pdev, 0);
  1958		if (IS_ERR(addr)) {
  1959			err = PTR_ERR(addr);
  1960			goto fail_dev;
  1961		}
  1962		gpriv->base = addr;
  1963	
  1964		/* Request IRQ that's common for both channels */
  1965		if (info->shared_global_irqs) {
  1966			err = devm_request_irq(dev, ch_irq,
  1967					       rcar_canfd_channel_interrupt, 0,
  1968					       "canfd.ch_int", gpriv);
  1969			if (err) {
  1970				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1971					ch_irq, err);
  1972				goto fail_dev;
  1973			}
  1974	
  1975			err = devm_request_irq(dev, g_irq, rcar_canfd_global_interrupt,
  1976					       0, "canfd.g_int", gpriv);
  1977			if (err) {
  1978				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1979					g_irq, err);
  1980				goto fail_dev;
  1981			}
  1982		} else {
  1983			err = devm_request_irq(dev, g_recc_irq,
  1984					       rcar_canfd_global_receive_fifo_interrupt, 0,
  1985					       "canfd.g_recc", gpriv);
  1986	
  1987			if (err) {
  1988				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1989					g_recc_irq, err);
  1990				goto fail_dev;
  1991			}
  1992	
  1993			err = devm_request_irq(dev, g_err_irq,
  1994					       rcar_canfd_global_err_interrupt, 0,
  1995					       "canfd.g_err", gpriv);
  1996			if (err) {
  1997				dev_err(dev, "devm_request_irq(%d) failed, error %d\n",
  1998					g_err_irq, err);
  1999				goto fail_dev;
  2000			}
  2001		}
  2002	
  2003		err = reset_control_reset(gpriv->rstc1);
  2004		if (err)
  2005			goto fail_dev;
  2006		err = reset_control_reset(gpriv->rstc2);
  2007		if (err) {
  2008			reset_control_assert(gpriv->rstc1);
  2009			goto fail_dev;
  2010		}
  2011	
  2012		/* Enable peripheral clock for register access */
  2013		err = clk_prepare_enable(gpriv->clkp);
  2014		if (err) {
  2015			dev_err(dev, "failed to enable peripheral clock, error %d\n",
  2016				err);
  2017			goto fail_reset;
  2018		}
  2019	
  2020		err = rcar_canfd_reset_controller(gpriv);
  2021		if (err) {
  2022			dev_err(dev, "reset controller failed\n");
  2023			goto fail_clk;
  2024		}
  2025	
  2026		/* Controller in Global reset & Channel reset mode */
  2027		rcar_canfd_configure_controller(gpriv);
  2028	
  2029		/* Configure per channel attributes */
  2030		for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels) {
  2031			/* Configure Channel's Rx fifo */
  2032			rcar_canfd_configure_rx(gpriv, ch);
  2033	
  2034			/* Configure Channel's Tx (Common) fifo */
  2035			rcar_canfd_configure_tx(gpriv, ch);
  2036	
  2037			/* Configure receive rules */
  2038			rcar_canfd_configure_afl_rules(gpriv, ch);
  2039		}
  2040	
  2041		/* Configure common interrupts */
  2042		rcar_canfd_enable_global_interrupts(gpriv);
  2043	
  2044		/* Start Global operation mode */
  2045		rcar_canfd_update_bit(gpriv->base, RCANFD_GCTR, RCANFD_GCTR_GMDC_MASK,
  2046				      RCANFD_GCTR_GMDC_GOPM);
  2047	
  2048		/* Verify mode change */
  2049		err = readl_poll_timeout((gpriv->base + RCANFD_GSTS), sts,
  2050					 !(sts & RCANFD_GSTS_GNOPM), 2, 500000);
  2051		if (err) {
  2052			dev_err(dev, "global operational mode failed\n");
  2053			goto fail_mode;
  2054		}
  2055	
  2056		for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels) {
  2057			err = rcar_canfd_channel_probe(gpriv, ch, fcan_freq,
  2058						       transceivers[ch]);
  2059			if (err)
  2060				goto fail_channel;
  2061		}
  2062	
  2063		platform_set_drvdata(pdev, gpriv);
  2064		dev_info(dev, "global operational state (clk %d, fdmode %d)\n",
  2065			 gpriv->fcan, gpriv->fdmode);
  2066		return 0;
  2067	
  2068	fail_channel:
  2069		for_each_set_bit(ch, &gpriv->channels_mask, info->max_channels)
  2070			rcar_canfd_channel_remove(gpriv, ch);
  2071	fail_mode:
  2072		rcar_canfd_disable_global_interrupts(gpriv);
  2073	fail_clk:
  2074		clk_disable_unprepare(gpriv->clkp);
  2075	fail_reset:
  2076		reset_control_assert(gpriv->rstc1);
  2077		reset_control_assert(gpriv->rstc2);
  2078	fail_dev:
  2079		return err;
  2080	}
  2081	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (13 preceding siblings ...)
  2023-01-24 11:02 ` Simon Horman
@ 2023-01-25 19:15 ` Rob Herring
  2023-01-25 19:15 ` [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support Rob Herring
  2023-01-25 19:16 ` [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support Rob Herring
  16 siblings, 0 replies; 30+ messages in thread
From: Rob Herring @ 2023-01-25 19:15 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Ulrich Hecht, devicetree, linux-can, Rob Herring,
	Marc Kleine-Budde, netdev, linux-renesas-soc, Fabrizio Castro,
	Wolfgang Grandegger, Philipp Zabel, Krzysztof Kozlowski


On Mon, 23 Jan 2023 19:56:03 +0100, Geert Uytterhoeven wrote:
> Despite the name, R-Car V3U is the first member of the R-Car Gen4
> family.  Hence generalize this by introducing a family-specific
> compatible value for R-Car Gen4.
> 
> While at it, replace "both channels" by "all channels", as the numbers
> of channels may differ from two.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  .../bindings/net/can/renesas,rcar-canfd.yaml          | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (14 preceding siblings ...)
  2023-01-25 19:15 ` [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4 Rob Herring
@ 2023-01-25 19:15 ` Rob Herring
  2023-01-25 19:16 ` [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support Rob Herring
  16 siblings, 0 replies; 30+ messages in thread
From: Rob Herring @ 2023-01-25 19:15 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Ulrich Hecht, linux-renesas-soc, Rob Herring, Marc Kleine-Budde,
	linux-can, devicetree, netdev, Philipp Zabel,
	Wolfgang Grandegger, Fabrizio Castro, Krzysztof Kozlowski


On Mon, 23 Jan 2023 19:56:04 +0100, Geert Uytterhoeven wrote:
> Document support for the CAN-FD Interface on the Renesas R-Car V4H
> (R8A779G0) SoC.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  .../devicetree/bindings/net/can/renesas,rcar-canfd.yaml          | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support
  2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
                   ` (15 preceding siblings ...)
  2023-01-25 19:15 ` [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support Rob Herring
@ 2023-01-25 19:16 ` Rob Herring
  16 siblings, 0 replies; 30+ messages in thread
From: Rob Herring @ 2023-01-25 19:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-can, Ulrich Hecht, Marc Kleine-Budde, linux-renesas-soc,
	Fabrizio Castro, netdev, devicetree, Rob Herring,
	Krzysztof Kozlowski, Philipp Zabel, Wolfgang Grandegger


On Mon, 23 Jan 2023 19:56:05 +0100, Geert Uytterhoeven wrote:
> Add support for describing CAN transceivers as PHYs.
> 
> While simple CAN transceivers can do without, this is needed for CAN
> transceivers like NXP TJR1443 that need a configuration step (like
> pulling standby or enable lines), and/or impose a bitrate limit.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  .../devicetree/bindings/net/can/renesas,rcar-canfd.yaml       | 4 ++++
>  1 file changed, 4 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4
  2023-01-23 18:56 ` [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4 Geert Uytterhoeven
@ 2023-01-31 17:17   ` Rob Herring
  0 siblings, 0 replies; 30+ messages in thread
From: Rob Herring @ 2023-01-31 17:17 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfgang Grandegger, Marc Kleine-Budde, Krzysztof Kozlowski,
	Fabrizio Castro, Philipp Zabel, Ulrich Hecht, linux-can, netdev,
	devicetree, linux-renesas-soc

On Mon, Jan 23, 2023 at 07:56:03PM +0100, Geert Uytterhoeven wrote:
> Despite the name, R-Car V3U is the first member of the R-Car Gen4
> family.  Hence generalize this by introducing a family-specific
> compatible value for R-Car Gen4.
> 
> While at it, replace "both channels" by "all channels", as the numbers
> of channels may differ from two.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  .../bindings/net/can/renesas,rcar-canfd.yaml          | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

Properly threaded resend due to header corruption.

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support
  2023-01-23 18:56 ` [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support Geert Uytterhoeven
@ 2023-01-31 17:18   ` Rob Herring
  0 siblings, 0 replies; 30+ messages in thread
From: Rob Herring @ 2023-01-31 17:18 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfgang Grandegger, Marc Kleine-Budde, Krzysztof Kozlowski,
	Fabrizio Castro, Philipp Zabel, Ulrich Hecht, linux-can, netdev,
	devicetree, linux-renesas-soc

On Mon, Jan 23, 2023 at 07:56:04PM +0100, Geert Uytterhoeven wrote:
> Document support for the CAN-FD Interface on the Renesas R-Car V4H
> (R8A779G0) SoC.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  .../devicetree/bindings/net/can/renesas,rcar-canfd.yaml          | 1 +
>  1 file changed, 1 insertion(+)

Properly threaded resend due to header corruption.

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support
  2023-01-23 18:56 ` [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support Geert Uytterhoeven
@ 2023-01-31 17:18   ` Rob Herring
  0 siblings, 0 replies; 30+ messages in thread
From: Rob Herring @ 2023-01-31 17:18 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfgang Grandegger, Marc Kleine-Budde, Krzysztof Kozlowski,
	Fabrizio Castro, Philipp Zabel, Ulrich Hecht, linux-can, netdev,
	devicetree, linux-renesas-soc

On Mon, Jan 23, 2023 at 07:56:05PM +0100, Geert Uytterhoeven wrote:
> Add support for describing CAN transceivers as PHYs.
> 
> While simple CAN transceivers can do without, this is needed for CAN
> transceivers like NXP TJR1443 that need a configuration step (like
> pulling standby or enable lines), and/or impose a bitrate limit.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  .../devicetree/bindings/net/can/renesas,rcar-canfd.yaml       | 4 ++++
>  1 file changed, 4 insertions(+)

Properly threaded resend due to header corruption.

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 12/12] can: rcar_canfd: Add transceiver support
  2023-01-24 18:41   ` Geert Uytterhoeven
@ 2023-02-02 14:40     ` Marc Kleine-Budde
  2023-02-02 14:53       ` Geert Uytterhoeven
  0 siblings, 1 reply; 30+ messages in thread
From: Marc Kleine-Budde @ 2023-02-02 14:40 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfgang Grandegger, Rob Herring, Krzysztof Kozlowski,
	Fabrizio Castro, Philipp Zabel, Ulrich Hecht, linux-can, netdev,
	devicetree, linux-renesas-soc, Geert Uytterhoeven

[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]

On 24.01.2023 19:41:03, Geert Uytterhoeven wrote:
> On Mon, Jan 23, 2023 at 7:56 PM Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > Add support for CAN transceivers described as PHYs.
> >
> > While simple CAN transceivers can do without, this is needed for CAN
> > transceivers like NXP TJR1443 that need a configuration step (like
> > pulling standby or enable lines), and/or impose a bitrate limit.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > This depends on "[PATCH 1/7] phy: Add devm_of_phy_optional_get() helper".
> > https://lore.kernel.org/all/f53a1bcca637ceeafb04ce3540a605532d3bc34a.1674036164.git.geert+renesas@glider.be
> 
> v2: "[PATCH v2 3/9] phy: Add devm_of_phy_optional_get() helper"
>     https://lore.kernel.org/all/4cd0069bcff424ffc5c3a102397c02370b91985b.1674584626.git.geert+renesas@glider.be
> 
> I'll keep you updated when/if this ends up on an immutable branch.

Should I take the patches 1...11 for can-next/main?

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 12/12] can: rcar_canfd: Add transceiver support
  2023-02-02 14:40     ` Marc Kleine-Budde
@ 2023-02-02 14:53       ` Geert Uytterhoeven
  2023-02-02 15:06         ` Marc Kleine-Budde
  0 siblings, 1 reply; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-02-02 14:53 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wolfgang Grandegger, Rob Herring, Krzysztof Kozlowski,
	Fabrizio Castro, Philipp Zabel, Ulrich Hecht, linux-can, netdev,
	devicetree, linux-renesas-soc, Vinod

Hi Marc,

On Thu, Feb 2, 2023 at 3:40 PM Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> On 24.01.2023 19:41:03, Geert Uytterhoeven wrote:
> > On Mon, Jan 23, 2023 at 7:56 PM Geert Uytterhoeven
> > <geert+renesas@glider.be> wrote:
> > > Add support for CAN transceivers described as PHYs.
> > >
> > > While simple CAN transceivers can do without, this is needed for CAN
> > > transceivers like NXP TJR1443 that need a configuration step (like
> > > pulling standby or enable lines), and/or impose a bitrate limit.
> > >
> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > ---
> > > This depends on "[PATCH 1/7] phy: Add devm_of_phy_optional_get() helper".
> > > https://lore.kernel.org/all/f53a1bcca637ceeafb04ce3540a605532d3bc34a.1674036164.git.geert+renesas@glider.be
> >
> > v2: "[PATCH v2 3/9] phy: Add devm_of_phy_optional_get() helper"
> >     https://lore.kernel.org/all/4cd0069bcff424ffc5c3a102397c02370b91985b.1674584626.git.geert+renesas@glider.be
> >
> > I'll keep you updated when/if this ends up on an immutable branch.
>
> Should I take the patches 1...11 for can-next/main?

That would be great, thanks!

I had hoped Vinod would have applied the dependency, and provided
an immutable branch, as originally planned.

Alternatively, I can send a v2 of 12/12 that does not rely on the
new helper, and convert it later.

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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 12/12] can: rcar_canfd: Add transceiver support
  2023-02-02 14:53       ` Geert Uytterhoeven
@ 2023-02-02 15:06         ` Marc Kleine-Budde
  2023-02-03 10:24           ` Geert Uytterhoeven
  0 siblings, 1 reply; 30+ messages in thread
From: Marc Kleine-Budde @ 2023-02-02 15:06 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfgang Grandegger, Rob Herring, Krzysztof Kozlowski,
	Fabrizio Castro, Philipp Zabel, Ulrich Hecht, linux-can, netdev,
	devicetree, linux-renesas-soc, Vinod

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

On 02.02.2023 15:53:08, Geert Uytterhoeven wrote:
> > > > This depends on "[PATCH 1/7] phy: Add devm_of_phy_optional_get() helper".
> > > > https://lore.kernel.org/all/f53a1bcca637ceeafb04ce3540a605532d3bc34a.1674036164.git.geert+renesas@glider.be
> > >
> > > v2: "[PATCH v2 3/9] phy: Add devm_of_phy_optional_get() helper"
> > >     https://lore.kernel.org/all/4cd0069bcff424ffc5c3a102397c02370b91985b.1674584626.git.geert+renesas@glider.be
> > >
> > > I'll keep you updated when/if this ends up on an immutable branch.
> >
> > Should I take the patches 1...11 for can-next/main?
> 
> That would be great, thanks!

Done.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 12/12] can: rcar_canfd: Add transceiver support
  2023-02-02 15:06         ` Marc Kleine-Budde
@ 2023-02-03 10:24           ` Geert Uytterhoeven
  2023-02-07 19:20             ` Marc Kleine-Budde
  0 siblings, 1 reply; 30+ messages in thread
From: Geert Uytterhoeven @ 2023-02-03 10:24 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wolfgang Grandegger, Rob Herring, Krzysztof Kozlowski,
	Fabrizio Castro, Philipp Zabel, Ulrich Hecht, linux-can, netdev,
	devicetree, linux-renesas-soc, Vinod

Hi Marc,

On Thu, Feb 2, 2023 at 4:06 PM Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> On 02.02.2023 15:53:08, Geert Uytterhoeven wrote:
> > > > > This depends on "[PATCH 1/7] phy: Add devm_of_phy_optional_get() helper".
> > > > > https://lore.kernel.org/all/f53a1bcca637ceeafb04ce3540a605532d3bc34a.1674036164.git.geert+renesas@glider.be
> > > >
> > > > v2: "[PATCH v2 3/9] phy: Add devm_of_phy_optional_get() helper"
> > > >     https://lore.kernel.org/all/4cd0069bcff424ffc5c3a102397c02370b91985b.1674584626.git.geert+renesas@glider.be
> > > >
> > > > I'll keep you updated when/if this ends up on an immutable branch.
> > >
> > > Should I take the patches 1...11 for can-next/main?
> >
> > That would be great, thanks!
>
> Done.

Thank you!
Meanwhile, the dependency for 12/12 is now available as an immutable
branch, cfr. https://lore.kernel.org/all/Y9za4a8qyapi4CWD@matsya

Thanks again!


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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 12/12] can: rcar_canfd: Add transceiver support
  2023-02-03 10:24           ` Geert Uytterhoeven
@ 2023-02-07 19:20             ` Marc Kleine-Budde
  0 siblings, 0 replies; 30+ messages in thread
From: Marc Kleine-Budde @ 2023-02-07 19:20 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfgang Grandegger, Rob Herring, Krzysztof Kozlowski,
	Fabrizio Castro, Philipp Zabel, Ulrich Hecht, linux-can, netdev,
	devicetree, linux-renesas-soc, Vinod

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]

On 03.02.2023 11:24:08, Geert Uytterhoeven wrote:
> > > > > I'll keep you updated when/if this ends up on an immutable branch.
> > > >
> > > > Should I take the patches 1...11 for can-next/main?
> > >
> > > That would be great, thanks!
> >
> > Done.
> 
> Thank you!
> Meanwhile, the dependency for 12/12 is now available as an immutable
> branch, cfr. https://lore.kernel.org/all/Y9za4a8qyapi4CWD@matsya

net-next/main is at v6.2-rc6, but does not include this series. I assume
it will be mainlined in the v6.3 merge window. I think you can resend
this patch against can/main once v6.3-rc1 is released.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2023-02-07 19:21 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 18:56 [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4 Geert Uytterhoeven
2023-01-31 17:17   ` Rob Herring
2023-01-23 18:56 ` [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support Geert Uytterhoeven
2023-01-31 17:18   ` Rob Herring
2023-01-23 18:56 ` [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support Geert Uytterhoeven
2023-01-31 17:18   ` Rob Herring
2023-01-23 18:56 ` [PATCH 04/12] can: rcar_canfd: Fix R-Car V3U CAN mode selection Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 05/12] can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 06/12] can: rcar_canfd: Abstract out DCFG address differences Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 07/12] can: rcar_canfd: Add support for R-Car Gen4 Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 08/12] can: rcar_canfd: Fix R-Car Gen4 DCFG.DSJW field width Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 09/12] can: rcar_canfd: Fix R-Car Gen4 CFCC.CFTML " Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 10/12] can: rcar_canfd: Sort included header files Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 11/12] can: rcar_canfd: Add helper variable dev Geert Uytterhoeven
2023-01-23 18:56 ` [PATCH 12/12] can: rcar_canfd: Add transceiver support Geert Uytterhoeven
2023-01-23 21:25   ` kernel test robot
2023-01-24 18:41   ` Geert Uytterhoeven
2023-02-02 14:40     ` Marc Kleine-Budde
2023-02-02 14:53       ` Geert Uytterhoeven
2023-02-02 15:06         ` Marc Kleine-Budde
2023-02-03 10:24           ` Geert Uytterhoeven
2023-02-07 19:20             ` Marc Kleine-Budde
2023-01-25  6:34   ` kernel test robot
2023-01-23 19:28 ` [PATCH 00/12] can: rcar_canfd: Add support for R-Car V4H systems Wolfram Sang
2023-01-23 19:37   ` Geert Uytterhoeven
2023-01-24 11:02 ` Simon Horman
2023-01-25 19:15 ` [PATCH 01/12] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4 Rob Herring
2023-01-25 19:15 ` [PATCH 02/12] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support Rob Herring
2023-01-25 19:16 ` [PATCH 03/12] dt-bindings: can: renesas,rcar-canfd: Add transceiver support Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.