Skip to contentSkip to conversation

net: stmmac: add renesas,rzn1-gmac support

PATCH Superseded Clément Léger 5 participants 14 messages Jan 16, 2023 – Feb 10, 2023

Subsystems (6)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover net: stmmac: add renesas,rzn1-gmac support

The rzn1-gmac instance is connected to a PCS (MIIC). In order to use this pcs, add support in the sttmac driver to set a generic phylink pcs device instead of the xpcs only. Moreover, it adds support to provide a phylink pcs device from the stmmac platform data and use it with the driver. It also adds the bindings and the new rzn1-gmac driver that retrieve this pcs from the device-tree.

Clément Léger (6):
net: stmmac: add support to use a generic phylink_pcs as PCS
net: stmmac: add support to provide pcs from platform data
net: stmmac: start phylink before setting up hardware
dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support
net: stmmac: add support for RZ/N1 GMAC
ARM: dts: r9a06g032: describe GMAC1

 .../bindings/net/renesas,rzn1-gmac.yaml       |  71 +++++++++++
 arch/arm/boot/dts/r9a06g032.dtsi              |  18 +++
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 ++
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 drivers/net/ethernet/stmicro/stmmac/common.h  |   2 +
 .../net/ethernet/stmicro/stmmac/dwmac-rzn1.c  | 113 ++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  15 ++-
 .../net/ethernet/stmicro/stmmac/stmmac_mdio.c |   1 +
 include/linux/stmmac.h                        |   1 +
 9 files changed, 228 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
Signature · 1 line
2.39.0
#1 lore raw

PATCH 1/6 net: stmmac: add support to use a generic phylink_pcs as PCS

Currently, the PCS is set based on the presence of the xpcs field. In order to allow supporting other PCS, add a phylink_pcs pcs field to struct mac_device_info which is used in stmmac_mac_select_pcs() to select the correct PCS.

---
 drivers/net/ethernet/stmicro/stmmac/common.h      | 2 ++
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +----
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 1 +
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +2 -0
index 6b5d96bced47..79fd67e8ab90 100644
@@ -15,6 +15,7 @@
 #include <linux/netdevice.h>
 #include <linux/stmmac.h>
 #include <linux/phy.h>
+#include <linux/phylink.h>
 #include <linux/pcs/pcs-xpcs.h>
 #include <linux/module.h>
 #if IS_ENABLED(CONFIG_VLAN_8021Q)
@@ -518,6 +519,7 @@ struct mac_device_info {
 	const struct stmmac_tc_ops *tc;
 	const struct stmmac_mmc_ops *mmc;
 	struct dw_xpcs *xpcs;
+	struct phylink_pcs *phylink_pcs;
 	struct mii_regs mii;	/* MII register Addresses */
 	struct mac_link link;
 	void __iomem *pcsr;     /* vpointer to device CSRs */
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -4
index c6951c976f5d..19459ef15a35 100644
@@ -937,10 +937,7 @@ static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config,
 {
 	struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
 
-	if (!priv->hw->xpcs)
-		return NULL;
-
-	return &priv->hw->xpcs->pcs;
+	return priv->hw->phylink_pcs;
 }
 
 static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +1 -0
index 5f177ea80725..3e875d4664c0 100644
@@ -413,6 +413,7 @@ int stmmac_xpcs_setup(struct mii_bus *bus)
 		}
 
 		priv->hw->xpcs = xpcs;
+		priv->hw->phylink_pcs = &xpcs->pcs;
 		break;
 	}
 
Signature · 1 line
2.39.0
#2 lore raw

PATCH 2/6 net: stmmac: add support to provide pcs from platform data

In reply to Clément Léger

Add a pcs field in platform_data to allow providing platform data. This is gonig to be used by the renesas,rzn1-gmac compatible driver which can make use of a PCS.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
 include/linux/stmmac.h                            | 1 +
 2 files changed, 4 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -0
index 19459ef15a35..f2247b8cf0a3 100644
@@ -7287,6 +7287,9 @@ int stmmac_dvr_probe(struct device *device,
 			goto error_xpcs_setup;
 	}
 
