All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/6] net: stmmac: add renesas,rzn1-gmac support
@ 2023-02-09 15:16 ` Clément Léger
  0 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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.

---
V3:
 - Sort out the bindings compatible

V2:
 - Remove patch that moves phylink_start() earlier in init
 - Add miic_early_qsetup()  which allows initializing some miic port
   earlier to provide a RX clock to stmmac IP
 - Call miic_early_setup() in rzn1 stmmac driver
 - Fix bindings

Clément Léger (6):
  net: pcs: rzn1-miic: add pcs_early_setup() function
  net: stmmac: add support to use a generic phylink_pcs as PCS
  net: stmmac: add support to provide pcs from platform data
  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       |  67 ++++++++++
 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  | 120 ++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |   8 +-
 .../net/ethernet/stmicro/stmmac/stmmac_mdio.c |   1 +
 drivers/net/pcs/pcs-rzn1-miic.c               |  12 ++
 include/linux/pcs-rzn1-miic.h                 |   3 +
 include/linux/stmmac.h                        |   1 +
 11 files changed, 240 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c

-- 
2.39.0


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

* [PATCH net-next v3 0/6] net: stmmac: add renesas,rzn1-gmac support
@ 2023-02-09 15:16 ` Clément Léger
  0 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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.

---
V3:
 - Sort out the bindings compatible

V2:
 - Remove patch that moves phylink_start() earlier in init
 - Add miic_early_qsetup()  which allows initializing some miic port
   earlier to provide a RX clock to stmmac IP
 - Call miic_early_setup() in rzn1 stmmac driver
 - Fix bindings

Clément Léger (6):
  net: pcs: rzn1-miic: add pcs_early_setup() function
  net: stmmac: add support to use a generic phylink_pcs as PCS
  net: stmmac: add support to provide pcs from platform data
  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       |  67 ++++++++++
 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  | 120 ++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |   8 +-
 .../net/ethernet/stmicro/stmmac/stmmac_mdio.c |   1 +
 drivers/net/pcs/pcs-rzn1-miic.c               |  12 ++
 include/linux/pcs-rzn1-miic.h                 |   3 +
 include/linux/stmmac.h                        |   1 +
 11 files changed, 240 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c

-- 
2.39.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 1/6] net: pcs: rzn1-miic: add pcs_early_setup() function
  2023-02-09 15:16 ` Clément Léger
@ 2023-02-09 15:16   ` Clément Léger
  -1 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

When using this PCS with the stmmac IP, if the pcs is not configured and
enabled before setting up stmmac hardware, driver setup will fail due to
the lack of input RGMII RX clock. Add pcs_early_setup() function which
allows to configure the MIIC converter based on the "phy-mode" that is
described in the device-tree.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 drivers/net/pcs/pcs-rzn1-miic.c | 12 ++++++++++++
 include/linux/pcs-rzn1-miic.h   |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
index c1424119e821..e2eaf789c4d2 100644
--- a/drivers/net/pcs/pcs-rzn1-miic.c
+++ b/drivers/net/pcs/pcs-rzn1-miic.c
@@ -288,6 +288,18 @@ static const struct phylink_pcs_ops miic_phylink_ops = {
 	.pcs_link_up = miic_link_up,
 };
 
