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