diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2012-04-28 20:04:10 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-05-16 12:45:21 -0400 |
commit | bf7d420b4a3ea06d9638ec7f1b9d7971fa7f4f66 (patch) | |
tree | 78b03e4de848b3d2a2b62ee22391c3008ac553f3 /drivers/ssb | |
parent | a25595562291baea4ccc2ed570dd15c638b67b21 (diff) |
ssb/bcma: fill attribute alpha2 from sprom
The attribute country_code and alpha2 are two different attributes in
the sprom. country_code contains some code in an 8 bit coding and
alpha2 contains two chars with the country code. The attributes where
read out wrongly in the past and country_code is only available on
sprom version 1.
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/ssb')
-rw-r--r-- | drivers/ssb/pci.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c index 113208e0ae33..82589d447f85 100644 --- a/drivers/ssb/pci.c +++ b/drivers/ssb/pci.c | |||
@@ -360,8 +360,9 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in) | |||
360 | SPEX(et0mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0M, 14); | 360 | SPEX(et0mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0M, 14); |
361 | SPEX(et1mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1M, 15); | 361 | SPEX(et1mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1M, 15); |
362 | SPEX(board_rev, SSB_SPROM1_BINF, SSB_SPROM1_BINF_BREV, 0); | 362 | SPEX(board_rev, SSB_SPROM1_BINF, SSB_SPROM1_BINF_BREV, 0); |
363 | SPEX(country_code, SSB_SPROM1_BINF, SSB_SPROM1_BINF_CCODE, | 363 | if (out->revision == 1) |
364 | SSB_SPROM1_BINF_CCODE_SHIFT); | 364 | SPEX(country_code, SSB_SPROM1_BINF, SSB_SPROM1_BINF_CCODE, |
365 | SSB_SPROM1_BINF_CCODE_SHIFT); | ||
365 | SPEX(ant_available_a, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTA, | 366 | SPEX(ant_available_a, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTA, |
366 | SSB_SPROM1_BINF_ANTA_SHIFT); | 367 | SSB_SPROM1_BINF_ANTA_SHIFT); |
367 | SPEX(ant_available_bg, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTBG, | 368 | SPEX(ant_available_bg, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTBG, |
@@ -387,6 +388,8 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in) | |||
387 | SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0); | 388 | SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0); |
388 | if (out->revision >= 2) | 389 | if (out->revision >= 2) |
389 | SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0); | 390 | SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0); |
391 | SPEX(alpha2[0], SSB_SPROM1_CCODE, 0xff00, 8); | ||
392 | SPEX(alpha2[1], SSB_SPROM1_CCODE, 0x00ff, 0); | ||
390 | 393 | ||
391 | /* Extract the antenna gain values. */ | 394 | /* Extract the antenna gain values. */ |
392 | out->antenna_gain.a0 = r123_extract_antgain(out->revision, in, | 395 | out->antenna_gain.a0 = r123_extract_antgain(out->revision, in, |
@@ -456,13 +459,15 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) | |||
456 | SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A, | 459 | SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A, |
457 | SSB_SPROM4_ETHPHY_ET1A_SHIFT); | 460 | SSB_SPROM4_ETHPHY_ET1A_SHIFT); |
458 | if (out->revision == 4) { | 461 | if (out->revision == 4) { |
459 | SPEX(country_code, SSB_SPROM4_CCODE, 0xFFFF, 0); | 462 | SPEX(alpha2[0], SSB_SPROM4_CCODE, 0xff00, 8); |
463 | SPEX(alpha2[1], SSB_SPROM4_CCODE, 0x00ff, 0); | ||
460 | SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0); | 464 | SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0); |
461 | SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0); | 465 | SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0); |
462 | SPEX(boardflags2_lo, SSB_SPROM4_BFL2LO, 0xFFFF, 0); | 466 | SPEX(boardflags2_lo, SSB_SPROM4_BFL2LO, 0xFFFF, 0); |
463 | SPEX(boardflags2_hi, SSB_SPROM4_BFL2HI, 0xFFFF, 0); | 467 | SPEX(boardflags2_hi, SSB_SPROM4_BFL2HI, 0xFFFF, 0); |
464 | } else { | 468 | } else { |
465 | SPEX(country_code, SSB_SPROM5_CCODE, 0xFFFF, 0); | 469 | SPEX(alpha2[0], SSB_SPROM5_CCODE, 0xff00, 8); |
470 | SPEX(alpha2[1], SSB_SPROM5_CCODE, 0x00ff, 0); | ||
466 | SPEX(boardflags_lo, SSB_SPROM5_BFLLO, 0xFFFF, 0); | 471 | SPEX(boardflags_lo, SSB_SPROM5_BFLLO, 0xFFFF, 0); |
467 | SPEX(boardflags_hi, SSB_SPROM5_BFLHI, 0xFFFF, 0); | 472 | SPEX(boardflags_hi, SSB_SPROM5_BFLHI, 0xFFFF, 0); |
468 | SPEX(boardflags2_lo, SSB_SPROM5_BFL2LO, 0xFFFF, 0); | 473 | SPEX(boardflags2_lo, SSB_SPROM5_BFL2LO, 0xFFFF, 0); |
@@ -525,7 +530,8 @@ static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in) | |||
525 | v = in[SPOFF(SSB_SPROM8_IL0MAC) + i]; | 530 | v = in[SPOFF(SSB_SPROM8_IL0MAC) + i]; |
526 | *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); | 531 | *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); |
527 | } | 532 | } |
528 | SPEX(country_code, SSB_SPROM8_CCODE, 0xFFFF, 0); | 533 | SPEX(alpha2[0], SSB_SPROM8_CCODE, 0xff00, 8); |
534 | SPEX(alpha2[1], SSB_SPROM8_CCODE, 0x00ff, 0); | ||
529 | SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0); | 535 | SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0); |
530 | SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0xFFFF, 0); | 536 | SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0xFFFF, 0); |
531 | SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, 0xFFFF, 0); | 537 | SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, 0xFFFF, 0); |