Skip to contentSkip to conversation

net: ethernet: mvneta: add support for 2.5G DRSGMII mode

PATCH In review Sascha Hauer 3 participants 7 messages Jun 8, 2020 – Jun 9, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethernet: mvneta: add support for 2.5G DRSGMII mode

The Marvell MVNETA Ethernet controller supports a 2.5 Gbps SGMII mode called DRSGMII.

This patch adds a corresponding phy-mode string 'drsgmii' and parses it from DT. The MVNETA then configures the SERDES protocol value accordingly.

It was successfully tested on a MV78460 connected to a FPGA.

---
 .../devicetree/bindings/net/ethernet-controller.yaml       | 1 +
 drivers/net/ethernet/marvell/mvneta.c                      | 7 ++++++-
 include/linux/phy.h                                        | 3 +++
 3 files changed, 10 insertions(+), 1 deletion(-)

This patch has already been sent 3 years ago here:
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
Since then the driver has evolved a lot. 2.5Gbps is properly configured in the MAC now.

Documentation/devicetree/bindings/net/ethernet-controller.yaml +1 -0
index ac471b60ed6ae..4eead3c89bd3e 100644
@@ -66,6 +66,7 @@ properties:
       - gmii
       - sgmii
       - qsgmii
+      - drsgmii
       - tbi
       - rev-mii
       - rmii
drivers/net/ethernet/marvell/mvneta.c +6 -1
index 51889770958d8..807c698576c74 100644
@@ -109,6 +109,7 @@
 #define MVNETA_SERDES_CFG			 0x24A0
 #define      MVNETA_SGMII_SERDES_PROTO		 0x0cc7
 #define      MVNETA_QSGMII_SERDES_PROTO		 0x0667
+#define      MVNETA_DRSGMII_SERDES_PROTO	 0x1107
 #define MVNETA_TYPE_PRIO                         0x24bc
 #define      MVNETA_FORCE_UNI                    BIT(21)
 #define MVNETA_TXQ_CMD_1                         0x24e4
