Added in sub endpoint size patch
[openwrt-10.03/.git] / target / linux / at91 / patches-2.6.25 / 010-dm9161a-phyfix.patch
1 Index: linux-2.6.22.19/drivers/net/arm/at91_ether.c
2 ===================================================================
3 --- linux-2.6.22.19.orig/drivers/net/arm/at91_ether.c
4 +++ linux-2.6.22.19/drivers/net/arm/at91_ether.c
5 @@ -146,6 +146,7 @@ static void update_linkspeed(struct net_
6         struct at91_private *lp = netdev_priv(dev);
7         unsigned int bmsr, bmcr, lpa, mac_cfg;
8         unsigned int speed, duplex;
9 +       unsigned long timeout = jiffies + HZ;
10  
11         if (!mii_link_ok(&lp->mii)) {           /* no link */
12                 netif_carrier_off(dev);
13 @@ -158,8 +159,15 @@ static void update_linkspeed(struct net_
14         read_phy(lp->phy_address, MII_BMSR, &bmsr);
15         read_phy(lp->phy_address, MII_BMCR, &bmcr);
16         if (bmcr & BMCR_ANENABLE) {                             /* AutoNegotiation is enabled */
17 -               if (!(bmsr & BMSR_ANEGCOMPLETE))
18 -                       return;                 /* Do nothing - another interrupt generated when negotiation complete */
19 +               while (!(bmsr & BMSR_ANEGCOMPLETE)) {
20 +                       if (time_after(jiffies, timeout)) {
21 +                               printk("at91_ether: Auto-negotiate timeout\n");
22 +                               return;
23 +                       }
24 +                       read_phy(lp->phy_address, MII_BMSR, &bmsr);
25 +                       read_phy(lp->phy_address, MII_BMCR, &bmcr);
26 +                       cpu_relax();
27 +               }
28  
29                 read_phy(lp->phy_address, MII_LPA, &lpa);
30                 if ((lpa & LPA_100FULL) || (lpa & LPA_100HALF)) speed = SPEED_100;