diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-09-13 05:42:02 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:29 -0400 |
commit | c46917bb53a546f60c7d3103407fe953c418dd5b (patch) | |
tree | 5598017157d88b70d3ec9905acb020303913c0e8 /drivers/net/wireless/ath/ath9k/hw.c | |
parent | cd9bf689600e62d84449d65b3d25fb6d2757589e (diff) |
atheros: add common debug printing
ath9k uses this for now, ath9k_htc is expected to re-use this
as well. We lave ath5k as is, but it certainly can also be
converted later.
The ath9k module parameter and debugfs entry is kept.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.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.c | 254 |
1 files changed, 139 insertions, 115 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index e6ca3158759b..8ecd1b0bdf8f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -94,9 +94,9 @@ bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout) | |||
94 | udelay(AH_TIME_QUANTUM); | 94 | udelay(AH_TIME_QUANTUM); |
95 | } | 95 | } |
96 | 96 | ||
97 | DPRINTF(ah, ATH_DBG_ANY, | 97 | ath_print(ath9k_hw_common(ah), ATH_DBG_ANY, |
98 | "timeout (%d us) on reg 0x%x: 0x%08x & 0x%08x != 0x%08x\n", | 98 | "timeout (%d us) on reg 0x%x: 0x%08x & 0x%08x != 0x%08x\n", |
99 | timeout, reg, REG_READ(ah, reg), mask, val); | 99 | timeout, reg, REG_READ(ah, reg), mask, val); |
100 | 100 | ||
101 | return false; | 101 | return false; |
102 | } | 102 | } |
@@ -178,9 +178,9 @@ u16 ath9k_hw_computetxtime(struct ath_hw *ah, | |||
178 | } | 178 | } |
179 | break; | 179 | break; |
180 | default: | 180 | default: |
181 | DPRINTF(ah, ATH_DBG_FATAL, | 181 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, |
182 | "Unknown phy %u (rate ix %u)\n", | 182 | "Unknown phy %u (rate ix %u)\n", |
183 | rates->info[rateix].phy, rateix); | 183 | rates->info[rateix].phy, rateix); |
184 | txTime = 0; | 184 | txTime = 0; |
185 | break; | 185 | break; |
186 | } | 186 | } |
@@ -285,6 +285,7 @@ static void ath9k_hw_disablepcie(struct ath_hw *ah) | |||
285 | 285 | ||
286 | static bool ath9k_hw_chip_test(struct ath_hw *ah) | 286 | static bool ath9k_hw_chip_test(struct ath_hw *ah) |
287 | { | 287 | { |
288 | struct ath_common *common = ath9k_hw_common(ah); | ||
288 | u32 regAddr[2] = { AR_STA_ID0, AR_PHY_BASE + (8 << 2) }; | 289 | u32 regAddr[2] = { AR_STA_ID0, AR_PHY_BASE + (8 << 2) }; |
289 | u32 regHold[2]; | 290 | u32 regHold[2]; |
290 | u32 patternData[4] = { 0x55555555, | 291 | u32 patternData[4] = { 0x55555555, |
@@ -303,10 +304,11 @@ static bool ath9k_hw_chip_test(struct ath_hw *ah) | |||
303 | REG_WRITE(ah, addr, wrData); | 304 | REG_WRITE(ah, addr, wrData); |
304 | rdData = REG_READ(ah, addr); | 305 | rdData = REG_READ(ah, addr); |
305 | if (rdData != wrData) { | 306 | if (rdData != wrData) { |
306 | DPRINTF(ah, ATH_DBG_FATAL, | 307 | ath_print(common, ATH_DBG_FATAL, |
307 | "address test failed " | 308 | "address test failed " |
308 | "addr: 0x%08x - wr:0x%08x != rd:0x%08x\n", | 309 | "addr: 0x%08x - wr:0x%08x != " |
309 | addr, wrData, rdData); | 310 | "rd:0x%08x\n", |
311 | addr, wrData, rdData); | ||
310 | return false; | 312 | return false; |
311 | } | 313 | } |
312 | } | 314 | } |
@@ -315,10 +317,11 @@ static bool ath9k_hw_chip_test(struct ath_hw *ah) | |||
315 | REG_WRITE(ah, addr, wrData); | 317 | REG_WRITE(ah, addr, wrData); |
316 | rdData = REG_READ(ah, addr); | 318 | rdData = REG_READ(ah, addr); |
317 | if (wrData != rdData) { | 319 | if (wrData != rdData) { |
318 | DPRINTF(ah, ATH_DBG_FATAL, | 320 | ath_print(common, ATH_DBG_FATAL, |
319 | "address test failed " | 321 | "address test failed " |
320 | "addr: 0x%08x - wr:0x%08x != rd:0x%08x\n", | 322 | "addr: 0x%08x - wr:0x%08x != " |
321 | addr, wrData, rdData); | 323 | "rd:0x%08x\n", |
324 | addr, wrData, rdData); | ||
322 | return false; | 325 | return false; |
323 | } | 326 | } |
324 | } | 327 | } |
@@ -440,8 +443,8 @@ static int ath9k_hw_rfattach(struct ath_hw *ah) | |||
440 | 443 | ||
441 | rfStatus = ath9k_hw_init_rf(ah, &ecode); | 444 | rfStatus = ath9k_hw_init_rf(ah, &ecode); |
442 | if (!rfStatus) { | 445 | if (!rfStatus) { |
443 | DPRINTF(ah, ATH_DBG_FATAL, | 446 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, |
444 | "RF setup failed, status: %u\n", ecode); | 447 | "RF setup failed, status: %u\n", ecode); |
445 | return ecode; | 448 | return ecode; |
446 | } | 449 | } |
447 | 450 | ||
@@ -465,9 +468,9 @@ static int ath9k_hw_rf_claim(struct ath_hw *ah) | |||
465 | case AR_RAD2122_SREV_MAJOR: | 468 | case AR_RAD2122_SREV_MAJOR: |
466 | break; | 469 | break; |
467 | default: | 470 | default: |
468 | DPRINTF(ah, ATH_DBG_FATAL, | 471 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, |
469 | "Radio Chip Rev 0x%02X not supported\n", | 472 | "Radio Chip Rev 0x%02X not supported\n", |
470 | val & AR_RADIO_SREV_MAJOR); | 473 | val & AR_RADIO_SREV_MAJOR); |
471 | return -EOPNOTSUPP; | 474 | return -EOPNOTSUPP; |
472 | } | 475 | } |
473 | 476 | ||
@@ -559,8 +562,10 @@ static int ath9k_hw_post_init(struct ath_hw *ah) | |||
559 | if (ecode != 0) | 562 | if (ecode != 0) |
560 | return ecode; | 563 | return ecode; |
561 | 564 | ||
562 | DPRINTF(ah, ATH_DBG_CONFIG, "Eeprom VER: %d, REV: %d\n", | 565 | ath_print(ath9k_hw_common(ah), ATH_DBG_CONFIG, |
563 | ah->eep_ops->get_eeprom_ver(ah), ah->eep_ops->get_eeprom_rev(ah)); | 566 | "Eeprom VER: %d, REV: %d\n", |
567 | ah->eep_ops->get_eeprom_ver(ah), | ||
568 | ah->eep_ops->get_eeprom_rev(ah)); | ||
564 | 569 | ||
565 | ecode = ath9k_hw_rfattach(ah); | 570 | ecode = ath9k_hw_rfattach(ah); |
566 | if (ecode != 0) | 571 | if (ecode != 0) |
@@ -874,6 +879,7 @@ static void ath9k_hw_init_11a_eeprom_fix(struct ath_hw *ah) | |||
874 | 879 | ||
875 | int ath9k_hw_init(struct ath_hw *ah) | 880 | int ath9k_hw_init(struct ath_hw *ah) |
876 | { | 881 | { |
882 | struct ath_common *common = ath9k_hw_common(ah); | ||
877 | int r = 0; | 883 | int r = 0; |
878 | 884 | ||
879 | if (!ath9k_hw_devid_supported(ah->hw_version.devid)) | 885 | if (!ath9k_hw_devid_supported(ah->hw_version.devid)) |
@@ -883,12 +889,13 @@ int ath9k_hw_init(struct ath_hw *ah) | |||
883 | ath9k_hw_init_config(ah); | 889 | ath9k_hw_init_config(ah); |
884 | 890 | ||
885 | if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) { | 891 | if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) { |
886 | DPRINTF(ah, ATH_DBG_FATAL, "Couldn't reset chip\n"); | 892 | ath_print(common, ATH_DBG_FATAL, |
893 | "Couldn't reset chip\n"); | ||
887 | return -EIO; | 894 | return -EIO; |
888 | } | 895 | } |
889 | 896 | ||
890 | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) { | 897 | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) { |
891 | DPRINTF(ah, ATH_DBG_FATAL, "Couldn't wakeup chip\n"); | 898 | ath_print(common, ATH_DBG_FATAL, "Couldn't wakeup chip\n"); |
892 | return -EIO; | 899 | return -EIO; |
893 | } | 900 | } |
894 | 901 | ||
@@ -903,14 +910,14 @@ int ath9k_hw_init(struct ath_hw *ah) | |||
903 | } | 910 | } |
904 | } | 911 | } |
905 | 912 | ||
906 | DPRINTF(ah, ATH_DBG_RESET, "serialize_regmode is %d\n", | 913 | ath_print(common, ATH_DBG_RESET, "serialize_regmode is %d\n", |
907 | ah->config.serialize_regmode); | 914 | ah->config.serialize_regmode); |
908 | 915 | ||
909 | if (!ath9k_hw_macversion_supported(ah->hw_version.macVersion)) { | 916 | if (!ath9k_hw_macversion_supported(ah->hw_version.macVersion)) { |
910 | DPRINTF(ah, ATH_DBG_FATAL, | 917 | ath_print(common, ATH_DBG_FATAL, |
911 | "Mac Chip Rev 0x%02x.%x is not supported by " | 918 | "Mac Chip Rev 0x%02x.%x is not supported by " |
912 | "this driver\n", ah->hw_version.macVersion, | 919 | "this driver\n", ah->hw_version.macVersion, |
913 | ah->hw_version.macRev); | 920 | ah->hw_version.macRev); |
914 | return -EOPNOTSUPP; | 921 | return -EOPNOTSUPP; |
915 | } | 922 | } |
916 | 923 | ||
@@ -948,8 +955,8 @@ int ath9k_hw_init(struct ath_hw *ah) | |||
948 | 955 | ||
949 | r = ath9k_hw_init_macaddr(ah); | 956 | r = ath9k_hw_init_macaddr(ah); |
950 | if (r) { | 957 | if (r) { |
951 | DPRINTF(ah, ATH_DBG_FATAL, | 958 | ath_print(common, ATH_DBG_FATAL, |
952 | "Failed to initialize MAC address\n"); | 959 | "Failed to initialize MAC address\n"); |
953 | return r; | 960 | return r; |
954 | } | 961 | } |
955 | 962 | ||
@@ -1133,7 +1140,8 @@ static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, | |||
1133 | static bool ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us) | 1140 | static bool ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us) |
1134 | { | 1141 | { |
1135 | if (us > ath9k_hw_mac_to_usec(ah, MS(0xffffffff, AR_TIME_OUT_ACK))) { | 1142 | if (us > ath9k_hw_mac_to_usec(ah, MS(0xffffffff, AR_TIME_OUT_ACK))) { |
1136 | DPRINTF(ah, ATH_DBG_RESET, "bad ack timeout %u\n", us); | 1143 | ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, |
1144 | "bad ack timeout %u\n", us); | ||
1137 | ah->acktimeout = (u32) -1; | 1145 | ah->acktimeout = (u32) -1; |
1138 | return false; | 1146 | return false; |
1139 | } else { | 1147 | } else { |
@@ -1147,7 +1155,8 @@ static bool ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us) | |||
1147 | static bool ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us) | 1155 | static bool ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us) |
1148 | { | 1156 | { |
1149 | if (us > ath9k_hw_mac_to_usec(ah, MS(0xffffffff, AR_TIME_OUT_CTS))) { | 1157 | if (us > ath9k_hw_mac_to_usec(ah, MS(0xffffffff, AR_TIME_OUT_CTS))) { |
1150 | DPRINTF(ah, ATH_DBG_RESET, "bad cts timeout %u\n", us); | 1158 | ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, |
1159 | "bad cts timeout %u\n", us); | ||
1151 | ah->ctstimeout = (u32) -1; | 1160 | ah->ctstimeout = (u32) -1; |
1152 | return false; | 1161 | return false; |
1153 | } else { | 1162 | } else { |
@@ -1161,8 +1170,8 @@ static bool ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us) | |||
1161 | static bool ath9k_hw_set_global_txtimeout(struct ath_hw *ah, u32 tu) | 1170 | static bool ath9k_hw_set_global_txtimeout(struct ath_hw *ah, u32 tu) |
1162 | { | 1171 | { |
1163 | if (tu > 0xFFFF) { | 1172 | if (tu > 0xFFFF) { |
1164 | DPRINTF(ah, ATH_DBG_XMIT, | 1173 | ath_print(ath9k_hw_common(ah), ATH_DBG_XMIT, |
1165 | "bad global tx timeout %u\n", tu); | 1174 | "bad global tx timeout %u\n", tu); |
1166 | ah->globaltxtimeout = (u32) -1; | 1175 | ah->globaltxtimeout = (u32) -1; |
1167 | return false; | 1176 | return false; |
1168 | } else { | 1177 | } else { |
@@ -1174,8 +1183,8 @@ static bool ath9k_hw_set_global_txtimeout(struct ath_hw *ah, u32 tu) | |||
1174 | 1183 | ||
1175 | static void ath9k_hw_init_user_settings(struct ath_hw *ah) | 1184 | static void ath9k_hw_init_user_settings(struct ath_hw *ah) |
1176 | { | 1185 | { |
1177 | DPRINTF(ah, ATH_DBG_RESET, "ah->misc_mode 0x%x\n", | 1186 | ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, "ah->misc_mode 0x%x\n", |
1178 | ah->misc_mode); | 1187 | ah->misc_mode); |
1179 | 1188 | ||
1180 | if (ah->misc_mode != 0) | 1189 | if (ah->misc_mode != 0) |
1181 | REG_WRITE(ah, AR_PCU_MISC, | 1190 | REG_WRITE(ah, AR_PCU_MISC, |
@@ -1267,28 +1276,29 @@ static u32 ath9k_hw_def_ini_fixup(struct ath_hw *ah, | |||
1267 | u32 reg, u32 value) | 1276 | u32 reg, u32 value) |
1268 | { | 1277 | { |
1269 | struct base_eep_header *pBase = &(pEepData->baseEepHeader); | 1278 | struct base_eep_header *pBase = &(pEepData->baseEepHeader); |
1279 | struct ath_common *common = ath9k_hw_common(ah); | ||
1270 | 1280 | ||
1271 | switch (ah->hw_version.devid) { | 1281 | switch (ah->hw_version.devid) { |
1272 | case AR9280_DEVID_PCI: | 1282 | case AR9280_DEVID_PCI: |
1273 | if (reg == 0x7894) { | 1283 | if (reg == 0x7894) { |
1274 | DPRINTF(ah, ATH_DBG_EEPROM, | 1284 | ath_print(common, ATH_DBG_EEPROM, |
1275 | "ini VAL: %x EEPROM: %x\n", value, | 1285 | "ini VAL: %x EEPROM: %x\n", value, |
1276 | (pBase->version & 0xff)); | 1286 | (pBase->version & 0xff)); |
1277 | 1287 | ||
1278 | if ((pBase->version & 0xff) > 0x0a) { | 1288 | if ((pBase->version & 0xff) > 0x0a) { |
1279 | DPRINTF(ah, ATH_DBG_EEPROM, | 1289 | ath_print(common, ATH_DBG_EEPROM, |
1280 | "PWDCLKIND: %d\n", | 1290 | "PWDCLKIND: %d\n", |
1281 | pBase->pwdclkind); | 1291 | pBase->pwdclkind); |
1282 | value &= ~AR_AN_TOP2_PWDCLKIND; | 1292 | value &= ~AR_AN_TOP2_PWDCLKIND; |
1283 | value |= AR_AN_TOP2_PWDCLKIND & | 1293 | value |= AR_AN_TOP2_PWDCLKIND & |
1284 | (pBase->pwdclkind << AR_AN_TOP2_PWDCLKIND_S); | 1294 | (pBase->pwdclkind << AR_AN_TOP2_PWDCLKIND_S); |
1285 | } else { | 1295 | } else { |
1286 | DPRINTF(ah, ATH_DBG_EEPROM, | 1296 | ath_print(common, ATH_DBG_EEPROM, |
1287 | "PWDCLKIND Earlier Rev\n"); | 1297 | "PWDCLKIND Earlier Rev\n"); |
1288 | } | 1298 | } |
1289 | 1299 | ||
1290 | DPRINTF(ah, ATH_DBG_EEPROM, | 1300 | ath_print(common, ATH_DBG_EEPROM, |
1291 | "final ini VAL: %x\n", value); | 1301 | "final ini VAL: %x\n", value); |
1292 | } | 1302 | } |
1293 | break; | 1303 | break; |
1294 | } | 1304 | } |
@@ -1460,8 +1470,8 @@ static int ath9k_hw_process_ini(struct ath_hw *ah, | |||
1460 | (u32) regulatory->power_limit)); | 1470 | (u32) regulatory->power_limit)); |
1461 | 1471 | ||
1462 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { | 1472 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { |
1463 | DPRINTF(ah, ATH_DBG_FATAL, | 1473 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, |
1464 | "ar5416SetRfRegs failed\n"); | 1474 | "ar5416SetRfRegs failed\n"); |
1465 | return -EIO; | 1475 | return -EIO; |
1466 | } | 1476 | } |
1467 | 1477 | ||
@@ -1666,8 +1676,8 @@ static bool ath9k_hw_set_reset(struct ath_hw *ah, int type) | |||
1666 | 1676 | ||
1667 | REG_WRITE(ah, AR_RTC_RC, 0); | 1677 | REG_WRITE(ah, AR_RTC_RC, 0); |
1668 | if (!ath9k_hw_wait(ah, AR_RTC_RC, AR_RTC_RC_M, 0, AH_WAIT_TIMEOUT)) { | 1678 | if (!ath9k_hw_wait(ah, AR_RTC_RC, AR_RTC_RC_M, 0, AH_WAIT_TIMEOUT)) { |
1669 | DPRINTF(ah, ATH_DBG_RESET, | 1679 | ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, |
1670 | "RTC stuck in MAC reset\n"); | 1680 | "RTC stuck in MAC reset\n"); |
1671 | return false; | 1681 | return false; |
1672 | } | 1682 | } |
1673 | 1683 | ||
@@ -1703,7 +1713,8 @@ static bool ath9k_hw_set_reset_power_on(struct ath_hw *ah) | |||
1703 | AR_RTC_STATUS_M, | 1713 | AR_RTC_STATUS_M, |
1704 | AR_RTC_STATUS_ON, | 1714 | AR_RTC_STATUS_ON, |
1705 | AH_WAIT_TIMEOUT)) { | 1715 | AH_WAIT_TIMEOUT)) { |
1706 | DPRINTF(ah, ATH_DBG_RESET, "RTC not waking up\n"); | 1716 | ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, |
1717 | "RTC not waking up\n"); | ||
1707 | return false; | 1718 | return false; |
1708 | } | 1719 | } |
1709 | 1720 | ||
@@ -1783,13 +1794,15 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
1783 | enum ath9k_ht_macmode macmode) | 1794 | enum ath9k_ht_macmode macmode) |
1784 | { | 1795 | { |
1785 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | 1796 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); |
1797 | struct ath_common *common = ath9k_hw_common(ah); | ||
1786 | struct ieee80211_channel *channel = chan->chan; | 1798 | struct ieee80211_channel *channel = chan->chan; |
1787 | u32 synthDelay, qnum; | 1799 | u32 synthDelay, qnum; |
1788 | 1800 | ||
1789 | for (qnum = 0; qnum < AR_NUM_QCU; qnum++) { | 1801 | for (qnum = 0; qnum < AR_NUM_QCU; qnum++) { |
1790 | if (ath9k_hw_numtxpending(ah, qnum)) { | 1802 | if (ath9k_hw_numtxpending(ah, qnum)) { |
1791 | DPRINTF(ah, ATH_DBG_QUEUE, | 1803 | ath_print(common, ATH_DBG_QUEUE, |
1792 | "Transmit frames pending on queue %d\n", qnum); | 1804 | "Transmit frames pending on " |
1805 | "queue %d\n", qnum); | ||
1793 | return false; | 1806 | return false; |
1794 | } | 1807 | } |
1795 | } | 1808 | } |
@@ -1797,8 +1810,8 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
1797 | REG_WRITE(ah, AR_PHY_RFBUS_REQ, AR_PHY_RFBUS_REQ_EN); | 1810 | REG_WRITE(ah, AR_PHY_RFBUS_REQ, AR_PHY_RFBUS_REQ_EN); |
1798 | if (!ath9k_hw_wait(ah, AR_PHY_RFBUS_GRANT, AR_PHY_RFBUS_GRANT_EN, | 1811 | if (!ath9k_hw_wait(ah, AR_PHY_RFBUS_GRANT, AR_PHY_RFBUS_GRANT_EN, |
1799 | AR_PHY_RFBUS_GRANT_EN, AH_WAIT_TIMEOUT)) { | 1812 | AR_PHY_RFBUS_GRANT_EN, AH_WAIT_TIMEOUT)) { |
1800 | DPRINTF(ah, ATH_DBG_FATAL, | 1813 | ath_print(common, ATH_DBG_FATAL, |
1801 | "Could not kill baseband RX\n"); | 1814 | "Could not kill baseband RX\n"); |
1802 | return false; | 1815 | return false; |
1803 | } | 1816 | } |
1804 | 1817 | ||
@@ -1808,8 +1821,8 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
1808 | ath9k_hw_ar9280_set_channel(ah, chan); | 1821 | ath9k_hw_ar9280_set_channel(ah, chan); |
1809 | } else { | 1822 | } else { |
1810 | if (!(ath9k_hw_set_channel(ah, chan))) { | 1823 | if (!(ath9k_hw_set_channel(ah, chan))) { |
1811 | DPRINTF(ah, ATH_DBG_FATAL, | 1824 | ath_print(common, ATH_DBG_FATAL, |
1812 | "Failed to set channel\n"); | 1825 | "Failed to set channel\n"); |
1813 | return false; | 1826 | return false; |
1814 | } | 1827 | } |
1815 | } | 1828 | } |
@@ -2370,7 +2383,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
2370 | } | 2383 | } |
2371 | 2384 | ||
2372 | if (!ath9k_hw_chip_reset(ah, chan)) { | 2385 | if (!ath9k_hw_chip_reset(ah, chan)) { |
2373 | DPRINTF(ah, ATH_DBG_FATAL, "Chip reset failed\n"); | 2386 | ath_print(common, ATH_DBG_FATAL, "Chip reset failed\n"); |
2374 | return -EINVAL; | 2387 | return -EINVAL; |
2375 | } | 2388 | } |
2376 | 2389 | ||
@@ -2525,13 +2538,13 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
2525 | u32 mask; | 2538 | u32 mask; |
2526 | mask = REG_READ(ah, AR_CFG); | 2539 | mask = REG_READ(ah, AR_CFG); |
2527 | if (mask & (AR_CFG_SWRB | AR_CFG_SWTB | AR_CFG_SWRG)) { | 2540 | if (mask & (AR_CFG_SWRB | AR_CFG_SWTB | AR_CFG_SWRG)) { |
2528 | DPRINTF(ah, ATH_DBG_RESET, | 2541 | ath_print(common, ATH_DBG_RESET, |
2529 | "CFG Byte Swap Set 0x%x\n", mask); | 2542 | "CFG Byte Swap Set 0x%x\n", mask); |
2530 | } else { | 2543 | } else { |
2531 | mask = | 2544 | mask = |
2532 | INIT_CONFIG_STATUS | AR_CFG_SWRB | AR_CFG_SWTB; | 2545 | INIT_CONFIG_STATUS | AR_CFG_SWRB | AR_CFG_SWTB; |
2533 | REG_WRITE(ah, AR_CFG, mask); | 2546 | REG_WRITE(ah, AR_CFG, mask); |
2534 | DPRINTF(ah, ATH_DBG_RESET, | 2547 | ath_print(common, ATH_DBG_RESET, |
2535 | "Setting CFG 0x%x\n", REG_READ(ah, AR_CFG)); | 2548 | "Setting CFG 0x%x\n", REG_READ(ah, AR_CFG)); |
2536 | } | 2549 | } |
2537 | } else { | 2550 | } else { |
@@ -2559,8 +2572,8 @@ bool ath9k_hw_keyreset(struct ath_hw *ah, u16 entry) | |||
2559 | u32 keyType; | 2572 | u32 keyType; |
2560 | 2573 | ||
2561 | if (entry >= ah->caps.keycache_size) { | 2574 | if (entry >= ah->caps.keycache_size) { |
2562 | DPRINTF(ah, ATH_DBG_FATAL, | 2575 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, |
2563 | "keychache entry %u out of range\n", entry); | 2576 | "keychache entry %u out of range\n", entry); |
2564 | return false; | 2577 | return false; |
2565 | } | 2578 | } |
2566 | 2579 | ||
@@ -2593,8 +2606,8 @@ bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac) | |||
2593 | u32 macHi, macLo; | 2606 | u32 macHi, macLo; |
2594 | 2607 | ||
2595 | if (entry >= ah->caps.keycache_size) { | 2608 | if (entry >= ah->caps.keycache_size) { |
2596 | DPRINTF(ah, ATH_DBG_FATAL, | 2609 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, |
2597 | "keychache entry %u out of range\n", entry); | 2610 | "keychache entry %u out of range\n", entry); |
2598 | return false; | 2611 | return false; |
2599 | } | 2612 | } |
2600 | 2613 | ||
@@ -2621,12 +2634,13 @@ bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry, | |||
2621 | const u8 *mac) | 2634 | const u8 *mac) |
2622 | { | 2635 | { |
2623 | const struct ath9k_hw_capabilities *pCap = &ah->caps; | 2636 | const struct ath9k_hw_capabilities *pCap = &ah->caps; |
2637 | struct ath_common *common = ath9k_hw_common(ah); | ||
2624 | u32 key0, key1, key2, key3, key4; | 2638 | u32 key0, key1, key2, key3, key4; |
2625 | u32 keyType; | 2639 | u32 keyType; |
2626 | 2640 | ||
2627 | if (entry >= pCap->keycache_size) { | 2641 | if (entry >= pCap->keycache_size) { |
2628 | DPRINTF(ah, ATH_DBG_FATAL, | 2642 | ath_print(common, ATH_DBG_FATAL, |
2629 | "keycache entry %u out of range\n", entry); | 2643 | "keycache entry %u out of range\n", entry); |
2630 | return false; | 2644 | return false; |
2631 | } | 2645 | } |
2632 | 2646 | ||
@@ -2636,9 +2650,9 @@ bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry, | |||
2636 | break; | 2650 | break; |
2637 | case ATH9K_CIPHER_AES_CCM: | 2651 | case ATH9K_CIPHER_AES_CCM: |
2638 | if (!(pCap->hw_caps & ATH9K_HW_CAP_CIPHER_AESCCM)) { | 2652 | if (!(pCap->hw_caps & ATH9K_HW_CAP_CIPHER_AESCCM)) { |
2639 | DPRINTF(ah, ATH_DBG_ANY, | 2653 | ath_print(common, ATH_DBG_ANY, |
2640 | "AES-CCM not supported by mac rev 0x%x\n", | 2654 | "AES-CCM not supported by mac rev 0x%x\n", |
2641 | ah->hw_version.macRev); | 2655 | ah->hw_version.macRev); |
2642 | return false; | 2656 | return false; |
2643 | } | 2657 | } |
2644 | keyType = AR_KEYTABLE_TYPE_CCM; | 2658 | keyType = AR_KEYTABLE_TYPE_CCM; |
@@ -2647,15 +2661,15 @@ bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry, | |||
2647 | keyType = AR_KEYTABLE_TYPE_TKIP; | 2661 | keyType = AR_KEYTABLE_TYPE_TKIP; |
2648 | if (ATH9K_IS_MIC_ENABLED(ah) | 2662 | if (ATH9K_IS_MIC_ENABLED(ah) |
2649 | && entry + 64 >= pCap->keycache_size) { | 2663 | && entry + 64 >= pCap->keycache_size) { |
2650 | DPRINTF(ah, ATH_DBG_ANY, | 2664 | ath_print(common, ATH_DBG_ANY, |
2651 | "entry %u inappropriate for TKIP\n", entry); | 2665 | "entry %u inappropriate for TKIP\n", entry); |
2652 | return false; | 2666 | return false; |
2653 | } | 2667 | } |
2654 | break; | 2668 | break; |
2655 | case ATH9K_CIPHER_WEP: | 2669 | case ATH9K_CIPHER_WEP: |
2656 | if (k->kv_len < WLAN_KEY_LEN_WEP40) { | 2670 | if (k->kv_len < WLAN_KEY_LEN_WEP40) { |
2657 | DPRINTF(ah, ATH_DBG_ANY, | 2671 | ath_print(common, ATH_DBG_ANY, |
2658 | "WEP key length %u too small\n", k->kv_len); | 2672 | "WEP key length %u too small\n", k->kv_len); |
2659 | return false; | 2673 | return false; |
2660 | } | 2674 | } |
2661 | if (k->kv_len <= WLAN_KEY_LEN_WEP40) | 2675 | if (k->kv_len <= WLAN_KEY_LEN_WEP40) |
@@ -2669,8 +2683,8 @@ bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry, | |||
2669 | keyType = AR_KEYTABLE_TYPE_CLR; | 2683 | keyType = AR_KEYTABLE_TYPE_CLR; |
2670 | break; | 2684 | break; |
2671 | default: | 2685 | default: |
2672 | DPRINTF(ah, ATH_DBG_FATAL, | 2686 | ath_print(common, ATH_DBG_FATAL, |
2673 | "cipher %u not supported\n", k->kv_type); | 2687 | "cipher %u not supported\n", k->kv_type); |
2674 | return false; | 2688 | return false; |
2675 | } | 2689 | } |
2676 | 2690 | ||
@@ -2887,8 +2901,9 @@ static bool ath9k_hw_set_power_awake(struct ath_hw *ah, int setChip) | |||
2887 | AR_RTC_FORCE_WAKE_EN); | 2901 | AR_RTC_FORCE_WAKE_EN); |
2888 | } | 2902 | } |
2889 | if (i == 0) { | 2903 | if (i == 0) { |
2890 | DPRINTF(ah, ATH_DBG_FATAL, | 2904 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, |
2891 | "Failed to wakeup in %uus\n", POWER_UP_TIME / 20); | 2905 | "Failed to wakeup in %uus\n", |
2906 | POWER_UP_TIME / 20); | ||
2892 | return false; | 2907 | return false; |
2893 | } | 2908 | } |
2894 | } | 2909 | } |
@@ -2900,6 +2915,7 @@ static bool ath9k_hw_set_power_awake(struct ath_hw *ah, int setChip) | |||
2900 | 2915 | ||
2901 | bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode) | 2916 | bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode) |
2902 | { | 2917 | { |
2918 | struct ath_common *common = ath9k_hw_common(ah); | ||
2903 | int status = true, setChip = true; | 2919 | int status = true, setChip = true; |
2904 | static const char *modes[] = { | 2920 | static const char *modes[] = { |
2905 | "AWAKE", | 2921 | "AWAKE", |
@@ -2911,8 +2927,8 @@ bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode) | |||
2911 | if (ah->power_mode == mode) | 2927 | if (ah->power_mode == mode) |
2912 | return status; | 2928 | return status; |
2913 | 2929 | ||
2914 | DPRINTF(ah, ATH_DBG_RESET, "%s -> %s\n", | 2930 | ath_print(common, ATH_DBG_RESET, "%s -> %s\n", |
2915 | modes[ah->power_mode], modes[mode]); | 2931 | modes[ah->power_mode], modes[mode]); |
2916 | 2932 | ||
2917 | switch (mode) { | 2933 | switch (mode) { |
2918 | case ATH9K_PM_AWAKE: | 2934 | case ATH9K_PM_AWAKE: |
@@ -2926,8 +2942,8 @@ bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode) | |||
2926 | ath9k_set_power_network_sleep(ah, setChip); | 2942 | ath9k_set_power_network_sleep(ah, setChip); |
2927 | break; | 2943 | break; |
2928 | default: | 2944 | default: |
2929 | DPRINTF(ah, ATH_DBG_FATAL, | 2945 | ath_print(common, ATH_DBG_FATAL, |
2930 | "Unknown power mode %u\n", mode); | 2946 | "Unknown power mode %u\n", mode); |
2931 | return false; | 2947 | return false; |
2932 | } | 2948 | } |
2933 | ah->power_mode = mode; | 2949 | ah->power_mode = mode; |
@@ -3097,6 +3113,7 @@ bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked) | |||
3097 | struct ath9k_hw_capabilities *pCap = &ah->caps; | 3113 | struct ath9k_hw_capabilities *pCap = &ah->caps; |
3098 | u32 sync_cause = 0; | 3114 | u32 sync_cause = 0; |
3099 | bool fatal_int = false; | 3115 | bool fatal_int = false; |
3116 | struct ath_common *common = ath9k_hw_common(ah); | ||
3100 | 3117 | ||
3101 | if (!AR_SREV_9100(ah)) { | 3118 | if (!AR_SREV_9100(ah)) { |
3102 | if (REG_READ(ah, AR_INTR_ASYNC_CAUSE) & AR_INTR_MAC_IRQ) { | 3119 | if (REG_READ(ah, AR_INTR_ASYNC_CAUSE) & AR_INTR_MAC_IRQ) { |
@@ -3170,8 +3187,8 @@ bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked) | |||
3170 | } | 3187 | } |
3171 | 3188 | ||
3172 | if (isr & AR_ISR_RXORN) { | 3189 | if (isr & AR_ISR_RXORN) { |
3173 | DPRINTF(ah, ATH_DBG_INTERRUPT, | 3190 | ath_print(common, ATH_DBG_INTERRUPT, |
3174 | "receive FIFO overrun interrupt\n"); | 3191 | "receive FIFO overrun interrupt\n"); |
3175 | } | 3192 | } |
3176 | 3193 | ||
3177 | if (!AR_SREV_9100(ah)) { | 3194 | if (!AR_SREV_9100(ah)) { |
@@ -3213,25 +3230,25 @@ bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked) | |||
3213 | 3230 | ||
3214 | if (fatal_int) { | 3231 | if (fatal_int) { |
3215 | if (sync_cause & AR_INTR_SYNC_HOST1_FATAL) { | 3232 | if (sync_cause & AR_INTR_SYNC_HOST1_FATAL) { |
3216 | DPRINTF(ah, ATH_DBG_ANY, | 3233 | ath_print(common, ATH_DBG_ANY, |
3217 | "received PCI FATAL interrupt\n"); | 3234 | "received PCI FATAL interrupt\n"); |
3218 | } | 3235 | } |
3219 | if (sync_cause & AR_INTR_SYNC_HOST1_PERR) { | 3236 | if (sync_cause & AR_INTR_SYNC_HOST1_PERR) { |
3220 | DPRINTF(ah, ATH_DBG_ANY, | 3237 | ath_print(common, ATH_DBG_ANY, |
3221 | "received PCI PERR interrupt\n"); | 3238 | "received PCI PERR interrupt\n"); |
3222 | } | 3239 | } |
3223 | *masked |= ATH9K_INT_FATAL; | 3240 | *masked |= ATH9K_INT_FATAL; |
3224 | } | 3241 | } |
3225 | if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT) { | 3242 | if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT) { |
3226 | DPRINTF(ah, ATH_DBG_INTERRUPT, | 3243 | ath_print(common, ATH_DBG_INTERRUPT, |
3227 | "AR_INTR_SYNC_RADM_CPL_TIMEOUT\n"); | 3244 | "AR_INTR_SYNC_RADM_CPL_TIMEOUT\n"); |
3228 | REG_WRITE(ah, AR_RC, AR_RC_HOSTIF); | 3245 | REG_WRITE(ah, AR_RC, AR_RC_HOSTIF); |
3229 | REG_WRITE(ah, AR_RC, 0); | 3246 | REG_WRITE(ah, AR_RC, 0); |
3230 | *masked |= ATH9K_INT_FATAL; | 3247 | *masked |= ATH9K_INT_FATAL; |
3231 | } | 3248 | } |
3232 | if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) { | 3249 | if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) { |
3233 | DPRINTF(ah, ATH_DBG_INTERRUPT, | 3250 | ath_print(common, ATH_DBG_INTERRUPT, |
3234 | "AR_INTR_SYNC_LOCAL_TIMEOUT\n"); | 3251 | "AR_INTR_SYNC_LOCAL_TIMEOUT\n"); |
3235 | } | 3252 | } |
3236 | 3253 | ||
3237 | REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause); | 3254 | REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause); |
@@ -3246,11 +3263,12 @@ enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints) | |||
3246 | u32 omask = ah->mask_reg; | 3263 | u32 omask = ah->mask_reg; |
3247 | u32 mask, mask2; | 3264 | u32 mask, mask2; |
3248 | struct ath9k_hw_capabilities *pCap = &ah->caps; | 3265 | struct ath9k_hw_capabilities *pCap = &ah->caps; |
3266 | struct ath_common *common = ath9k_hw_common(ah); | ||
3249 | 3267 | ||
3250 | DPRINTF(ah, ATH_DBG_INTERRUPT, "0x%x => 0x%x\n", omask, ints); | 3268 | ath_print(common, ATH_DBG_INTERRUPT, "0x%x => 0x%x\n", omask, ints); |
3251 | 3269 | ||
3252 | if (omask & ATH9K_INT_GLOBAL) { | 3270 | if (omask & ATH9K_INT_GLOBAL) { |
3253 | DPRINTF(ah, ATH_DBG_INTERRUPT, "disable IER\n"); | 3271 | ath_print(common, ATH_DBG_INTERRUPT, "disable IER\n"); |
3254 | REG_WRITE(ah, AR_IER, AR_IER_DISABLE); | 3272 | REG_WRITE(ah, AR_IER, AR_IER_DISABLE); |
3255 | (void) REG_READ(ah, AR_IER); | 3273 | (void) REG_READ(ah, AR_IER); |
3256 | if (!AR_SREV_9100(ah)) { | 3274 | if (!AR_SREV_9100(ah)) { |
@@ -3307,7 +3325,7 @@ enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints) | |||
3307 | mask2 |= AR_IMR_S2_CST; | 3325 | mask2 |= AR_IMR_S2_CST; |
3308 | } | 3326 | } |
3309 | 3327 | ||
3310 | DPRINTF(ah, ATH_DBG_INTERRUPT, "new IMR 0x%x\n", mask); | 3328 | ath_print(common, ATH_DBG_INTERRUPT, "new IMR 0x%x\n", mask); |
3311 | REG_WRITE(ah, AR_IMR, mask); | 3329 | REG_WRITE(ah, AR_IMR, mask); |
3312 | mask = REG_READ(ah, AR_IMR_S2) & ~(AR_IMR_S2_TIM | | 3330 | mask = REG_READ(ah, AR_IMR_S2) & ~(AR_IMR_S2_TIM | |
3313 | AR_IMR_S2_DTIM | | 3331 | AR_IMR_S2_DTIM | |
@@ -3327,7 +3345,7 @@ enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints) | |||
3327 | } | 3345 | } |
3328 | 3346 | ||
3329 | if (ints & ATH9K_INT_GLOBAL) { | 3347 | if (ints & ATH9K_INT_GLOBAL) { |
3330 | DPRINTF(ah, ATH_DBG_INTERRUPT, "enable IER\n"); | 3348 | ath_print(common, ATH_DBG_INTERRUPT, "enable IER\n"); |
3331 | REG_WRITE(ah, AR_IER, AR_IER_ENABLE); | 3349 | REG_WRITE(ah, AR_IER, AR_IER_ENABLE); |
3332 | if (!AR_SREV_9100(ah)) { | 3350 | if (!AR_SREV_9100(ah)) { |
3333 | REG_WRITE(ah, AR_INTR_ASYNC_ENABLE, | 3351 | REG_WRITE(ah, AR_INTR_ASYNC_ENABLE, |
@@ -3340,8 +3358,8 @@ enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints) | |||
3340 | REG_WRITE(ah, AR_INTR_SYNC_MASK, | 3358 | REG_WRITE(ah, AR_INTR_SYNC_MASK, |
3341 | AR_INTR_SYNC_DEFAULT); | 3359 | AR_INTR_SYNC_DEFAULT); |
3342 | } | 3360 | } |
3343 | DPRINTF(ah, ATH_DBG_INTERRUPT, "AR_IMR 0x%x IER 0x%x\n", | 3361 | ath_print(common, ATH_DBG_INTERRUPT, "AR_IMR 0x%x IER 0x%x\n", |
3344 | REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER)); | 3362 | REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER)); |
3345 | } | 3363 | } |
3346 | 3364 | ||
3347 | return omask; | 3365 | return omask; |
@@ -3388,9 +3406,9 @@ void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period) | |||
3388 | AR_TBTT_TIMER_EN | AR_DBA_TIMER_EN | AR_SWBA_TIMER_EN; | 3406 | AR_TBTT_TIMER_EN | AR_DBA_TIMER_EN | AR_SWBA_TIMER_EN; |
3389 | break; | 3407 | break; |
3390 | default: | 3408 | default: |
3391 | DPRINTF(ah, ATH_DBG_BEACON, | 3409 | ath_print(ath9k_hw_common(ah), ATH_DBG_BEACON, |
3392 | "%s: unsupported opmode: %d\n", | 3410 | "%s: unsupported opmode: %d\n", |
3393 | __func__, ah->opmode); | 3411 | __func__, ah->opmode); |
3394 | return; | 3412 | return; |
3395 | break; | 3413 | break; |
3396 | } | 3414 | } |
@@ -3414,6 +3432,7 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, | |||
3414 | { | 3432 | { |
3415 | u32 nextTbtt, beaconintval, dtimperiod, beacontimeout; | 3433 | u32 nextTbtt, beaconintval, dtimperiod, beacontimeout; |
3416 | struct ath9k_hw_capabilities *pCap = &ah->caps; | 3434 | struct ath9k_hw_capabilities *pCap = &ah->caps; |
3435 | struct ath_common *common = ath9k_hw_common(ah); | ||
3417 | 3436 | ||
3418 | REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(bs->bs_nexttbtt)); | 3437 | REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(bs->bs_nexttbtt)); |
3419 | 3438 | ||
@@ -3439,10 +3458,10 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, | |||
3439 | else | 3458 | else |
3440 | nextTbtt = bs->bs_nexttbtt; | 3459 | nextTbtt = bs->bs_nexttbtt; |
3441 | 3460 | ||
3442 | DPRINTF(ah, ATH_DBG_BEACON, "next DTIM %d\n", bs->bs_nextdtim); | 3461 | ath_print(common, ATH_DBG_BEACON, "next DTIM %d\n", bs->bs_nextdtim); |
3443 | DPRINTF(ah, ATH_DBG_BEACON, "next beacon %d\n", nextTbtt); | 3462 | ath_print(common, ATH_DBG_BEACON, "next beacon %d\n", nextTbtt); |
3444 | DPRINTF(ah, ATH_DBG_BEACON, "beacon period %d\n", beaconintval); | 3463 | ath_print(common, ATH_DBG_BEACON, "beacon period %d\n", beaconintval); |
3445 | DPRINTF(ah, ATH_DBG_BEACON, "DTIM period %d\n", dtimperiod); | 3464 | ath_print(common, ATH_DBG_BEACON, "DTIM period %d\n", dtimperiod); |
3446 | 3465 | ||
3447 | REG_WRITE(ah, AR_NEXT_DTIM, | 3466 | REG_WRITE(ah, AR_NEXT_DTIM, |
3448 | TU_TO_USEC(bs->bs_nextdtim - SLEEP_SLOP)); | 3467 | TU_TO_USEC(bs->bs_nextdtim - SLEEP_SLOP)); |
@@ -3479,6 +3498,7 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
3479 | { | 3498 | { |
3480 | struct ath9k_hw_capabilities *pCap = &ah->caps; | 3499 | struct ath9k_hw_capabilities *pCap = &ah->caps; |
3481 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | 3500 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); |
3501 | struct ath_common *common = ath9k_hw_common(ah); | ||
3482 | struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; | 3502 | struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; |
3483 | 3503 | ||
3484 | u16 capField = 0, eeval; | 3504 | u16 capField = 0, eeval; |
@@ -3500,8 +3520,8 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
3500 | regulatory->current_rd += 5; | 3520 | regulatory->current_rd += 5; |
3501 | else if (regulatory->current_rd == 0x41) | 3521 | else if (regulatory->current_rd == 0x41) |
3502 | regulatory->current_rd = 0x43; | 3522 | regulatory->current_rd = 0x43; |
3503 | DPRINTF(ah, ATH_DBG_REGULATORY, | 3523 | ath_print(common, ATH_DBG_REGULATORY, |
3504 | "regdomain mapped to 0x%x\n", regulatory->current_rd); | 3524 | "regdomain mapped to 0x%x\n", regulatory->current_rd); |
3505 | } | 3525 | } |
3506 | 3526 | ||
3507 | eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); | 3527 | eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); |
@@ -4019,8 +4039,8 @@ void ath9k_hw_reset_tsf(struct ath_hw *ah) | |||
4019 | { | 4039 | { |
4020 | if (!ath9k_hw_wait(ah, AR_SLP32_MODE, AR_SLP32_TSF_WRITE_STATUS, 0, | 4040 | if (!ath9k_hw_wait(ah, AR_SLP32_MODE, AR_SLP32_TSF_WRITE_STATUS, 0, |
4021 | AH_TSF_WRITE_TIMEOUT)) | 4041 | AH_TSF_WRITE_TIMEOUT)) |
4022 | DPRINTF(ah, ATH_DBG_RESET, | 4042 | ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, |
4023 | "AR_SLP32_TSF_WRITE_STATUS limit exceeded\n"); | 4043 | "AR_SLP32_TSF_WRITE_STATUS limit exceeded\n"); |
4024 | 4044 | ||
4025 | REG_WRITE(ah, AR_RESET_TSF, AR_RESET_TSF_ONCE); | 4045 | REG_WRITE(ah, AR_RESET_TSF, AR_RESET_TSF_ONCE); |
4026 | } | 4046 | } |
@@ -4036,7 +4056,8 @@ void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting) | |||
4036 | bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us) | 4056 | bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us) |
4037 | { | 4057 | { |
4038 | if (us < ATH9K_SLOT_TIME_9 || us > ath9k_hw_mac_to_usec(ah, 0xffff)) { | 4058 | if (us < ATH9K_SLOT_TIME_9 || us > ath9k_hw_mac_to_usec(ah, 0xffff)) { |
4039 | DPRINTF(ah, ATH_DBG_RESET, "bad slot time %u\n", us); | 4059 | ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, |
4060 | "bad slot time %u\n", us); | ||
4040 | ah->slottime = (u32) -1; | 4061 | ah->slottime = (u32) -1; |
4041 | return false; | 4062 | return false; |
4042 | } else { | 4063 | } else { |
@@ -4121,8 +4142,9 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, | |||
4121 | timer = kzalloc(sizeof(struct ath_gen_timer), GFP_KERNEL); | 4142 | timer = kzalloc(sizeof(struct ath_gen_timer), GFP_KERNEL); |
4122 | 4143 | ||
4123 | if (timer == NULL) { | 4144 | if (timer == NULL) { |
4124 | printk(KERN_DEBUG "Failed to allocate memory" | 4145 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, |
4125 | "for hw timer[%d]\n", timer_index); | 4146 | "Failed to allocate memory" |
4147 | "for hw timer[%d]\n", timer_index); | ||
4126 | return NULL; | 4148 | return NULL; |
4127 | } | 4149 | } |
4128 | 4150 | ||
@@ -4150,8 +4172,9 @@ void ath9k_hw_gen_timer_start(struct ath_hw *ah, | |||
4150 | 4172 | ||
4151 | tsf = ath9k_hw_gettsf32(ah); | 4173 | tsf = ath9k_hw_gettsf32(ah); |
4152 | 4174 | ||
4153 | DPRINTF(ah, ATH_DBG_HWTIMER, "curent tsf %x period %x" | 4175 | ath_print(ath9k_hw_common(ah), ATH_DBG_HWTIMER, |
4154 | "timer_next %x\n", tsf, timer_period, timer_next); | 4176 | "curent tsf %x period %x" |
4177 | "timer_next %x\n", tsf, timer_period, timer_next); | ||
4155 | 4178 | ||
4156 | /* | 4179 | /* |
4157 | * Pull timer_next forward if the current TSF already passed it | 4180 | * Pull timer_next forward if the current TSF already passed it |
@@ -4213,6 +4236,7 @@ void ath_gen_timer_isr(struct ath_hw *ah) | |||
4213 | { | 4236 | { |
4214 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; | 4237 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; |
4215 | struct ath_gen_timer *timer; | 4238 | struct ath_gen_timer *timer; |
4239 | struct ath_common *common = ath9k_hw_common(ah); | ||
4216 | u32 trigger_mask, thresh_mask, index; | 4240 | u32 trigger_mask, thresh_mask, index; |
4217 | 4241 | ||
4218 | /* get hardware generic timer interrupt status */ | 4242 | /* get hardware generic timer interrupt status */ |
@@ -4227,8 +4251,8 @@ void ath_gen_timer_isr(struct ath_hw *ah) | |||
4227 | index = rightmost_index(timer_table, &thresh_mask); | 4251 | index = rightmost_index(timer_table, &thresh_mask); |
4228 | timer = timer_table->timers[index]; | 4252 | timer = timer_table->timers[index]; |
4229 | BUG_ON(!timer); | 4253 | BUG_ON(!timer); |
4230 | DPRINTF(ah, ATH_DBG_HWTIMER, | 4254 | ath_print(common, ATH_DBG_HWTIMER, |
4231 | "TSF overflow for Gen timer %d\n", index); | 4255 | "TSF overflow for Gen timer %d\n", index); |
4232 | timer->overflow(timer->arg); | 4256 | timer->overflow(timer->arg); |
4233 | } | 4257 | } |
4234 | 4258 | ||
@@ -4236,8 +4260,8 @@ void ath_gen_timer_isr(struct ath_hw *ah) | |||
4236 | index = rightmost_index(timer_table, &trigger_mask); | 4260 | index = rightmost_index(timer_table, &trigger_mask); |
4237 | timer = timer_table->timers[index]; | 4261 | timer = timer_table->timers[index]; |
4238 | BUG_ON(!timer); | 4262 | BUG_ON(!timer); |
4239 | DPRINTF(ah, ATH_DBG_HWTIMER, | 4263 | ath_print(common, ATH_DBG_HWTIMER, |
4240 | "Gen timer[%d] trigger\n", index); | 4264 | "Gen timer[%d] trigger\n", index); |
4241 | timer->trigger(timer->arg); | 4265 | timer->trigger(timer->arg); |
4242 | } | 4266 | } |
4243 | } | 4267 | } |