+int miic_early_setup(struct phylink_pcs *pcs, struct device *dev)
+{
+	int interface;
+
+	interface = device_get_phy_mode(dev);
+	if (interface < 0)
+		return interface;
+
+	return miic_config(pcs, 0, interface, NULL, false);
+}
+EXPORT_SYMBOL(miic_early_setup);
+
 struct phylink_pcs *miic_create(struct device *dev, struct device_node *np)
 {
 	struct platform_device *pdev;
diff --git a/include/linux/pcs-rzn1-miic.h b/include/linux/pcs-rzn1-miic.h
index 56d12b21365d..84d7130b4b78 100644
--- a/include/linux/pcs-rzn1-miic.h
+++ b/include/linux/pcs-rzn1-miic.h
@@ -9,8 +9,11 @@
 #define __LINUX_PCS_MIIC_H
 
 struct phylink;
+struct phylink_pcs;
 struct device_node;
 
+int miic_early_setup(struct phylink_pcs *pcs, struct device *dev);
+
 struct phylink_pcs *miic_create(struct device *dev, struct device_node *np);
 
 void miic_destroy(struct phylink_pcs *pcs);
-- 
2.39.0


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

* [PATCH net-next v3 1/6] net: pcs: rzn1-miic: add pcs_early_setup() function
@ 2023-02-09 15:16   ` Clément Léger
  0 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

When using this PCS with the stmmac IP, if the pcs is not configured and
enabled before setting up stmmac hardware, driver setup will fail due to
the lack of input RGMII RX clock. Add pcs_early_setup() function which
allows to configure the MIIC converter based on the "phy-mode" that is
described in the device-tree.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 drivers/net/pcs/pcs-rzn1-miic.c | 12 ++++++++++++
 include/linux/pcs-rzn1-miic.h   |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
index c1424119e821..e2eaf789c4d2 100644
--- a/drivers/net/pcs/pcs-rzn1-miic.c
+++ b/drivers/net/pcs/pcs-rzn1-miic.c
@@ -288,6 +288,18 @@ static const struct phylink_pcs_ops miic_phylink_ops = {
 	.pcs_link_up = miic_link_up,
 };
 
+int miic_early_setup(struct phylink_pcs *pcs, struct device *dev)
+{
+	int interface;
+
+	interface = device_get_phy_mode(dev);
+	if (interface < 0)
+		return interface;
+
+	return miic_config(pcs, 0, interface, NULL, false);
+}
+EXPORT_SYMBOL(miic_early_setup);
+
 struct phylink_pcs *miic_create(struct device *dev, struct device_node *np)
 {
 	struct platform_device *pdev;
diff --git a/include/linux/pcs-rzn1-miic.h b/include/linux/pcs-rzn1-miic.h
index 56d12b21365d..84d7130b4b78 100644
--- a/include/linux/pcs-rzn1-miic.h
+++ b/include/linux/pcs-rzn1-miic.h
@@ -9,8 +9,11 @@
 #define __LINUX_PCS_MIIC_H
 
 struct phylink;
+struct phylink_pcs;
 struct device_node;
 
+int miic_early_setup(struct phylink_pcs *pcs, struct device *dev);
+
 struct phylink_pcs *miic_create(struct device *dev, struct device_node *np);
 
 void miic_destroy(struct phylink_pcs *pcs);
-- 
2.39.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 2/6] net: stmmac: add support to use a generic phylink_pcs as PCS
  2023-02-09 15:16 ` Clément Léger
@ 2023-02-09 15:16   ` Clément Léger
  -1 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 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(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 6b5d96bced47..79fd67e8ab90 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -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 */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f44e4e4b4f16..9a8721227b17 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 21aaa2730ac8..68deda5c5fa9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -513,6 +513,7 @@ int stmmac_xpcs_setup(struct mii_bus *bus)
 		}
 
 		priv->hw->xpcs = xpcs;
+		priv->hw->phylink_pcs = &xpcs->pcs;
 		break;
 	}
 
-- 
2.39.0


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

* [PATCH net-next v3 2/6] net: stmmac: add support to use a generic phylink_pcs as PCS
@ 2023-02-09 15:16   ` Clément Léger
  0 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 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(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 6b5d96bced47..79fd67e8ab90 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -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 */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f44e4e4b4f16..9a8721227b17 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 21aaa2730ac8..68deda5c5fa9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -513,6 +513,7 @@ int stmmac_xpcs_setup(struct mii_bus *bus)
 		}
 
 		priv->hw->xpcs = xpcs;
+		priv->hw->phylink_pcs = &xpcs->pcs;
 		break;
 	}
 
-- 
2.39.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 3/6] net: stmmac: add support to provide pcs from platform data
  2023-02-09 15:16 ` Clément Léger
@ 2023-02-09 15:16   ` Clément Léger
  -1 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
 include/linux/stmmac.h                            | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 9a8721227b17..8bf5f73eb4c8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7295,6 +7295,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);
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index a152678b82b7..104b3d1101c0 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -273,5 +273,6 @@ struct plat_stmmacenet_data {
 	bool use_phy_wol;
 	bool sph_disable;
 	bool serdes_up_after_phy_linkup;
+	struct phylink_pcs *pcs;
 };
 #endif
-- 
2.39.0


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

* [PATCH net-next v3 3/6] net: stmmac: add support to provide pcs from platform data
@ 2023-02-09 15:16   ` Clément Léger
  0 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
 include/linux/stmmac.h                            | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 9a8721227b17..8bf5f73eb4c8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7295,6 +7295,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);
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index a152678b82b7..104b3d1101c0 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -273,5 +273,6 @@ struct plat_stmmacenet_data {
 	bool use_phy_wol;
 	bool sph_disable;
 	bool serdes_up_after_phy_linkup;
+	struct phylink_pcs *pcs;
 };
 #endif
-- 
2.39.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support
  2023-02-09 15:16 ` Clément Léger
