aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/hw.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2010-04-15 17:38:17 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-16 15:43:19 -0400
commit647739645bea4a5628f9e4eaf8022dcc5875c535 (patch)
tree992812cc5851df7d62dfcf2c2029bf6fda3279aa /drivers/net/wireless/ath/ath9k/hw.c
parentbbd79af5639bd51af1119e5df866568063a1b011 (diff)
ath9k_hw: add a private callback for PLL control computation
The PLL control computation used to program the AR_RTC_PLL_CONTROL register varies between our harware so just add a private callback for it. AR9003 will use its own callback. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/hw.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c64
1 files changed, 7 insertions, 57 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index ea831f575a9..349cffdbdea 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -66,6 +66,12 @@ static bool ath9k_hw_macversion_supported(struct ath_hw *ah)
66 return priv_ops->macversion_supported(ah->hw_version.macVersion); 66 return priv_ops->macversion_supported(ah->hw_version.macVersion);
67} 67}
68 68
69static u32 ath9k_hw_compute_pll_control(struct ath_hw *ah,
70 struct ath9k_channel *chan)
71{
72 return ath9k_hw_private_ops(ah)->compute_pll_control(ah, chan);
73}
74
69/********************/ 75/********************/
70/* Helper Functions */ 76/* Helper Functions */
71/********************/ 77/********************/
@@ -1023,64 +1029,8 @@ static void ath9k_hw_init_qos(struct ath_hw *ah)
1023static void ath9k_hw_init_pll(struct ath_hw *ah, 1029static void ath9k_hw_init_pll(struct ath_hw *ah,
1024 struct ath9k_channel *chan) 1030 struct ath9k_channel *chan)
1025{ 1031{
1026 u32 pll; 1032 u32 pll = ath9k_hw_compute_pll_control(ah, chan);
1027
1028 if (AR_SREV_9100(ah)) {
1029 if (chan && IS_CHAN_5GHZ(chan))
1030 pll = 0x1450;
1031 else
1032 pll = 0x1458;
1033 } else {
1034 if (AR_SREV_9280_10_OR_LATER(ah)) {
1035 pll = SM(0x5, AR_RTC_9160_PLL_REFDIV);
1036
1037 if (chan && IS_CHAN_HALF_RATE(chan))
1038 pll |= SM(0x1, AR_RTC_9160_PLL_CLKSEL);
1039 else if (chan && IS_CHAN_QUARTER_RATE(chan))
1040 pll |= SM(0x2, AR_RTC_9160_PLL_CLKSEL);
1041
1042 if (chan && IS_CHAN_5GHZ(chan)) {
1043 pll |= SM(0x28, AR_RTC_9160_PLL_DIV);
1044
1045
1046 if (AR_SREV_9280_20(ah)) {
1047 if (((chan->channel % 20) == 0)
1048 || ((chan->channel % 10) == 0))
1049 pll = 0x2850;
1050 else
1051 pll = 0x142c;
1052 }
1053 } else {
1054 pll |= SM(0x2c, AR_RTC_9160_PLL_DIV);
1055 }
1056
1057 } else if (AR_SREV_9160_10_OR_LATER(ah)) {
1058
1059 pll = SM(0x5, AR_RTC_9160_PLL_REFDIV);
1060
1061 if (chan && IS_CHAN_HALF_RATE(chan))
1062 pll |= SM(0x1, AR_RTC_9160_PLL_CLKSEL);
1063 else if (chan && IS_CHAN_QUARTER_RATE(chan))
1064 pll |= SM(0x2, AR_RTC_9160_PLL_CLKSEL);
1065
1066 if (chan && IS_CHAN_5GHZ(chan))
1067 pll |= SM(0x50, AR_RTC_9160_PLL_DIV);
1068 else
1069 pll |= SM(0x58, AR_RTC_9160_PLL_DIV);
1070 } else {
1071 pll = AR_RTC_PLL_REFDIV_5 | AR_RTC_PLL_DIV2;
1072
1073 if (chan && IS_CHAN_HALF_RATE(chan))
1074 pll |= SM(0x1, AR_RTC_PLL_CLKSEL);
1075 else if (chan && IS_CHAN_QUARTER_RATE(chan))
1076 pll |= SM(0x2, AR_RTC_PLL_CLKSEL);
1077 1033
1078 if (chan && IS_CHAN_5GHZ(chan))
1079 pll |= SM(0xa, AR_RTC_PLL_DIV);
1080 else
1081 pll |= SM(0xb, AR_RTC_PLL_DIV);
1082 }
1083 }
1084 REG_WRITE(ah, AR_RTC_PLL_CONTROL, pll); 1034 REG_WRITE(ah, AR_RTC_PLL_CONTROL, pll);
1085 1035
1086 /* Switch the core clock for ar9271 to 117Mhz */ 1036 /* Switch the core clock for ar9271 to 117Mhz */