omap24xx cbus: fix ioctls
[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 @@ -381,11 +381,12 @@ static void b44_set_flow_ctrl(struct b44
4 __b44_set_flow_ctrl(bp, pause_enab);
5 }
6
7 -#ifdef SSB_DRIVER_MIPS
8 -extern char *nvram_get(char *name);
9 +#ifdef CONFIG_BCM47XX
10 +
11 +#include <asm/mach-bcm47xx/nvram.h>
12 static void b44_wap54g10_workaround(struct b44 *bp)
13 {
14 - const char *str;
15 + char buf[20];
16 u32 val;
17 int err;
18
19 @@ -394,10 +395,9 @@ static void b44_wap54g10_workaround(stru
20 * see https://dev.openwrt.org/ticket/146
21 * check and reset bit "isolate"
22 */
23 - str = nvram_get("boardnum");
24 - if (!str)
25 + if (nvram_getenv("boardnum", buf, sizeof(buf)) > 0)
26 return;
27 - if (simple_strtoul(str, NULL, 0) == 2) {
28 + if (simple_strtoul(buf, NULL, 0) == 2) {
29 err = __b44_readphy(bp, 0, MII_BMCR, &val);
30 if (err)
31 goto error;
32 @@ -412,10 +412,43 @@ static void b44_wap54g10_workaround(stru
33 error:
34 pr_warning("PHY: cannot reset MII transceiver isolate bit\n");
35 }
36 +
37 +static inline int startswith (const char *source, const char *cmp)
38 +{
39 + return !strncmp(source,cmp,strlen(cmp));
40 +}
41 +
42 +static inline void b44_bcm47xx_workarounds(struct b44 *bp)
43 +{
44 + char buf[20];
45 + /* Toshiba WRC-1000, Siemens SE505 v1, Askey RT-210W, RT-220W */
46 + if (nvram_getenv("boardnum", buf, sizeof(buf)) > 0)
47 + return;
48 + if (simple_strtoul(buf, NULL, 0) == 100) {
49 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
50 + } else {
51 + /* WL-HDD */
52 + struct ssb_device *sdev = bp->sdev;
53 + if (nvram_getenv("hardware_version", buf, sizeof(buf)) > 0)
54 + return;
55 + if (startswith(buf, "WL300-")) {
56 + if (sdev->bus->sprom.et0phyaddr == 0 &&
57 + sdev->bus->sprom.et1phyaddr == 1)
58 + bp->phy_addr = B44_PHY_ADDR_NO_PHY;
59 + }
60 + }
61 + return;
62 +}
63 +
64 #else
65 +
66 static inline void b44_wap54g10_workaround(struct b44 *bp)
67 {
68 }
69 +
70 +static inline void b44_bcm47xx_workarounds(struct b44 *bp)
71 +{
72 +}
73 #endif
74
75 static int b44_setup_phy(struct b44 *bp)
76 @@ -424,6 +457,7 @@ static int b44_setup_phy(struct b44 *bp)
77 int err;
78
79 b44_wap54g10_workaround(bp);
80 + b44_bcm47xx_workarounds(bp);
81
82 if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
83 return 0;
84 @@ -2080,6 +2114,8 @@ static int __devinit b44_get_invariants(
85 * valid PHY address. */
86 bp->phy_addr &= 0x1F;
87
88 + b44_bcm47xx_workarounds(bp);
89 +
90 memcpy(bp->dev->dev_addr, addr, 6);
91
92 if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){
This page took 0.043342 seconds and 5 git commands to generate.