Skip to contentSkip to conversation

net: dsa: mv88e6xxx: implement USXGMII mode for mv88e6393x

PATCH Superseded [email protected] 4 participants 5 messages Jun 1, 2023 – Jun 2, 2023

Subsystems (4)

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v5 cover net: dsa: mv88e6xxx: implement USXGMII mode for mv88e6393x

From: Michal Smulski <[email protected]>

Re-generated patch against net-next(main) updated as of 2023-06-01

Michal Smulski (1):
net: dsa: mv88e6xxx: implement USXGMII mode for mv88e6393x

 drivers/net/dsa/mv88e6xxx/chip.c   |  3 +-
 drivers/net/dsa/mv88e6xxx/port.c   |  3 ++
 drivers/net/dsa/mv88e6xxx/serdes.c | 70 +++++++++++++++++++++++++++++-
 drivers/net/dsa/mv88e6xxx/serdes.h | 13 ++++++
 4 files changed, 85 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v5 1/1 net: dsa: mv88e6xxx: implement USXGMII mode for mv88e6393x

From: Michal Smulski <[email protected]>

Enable USXGMII mode for mv88e6393x chips. Tested on Marvell 88E6191X.

---
 drivers/net/dsa/mv88e6xxx/chip.c   |  3 +-
 drivers/net/dsa/mv88e6xxx/port.c   |  3 ++
 drivers/net/dsa/mv88e6xxx/serdes.c | 70 +++++++++++++++++++++++++++++-
 drivers/net/dsa/mv88e6xxx/serdes.h | 13 ++++++
 4 files changed, 85 insertions(+), 4 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +1 -2
index 8731af6d79de..5a92ccfd08ea 100644
@@ -815,8 +815,7 @@ static void mv88e6393x_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
 				config->mac_capabilities |= MAC_5000FD |
 					MAC_10000FD;
 			}
-			/* FIXME: USXGMII is not supported yet */
-			/* __set_bit(PHY_INTERFACE_MODE_USXGMII, supported); */
+			__set_bit(PHY_INTERFACE_MODE_USXGMII, supported);
 		}
 	}
 
drivers/net/dsa/mv88e6xxx/port.c +3 -0
index e9b4a6ea4d09..dd66ec902d4c 100644
@@ -566,6 +566,9 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
 	case PHY_INTERFACE_MODE_10GBASER:
 		cmode = MV88E6393X_PORT_STS_CMODE_10GBASER;
 		break;
+	case PHY_INTERFACE_MODE_USXGMII:
+		cmode = MV88E6393X_PORT_STS_CMODE_USXGMII;
+		break;
 	default:
 		cmode = 0;
 	}
drivers/net/dsa/mv88e6xxx/serdes.c +68 -2

112 lines not on this page · raw message

drivers/net/dsa/mv88e6xxx/serdes.h +13 -0
index 29bb4e91e2f6..899b8518113a 100644
@@ -48,6 +48,19 @@
 #define MV88E6393X_10G_INT_LINK_CHANGE	BIT(2)
 #define MV88E6393X_10G_INT_STATUS	0x9001
 
+/* USXGMII */
+#define MV88E6390_USXGMII_LP_STATUS       0xf0a2
+#define MV88E6390_USXGMII_PHY_STATUS      0xf0a6
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_MASK	GENMASK(11, 9)
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_5000	0xa00
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_2500	0x800
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_10000	0x600
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_1000	0x400
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_100	0x200
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_10	0x000
+#define MV88E6390_USXGMII_PHY_STATUS_DUPLEX_FULL	BIT(12)
+#define MV88E6390_USXGMII_PHY_STATUS_LINK		BIT(15)
+
 /* 1000BASE-X and SGMII */
 #define MV88E6390_SGMII_BMCR		(0x2000 + MII_BMCR)
 #define MV88E6390_SGMII_BMSR		(0x2000 + MII_BMSR)
Signature · 1 line
2.34.1
#2 lore raw

drivers/net/dsa/mv88e6xxx/serdes.h line 62

Quoted 10 lines · On Thu, Jun 01, 2023 at 02:52:51PM -0700, [email protected] wrote:
drivers/net/dsa/mv88e6xxx/serdes.h +10 -0
+/* USXGMII */
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_MASK	GENMASK(11, 9)
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_5000	0xa00
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_2500	0x800
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_10000	0x600
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_1000	0x400
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_100	0x200
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_10	0x000
+#define MV88E6390_USXGMII_PHY_STATUS_DUPLEX_FULL	BIT(12)
+#define MV88E6390_USXGMII_PHY_STATUS_LINK		BIT(15)

How is this different from the definitions in include/uapi/linux/mdio.h (see MDIO_USXGMII_*). Have you considered using phylink_decode_usxgmii_word() to decode these instead of reinventing the wheel?

It would be nice to wait until we've converted 88e6xxx to phylink PCS before adding this support, which is something that's been blocked for a few years but should be unblocked either at the end of this cycle, or certainly by 6.5-rc1. Andrew, would you agree?

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

I was not aware of phylink_decode_usxgmii_word(). I would be happy to re-do this patch and remove #defines as per your comments.

Regards,
Michal

-----Original Message-----
From: Russell King <[email protected]>
Sent: Thursday, June 1, 2023 3:43 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Michal Smulski <[email protected]>
Subject: Re: [PATCH net-next v5 1/1] net: dsa: mv88e6xxx: implement USXGMII mode for mv88e6393x

CAUTION: This email is originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

drivers/net/dsa/mv88e6xxx/serdes.h line 62

Quoted 10 lines · On Thu, Jun 01, 2023 at 02:52:51PM -0700, [email protected] wrote:
drivers/net/dsa/mv88e6xxx/serdes.h +10 -0
+/* USXGMII */
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_MASK      GENMASK(11, 9)
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_5000      0xa00
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_2500      0x800
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_10000     0x600
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_1000      0x400
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_100       0x200
+#define MV88E6390_USXGMII_PHY_STATUS_SPEED_10        0x000
+#define MV88E6390_USXGMII_PHY_STATUS_DUPLEX_FULL     BIT(12)
+#define MV88E6390_USXGMII_PHY_STATUS_LINK            BIT(15)

How is this different from the definitions in include/uapi/linux/mdio.h (see MDIO_USXGMII_*). Have you considered using phylink_decode_usxgmii_word() to decode these instead of reinventing the wheel?

It would be nice to wait until we've converted 88e6xxx to phylink PCS before adding this support, which is something that's been blocked for a few years but should be unblocked either at the end of this cycle, or certainly by 6.5-rc1. Andrew, would you agree?

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

maintainer
#4 lore raw
In reply to Russell King (Oracle)
Quoted 4 lines

It would be nice to wait until we've converted 88e6xxx to phylink PCS before adding this support, which is something that's been blocked for a few years but should be unblocked either at the end of this cycle, or certainly by 6.5-rc1. Andrew, would you agree?

I don't think merging this will make it any harder to convert the code to a PCS driver.

As far as i know, all the DT changes should already be in linux-next, so i think 6.5-rc1 is a reasonable target.

Andrew