diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2014-07-15 10:18:57 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-07-18 13:45:24 -0400 |
commit | 6ad59343ecd72dd3f83c4db3bcddbb0beabb4c4c (patch) | |
tree | fb55cc9354e5bee07815ce73f042ed911e2e065d /drivers/ssb | |
parent | 72269146afabf1656f867f715f40a7dd470499fb (diff) |
ssb: extract power info from SPROM revs 4 and 5
This is needed to properly handle early 802.11n devices like BCM4321.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb')
-rw-r--r-- | drivers/ssb/pci.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c index 6318364be590..0f28c08fcb3c 100644 --- a/drivers/ssb/pci.c +++ b/drivers/ssb/pci.c | |||
@@ -470,7 +470,15 @@ static void sprom_extract_r458(struct ssb_sprom *out, const u16 *in) | |||
470 | 470 | ||
471 | static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) | 471 | static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) |
472 | { | 472 | { |
473 | static const u16 pwr_info_offset[] = { | ||
474 | SSB_SPROM4_PWR_INFO_CORE0, SSB_SPROM4_PWR_INFO_CORE1, | ||
475 | SSB_SPROM4_PWR_INFO_CORE2, SSB_SPROM4_PWR_INFO_CORE3 | ||
476 | }; | ||
473 | u16 il0mac_offset; | 477 | u16 il0mac_offset; |
478 | int i; | ||
479 | |||
480 | BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) != | ||
481 | ARRAY_SIZE(out->core_pwr_info)); | ||
474 | 482 | ||
475 | if (out->revision == 4) | 483 | if (out->revision == 4) |
476 | il0mac_offset = SSB_SPROM4_IL0MAC; | 484 | il0mac_offset = SSB_SPROM4_IL0MAC; |
@@ -543,6 +551,43 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) | |||
543 | SSB_SPROM4_AGAIN3, | 551 | SSB_SPROM4_AGAIN3, |
544 | SSB_SPROM4_AGAIN3_SHIFT); | 552 | SSB_SPROM4_AGAIN3_SHIFT); |
545 | 553 | ||
554 | /* Extract cores power info info */ | ||
555 | for (i = 0; i < ARRAY_SIZE(pwr_info_offset); i++) { | ||
556 | u16 o = pwr_info_offset[i]; | ||
557 | |||
558 | SPEX(core_pwr_info[i].itssi_2g, o + SSB_SPROM4_2G_MAXP_ITSSI, | ||
559 | SSB_SPROM4_2G_ITSSI, SSB_SPROM4_2G_ITSSI_SHIFT); | ||
560 | SPEX(core_pwr_info[i].maxpwr_2g, o + SSB_SPROM4_2G_MAXP_ITSSI, | ||
561 | SSB_SPROM4_2G_MAXP, 0); | ||
562 | |||
563 | SPEX(core_pwr_info[i].pa_2g[0], o + SSB_SPROM4_2G_PA_0, ~0, 0); | ||
564 | SPEX(core_pwr_info[i].pa_2g[1], o + SSB_SPROM4_2G_PA_1, ~0, 0); | ||
565 | SPEX(core_pwr_info[i].pa_2g[2], o + SSB_SPROM4_2G_PA_2, ~0, 0); | ||
566 | SPEX(core_pwr_info[i].pa_2g[3], o + SSB_SPROM4_2G_PA_3, ~0, 0); | ||
567 | |||
568 | SPEX(core_pwr_info[i].itssi_5g, o + SSB_SPROM4_5G_MAXP_ITSSI, | ||
569 | SSB_SPROM4_5G_ITSSI, SSB_SPROM4_5G_ITSSI_SHIFT); | ||
570 | SPEX(core_pwr_info[i].maxpwr_5g, o + SSB_SPROM4_5G_MAXP_ITSSI, | ||
571 | SSB_SPROM4_5G_MAXP, 0); | ||
572 | SPEX(core_pwr_info[i].maxpwr_5gh, o + SSB_SPROM4_5GHL_MAXP, | ||
573 | SSB_SPROM4_5GH_MAXP, 0); | ||
574 | SPEX(core_pwr_info[i].maxpwr_5gl, o + SSB_SPROM4_5GHL_MAXP, | ||
575 | SSB_SPROM4_5GL_MAXP, SSB_SPROM4_5GL_MAXP_SHIFT); | ||
576 | |||
577 | SPEX(core_pwr_info[i].pa_5gl[0], o + SSB_SPROM4_5GL_PA_0, ~0, 0); | ||
578 | SPEX(core_pwr_info[i].pa_5gl[1], o + SSB_SPROM4_5GL_PA_1, ~0, 0); | ||
579 | SPEX(core_pwr_info[i].pa_5gl[2], o + SSB_SPROM4_5GL_PA_2, ~0, 0); | ||
580 | SPEX(core_pwr_info[i].pa_5gl[3], o + SSB_SPROM4_5GL_PA_3, ~0, 0); | ||
581 | SPEX(core_pwr_info[i].pa_5g[0], o + SSB_SPROM4_5G_PA_0, ~0, 0); | ||
582 | SPEX(core_pwr_info[i].pa_5g[1], o + SSB_SPROM4_5G_PA_1, ~0, 0); | ||
583 | SPEX(core_pwr_info[i].pa_5g[2], o + SSB_SPROM4_5G_PA_2, ~0, 0); | ||
584 | SPEX(core_pwr_info[i].pa_5g[3], o + SSB_SPROM4_5G_PA_3, ~0, 0); | ||
585 | SPEX(core_pwr_info[i].pa_5gh[0], o + SSB_SPROM4_5GH_PA_0, ~0, 0); | ||
586 | SPEX(core_pwr_info[i].pa_5gh[1], o + SSB_SPROM4_5GH_PA_1, ~0, 0); | ||
587 | SPEX(core_pwr_info[i].pa_5gh[2], o + SSB_SPROM4_5GH_PA_2, ~0, 0); | ||
588 | SPEX(core_pwr_info[i].pa_5gh[3], o + SSB_SPROM4_5GH_PA_3, ~0, 0); | ||
589 | } | ||
590 | |||
546 | sprom_extract_r458(out, in); | 591 | sprom_extract_r458(out, in); |
547 | 592 | ||
548 | /* TODO - get remaining rev 4 stuff needed */ | 593 | /* TODO - get remaining rev 4 stuff needed */ |