aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ar5008_phy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ar5008_phy.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar5008_phy.c187
1 files changed, 84 insertions, 103 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index 9af9f23af3c..059330aac64 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -130,9 +130,8 @@ static void ar5008_hw_force_bias(struct ath_hw *ah, u16 synth_freq)
130 /* pre-reverse this field */ 130 /* pre-reverse this field */
131 tmp_reg = ath9k_hw_reverse_bits(new_bias, 3); 131 tmp_reg = ath9k_hw_reverse_bits(new_bias, 3);
132 132
133 ath_print(common, ATH_DBG_CONFIG, 133 ath_dbg(common, ATH_DBG_CONFIG, "Force rf_pwd_icsyndiv to %1d on %4d\n",
134 "Force rf_pwd_icsyndiv to %1d on %4d\n", 134 new_bias, synth_freq);
135 new_bias, synth_freq);
136 135
137 /* swizzle rf_pwd_icsyndiv */ 136 /* swizzle rf_pwd_icsyndiv */
138 ar5008_hw_phy_modify_rx_buffer(ah->analogBank6Data, tmp_reg, 3, 181, 3); 137 ar5008_hw_phy_modify_rx_buffer(ah->analogBank6Data, tmp_reg, 3, 181, 3);
@@ -1054,10 +1053,9 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
1054 u32 level = param; 1053 u32 level = param;
1055 1054
1056 if (level >= ARRAY_SIZE(ah->totalSizeDesired)) { 1055 if (level >= ARRAY_SIZE(ah->totalSizeDesired)) {
1057 ath_print(common, ATH_DBG_ANI, 1056 ath_dbg(common, ATH_DBG_ANI,
1058 "level out of range (%u > %u)\n", 1057 "level out of range (%u > %zu)\n",
1059 level, 1058 level, ARRAY_SIZE(ah->totalSizeDesired));
1060 (unsigned)ARRAY_SIZE(ah->totalSizeDesired));
1061 return false; 1059 return false;
1062 } 1060 }
1063 1061
@@ -1159,10 +1157,9 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
1159 u32 level = param; 1157 u32 level = param;
1160 1158
1161 if (level >= ARRAY_SIZE(firstep)) { 1159 if (level >= ARRAY_SIZE(firstep)) {
1162 ath_print(common, ATH_DBG_ANI, 1160 ath_dbg(common, ATH_DBG_ANI,
1163 "level out of range (%u > %u)\n", 1161 "level out of range (%u > %zu)\n",
1164 level, 1162 level, ARRAY_SIZE(firstep));
1165 (unsigned) ARRAY_SIZE(firstep));
1166 return false; 1163 return false;
1167 } 1164 }
1168 REG_RMW_FIELD(ah, AR_PHY_FIND_SIG, 1165 REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
@@ -1180,10 +1177,9 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
1180 u32 level = param; 1177 u32 level = param;
1181 1178
1182 if (level >= ARRAY_SIZE(cycpwrThr1)) { 1179 if (level >= ARRAY_SIZE(cycpwrThr1)) {
1183 ath_print(common, ATH_DBG_ANI, 1180 ath_dbg(common, ATH_DBG_ANI,
1184 "level out of range (%u > %u)\n", 1181 "level out of range (%u > %zu)\n",
1185 level, 1182 level, ARRAY_SIZE(cycpwrThr1));
1186 (unsigned) ARRAY_SIZE(cycpwrThr1));
1187 return false; 1183 return false;
1188 } 1184 }
1189 REG_RMW_FIELD(ah, AR_PHY_TIMING5, 1185 REG_RMW_FIELD(ah, AR_PHY_TIMING5,
@@ -1199,25 +1195,22 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
1199 case ATH9K_ANI_PRESENT: 1195 case ATH9K_ANI_PRESENT:
1200 break; 1196 break;
1201 default: 1197 default:
1202 ath_print(common, ATH_DBG_ANI, 1198 ath_dbg(common, ATH_DBG_ANI, "invalid cmd %u\n", cmd);
1203 "invalid cmd %u\n", cmd);
1204 return false; 1199 return false;
1205 } 1200 }
1206 1201
1207 ath_print(common, ATH_DBG_ANI, "ANI parameters:\n"); 1202 ath_dbg(common, ATH_DBG_ANI, "ANI parameters:\n");
1208 ath_print(common, ATH_DBG_ANI, 1203 ath_dbg(common, ATH_DBG_ANI,
1209 "noiseImmunityLevel=%d, spurImmunityLevel=%d, " 1204 "noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetectOff=%d\n",
1210 "ofdmWeakSigDetectOff=%d\n", 1205 aniState->noiseImmunityLevel,
1211 aniState->noiseImmunityLevel, 1206 aniState->spurImmunityLevel,
1212 aniState->spurImmunityLevel, 1207 !aniState->ofdmWeakSigDetectOff);
1213 !aniState->ofdmWeakSigDetectOff); 1208 ath_dbg(common, ATH_DBG_ANI,
1214 ath_print(common, ATH_DBG_ANI, 1209 "cckWeakSigThreshold=%d, firstepLevel=%d, listenTime=%d\n",
1215 "cckWeakSigThreshold=%d, " 1210 aniState->cckWeakSigThreshold,
1216 "firstepLevel=%d, listenTime=%d\n", 1211 aniState->firstepLevel,
1217 aniState->cckWeakSigThreshold, 1212 aniState->listenTime);
1218 aniState->firstepLevel, 1213 ath_dbg(common, ATH_DBG_ANI,
1219 aniState->listenTime);
1220 ath_print(common, ATH_DBG_ANI,
1221 "ofdmPhyErrCount=%d, cckPhyErrCount=%d\n\n", 1214 "ofdmPhyErrCount=%d, cckPhyErrCount=%d\n\n",
1222 aniState->ofdmPhyErrCount, 1215 aniState->ofdmPhyErrCount,
1223 aniState->cckPhyErrCount); 1216 aniState->cckPhyErrCount);
@@ -1302,12 +1295,12 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
1302 AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); 1295 AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
1303 1296
1304 if (!on != aniState->ofdmWeakSigDetectOff) { 1297 if (!on != aniState->ofdmWeakSigDetectOff) {
1305 ath_print(common, ATH_DBG_ANI, 1298 ath_dbg(common, ATH_DBG_ANI,
1306 "** ch %d: ofdm weak signal: %s=>%s\n", 1299 "** ch %d: ofdm weak signal: %s=>%s\n",
1307 chan->channel, 1300 chan->channel,
1308 !aniState->ofdmWeakSigDetectOff ? 1301 !aniState->ofdmWeakSigDetectOff ?
1309 "on" : "off", 1302 "on" : "off",
1310 on ? "on" : "off"); 1303 on ? "on" : "off");
1311 if (on) 1304 if (on)
1312 ah->stats.ast_ani_ofdmon++; 1305 ah->stats.ast_ani_ofdmon++;
1313 else 1306 else
@@ -1320,11 +1313,9 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
1320 u32 level = param; 1313 u32 level = param;
1321 1314
1322 if (level >= ARRAY_SIZE(firstep_table)) { 1315 if (level >= ARRAY_SIZE(firstep_table)) {
1323 ath_print(common, ATH_DBG_ANI, 1316 ath_dbg(common, ATH_DBG_ANI,
1324 "ATH9K_ANI_FIRSTEP_LEVEL: level " 1317 "ATH9K_ANI_FIRSTEP_LEVEL: level out of range (%u > %zu)\n",
1325 "out of range (%u > %u)\n", 1318 level, ARRAY_SIZE(firstep_table));
1326 level,
1327 (unsigned) ARRAY_SIZE(firstep_table));
1328 return false; 1319 return false;
1329 } 1320 }
1330 1321
@@ -1359,24 +1350,22 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
1359 AR_PHY_FIND_SIG_FIRSTEP_LOW, value2); 1350 AR_PHY_FIND_SIG_FIRSTEP_LOW, value2);
1360 1351
1361 if (level != aniState->firstepLevel) { 1352 if (level != aniState->firstepLevel) {
1362 ath_print(common, ATH_DBG_ANI, 1353 ath_dbg(common, ATH_DBG_ANI,
1363 "** ch %d: level %d=>%d[def:%d] " 1354 "** ch %d: level %d=>%d[def:%d] firstep[level]=%d ini=%d\n",
1364 "firstep[level]=%d ini=%d\n", 1355 chan->channel,
1365 chan->channel, 1356 aniState->firstepLevel,
1366 aniState->firstepLevel, 1357 level,
1367 level, 1358 ATH9K_ANI_FIRSTEP_LVL_NEW,
1368 ATH9K_ANI_FIRSTEP_LVL_NEW, 1359 value,
1369 value, 1360 aniState->iniDef.firstep);
1370 aniState->iniDef.firstep); 1361 ath_dbg(common, ATH_DBG_ANI,
1371 ath_print(common, ATH_DBG_ANI, 1362 "** ch %d: level %d=>%d[def:%d] firstep_low[level]=%d ini=%d\n",
1372 "** ch %d: level %d=>%d[def:%d] " 1363 chan->channel,
1373 "firstep_low[level]=%d ini=%d\n", 1364 aniState->firstepLevel,
1374 chan->channel, 1365 level,
1375 aniState->firstepLevel, 1366 ATH9K_ANI_FIRSTEP_LVL_NEW,
1376 level, 1367 value2,
1377 ATH9K_ANI_FIRSTEP_LVL_NEW, 1368 aniState->iniDef.firstepLow);
1378 value2,
1379 aniState->iniDef.firstepLow);
1380 if (level > aniState->firstepLevel) 1369 if (level > aniState->firstepLevel)
1381 ah->stats.ast_ani_stepup++; 1370 ah->stats.ast_ani_stepup++;
1382 else if (level < aniState->firstepLevel) 1371 else if (level < aniState->firstepLevel)
@@ -1389,11 +1378,9 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
1389 u32 level = param; 1378 u32 level = param;
1390 1379
1391 if (level >= ARRAY_SIZE(cycpwrThr1_table)) { 1380 if (level >= ARRAY_SIZE(cycpwrThr1_table)) {
1392 ath_print(common, ATH_DBG_ANI, 1381 ath_dbg(common, ATH_DBG_ANI,
1393 "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level " 1382 "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%u > %zu)\n",
1394 "out of range (%u > %u)\n", 1383 level, ARRAY_SIZE(cycpwrThr1_table));
1395 level,
1396 (unsigned) ARRAY_SIZE(cycpwrThr1_table));
1397 return false; 1384 return false;
1398 } 1385 }
1399 /* 1386 /*
@@ -1427,24 +1414,22 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
1427 AR_PHY_EXT_TIMING5_CYCPWR_THR1, value2); 1414 AR_PHY_EXT_TIMING5_CYCPWR_THR1, value2);
1428 1415
1429 if (level != aniState->spurImmunityLevel) { 1416 if (level != aniState->spurImmunityLevel) {
1430 ath_print(common, ATH_DBG_ANI, 1417 ath_dbg(common, ATH_DBG_ANI,
1431 "** ch %d: level %d=>%d[def:%d] " 1418 "** ch %d: level %d=>%d[def:%d] cycpwrThr1[level]=%d ini=%d\n",
1432 "cycpwrThr1[level]=%d ini=%d\n", 1419 chan->channel,
1433 chan->channel, 1420 aniState->spurImmunityLevel,
1434 aniState->spurImmunityLevel, 1421 level,
1435 level, 1422 ATH9K_ANI_SPUR_IMMUNE_LVL_NEW,
1436 ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, 1423 value,
1437 value, 1424 aniState->iniDef.cycpwrThr1);
1438 aniState->iniDef.cycpwrThr1); 1425 ath_dbg(common, ATH_DBG_ANI,
1439 ath_print(common, ATH_DBG_ANI, 1426 "** ch %d: level %d=>%d[def:%d] cycpwrThr1Ext[level]=%d ini=%d\n",
1440 "** ch %d: level %d=>%d[def:%d] " 1427 chan->channel,
1441 "cycpwrThr1Ext[level]=%d ini=%d\n", 1428 aniState->spurImmunityLevel,
1442 chan->channel, 1429 level,
1443 aniState->spurImmunityLevel, 1430 ATH9K_ANI_SPUR_IMMUNE_LVL_NEW,
1444 level, 1431 value2,
1445 ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, 1432 aniState->iniDef.cycpwrThr1Ext);
1446 value2,
1447 aniState->iniDef.cycpwrThr1Ext);
1448 if (level > aniState->spurImmunityLevel) 1433 if (level > aniState->spurImmunityLevel)
1449 ah->stats.ast_ani_spurup++; 1434 ah->stats.ast_ani_spurup++;
1450 else if (level < aniState->spurImmunityLevel) 1435 else if (level < aniState->spurImmunityLevel)
@@ -1463,22 +1448,19 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
1463 case ATH9K_ANI_PRESENT: 1448 case ATH9K_ANI_PRESENT:
1464 break; 1449 break;
1465 default: 1450 default:
1466 ath_print(common, ATH_DBG_ANI, 1451 ath_dbg(common, ATH_DBG_ANI, "invalid cmd %u\n", cmd);
1467 "invalid cmd %u\n", cmd);
1468 return false; 1452 return false;
1469 } 1453 }
1470 1454
1471 ath_print(common, ATH_DBG_ANI, 1455 ath_dbg(common, ATH_DBG_ANI,
1472 "ANI parameters: SI=%d, ofdmWS=%s FS=%d " 1456 "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n",
1473 "MRCcck=%s listenTime=%d " 1457 aniState->spurImmunityLevel,
1474 "ofdmErrs=%d cckErrs=%d\n", 1458 !aniState->ofdmWeakSigDetectOff ? "on" : "off",
1475 aniState->spurImmunityLevel, 1459 aniState->firstepLevel,
1476 !aniState->ofdmWeakSigDetectOff ? "on" : "off", 1460 !aniState->mrcCCKOff ? "on" : "off",
1477 aniState->firstepLevel, 1461 aniState->listenTime,
1478 !aniState->mrcCCKOff ? "on" : "off", 1462 aniState->ofdmPhyErrCount,
1479 aniState->listenTime, 1463 aniState->cckPhyErrCount);
1480 aniState->ofdmPhyErrCount,
1481 aniState->cckPhyErrCount);
1482 return true; 1464 return true;
1483} 1465}
1484 1466
@@ -1524,13 +1506,12 @@ static void ar5008_hw_ani_cache_ini_regs(struct ath_hw *ah)
1524 1506
1525 iniDef = &aniState->iniDef; 1507 iniDef = &aniState->iniDef;
1526 1508
1527 ath_print(common, ATH_DBG_ANI, 1509 ath_dbg(common, ATH_DBG_ANI, "ver %d.%d opmode %u chan %d Mhz/0x%x\n",
1528 "ver %d.%d opmode %u chan %d Mhz/0x%x\n", 1510 ah->hw_version.macVersion,
1529 ah->hw_version.macVersion, 1511 ah->hw_version.macRev,
1530 ah->hw_version.macRev, 1512 ah->opmode,
1531 ah->opmode, 1513 chan->channel,
1532 chan->channel, 1514 chan->channelFlags);
1533 chan->channelFlags);
1534 1515
1535 val = REG_READ(ah, AR_PHY_SFCORR); 1516 val = REG_READ(ah, AR_PHY_SFCORR);
1536 iniDef->m1Thresh = MS(val, AR_PHY_SFCORR_M1_THRESH); 1517 iniDef->m1Thresh = MS(val, AR_PHY_SFCORR_M1_THRESH);