package/mac80211: sync commit r22419
[openwrt.git] / package / broadcom-wl / patches / 910-fallback-sprom.patch
1 --- a/driver/bcmsrom.c
2 +++ b/driver/bcmsrom.c
3 @@ -39,6 +39,10 @@
4 #include <sbsdpcmdev.h>
5 #endif
6
7 +#ifdef CONFIG_SSB
8 +#include <linux/ssb/ssb.h>
9 +#endif
10 +
11 #ifdef WLTEST
12 #include <sbsprom.h>
13 #endif /* WLTEST */
14 @@ -2058,6 +2062,11 @@ BCMATTACHFN(initvars_srom_pci)(si_t *sih
15 bool flash = FALSE;
16 int err = 0;
17
18 +#ifdef CONFIG_SSB
19 + struct ssb_sprom *fbrom;
20 + char eabuf[18];
21 +#endif
22 +
23 /*
24 * Apply CRC over SROM content regardless SROM is present or not,
25 * and use variable <devpath>sromrev's existance in flash to decide
26 @@ -2120,6 +2129,62 @@ BCMATTACHFN(initvars_srom_pci)(si_t *sih
27 goto varscont;
28 }
29
30 +#ifdef CONFIG_SSB
31 + base = vp = MALLOC(osh, MAXSZ_NVRAM_VARS);
32 +
33 + if( base != NULL )
34 + {
35 + varbuf_init(&b, base, MAXSZ_NVRAM_VARS);
36 +
37 + /* Try to load ssb fallback sprom */
38 + if ((fbrom = ssb_get_fallback_sprom()) != NULL)
39 + {
40 + printk("Got version %i SPROM from SSB\n", fbrom->revision);
41 +
42 + varbuf_append(&b, vstr_sromrev, fbrom->revision);
43 + varbuf_append(&b, vstr_boardrev, fbrom->board_rev);
44 +
45 + /* ToDo: map fbrom->country_code */
46 + varbuf_append(&b, vstr_noccode);
47 +
48 + varbuf_append(&b, vstr_aa2g, fbrom->ant_available_bg);
49 +
50 + varbuf_append(&b, vstr_pa0b[0], fbrom->pa0b0);
51 + varbuf_append(&b, vstr_pa1b[0], fbrom->pa1b0);
52 + varbuf_append(&b, vstr_pa0b[1], fbrom->pa0b1);
53 + varbuf_append(&b, vstr_pa1b[1], fbrom->pa1b1);
54 + varbuf_append(&b, vstr_pa0b[2], fbrom->pa0b2);
55 + varbuf_append(&b, vstr_pa1b[2], fbrom->pa1b2);
56 +
57 + varbuf_append(&b, vstr_pa0maxpwr, fbrom->maxpwr_bg);
58 + varbuf_append(&b, vstr_pa0itssit, fbrom->itssi_bg);
59 +
60 + varbuf_append(&b, vstr_boardflags, (fbrom->boardflags_hi << 16) | fbrom->boardflags_lo);
61 + varbuf_append(&b, vstr_boardflags2, (fbrom->boardflags2_hi << 16) | fbrom->boardflags2_lo);
62 +
63 + snprintf(eabuf, sizeof(eabuf), "%02x:%02x:%02x:%02x:%02x:%02x",
64 + fbrom->il0mac[0], fbrom->il0mac[1], fbrom->il0mac[2],
65 + fbrom->il0mac[3], fbrom->il0mac[4], fbrom->il0mac[5]
66 + );
67 +
68 + varbuf_append(&b, vstr_macaddr, eabuf);
69 + }
70 +
71 + /* final nullbyte terminator */
72 + ASSERT(b.size >= 1);
73 + vp = b.buf;
74 + *vp++ = '\0';
75 +
76 + ASSERT((vp - base) <= MAXSZ_NVRAM_VARS);
77 + goto varsdone;
78 + }
79 + else
80 + {
81 + err = -2;
82 + goto errout;
83 + }
84 +#endif
85 +
86 BS_ERROR(("SROM CRC Error\n"));
87
88 #if defined(WLTEST)
This page took 0.044626 seconds and 5 git commands to generate.