1 --- a/drivers/net/arm/ixp4xx_eth.c
2 +++ b/drivers/net/arm/ixp4xx_eth.c
3 @@ -168,7 +168,7 @@ struct port {
4 struct desc *desc_tab; /* coherent */
6 int id; /* logical port ID */
8 + int link, speed, duplex;
12 @@ -365,37 +365,52 @@ static void ixp4xx_mdio_remove(void)
13 mdiobus_free(mdio_bus);
17 -static void ixp4xx_adjust_link(struct net_device *dev)
18 +static void ixp4xx_update_link(struct net_device *dev)
20 struct port *port = netdev_priv(dev);
21 - struct phy_device *phydev = port->phydev;
23 - if (!phydev->link) {
26 - printk(KERN_INFO "%s: link down\n", dev->name);
29 + netif_carrier_off(dev);
30 + printk(KERN_INFO "%s: link down\n", dev->name);
34 - if (port->speed == phydev->speed && port->duplex == phydev->duplex)
37 - port->speed = phydev->speed;
38 - port->duplex = phydev->duplex;
41 + if (port->duplex == DUPLEX_FULL)
42 __raw_writel(DEFAULT_TX_CNTRL0 & ~TX_CNTRL0_HALFDUPLEX,
43 &port->regs->tx_control[0]);
45 __raw_writel(DEFAULT_TX_CNTRL0 | TX_CNTRL0_HALFDUPLEX,
46 &port->regs->tx_control[0]);
48 + netif_carrier_on(dev);
49 printk(KERN_INFO "%s: link up, speed %u Mb/s, %s duplex\n",
50 dev->name, port->speed, port->duplex ? "full" : "half");
53 +static void ixp4xx_adjust_link(struct net_device *dev)
55 + struct port *port = netdev_priv(dev);
56 + struct phy_device *phydev = port->phydev;
57 + int status_change = 0;
60 + if (port->duplex != phydev->duplex
61 + || port->speed != phydev->speed) {
66 + if (phydev->link != port->link)
69 + port->link = phydev->link;
70 + port->speed = phydev->speed;
71 + port->duplex = phydev->duplex;
74 + ixp4xx_update_link(dev);
77 static int ixp4xx_phy_connect(struct net_device *dev)
79 struct port *port = netdev_priv(dev);
80 @@ -416,6 +431,10 @@ static int ixp4xx_phy_connect(struct net
82 port->phydev->irq = PHY_POLL;
88 printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy,
91 @@ -433,7 +452,6 @@ static void ixp4xx_phy_start(struct net_
93 struct port *port = netdev_priv(dev);
95 - port->speed = 0; /* force "link up" message */
96 phy_start(port->phydev);