@ 2023-02-09 15:16   ` Clément Léger
  -1 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 .../bindings/net/renesas,rzn1-gmac.yaml       | 67 +++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml

diff --git a/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
new file mode 100644
index 000000000000..029ce758a29c
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
@@ -0,0 +1,67 @@
+# 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 GMAC
+
+maintainers:
+  - Clément Léger <clement.leger@bootlin.com>
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - renesas,r9a06g032-gmac
+          - renesas,rzn1-gmac
+  required:
+    - compatible
+
+allOf:
+  - $ref: snps,dwmac.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,r9a06g032-gmac
+      - const: renesas,rzn1-gmac
+      - const: 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,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>;
+      phy-mode = "mii";
+    };
+
+...
-- 
2.39.0


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

* [PATCH net-next v3 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support
@ 2023-02-09 15:16   ` Clément Léger
  0 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 .../bindings/net/renesas,rzn1-gmac.yaml       | 67 +++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml

diff --git a/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
new file mode 100644
index 000000000000..029ce758a29c
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
@@ -0,0 +1,67 @@
+# 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 GMAC
+
+maintainers:
+  - Clément Léger <clement.leger@bootlin.com>
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - renesas,r9a06g032-gmac
+          - renesas,rzn1-gmac
+  required:
+    - compatible
+
+allOf:
+  - $ref: snps,dwmac.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,r9a06g032-gmac
+      - const: renesas,rzn1-gmac
+      - const: 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,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>;
+      phy-mode = "mii";
+    };
+
+...
-- 
2.39.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 5/6] net: stmmac: add support for RZ/N1 GMAC
  2023-02-09 15:16 ` Clément Léger
@ 2023-02-09 15:16   ` Clément Léger
  -1 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 ++
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../net/ethernet/stmicro/stmmac/dwmac-rzn1.c  | 120 ++++++++++++++++++
 3 files changed, 132 insertions(+)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index f77511fe4e87..be5429b7e192 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -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
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 057e4bab5c08..53a0f74c1cb5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -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
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
new file mode 100644
index 000000000000..82118d8cb50e
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
@@ -0,0 +1,120 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2022 Schneider-Electric
+ *
+ * Clément Léger <clement.leger@bootlin.com>
+ */
+
+#include <linux/of.h>
+#include <linux/pcs-rzn1-miic.h>
+#include <linux/phylink.h>
+#include <linux/platform_device.h>
+
+#include "stmmac_platform.h"
+#include "stmmac.h"
+
+struct rzn1_dwmac {
+	struct phylink_pcs *pcs;
+};
+
+static int rzn1_dt_parse(struct device *dev, struct rzn1_dwmac *dwmac)
+{
+	struct device_node *np = dev->of_node;
+	struct device_node *pcs_node;
+	struct phylink_pcs *pcs;
+	int ret;
+
+	pcs_node = of_parse_phandle(np, "pcs-handle", 0);
+	if (!pcs_node)
+		return 0;
+
+	pcs = miic_create(dev, pcs_node);
+	if (IS_ERR(pcs))
+		return PTR_ERR(pcs);
+
+	ret = miic_early_setup(pcs, dev);
+	if (ret) {
+		miic_destroy(pcs);
+		return ret;
+	}
+
+	dwmac->pcs = pcs;
+
+	return 0;
+}
+
+static int rzn1_dwmac_probe(struct platform_device *pdev)
+{
+	struct plat_stmmacenet_data *plat_dat;
+	struct stmmac_resources stmmac_res;
+	struct device *dev = &pdev->dev;
+	struct rzn1_dwmac *dwmac;
+	int ret;
+
+	ret = stmmac_get_platform_resources(pdev, &stmmac_res);
+	if (ret)
+		return ret;
+
+	plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac);
+	if (IS_ERR(plat_dat))
+		return PTR_ERR(plat_dat);
+
+	dwmac = devm_kzalloc(dev, sizeof(*dwmac), GFP_KERNEL);
+	if (!dwmac) {
+		ret = -ENOMEM;
+		goto err_remove_config_dt;
+	}
+
+	ret = rzn1_dt_parse(dev, dwmac);
+	if (ret)
+		goto err_remove_config_dt;
+
+	plat_dat->bsp_priv = dwmac;
+	plat_dat->pcs = dwmac->pcs;
+
+	ret = stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
+	if (ret)
+		goto err_free_pcs;
+
+	return 0;
+
+err_free_pcs:
+	if (dwmac->pcs)
+		miic_destroy(dwmac->pcs);
+
+err_remove_config_dt:
+	stmmac_remove_config_dt(pdev, plat_dat);
+
+	return ret;
+}
+
+static int rzn1_dwmac_remove(struct platform_device *pdev)
+{
+	struct rzn1_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);
+	int ret = stmmac_dvr_remove(&pdev->dev);
+
+	if (dwmac->pcs)
+		miic_destroy(dwmac->pcs);
+
+	return ret;
+}
+
+static const struct of_device_id rzn1_dwmac_match[] = {
+	{ .compatible = "renesas,rzn1-gmac" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, rzn1_dwmac_match);
+
+static struct platform_driver rzn1_dwmac_driver = {
+	.probe  = rzn1_dwmac_probe,
+	.remove = rzn1_dwmac_remove,
+	.driver = {
+		.name           = "rzn1-dwmac",
+		.of_match_table = rzn1_dwmac_match,
+	},
+};
+module_platform_driver(rzn1_dwmac_driver);
+
+MODULE_AUTHOR("Clément Léger <clement.leger@bootlin.com>");
+MODULE_DESCRIPTION("Renesas RZN1 DWMAC specific glue layer");
+MODULE_LICENSE("GPL");
-- 
2.39.0


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

* [PATCH net-next v3 5/6] net: stmmac: add support for RZ/N1 GMAC
@ 2023-02-09 15:16   ` Clément Léger
  0 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 ++
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../net/ethernet/stmicro/stmmac/dwmac-rzn1.c  | 120 ++++++++++++++++++
 3 files changed, 132 insertions(+)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index f77511fe4e87..be5429b7e192 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -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
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 057e4bab5c08..53a0f74c1cb5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -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
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
new file mode 100644
index 000000000000..82118d8cb50e
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
@@ -0,0 +1,120 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2022 Schneider-Electric
+ *
+ * Clément Léger <clement.leger@bootlin.com>
+ */
+
+#include <linux/of.h>
+#include <linux/pcs-rzn1-miic.h>
+#include <linux/phylink.h>
+#include <linux/platform_device.h>
+
+#include "stmmac_platform.h"
+#include "stmmac.h"
+
+struct rzn1_dwmac {
+	struct phylink_pcs *pcs;
+};
+
+static int rzn1_dt_parse(struct device *dev, struct rzn1_dwmac *dwmac)
+{
+	struct device_node *np = dev->of_node;
+	struct device_node *pcs_node;
+	struct phylink_pcs *pcs;
+	int ret;
+
+	pcs_node = of_parse_phandle(np, "pcs-handle", 0);
+	if (!pcs_node)
+		return 0;
+
+	pcs = miic_create(dev, pcs_node);
+	if (IS_ERR(pcs))
+		return PTR_ERR(pcs);
+
+	ret = miic_early_setup(pcs, dev);
+	if (ret) {
+		miic_destroy(pcs);
+		return ret;
+	}
+
+	dwmac->pcs = pcs;
+
+	return 0;
+}
+
+static int rzn1_dwmac_probe(struct platform_device *pdev)
+{
+	struct plat_stmmacenet_data *plat_dat;
+	struct stmmac_resources stmmac_res;
+	struct device *dev = &pdev->dev;
+	struct rzn1_dwmac *dwmac;
+	int ret;
+
+	ret = stmmac_get_platform_resources(pdev, &stmmac_res);
+	if (ret)
+		return ret;
+
+	plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac);
+	if (IS_ERR(plat_dat))
+		return PTR_ERR(plat_dat);
+
+	dwmac = devm_kzalloc(dev, sizeof(*dwmac), GFP_KERNEL);
+	if (!dwmac) {
+		ret = -ENOMEM;
+		goto err_remove_config_dt;
+	}
+
+	ret = rzn1_dt_parse(dev, dwmac);
+	if (ret)
+		goto err_remove_config_dt;
+
+	plat_dat->bsp_priv = dwmac;
+	plat_dat->pcs = dwmac->pcs;
+
+	ret = stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
+	if (ret)
+		goto err_free_pcs;
+
+	return 0;
+
+err_free_pcs:
+	if (dwmac->pcs)
+		miic_destroy(dwmac->pcs);
+
+err_remove_config_dt:
+	stmmac_remove_config_dt(pdev, plat_dat);
+
+	return ret;
+}
+
+static int rzn1_dwmac_remove(struct platform_device *pdev)
+{
+	struct rzn1_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);
+	int ret = stmmac_dvr_remove(&pdev->dev);
+
+	if (dwmac->pcs)
+		miic_destroy(dwmac->pcs);
+
+	return ret;
+}
+
+static const struct of_device_id rzn1_dwmac_match[] = {
+	{ .compatible = "renesas,rzn1-gmac" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, rzn1_dwmac_match);
+
+static struct platform_driver rzn1_dwmac_driver = {
+	.probe  = rzn1_dwmac_probe,
+	.remove = rzn1_dwmac_remove,
+	.driver = {
+		.name           = "rzn1-dwmac",
+		.of_match_table = rzn1_dwmac_match,
+	},
+};
+module_platform_driver(rzn1_dwmac_driver);
+
+MODULE_AUTHOR("Clément Léger <clement.leger@bootlin.com>");
+MODULE_DESCRIPTION("Renesas RZN1 DWMAC specific glue layer");
+MODULE_LICENSE("GPL");
-- 
2.39.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH net-next v3 6/6] ARM: dts: r9a06g032: describe GMAC1
  2023-02-09 15:16 ` Clément Léger
@ 2023-02-09 15:16   ` Clément Léger
  -1 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 arch/arm/boot/dts/r9a06g032.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/r9a06g032.dtsi b/arch/arm/boot/dts/r9a06g032.dtsi
index 41e19c0986ce..ba32e4429b01 100644
--- a/arch/arm/boot/dts/r9a06g032.dtsi
+++ b/arch/arm/boot/dts/r9a06g032.dtsi
@@ -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>;
-- 
2.39.0


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

* [PATCH net-next v3 6/6] ARM: dts: r9a06g032: describe GMAC1
@ 2023-02-09 15:16   ` Clément Léger
  0 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-09 15:16 UTC (permalink / raw)
  To: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Clément Léger, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

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.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 arch/arm/boot/dts/r9a06g032.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/r9a06g032.dtsi b/arch/arm/boot/dts/r9a06g032.dtsi
index 41e19c0986ce..ba32e4429b01 100644
--- a/arch/arm/boot/dts/r9a06g032.dtsi
+++ b/arch/arm/boot/dts/r9a06g032.dtsi
@@ -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>;
-- 
2.39.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next v3 5/6] net: stmmac: add support for RZ/N1 GMAC
  2023-02-09 15:16   ` Clément Léger
@ 2023-02-10 11:09     ` Russell King (Oracle)
  -1 siblings, 0 replies; 24+ messages in thread
