strip the kernel version suffix from target directories, except for brcm-2.4 (the...
[openwrt/openwrt.git] / target / linux / at91 / patches-2.6.22 / 010-dm9161a-phyfix.patch
1 --- linux-2.6.21.1/drivers/net/arm/at91_ether.c.old 2007-06-04 18:15:49.000000000 +0200
2 +++ linux-2.6.21.1/drivers/net/arm/at91_ether.c 2007-06-04 18:10:36.000000000 +0200
3 @@ -146,6 +146,7 @@
4 struct at91_private *lp = netdev_priv(dev);
5 unsigned int bmsr, bmcr, lpa, mac_cfg;
6 unsigned int speed, duplex;
7 + unsigned long timeout = jiffies + HZ;
8
9 if (!mii_link_ok(&lp->mii)) { /* no link */
10 netif_carrier_off(dev);
11 @@ -158,8 +159,15 @@
12 read_phy(lp->phy_address, MII_BMSR, &bmsr);
13 read_phy(lp->phy_address, MII_BMCR, &bmcr);
14 if (bmcr & BMCR_ANENABLE) { /* AutoNegotiation is enabled */
15 - if (!(bmsr & BMSR_ANEGCOMPLETE))
16 - return; /* Do nothing - another interrupt generated when negotiation complete */
17 + while (!(bmsr & BMSR_ANEGCOMPLETE)) {
18 + if (time_after(jiffies, timeout)) {
19 + printk("at91_ether: Auto-negotiate timeout\n");
20 + return;
21 + }
22 + read_phy(lp->phy_address, MII_BMSR, &bmsr);
23 + read_phy(lp->phy_address, MII_BMCR, &bmcr);
24 + cpu_relax();
25 + }
26
27 read_phy(lp->phy_address, MII_LPA, &lpa);
28 if ((lpa & LPA_100FULL) || (lpa & LPA_100HALF)) speed = SPEED_100;