@@ -3734,10 +3735,11 @@ static void mvneta_validate(struct phylink_config *config,
 	struct mvneta_port *pp = netdev_priv(ndev);
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 
-	/* We only support QSGMII, SGMII, 802.3z and RGMII modes */
+	/* We only support QSGMII, SGMII, DRSGMII, 802.3z and RGMII modes */
 	if (state->interface != PHY_INTERFACE_MODE_NA &&
 	    state->interface != PHY_INTERFACE_MODE_QSGMII &&
 	    state->interface != PHY_INTERFACE_MODE_SGMII &&
+	    state->interface != PHY_INTERFACE_MODE_DRSGMII &&
 	    !phy_interface_mode_is_8023z(state->interface) &&
 	    !phy_interface_mode_is_rgmii(state->interface)) {
 		bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
@@ -3851,6 +3853,7 @@ static void mvneta_mac_config(struct phylink_config *config, unsigned int mode,
 
 	if (state->interface == PHY_INTERFACE_MODE_QSGMII ||
 	    state->interface == PHY_INTERFACE_MODE_SGMII ||
+	    state->interface == PHY_INTERFACE_MODE_DRSGMII ||
 	    phy_interface_mode_is_8023z(state->interface))
 		new_ctrl2 |= MVNETA_GMAC2_PCS_ENABLE;
 
@@ -4968,6 +4971,8 @@ static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
 	else if (phy_mode == PHY_INTERFACE_MODE_SGMII ||
 		 phy_interface_mode_is_8023z(phy_mode))
 		mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
+	else if (phy_mode == PHY_INTERFACE_MODE_DRSGMII)
+		mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_DRSGMII_SERDES_PROTO);
 	else if (!phy_interface_mode_is_rgmii(phy_mode))
 		return -EINVAL;
 
include/linux/phy.h +3 -0
index 2432ca463ddc0..bf3276b330f9e 100644
@@ -109,6 +109,7 @@ typedef enum {
 	PHY_INTERFACE_MODE_USXGMII,
 	/* 10GBASE-KR - with Clause 73 AN */
 	PHY_INTERFACE_MODE_10GKR,
+	PHY_INTERFACE_MODE_DRSGMII,
 	PHY_INTERFACE_MODE_MAX,
 } phy_interface_t;
 
@@ -190,6 +191,8 @@ static inline const char *phy_modes(phy_interface_t interface)
 		return "usxgmii";
 	case PHY_INTERFACE_MODE_10GKR:
 		return "10gbase-kr";
+	case PHY_INTERFACE_MODE_DRSGMII:
+		return "drsgmii";
 	default:
 		return "unknown";
 	}
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 8 lines · Sascha Hauer

The Marvell MVNETA Ethernet controller supports a 2.5 Gbps SGMII mode called DRSGMII.

This patch adds a corresponding phy-mode string 'drsgmii' and parses it from DT. The MVNETA then configures the SERDES protocol value accordingly.

It was successfully tested on a MV78460 connected to a FPGA.

Hi Sascha

Is this really overclocked SGMII, or 2500BaseX? How does it differ from 2500BaseX, which mvneta already supports?

Also, does comphy need extensions to support this?

Andrew

#2 lore raw
Quoted 8 lines · Andrew Lunn
Quoted 7 lines · Sascha Hauer

The Marvell MVNETA Ethernet controller supports a 2.5 Gbps SGMII mode called DRSGMII.

This patch adds a corresponding phy-mode string 'drsgmii' and parses it from DT. The MVNETA then configures the SERDES protocol value accordingly.

Quoted 6 lines
Quoted 1 line

It was successfully tested on a MV78460 connected to a FPGA.

Hi Sascha

Is this really overclocked SGMII, or 2500BaseX? How does it differ from 2500BaseX, which mvneta already supports?

I think it is overclocked SGMII or 2500BaseX depending on the Port MAC Control Register0 PortType setting bit.
As said to Russell we have a fixed link so nobody really cares if it's SGMII or 2500BaseX. This boils down the patch to fixing the Serdes configuration setting for 2500BaseX.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
maintainer
#3 lore raw
Quoted 13 lines · Sascha Hauer
Quoted 12 lines · Andrew Lunn
Quoted 8 lines · Sascha Hauer

The Marvell MVNETA Ethernet controller supports a 2.5 Gbps SGMII mode called DRSGMII.

This patch adds a corresponding phy-mode string 'drsgmii' and parses it from DT. The MVNETA then configures the SERDES protocol value accordingly.

It was successfully tested on a MV78460 connected to a FPGA.

Hi Sascha

Quoted 8 lines
Quoted 2 lines

Is this really overclocked SGMII, or 2500BaseX? How does it differ from 2500BaseX, which mvneta already supports?

I think it is overclocked SGMII or 2500BaseX depending on the Port MAC Control Register0 PortType setting bit.
As said to Russell we have a fixed link so nobody really cares if it's SGMII or 2500BaseX. This boils down the patch to fixing the Serdes configuration setting for 2500BaseX.

Hi Sascha

Does 2500BaseX work for your use case? Since this drsmgii mode is not well defined, i would prefer to not add it, unless it is really needed.

Andrew

#4 lore raw

Hi Andrew,

Quoted 23 lines · Andrew Lunn
Quoted 13 lines · Sascha Hauer
Quoted 12 lines · Andrew Lunn
Quoted 8 lines · Sascha Hauer

The Marvell MVNETA Ethernet controller supports a 2.5 Gbps SGMII mode called DRSGMII.

This patch adds a corresponding phy-mode string 'drsgmii' and parses it from DT. The MVNETA then configures the SERDES protocol value accordingly.

It was successfully tested on a MV78460 connected to a FPGA.

Hi Sascha

Quoted 8 lines
Quoted 2 lines

Is this really overclocked SGMII, or 2500BaseX? How does it differ from 2500BaseX, which mvneta already supports?

I think it is overclocked SGMII or 2500BaseX depending on the Port MAC Control Register0 PortType setting bit.
As said to Russell we have a fixed link so nobody really cares if it's SGMII or 2500BaseX. This boils down the patch to fixing the Serdes configuration setting for 2500BaseX.

Quoted 5 lines

Hi Sascha

Does 2500BaseX work for your use case? Since this drsmgii mode is not well defined, i would prefer to not add it, unless it is really needed.

Yes, it does, see updated patch I just sent.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#5 lore raw
In reply to Sascha Hauer
Quoted 8 lines · Sascha Hauer

The Marvell MVNETA Ethernet controller supports a 2.5 Gbps SGMII mode called DRSGMII.

This patch adds a corresponding phy-mode string 'drsgmii' and parses it from DT. The MVNETA then configures the SERDES protocol value accordingly.

It was successfully tested on a MV78460 connected to a FPGA.

Digging around, this is Armada XP? Which SoCs is this mode supported? There's no mention of DRSGMII in the A38x nor A37xx documentation which are later than Armada XP.

What exactly is "drsgmii"? It can't be "double-rate" SGMII because that would give you 2Gbps max instead of the 1Gbps, but this gives 2.5Gbps, so I'm really not sure using "drsgmii" is a good idea. It may be what Marvell call it, but we really need to know if there's some vendor neutral way to refer to it.

Quoted 11 lines
---
 .../devicetree/bindings/net/ethernet-controller.yaml       | 1 +
 drivers/net/ethernet/marvell/mvneta.c                      | 7 ++++++-
 include/linux/phy.h                                        | 3 +++
 3 files changed, 10 insertions(+), 1 deletion(-)

This patch has already been sent 3 years ago here:
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
Since then the driver has evolved a lot. 2.5Gbps is properly configured in the MAC now.

Nevertheless, adding a new interface mode needs properly documenting to describe exactly what it is - see Documentation/networking/phy.rst, the section "PHY interface modes". The above point about "what is this" illustrates why we need these documented.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up
#6 lore raw
Quoted 8 lines · Russell King - ARM Linux admin
Quoted 7 lines · Sascha Hauer

The Marvell MVNETA Ethernet controller supports a 2.5 Gbps SGMII mode called DRSGMII.

This patch adds a corresponding phy-mode string 'drsgmii' and parses it from DT. The MVNETA then configures the SERDES protocol value accordingly.

Quoted 5 lines
Quoted 1 line

It was successfully tested on a MV78460 connected to a FPGA.

Digging around, this is Armada XP? Which SoCs is this mode supported? There's no mention of DRSGMII in the A38x nor A37xx documentation which are later than Armada XP.

It's an Armada XP MV78460 in my case. I have no idea what other SoCs this mode is supported on.

Quoted 6 lines

What exactly is "drsgmii"? It can't be "double-rate" SGMII because that would give you 2Gbps max instead of the 1Gbps, but this gives 2.5Gbps, so I'm really not sure using "drsgmii" is a good idea. It may be what Marvell call it, but we really need to know if there's some vendor neutral way to refer to it.

The abbreviation really is for "Double Rated SGMII". It seems it has 2.5 times the clock rate than ordinary SGMII. Another term I found is HSGMII (High serial gigabit media-independent interface) which also has 2.5Gbps.

Anyway, I just learned from the paragraph you added to Documentation/networking/phy.rst that 1000BASEX differs from SGMII in the format of the control word. As we have a fixed link to a FPGA the control word seems to be unused, at least the Port MAC Control Register0 PortType setting bit doesn't change anything. So I can equally well use the existing 2500BASEX mode.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |