add Avila/Cambria latch LED support, thanks Chris
[openwrt.git] / target / linux / ixp4xx / patches-2.6.24 / 203-npe_driver_phy_reset_autoneg.patch
1 Index: linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c
2 ===================================================================
3 --- linux-2.6.24.7.orig/drivers/net/arm/ixp4xx_eth.c
4 +++ linux-2.6.24.7/drivers/net/arm/ixp4xx_eth.c
5 @@ -322,8 +322,12 @@ static void phy_reset(struct net_device
6 struct port *port = netdev_priv(dev);
7 int phy_id = port->mii[idx].phy_id;
8 int cycles = 0;
9 + u16 bmcr;
10
11 - mdio_write(dev, phy_id, MII_BMCR, port->mii_bmcr[idx] | BMCR_RESET);
12 + /* reset the PHY */
13 + bmcr = mdio_read(dev, phy_id, MII_BMCR);
14 + bmcr |= BMCR_ANENABLE;
15 + mdio_write(dev, phy_id, MII_BMCR, bmcr | BMCR_RESET);
16
17 while (cycles < MAX_MII_RESET_RETRIES) {
18 if (!(mdio_read(dev, phy_id, MII_BMCR) & BMCR_RESET)) {
19 @@ -331,13 +335,23 @@ static void phy_reset(struct net_device
20 printk(KERN_DEBUG "%s: phy_reset() took %i cycles\n",
21 dev->name, cycles);
22 #endif
23 - return;
24 + break;
25 }
26 udelay(1);
27 cycles++;
28 }
29
30 - printk(KERN_ERR "%s: MII reset failed on PHY%2d\n", dev->name, phy_id);
31 + if (cycles == MAX_MII_RESET_RETRIES) {
32 + printk(KERN_ERR "%s: MII reset failed on PHY%2d\n", dev->name,
33 + phy_id);
34 + return;
35 + }
36 +
37 + /* restart auto negotiation */
38 + bmcr = mdio_read(dev, phy_id, MII_BMCR);
39 + bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
40 + mdio_write(dev, phy_id, MII_BMCR, bmcr);
41 +
42 }
43
44 static void eth_set_duplex(struct port *port, int full_duplex)
This page took 0.046286 seconds and 5 git commands to generate.