diff options
author | Nick Kossifidis <mick@madwifi-project.org> | 2009-04-30 15:55:45 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-06 15:14:55 -0400 |
commit | cd417519086b223562b50c364d7beab12ef4c62c (patch) | |
tree | 08cdb0c168bbbd1e000604fd9ee81289efcc2763 /drivers/net/wireless | |
parent | a082381044ce026e83dbd17f8837722b028fc07d (diff) |
ath5k: Read Spur channels from EEPROM
* Read Spur channel information from EEPROM and use default channels
for RF5413 compatible chips that don't have this info on EEPROM.
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/eeprom.c | 37 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/eeprom.h | 20 |
2 files changed, 56 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c index c85429d2de3..587c5b8ddc2 100644 --- a/drivers/net/wireless/ath/ath5k/eeprom.c +++ b/drivers/net/wireless/ath/ath5k/eeprom.c | |||
@@ -1694,9 +1694,40 @@ ath5k_eeprom_read_ctl_info(struct ath5k_hw *ah) | |||
1694 | return 0; | 1694 | return 0; |
1695 | } | 1695 | } |
1696 | 1696 | ||
1697 | static int | ||
1698 | ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah) | ||
1699 | { | ||
1700 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; | ||
1701 | u32 offset; | ||
1702 | u16 val; | ||
1703 | int ret = 0, i; | ||
1704 | |||
1705 | offset = AR5K_EEPROM_CTL(ee->ee_version) + | ||
1706 | AR5K_EEPROM_N_CTLS(ee->ee_version); | ||
1707 | |||
1708 | if (ee->ee_version < AR5K_EEPROM_VERSION_5_3) { | ||
1709 | /* No spur info for 5GHz */ | ||
1710 | ee->ee_spur_chans[0][0] = AR5K_EEPROM_NO_SPUR; | ||
1711 | /* 2 channels for 2GHz (2464/2420) */ | ||
1712 | ee->ee_spur_chans[0][1] = AR5K_EEPROM_5413_SPUR_CHAN_1; | ||
1713 | ee->ee_spur_chans[1][1] = AR5K_EEPROM_5413_SPUR_CHAN_2; | ||
1714 | ee->ee_spur_chans[2][1] = AR5K_EEPROM_NO_SPUR; | ||
1715 | } else if (ee->ee_version >= AR5K_EEPROM_VERSION_5_3) { | ||
1716 | for (i = 0; i < AR5K_EEPROM_N_SPUR_CHANS; i++) { | ||
1717 | AR5K_EEPROM_READ(offset, val); | ||
1718 | ee->ee_spur_chans[i][0] = val; | ||
1719 | AR5K_EEPROM_READ(offset + AR5K_EEPROM_N_SPUR_CHANS, | ||
1720 | val); | ||
1721 | ee->ee_spur_chans[i][1] = val; | ||
1722 | offset++; | ||
1723 | } | ||
1724 | } | ||
1725 | |||
1726 | return ret; | ||
1727 | } | ||
1697 | 1728 | ||
1698 | /* | 1729 | /* |
1699 | * Initialize eeprom power tables | 1730 | * Initialize eeprom data structure |
1700 | */ | 1731 | */ |
1701 | int | 1732 | int |
1702 | ath5k_eeprom_init(struct ath5k_hw *ah) | 1733 | ath5k_eeprom_init(struct ath5k_hw *ah) |
@@ -1719,6 +1750,10 @@ ath5k_eeprom_init(struct ath5k_hw *ah) | |||
1719 | if (err < 0) | 1750 | if (err < 0) |
1720 | return err; | 1751 | return err; |
1721 | 1752 | ||
1753 | err = ath5k_eeprom_read_spur_chans(ah); | ||
1754 | if (err < 0) | ||
1755 | return err; | ||
1756 | |||
1722 | return 0; | 1757 | return 0; |
1723 | } | 1758 | } |
1724 | 1759 | ||
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.h b/drivers/net/wireless/ath/ath5k/eeprom.h index b0c0606dea0..df9ffa044ea 100644 --- a/drivers/net/wireless/ath/ath5k/eeprom.h +++ b/drivers/net/wireless/ath/ath5k/eeprom.h | |||
@@ -211,6 +211,23 @@ | |||
211 | #define AR5K_EEPROM_I_GAIN 10 | 211 | #define AR5K_EEPROM_I_GAIN 10 |
212 | #define AR5K_EEPROM_CCK_OFDM_DELTA 15 | 212 | #define AR5K_EEPROM_CCK_OFDM_DELTA 15 |
213 | #define AR5K_EEPROM_N_IQ_CAL 2 | 213 | #define AR5K_EEPROM_N_IQ_CAL 2 |
214 | /* 5GHz/2GHz */ | ||
215 | enum ath5k_eeprom_freq_bands{ | ||
216 | AR5K_EEPROM_BAND_5GHZ = 0, | ||
217 | AR5K_EEPROM_BAND_2GHZ = 1, | ||
218 | AR5K_EEPROM_N_FREQ_BANDS, | ||
219 | }; | ||
220 | /* Spur chans per freq band */ | ||
221 | #define AR5K_EEPROM_N_SPUR_CHANS 5 | ||
222 | /* fbin value for chan 2464 x2 */ | ||
223 | #define AR5K_EEPROM_5413_SPUR_CHAN_1 1640 | ||
224 | /* fbin value for chan 2420 x2 */ | ||
225 | #define AR5K_EEPROM_5413_SPUR_CHAN_2 1200 | ||
226 | #define AR5K_EEPROM_SPUR_CHAN_MASK 0x3FFF | ||
227 | #define AR5K_EEPROM_NO_SPUR 0x8000 | ||
228 | #define AR5K_SPUR_CHAN_WIDTH 87 | ||
229 | #define AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz 3125 | ||
230 | #define AR5K_SPUR_SYMBOL_WIDTH_TURBO_100Hz 6250 | ||
214 | 231 | ||
215 | #define AR5K_EEPROM_READ(_o, _v) do { \ | 232 | #define AR5K_EEPROM_READ(_o, _v) do { \ |
216 | ret = ath5k_hw_eeprom_read(ah, (_o), &(_v)); \ | 233 | ret = ath5k_hw_eeprom_read(ah, (_o), &(_v)); \ |
@@ -436,6 +453,9 @@ struct ath5k_eeprom_info { | |||
436 | s8 ee_pga_desired_size_turbo[AR5K_EEPROM_N_MODES]; | 453 | s8 ee_pga_desired_size_turbo[AR5K_EEPROM_N_MODES]; |
437 | s8 ee_pd_gain_overlap; | 454 | s8 ee_pd_gain_overlap; |
438 | 455 | ||
456 | /* Spur mitigation data (fbin values for spur channels) */ | ||
457 | u16 ee_spur_chans[AR5K_EEPROM_N_SPUR_CHANS][AR5K_EEPROM_N_FREQ_BANDS]; | ||
458 | |||
439 | u32 ee_antenna[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX]; | 459 | u32 ee_antenna[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX]; |
440 | }; | 460 | }; |
441 | 461 | ||