Skip to contentSkip to conversation

net: stmmac: add SL2610 ethernet support

PATCH Superseded Jisheng Zhang 3 participants 6 messages Dec 1 – Dec 2

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover net: stmmac: add SL2610 ethernet support

This series add Synaptics SL2610 ethernet support.

since v2:
- remove sl2610 clk IDs, reset IDs dependency from dt-binding's example
- add mdio owner validation per Andrew suggestion

since v1:
- switch to one MDIO bus solution instead of MDIO demultiplexer
- remove patches to add eth nodes to dtsi and enable eth for rdk. They will be sent separately
- add constraints for interrupts, clocks, resets and so on
- update dt-bindings example
- use .set_phy_intf_sel()
- use PHY_INTF_SEL_RGMII and PHY_INTF_SEL_RMII

A consolidated MAINTAINERS update will follow once the subsystem series have merged, avoiding overlapping changes to the Synaptics entry.

Jisheng Zhang (2):
dt-bindings: net: Add Synaptics SL2610 DWMAC
net: stmmac: Add glue layer for Synaptics SL2610 SoC

 .../devicetree/bindings/net/snps,dwmac.yaml   |   1 +
 .../bindings/net/syna,sl2610-dwmac.yaml       | 124 ++++++++++++
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 ++
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../net/ethernet/stmicro/stmmac/dwmac-syna.c  | 183 ++++++++++++++++++
 5 files changed, 320 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c
Signature · 1 line
2.55.0
#1 lore raw

PATCH v3 1/2 dt-bindings: net: Add Synaptics SL2610 DWMAC

Describe the Synaptics SL2610 integration of DWMAC 5.20. The PHY interface mode and the routing of the shared MDC/MDIO signals are controlled through system-controller registers.

Add the compatible to the common DWMAC schema and show a PHY connected to MAC1's MDIO bus in the example.

---
 .../devicetree/bindings/net/snps,dwmac.yaml   |   1 +
 .../bindings/net/syna,sl2610-dwmac.yaml       | 124 ++++++++++++++++++
 2 files changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml
Documentation/devicetree/bindings/net/snps,dwmac.yaml +1 -0
index 69d88a9b1925..619c389d8838 100644
@@ -120,6 +120,7 @@ properties:
         - sophgo,sg2044-dwmac
         - starfive,jh7100-dwmac
         - starfive,jh7110-dwmac
+        - syna,sl2610-dwmac
         - tesla,fsd-ethqos
         - thead,th1520-gmac
         - ultrarisc,dp1000-gmac
Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml new file +124 -0

124 lines not on this page · raw message

Signature · 1 line
2.55.0
#3 lore raw

PATCH v3 2/2 net: stmmac: Add glue layer for Synaptics SL2610 SoC

In reply to Jisheng Zhang

Add dwmac glue driver to support the DesignWare-based GMAC controllers in the Synaptics SL2610 SoC.

---
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  11 ++
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../net/ethernet/stmicro/stmmac/dwmac-syna.c  | 183 ++++++++++++++++++
 3 files changed, 195 insertions(+)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c
drivers/net/ethernet/stmicro/stmmac/Kconfig +11 -0
index c6559e749c0c..79ffebcaba0e 100644
@@ -310,6 +310,17 @@ config DWMAC_SUN55I
 	  stmmac device driver. This driver is used for A523/T527
 	  GMAC200 ethernet controller.
 
+config DWMAC_SYNA
+	tristate "Synaptics SL2610 DWMAC support"
+	depends on OF && HAS_DMA && (ARCH_BERLIN || COMPILE_TEST)
+	select MFD_SYSCON
+	help
+	  Support for the Synaptics SL2610 DesignWare Ethernet MAC glue.
+	  This configures the PHY interface through the system controller.
+
+	  To compile this driver as a module, choose M here. The module
+	  will be called dwmac-syna.
+
 config DWMAC_THEAD
 	tristate "T-HEAD dwmac support"
 	depends on OF && (ARCH_THEAD || COMPILE_TEST)
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
index b16a456b730e..d132353e9403 100644
@@ -35,6 +35,7 @@ obj-$(CONFIG_DWMAC_STM32)	+= dwmac-stm32.o
 obj-$(CONFIG_DWMAC_SUNXI)	+= dwmac-sunxi.o
 obj-$(CONFIG_DWMAC_SUN8I)	+= dwmac-sun8i.o
 obj-$(CONFIG_DWMAC_SUN55I)	+= dwmac-sun55i.o
+obj-$(CONFIG_DWMAC_SYNA)	+= dwmac-syna.o
 obj-$(CONFIG_DWMAC_THEAD)	+= dwmac-thead.o
 obj-$(CONFIG_DWMAC_ULTRARISC)	+= dwmac-ultrarisc.o
 obj-$(CONFIG_DWMAC_DWC_QOS_ETH)	+= dwmac-dwc-qos-eth.o
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +183 -0

183 lines not on this page · raw message

Signature · 1 line
2.55.0
#4 lore raw

Re: [PATCH net-next v3 2/2] net: stmmac: Add glue layer for Synaptics SL2610 SoC

drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c line 42

Quoted 3 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +3 -0
+/* Protect the list of MDIO providers, keyed by their shared syscon regmap. */
+static DEFINE_MUTEX(syna_mdio_lock);
+static LIST_HEAD(syna_mdio_owners);

A linked list seems a bit over the top. syna_dwmac_claim_mdio() could use test_and_set_bit(), which is atomic, no need for a mutex, and if the bit is already set, return EINVAL. The release method can probably use clear_bit().

