aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2012-04-28 20:50:35 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-16 12:45:24 -0400
commit712e3c1f33f807db5bdf40e7d01e075e9b995a7c (patch)
tree37551554f071a4d292214652f076d38302314951
parentfa0b823b179d0d06bac60394dd3cb1c998fe26e2 (diff)
brcmsmac: remove _ai_clkctl_cc()
This is now done by calling bcma_core_set_clockmode() 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>
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/aiutils.c56
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/aiutils.h4
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.c30
3 files changed, 31 insertions, 59 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index 1b7b17284f5d..b64fbc0b37df 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -761,39 +761,6 @@ u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih)
761 return fpdelay; 761 return fpdelay;
762} 762}
763 763
764/* clk control mechanism through chipcommon, no policy checking */
765static bool _ai_clkctl_cc(struct si_info *sii, uint mode)
766{
767 struct bcma_device *cc;
768 u32 scc;
769
770 cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0);
771
772 switch (mode) {
773 case CLK_FAST: /* FORCEHT, fast (pll) clock */
774 bcma_set32(cc, CHIPCREGOFFS(clk_ctl_st), CCS_FORCEHT);
775
776 /* wait for the PLL */
777 if (ai_get_cccaps(&sii->pub) & CC_CAP_PMU) {
778 u32 htavail = CCS_HTAVAIL;
779 SPINWAIT(((bcma_read32(cc, CHIPCREGOFFS(clk_ctl_st)) &
780 htavail) == 0), PMU_MAX_TRANSITION_DLY);
781 } else {
782 udelay(PLL_DELAY);
783 }
784 break;
785
786 case CLK_DYNAMIC: /* enable dynamic clock control */
787 bcma_mask32(cc, CHIPCREGOFFS(clk_ctl_st), ~CCS_FORCEHT);
788 break;
789
790 default:
791 break;
792 }
793
794 return mode == CLK_FAST;
795}
796
797/* 764/*
798 * clock control policy function throught chipcommon 765 * clock control policy function throught chipcommon
799 * 766 *
@@ -802,26 +769,32 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode)
802 * this is a wrapper over the next internal function 769 * this is a wrapper over the next internal function
803 * to allow flexible policy settings for outside caller 770 * to allow flexible policy settings for outside caller
804 */ 771 */
805bool ai_clkctl_cc(struct si_pub *sih, uint mode) 772bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode)
806{ 773{
807 struct si_info *sii; 774 struct si_info *sii;
775 struct bcma_device *cc;
808 776
809 sii = (struct si_info *)sih; 777 sii = (struct si_info *)sih;
810 778
811 if (PCI_FORCEHT(sih)) 779 if (PCI_FORCEHT(sih))
812 return mode == CLK_FAST; 780 return mode == BCMA_CLKMODE_FAST;
813 781
814 return _ai_clkctl_cc(sii, mode); 782 cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0);
783 bcma_core_set_clockmode(cc, mode);
784 return mode == BCMA_CLKMODE_FAST;
815} 785}
816 786
817void ai_pci_up(struct si_pub *sih) 787void ai_pci_up(struct si_pub *sih)
818{ 788{
819 struct si_info *sii; 789 struct si_info *sii;
790 struct bcma_device *cc;
820 791
821 sii = (struct si_info *)sih; 792 sii = (struct si_info *)sih;
822 793
823 if (PCI_FORCEHT(sih)) 794 if (PCI_FORCEHT(sih)) {
824 _ai_clkctl_cc(sii, CLK_FAST); 795 cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0);
796 bcma_core_set_clockmode(cc, BCMA_CLKMODE_FAST);
797 }
825 798
826 if (PCIE(sih)) 799 if (PCIE(sih))
827 pcicore_up(sii->pch, SI_PCIUP); 800 pcicore_up(sii->pch, SI_PCIUP);
@@ -832,12 +805,15 @@ void ai_pci_up(struct si_pub *sih)
832void ai_pci_down(struct si_pub *sih) 805void ai_pci_down(struct si_pub *sih)
833{ 806{
834 struct si_info *sii; 807 struct si_info *sii;
808 struct bcma_device *cc;
835 809
836 sii = (struct si_info *)sih; 810 sii = (struct si_info *)sih;
837 811
838 /* release FORCEHT since chip is going to "down" state */ 812 /* release FORCEHT since chip is going to "down" state */
839 if (PCI_FORCEHT(sih)) 813 if (PCI_FORCEHT(sih)) {
840 _ai_clkctl_cc(sii, CLK_DYNAMIC); 814 cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0);
815 bcma_core_set_clockmode(cc, BCMA_CLKMODE_DYNAMIC);
816 }
841 817
842 pcicore_down(sii->pch, SI_PCIDOWN); 818 pcicore_down(sii->pch, SI_PCIDOWN);
843} 819}
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
index 62c3a636014a..14ae9f58a90d 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
@@ -113,10 +113,6 @@
113#define XTAL 0x1 /* primary crystal oscillator (2050) */ 113#define XTAL 0x1 /* primary crystal oscillator (2050) */
114#define PLL 0x2 /* main chip pll */ 114#define PLL 0x2 /* main chip pll */
115 115
116/* clkctl clk mode */
117#define CLK_FAST 0 /* force fast (pll) clock */
118#define CLK_DYNAMIC 2 /* enable dynamic clock control */
119
120/* GPIO usage priorities */ 116/* GPIO usage priorities */
121#define GPIO_DRV_PRIORITY 0 /* Driver */ 117#define GPIO_DRV_PRIORITY 0 /* Driver */
122#define GPIO_APP_PRIORITY 1 /* Application */ 118#define GPIO_APP_PRIORITY 1 /* Application */
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 0c66bb726aec..71d7f394c8a2 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -1219,7 +1219,7 @@ static void brcms_b_wait_for_wake(struct brcms_hardware *wlc_hw)
1219} 1219}
1220 1220
1221/* control chip clock to save power, enable dynamic clock or force fast clock */ 1221/* control chip clock to save power, enable dynamic clock or force fast clock */
1222static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, uint mode) 1222static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, enum bcma_clkmode mode)
1223{ 1223{
1224 if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) { 1224 if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) {
1225 /* new chips with PMU, CCS_FORCEHT will distribute the HT clock 1225 /* new chips with PMU, CCS_FORCEHT will distribute the HT clock
@@ -1229,7 +1229,7 @@ static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, uint mode)
1229 */ 1229 */
1230 1230
1231 if (wlc_hw->clk) { 1231 if (wlc_hw->clk) {
1232 if (mode == CLK_FAST) { 1232 if (mode == BCMA_CLKMODE_FAST) {
1233 bcma_set32(wlc_hw->d11core, 1233 bcma_set32(wlc_hw->d11core,
1234 D11REGOFFS(clk_ctl_st), 1234 D11REGOFFS(clk_ctl_st),
1235 CCS_FORCEHT); 1235 CCS_FORCEHT);
@@ -1260,7 +1260,7 @@ static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, uint mode)
1260 ~CCS_FORCEHT); 1260 ~CCS_FORCEHT);
1261 } 1261 }
1262 } 1262 }
1263 wlc_hw->forcefastclk = (mode == CLK_FAST); 1263 wlc_hw->forcefastclk = (mode == BCMA_CLKMODE_FAST);
1264 } else { 1264 } else {
1265 1265
1266 /* old chips w/o PMU, force HT through cc, 1266 /* old chips w/o PMU, force HT through cc,
@@ -1567,7 +1567,7 @@ void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw)
1567 /* request FAST clock if not on */ 1567 /* request FAST clock if not on */
1568 fastclk = wlc_hw->forcefastclk; 1568 fastclk = wlc_hw->forcefastclk;
1569 if (!fastclk) 1569 if (!fastclk)
1570 brcms_b_clkctl_clk(wlc_hw, CLK_FAST); 1570 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST);
1571 1571
1572 wlc_phy_bw_state_set(wlc_hw->band->pi, bw); 1572 wlc_phy_bw_state_set(wlc_hw->band->pi, bw);
1573 1573
@@ -1576,7 +1576,7 @@ void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw)
1576 1576
1577 /* restore the clk */ 1577 /* restore the clk */
1578 if (!fastclk) 1578 if (!fastclk)
1579 brcms_b_clkctl_clk(wlc_hw, CLK_DYNAMIC); 1579 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC);
1580} 1580}
1581 1581
1582static void brcms_b_upd_synthpu(struct brcms_hardware *wlc_hw) 1582static void brcms_b_upd_synthpu(struct brcms_hardware *wlc_hw)
@@ -1994,7 +1994,7 @@ void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags)
1994 /* request FAST clock if not on */ 1994 /* request FAST clock if not on */
1995 fastclk = wlc_hw->forcefastclk; 1995 fastclk = wlc_hw->forcefastclk;
1996 if (!fastclk) 1996 if (!fastclk)
1997 brcms_b_clkctl_clk(wlc_hw, CLK_FAST); 1997 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST);
1998 1998
1999 /* reset the dma engines except first time thru */ 1999 /* reset the dma engines except first time thru */
2000 if (bcma_core_is_enabled(wlc_hw->d11core)) { 2000 if (bcma_core_is_enabled(wlc_hw->d11core)) {
@@ -2043,7 +2043,7 @@ void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags)
2043 brcms_c_mctrl_reset(wlc_hw); 2043 brcms_c_mctrl_reset(wlc_hw);
2044 2044
2045 if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) 2045 if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU)
2046 brcms_b_clkctl_clk(wlc_hw, CLK_FAST); 2046 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST);
2047 2047
2048 brcms_b_phy_reset(wlc_hw); 2048 brcms_b_phy_reset(wlc_hw);
2049 2049
@@ -2055,7 +2055,7 @@ void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags)
2055 2055
2056 /* restore the clk setting */ 2056 /* restore the clk setting */
2057 if (!fastclk) 2057 if (!fastclk)
2058 brcms_b_clkctl_clk(wlc_hw, CLK_DYNAMIC); 2058 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC);
2059} 2059}
2060 2060
2061/* txfifo sizes needs to be modified(increased) since the newer cores 2061/* txfifo sizes needs to be modified(increased) since the newer cores
@@ -3361,7 +3361,7 @@ static brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec) {
3361 /* request FAST clock if not on */ 3361 /* request FAST clock if not on */
3362 fastclk = wlc_hw->forcefastclk; 3362 fastclk = wlc_hw->forcefastclk;
3363 if (!fastclk) 3363 if (!fastclk)
3364 brcms_b_clkctl_clk(wlc_hw, CLK_FAST); 3364 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST);
3365 3365
3366 /* disable interrupts */ 3366 /* disable interrupts */
3367 macintmask = brcms_intrsoff(wlc->wl); 3367 macintmask = brcms_intrsoff(wlc->wl);
@@ -3395,7 +3395,7 @@ static brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec) {
3395 3395
3396 /* restore the clk */ 3396 /* restore the clk */
3397 if (!fastclk) 3397 if (!fastclk)
3398 brcms_b_clkctl_clk(wlc_hw, CLK_DYNAMIC); 3398 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC);
3399} 3399}
3400 3400
3401static void brcms_c_set_phy_chanspec(struct brcms_c_info *wlc, 3401static void brcms_c_set_phy_chanspec(struct brcms_c_info *wlc,
@@ -4491,7 +4491,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,
4491 * is still false; But it will be called again inside wlc_corereset, 4491 * is still false; But it will be called again inside wlc_corereset,
4492 * after d11 is out of reset. 4492 * after d11 is out of reset.
4493 */ 4493 */
4494 brcms_b_clkctl_clk(wlc_hw, CLK_FAST); 4494 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST);
4495 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); 4495 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
4496 4496
4497 if (!brcms_b_validate_chip_access(wlc_hw)) { 4497 if (!brcms_b_validate_chip_access(wlc_hw)) {
@@ -5019,7 +5019,7 @@ static void brcms_b_hw_up(struct brcms_hardware *wlc_hw)
5019 */ 5019 */
5020 brcms_b_xtal(wlc_hw, ON); 5020 brcms_b_xtal(wlc_hw, ON);
5021 ai_clkctl_init(wlc_hw->sih); 5021 ai_clkctl_init(wlc_hw->sih);
5022 brcms_b_clkctl_clk(wlc_hw, CLK_FAST); 5022 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST);
5023 5023
5024 ai_pci_fixcfg(wlc_hw->sih); 5024 ai_pci_fixcfg(wlc_hw->sih);
5025 5025
@@ -5058,7 +5058,7 @@ static int brcms_b_up_prep(struct brcms_hardware *wlc_hw)
5058 */ 5058 */
5059 brcms_b_xtal(wlc_hw, ON); 5059 brcms_b_xtal(wlc_hw, ON);
5060 ai_clkctl_init(wlc_hw->sih); 5060 ai_clkctl_init(wlc_hw->sih);
5061 brcms_b_clkctl_clk(wlc_hw, CLK_FAST); 5061 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST);
5062 5062
5063 /* 5063 /*
5064 * Configure pci/pcmcia here instead of in brcms_c_attach() 5064 * Configure pci/pcmcia here instead of in brcms_c_attach()
@@ -5095,7 +5095,7 @@ static int brcms_b_up_finish(struct brcms_hardware *wlc_hw)
5095 wlc_phy_hw_state_upd(wlc_hw->band->pi, true); 5095 wlc_phy_hw_state_upd(wlc_hw->band->pi, true);
5096 5096
5097 /* FULLY enable dynamic power control and d11 core interrupt */ 5097 /* FULLY enable dynamic power control and d11 core interrupt */
5098 brcms_b_clkctl_clk(wlc_hw, CLK_DYNAMIC); 5098 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC);
5099 brcms_intrson(wlc_hw->wlc->wl); 5099 brcms_intrson(wlc_hw->wlc->wl);
5100 return 0; 5100 return 0;
5101} 5101}
@@ -5236,7 +5236,7 @@ static int brcms_b_bmac_down_prep(struct brcms_hardware *wlc_hw)
5236 brcms_intrsoff(wlc_hw->wlc->wl); 5236 brcms_intrsoff(wlc_hw->wlc->wl);
5237 5237
5238 /* ensure we're running on the pll clock again */ 5238 /* ensure we're running on the pll clock again */
5239 brcms_b_clkctl_clk(wlc_hw, CLK_FAST); 5239 brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST);
5240 } 5240 }
5241 /* down phy at the last of this stage */ 5241 /* down phy at the last of this stage */
5242 callbacks += wlc_phy_down(wlc_hw->band->pi); 5242 callbacks += wlc_phy_down(wlc_hw->band->pi);