Skip to contentSkip to conversation

phy: mv88e61xx: add support for RGMII TX/RX delay

PATCH Superseded Pawel Dembicki 2 participants 3 messages Apr 11, 2020 – Jun 12, 2020

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 phy: mv88e61xx: add support for RGMII TX/RX delay

Clock delay in RGMII is required for some boards. This patch introduce CONFIG_MV88E61XX_CPU_PORT_TX_DELAY and CONFIG_MV88E61XX_CPU_PORT_RX_DELAY defines, which are setting proper bits in PORT_REG_PHYS_CTRL register.

Cc Chris Packham <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Tim Harvey <[email protected]>
---
 drivers/net/phy/mv88e61xx.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/phy/mv88e61xx.c +10 -1
index 5aff7ed397..889327639d 100644
@@ -94,6 +94,8 @@
 #define PORT_REG_STATUS_CMODE_1000BASE_X	0x9
 #define PORT_REG_STATUS_CMODE_SGMII		0xa
 
+#define PORT_REG_PHYS_CTRL_RGMII_RX_DELAY	BIT(15)
+#define PORT_REG_PHYS_CTRL_RGMII_TX_DELAY	BIT(14)
 #define PORT_REG_PHYS_CTRL_PCS_AN_EN	BIT(10)
 #define PORT_REG_PHYS_CTRL_PCS_AN_RST	BIT(9)
 #define PORT_REG_PHYS_CTRL_FC_VALUE	BIT(7)
@@ -747,9 +749,16 @@ static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port)
 		       PORT_REG_PHYS_CTRL_SPD1000;
 	}
 
-	if (port == CONFIG_MV88E61XX_CPU_PORT)
+	if (port == CONFIG_MV88E61XX_CPU_PORT) {
 		val |= PORT_REG_PHYS_CTRL_LINK_VALUE |
 		       PORT_REG_PHYS_CTRL_LINK_FORCE;
+#if defined(CONFIG_MV88E61XX_CPU_PORT_RX_DELAY)
+		val |= PORT_REG_PHYS_CTRL_RGMII_RX_DELAY;
+#endif
+#if defined(CONFIG_MV88E61XX_CPU_PORT_TX_DELAY)
+		val |= PORT_REG_PHYS_CTRL_RGMII_TX_DELAY;
+#endif
+	}
 
 	return mv88e61xx_port_write(phydev, port, PORT_REG_PHYS_CTRL,
 				   val);
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 phy: mv88e61xx: add support for MV88E6171

This patch add MV88E6171 id to driver data.

Tested on Checkpoint L-50 board.

Cc Chris Packham <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Tim Harvey <[email protected]>
---
 drivers/net/phy/mv88e61xx.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/net/phy/mv88e61xx.c +14 -0
index 889327639d..e0b648a54e 100644
@@ -180,6 +180,7 @@
 #define PORT_SWITCH_ID_6071		0x0710
 #define PORT_SWITCH_ID_6096		0x0980
 #define PORT_SWITCH_ID_6097		0x0990
+#define PORT_SWITCH_ID_6171		0x1710
 #define PORT_SWITCH_ID_6172		0x1720
 #define PORT_SWITCH_ID_6176		0x1760
 #define PORT_SWITCH_ID_6220		0x2200
@@ -997,6 +998,7 @@ static int mv88e61xx_probe(struct phy_device *phydev)
 	switch (priv->id) {
 	case PORT_SWITCH_ID_6096:
 	case PORT_SWITCH_ID_6097:
+	case PORT_SWITCH_ID_6171:
 	case PORT_SWITCH_ID_6172:
 	case PORT_SWITCH_ID_6176:
 	case PORT_SWITCH_ID_6240:
@@ -1152,6 +1154,17 @@ static struct phy_driver mv88e61xx_driver = {
 	.shutdown = &genphy_shutdown,
 };
 
+static struct phy_driver mv88e617x_driver = {
+	.name = "Marvell MV88E617x",
+	.uid = 0x01410e70,
+	.mask = 0xfffffff0,
+	.features = PHY_GBIT_FEATURES,
+	.probe = mv88e61xx_probe,
+	.config = mv88e61xx_phy_config,
+	.startup = mv88e61xx_phy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
 static struct phy_driver mv88e609x_driver = {
 	.name = "Marvell MV88E609x",
 	.uid = 0x1410c89,
@@ -1177,6 +1190,7 @@ static struct phy_driver mv88e6071_driver = {
 int phy_mv88e61xx_init(void)
 {
 	phy_register(&mv88e61xx_driver);
+	phy_register(&mv88e617x_driver);
 	phy_register(&mv88e609x_driver);
 	phy_register(&mv88e6071_driver);
 
Signature · 1 line
2.20.1
#2 lore raw

PATCH 1/2 phy: mv88e61xx: add support for RGMII TX/RX delay

In reply to Pawel Dembicki
Quoted 35 lines · Pawel Dembicki

Clock delay in RGMII is required for some boards. This patch introduce CONFIG_MV88E61XX_CPU_PORT_TX_DELAY and CONFIG_MV88E61XX_CPU_PORT_RX_DELAY defines, which are setting proper bits in PORT_REG_PHYS_CTRL register.

Cc Chris Packham <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Anatolij Gustschin <[email protected]>
Cc Tim Harvey <[email protected]>
---
 drivers/net/phy/mv88e61xx.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/phy/mv88e61xx.c +3 -1
index 5aff7ed397..889327639d 100644
@@ -94,6 +94,8 @@
 #define PORT_REG_STATUS_CMODE_1000BASE_X	0x9
 #define PORT_REG_STATUS_CMODE_SGMII		0xa
 
+#define PORT_REG_PHYS_CTRL_RGMII_RX_DELAY	BIT(15)
+#define PORT_REG_PHYS_CTRL_RGMII_TX_DELAY	BIT(14)
 #define PORT_REG_PHYS_CTRL_PCS_AN_EN	BIT(10)
 #define PORT_REG_PHYS_CTRL_PCS_AN_RST	BIT(9)
 #define PORT_REG_PHYS_CTRL_FC_VALUE	BIT(7)
@@ -747,9 +749,16 @@ static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port)
 		       PORT_REG_PHYS_CTRL_SPD1000;
 	}
 
-	if (port == CONFIG_MV88E61XX_CPU_PORT)
+	if (port == CONFIG_MV88E61XX_CPU_PORT) {
 		val |= PORT_REG_PHYS_CTRL_LINK_VALUE |
 		       PORT_REG_PHYS_CTRL_LINK_FORCE;

drivers/net/phy/mv88e61xx.c static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port) · line 764

Quoted 10 lines
drivers/net/phy/mv88e61xx.c +7 -0
+#if defined(CONFIG_MV88E61XX_CPU_PORT_RX_DELAY)
+		val |= PORT_REG_PHYS_CTRL_RGMII_RX_DELAY;
+#endif
+#if defined(CONFIG_MV88E61XX_CPU_PORT_TX_DELAY)
+		val |= PORT_REG_PHYS_CTRL_RGMII_TX_DELAY;
+#endif
+	}
 
 	return mv88e61xx_port_write(phydev, port, PORT_REG_PHYS_CTRL,
 				   val);

Two problems. First, you cannot add new CONFIG symbols that are not in Kconfig. Second, similar to Chris' comment in "net: mvgbe: add support for differ PHY addresses" this should likely come via the device tree I suspect. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200612/342428b0/attachment.sig>