diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2012-04-28 20:50:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-05-16 12:45:23 -0400 |
commit | d43c1c5261108167894d63583531250ea7d04416 (patch) | |
tree | 3c3b0841c0085384fafa91f82a9c68a0db6324e4 /drivers/net | |
parent | 1928ad71f23d8664df0699b767d2054a4ddb643b (diff) |
brcmsmac: remove support for cc rev < 20
The lowest chip common version used on bcma based devices is 31 on the
bcm4718 and 32 on the bcm4313, bcm43224, and bcm43225, so the support
for the old versions could be removed.
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/net')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 105 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 5 |
2 files changed, 11 insertions, 99 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c index d2c8f14c0597..ebec0a28b310 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | |||
@@ -491,8 +491,7 @@ ai_buscore_setup(struct si_info *sii, struct bcma_device *cc) | |||
491 | sii->pub.ccrev = cc->id.rev; | 491 | sii->pub.ccrev = cc->id.rev; |
492 | 492 | ||
493 | /* get chipcommon chipstatus */ | 493 | /* get chipcommon chipstatus */ |
494 | if (ai_get_ccrev(&sii->pub) >= 11) | 494 | sii->chipst = bcma_read32(cc, CHIPCREGOFFS(chipstatus)); |
495 | sii->chipst = bcma_read32(cc, CHIPCREGOFFS(chipstatus)); | ||
496 | 495 | ||
497 | /* get chipcommon capabilites */ | 496 | /* get chipcommon capabilites */ |
498 | sii->pub.cccaps = bcma_read32(cc, CHIPCREGOFFS(capabilities)); | 497 | sii->pub.cccaps = bcma_read32(cc, CHIPCREGOFFS(capabilities)); |
@@ -721,21 +720,7 @@ uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val) | |||
721 | /* return the slow clock source - LPO, XTAL, or PCI */ | 720 | /* return the slow clock source - LPO, XTAL, or PCI */ |
722 | static uint ai_slowclk_src(struct si_pub *sih, struct bcma_device *cc) | 721 | static uint ai_slowclk_src(struct si_pub *sih, struct bcma_device *cc) |
723 | { | 722 | { |
724 | struct si_info *sii; | 723 | return SCC_SS_XTAL; |
725 | u32 val; | ||
726 | |||
727 | sii = (struct si_info *)sih; | ||
728 | if (ai_get_ccrev(&sii->pub) < 6) { | ||
729 | pci_read_config_dword(sii->pcibus, PCI_GPIO_OUT, | ||
730 | &val); | ||
731 | if (val & PCI_CFG_GPIO_SCS) | ||
732 | return SCC_SS_PCI; | ||
733 | return SCC_SS_XTAL; | ||
734 | } else if (ai_get_ccrev(&sii->pub) < 10) { | ||
735 | return bcma_read32(cc, CHIPCREGOFFS(slow_clk_ctl)) & | ||
736 | SCC_SS_MASK; | ||
737 | } else /* Insta-clock */ | ||
738 | return SCC_SS_XTAL; | ||
739 | } | 724 | } |
740 | 725 | ||
741 | /* | 726 | /* |
@@ -745,36 +730,12 @@ static uint ai_slowclk_src(struct si_pub *sih, struct bcma_device *cc) | |||
745 | static uint ai_slowclk_freq(struct si_pub *sih, bool max_freq, | 730 | static uint ai_slowclk_freq(struct si_pub *sih, bool max_freq, |
746 | struct bcma_device *cc) | 731 | struct bcma_device *cc) |
747 | { | 732 | { |
748 | u32 slowclk; | ||
749 | uint div; | 733 | uint div; |
750 | 734 | ||
751 | slowclk = ai_slowclk_src(sih, cc); | 735 | /* Chipc rev 10 is InstaClock */ |
752 | if (ai_get_ccrev(sih) < 6) { | 736 | div = bcma_read32(cc, CHIPCREGOFFS(system_clk_ctl)); |
753 | if (slowclk == SCC_SS_PCI) | 737 | div = 4 * ((div >> SYCC_CD_SHIFT) + 1); |
754 | return max_freq ? (PCIMAXFREQ / 64) | 738 | return max_freq ? XTALMAXFREQ : (XTALMINFREQ / div); |
755 | : (PCIMINFREQ / 64); | ||
756 | else | ||
757 | return max_freq ? (XTALMAXFREQ / 32) | ||
758 | : (XTALMINFREQ / 32); | ||
759 | } else if (ai_get_ccrev(sih) < 10) { | ||
760 | div = 4 * | ||
761 | (((bcma_read32(cc, CHIPCREGOFFS(slow_clk_ctl)) & | ||
762 | SCC_CD_MASK) >> SCC_CD_SHIFT) + 1); | ||
763 | if (slowclk == SCC_SS_LPO) | ||
764 | return max_freq ? LPOMAXFREQ : LPOMINFREQ; | ||
765 | else if (slowclk == SCC_SS_XTAL) | ||
766 | return max_freq ? (XTALMAXFREQ / div) | ||
767 | : (XTALMINFREQ / div); | ||
768 | else if (slowclk == SCC_SS_PCI) | ||
769 | return max_freq ? (PCIMAXFREQ / div) | ||
770 | : (PCIMINFREQ / div); | ||
771 | } else { | ||
772 | /* Chipc rev 10 is InstaClock */ | ||
773 | div = bcma_read32(cc, CHIPCREGOFFS(system_clk_ctl)); | ||
774 | div = 4 * ((div >> SYCC_CD_SHIFT) + 1); | ||
775 | return max_freq ? XTALMAXFREQ : (XTALMINFREQ / div); | ||
776 | } | ||
777 | return 0; | ||
778 | } | 739 | } |
779 | 740 | ||
780 | static void | 741 | static void |
@@ -797,8 +758,7 @@ ai_clkctl_setdelay(struct si_pub *sih, struct bcma_device *cc) | |||
797 | 758 | ||
798 | /* Starting with 4318 it is ILP that is used for the delays */ | 759 | /* Starting with 4318 it is ILP that is used for the delays */ |
799 | slowmaxfreq = | 760 | slowmaxfreq = |
800 | ai_slowclk_freq(sih, | 761 | ai_slowclk_freq(sih, false, cc); |
801 | (ai_get_ccrev(sih) >= 10) ? false : true, cc); | ||
802 | 762 | ||
803 | pll_on_delay = ((slowmaxfreq * pll_delay) + 999999) / 1000000; | 763 | pll_on_delay = ((slowmaxfreq * pll_delay) + 999999) / 1000000; |
804 | fref_sel_delay = ((slowmaxfreq * FREF_DELAY) + 999999) / 1000000; | 764 | fref_sel_delay = ((slowmaxfreq * FREF_DELAY) + 999999) / 1000000; |
@@ -820,9 +780,8 @@ void ai_clkctl_init(struct si_pub *sih) | |||
820 | return; | 780 | return; |
821 | 781 | ||
822 | /* set all Instaclk chip ILP to 1 MHz */ | 782 | /* set all Instaclk chip ILP to 1 MHz */ |
823 | if (ai_get_ccrev(sih) >= 10) | 783 | bcma_maskset32(cc, CHIPCREGOFFS(system_clk_ctl), SYCC_CD_MASK, |
824 | bcma_maskset32(cc, CHIPCREGOFFS(system_clk_ctl), SYCC_CD_MASK, | 784 | (ILP_DIV_1MHZ << SYCC_CD_SHIFT)); |
825 | (ILP_DIV_1MHZ << SYCC_CD_SHIFT)); | ||
826 | 785 | ||
827 | ai_clkctl_setdelay(sih, cc); | 786 | ai_clkctl_setdelay(sih, cc); |
828 | } | 787 | } |
@@ -926,31 +885,11 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode) | |||
926 | struct bcma_device *cc; | 885 | struct bcma_device *cc; |
927 | u32 scc; | 886 | u32 scc; |
928 | 887 | ||
929 | /* chipcommon cores prior to rev6 don't support dynamic clock control */ | ||
930 | if (ai_get_ccrev(&sii->pub) < 6) | ||
931 | return false; | ||
932 | |||
933 | cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); | 888 | cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0); |
934 | 889 | ||
935 | if (!(ai_get_cccaps(&sii->pub) & CC_CAP_PWR_CTL) && | ||
936 | (ai_get_ccrev(&sii->pub) < 20)) | ||
937 | return mode == CLK_FAST; | ||
938 | |||
939 | switch (mode) { | 890 | switch (mode) { |
940 | case CLK_FAST: /* FORCEHT, fast (pll) clock */ | 891 | case CLK_FAST: /* FORCEHT, fast (pll) clock */ |
941 | if (ai_get_ccrev(&sii->pub) < 10) { | 892 | bcma_set32(cc, CHIPCREGOFFS(clk_ctl_st), CCS_FORCEHT); |
942 | /* | ||
943 | * don't forget to force xtal back | ||
944 | * on before we clear SCC_DYN_XTAL.. | ||
945 | */ | ||
946 | ai_clkctl_xtal(&sii->pub, XTAL, ON); | ||
947 | bcma_maskset32(cc, CHIPCREGOFFS(slow_clk_ctl), | ||
948 | (SCC_XC | SCC_FS | SCC_IP), SCC_IP); | ||
949 | } else if (ai_get_ccrev(&sii->pub) < 20) { | ||
950 | bcma_set32(cc, CHIPCREGOFFS(system_clk_ctl), SYCC_HR); | ||
951 | } else { | ||
952 | bcma_set32(cc, CHIPCREGOFFS(clk_ctl_st), CCS_FORCEHT); | ||
953 | } | ||
954 | 893 | ||
955 | /* wait for the PLL */ | 894 | /* wait for the PLL */ |
956 | if (ai_get_cccaps(&sii->pub) & CC_CAP_PMU) { | 895 | if (ai_get_cccaps(&sii->pub) & CC_CAP_PMU) { |
@@ -963,25 +902,7 @@ static bool _ai_clkctl_cc(struct si_info *sii, uint mode) | |||
963 | break; | 902 | break; |
964 | 903 | ||
965 | case CLK_DYNAMIC: /* enable dynamic clock control */ | 904 | case CLK_DYNAMIC: /* enable dynamic clock control */ |
966 | if (ai_get_ccrev(&sii->pub) < 10) { | 905 | bcma_mask32(cc, CHIPCREGOFFS(clk_ctl_st), ~CCS_FORCEHT); |
967 | scc = bcma_read32(cc, CHIPCREGOFFS(slow_clk_ctl)); | ||
968 | scc &= ~(SCC_FS | SCC_IP | SCC_XC); | ||
969 | if ((scc & SCC_SS_MASK) != SCC_SS_XTAL) | ||
970 | scc |= SCC_XC; | ||
971 | bcma_write32(cc, CHIPCREGOFFS(slow_clk_ctl), scc); | ||
972 | |||
973 | /* | ||
974 | * for dynamic control, we have to | ||
975 | * release our xtal_pu "force on" | ||
976 | */ | ||
977 | if (scc & SCC_XC) | ||
978 | ai_clkctl_xtal(&sii->pub, XTAL, OFF); | ||
979 | } else if (ai_get_ccrev(&sii->pub) < 20) { | ||
980 | /* Instaclock */ | ||
981 | bcma_mask32(cc, CHIPCREGOFFS(system_clk_ctl), ~SYCC_HR); | ||
982 | } else { | ||
983 | bcma_mask32(cc, CHIPCREGOFFS(clk_ctl_st), ~CCS_FORCEHT); | ||
984 | } | ||
985 | break; | 906 | break; |
986 | 907 | ||
987 | default: | 908 | default: |
@@ -1005,10 +926,6 @@ bool ai_clkctl_cc(struct si_pub *sih, uint mode) | |||
1005 | 926 | ||
1006 | sii = (struct si_info *)sih; | 927 | sii = (struct si_info *)sih; |
1007 | 928 | ||
1008 | /* chipcommon cores prior to rev6 don't support dynamic clock control */ | ||
1009 | if (ai_get_ccrev(sih) < 6) | ||
1010 | return false; | ||
1011 | |||
1012 | if (PCI_FORCEHT(sih)) | 929 | if (PCI_FORCEHT(sih)) |
1013 | return mode == CLK_FAST; | 930 | return mode == CLK_FAST; |
1014 | 931 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h index e198b63c9079..32f159798d3c 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | |||
@@ -217,11 +217,6 @@ extern void ai_epa_4313war(struct si_pub *sih); | |||
217 | extern uint ai_get_buscoretype(struct si_pub *sih); | 217 | extern uint ai_get_buscoretype(struct si_pub *sih); |
218 | extern uint ai_get_buscorerev(struct si_pub *sih); | 218 | extern uint ai_get_buscorerev(struct si_pub *sih); |
219 | 219 | ||
220 | static inline int ai_get_ccrev(struct si_pub *sih) | ||
221 | { | ||
222 | return sih->ccrev; | ||
223 | } | ||
224 | |||
225 | static inline u32 ai_get_cccaps(struct si_pub *sih) | 220 | static inline u32 ai_get_cccaps(struct si_pub *sih) |
226 | { | 221 | { |
227 | return sih->cccaps; | 222 | return sih->cccaps; |