aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/hw.c
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2013-12-17 23:23:27 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-12-18 15:23:51 -0500
commitd7df7a55cbac30acf8edade8f06458d35900ebfa (patch)
tree6a3ae828a3575178d29619f0a09065c0c26cb653 /drivers/net/wireless/ath/ath9k/hw.c
parent4dc78c437a0a2ac152a2b2c5e91a814a6ef3599e (diff)
ath9k: Use a subroutine for the AR9330 reset WAR
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.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.c70
1 files changed, 38 insertions, 32 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 3ca682f3c704..0e548a461f55 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1272,6 +1272,42 @@ void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
1272 *coef_exponent = coef_exp - 16; 1272 *coef_exponent = coef_exp - 16;
1273} 1273}
1274 1274
1275/* AR9330 WAR:
1276 * call external reset function to reset WMAC if:
1277 * - doing a cold reset
1278 * - we have pending frames in the TX queues.
1279 */
1280static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type)
1281{
1282 int i, npend = 0;
1283
1284 for (i = 0; i < AR_NUM_QCU; i++) {
1285 npend = ath9k_hw_numtxpending(ah, i);
1286 if (npend)
1287 break;
1288 }
1289
1290 if (ah->external_reset &&
1291 (npend || type == ATH9K_RESET_COLD)) {
1292 int reset_err = 0;
1293
1294 ath_dbg(ath9k_hw_common(ah), RESET,
1295 "reset MAC via external reset\n");
1296
1297 reset_err = ah->external_reset();
1298 if (reset_err) {
1299 ath_err(ath9k_hw_common(ah),
1300 "External reset failed, err=%d\n",
1301 reset_err);
1302 return false;
1303 }
1304
1305 REG_WRITE(ah, AR_RTC_RESET, 1);
1306 }
1307
1308 return true;
1309}
1310
1275static bool ath9k_hw_set_reset(struct ath_hw *ah, int type) 1311static bool ath9k_hw_set_reset(struct ath_hw *ah, int type)
1276{ 1312{
1277 u32 rst_flags; 1313 u32 rst_flags;
@@ -1322,38 +1358,8 @@ static bool ath9k_hw_set_reset(struct ath_hw *ah, int type)
1322 } 1358 }
1323 1359
1324 if (AR_SREV_9330(ah)) { 1360 if (AR_SREV_9330(ah)) {
1325 int npend = 0; 1361 if (!ath9k_hw_ar9330_reset_war(ah, type))
1326 int i; 1362 return false;
1327
1328 /* AR9330 WAR:
1329 * call external reset function to reset WMAC if:
1330 * - doing a cold reset
1331 * - we have pending frames in the TX queues
1332 */
1333
1334 for (i = 0; i < AR_NUM_QCU; i++) {
1335 npend = ath9k_hw_numtxpending(ah, i);
1336 if (npend)
1337 break;
1338 }
1339
1340 if (ah->external_reset &&
1341 (npend || type == ATH9K_RESET_COLD)) {
1342 int reset_err = 0;
1343
1344 ath_dbg(ath9k_hw_common(ah), RESET,
1345 "reset MAC via external reset\n");
1346
1347 reset_err = ah->external_reset();
1348 if (reset_err) {
1349 ath_err(ath9k_hw_common(ah),
1350 "External reset failed, err=%d\n",
1351 reset_err);
1352 return false;
1353 }
1354
1355 REG_WRITE(ah, AR_RTC_RESET, 1);
1356 }
1357 } 1363 }
1358 1364
1359 if (ath9k_hw_mci_is_enabled(ah)) 1365 if (ath9k_hw_mci_is_enabled(ah))