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