diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2009-02-11 23:36:45 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:51:43 -0500 |
commit | 06d0f0663e11cab4ec5f2c143a118d71a12fbbe9 (patch) | |
tree | 25f7f2dcee8b2f6acdf577a8122fd5da15e2b2b2 | |
parent | fec0de1110e58ed39647e484bff8437e4185158d (diff) |
ath9k: Enable Fractional N mode
This patch enables Fractional N mode for all channel
if the EEPROM says so, and also fixes the INI only
when the device is not a 2 GHz only capable device.
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath9k/eeprom.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/eeprom.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/hw.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/phy.c | 19 |
4 files changed, 35 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath9k/eeprom.c b/drivers/net/wireless/ath9k/eeprom.c index 34e9d818fadd..68de89d7986f 100644 --- a/drivers/net/wireless/ath9k/eeprom.c +++ b/drivers/net/wireless/ath9k/eeprom.c | |||
@@ -466,6 +466,8 @@ static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah, | |||
466 | return pBase->txMask; | 466 | return pBase->txMask; |
467 | case EEP_RX_MASK: | 467 | case EEP_RX_MASK: |
468 | return pBase->rxMask; | 468 | return pBase->rxMask; |
469 | case EEP_FRAC_N_5G: | ||
470 | return 0; | ||
469 | default: | 471 | default: |
470 | return 0; | 472 | return 0; |
471 | } | 473 | } |
@@ -1599,6 +1601,11 @@ static u32 ath9k_hw_def_get_eeprom(struct ath_hw *ah, | |||
1599 | return pBase->dacHiPwrMode_5G; | 1601 | return pBase->dacHiPwrMode_5G; |
1600 | else | 1602 | else |
1601 | return 0; | 1603 | return 0; |
1604 | case EEP_FRAC_N_5G: | ||
1605 | if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_22) | ||
1606 | return pBase->frac_n_5g; | ||
1607 | else | ||
1608 | return 0; | ||
1602 | default: | 1609 | default: |
1603 | return 0; | 1610 | return 0; |
1604 | } | 1611 | } |
diff --git a/drivers/net/wireless/ath9k/eeprom.h b/drivers/net/wireless/ath9k/eeprom.h index 5c0d6c339fe9..60cb23de97c6 100644 --- a/drivers/net/wireless/ath9k/eeprom.h +++ b/drivers/net/wireless/ath9k/eeprom.h | |||
@@ -125,6 +125,7 @@ | |||
125 | #define AR5416_EEP_MINOR_VER_17 0x11 | 125 | #define AR5416_EEP_MINOR_VER_17 0x11 |
126 | #define AR5416_EEP_MINOR_VER_19 0x13 | 126 | #define AR5416_EEP_MINOR_VER_19 0x13 |
127 | #define AR5416_EEP_MINOR_VER_20 0x14 | 127 | #define AR5416_EEP_MINOR_VER_20 0x14 |
128 | #define AR5416_EEP_MINOR_VER_22 0x16 | ||
128 | 129 | ||
129 | #define AR5416_NUM_5G_CAL_PIERS 8 | 130 | #define AR5416_NUM_5G_CAL_PIERS 8 |
130 | #define AR5416_NUM_2G_CAL_PIERS 4 | 131 | #define AR5416_NUM_2G_CAL_PIERS 4 |
@@ -188,6 +189,7 @@ enum eeprom_param { | |||
188 | EEP_RXGAIN_TYPE, | 189 | EEP_RXGAIN_TYPE, |
189 | EEP_TXGAIN_TYPE, | 190 | EEP_TXGAIN_TYPE, |
190 | EEP_DAC_HPWR_5G, | 191 | EEP_DAC_HPWR_5G, |
192 | EEP_FRAC_N_5G | ||
191 | }; | 193 | }; |
192 | 194 | ||
193 | enum ar5416_rates { | 195 | enum ar5416_rates { |
@@ -232,7 +234,9 @@ struct base_eep_header { | |||
232 | u8 txGainType; | 234 | u8 txGainType; |
233 | u8 rcChainMask; | 235 | u8 rcChainMask; |
234 | u8 desiredScaleCCK; | 236 | u8 desiredScaleCCK; |
235 | u8 futureBase_3[23]; | 237 | u8 power_table_offset; |
238 | u8 frac_n_5g; | ||
239 | u8 futureBase_3[21]; | ||
236 | } __packed; | 240 | } __packed; |
237 | 241 | ||
238 | struct base_eep_header_4k { | 242 | struct base_eep_header_4k { |
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index 55d5a7440942..6939e4142325 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c | |||
@@ -823,7 +823,16 @@ static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc, | |||
823 | if (AR_SREV_9280_20(ah)) | 823 | if (AR_SREV_9280_20(ah)) |
824 | ath9k_hw_init_txgain_ini(ah); | 824 | ath9k_hw_init_txgain_ini(ah); |
825 | 825 | ||
826 | if (ah->hw_version.devid == AR9280_DEVID_PCI) { | 826 | if (!ath9k_hw_fill_cap_info(ah)) { |
827 | DPRINTF(sc, ATH_DBG_RESET, "failed ath9k_hw_fill_cap_info\n"); | ||
828 | ecode = -EINVAL; | ||
829 | goto bad; | ||
830 | } | ||
831 | |||
832 | if ((ah->hw_version.devid == AR9280_DEVID_PCI) && | ||
833 | test_bit(ATH9K_MODE_11A, ah->caps.wireless_modes)) { | ||
834 | |||
835 | /* EEPROM Fixup */ | ||
827 | for (i = 0; i < ah->iniModes.ia_rows; i++) { | 836 | for (i = 0; i < ah->iniModes.ia_rows; i++) { |
828 | u32 reg = INI_RA(&ah->iniModes, i, 0); | 837 | u32 reg = INI_RA(&ah->iniModes, i, 0); |
829 | 838 | ||
@@ -838,13 +847,6 @@ static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc, | |||
838 | } | 847 | } |
839 | } | 848 | } |
840 | 849 | ||
841 | if (!ath9k_hw_fill_cap_info(ah)) { | ||
842 | DPRINTF(sc, ATH_DBG_RESET, | ||
843 | "failed ath9k_hw_fill_cap_info\n"); | ||
844 | ecode = -EINVAL; | ||
845 | goto bad; | ||
846 | } | ||
847 | |||
848 | ecode = ath9k_hw_init_macaddr(ah); | 850 | ecode = ath9k_hw_init_macaddr(ah); |
849 | if (ecode != 0) { | 851 | if (ecode != 0) { |
850 | DPRINTF(sc, ATH_DBG_RESET, | 852 | DPRINTF(sc, ATH_DBG_RESET, |
diff --git a/drivers/net/wireless/ath9k/phy.c b/drivers/net/wireless/ath9k/phy.c index 52aa2a7abe7a..e1494bae0f9f 100644 --- a/drivers/net/wireless/ath9k/phy.c +++ b/drivers/net/wireless/ath9k/phy.c | |||
@@ -132,20 +132,27 @@ ath9k_hw_ar9280_set_channel(struct ath_hw *ah, | |||
132 | bMode = 0; | 132 | bMode = 0; |
133 | fracMode = 0; | 133 | fracMode = 0; |
134 | 134 | ||
135 | if ((freq % 20) == 0) { | 135 | switch(ah->eep_ops->get_eeprom(ah, EEP_FRAC_N_5G)) { |
136 | aModeRefSel = 3; | 136 | case 0: |
137 | } else if ((freq % 10) == 0) { | 137 | if ((freq % 20) == 0) { |
138 | aModeRefSel = 2; | 138 | aModeRefSel = 3; |
139 | } else { | 139 | } else if ((freq % 10) == 0) { |
140 | aModeRefSel = 2; | ||
141 | } | ||
142 | if (aModeRefSel) | ||
143 | break; | ||
144 | case 1: | ||
145 | default: | ||
140 | aModeRefSel = 0; | 146 | aModeRefSel = 0; |
141 | |||
142 | fracMode = 1; | 147 | fracMode = 1; |
143 | refDivA = 1; | 148 | refDivA = 1; |
144 | channelSel = (freq * 0x8000) / 15; | 149 | channelSel = (freq * 0x8000) / 15; |
145 | 150 | ||
146 | REG_RMW_FIELD(ah, AR_AN_SYNTH9, | 151 | REG_RMW_FIELD(ah, AR_AN_SYNTH9, |
147 | AR_AN_SYNTH9_REFDIVA, refDivA); | 152 | AR_AN_SYNTH9_REFDIVA, refDivA); |
153 | |||
148 | } | 154 | } |
155 | |||
149 | if (!fracMode) { | 156 | if (!fracMode) { |
150 | ndiv = (freq * (refDivA >> aModeRefSel)) / 60; | 157 | ndiv = (freq * (refDivA >> aModeRefSel)) / 60; |
151 | channelSel = ndiv & 0x1ff; | 158 | channelSel = ndiv & 0x1ff; |