From: Russell King (Oracle) @ 2023-02-10 11:09 UTC (permalink / raw)
  To: Clément Léger
  Cc: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Wong Vee Khee,
	Kurt Kanzenbach, Revanth Kumar Uppala, Tan Tee Min,
	Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

On Thu, Feb 09, 2023 at 04:16:31PM +0100, Clément Léger wrote:
> +struct rzn1_dwmac {
> +	struct phylink_pcs *pcs;
> +};

Please see my comments on your previous patch series as to why I don't
think you need this structure nor its associated memory allocations.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

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

* Re: [PATCH net-next v3 5/6] net: stmmac: add support for RZ/N1 GMAC
@ 2023-02-10 11:09     ` Russell King (Oracle)
  0 siblings, 0 replies; 24+ messages in thread
From: Russell King (Oracle) @ 2023-02-10 11:09 UTC (permalink / raw)
  To: Clément Léger
  Cc: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Wong Vee Khee,
	Kurt Kanzenbach, Revanth Kumar Uppala, Tan Tee Min,
	Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

On Thu, Feb 09, 2023 at 04:16:31PM +0100, Clément Léger wrote:
> +struct rzn1_dwmac {
> +	struct phylink_pcs *pcs;
> +};

Please see my comments on your previous patch series as to why I don't
think you need this structure nor its associated memory allocations.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next v3 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support
  2023-02-09 15:16   ` Clément Léger
