ath9k: merge a pending aggregation fix
[openwrt.git] / package / broadcom-wl / patches / 910-fallback-sprom.patch
1 --- a/driver/bcmsrom.c
2 +++ b/driver/bcmsrom.c
3 @@ -39,6 +39,11 @@
4 #include <sbsdpcmdev.h>
5 #endif
6
7 +#if defined(CONFIG_SSB_PCIHOST) && defined(CONFIG_BOARD_BCM963XX)
8 +#include <linux/ssb/ssb.h>
9 +extern struct ssb_sprom bcm63xx_sprom;
10 +#endif
11 +
12 #ifdef WLTEST
13 #include <sbsprom.h>
14 #endif /* WLTEST */
15 @@ -2058,6 +2063,10 @@ BCMATTACHFN(initvars_srom_pci)(si_t *sih
16 bool flash = FALSE;
17 int err = 0;
18
19 +#if defined(CONFIG_SSB_PCIHOST) && defined(CONFIG_BOARD_BCM963XX)
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,58 @@ BCMATTACHFN(initvars_srom_pci)(si_t *sih
27 goto varscont;
28 }
29
30 +#if defined(CONFIG_SSB_PCIHOST) && defined(CONFIG_BOARD_BCM963XX)
31 + base = vp = MALLOC(osh, MAXSZ_NVRAM_VARS);
32 +
33 + if( base != NULL )
34 + {
35 + varbuf_init(&b, base, MAXSZ_NVRAM_VARS);
36 +
37 + printk("Got version %i SPROM from SSB\n", bcm63xx_sprom.revision);
38 +
39 + varbuf_append(&b, vstr_sromrev, bcm63xx_sprom.revision);
40 + varbuf_append(&b, vstr_boardrev, bcm63xx_sprom.board_rev);
41 +
42 + /* ToDo: map bcm63xx_sprom.country_code */
43 + varbuf_append(&b, vstr_noccode);
44 +
45 + varbuf_append(&b, vstr_aa2g, bcm63xx_sprom.ant_available_bg);
46 +
47 + varbuf_append(&b, vstr_pa0b[0], bcm63xx_sprom.pa0b0);
48 + varbuf_append(&b, vstr_pa1b[0], bcm63xx_sprom.pa1b0);
49 + varbuf_append(&b, vstr_pa0b[1], bcm63xx_sprom.pa0b1);
50 + varbuf_append(&b, vstr_pa1b[1], bcm63xx_sprom.pa1b1);
51 + varbuf_append(&b, vstr_pa0b[2], bcm63xx_sprom.pa0b2);
52 + varbuf_append(&b, vstr_pa1b[2], bcm63xx_sprom.pa1b2);
53 +
54 + varbuf_append(&b, vstr_pa0maxpwr, bcm63xx_sprom.maxpwr_bg);
55 + varbuf_append(&b, vstr_pa0itssit, bcm63xx_sprom.itssi_bg);
56 +
57 + varbuf_append(&b, vstr_boardflags, (bcm63xx_sprom.boardflags_hi << 16) | bcm63xx_sprom.boardflags_lo);
58 + varbuf_append(&b, vstr_boardflags2, (bcm63xx_sprom.boardflags2_hi << 16) | bcm63xx_sprom.boardflags2_lo);
59 +
60 + snprintf(eabuf, sizeof(eabuf), "%02x:%02x:%02x:%02x:%02x:%02x",
61 + bcm63xx_sprom.il0mac[0], bcm63xx_sprom.il0mac[1], bcm63xx_sprom.il0mac[2],
62 + bcm63xx_sprom.il0mac[3], bcm63xx_sprom.il0mac[4], bcm63xx_sprom.il0mac[5]
63 + );
64 +
65 + varbuf_append(&b, vstr_macaddr, eabuf);
66 +
67 + /* final nullbyte terminator */
68 + ASSERT(b.size >= 1);
69 + vp = b.buf;
70 + *vp++ = '\0';
71 +
72 + ASSERT((vp - base) <= MAXSZ_NVRAM_VARS);
73 + goto varsdone;
74 + }
75 + else
76 + {
77 + err = -2;
78 + goto errout;
79 + }
80 +#endif
81 +
82 BS_ERROR(("SROM CRC Error\n"));
83
84 #if defined(WLTEST)
This page took 0.04365 seconds and 5 git commands to generate.