Andrew

---
pw-bot: cr
Andrew

#2 lore raw

Re: [PATCH net-next v3 1/2] dt-bindings: net: Add Synaptics SL2610 DWMAC

In reply to Jisheng Zhang
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] dt-bindings: net: non-canonical property order in syna,sl2610-dwmac.yaml --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] dt-bindings: net: non-canonical property order in syna,sl2610-dwmac.yaml
--

commit 32a30e5df7dbed46d64215a1ce0df8698875a083
Author: Jisheng Zhang <[email protected]>

dt-bindings: net: Add Synaptics SL2610 DWMAC

This commit adds a Device Tree binding schema for the Synaptics SL2610 integration of the DWMAC 5.20 Ethernet controller and adds its compatible string to the common DWMAC schema.

Quoted 5 lines
Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml new file +0 -0
new file mode 100644
index 0000000000000..37f91fdfddb1e

[ ... ]

Quoted 60 lines
Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml new file +60 -0
+properties:
+  compatible:
+    items:
+      - const: syna,sl2610-dwmac
+      - const: snps,dwmac-5.20
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-names:
+    const: macirq
+
+  clocks:
+    items:
+      - description: MAC clock
+      - description: Peripheral register interface clock
+      - description: PTP reference clock
+
+  clock-names:
+    items:
+      - const: stmmaceth
+      - const: pclk
+      - const: ptp_ref
+
+  resets:
+    maxItems: 1
+
+  reset-names:
+    const: stmmaceth
+
+  power-domains:
+    maxItems: 1
+
+  syna,syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      - items:
+          - description: Phandle to the SL2610 system controller.
+          - description: Offset of the Ethernet interface control register.
+    description:
+      Phandle and register offset used to configure the Ethernet PHY
+      interface mode.
+
+  phy-mode:
+    enum:
+      - rmii
+      - rgmii
+      - rgmii-id
+      - rgmii-rxid
+      - rgmii-txid
+
+required:
+  - compatible
+  - clocks
+  - clock-names
+  - syna,syscon
+  - phy-mode

[ ... ]

Quoted 7 lines
Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml new file +7 -0
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    ethernet@f7a06000 {
+        compatible = "syna,sl2610-dwmac", "snps,dwmac-5.20";

Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml line 112

Quoted 10 lines
Documentation/devicetree/bindings/net/syna,sl2610-dwmac.yaml new file +10 -0
+        reg = <0xf7a06000 0x2000>;
+        interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-names = "macirq";
+        clocks = <&clk 13>, <&clk 45>, <&clk 15>;
+        clock-names = "stmmaceth", "pclk", "ptp_ref";
+        resets = <&rst 6>;
+        reset-names = "stmmaceth";
+        phy-mode = "rgmii-id";
+        syna,syscon = <&chip 0xa3c>;
+        phy-handle = <&phy1>;

[Severity: Low]
This isn't a bug, but the property order in properties:, required:, and the example node does not follow the standard DT binding convention. clocks and clock-names should come before interrupts and interrupt-names, and the vendor-specific syna,syscon property should be placed after standard properties such as phy-mode and phy-handle.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#5 lore raw

Re: [PATCH net-next v3 2/2] net: stmmac: Add glue layer for Synaptics SL2610 SoC

In reply to Jisheng Zhang
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] net: stmmac: wrong enum passed to phy_modes() in syna_dwmac_set_phy_intf_sel() --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] net: stmmac: wrong enum passed to phy_modes() in syna_dwmac_set_phy_intf_sel()
--

commit 14cec5d5e8a51b1c42650d9c05ead55e12105f72
Author: Jisheng Zhang <[email protected]>

net: stmmac: Add glue layer for Synaptics SL2610 SoC

This commit adds a platform glue driver for the Synopsys DesignWare GMAC controllers on the Synaptics SL2610 SoC, configuring the PHY interface mode and shared MDIO master selection via a syscon regmap.

Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +0 -0
new file mode 100644
index 0000000000000..b245c6cbed99c
@@ -0,0 +1,183 @@

[ ... ]

Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +7 -0
+static int syna_dwmac_set_phy_intf_sel(void *bsp_priv, u8 phy_intf_sel)
+{
+	struct syna_dwmac *dwmac = bsp_priv;
+	u32 phyif;
+
+	switch (phy_intf_sel) {
+	case PHY_INTF_SEL_RMII:

drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c line 91

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-syna.c new file +10 -0
+		phyif = CTL_PHY_INTF_RMII;
+		break;
+	case PHY_INTF_SEL_RGMII:
+		phyif = CTL_PHY_INTF_RGMII;
+		break;
+	default:
+		dev_err(dwmac->dev, "unsupported phy interface %s\n",
+			phy_modes(phy_intf_sel));
+		return -EINVAL;
+	}

[Severity: Low]
Does phy_modes(phy_intf_sel) log the wrong PHY mode name here?

phy_intf_sel is a DWMAC PHY_INTF_SEL_* value rather than a phy_interface_t (PHY_INTERFACE_MODE_*) enum, so phy_modes() prints an empty or mismatched interface name when an unsupported mode is selected (for instance, PHY_INTF_SEL_GMII_MII is 0, which maps to PHY_INTERFACE_MODE_NA, and PHY_INTF_SEL_SGMII is 2, which maps to "mii"). stmmac_prereset_configure() already logs the unsupported mode with phy_modes(interface) when set_phy_intf_sel() returns -EINVAL, so this dev_err() can be dropped.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2