@ 2023-02-10 12:01     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2023-02-10 12:01 UTC (permalink / raw)
  To: Clément Léger, Sergey Shtylyov, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Geert Uytterhoeven, Magnus Damm,
	Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	Maxime Coquelin, Russell King, Wong Vee Khee, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

On 09/02/2023 16:16, Clément Léger wrote:
> Add "renesas,rzn1-gmac" binding documentation which is compatible with
> "snps,dwmac" compatible driver but uses a custom PCS to communicate
> with the phy.
> 
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> ---
>  .../bindings/net/renesas,rzn1-gmac.yaml       | 67 +++++++++++++++++++
>  1 file changed, 67 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> new file mode 100644
> index 000000000000..029ce758a29c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> @@ -0,0 +1,67 @@
> +# 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 GMAC
> +
> +maintainers:
> +  - Clément Léger <clement.leger@bootlin.com>
> +
> +select:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - renesas,r9a06g032-gmac
> +          - renesas,rzn1-gmac
> +  required:
> +    - compatible
> +
> +allOf:
> +  - $ref: snps,dwmac.yaml#
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - renesas,r9a06g032-gmac
> +      - const: renesas,rzn1-gmac
> +      - const: snps,dwmac

Thanks, looks good now.

> +
> +  pcs-handle:
> +    description:
> +      phandle pointing to a PCS sub-node compatible with
> +      renesas,rzn1-miic.yaml#
> +    $ref: /schemas/types.yaml#/definitions/phandle

