ip17xx: fix autonegotioation issues
[openwrt.git] / target / linux / brcm47xx / patches-2.6.33 / 210-b44_phy_fix.patch
1 --- a/drivers/net/b44.c
2 +++ b/drivers/net/b44.c
3 @@ -339,7 +339,7 @@ static int b44_phy_reset(struct b44 *bp)
4 }
5 }
6
7 - return 0;
8 + return err;
9 }
10
11 static void __b44_set_flow_ctrl(struct b44 *bp, u32 pause_flags)
12 @@ -384,7 +384,7 @@ static void b44_set_flow_ctrl(struct b44
13 __b44_set_flow_ctrl(bp, pause_enab);
14 }
15
16 -#ifdef SSB_DRIVER_MIPS
17 +#ifdef CONFIG_SSB_DRIVER_MIPS
18 extern char *nvram_get(char *name);
19 static void b44_wap54g10_workaround(struct b44 *bp)
20 {
21 @@ -421,12 +421,45 @@ static inline void b44_wap54g10_workarou
22 }
23 #endif
24
25 +#ifdef CONFIG_SSB_DRIVER_MIPS
26 +static inline int startswith (const char *source, const char *cmp)
27 +{
28 + return !strncmp(source,cmp,strlen(cmp));
29 +}
30 +
31 +#define getvar(str) (nvram_get(str) ? : "")
32 +
33 +static inline void b44_bcm47xx_workarounds(struct b44 *bp)
34 +{
35 + /* Toshiba WRC-1000, Siemens SE505 v1, Askey RT-210W, RT-220W */
36 + if (simple_strtoul(getvar("boardnum"), NULL, 0) == 100) {
37 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
38 + } else {
39 + /* WL-HDD */
40 + struct ssb_device *sdev = bp->sdev;
41 + if (startswith(getvar("hardware_version"), "WL300-"))
42 + {
43 + if (sdev->bus->sprom.et0phyaddr == 0 &&
44 + sdev->bus->sprom.et1phyaddr == 1)
45 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
46 + }
47 + }
48 + return;
49 +}
50 +
51 +#else
52 +static inline void b44_bcm47xx_workarounds(struct b44 *bp)
53 +{
54 +}
55 +#endif
56 +
57 static int b44_setup_phy(struct b44 *bp)
58 {
59 u32 val;
60 int err;
61
62 b44_wap54g10_workaround(bp);
63 + b44_bcm47xx_workarounds(bp);
64
65 if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
66 return 0;
67 @@ -2094,6 +2127,8 @@ static int __devinit b44_get_invariants(
68 * valid PHY address. */
69 bp->phy_addr &= 0x1F;
70
71 + b44_bcm47xx_workarounds(bp);
72 +
73 memcpy(bp->dev->dev_addr, addr, 6);
74
75 if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){
76 @@ -2223,6 +2258,10 @@ static int __devinit b44_init_one(struct
77 */
78 b44_chip_reset(bp, B44_CHIP_RESET_FULL);
79
80 + /* do a phy reset to test if there is an active phy */
81 + if (b44_phy_reset(bp) < 0)
82 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
83 +
84 printk(KERN_INFO "%s: Broadcom 44xx/47xx 10/100BaseT Ethernet %pM\n",
85 dev->name, dev->dev_addr);
86
This page took 0.042358 seconds and 5 git commands to generate.