1 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
2 +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
3 @@ -171,12 +171,13 @@ struct port {
5 struct net_device *netdev;
6 struct napi_struct napi;
7 + struct phy_device *phydev;
8 struct eth_plat_info *plat;
9 buffer_t *rx_buff_tab[RX_DESCS], *tx_buff_tab[TX_DESCS];
10 struct desc *desc_tab; /* coherent */
12 int id; /* logical port ID */
14 + int link, speed, duplex;
18 @@ -558,36 +559,46 @@ static void ixp4xx_mdio_remove(void)
22 -static void ixp4xx_adjust_link(struct net_device *dev)
23 +static void ixp4xx_update_link(struct net_device *dev)
25 struct port *port = netdev_priv(dev);
26 - struct phy_device *phydev = dev->phydev;
28 - if (!phydev->link) {
31 - printk(KERN_INFO "%s: link down\n", dev->name);
36 - if (port->speed == phydev->speed && port->duplex == phydev->duplex)
39 - port->speed = phydev->speed;
40 - port->duplex = phydev->duplex;
43 + if (port->duplex == DUPLEX_FULL)
44 __raw_writel(DEFAULT_TX_CNTRL0 & ~TX_CNTRL0_HALFDUPLEX,
45 &port->regs->tx_control[0]);
47 __raw_writel(DEFAULT_TX_CNTRL0 | TX_CNTRL0_HALFDUPLEX,
48 &port->regs->tx_control[0]);
50 + netif_carrier_on(dev);
51 printk(KERN_INFO "%s: link up, speed %u Mb/s, %s duplex\n",
52 dev->name, port->speed, port->duplex ? "full" : "half");
55 +static void ixp4xx_adjust_link(struct net_device *dev)
57 + struct port *port = netdev_priv(dev);
58 + struct phy_device *phydev = port->phydev;
59 + int status_change = 0;
62 + if (port->duplex != phydev->duplex
63 + || port->speed != phydev->speed) {
68 + if (phydev->link != port->link)
71 + port->link = phydev->link;
72 + port->speed = phydev->speed;
73 + port->duplex = phydev->duplex;
76 + ixp4xx_update_link(dev);
79 static int ixp4xx_phy_connect(struct net_device *dev)
81 struct port *port = netdev_priv(dev);
82 @@ -623,7 +634,6 @@ static void ixp4xx_phy_start(struct net_
84 struct port *port = netdev_priv(dev);
86 - port->speed = 0; /* force "link up" message */
87 phy_start(port->phydev);
90 @@ -1499,6 +1509,10 @@ static int eth_init_one(struct platform_
91 if ((err = register_netdev(dev)))
98 printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy,