diff options
author | Pavel Roskin <proski@gnu.org> | 2010-04-07 01:33:33 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-04-08 15:24:12 -0400 |
commit | 2eb46d9bda44b3f85727fee6865d9b25725e6bf9 (patch) | |
tree | 570f07de7cd6ce607a38b186062d972d29a64cd5 /drivers/net | |
parent | f984d94c500c79048b33ab14923dfcec336d9968 (diff) |
ath9k: simplify AR9220 fixup code for AR_AN_TOP2 register
Don't modify ah->iniModes, it's supposed to be constant. Instead, apply
the fixup when the data is written to the registers.
Change ath9k_hw_init_eeprom_fix() to only determine whether the fixup is
needed.
This allows similteneous support for AR9220 cards that need AR_AN_TOP2
fixup (such as Ubiquiti SR71-12) and those that don't need it (D-Link
DWA-552 rev A2).
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 76 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 1 |
2 files changed, 13 insertions, 64 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 88f8bfdbded4..3b9f4c1f8d4e 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -27,9 +27,6 @@ | |||
27 | 27 | ||
28 | static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type); | 28 | static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type); |
29 | static void ath9k_hw_set_regs(struct ath_hw *ah, struct ath9k_channel *chan); | 29 | static void ath9k_hw_set_regs(struct ath_hw *ah, struct ath9k_channel *chan); |
30 | static u32 ath9k_hw_ini_fixup(struct ath_hw *ah, | ||
31 | struct ar5416_eeprom_def *pEepData, | ||
32 | u32 reg, u32 value); | ||
33 | 30 | ||
34 | MODULE_AUTHOR("Atheros Communications"); | 31 | MODULE_AUTHOR("Atheros Communications"); |
35 | MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards."); | 32 | MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards."); |
@@ -844,24 +841,17 @@ static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah) | |||
844 | 841 | ||
845 | static void ath9k_hw_init_eeprom_fix(struct ath_hw *ah) | 842 | static void ath9k_hw_init_eeprom_fix(struct ath_hw *ah) |
846 | { | 843 | { |
847 | u32 i, j; | 844 | struct base_eep_header *pBase = &(ah->eeprom.def.baseEepHeader); |
848 | 845 | struct ath_common *common = ath9k_hw_common(ah); | |
849 | if (ah->hw_version.devid == AR9280_DEVID_PCI) { | ||
850 | |||
851 | /* EEPROM Fixup */ | ||
852 | for (i = 0; i < ah->iniModes.ia_rows; i++) { | ||
853 | u32 reg = INI_RA(&ah->iniModes, i, 0); | ||
854 | 846 | ||
855 | for (j = 1; j < ah->iniModes.ia_columns; j++) { | 847 | ah->need_an_top2_fixup = (ah->hw_version.devid == AR9280_DEVID_PCI) && |
856 | u32 val = INI_RA(&ah->iniModes, i, j); | 848 | (ah->eep_map != EEP_MAP_4KBITS) && |
849 | ((pBase->version & 0xff) > 0x0a) && | ||
850 | (pBase->pwdclkind == 0); | ||
857 | 851 | ||
858 | INI_RA(&ah->iniModes, i, j) = | 852 | if (ah->need_an_top2_fixup) |
859 | ath9k_hw_ini_fixup(ah, | 853 | ath_print(common, ATH_DBG_EEPROM, |
860 | &ah->eeprom.def, | 854 | "needs fixup for AR_AN_TOP2 register\n"); |
861 | reg, val); | ||
862 | } | ||
863 | } | ||
864 | } | ||
865 | } | 855 | } |
866 | 856 | ||
867 | int ath9k_hw_init(struct ath_hw *ah) | 857 | int ath9k_hw_init(struct ath_hw *ah) |
@@ -1305,51 +1295,6 @@ static void ath9k_hw_override_ini(struct ath_hw *ah, | |||
1305 | } | 1295 | } |
1306 | } | 1296 | } |
1307 | 1297 | ||
1308 | static u32 ath9k_hw_def_ini_fixup(struct ath_hw *ah, | ||
1309 | struct ar5416_eeprom_def *pEepData, | ||
1310 | u32 reg, u32 value) | ||
1311 | { | ||
1312 | struct base_eep_header *pBase = &(pEepData->baseEepHeader); | ||
1313 | struct ath_common *common = ath9k_hw_common(ah); | ||
1314 | |||
1315 | switch (ah->hw_version.devid) { | ||
1316 | case AR9280_DEVID_PCI: | ||
1317 | if (reg == 0x7894) { | ||
1318 | ath_print(common, ATH_DBG_EEPROM, | ||
1319 | "ini VAL: %x EEPROM: %x\n", value, | ||
1320 | (pBase->version & 0xff)); | ||
1321 | |||
1322 | if ((pBase->version & 0xff) > 0x0a) { | ||
1323 | ath_print(common, ATH_DBG_EEPROM, | ||
1324 | "PWDCLKIND: %d\n", | ||
1325 | pBase->pwdclkind); | ||
1326 | value &= ~AR_AN_TOP2_PWDCLKIND; | ||
1327 | value |= AR_AN_TOP2_PWDCLKIND & | ||
1328 | (pBase->pwdclkind << AR_AN_TOP2_PWDCLKIND_S); | ||
1329 | } else { | ||
1330 | ath_print(common, ATH_DBG_EEPROM, | ||
1331 | "PWDCLKIND Earlier Rev\n"); | ||
1332 | } | ||
1333 | |||
1334 | ath_print(common, ATH_DBG_EEPROM, | ||
1335 | "final ini VAL: %x\n", value); | ||
1336 | } | ||
1337 | break; | ||
1338 | } | ||
1339 | |||
1340 | return value; | ||
1341 | } | ||
1342 | |||
1343 | static u32 ath9k_hw_ini_fixup(struct ath_hw *ah, | ||
1344 | struct ar5416_eeprom_def *pEepData, | ||
1345 | u32 reg, u32 value) | ||
1346 | { | ||
1347 | if (ah->eep_map == EEP_MAP_4KBITS) | ||
1348 | return value; | ||
1349 | else | ||
1350 | return ath9k_hw_def_ini_fixup(ah, pEepData, reg, value); | ||
1351 | } | ||
1352 | |||
1353 | static void ath9k_olc_init(struct ath_hw *ah) | 1298 | static void ath9k_olc_init(struct ath_hw *ah) |
1354 | { | 1299 | { |
1355 | u32 i; | 1300 | u32 i; |
@@ -1455,6 +1400,9 @@ static int ath9k_hw_process_ini(struct ath_hw *ah, | |||
1455 | u32 reg = INI_RA(&ah->iniModes, i, 0); | 1400 | u32 reg = INI_RA(&ah->iniModes, i, 0); |
1456 | u32 val = INI_RA(&ah->iniModes, i, modesIndex); | 1401 | u32 val = INI_RA(&ah->iniModes, i, modesIndex); |
1457 | 1402 | ||
1403 | if (reg == AR_AN_TOP2 && ah->need_an_top2_fixup) | ||
1404 | val &= ~AR_AN_TOP2_PWDCLKIND; | ||
1405 | |||
1458 | REG_WRITE(ah, reg, val); | 1406 | REG_WRITE(ah, reg, val); |
1459 | 1407 | ||
1460 | if (reg >= 0x7800 && reg < 0x78a0 | 1408 | if (reg >= 0x7800 && reg < 0x78a0 |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index b02a97c72c64..f4821cf33b87 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -459,6 +459,7 @@ struct ath_hw { | |||
459 | 459 | ||
460 | bool sw_mgmt_crypto; | 460 | bool sw_mgmt_crypto; |
461 | bool is_pciexpress; | 461 | bool is_pciexpress; |
462 | bool need_an_top2_fixup; | ||
462 | u16 tx_trig_level; | 463 | u16 tx_trig_level; |
463 | u16 rfsilent; | 464 | u16 rfsilent; |
464 | u32 rfkill_gpio; | 465 | u32 rfkill_gpio; |