]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: phy: genphy_c45_pma_baset1_read_master_slave: read actual configuration
authorOleksij Rempel <o.rempel@pengutronix.de>
Fri, 6 May 2022 04:23:55 +0000 (06:23 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 May 2022 11:09:29 +0000 (12:09 +0100)
Since MDIO_PMA_PMD_BT1_CTRL register shows actual configuration (and
forced state configuration is equal to the state), we should show
this configuration for ethtool.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy-c45.c

index d440b76a18b40c6c18a6f2a2166f383e48e22867..a0684c716a2eb3d32576c37edcbbbd95116ea028 100644 (file)
@@ -560,15 +560,19 @@ int genphy_c45_pma_baset1_read_master_slave(struct phy_device *phydev)
        int val;
 
        phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
+       phydev->master_slave_get = MASTER_SLAVE_CFG_UNKNOWN;
 
        val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL);
        if (val < 0)
                return val;
 
-       if (val & MDIO_PMA_PMD_BT1_CTRL_CFG_MST)
+       if (val & MDIO_PMA_PMD_BT1_CTRL_CFG_MST) {
+               phydev->master_slave_get = MASTER_SLAVE_CFG_MASTER_FORCE;
                phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
-       else
+       } else {
+               phydev->master_slave_get = MASTER_SLAVE_CFG_SLAVE_FORCE;
                phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
+       }
 
        return 0;
 }