mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
net: stmmac: qcom-ethqos: move ethqos_set_serdes_speed()
Combine ethqos_set_serdes_speed() with ethqos_mac_finish_serdes() to simplify the code. Reviewed-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com> Tested-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/E1vxS3z-0000000BQXO-2WpU@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
46cb1fcdb7
commit
fc8ca5da89
|
|
@ -591,14 +591,6 @@ static void ethqos_configure_rgmii(struct qcom_ethqos *ethqos,
|
|||
ethqos_rgmii_macro_init(ethqos, speed);
|
||||
}
|
||||
|
||||
static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed)
|
||||
{
|
||||
if (ethqos->serdes_speed != speed) {
|
||||
phy_set_speed(ethqos->serdes_phy, speed);
|
||||
ethqos->serdes_speed = speed;
|
||||
}
|
||||
}
|
||||
|
||||
static void ethqos_pcs_set_inband(struct stmmac_priv *priv, bool enable)
|
||||
{
|
||||
stmmac_pcs_ctrl_ane(priv, enable, 0);
|
||||
|
|
@ -683,15 +675,23 @@ static int ethqos_mac_finish_serdes(struct net_device *ndev, void *priv,
|
|||
phy_interface_t interface)
|
||||
{
|
||||
struct qcom_ethqos *ethqos = priv;
|
||||
int speed, ret = 0;
|
||||
|
||||
qcom_ethqos_set_sgmii_loopback(ethqos, false);
|
||||
|
||||
speed = SPEED_UNKNOWN;
|
||||
if (interface == PHY_INTERFACE_MODE_SGMII)
|
||||
ethqos_set_serdes_speed(ethqos, SPEED_1000);
|
||||
speed = SPEED_1000;
|
||||
else if (interface == PHY_INTERFACE_MODE_2500BASEX)
|
||||
ethqos_set_serdes_speed(ethqos, SPEED_2500);
|
||||
speed = SPEED_2500;
|
||||
|
||||
return 0;
|
||||
if (speed != SPEED_UNKNOWN && speed != ethqos->serdes_speed) {
|
||||
ret = phy_set_speed(ethqos->serdes_phy, speed);
|
||||
if (ret == 0)
|
||||
ethqos->serdes_speed = speed;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ethqos_clks_config(void *priv, bool enabled)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user