Commit 6a553b48 authored by David S. Miller's avatar David S. Miller

Merge branch 'stmmac-misc'

Corentin Labbe says:

====================
stmmac: misc patchs

This is a follow up of my previous stmmac serie which address some comment
done in v2.
====================
Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 36a4a50f c80151ec
...@@ -442,24 +442,24 @@ static void stmmac_ethtool_gregs(struct net_device *dev, ...@@ -442,24 +442,24 @@ static void stmmac_ethtool_gregs(struct net_device *dev,
memset(reg_space, 0x0, REG_SPACE_SIZE); memset(reg_space, 0x0, REG_SPACE_SIZE);
if (!(priv->plat->has_gmac || priv->plat->has_gmac4)) { if (priv->plat->has_gmac || priv->plat->has_gmac4) {
/* MAC registers */ /* MAC registers */
for (i = 0; i < 12; i++) for (i = 0; i < 55; i++)
reg_space[i] = readl(priv->ioaddr + (i * 4)); reg_space[i] = readl(priv->ioaddr + (i * 4));
/* DMA registers */ /* DMA registers */
for (i = 0; i < 9; i++) for (i = 0; i < 22; i++)
reg_space[i + 12] = reg_space[i + 55] =
readl(priv->ioaddr + (DMA_BUS_MODE + (i * 4))); readl(priv->ioaddr + (DMA_BUS_MODE + (i * 4)));
reg_space[22] = readl(priv->ioaddr + DMA_CUR_TX_BUF_ADDR);
reg_space[23] = readl(priv->ioaddr + DMA_CUR_RX_BUF_ADDR);
} else { } else {
/* MAC registers */ /* MAC registers */
for (i = 0; i < 55; i++) for (i = 0; i < 12; i++)
reg_space[i] = readl(priv->ioaddr + (i * 4)); reg_space[i] = readl(priv->ioaddr + (i * 4));
/* DMA registers */ /* DMA registers */
for (i = 0; i < 22; i++) for (i = 0; i < 9; i++)
reg_space[i + 55] = reg_space[i + 12] =
readl(priv->ioaddr + (DMA_BUS_MODE + (i * 4))); readl(priv->ioaddr + (DMA_BUS_MODE + (i * 4)));
reg_space[22] = readl(priv->ioaddr + DMA_CUR_TX_BUF_ADDR);
reg_space[23] = readl(priv->ioaddr + DMA_CUR_RX_BUF_ADDR);
} }
} }
......
...@@ -716,32 +716,36 @@ static void stmmac_adjust_link(struct net_device *dev) ...@@ -716,32 +716,36 @@ static void stmmac_adjust_link(struct net_device *dev)
new_state = 1; new_state = 1;
switch (phydev->speed) { switch (phydev->speed) {
case 1000: case 1000:
if (likely((priv->plat->has_gmac) || if (priv->plat->has_gmac ||
(priv->plat->has_gmac4))) priv->plat->has_gmac4)
ctrl &= ~priv->hw->link.port; ctrl &= ~priv->hw->link.port;
stmmac_hw_fix_mac_speed(priv);
break; break;
case 100: case 100:
if (priv->plat->has_gmac ||
priv->plat->has_gmac4) {
ctrl |= priv->hw->link.port;
ctrl |= priv->hw->link.speed;
} else {
ctrl &= ~priv->hw->link.port;
}
break;
case 10: case 10:
if (likely((priv->plat->has_gmac) || if (priv->plat->has_gmac ||
(priv->plat->has_gmac4))) { priv->plat->has_gmac4) {
ctrl |= priv->hw->link.port; ctrl |= priv->hw->link.port;
if (phydev->speed == SPEED_100) { ctrl &= ~(priv->hw->link.speed);
ctrl |= priv->hw->link.speed;
} else {
ctrl &= ~(priv->hw->link.speed);
}
} else { } else {
ctrl &= ~priv->hw->link.port; ctrl &= ~priv->hw->link.port;
} }
stmmac_hw_fix_mac_speed(priv);
break; break;
default: default:
netif_warn(priv, link, priv->dev, netif_warn(priv, link, priv->dev,
"broken speed: %d\n", phydev->speed); "broken speed: %d\n", phydev->speed);
phydev->speed = SPEED_UNKNOWN;
break; break;
} }
if (phydev->speed != SPEED_UNKNOWN)
stmmac_hw_fix_mac_speed(priv);
priv->speed = phydev->speed; priv->speed = phydev->speed;
} }
...@@ -754,8 +758,8 @@ static void stmmac_adjust_link(struct net_device *dev) ...@@ -754,8 +758,8 @@ static void stmmac_adjust_link(struct net_device *dev)
} else if (priv->oldlink) { } else if (priv->oldlink) {
new_state = 1; new_state = 1;
priv->oldlink = 0; priv->oldlink = 0;
priv->speed = 0; priv->speed = SPEED_UNKNOWN;
priv->oldduplex = -1; priv->oldduplex = DUPLEX_UNKNOWN;
} }
if (new_state && netif_msg_link(priv)) if (new_state && netif_msg_link(priv))
...@@ -817,8 +821,8 @@ static int stmmac_init_phy(struct net_device *dev) ...@@ -817,8 +821,8 @@ static int stmmac_init_phy(struct net_device *dev)
int interface = priv->plat->interface; int interface = priv->plat->interface;
int max_speed = priv->plat->max_speed; int max_speed = priv->plat->max_speed;
priv->oldlink = 0; priv->oldlink = 0;
priv->speed = 0; priv->speed = SPEED_UNKNOWN;
priv->oldduplex = -1; priv->oldduplex = DUPLEX_UNKNOWN;
if (priv->plat->phy_node) { if (priv->plat->phy_node) {
phydev = of_phy_connect(dev, priv->plat->phy_node, phydev = of_phy_connect(dev, priv->plat->phy_node,
...@@ -3434,8 +3438,8 @@ int stmmac_suspend(struct device *dev) ...@@ -3434,8 +3438,8 @@ int stmmac_suspend(struct device *dev)
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
priv->oldlink = 0; priv->oldlink = 0;
priv->speed = 0; priv->speed = SPEED_UNKNOWN;
priv->oldduplex = -1; priv->oldduplex = DUPLEX_UNKNOWN;
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(stmmac_suspend); EXPORT_SYMBOL_GPL(stmmac_suspend);
......
...@@ -247,50 +247,48 @@ int stmmac_mdio_register(struct net_device *ndev) ...@@ -247,50 +247,48 @@ int stmmac_mdio_register(struct net_device *ndev)
found = 0; found = 0;
for (addr = 0; addr < PHY_MAX_ADDR; addr++) { for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
struct phy_device *phydev = mdiobus_get_phy(new_bus, addr); struct phy_device *phydev = mdiobus_get_phy(new_bus, addr);
int act = 0;
char irq_num[4];
char *irq_str;
if (!phydev)
continue;
/*
* If an IRQ was provided to be assigned after
* the bus probe, do it here.
*/
if (!mdio_bus_data->irqs &&
(mdio_bus_data->probed_phy_irq > 0)) {
new_bus->irq[addr] = mdio_bus_data->probed_phy_irq;
phydev->irq = mdio_bus_data->probed_phy_irq;
}
if (phydev) { /*
int act = 0; * If we're going to bind the MAC to this PHY bus,
char irq_num[4]; * and no PHY number was provided to the MAC,
char *irq_str; * use the one probed here.
*/
/* if (priv->plat->phy_addr == -1)
* If an IRQ was provided to be assigned after priv->plat->phy_addr = addr;
* the bus probe, do it here.
*/ act = (priv->plat->phy_addr == addr);
if ((!mdio_bus_data->irqs) && switch (phydev->irq) {
(mdio_bus_data->probed_phy_irq > 0)) { case PHY_POLL:
new_bus->irq[addr] = irq_str = "POLL";
mdio_bus_data->probed_phy_irq; break;
phydev->irq = mdio_bus_data->probed_phy_irq; case PHY_IGNORE_INTERRUPT:
} irq_str = "IGNORE";
break;
/* default:
* If we're going to bind the MAC to this PHY bus, sprintf(irq_num, "%d", phydev->irq);
* and no PHY number was provided to the MAC, irq_str = irq_num;
* use the one probed here. break;
*/
if (priv->plat->phy_addr == -1)
priv->plat->phy_addr = addr;
act = (priv->plat->phy_addr == addr);
switch (phydev->irq) {
case PHY_POLL:
irq_str = "POLL";
break;
case PHY_IGNORE_INTERRUPT:
irq_str = "IGNORE";
break;
default:
sprintf(irq_num, "%d", phydev->irq);
irq_str = irq_num;
break;
}
netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n",
phydev->phy_id, addr,
irq_str, phydev_name(phydev),
act ? " active" : "");
found = 1;
} }
netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n",
phydev->phy_id, addr, irq_str, phydev_name(phydev),
act ? " active" : "");
found = 1;
} }
if (!found && !mdio_node) { if (!found && !mdio_node) {
......
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