mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 21:53:44 +00:00
net: phy: introduce genphy_c45_pma_baset1_read_master_slave()
Move baset1 specific part of genphy_c45_read_pma() code to separate function to make it reusable by PHY drivers. 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>
This commit is contained in:
parent
a04dd88f77
commit
b9a366f3d8
@ -550,6 +550,30 @@ int genphy_c45_read_lpa(struct phy_device *phydev)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(genphy_c45_read_lpa);
|
||||
|
||||
/**
|
||||
* genphy_c45_pma_baset1_read_master_slave - read forced master/slave
|
||||
* configuration
|
||||
* @phydev: target phy_device struct
|
||||
*/
|
||||
int genphy_c45_pma_baset1_read_master_slave(struct phy_device *phydev)
|
||||
{
|
||||
int val;
|
||||
|
||||
phydev->master_slave_state = MASTER_SLAVE_STATE_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)
|
||||
phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
|
||||
else
|
||||
phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(genphy_c45_pma_baset1_read_master_slave);
|
||||
|
||||
/**
|
||||
* genphy_c45_read_pma - read link speed etc from PMA
|
||||
* @phydev: target phy_device struct
|
||||
@ -591,14 +615,9 @@ int genphy_c45_read_pma(struct phy_device *phydev)
|
||||
phydev->duplex = DUPLEX_FULL;
|
||||
|
||||
if (genphy_c45_baset1_able(phydev)) {
|
||||
val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL);
|
||||
val = genphy_c45_pma_baset1_read_master_slave(phydev);
|
||||
if (val < 0)
|
||||
return val;
|
||||
|
||||
if (MDIO_PMA_PMD_BT1_CTRL_CFG_MST)
|
||||
phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
|
||||
else
|
||||
phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1619,6 +1619,7 @@ int genphy_c45_an_config_aneg(struct phy_device *phydev);
|
||||
int genphy_c45_an_disable_aneg(struct phy_device *phydev);
|
||||
int genphy_c45_read_mdix(struct phy_device *phydev);
|
||||
int genphy_c45_pma_read_abilities(struct phy_device *phydev);
|
||||
int genphy_c45_pma_baset1_read_master_slave(struct phy_device *phydev);
|
||||
int genphy_c45_read_status(struct phy_device *phydev);
|
||||
int genphy_c45_config_aneg(struct phy_device *phydev);
|
||||
int genphy_c45_loopback(struct phy_device *phydev, bool enable);
|
||||
|
Loading…
Reference in New Issue
Block a user