aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2013-03-27 12:26:05 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-03-27 13:39:09 -0400
commit689b66cb53fbb5d567aa4e095eaa828aff73aef0 (patch)
tree5cea5d1c0403ec1a75f0da0c87c834f4432d5706 /drivers
parentca84a6c5fb9306d6c8973b662bc93338dcb84ac7 (diff)
brcmsmac: remove some pmu functions and use the bcma equivalents
This removes the following functions: si_pmu_chipcontrol() => bcma_chipco_chipctl_maskset() si_pmu_regcontrol() => bcma_chipco_regctl_maskset() si_pmu_pllcontrol() => bcma_chipco_pll_maskset() si_pmu_pllupd() => bcma_cc_set32() si_pmu_alp_clock() => bcma_chipco_get_alp_clock() This also removed the sih member from struct shared_phy. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c40
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h1
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c35
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c14
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/pmu.c54
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/pmu.h6
6 files changed, 43 insertions, 107 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
index 91937c5025ce..b0fd807f2b2b 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -198,8 +198,6 @@ u16 read_radio_reg(struct brcms_phy *pi, u16 addr)
198 198
199void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val) 199void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
200{ 200{
201 struct si_info *sii = container_of(pi->sh->sih, struct si_info, pub);
202
203 if ((D11REV_GE(pi->sh->corerev, 24)) || 201 if ((D11REV_GE(pi->sh->corerev, 24)) ||
204 (D11REV_IS(pi->sh->corerev, 22) 202 (D11REV_IS(pi->sh->corerev, 22)
205 && (pi->pubpi.phy_type != PHY_TYPE_SSN))) { 203 && (pi->pubpi.phy_type != PHY_TYPE_SSN))) {
@@ -211,7 +209,7 @@ void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
211 bcma_write16(pi->d11core, D11REGOFFS(phy4wdatalo), val); 209 bcma_write16(pi->d11core, D11REGOFFS(phy4wdatalo), val);
212 } 210 }
213 211
214 if ((sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) && 212 if ((pi->d11core->bus->hosttype == BCMA_HOSTTYPE_PCI) &&
215 (++pi->phy_wreg >= pi->phy_wreg_limit)) { 213 (++pi->phy_wreg >= pi->phy_wreg_limit)) {
216 (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); 214 (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol));
217 pi->phy_wreg = 0; 215 pi->phy_wreg = 0;
@@ -297,10 +295,8 @@ void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
297 if (addr == 0x72) 295 if (addr == 0x72)
298 (void)bcma_read16(pi->d11core, D11REGOFFS(phyregdata)); 296 (void)bcma_read16(pi->d11core, D11REGOFFS(phyregdata));
299#else 297#else
300 struct si_info *sii = container_of(pi->sh->sih, struct si_info, pub);
301
302 bcma_write32(pi->d11core, D11REGOFFS(phyregaddr), addr | (val << 16)); 298 bcma_write32(pi->d11core, D11REGOFFS(phyregaddr), addr | (val << 16));
303 if ((sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) && 299 if ((pi->d11core->bus->hosttype == BCMA_HOSTTYPE_PCI) &&
304 (++pi->phy_wreg >= pi->phy_wreg_limit)) { 300 (++pi->phy_wreg >= pi->phy_wreg_limit)) {
305 pi->phy_wreg = 0; 301 pi->phy_wreg = 0;
306 (void)bcma_read16(pi->d11core, D11REGOFFS(phyversion)); 302 (void)bcma_read16(pi->d11core, D11REGOFFS(phyversion));
@@ -374,7 +370,6 @@ struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp)
374 if (sh == NULL) 370 if (sh == NULL)
375 return NULL; 371 return NULL;
376 372
377 sh->sih = shp->sih;
378 sh->physhim = shp->physhim; 373 sh->physhim = shp->physhim;
379 sh->unit = shp->unit; 374 sh->unit = shp->unit;
380 sh->corerev = shp->corerev; 375 sh->corerev = shp->corerev;
@@ -2911,29 +2906,24 @@ void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode)
2911 mod_phy_reg(pi, 0x44c, (0x1 << 2), (1) << 2); 2906 mod_phy_reg(pi, 0x44c, (0x1 << 2), (1) << 2);
2912 2907
2913 } 2908 }
2914 ai_cc_reg(pi->sh->sih, 2909
2915 offsetof(struct chipcregs, gpiocontrol), 2910 bcma_chipco_gpio_control(&pi->d11core->bus->drv_cc,
2916 ~0x0, 0x0); 2911 0x0, 0x0);
2917 ai_cc_reg(pi->sh->sih, 2912 bcma_chipco_gpio_out(&pi->d11core->bus->drv_cc,
2918 offsetof(struct chipcregs, gpioout), 2913 ~0x40, 0x40);
2919 0x40, 0x40); 2914 bcma_chipco_gpio_outen(&pi->d11core->bus->drv_cc,
2920 ai_cc_reg(pi->sh->sih, 2915 ~0x40, 0x40);
2921 offsetof(struct chipcregs, gpioouten),
2922 0x40, 0x40);
2923 } else { 2916 } else {
2924 mod_phy_reg(pi, 0x44c, (0x1 << 2), (0) << 2); 2917 mod_phy_reg(pi, 0x44c, (0x1 << 2), (0) << 2);
2925 2918
2926 mod_phy_reg(pi, 0x44d, (0x1 << 2), (0) << 2); 2919 mod_phy_reg(pi, 0x44d, (0x1 << 2), (0) << 2);
2927 2920
2928 ai_cc_reg(pi->sh->sih, 2921 bcma_chipco_gpio_out(&pi->d11core->bus->drv_cc,
2929 offsetof(struct chipcregs, gpioout), 2922 ~0x40, 0x00);
2930 0x40, 0x00); 2923 bcma_chipco_gpio_outen(&pi->d11core->bus->drv_cc,
2931 ai_cc_reg(pi->sh->sih, 2924 ~0x40, 0x00);
2932 offsetof(struct chipcregs, gpioouten), 2925 bcma_chipco_gpio_control(&pi->d11core->bus->drv_cc,
2933 0x40, 0x0); 2926 0x0, 0x40);
2934 ai_cc_reg(pi->sh->sih,
2935 offsetof(struct chipcregs, gpiocontrol),
2936 ~0x0, 0x40);
2937 } 2927 }
2938 } 2928 }
2939} 2929}
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
index af00e2c2b266..1dc767c31653 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
@@ -488,7 +488,6 @@ struct lcnphy_cal_results {
488struct shared_phy { 488struct shared_phy {
489 struct brcms_phy *phy_head; 489 struct brcms_phy *phy_head;
490 uint unit; 490 uint unit;
491 struct si_pub *sih;
492 struct phy_shim_info *physhim; 491 struct phy_shim_info *physhim;
493 uint corerev; 492 uint corerev;
494 u32 machwcap; 493 u32 machwcap;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
index 21a824232478..427b0f613b94 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -1643,11 +1643,15 @@ wlc_lcnphy_set_chanspec_tweaks(struct brcms_phy *pi, u16 chanspec)
1643 if (channel == 1 || channel == 2 || channel == 3 || 1643 if (channel == 1 || channel == 2 || channel == 3 ||
1644 channel == 4 || channel == 9 || 1644 channel == 4 || channel == 9 ||
1645 channel == 10 || channel == 11 || channel == 12) { 1645 channel == 10 || channel == 11 || channel == 12) {
1646 si_pmu_pllcontrol(pi->sh->sih, 0x2, 0xffffffff, 0x03000c04); 1646 bcma_chipco_pll_write(&pi->d11core->bus->drv_cc, 0x2,
1647 si_pmu_pllcontrol(pi->sh->sih, 0x3, 0xffffff, 0x0); 1647 0x03000c04);
1648 si_pmu_pllcontrol(pi->sh->sih, 0x4, 0xffffffff, 0x200005c0); 1648 bcma_chipco_pll_maskset(&pi->d11core->bus->drv_cc, 0x3,
1649 1649 ~0x00ffffff, 0x0);
1650 si_pmu_pllupd(pi->sh->sih); 1650 bcma_chipco_pll_write(&pi->d11core->bus->drv_cc, 0x4,
1651 0x200005c0);
1652
1653 bcma_cc_set32(&pi->d11core->bus->drv_cc, BCMA_CC_PMU_CTL,
1654 BCMA_CC_PMU_CTL_PLL_UPD);
1651 write_phy_reg(pi, 0x942, 0); 1655 write_phy_reg(pi, 0x942, 0);
1652 wlc_lcnphy_txrx_spur_avoidance_mode(pi, false); 1656 wlc_lcnphy_txrx_spur_avoidance_mode(pi, false);
1653 pi_lcn->lcnphy_spurmod = false; 1657 pi_lcn->lcnphy_spurmod = false;
@@ -1655,11 +1659,15 @@ wlc_lcnphy_set_chanspec_tweaks(struct brcms_phy *pi, u16 chanspec)
1655 1659
1656 write_phy_reg(pi, 0x425, 0x5907); 1660 write_phy_reg(pi, 0x425, 0x5907);
1657 } else { 1661 } else {
1658 si_pmu_pllcontrol(pi->sh->sih, 0x2, 0xffffffff, 0x03140c04); 1662 bcma_chipco_pll_write(&pi->d11core->bus->drv_cc, 0x2,
1659 si_pmu_pllcontrol(pi->sh->sih, 0x3, 0xffffff, 0x333333); 1663 0x03140c04);
1660 si_pmu_pllcontrol(pi->sh->sih, 0x4, 0xffffffff, 0x202c2820); 1664 bcma_chipco_pll_maskset(&pi->d11core->bus->drv_cc, 0x3,
1661 1665 ~0x00ffffff, 0x333333);
1662 si_pmu_pllupd(pi->sh->sih); 1666 bcma_chipco_pll_write(&pi->d11core->bus->drv_cc, 0x4,
1667 0x202c2820);
1668
1669 bcma_cc_set32(&pi->d11core->bus->drv_cc, BCMA_CC_PMU_CTL,
1670 BCMA_CC_PMU_CTL_PLL_UPD);
1663 write_phy_reg(pi, 0x942, 0); 1671 write_phy_reg(pi, 0x942, 0);
1664 wlc_lcnphy_txrx_spur_avoidance_mode(pi, true); 1672 wlc_lcnphy_txrx_spur_avoidance_mode(pi, true);
1665 1673
@@ -4864,9 +4872,10 @@ void wlc_phy_init_lcnphy(struct brcms_phy *pi)
4864 4872
4865 wlc_phy_chanspec_set((struct brcms_phy_pub *) pi, pi->radio_chanspec); 4873 wlc_phy_chanspec_set((struct brcms_phy_pub *) pi, pi->radio_chanspec);
4866 4874
4867 si_pmu_regcontrol(pi->sh->sih, 0, 0xf, 0x9); 4875 bcma_chipco_regctl_maskset(&pi->d11core->bus->drv_cc, 0, ~0xf, 0x9);
4868 4876
4869 si_pmu_chipcontrol(pi->sh->sih, 0, 0xffffffff, 0x03CDDDDD); 4877 bcma_chipco_chipctl_maskset(&pi->d11core->bus->drv_cc, 0, 0x0,
4878 0x03CDDDDD);
4870 4879
4871 if ((pi->sh->boardflags & BFL_FEM) 4880 if ((pi->sh->boardflags & BFL_FEM)
4872 && wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) 4881 && wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi))
@@ -5078,7 +5087,7 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi)
5078 pi->hwpwrctrl_capable = true; 5087 pi->hwpwrctrl_capable = true;
5079 } 5088 }
5080 5089
5081 pi->xtalfreq = si_pmu_alp_clock(pi->sh->sih); 5090 pi->xtalfreq = bcma_chipco_get_alp_clock(&pi->d11core->bus->drv_cc);
5082 pi_lcn->lcnphy_papd_rxGnCtrl_init = 0; 5091 pi_lcn->lcnphy_papd_rxGnCtrl_init = 0;
5083 5092
5084 pi->pi_fptr.init = wlc_phy_init_lcnphy; 5093 pi->pi_fptr.init = wlc_phy_init_lcnphy;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
index 65db9b7458dc..3e9f5b25be63 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
@@ -19321,14 +19321,13 @@ void wlc_phy_init_nphy(struct brcms_phy *pi)
19321 (pi->sh->chippkg == BCMA_PKG_ID_BCM4718))) { 19321 (pi->sh->chippkg == BCMA_PKG_ID_BCM4718))) {
19322 if ((pi->sh->boardflags & BFL_EXTLNA) && 19322 if ((pi->sh->boardflags & BFL_EXTLNA) &&
19323 (CHSPEC_IS2G(pi->radio_chanspec))) 19323 (CHSPEC_IS2G(pi->radio_chanspec)))
19324 ai_cc_reg(pi->sh->sih, 19324 bcma_cc_set32(&pi->d11core->bus->drv_cc,
19325 offsetof(struct chipcregs, chipcontrol), 19325 BCMA_CC_CHIPCTL, 0x40);
19326 0x40, 0x40);
19327 } 19326 }
19328 19327
19329 if ((!PHY_IPA(pi)) && (pi->sh->chip == BCMA_CHIP_ID_BCM5357)) 19328 if ((!PHY_IPA(pi)) && (pi->sh->chip == BCMA_CHIP_ID_BCM5357))
19330 si_pmu_chipcontrol(pi->sh->sih, 1, CCTRL5357_EXTPA, 19329 bcma_chipco_chipctl_maskset(&pi->d11core->bus->drv_cc, 1,
19331 CCTRL5357_EXTPA); 19330 ~CCTRL5357_EXTPA, CCTRL5357_EXTPA);
19332 19331
19333 if ((pi->nphy_gband_spurwar2_en) && CHSPEC_IS2G(pi->radio_chanspec) && 19332 if ((pi->nphy_gband_spurwar2_en) && CHSPEC_IS2G(pi->radio_chanspec) &&
19334 CHSPEC_IS40(pi->radio_chanspec)) { 19333 CHSPEC_IS40(pi->radio_chanspec)) {
@@ -21133,7 +21132,6 @@ wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec,
21133 const struct nphy_sfo_cfg *ci) 21132 const struct nphy_sfo_cfg *ci)
21134{ 21133{
21135 u16 val; 21134 u16 val;
21136 struct si_info *sii = container_of(pi->sh->sih, struct si_info, pub);
21137 21135
21138 val = read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand; 21136 val = read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand;
21139 if (CHSPEC_IS5G(chanspec) && !val) { 21137 if (CHSPEC_IS5G(chanspec) && !val) {
@@ -21221,11 +21219,11 @@ wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec,
21221 21219
21222 if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) || 21220 if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) ||
21223 (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) { 21221 (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) {
21224 bcma_pmu_spuravoid_pllupdate(&sii->icbus->drv_cc, 21222 bcma_pmu_spuravoid_pllupdate(&pi->d11core->bus->drv_cc,
21225 spuravoid); 21223 spuravoid);
21226 } else { 21224 } else {
21227 wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false); 21225 wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false);
21228 bcma_pmu_spuravoid_pllupdate(&sii->icbus->drv_cc, 21226 bcma_pmu_spuravoid_pllupdate(&pi->d11core->bus->drv_cc,
21229 spuravoid); 21227 spuravoid);
21230 wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true); 21228 wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true);
21231 } 21229 }
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
index 7e9df566c733..71b80381f3ad 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
@@ -115,60 +115,6 @@ u16 si_pmu_fast_pwrup_delay(struct si_pub *sih)
115 return (u16) delay; 115 return (u16) delay;
116} 116}
117 117
118/* Read/write a chipcontrol reg */
119u32 si_pmu_chipcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val)
120{
121 ai_cc_reg(sih, offsetof(struct chipcregs, chipcontrol_addr), ~0, reg);
122 return ai_cc_reg(sih, offsetof(struct chipcregs, chipcontrol_data),
123 mask, val);
124}
125
126/* Read/write a regcontrol reg */
127u32 si_pmu_regcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val)
128{
129 ai_cc_reg(sih, offsetof(struct chipcregs, regcontrol_addr), ~0, reg);
130 return ai_cc_reg(sih, offsetof(struct chipcregs, regcontrol_data),
131 mask, val);
132}
133
134/* Read/write a pllcontrol reg */
135u32 si_pmu_pllcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val)
136{
137 ai_cc_reg(sih, offsetof(struct chipcregs, pllcontrol_addr), ~0, reg);
138 return ai_cc_reg(sih, offsetof(struct chipcregs, pllcontrol_data),
139 mask, val);
140}
141
142/* PMU PLL update */
143void si_pmu_pllupd(struct si_pub *sih)
144{
145 ai_cc_reg(sih, offsetof(struct chipcregs, pmucontrol),
146 PCTL_PLL_PLLCTL_UPD, PCTL_PLL_PLLCTL_UPD);
147}
148
149/* query alp/xtal clock frequency */
150u32 si_pmu_alp_clock(struct si_pub *sih)
151{
152 u32 clock = ALP_CLOCK;
153
154 /* bail out with default */
155 if (!(ai_get_cccaps(sih) & CC_CAP_PMU))
156 return clock;
157
158 switch (ai_get_chip_id(sih)) {
159 case BCMA_CHIP_ID_BCM43224:
160 case BCMA_CHIP_ID_BCM43225:
161 case BCMA_CHIP_ID_BCM4313:
162 /* always 20Mhz */
163 clock = 20000 * 1000;
164 break;
165 default:
166 break;
167 }
168
169 return clock;
170}
171
172u32 si_pmu_measure_alpclk(struct si_pub *sih) 118u32 si_pmu_measure_alpclk(struct si_pub *sih)
173{ 119{
174 struct si_info *sii = container_of(sih, struct si_info, pub); 120 struct si_info *sii = container_of(sih, struct si_info, pub);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.h b/drivers/net/wireless/brcm80211/brcmsmac/pmu.h
index f7cff873578b..20e2012d5a3a 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.h
@@ -21,12 +21,6 @@
21#include "types.h" 21#include "types.h"
22 22
23extern u16 si_pmu_fast_pwrup_delay(struct si_pub *sih); 23extern u16 si_pmu_fast_pwrup_delay(struct si_pub *sih);
24extern void si_pmu_sprom_enable(struct si_pub *sih, bool enable);
25extern u32 si_pmu_chipcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val);
26extern u32 si_pmu_regcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val);
27extern u32 si_pmu_alp_clock(struct si_pub *sih);
28extern void si_pmu_pllupd(struct si_pub *sih);
29extern u32 si_pmu_pllcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val);
30extern u32 si_pmu_measure_alpclk(struct si_pub *sih); 24extern u32 si_pmu_measure_alpclk(struct si_pub *sih);
31 25
32#endif /* _BRCM_PMU_H_ */ 26#endif /* _BRCM_PMU_H_ */