diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/reset.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/reset.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c index bc84aaa31446..84206898f77d 100644 --- a/drivers/net/wireless/ath/ath5k/reset.c +++ b/drivers/net/wireless/ath/ath5k/reset.c | |||
@@ -537,7 +537,7 @@ int ath5k_hw_on_hold(struct ath5k_hw *ah) | |||
537 | * we ingore that flag for PCI-E cards. On PCI cards | 537 | * we ingore that flag for PCI-E cards. On PCI cards |
538 | * this flag gets cleared after 64 PCI clocks. | 538 | * this flag gets cleared after 64 PCI clocks. |
539 | */ | 539 | */ |
540 | bus_flags = (pdev && pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI; | 540 | bus_flags = (pdev && pci_is_pcie(pdev)) ? 0 : AR5K_RESET_CTL_PCI; |
541 | 541 | ||
542 | if (ah->ah_version == AR5K_AR5210) { | 542 | if (ah->ah_version == AR5K_AR5210) { |
543 | ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | | 543 | ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | |
@@ -594,7 +594,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) | |||
594 | * we ingore that flag for PCI-E cards. On PCI cards | 594 | * we ingore that flag for PCI-E cards. On PCI cards |
595 | * this flag gets cleared after 64 PCI clocks. | 595 | * this flag gets cleared after 64 PCI clocks. |
596 | */ | 596 | */ |
597 | bus_flags = (pdev && pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI; | 597 | bus_flags = (pdev && pci_is_pcie(pdev)) ? 0 : AR5K_RESET_CTL_PCI; |
598 | 598 | ||
599 | if (ah->ah_version == AR5K_AR5210) { | 599 | if (ah->ah_version == AR5K_AR5210) { |
600 | ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | | 600 | ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | |
@@ -866,15 +866,18 @@ static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah, | |||
866 | } | 866 | } |
867 | 867 | ||
868 | static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, | 868 | static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, |
869 | struct ieee80211_channel *channel, u8 ee_mode) | 869 | struct ieee80211_channel *channel) |
870 | { | 870 | { |
871 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; | 871 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; |
872 | s16 cck_ofdm_pwr_delta; | 872 | s16 cck_ofdm_pwr_delta; |
873 | u8 ee_mode; | ||
873 | 874 | ||
874 | /* TODO: Add support for AR5210 EEPROM */ | 875 | /* TODO: Add support for AR5210 EEPROM */ |
875 | if (ah->ah_version == AR5K_AR5210) | 876 | if (ah->ah_version == AR5K_AR5210) |
876 | return; | 877 | return; |
877 | 878 | ||
879 | ee_mode = ath5k_eeprom_mode_from_channel(channel); | ||
880 | |||
878 | /* Adjust power delta for channel 14 */ | 881 | /* Adjust power delta for channel 14 */ |
879 | if (channel->center_freq == 2484) | 882 | if (channel->center_freq == 2484) |
880 | cck_ofdm_pwr_delta = | 883 | cck_ofdm_pwr_delta = |
@@ -1020,13 +1023,11 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1020 | struct ieee80211_channel *channel, bool fast, bool skip_pcu) | 1023 | struct ieee80211_channel *channel, bool fast, bool skip_pcu) |
1021 | { | 1024 | { |
1022 | u32 s_seq[10], s_led[3], tsf_up, tsf_lo; | 1025 | u32 s_seq[10], s_led[3], tsf_up, tsf_lo; |
1023 | u8 mode, freq, ee_mode; | 1026 | u8 mode; |
1024 | int i, ret; | 1027 | int i, ret; |
1025 | 1028 | ||
1026 | ee_mode = 0; | ||
1027 | tsf_up = 0; | 1029 | tsf_up = 0; |
1028 | tsf_lo = 0; | 1030 | tsf_lo = 0; |
1029 | freq = 0; | ||
1030 | mode = 0; | 1031 | mode = 0; |
1031 | 1032 | ||
1032 | /* | 1033 | /* |
@@ -1071,8 +1072,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1071 | switch (channel->hw_value & CHANNEL_MODES) { | 1072 | switch (channel->hw_value & CHANNEL_MODES) { |
1072 | case CHANNEL_A: | 1073 | case CHANNEL_A: |
1073 | mode = AR5K_MODE_11A; | 1074 | mode = AR5K_MODE_11A; |
1074 | freq = AR5K_INI_RFGAIN_5GHZ; | ||
1075 | ee_mode = AR5K_EEPROM_MODE_11A; | ||
1076 | break; | 1075 | break; |
1077 | case CHANNEL_G: | 1076 | case CHANNEL_G: |
1078 | 1077 | ||
@@ -1083,8 +1082,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1083 | } | 1082 | } |
1084 | 1083 | ||
1085 | mode = AR5K_MODE_11G; | 1084 | mode = AR5K_MODE_11G; |
1086 | freq = AR5K_INI_RFGAIN_2GHZ; | ||
1087 | ee_mode = AR5K_EEPROM_MODE_11G; | ||
1088 | break; | 1085 | break; |
1089 | case CHANNEL_B: | 1086 | case CHANNEL_B: |
1090 | 1087 | ||
@@ -1095,8 +1092,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1095 | } | 1092 | } |
1096 | 1093 | ||
1097 | mode = AR5K_MODE_11B; | 1094 | mode = AR5K_MODE_11B; |
1098 | freq = AR5K_INI_RFGAIN_2GHZ; | ||
1099 | ee_mode = AR5K_EEPROM_MODE_11B; | ||
1100 | break; | 1095 | break; |
1101 | case CHANNEL_XR: | 1096 | case CHANNEL_XR: |
1102 | if (ah->ah_version == AR5K_AR5211) { | 1097 | if (ah->ah_version == AR5K_AR5211) { |
@@ -1105,8 +1100,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1105 | return -EINVAL; | 1100 | return -EINVAL; |
1106 | } | 1101 | } |
1107 | mode = AR5K_MODE_XR; | 1102 | mode = AR5K_MODE_XR; |
1108 | freq = AR5K_INI_RFGAIN_5GHZ; | ||
1109 | ee_mode = AR5K_EEPROM_MODE_11A; | ||
1110 | break; | 1103 | break; |
1111 | default: | 1104 | default: |
1112 | ATH5K_ERR(ah->ah_sc, | 1105 | ATH5K_ERR(ah->ah_sc, |
@@ -1119,8 +1112,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1119 | * go on. If it fails continue with a normal reset. | 1112 | * go on. If it fails continue with a normal reset. |
1120 | */ | 1113 | */ |
1121 | if (fast) { | 1114 | if (fast) { |
1122 | ret = ath5k_hw_phy_init(ah, channel, mode, | 1115 | ret = ath5k_hw_phy_init(ah, channel, mode, true); |
1123 | ee_mode, freq, true); | ||
1124 | if (ret) { | 1116 | if (ret) { |
1125 | ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET, | 1117 | ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET, |
1126 | "fast chan change failed, falling back to normal reset\n"); | 1118 | "fast chan change failed, falling back to normal reset\n"); |
@@ -1217,7 +1209,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1217 | ath5k_hw_tweak_initval_settings(ah, channel); | 1209 | ath5k_hw_tweak_initval_settings(ah, channel); |
1218 | 1210 | ||
1219 | /* Commit values from EEPROM */ | 1211 | /* Commit values from EEPROM */ |
1220 | ath5k_hw_commit_eeprom_settings(ah, channel, ee_mode); | 1212 | ath5k_hw_commit_eeprom_settings(ah, channel); |
1221 | 1213 | ||
1222 | 1214 | ||
1223 | /* | 1215 | /* |
@@ -1256,7 +1248,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1256 | /* | 1248 | /* |
1257 | * Initialize PHY | 1249 | * Initialize PHY |
1258 | */ | 1250 | */ |
1259 | ret = ath5k_hw_phy_init(ah, channel, mode, ee_mode, freq, false); | 1251 | ret = ath5k_hw_phy_init(ah, channel, mode, false); |
1260 | if (ret) { | 1252 | if (ret) { |
1261 | ATH5K_ERR(ah->ah_sc, | 1253 | ATH5K_ERR(ah->ah_sc, |
1262 | "failed to initialize PHY (%i) !\n", ret); | 1254 | "failed to initialize PHY (%i) !\n", ret); |