+	if (priv->plat->pcs)
+		priv->hw->phylink_pcs = priv->plat->pcs;
+
 	ret = stmmac_phy_setup(priv);
 	if (ret) {
 		netdev_err(ndev, "failed to setup phy (%d)\n", ret);
include/linux/stmmac.h +1 -0
index 83ca2e8eb6b5..af09d5e0ca4b 100644
@@ -272,5 +272,6 @@ struct plat_stmmacenet_data {
 	bool use_phy_wol;
 	bool sph_disable;
 	bool serdes_up_after_phy_linkup;
+	struct phylink_pcs *pcs;
 };
 #endif
Signature · 1 line
2.39.0
#3 lore raw

PATCH 3/6 net: stmmac: start phylink before setting up hardware

In reply to Clément Léger

The stmmac on the Renesas RZ/N1 platform is connected to the PCS which must be configured to provide a correct RGMII RX clock to the stmmac IP. Without the RX clock, the driver will fail to initialize the hardware (more specifically, the driver will report it fails to reset DMA). In order to fix that, start phylink mecanism before setting up hardware.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6 -1
index f2247b8cf0a3..88c941003855 100644
@@ -3818,6 +3818,12 @@ static int __stmmac_open(struct net_device *dev,
 		}
 	}
 
+	/* We need to setup the phy & PCS before accessing the stmmac registers
+	 * because in some cases (RZ/N1), if the stmmac IP is not clocked by the
+	 * PCS, hardware init will fail because it lacks a RGMII RX clock.
+	 */
+	phylink_start(priv->phylink);
+
 	ret = stmmac_hw_setup(dev, true);
 	if (ret < 0) {
 		netdev_err(priv->dev, "%s: Hw setup failed\n", __func__);
@@ -3826,7 +3832,6 @@ static int __stmmac_open(struct net_device *dev,
 
 	stmmac_init_coalesce(priv);
 
-	phylink_start(priv->phylink);
 	/* We may have called phylink_speed_down before */
 	phylink_speed_up(priv->phylink);
 
Signature · 1 line
2.39.0
#4 lore raw

Re: [PATCH net-next 3/6] net: stmmac: start phylink before setting up hardware

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int __stmmac_open(struct net_device *dev, · line 3825

Quoted 13 lines · Clément Léger
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -0
index f2247b8cf0a3..88c941003855 100644
@@ -3818,6 +3818,12 @@ static int __stmmac_open(struct net_device *dev,
 		}
 	}
 
+	/* We need to setup the phy & PCS before accessing the stmmac registers
+	 * because in some cases (RZ/N1), if the stmmac IP is not clocked by the
+	 * PCS, hardware init will fail because it lacks a RGMII RX clock.
+	 */
+	phylink_start(priv->phylink);

So what happens if you end up with the mac_link_up method being called at this point in the driver, before the hardware has been setup ?

If you use a fixed-link, that's a real possibility.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#5 lore raw

Re: [PATCH net-next 3/6] net: stmmac: start phylink before setting up hardware

Quoted 18 lines · Russell King (Oracle)

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int __stmmac_open(struct net_device *dev, · line 3825

Quoted 13 lines · Clément Léger
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -0
index f2247b8cf0a3..88c941003855 100644
@@ -3818,6 +3818,12 @@ static int __stmmac_open(struct net_device *dev,
 		}
 	}
 
+	/* We need to setup the phy & PCS before accessing the stmmac registers
+	 * because in some cases (RZ/N1), if the stmmac IP is not clocked by the
+	 * PCS, hardware init will fail because it lacks a RGMII RX clock.
+	 */
+	phylink_start(priv->phylink);  

So what happens if you end up with the mac_link_up method being called at this point in the driver, before the hardware has been setup ?

Quoted 1 line

If you use a fixed-link, that's a real possibility.

I actually have this setup. On the board, one GMAC is connected to a DSA switch using a fixed-link and the other using the PCS such as added by this series.

From what I see, indeed, the mac_link_up() function is called before stmmac_hw_setup(). This does not seems to have any effect on my setup (except making it working of course) but I agree this is clearly not ideal.

What I could do is adding a function in the miic pcs driver that could be called from my rzn1 stmmac probe function to actually configure the PCS at probe time based on the detected "phy-mode". Does that seems better to you ?

Thanks,

Signature · 8 lines
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#6 lore raw

Re: [PATCH net-next 3/6] net: stmmac: start phylink before setting up hardware

Quoted 32 lines · Clément Léger
Quoted 18 lines · Russell King (Oracle)

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int __stmmac_open(struct net_device *dev, · line 3825

Quoted 13 lines · Clément Léger
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -0
index f2247b8cf0a3..88c941003855 100644
@@ -3818,6 +3818,12 @@ static int __stmmac_open(struct net_device *dev,
 		}
 	}
 
+	/* We need to setup the phy & PCS before accessing the stmmac registers
+	 * because in some cases (RZ/N1), if the stmmac IP is not clocked by the
+	 * PCS, hardware init will fail because it lacks a RGMII RX clock.
+	 */
+	phylink_start(priv->phylink);  

So what happens if you end up with the mac_link_up method being called at this point in the driver, before the hardware has been setup ?

Quoted 1 line

If you use a fixed-link, that's a real possibility.

I actually have this setup. On the board, one GMAC is connected to a DSA switch using a fixed-link and the other using the PCS such as added by this series.

From what I see, indeed, the mac_link_up() function is called before stmmac_hw_setup(). This does not seems to have any effect on my setup (except making it working of course) but I agree this is clearly not ideal.

Quoted 4 lines

What I could do is adding a function in the miic pcs driver that could be called from my rzn1 stmmac probe function to actually configure the PCS at probe time based on the detected "phy-mode". Does that seems better to you ?

I think Clark Wang is also working on addressing a very similar problem with stmmac. Please can you check out his work first, he's adding a new function to phylink to bring the PHY up early in the resume path.

I would like you both to work together to address what seems to be the same issue.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#7 lore raw

Re: [PATCH net-next 3/6] net: stmmac: start phylink before setting up hardware

Quoted 38 lines · Russell King (Oracle)
Quoted 32 lines · Clément Léger
Quoted 18 lines · Russell King (Oracle)

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int __stmmac_open(struct net_device *dev, · line 3825

Quoted 13 lines · Clément Léger
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -0
index f2247b8cf0a3..88c941003855 100644
@@ -3818,6 +3818,12 @@ static int __stmmac_open(struct net_device *dev,
 		}
 	}
 
+	/* We need to setup the phy & PCS before accessing the stmmac registers
+	 * because in some cases (RZ/N1), if the stmmac IP is not clocked by the
+	 * PCS, hardware init will fail because it lacks a RGMII RX clock.
+	 */
+	phylink_start(priv->phylink);    

So what happens if you end up with the mac_link_up method being called at this point in the driver, before the hardware has been setup ?

Quoted 1 line

If you use a fixed-link, that's a real possibility.

I actually have this setup. On the board, one GMAC is connected to a DSA switch using a fixed-link and the other using the PCS such as added by this series.

From what I see, indeed, the mac_link_up() function is called before stmmac_hw_setup(). This does not seems to have any effect on my setup (except making it working of course) but I agree this is clearly not ideal.

Quoted 4 lines

What I could do is adding a function in the miic pcs driver that could be called from my rzn1 stmmac probe function to actually configure the PCS at probe time based on the detected "phy-mode". Does that seems better to you ?

Quoted 7 lines

I think Clark Wang is also working on addressing a very similar problem with stmmac. Please can you check out his work first, he's adding a new function to phylink to bring the PHY up early in the resume path.

I would like you both to work together to address what seems to be the same issue.

Acked

Signature · 3 lines
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com
#8 lore raw

PATCH 4/6 dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support

In reply to Clément Léger

Add "renesas,rzn1-gmac" binding documention which is compatible which "snps,dwmac" compatible driver but uses a custom PCS to communicate with the phy.

---
 .../bindings/net/renesas,rzn1-gmac.yaml       | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +71 -0
new file mode 100644
index 000000000000..effb9a312832
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/renesas,rzn1-gmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas GMAC1 Device Tree Bindings
+
+maintainers:
+  - Clément Léger <[email protected]>
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - renesas,r9a06g032-gmac
+          - renesas,rzn1-gmac
+  required:
+    - compatible
+
+allOf:
+  - $ref: "snps,dwmac.yaml#"
+
+properties:
+  compatible:
+    additionalItems: true
+    maxItems: 3
+    items:
+      - enum:
+          - renesas,r9a06g032-gmac
+          - renesas,rzn1-gmac
+    contains:
+      enum:
+        - snps,dwmac
+
+  pcs-handle:
+    description:
+      phandle pointing to a PCS sub-node compatible with
+      renesas,rzn1-miic.yaml#
+    $ref: /schemas/types.yaml#/definitions/phandle
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/r9a06g032-sysctrl.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    ethernet@44000000 {
+      compatible = "renesas,rzn1-gmac";
+      reg = <0x44000000 0x2000>;
+      interrupt-parent = <&gic>;
+      interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
+             <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>,
+             <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
+      interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
+      clock-names = "stmmaceth";
+      clocks = <&sysctrl R9A06G032_HCLK_GMAC0>;
+      snps,multicast-filter-bins = <256>;
+      snps,perfect-filter-entries = <128>;
+      tx-fifo-depth = <2048>;
+      rx-fifo-depth = <4096>;
+      pcs-handle = <&mii_conv1>;
+      phy-mode = "mii";
+    };
+
+...
Signature · 1 line
2.39.0
#9 lore raw

Re: [PATCH net-next 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support

Hi Clément,

Thanks for your patch!

Quoted 1 line · Clément Léger

Add "renesas,rzn1-gmac" binding documention which is compatible which

documentation

Quoted 40 lines

"snps,dwmac" compatible driver but uses a custom PCS to communicate with the phy.

---
 .../bindings/net/renesas,rzn1-gmac.yaml       | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +25 -0
new file mode 100644
index 000000000000..effb9a312832
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/renesas,rzn1-gmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas GMAC1 Device Tree Bindings
+
+maintainers:
+  - Clément Léger <[email protected]>
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - renesas,r9a06g032-gmac
+          - renesas,rzn1-gmac
+  required:
+    - compatible
+
+allOf:
+  - $ref: "snps,dwmac.yaml#"
+
+properties:

Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml line 35

Quoted 10 lines
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +10 -0
+  compatible:
+    additionalItems: true
+    maxItems: 3
+    items:
+      - enum:
+          - renesas,r9a06g032-gmac
+          - renesas,rzn1-gmac
+    contains:
+      enum:
+        - snps,dwmac

Why not just

items:
- enum:
- renesas,r9a06g032-gmac
- renesas,rzn1-gmac
- snps,dwmac

?

Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml line 54

Quoted 7 lines
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +7 -0
+examples:
+  - |
+    #include <dt-bindings/clock/r9a06g032-sysctrl.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    ethernet@44000000 {
+      compatible = "renesas,rzn1-gmac";

Documentation/devicetree/bindings/net/renesas,rzn1-gmac.example.dtb:
ethernet@44000000: compatible: ['renesas,rzn1-gmac'] does not contain items matching the given schema

Quoted 7 lines
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +7 -0
+      reg = <0x44000000 0x2000>;
+      interrupt-parent = <&gic>;
+      interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
+             <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>,
+             <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
+      interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
+      clock-names = "stmmaceth";

Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml line 71

Quoted 10 lines
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +10 -0
+      clocks = <&sysctrl R9A06G032_HCLK_GMAC0>;
+      snps,multicast-filter-bins = <256>;
+      snps,perfect-filter-entries = <128>;
+      tx-fifo-depth = <2048>;
+      rx-fifo-depth = <4096>;
+      pcs-handle = <&mii_conv1>;
+      phy-mode = "mii";
+    };
+
+...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#10 lore raw

Re: [PATCH net-next 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support

In reply to Clément Léger
Quoted 10 lines · Clément Léger

Add "renesas,rzn1-gmac" binding documention which is compatible which "snps,dwmac" compatible driver but uses a custom PCS to communicate with the phy.

---
 .../bindings/net/renesas,rzn1-gmac.yaml       | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.example.dtb: ethernet@44000000: compatible: ['renesas,rzn1-gmac'] does not contain items matching the given schema
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#11 lore raw

Re: [PATCH net-next 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support

In reply to Clément Léger
Quoted 16 lines · Clément Léger

Add "renesas,rzn1-gmac" binding documention which is compatible which "snps,dwmac" compatible driver but uses a custom PCS to communicate with the phy.

---
 .../bindings/net/renesas,rzn1-gmac.yaml       | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +0 -0
new file mode 100644
index 000000000000..effb9a312832

Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +7 -0
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/renesas,rzn1-gmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas GMAC1 Device Tree Bindings

Drop Device Tree Bindings.

Quoted 6 lines
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +6 -0
+
+maintainers:
+  - Clément Léger <[email protected]>
+
+select:
+  properties:

Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml line 23

Quoted 10 lines
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +10 -0
+    compatible:
+      contains:
+        enum:
+          - renesas,r9a06g032-gmac
+          - renesas,rzn1-gmac
+  required:
+    - compatible
+
+allOf:
+  - $ref: "snps,dwmac.yaml#"

Drop quotes.

Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml line 27

Quoted 4 lines
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +4 -0
+
+properties:
+  compatible:
+    additionalItems: true

No. Drop.

Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml line 28

Quoted 1 line
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +1 -0
+    maxItems: 3

No.

Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml line 35

Quoted 7 lines
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +7 -0
+    items:
+      - enum:
+          - renesas,r9a06g032-gmac
+          - renesas,rzn1-gmac
+    contains:
+      enum:
+        - snps,dwmac

No, please list possibilities

Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml line 47

Quoted 12 lines
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file +12 -0
+
+  pcs-handle:
+    description:
+      phandle pointing to a PCS sub-node compatible with
+      renesas,rzn1-miic.yaml#
+    $ref: /schemas/types.yaml#/definitions/phandle
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+

Best regards,
Krzysztof

#12 lore raw

PATCH 5/6 net: stmmac: add support for RZ/N1 GMAC

In reply to Clément Léger

Add support for Renesas RZ/N1 GMAC. This support uses a custom PCS (MIIC) which is handle by parsing the pcs-handle device tree property.

---
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 ++
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../net/ethernet/stmicro/stmmac/dwmac-rzn1.c  | 113 ++++++++++++++++++
 3 files changed, 125 insertions(+)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
drivers/net/ethernet/stmicro/stmmac/Kconfig +11 -0
index f77511fe4e87..be5429b7e192 100644
@@ -153,6 +153,17 @@ config DWMAC_ROCKCHIP
 	  This selects the Rockchip RK3288 SoC glue layer support for
 	  the stmmac device driver.
 
+config DWMAC_RZN1
+	tristate "Renesas RZ/N1 dwmac support"
+	default ARCH_RZN1
+	depends on OF && (ARCH_RZN1 || COMPILE_TEST)
+	select PCS_RZN1_MIIC
+	help
+	  Support for Ethernet controller on Renesas RZ/N1 SoC family.
+
+	  This selects the Renesas RZ/N1 SoC glue layer support for
+	  the stmmac device driver.
+
 config DWMAC_SOCFPGA
 	tristate "SOCFPGA dwmac support"
 	default ARCH_INTEL_SOCFPGA
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
index 057e4bab5c08..53a0f74c1cb5 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o dwmac-meson8b.o
 obj-$(CONFIG_DWMAC_OXNAS)	+= dwmac-oxnas.o
 obj-$(CONFIG_DWMAC_QCOM_ETHQOS)	+= dwmac-qcom-ethqos.o
 obj-$(CONFIG_DWMAC_ROCKCHIP)	+= dwmac-rk.o
+obj-$(CONFIG_DWMAC_RZN1)	+= dwmac-rzn1.o
 obj-$(CONFIG_DWMAC_SOCFPGA)	+= dwmac-altr-socfpga.o
 obj-$(CONFIG_DWMAC_STI)		+= dwmac-sti.o
 obj-$(CONFIG_DWMAC_STM32)	+= dwmac-stm32.o
drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c new file +113 -0

113 lines not on this page · raw message

Signature · 1 line
2.39.0
#13 lore raw

PATCH 6/6 ARM: dts: r9a06g032: describe GMAC1

In reply to Clément Léger

RZ/N1 SoC includes two MAC named GMACx that are compatible with the "snps,dwmac" driver. GMAC1 is connected directly to the MII converter port 1. Since this MII converter is represented using a PCS driver, it uses the renesas specific compatible driver which uses this PCS.

---
 arch/arm/boot/dts/r9a06g032.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/boot/dts/r9a06g032.dtsi +18 -0
index 41e19c0986ce..ba32e4429b01 100644
@@ -304,6 +304,24 @@ dma1: dma-controller@40105000 {
 			data-width = <8>;
 		};
 
+		gmac1: ethernet@44000000 {
+			compatible = "renesas,r9a06g032-gmac", "renesas,rzn1-gmac", "snps,dwmac";
+			reg = <0x44000000 0x2000>;
+			interrupt-parent = <&gic>;
+			interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
+			clock-names = "stmmaceth";
+			clocks = <&sysctrl R9A06G032_HCLK_GMAC0>;
+			snps,multicast-filter-bins = <256>;
+			snps,perfect-filter-entries = <128>;
+			tx-fifo-depth = <2048>;
+			rx-fifo-depth = <4096>;
+			pcs-handle = <&mii_conv1>;
+			status = "disabled";
+		};
+
 		gmac2: ethernet@44002000 {
 			compatible = "renesas,r9a06g032-gmac", "renesas,rzn1-gmac", "snps,dwmac";
 			reg = <0x44002000 0x2000>;
Signature · 1 line
2.39.0