Commit 1b666016 authored by Stefan Eichenberger's avatar Stefan Eichenberger Committed by Paolo Abeni

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: default avatarStefan Eichenberger <eichest@gmail.com>
Reviewed-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: default avatarMarcin Wojtas <mw@semihalf.com>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/20231212141200.62579-1-eichest@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 00b1b229
...@@ -1513,10 +1513,21 @@ static void mvpp22_gop_init_rgmii(struct mvpp2_port *port) ...@@ -1513,10 +1513,21 @@ static void mvpp22_gop_init_rgmii(struct mvpp2_port *port)
regmap_write(priv->sysctrl_base, GENCONF_PORT_CTRL0, val); regmap_write(priv->sysctrl_base, GENCONF_PORT_CTRL0, val);
regmap_read(priv->sysctrl_base, GENCONF_CTRL0, &val); regmap_read(priv->sysctrl_base, GENCONF_CTRL0, &val);
if (port->gop_id == 2) if (port->gop_id == 2) {
val |= GENCONF_CTRL0_PORT2_RGMII; val |= GENCONF_CTRL0_PORT2_RGMII;
else if (port->gop_id == 3) } else if (port->gop_id == 3) {
val |= GENCONF_CTRL0_PORT3_RGMII_MII; val |= GENCONF_CTRL0_PORT3_RGMII_MII;
/* According to the specification, GENCONF_CTRL0_PORT3_RGMII
* should be set to 1 for RGMII and 0 for MII. However, tests
* show that it is the other way around. This is also what
* U-Boot does for mvpp2, so it is assumed to be correct.
*/
if (port->phy_interface == PHY_INTERFACE_MODE_MII)
val |= GENCONF_CTRL0_PORT3_RGMII;
else
val &= ~GENCONF_CTRL0_PORT3_RGMII;
}
regmap_write(priv->sysctrl_base, GENCONF_CTRL0, val); regmap_write(priv->sysctrl_base, GENCONF_CTRL0, val);
} }
...@@ -1615,6 +1626,7 @@ static int mvpp22_gop_init(struct mvpp2_port *port, phy_interface_t interface) ...@@ -1615,6 +1626,7 @@ static int mvpp22_gop_init(struct mvpp2_port *port, phy_interface_t interface)
return 0; return 0;
switch (interface) { switch (interface) {
case PHY_INTERFACE_MODE_MII:
case PHY_INTERFACE_MODE_RGMII: case PHY_INTERFACE_MODE_RGMII:
case PHY_INTERFACE_MODE_RGMII_ID: case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID: case PHY_INTERFACE_MODE_RGMII_RXID:
...@@ -6915,8 +6927,11 @@ static int mvpp2_port_probe(struct platform_device *pdev, ...@@ -6915,8 +6927,11 @@ static int mvpp2_port_probe(struct platform_device *pdev,
MAC_10000FD; MAC_10000FD;
} }
if (mvpp2_port_supports_rgmii(port)) if (mvpp2_port_supports_rgmii(port)) {
phy_interface_set_rgmii(port->phylink_config.supported_interfaces); phy_interface_set_rgmii(port->phylink_config.supported_interfaces);
__set_bit(PHY_INTERFACE_MODE_MII,
port->phylink_config.supported_interfaces);
}
if (comphy) { if (comphy) {
/* If a COMPHY is present, we can support any of the /* If a COMPHY is present, we can support any of the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment