Skip to content

Commit 1b66601

Browse files
eichenbergerPaolo Abeni
authored and
Paolo Abeni
committed
net: mvpp2: add support for mii
Currently, mvpp2 only supports RGMII. This commit adds support for MII. The description in Marvell's functional specification seems to be wrong. To enable MII, we need to set GENCONF_CTRL0_PORT3_RGMII, while for RGMII we need to clear it. This is also how U-Boot handles it. Signed-off-by: Stefan Eichenberger <[email protected]> Reviewed-by: Maxime Chevallier <[email protected]> Reviewed-by: Marcin Wojtas <[email protected]> Reviewed-by: Russell King (Oracle) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 00b1b22 commit 1b66601

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

+18-3
Original file line numberDiff line numberDiff line change
@@ -1513,10 +1513,21 @@ static void mvpp22_gop_init_rgmii(struct mvpp2_port *port)
15131513
regmap_write(priv->sysctrl_base, GENCONF_PORT_CTRL0, val);
15141514

15151515
regmap_read(priv->sysctrl_base, GENCONF_CTRL0, &val);
1516-
if (port->gop_id == 2)
1516+
if (port->gop_id == 2) {
15171517
val |= GENCONF_CTRL0_PORT2_RGMII;
1518-
else if (port->gop_id == 3)
1518+
} else if (port->gop_id == 3) {
15191519
val |= GENCONF_CTRL0_PORT3_RGMII_MII;
1520+
1521+
/* According to the specification, GENCONF_CTRL0_PORT3_RGMII
1522+
* should be set to 1 for RGMII and 0 for MII. However, tests
1523+
* show that it is the other way around. This is also what
1524+
* U-Boot does for mvpp2, so it is assumed to be correct.
1525+
*/
1526+
if (port->phy_interface == PHY_INTERFACE_MODE_MII)
1527+
val |= GENCONF_CTRL0_PORT3_RGMII;
1528+
else
1529+
val &= ~GENCONF_CTRL0_PORT3_RGMII;
1530+
}
15201531
regmap_write(priv->sysctrl_base, GENCONF_CTRL0, val);
15211532
}
15221533

@@ -1615,6 +1626,7 @@ static int mvpp22_gop_init(struct mvpp2_port *port, phy_interface_t interface)
16151626
return 0;
16161627

16171628
switch (interface) {
1629+
case PHY_INTERFACE_MODE_MII:
16181630
case PHY_INTERFACE_MODE_RGMII:
16191631
case PHY_INTERFACE_MODE_RGMII_ID:
16201632
case PHY_INTERFACE_MODE_RGMII_RXID:
@@ -6915,8 +6927,11 @@ static int mvpp2_port_probe(struct platform_device *pdev,
69156927
MAC_10000FD;
69166928
}
69176929

6918-
if (mvpp2_port_supports_rgmii(port))
6930+
if (mvpp2_port_supports_rgmii(port)) {
69196931
phy_interface_set_rgmii(port->phylink_config.supported_interfaces);
6932+
__set_bit(PHY_INTERFACE_MODE_MII,
6933+
port->phylink_config.supported_interfaces);
6934+
}
69206935

69216936
if (comphy) {
69226937
/* If a COMPHY is present, we can support any of the

0 commit comments

Comments
 (0)