[ar7] generate NA and non-NA images for Titan platforms
[openwrt.git] / target / linux / brcm47xx / patches-2.6.34 / 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 @@ -421,12 +421,45 @@ static inline void b44_wap54g10_workarou
13 }
14 #endif
15
16 +#ifdef CONFIG_SSB_DRIVER_MIPS
17 +static inline int startswith (const char *source, const char *cmp)
18 +{
19 + return !strncmp(source,cmp,strlen(cmp));
20 +}
21 +
22 +#define getvar(str) (nvram_get(str) ? : "")
23 +
24 +static inline void b44_bcm47xx_workarounds(struct b44 *bp)
25 +{
26 + /* Toshiba WRC-1000, Siemens SE505 v1, Askey RT-210W, RT-220W */
27 + if (simple_strtoul(getvar("boardnum"), NULL, 0) == 100) {
28 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
29 + } else {
30 + /* WL-HDD */
31 + struct ssb_device *sdev = bp->sdev;
32 + if (startswith(getvar("hardware_version"), "WL300-"))
33 + {
34 + if (sdev->bus->sprom.et0phyaddr == 0 &&
35 + sdev->bus->sprom.et1phyaddr == 1)
36 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
37 + }
38 + }
39 + return;
40 +}
41 +
42 +#else
43 +static inline void b44_bcm47xx_workarounds(struct b44 *bp)
44 +{
45 +}
46 +#endif
47 +
48 static int b44_setup_phy(struct b44 *bp)
49 {
50 u32 val;
51 int err;
52
53 b44_wap54g10_workaround(bp);
54 + b44_bcm47xx_workarounds(bp);
55
56 if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
57 return 0;
58 @@ -2089,6 +2122,8 @@ static int __devinit b44_get_invariants(
59 * valid PHY address. */
60 bp->phy_addr &= 0x1F;
61
62 + b44_bcm47xx_workarounds(bp);
63 +
64 memcpy(bp->dev->dev_addr, addr, 6);
65
66 if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){
This page took 0.053021 seconds and 5 git commands to generate.