diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2012-04-28 20:04:12 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-05-16 12:45:21 -0400 |
commit | 432c4d1eef64fc4c57faf713f361a96e58e66c72 (patch) | |
tree | ff5bdbe808782f85a6a1c9bf5475e74c2c94dfd9 /drivers/bcma | |
parent | 673335c8f0c24912d57abf9b8cd10c9d91ff1a40 (diff) |
bcma: read out some additional sprom attributes
This code is copied from the ssb sprom read code. These attributes are
partly used by b43 and brcmsmac and should also be read out on bcma
based devices.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r-- | drivers/bcma/sprom.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index 1799372131d2..22c99683a180 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c | |||
@@ -181,6 +181,10 @@ static int bcma_sprom_valid(const u16 *sprom) | |||
181 | #define SPEX(_field, _offset, _mask, _shift) \ | 181 | #define SPEX(_field, _offset, _mask, _shift) \ |
182 | bus->sprom._field = ((sprom[SPOFF(_offset)] & (_mask)) >> (_shift)) | 182 | bus->sprom._field = ((sprom[SPOFF(_offset)] & (_mask)) >> (_shift)) |
183 | 183 | ||
184 | #define SPEX32(_field, _offset, _mask, _shift) \ | ||
185 | bus->sprom._field = ((((u32)sprom[SPOFF((_offset)+2)] << 16 | \ | ||
186 | sprom[SPOFF(_offset)]) & (_mask)) >> (_shift)) | ||
187 | |||
184 | static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) | 188 | static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) |
185 | { | 189 | { |
186 | u16 v, o; | 190 | u16 v, o; |
@@ -299,6 +303,78 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) | |||
299 | SSB_SROM8_FEM_TR_ISO_SHIFT); | 303 | SSB_SROM8_FEM_TR_ISO_SHIFT); |
300 | SPEX(fem.ghz5.antswlut, SSB_SPROM8_FEM5G, SSB_SROM8_FEM_ANTSWLUT, | 304 | SPEX(fem.ghz5.antswlut, SSB_SPROM8_FEM5G, SSB_SROM8_FEM_ANTSWLUT, |
301 | SSB_SROM8_FEM_ANTSWLUT_SHIFT); | 305 | SSB_SROM8_FEM_ANTSWLUT_SHIFT); |
306 | |||
307 | SPEX(ant_available_a, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_A, | ||
308 | SSB_SPROM8_ANTAVAIL_A_SHIFT); | ||
309 | SPEX(ant_available_bg, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_BG, | ||
310 | SSB_SPROM8_ANTAVAIL_BG_SHIFT); | ||
311 | SPEX(maxpwr_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_MAXP_BG_MASK, 0); | ||
312 | SPEX(itssi_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_ITSSI_BG, | ||
313 | SSB_SPROM8_ITSSI_BG_SHIFT); | ||
314 | SPEX(maxpwr_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_MAXP_A_MASK, 0); | ||
315 | SPEX(itssi_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_ITSSI_A, | ||
316 | SSB_SPROM8_ITSSI_A_SHIFT); | ||
317 | SPEX(maxpwr_ah, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AH_MASK, 0); | ||
318 | SPEX(maxpwr_al, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AL_MASK, | ||
319 | SSB_SPROM8_MAXP_AL_SHIFT); | ||
320 | SPEX(gpio0, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P0, 0); | ||
321 | SPEX(gpio1, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P1, | ||
322 | SSB_SPROM8_GPIOA_P1_SHIFT); | ||
323 | SPEX(gpio2, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P2, 0); | ||
324 | SPEX(gpio3, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P3, | ||
325 | SSB_SPROM8_GPIOB_P3_SHIFT); | ||
326 | SPEX(tri2g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI2G, 0); | ||
327 | SPEX(tri5g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI5G, | ||
328 | SSB_SPROM8_TRI5G_SHIFT); | ||
329 | SPEX(tri5gl, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GL, 0); | ||
330 | SPEX(tri5gh, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GH, | ||
331 | SSB_SPROM8_TRI5GH_SHIFT); | ||
332 | SPEX(rxpo2g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO2G, | ||
333 | SSB_SPROM8_RXPO2G_SHIFT); | ||
334 | SPEX(rxpo5g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO5G, | ||
335 | SSB_SPROM8_RXPO5G_SHIFT); | ||
336 | SPEX(rssismf2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMF2G, 0); | ||
337 | SPEX(rssismc2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMC2G, | ||
338 | SSB_SPROM8_RSSISMC2G_SHIFT); | ||
339 | SPEX(rssisav2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISAV2G, | ||
340 | SSB_SPROM8_RSSISAV2G_SHIFT); | ||
341 | SPEX(bxa2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_BXA2G, | ||
342 | SSB_SPROM8_BXA2G_SHIFT); | ||
343 | SPEX(rssismf5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMF5G, 0); | ||
344 | SPEX(rssismc5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMC5G, | ||
345 | SSB_SPROM8_RSSISMC5G_SHIFT); | ||
346 | SPEX(rssisav5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISAV5G, | ||
347 | SSB_SPROM8_RSSISAV5G_SHIFT); | ||
348 | SPEX(bxa5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_BXA5G, | ||
349 | SSB_SPROM8_BXA5G_SHIFT); | ||
350 | |||
351 | SPEX(pa0b0, SSB_SPROM8_PA0B0, ~0, 0); | ||
352 | SPEX(pa0b1, SSB_SPROM8_PA0B1, ~0, 0); | ||
353 | SPEX(pa0b2, SSB_SPROM8_PA0B2, ~0, 0); | ||
354 | SPEX(pa1b0, SSB_SPROM8_PA1B0, ~0, 0); | ||
355 | SPEX(pa1b1, SSB_SPROM8_PA1B1, ~0, 0); | ||
356 | SPEX(pa1b2, SSB_SPROM8_PA1B2, ~0, 0); | ||
357 | SPEX(pa1lob0, SSB_SPROM8_PA1LOB0, ~0, 0); | ||
358 | SPEX(pa1lob1, SSB_SPROM8_PA1LOB1, ~0, 0); | ||
359 | SPEX(pa1lob2, SSB_SPROM8_PA1LOB2, ~0, 0); | ||
360 | SPEX(pa1hib0, SSB_SPROM8_PA1HIB0, ~0, 0); | ||
361 | SPEX(pa1hib1, SSB_SPROM8_PA1HIB1, ~0, 0); | ||
362 | SPEX(pa1hib2, SSB_SPROM8_PA1HIB2, ~0, 0); | ||
363 | SPEX(cck2gpo, SSB_SPROM8_CCK2GPO, ~0, 0); | ||
364 | SPEX32(ofdm2gpo, SSB_SPROM8_OFDM2GPO, ~0, 0); | ||
365 | SPEX32(ofdm5glpo, SSB_SPROM8_OFDM5GLPO, ~0, 0); | ||
366 | SPEX32(ofdm5gpo, SSB_SPROM8_OFDM5GPO, ~0, 0); | ||
367 | SPEX32(ofdm5ghpo, SSB_SPROM8_OFDM5GHPO, ~0, 0); | ||
368 | |||
369 | /* Extract the antenna gain values. */ | ||
370 | SPEX(antenna_gain.a0, SSB_SPROM8_AGAIN01, | ||
371 | SSB_SPROM8_AGAIN0, SSB_SPROM8_AGAIN0_SHIFT); | ||
372 | SPEX(antenna_gain.a1, SSB_SPROM8_AGAIN01, | ||
373 | SSB_SPROM8_AGAIN1, SSB_SPROM8_AGAIN1_SHIFT); | ||
374 | SPEX(antenna_gain.a2, SSB_SPROM8_AGAIN23, | ||
375 | SSB_SPROM8_AGAIN2, SSB_SPROM8_AGAIN2_SHIFT); | ||
376 | SPEX(antenna_gain.a3, SSB_SPROM8_AGAIN23, | ||
377 | SSB_SPROM8_AGAIN3, SSB_SPROM8_AGAIN3_SHIFT); | ||
302 | } | 378 | } |
303 | 379 | ||
304 | /* | 380 | /* |