Commit 65a2c09a authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

net: mvpp2: do not set GMAC autoneg when using XLG MAC

When using the XLG MAC, it does not make sense to force the GMAC autoneg
parameters. This patch adds checks to only set the GMAC autoneg
parameters when needed (i.e. when not using the XLG MAC).
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f55744ad
...@@ -5735,17 +5735,17 @@ static irqreturn_t mvpp2_isr(int irq, void *dev_id) ...@@ -5735,17 +5735,17 @@ static irqreturn_t mvpp2_isr(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
/* Adjust link */ static void mvpp2_gmac_set_autoneg(struct mvpp2_port *port,
static void mvpp2_link_event(struct net_device *dev) struct phy_device *phydev)
{ {
struct mvpp2_port *port = netdev_priv(dev);
struct phy_device *phydev = dev->phydev;
u32 val; u32 val;
if (phydev->link) { if (port->phy_interface != PHY_INTERFACE_MODE_RGMII &&
if ((port->speed != phydev->speed) || port->phy_interface != PHY_INTERFACE_MODE_RGMII_ID &&
(port->duplex != phydev->duplex)) { port->phy_interface != PHY_INTERFACE_MODE_RGMII_RXID &&
u32 val; port->phy_interface != PHY_INTERFACE_MODE_RGMII_TXID &&
port->phy_interface != PHY_INTERFACE_MODE_SGMII)
return;
val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG); val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG);
val &= ~(MVPP2_GMAC_CONFIG_MII_SPEED | val &= ~(MVPP2_GMAC_CONFIG_MII_SPEED |
...@@ -5764,6 +5764,20 @@ static void mvpp2_link_event(struct net_device *dev) ...@@ -5764,6 +5764,20 @@ static void mvpp2_link_event(struct net_device *dev)
writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG); writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG);
}
/* Adjust link */
static void mvpp2_link_event(struct net_device *dev)
{
struct mvpp2_port *port = netdev_priv(dev);
struct phy_device *phydev = dev->phydev;
u32 val;
if (phydev->link) {
if ((port->speed != phydev->speed) ||
(port->duplex != phydev->duplex)) {
mvpp2_gmac_set_autoneg(port, phydev);
port->duplex = phydev->duplex; port->duplex = phydev->duplex;
port->speed = phydev->speed; port->speed = phydev->speed;
} }
...@@ -5773,10 +5787,16 @@ static void mvpp2_link_event(struct net_device *dev) ...@@ -5773,10 +5787,16 @@ static void mvpp2_link_event(struct net_device *dev)
port->link = phydev->link; port->link = phydev->link;
if (phydev->link) { if (phydev->link) {
if (port->phy_interface == PHY_INTERFACE_MODE_RGMII ||
port->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
port->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID ||
port->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID ||
port->phy_interface == PHY_INTERFACE_MODE_SGMII) {
val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG); val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG);
val |= (MVPP2_GMAC_FORCE_LINK_PASS | val |= (MVPP2_GMAC_FORCE_LINK_PASS |
MVPP2_GMAC_FORCE_LINK_DOWN); MVPP2_GMAC_FORCE_LINK_DOWN);
writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG); writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG);
}
mvpp2_interrupts_enable(port); mvpp2_interrupts_enable(port);
mvpp2_port_enable(port); mvpp2_port_enable(port);
......
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