mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-08 14:13:53 +00:00
net: phy: introduce genphy_c45_pma_baset1_setup_master_slave()
Move baset1 specific part of genphy_c45_pma_setup_forced() 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
a7f0e4bea8
commit
90532850eb
@ -70,6 +70,35 @@ int genphy_c45_pma_suspend(struct phy_device *phydev)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(genphy_c45_pma_suspend);
|
EXPORT_SYMBOL_GPL(genphy_c45_pma_suspend);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* genphy_c45_pma_baset1_setup_master_slave - configures forced master/slave
|
||||||
|
* role of BaseT1 devices.
|
||||||
|
* @phydev: target phy_device struct
|
||||||
|
*/
|
||||||
|
int genphy_c45_pma_baset1_setup_master_slave(struct phy_device *phydev)
|
||||||
|
{
|
||||||
|
int ctl = 0;
|
||||||
|
|
||||||
|
switch (phydev->master_slave_set) {
|
||||||
|
case MASTER_SLAVE_CFG_MASTER_PREFERRED:
|
||||||
|
case MASTER_SLAVE_CFG_MASTER_FORCE:
|
||||||
|
ctl = MDIO_PMA_PMD_BT1_CTRL_CFG_MST;
|
||||||
|
break;
|
||||||
|
case MASTER_SLAVE_CFG_SLAVE_FORCE:
|
||||||
|
case MASTER_SLAVE_CFG_SLAVE_PREFERRED:
|
||||||
|
case MASTER_SLAVE_CFG_UNKNOWN:
|
||||||
|
case MASTER_SLAVE_CFG_UNSUPPORTED:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
phydev_warn(phydev, "Unsupported Master/Slave mode\n");
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL,
|
||||||
|
MDIO_PMA_PMD_BT1_CTRL_CFG_MST, ctl);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(genphy_c45_pma_baset1_setup_master_slave);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* genphy_c45_pma_setup_forced - configures a forced speed
|
* genphy_c45_pma_setup_forced - configures a forced speed
|
||||||
* @phydev: target phy_device struct
|
* @phydev: target phy_device struct
|
||||||
@ -141,25 +170,7 @@ int genphy_c45_pma_setup_forced(struct phy_device *phydev)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (genphy_c45_baset1_able(phydev)) {
|
if (genphy_c45_baset1_able(phydev)) {
|
||||||
int ctl = 0;
|
ret = genphy_c45_pma_baset1_setup_master_slave(phydev);
|
||||||
|
|
||||||
switch (phydev->master_slave_set) {
|
|
||||||
case MASTER_SLAVE_CFG_MASTER_PREFERRED:
|
|
||||||
case MASTER_SLAVE_CFG_MASTER_FORCE:
|
|
||||||
ctl = MDIO_PMA_PMD_BT1_CTRL_CFG_MST;
|
|
||||||
break;
|
|
||||||
case MASTER_SLAVE_CFG_SLAVE_FORCE:
|
|
||||||
case MASTER_SLAVE_CFG_SLAVE_PREFERRED:
|
|
||||||
case MASTER_SLAVE_CFG_UNKNOWN:
|
|
||||||
case MASTER_SLAVE_CFG_UNSUPPORTED:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
phydev_warn(phydev, "Unsupported Master/Slave mode\n");
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL,
|
|
||||||
MDIO_PMA_PMD_BT1_CTRL_CFG_MST, ctl);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1614,6 +1614,7 @@ int genphy_c45_read_link(struct phy_device *phydev);
|
|||||||
int genphy_c45_read_lpa(struct phy_device *phydev);
|
int genphy_c45_read_lpa(struct phy_device *phydev);
|
||||||
int genphy_c45_read_pma(struct phy_device *phydev);
|
int genphy_c45_read_pma(struct phy_device *phydev);
|
||||||
int genphy_c45_pma_setup_forced(struct phy_device *phydev);
|
int genphy_c45_pma_setup_forced(struct phy_device *phydev);
|
||||||
|
int genphy_c45_pma_baset1_setup_master_slave(struct phy_device *phydev);
|
||||||
int genphy_c45_an_config_aneg(struct phy_device *phydev);
|
int genphy_c45_an_config_aneg(struct phy_device *phydev);
|
||||||
int genphy_c45_an_disable_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_read_mdix(struct phy_device *phydev);
|
||||||
|
Loading…
Reference in New Issue
Block a user