you do not need ref here - it is coming from ethernet-controller.yaml
via snps,dwmac.yaml. You actually could drop entire property, but it can
also stay for the description.

> +
> +required:
> +  - compatible
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/r9a06g032-sysctrl.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    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>,

Please align with previous <


Best regards,
Krzysztof


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

* Re: [PATCH net-next v3 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support
@ 2023-02-10 12:01     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2023-02-10 12:01 UTC (permalink / raw)
  To: Clément Léger, Sergey Shtylyov, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Geert Uytterhoeven, Magnus Damm,
	Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	Maxime Coquelin, Russell King, Wong Vee Khee, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min
  Cc: Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

On 09/02/2023 16:16, Clément Léger wrote:
> Add "renesas,rzn1-gmac" binding documentation which is compatible with
> "snps,dwmac" compatible driver but uses a custom PCS to communicate
> with the phy.
> 
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> ---
>  .../bindings/net/renesas,rzn1-gmac.yaml       | 67 +++++++++++++++++++
>  1 file changed, 67 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> new file mode 100644
> index 000000000000..029ce758a29c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> @@ -0,0 +1,67 @@
> +# 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 GMAC
> +
> +maintainers:
> +  - Clément Léger <clement.leger@bootlin.com>
> +
> +select:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - renesas,r9a06g032-gmac
> +          - renesas,rzn1-gmac
> +  required:
> +    - compatible
> +
> +allOf:
> +  - $ref: snps,dwmac.yaml#
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - renesas,r9a06g032-gmac
> +      - const: renesas,rzn1-gmac
> +      - const: snps,dwmac

Thanks, looks good now.

> +
> +  pcs-handle:
> +    description:
> +      phandle pointing to a PCS sub-node compatible with
> +      renesas,rzn1-miic.yaml#
> +    $ref: /schemas/types.yaml#/definitions/phandle

you do not need ref here - it is coming from ethernet-controller.yaml
via snps,dwmac.yaml. You actually could drop entire property, but it can
also stay for the description.

> +
> +required:
> +  - compatible
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/r9a06g032-sysctrl.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    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>,

Please align with previous <


Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next v3 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support
  2023-02-10 12:01     ` Krzysztof Kozlowski
@ 2023-02-10 12:29       ` Clément Léger
  -1 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-10 12:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Kurt Kanzenbach, Revanth Kumar Uppala,
	Tan Tee Min, Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

Le Fri, 10 Feb 2023 13:01:01 +0100,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> a écrit :

> On 09/02/2023 16:16, Clément Léger wrote:
> > Add "renesas,rzn1-gmac" binding documentation which is compatible with
> > "snps,dwmac" compatible driver but uses a custom PCS to communicate
> > with the phy.
> > 
> > Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> > ---
> >  .../bindings/net/renesas,rzn1-gmac.yaml       | 67 +++++++++++++++++++
> >  1 file changed, 67 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> > new file mode 100644
> > index 000000000000..029ce758a29c
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> > @@ -0,0 +1,67 @@
> > +# 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 GMAC
> > +
> > +maintainers:
> > +  - Clément Léger <clement.leger@bootlin.com>
> > +
> > +select:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        enum:
> > +          - renesas,r9a06g032-gmac
> > +          - renesas,rzn1-gmac
> > +  required:
> > +    - compatible
> > +
> > +allOf:
> > +  - $ref: snps,dwmac.yaml#
> > +
> > +properties:
> > +  compatible:
> > +    items:
> > +      - enum:
> > +          - renesas,r9a06g032-gmac
> > +      - const: renesas,rzn1-gmac
> > +      - const: snps,dwmac  
> 
> Thanks, looks good now.
> 
> > +
> > +  pcs-handle:
> > +    description:
> > +      phandle pointing to a PCS sub-node compatible with
> > +      renesas,rzn1-miic.yaml#
> > +    $ref: /schemas/types.yaml#/definitions/phandle  
> 
> you do not need ref here - it is coming from ethernet-controller.yaml
> via snps,dwmac.yaml. You actually could drop entire property, but it can
> also stay for the description.

Ok thanks for the tip. I will drop it since there will be a v4.

> 
> > +
> > +required:
> > +  - compatible
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/clock/r9a06g032-sysctrl.h>
> > +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +
> > +    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>,  
> 
> Please align with previous <
> 
> 
> Best regards,
> Krzysztof
> 



-- 
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

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

* Re: [PATCH net-next v3 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support
@ 2023-02-10 12:29       ` Clément Léger
  0 siblings, 0 replies; 24+ messages in thread
From: Clément Léger @ 2023-02-10 12:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Kurt Kanzenbach, Revanth Kumar Uppala,
	Tan Tee Min, Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

Le Fri, 10 Feb 2023 13:01:01 +0100,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> a écrit :

> On 09/02/2023 16:16, Clément Léger wrote:
> > Add "renesas,rzn1-gmac" binding documentation which is compatible with
> > "snps,dwmac" compatible driver but uses a custom PCS to communicate
> > with the phy.
> > 
> > Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> > ---
> >  .../bindings/net/renesas,rzn1-gmac.yaml       | 67 +++++++++++++++++++
> >  1 file changed, 67 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> > new file mode 100644
> > index 000000000000..029ce758a29c
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml
> > @@ -0,0 +1,67 @@
> > +# 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 GMAC
> > +
> > +maintainers:
> > +  - Clément Léger <clement.leger@bootlin.com>
> > +
> > +select:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        enum:
> > +          - renesas,r9a06g032-gmac
> > +          - renesas,rzn1-gmac
> > +  required:
> > +    - compatible
> > +
> > +allOf:
> > +  - $ref: snps,dwmac.yaml#
> > +
> > +properties:
> > +  compatible:
> > +    items:
> > +      - enum:
> > +          - renesas,r9a06g032-gmac
> > +      - const: renesas,rzn1-gmac
> > +      - const: snps,dwmac  
> 
> Thanks, looks good now.
> 
> > +
> > +  pcs-handle:
> > +    description:
> > +      phandle pointing to a PCS sub-node compatible with
> > +      renesas,rzn1-miic.yaml#
> > +    $ref: /schemas/types.yaml#/definitions/phandle  
> 
> you do not need ref here - it is coming from ethernet-controller.yaml
> via snps,dwmac.yaml. You actually could drop entire property, but it can
> also stay for the description.

Ok thanks for the tip. I will drop it since there will be a v4.

> 
> > +
> > +required:
> > +  - compatible
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/clock/r9a06g032-sysctrl.h>
> > +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +
> > +    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>,  
> 
> Please align with previous <
> 
> 
> Best regards,
> Krzysztof
> 



-- 
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next v3 6/6] ARM: dts: r9a06g032: describe GMAC1
  2023-02-09 15:16   ` Clément Léger
@ 2023-02-14 13:17     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 24+ messages in thread
From: Geert Uytterhoeven @ 2023-02-14 13:17 UTC (permalink / raw)
  To: Clément Léger
  Cc: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Magnus Damm,
	Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	Maxime Coquelin, Russell King, Wong Vee Khee, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min, Thomas Petazzoni,
	Herve Codina, Miquèl Raynal, Milan Stevanovic,
	Jimmy Lalande, Pascal Eberhard, Mohammad Athari Bin Ismail,
	Jon Hunter, netdev, linux-renesas-soc, devicetree, linux-kernel,
	linux-stm32, linux-arm-kernel

Hi Clément,

On Thu, Feb 9, 2023 at 4:14 PM Clément Léger <clement.leger@bootlin.com> wrote:
> 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.
>
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>

Thanks for your patch!

> --- a/arch/arm/boot/dts/r9a06g032.dtsi
> +++ b/arch/arm/boot/dts/r9a06g032.dtsi
> @@ -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";

Please move clock-names below clocks, like in all other nodes.

> +                       clocks = <&sysctrl R9A06G032_HCLK_GMAC0>;

Missing power-domains property.

> +                       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>;

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next v3 6/6] ARM: dts: r9a06g032: describe GMAC1
@ 2023-02-14 13:17     ` Geert Uytterhoeven
  0 siblings, 0 replies; 24+ messages in thread
From: Geert Uytterhoeven @ 2023-02-14 13:17 UTC (permalink / raw)
  To: Clément Léger
  Cc: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Magnus Damm,
	Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	Maxime Coquelin, Russell King, Wong Vee Khee, Kurt Kanzenbach,
	Revanth Kumar Uppala, Tan Tee Min, Thomas Petazzoni,
	Herve Codina, Miquèl Raynal, Milan Stevanovic,
	Jimmy Lalande, Pascal Eberhard, Mohammad Athari Bin Ismail,
	Jon Hunter, netdev, linux-renesas-soc, devicetree, linux-kernel,
	linux-stm32, linux-arm-kernel

Hi Clément,

On Thu, Feb 9, 2023 at 4:14 PM Clément Léger <clement.leger@bootlin.com> wrote:
> 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.
>
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>

Thanks for your patch!

> --- a/arch/arm/boot/dts/r9a06g032.dtsi
> +++ b/arch/arm/boot/dts/r9a06g032.dtsi
> @@ -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";

Please move clock-names below clocks, like in all other nodes.

> +                       clocks = <&sysctrl R9A06G032_HCLK_GMAC0>;

Missing power-domains property.

> +                       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>;

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] 24+ messages in thread

* Re: [PATCH net-next v3 5/6] net: stmmac: add support for RZ/N1 GMAC
  2023-02-09 15:16   ` Clément Léger
@ 2023-02-21 14:45     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 24+ messages in thread
From: Geert Uytterhoeven @ 2023-02-21 14:45 UTC (permalink / raw)
  To: Clément Léger
  Cc: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Kurt Kanzenbach, Revanth Kumar Uppala,
	Tan Tee Min, Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

Hi Clément,

On Thu, Feb 9, 2023 at 4:14 PM Clément Léger <clement.leger@bootlin.com> wrote:
> 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.
>
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>

Thanks for your patch!

> --- /dev/null
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c

> +static int rzn1_dwmac_remove(struct platform_device *pdev)
> +{
> +       struct rzn1_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);
> +       int ret = stmmac_dvr_remove(&pdev->dev);

This needs an update for commit ff0011cf56014b4d ("net: stmmac: Make
stmmac_dvr_remove() return void") in net-next/master.

> +
> +       if (dwmac->pcs)
> +               miic_destroy(dwmac->pcs);
> +
> +       return ret;
> +}

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next v3 5/6] net: stmmac: add support for RZ/N1 GMAC
@ 2023-02-21 14:45     ` Geert Uytterhoeven
  0 siblings, 0 replies; 24+ messages in thread
From: Geert Uytterhoeven @ 2023-02-21 14:45 UTC (permalink / raw)
  To: Clément Léger
  Cc: Sergey Shtylyov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Geert Uytterhoeven, Magnus Damm, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Russell King,
	Wong Vee Khee, Kurt Kanzenbach, Revanth Kumar Uppala,
	Tan Tee Min, Thomas Petazzoni, Herve Codina, Miquèl Raynal,
	Milan Stevanovic, Jimmy Lalande, Pascal Eberhard,
	Mohammad Athari Bin Ismail, Jon Hunter, netdev,
	linux-renesas-soc, devicetree, linux-kernel, linux-stm32,
	linux-arm-kernel

Hi Clément,

On Thu, Feb 9, 2023 at 4:14 PM Clément Léger <clement.leger@bootlin.com> wrote:
> 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.
>
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>

Thanks for your patch!

> --- /dev/null
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c

> +static int rzn1_dwmac_remove(struct platform_device *pdev)
> +{
> +       struct rzn1_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);
> +       int ret = stmmac_dvr_remove(&pdev->dev);

This needs an update for commit ff0011cf56014b4d ("net: stmmac: Make
stmmac_dvr_remove() return void") in net-next/master.

> +
> +       if (dwmac->pcs)
> +               miic_destroy(dwmac->pcs);
> +
> +       return ret;
> +}

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] 24+ messages in thread

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

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 15:16 [PATCH net-next v3 0/6] net: stmmac: add renesas,rzn1-gmac support Clément Léger
2023-02-09 15:16 ` Clément Léger
2023-02-09 15:16 ` [PATCH net-next v3 1/6] net: pcs: rzn1-miic: add pcs_early_setup() function Clément Léger
2023-02-09 15:16   ` Clément Léger
2023-02-09 15:16 ` [PATCH net-next v3 2/6] net: stmmac: add support to use a generic phylink_pcs as PCS Clément Léger
2023-02-09 15:16   ` Clément Léger
2023-02-09 15:16 ` [PATCH net-next v3 3/6] net: stmmac: add support to provide pcs from platform data Clément Léger
2023-02-09 15:16   ` Clément Léger
2023-02-09 15:16 ` [PATCH net-next v3 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support Clément Léger
2023-02-09 15:16   ` Clément Léger
2023-02-10 12:01   ` Krzysztof Kozlowski
2023-02-10 12:01     ` Krzysztof Kozlowski
2023-02-10 12:29     ` Clément Léger
2023-02-10 12:29       ` Clément Léger
2023-02-09 15:16 ` [PATCH net-next v3 5/6] net: stmmac: add support for RZ/N1 GMAC Clément Léger
2023-02-09 15:16   ` Clément Léger
2023-02-10 11:09   ` Russell King (Oracle)
2023-02-10 11:09     ` Russell King (Oracle)
2023-02-21 14:45   ` Geert Uytterhoeven
2023-02-21 14:45     ` Geert Uytterhoeven
2023-02-09 15:16 ` [PATCH net-next v3 6/6] ARM: dts: r9a06g032: describe GMAC1 Clément Léger
2023-02-09 15:16   ` Clément Léger
2023-02-14 13:17   ` Geert Uytterhoeven
2023-02-14 13:17     ` Geert Uytterhoeven

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.