f990b8534bd30545e543be49fd7cff63dfa6ed70
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-2.6.28 / 210-b44_phy_fix.patch
1 --- a/drivers/net/b44.c
2 +++ b/drivers/net/b44.c
3 @@ -384,7 +384,7 @@ static void b44_set_flow_ctrl(struct b44
4 __b44_set_flow_ctrl(bp, pause_enab);
5 }
6
7 -#ifdef SSB_DRIVER_MIPS
8 +#ifdef CONFIG_SSB_DRIVER_MIPS
9 extern char *nvram_get(char *name);
10 static void b44_wap54g10_workaround(struct b44 *bp)
11 {
12 @@ -2068,6 +2068,28 @@ out:
13 return err;
14 }
15
16 +#ifdef CONFIG_SSB_DRIVER_MIPS
17 +static void b44_wrtsl54gs_workaround(struct b44 *bp)
18 +{
19 + const char *str;
20 +
21 + /*
22 + * workaround for physical wiring in Linksys WRSL54GS
23 + * see https://dev.openwrt.org/ticket/2662 and 3903
24 + * eth1 PHY is probably on BCM5325 switch accessed via eth0
25 + */
26 + str = nvram_get("boardnum");
27 + if (!str)
28 + return;
29 + if (simple_strtoul(str, NULL, 0) == 42) {
30 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
31 + }
32 + return;
33 +}
34 +#else
35 +static void b44_wrtsl54gs_workaround(struct b44 *bp) { }
36 +#endif
37 +
38 static int __devinit b44_get_invariants(struct b44 *bp)
39 {
40 struct ssb_device *sdev = bp->sdev;
41 @@ -2089,6 +2111,8 @@ static int __devinit b44_get_invariants(
42 * valid PHY address. */
43 bp->phy_addr &= 0x1F;
44
45 + b44_wrtsl54gs_workaround(bp);
46 +
47 memcpy(bp->dev->dev_addr, addr, 6);
48
49 if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){