aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c55
1 files changed, 39 insertions, 16 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index faa804cf181a..5e80948d1a3e 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1033,7 +1033,8 @@ static void rt2500pci_toggle_rx(struct rt2x00_dev *rt2x00dev,
1033static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev, 1033static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev,
1034 enum dev_state state) 1034 enum dev_state state)
1035{ 1035{
1036 int mask = (state == STATE_RADIO_IRQ_OFF); 1036 int mask = (state == STATE_RADIO_IRQ_OFF) ||
1037 (state == STATE_RADIO_IRQ_OFF_ISR);
1037 u32 reg; 1038 u32 reg;
1038 1039
1039 /* 1040 /*
@@ -1134,7 +1135,9 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev,
1134 rt2500pci_toggle_rx(rt2x00dev, state); 1135 rt2500pci_toggle_rx(rt2x00dev, state);
1135 break; 1136 break;
1136 case STATE_RADIO_IRQ_ON: 1137 case STATE_RADIO_IRQ_ON:
1138 case STATE_RADIO_IRQ_ON_ISR:
1137 case STATE_RADIO_IRQ_OFF: 1139 case STATE_RADIO_IRQ_OFF:
1140 case STATE_RADIO_IRQ_OFF_ISR:
1138 rt2500pci_toggle_irq(rt2x00dev, state); 1141 rt2500pci_toggle_irq(rt2x00dev, state);
1139 break; 1142 break;
1140 case STATE_DEEP_SLEEP: 1143 case STATE_DEEP_SLEEP:
@@ -1367,23 +1370,10 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev,
1367 } 1370 }
1368} 1371}
1369 1372
1370static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance) 1373static irqreturn_t rt2500pci_interrupt_thread(int irq, void *dev_instance)
1371{ 1374{
1372 struct rt2x00_dev *rt2x00dev = dev_instance; 1375 struct rt2x00_dev *rt2x00dev = dev_instance;
1373 u32 reg; 1376 u32 reg = rt2x00dev->irqvalue[0];
1374
1375 /*
1376 * Get the interrupt sources & saved to local variable.
1377 * Write register value back to clear pending interrupts.
1378 */
1379 rt2x00pci_register_read(rt2x00dev, CSR7, &reg);
1380 rt2x00pci_register_write(rt2x00dev, CSR7, reg);
1381
1382 if (!reg)
1383 return IRQ_NONE;
1384
1385 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
1386 return IRQ_HANDLED;
1387 1377
1388 /* 1378 /*
1389 * Handle interrupts, walk through all bits 1379 * Handle interrupts, walk through all bits
@@ -1421,9 +1411,41 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)
1421 if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) 1411 if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING))
1422 rt2500pci_txdone(rt2x00dev, QID_AC_BK); 1412 rt2500pci_txdone(rt2x00dev, QID_AC_BK);
1423 1413
1414 /* Enable interrupts again. */
1415 rt2x00dev->ops->lib->set_device_state(rt2x00dev,
1416 STATE_RADIO_IRQ_ON_ISR);
1417
1424 return IRQ_HANDLED; 1418 return IRQ_HANDLED;
1425} 1419}
1426 1420
1421static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)
1422{
1423 struct rt2x00_dev *rt2x00dev = dev_instance;
1424 u32 reg;
1425
1426 /*
1427 * Get the interrupt sources & saved to local variable.
1428 * Write register value back to clear pending interrupts.
1429 */
1430 rt2x00pci_register_read(rt2x00dev, CSR7, &reg);
1431 rt2x00pci_register_write(rt2x00dev, CSR7, reg);
1432
1433 if (!reg)
1434 return IRQ_NONE;
1435
1436 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
1437 return IRQ_HANDLED;
1438
1439 /* Store irqvalues for use in the interrupt thread. */
1440 rt2x00dev->irqvalue[0] = reg;
1441
1442 /* Disable interrupts, will be enabled again in the interrupt thread. */
1443 rt2x00dev->ops->lib->set_device_state(rt2x00dev,
1444 STATE_RADIO_IRQ_OFF_ISR);
1445
1446 return IRQ_WAKE_THREAD;
1447}
1448
1427/* 1449/*
1428 * Device probe functions. 1450 * Device probe functions.
1429 */ 1451 */
@@ -1874,6 +1896,7 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = {
1874 1896
1875static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { 1897static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
1876 .irq_handler = rt2500pci_interrupt, 1898 .irq_handler = rt2500pci_interrupt,
1899 .irq_handler_thread = rt2500pci_interrupt_thread,
1877 .probe_hw = rt2500pci_probe_hw, 1900 .probe_hw = rt2500pci_probe_hw,
1878 .initialize = rt2x00pci_initialize, 1901 .initialize = rt2x00pci_initialize,
1879 .uninitialize = rt2x00pci_uninitialize, 1902 .uninitialize = rt2x00pci_uninitialize,