]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: phy: marvell-88x2222: set proper phydev->port
authorIvan Bornyakov <i.bornyakov@metrotek.ru>
Sun, 12 Jun 2022 18:19:34 +0000 (21:19 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Jun 2022 08:25:31 +0000 (09:25 +0100)
phydev->port was not set and always reported as PORT_TP.
Set phydev->port according to inserted SFP module.

Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/marvell-88x2222.c

index d8b31d4d2a73e54d4ae73f92af4399ea0163e44c..f070776ca904a0c430f7b4414d3a94601c588b15 100644 (file)
@@ -490,6 +490,7 @@ static int mv2222_sfp_insert(void *upstream, const struct sfp_eeprom_id *id)
        dev = &phydev->mdio.dev;
 
        sfp_parse_support(phydev->sfp_bus, id, sfp_supported);
+       phydev->port = sfp_parse_port(phydev->sfp_bus, id, sfp_supported);
        sfp_interface = sfp_select_interface(phydev->sfp_bus, sfp_supported);
 
        dev_info(dev, "%s SFP module inserted\n", phy_modes(sfp_interface));
@@ -526,6 +527,7 @@ static void mv2222_sfp_remove(void *upstream)
 
        priv->line_interface = PHY_INTERFACE_MODE_NA;
        linkmode_zero(priv->supported);
+       phydev->port = PORT_NONE;
 }
 
 static void mv2222_sfp_link_up(void *upstream)