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