mirror of https://gitee.com/openkylin/linux.git
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: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
6a553b4894
|
@ -442,7 +442,15 @@ 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 */
|
||||||
|
for (i = 0; i < 55; i++)
|
||||||
|
reg_space[i] = readl(priv->ioaddr + (i * 4));
|
||||||
|
/* DMA registers */
|
||||||
|
for (i = 0; i < 22; i++)
|
||||||
|
reg_space[i + 55] =
|
||||||
|
readl(priv->ioaddr + (DMA_BUS_MODE + (i * 4)));
|
||||||
|
} else {
|
||||||
/* MAC registers */
|
/* MAC registers */
|
||||||
for (i = 0; i < 12; i++)
|
for (i = 0; i < 12; i++)
|
||||||
reg_space[i] = readl(priv->ioaddr + (i * 4));
|
reg_space[i] = readl(priv->ioaddr + (i * 4));
|
||||||
|
@ -452,14 +460,6 @@ static void stmmac_ethtool_gregs(struct net_device *dev,
|
||||||
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[22] = readl(priv->ioaddr + DMA_CUR_TX_BUF_ADDR);
|
||||||
reg_space[23] = readl(priv->ioaddr + DMA_CUR_RX_BUF_ADDR);
|
reg_space[23] = readl(priv->ioaddr + DMA_CUR_RX_BUF_ADDR);
|
||||||
} else {
|
|
||||||
/* MAC registers */
|
|
||||||
for (i = 0; i < 55; i++)
|
|
||||||
reg_space[i] = readl(priv->ioaddr + (i * 4));
|
|
||||||
/* DMA registers */
|
|
||||||
for (i = 0; i < 22; i++)
|
|
||||||
reg_space[i + 55] =
|
|
||||||
readl(priv->ioaddr + (DMA_BUS_MODE + (i * 4)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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:
|
||||||
case 10:
|
if (priv->plat->has_gmac ||
|
||||||
if (likely((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;
|
||||||
|
case 10:
|
||||||
|
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;
|
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)
|
||||||
} 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)
|
||||||
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)
|
||||||
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,20 +247,20 @@ 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);
|
||||||
|
|
||||||
if (phydev) {
|
|
||||||
int act = 0;
|
int act = 0;
|
||||||
char irq_num[4];
|
char irq_num[4];
|
||||||
char *irq_str;
|
char *irq_str;
|
||||||
|
|
||||||
|
if (!phydev)
|
||||||
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If an IRQ was provided to be assigned after
|
* If an IRQ was provided to be assigned after
|
||||||
* the bus probe, do it here.
|
* the bus probe, do it here.
|
||||||
*/
|
*/
|
||||||
if ((!mdio_bus_data->irqs) &&
|
if (!mdio_bus_data->irqs &&
|
||||||
(mdio_bus_data->probed_phy_irq > 0)) {
|
(mdio_bus_data->probed_phy_irq > 0)) {
|
||||||
new_bus->irq[addr] =
|
new_bus->irq[addr] = mdio_bus_data->probed_phy_irq;
|
||||||
mdio_bus_data->probed_phy_irq;
|
|
||||||
phydev->irq = mdio_bus_data->probed_phy_irq;
|
phydev->irq = mdio_bus_data->probed_phy_irq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,12 +286,10 @@ int stmmac_mdio_register(struct net_device *ndev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n",
|
netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n",
|
||||||
phydev->phy_id, addr,
|
phydev->phy_id, addr, irq_str, phydev_name(phydev),
|
||||||
irq_str, phydev_name(phydev),
|
|
||||||
act ? " active" : "");
|
act ? " active" : "");
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!found && !mdio_node) {
|
if (!found && !mdio_node) {
|
||||||
netdev_warn(ndev, "No PHY found\n");
|
netdev_warn(ndev, "No PHY found\n");
|
||||||
|
|
Loading…
Reference in New Issue