diff options
author | Nick Kossifidis <mickflemm@gmail.com> | 2010-11-23 13:47:31 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-11-30 13:52:31 -0500 |
commit | b3a28e68d5c8d788a4e538a119a5d326545add8a (patch) | |
tree | 2c055f98eefb31b4fcb10e908112b92ec4efd36a /drivers | |
parent | 80dac9eecbdb95f61b9b3c7081e02412155982b7 (diff) |
ath5k: Debug DMA timeouts
* Increase timeouts on ath5k_hw_stop_tx_dma and also wait for
tx queue to stop before checking for pending frames
* Add a new debug level to debug dma start/stop
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/debug.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/debug.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/dma.c | 34 |
3 files changed, 32 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c index 7d785cb60ce0..5341dd2860d3 100644 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ b/drivers/net/wireless/ath/ath5k/debug.c | |||
@@ -312,6 +312,7 @@ static const struct { | |||
312 | { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" }, | 312 | { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" }, |
313 | { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, | 313 | { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, |
314 | { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, | 314 | { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, |
315 | { ATH5K_DEBUG_DMA, "dma", "dma start/stop" }, | ||
315 | { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" }, | 316 | { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" }, |
316 | { ATH5K_DEBUG_DESC, "desc", "descriptor chains" }, | 317 | { ATH5K_DEBUG_DESC, "desc", "descriptor chains" }, |
317 | { ATH5K_DEBUG_ANY, "all", "show all debug levels" }, | 318 | { ATH5K_DEBUG_ANY, "all", "show all debug levels" }, |
diff --git a/drivers/net/wireless/ath/ath5k/debug.h b/drivers/net/wireless/ath/ath5k/debug.h index 236edbd2507d..3e34428d5126 100644 --- a/drivers/net/wireless/ath/ath5k/debug.h +++ b/drivers/net/wireless/ath/ath5k/debug.h | |||
@@ -95,6 +95,7 @@ struct ath5k_dbg_info { | |||
95 | * @ATH5K_DEBUG_DUMP_RX: print received skb content | 95 | * @ATH5K_DEBUG_DUMP_RX: print received skb content |
96 | * @ATH5K_DEBUG_DUMP_TX: print transmit skb content | 96 | * @ATH5K_DEBUG_DUMP_TX: print transmit skb content |
97 | * @ATH5K_DEBUG_DUMPBANDS: dump bands | 97 | * @ATH5K_DEBUG_DUMPBANDS: dump bands |
98 | * @ATH5K_DEBUG_DMA: debug dma start/stop | ||
98 | * @ATH5K_DEBUG_TRACE: trace function calls | 99 | * @ATH5K_DEBUG_TRACE: trace function calls |
99 | * @ATH5K_DEBUG_DESC: descriptor setup | 100 | * @ATH5K_DEBUG_DESC: descriptor setup |
100 | * @ATH5K_DEBUG_ANY: show at any debug level | 101 | * @ATH5K_DEBUG_ANY: show at any debug level |
@@ -118,6 +119,7 @@ enum ath5k_debug_level { | |||
118 | ATH5K_DEBUG_DUMP_RX = 0x00000100, | 119 | ATH5K_DEBUG_DUMP_RX = 0x00000100, |
119 | ATH5K_DEBUG_DUMP_TX = 0x00000200, | 120 | ATH5K_DEBUG_DUMP_TX = 0x00000200, |
120 | ATH5K_DEBUG_DUMPBANDS = 0x00000400, | 121 | ATH5K_DEBUG_DUMPBANDS = 0x00000400, |
122 | ATH5K_DEBUG_DMA = 0x00000800, | ||
121 | ATH5K_DEBUG_ANI = 0x00002000, | 123 | ATH5K_DEBUG_ANI = 0x00002000, |
122 | ATH5K_DEBUG_DESC = 0x00004000, | 124 | ATH5K_DEBUG_DESC = 0x00004000, |
123 | ATH5K_DEBUG_ANY = 0xffffffff | 125 | ATH5K_DEBUG_ANY = 0xffffffff |
diff --git a/drivers/net/wireless/ath/ath5k/dma.c b/drivers/net/wireless/ath/ath5k/dma.c index ca0467e21e56..e39c95340841 100644 --- a/drivers/net/wireless/ath/ath5k/dma.c +++ b/drivers/net/wireless/ath/ath5k/dma.c | |||
@@ -70,7 +70,11 @@ int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah) | |||
70 | for (i = 1000; i > 0 && | 70 | for (i = 1000; i > 0 && |
71 | (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) != 0; | 71 | (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) != 0; |
72 | i--) | 72 | i--) |
73 | udelay(10); | 73 | udelay(100); |
74 | |||
75 | if (i) | ||
76 | ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, | ||
77 | "failed to stop RX DMA !\n"); | ||
74 | 78 | ||
75 | return i ? 0 : -EBUSY; | 79 | return i ? 0 : -EBUSY; |
76 | } | 80 | } |
@@ -217,7 +221,18 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue) | |||
217 | */ | 221 | */ |
218 | AR5K_REG_WRITE_Q(ah, AR5K_QCU_TXD, queue); | 222 | AR5K_REG_WRITE_Q(ah, AR5K_QCU_TXD, queue); |
219 | 223 | ||
220 | /*Check for pending frames*/ | 224 | /* Wait for queue to stop */ |
225 | for (i = 1000; i > 0 && | ||
226 | (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue) != 0); | ||
227 | i--) | ||
228 | udelay(100); | ||
229 | |||
230 | if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue)) | ||
231 | ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, | ||
232 | "queue %i didn't stop !\n", queue); | ||
233 | |||
234 | /* Check for pending frames */ | ||
235 | i = 1000; | ||
221 | do { | 236 | do { |
222 | pending = ath5k_hw_reg_read(ah, | 237 | pending = ath5k_hw_reg_read(ah, |
223 | AR5K_QUEUE_STATUS(queue)) & | 238 | AR5K_QUEUE_STATUS(queue)) & |
@@ -248,12 +263,12 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue) | |||
248 | AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); | 263 | AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); |
249 | 264 | ||
250 | /* Wait a while and disable mechanism */ | 265 | /* Wait a while and disable mechanism */ |
251 | udelay(200); | 266 | udelay(400); |
252 | AR5K_REG_DISABLE_BITS(ah, AR5K_QUIET_CTL1, | 267 | AR5K_REG_DISABLE_BITS(ah, AR5K_QUIET_CTL1, |
253 | AR5K_QUIET_CTL1_QT_EN); | 268 | AR5K_QUIET_CTL1_QT_EN); |
254 | 269 | ||
255 | /* Re-check for pending frames */ | 270 | /* Re-check for pending frames */ |
256 | i = 40; | 271 | i = 100; |
257 | do { | 272 | do { |
258 | pending = ath5k_hw_reg_read(ah, | 273 | pending = ath5k_hw_reg_read(ah, |
259 | AR5K_QUEUE_STATUS(queue)) & | 274 | AR5K_QUEUE_STATUS(queue)) & |
@@ -263,12 +278,21 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue) | |||
263 | 278 | ||
264 | AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5211, | 279 | AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5211, |
265 | AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); | 280 | AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); |
281 | |||
282 | if (pending) | ||
283 | ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, | ||
284 | "quiet mechanism didn't work q:%i !\n", | ||
285 | queue); | ||
266 | } | 286 | } |
267 | 287 | ||
268 | /* Clear register */ | 288 | /* Clear register */ |
269 | ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD); | 289 | ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD); |
270 | if (pending) | 290 | if (pending) { |
291 | ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, | ||
292 | "tx dma didn't stop (q:%i, frm:%i) !\n", | ||
293 | queue, pending); | ||
271 | return -EBUSY; | 294 | return -EBUSY; |
295 | } | ||
272 | } | 296 | } |
273 | 297 | ||
274 | /* TODO: Check for success on 5210 else return error */ | 298 | /* TODO: Check for success on 5210 else return error */ |