brcm47xx: add initial support for kernel 3.8
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.8 / 210-b44_phy_fix.patch
1 --- a/drivers/net/ethernet/broadcom/b44.c
2 +++ b/drivers/net/ethernet/broadcom/b44.c
3 @@ -410,10 +410,34 @@ static void b44_wap54g10_workaround(stru
4 error:
5 pr_warning("PHY: cannot reset MII transceiver isolate bit\n");
6 }
7 +
8 +static void b44_bcm47xx_workarounds(struct b44 *bp)
9 +{
10 + char buf[20];
11 + struct ssb_device *sdev = bp->sdev;
12 +
13 + /* Toshiba WRC-1000, Siemens SE505 v1, Askey RT-210W, RT-220W */
14 + if (sdev->bus->sprom.board_num == 100) {
15 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
16 + } else {
17 + /* WL-HDD */
18 + if (bcm47xx_nvram_getenv("hardware_version", buf, sizeof(buf)) >= 0 &&
19 + !strncmp(buf, "WL300-", strlen("WL300-"))) {
20 + if (sdev->bus->sprom.et0phyaddr == 0 &&
21 + sdev->bus->sprom.et1phyaddr == 1)
22 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
23 + }
24 + }
25 + return;
26 +}
27 #else
28 static inline void b44_wap54g10_workaround(struct b44 *bp)
29 {
30 }
31 +
32 +static inline void b44_bcm47xx_workarounds(struct b44 *bp)
33 +{
34 +}
35 #endif
36
37 static int b44_setup_phy(struct b44 *bp)
38 @@ -422,6 +446,7 @@ static int b44_setup_phy(struct b44 *bp)
39 int err;
40
41 b44_wap54g10_workaround(bp);
42 + b44_bcm47xx_workarounds(bp);
43
44 if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
45 return 0;
46 @@ -2104,6 +2129,8 @@ static int b44_get_invariants(struct b44
47 * valid PHY address. */
48 bp->phy_addr &= 0x1F;
49
50 + b44_bcm47xx_workarounds(bp);
51 +
52 memcpy(bp->dev->dev_addr, addr, 6);
53
54 if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){