aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorIvo van Doorn <IvDoorn@gmail.com>2010-11-06 10:49:01 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-11-15 13:26:36 -0500
commit8c5765fda4b382acce4ff386e18ec11790dff893 (patch)
tree26859992b48faf7f6c93ceaad6dd20dcdcf303cf /drivers/net/wireless
parentea175ee26268370ca07aff91cf6ba1e0f1a3bd36 (diff)
rt2x00: Add watchdog functions for HW queue
Add watchdog functions for managing the Queues inside the hardware. Normally the driver doesn't have much to do with these queues directly, but the Ralink drivers did implement watchdog functions for these. These watchdog functions are not triggered that often, compared to the other watchdog functions, but I have at least seen them trigger once or twice during a long stresstest run. v2: Add extra documentation for register fields Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800.h16
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c45
2 files changed, 58 insertions, 3 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index c2cc126502d6..002224c9bb62 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -412,10 +412,22 @@
412#define BCN_OFFSET1_BCN7 FIELD32(0xff000000) 412#define BCN_OFFSET1_BCN7 FIELD32(0xff000000)
413 413
414/* 414/*
415 * PBF registers 415 * TXRXQ_PCNT: PBF register
416 * Most are for debug. Driver doesn't touch PBF register. 416 * PCNT_TX0Q: Page count for TX hardware queue 0
417 * PCNT_TX1Q: Page count for TX hardware queue 1
418 * PCNT_TX2Q: Page count for TX hardware queue 2
419 * PCNT_RX0Q: Page count for RX hardware queue
417 */ 420 */
418#define TXRXQ_PCNT 0x0438 421#define TXRXQ_PCNT 0x0438
422#define TXRXQ_PCNT_TX0Q FIELD32(0x000000ff)
423#define TXRXQ_PCNT_TX1Q FIELD32(0x0000ff00)
424#define TXRXQ_PCNT_TX2Q FIELD32(0x00ff0000)
425#define TXRXQ_PCNT_RX0Q FIELD32(0xff000000)
426
427/*
428 * PBF register
429 * Debug. Driver doesn't touch PBF register.
430 */
419#define PBF_DBG 0x043c 431#define PBF_DBG 0x043c
420 432
421/* 433/*
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index f93337128504..389ecba8e891 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -243,6 +243,49 @@ static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev,
243} 243}
244 244
245/* 245/*
246 * Watchdog handlers
247 */
248static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev)
249{
250 unsigned int i;
251 u32 reg;
252
253 rt2800_register_read(rt2x00dev, TXRXQ_PCNT, &reg);
254 if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) {
255 WARNING(rt2x00dev, "TX HW queue 0 timed out,"
256 " invoke forced kick");
257
258 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40012);
259
260 for (i = 0; i < 10; i++) {
261 udelay(10);
262 if (!rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q))
263 break;
264 }
265
266 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40006);
267 }
268
269 rt2800_register_read(rt2x00dev, TXRXQ_PCNT, &reg);
270 if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) {
271 WARNING(rt2x00dev, "TX HW queue 1 timed out,"
272 " invoke forced kick");
273
274 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf4000a);
275
276 for (i = 0; i < 10; i++) {
277 udelay(10);
278 if (!rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q))
279 break;
280 }
281
282 rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40006);
283 }
284
285 rt2x00usb_watchdog(rt2x00dev);
286}
287
288/*
246 * TX descriptor initialization 289 * TX descriptor initialization
247 */ 290 */
248static __le32 *rt2800usb_get_txwi(struct queue_entry *entry) 291static __le32 *rt2800usb_get_txwi(struct queue_entry *entry)
@@ -534,7 +577,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
534 .link_stats = rt2800_link_stats, 577 .link_stats = rt2800_link_stats,
535 .reset_tuner = rt2800_reset_tuner, 578 .reset_tuner = rt2800_reset_tuner,
536 .link_tuner = rt2800_link_tuner, 579 .link_tuner = rt2800_link_tuner,
537 .watchdog = rt2x00usb_watchdog, 580 .watchdog = rt2800usb_watchdog,
538 .write_tx_desc = rt2800usb_write_tx_desc, 581 .write_tx_desc = rt2800usb_write_tx_desc,
539 .write_tx_data = rt2800_write_tx_data, 582 .write_tx_data = rt2800_write_tx_data,
540 .write_beacon = rt2800_write_beacon, 583 .write_beacon = rt2800_write_beacon,