Commit 46f69ded authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller

net: stmmac: Use resolved link config in mac_link_up()

Convert the stmmac ethernet driver to use the finalised link parameters
in mac_link_up() rather than the parameters in mac_config().
Suggested-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8dc6051c
...@@ -873,6 +873,31 @@ static void stmmac_mac_pcs_get_state(struct phylink_config *config, ...@@ -873,6 +873,31 @@ static void stmmac_mac_pcs_get_state(struct phylink_config *config,
static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
const struct phylink_link_state *state) const struct phylink_link_state *state)
{
/* Nothing for now. */
}
static void stmmac_mac_an_restart(struct phylink_config *config)
{
/* Not Supported */
}
static void stmmac_mac_link_down(struct phylink_config *config,
unsigned int mode, phy_interface_t interface)
{
struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
stmmac_mac_set(priv, priv->ioaddr, false);
priv->eee_active = false;
stmmac_eee_init(priv);
stmmac_set_eee_pls(priv, priv->hw, false);
}
static void stmmac_mac_link_up(struct phylink_config *config,
struct phy_device *phy,
unsigned int mode, phy_interface_t interface,
int speed, int duplex,
bool tx_pause, bool rx_pause)
{ {
struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev)); struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
u32 ctrl; u32 ctrl;
...@@ -880,8 +905,8 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, ...@@ -880,8 +905,8 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
ctrl = readl(priv->ioaddr + MAC_CTRL_REG); ctrl = readl(priv->ioaddr + MAC_CTRL_REG);
ctrl &= ~priv->hw->link.speed_mask; ctrl &= ~priv->hw->link.speed_mask;
if (state->interface == PHY_INTERFACE_MODE_USXGMII) { if (interface == PHY_INTERFACE_MODE_USXGMII) {
switch (state->speed) { switch (speed) {
case SPEED_10000: case SPEED_10000:
ctrl |= priv->hw->link.xgmii.speed10000; ctrl |= priv->hw->link.xgmii.speed10000;
break; break;
...@@ -895,7 +920,7 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, ...@@ -895,7 +920,7 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
return; return;
} }
} else { } else {
switch (state->speed) { switch (speed) {
case SPEED_2500: case SPEED_2500:
ctrl |= priv->hw->link.speed2500; ctrl |= priv->hw->link.speed2500;
break; break;
...@@ -913,46 +938,21 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, ...@@ -913,46 +938,21 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
} }
} }
priv->speed = state->speed; priv->speed = speed;
if (priv->plat->fix_mac_speed) if (priv->plat->fix_mac_speed)
priv->plat->fix_mac_speed(priv->plat->bsp_priv, state->speed); priv->plat->fix_mac_speed(priv->plat->bsp_priv, speed);
if (!state->duplex) if (!duplex)
ctrl &= ~priv->hw->link.duplex; ctrl &= ~priv->hw->link.duplex;
else else
ctrl |= priv->hw->link.duplex; ctrl |= priv->hw->link.duplex;
/* Flow Control operation */ /* Flow Control operation */
if (state->pause) if (tx_pause && rx_pause)
stmmac_mac_flow_ctrl(priv, state->duplex); stmmac_mac_flow_ctrl(priv, duplex);
writel(ctrl, priv->ioaddr + MAC_CTRL_REG); writel(ctrl, priv->ioaddr + MAC_CTRL_REG);
}
static void stmmac_mac_an_restart(struct phylink_config *config)
{
/* Not Supported */
}
static void stmmac_mac_link_down(struct phylink_config *config,
unsigned int mode, phy_interface_t interface)
{
struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
stmmac_mac_set(priv, priv->ioaddr, false);
priv->eee_active = false;
stmmac_eee_init(priv);
stmmac_set_eee_pls(priv, priv->hw, false);
}
static void stmmac_mac_link_up(struct phylink_config *config,
struct phy_device *phy,
unsigned int mode, phy_interface_t interface,
int speed, int duplex,
bool tx_pause, bool rx_pause)
{
struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
stmmac_mac_set(priv, priv->ioaddr, true); stmmac_mac_set(priv, priv->ioaddr, true);
if (phy && priv->dma_cap.eee) { if (phy && priv->dma_cap.eee) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment