diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 87 |
1 files changed, 55 insertions, 32 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 41da3d218c65..c2a555d5376b 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -626,6 +626,7 @@ static inline void rt2500pci_set_vgc(struct rt2x00_dev *rt2x00dev, | |||
626 | { | 626 | { |
627 | if (qual->vgc_level_reg != vgc_level) { | 627 | if (qual->vgc_level_reg != vgc_level) { |
628 | rt2500pci_bbp_write(rt2x00dev, 17, vgc_level); | 628 | rt2500pci_bbp_write(rt2x00dev, 17, vgc_level); |
629 | qual->vgc_level = vgc_level; | ||
629 | qual->vgc_level_reg = vgc_level; | 630 | qual->vgc_level_reg = vgc_level; |
630 | } | 631 | } |
631 | } | 632 | } |
@@ -700,13 +701,10 @@ dynamic_cca_tune: | |||
700 | * R17 is inside the dynamic tuning range, | 701 | * R17 is inside the dynamic tuning range, |
701 | * start tuning the link based on the false cca counter. | 702 | * start tuning the link based on the false cca counter. |
702 | */ | 703 | */ |
703 | if (qual->false_cca > 512 && qual->vgc_level_reg < 0x40) { | 704 | if (qual->false_cca > 512 && qual->vgc_level_reg < 0x40) |
704 | rt2500pci_set_vgc(rt2x00dev, qual, ++qual->vgc_level_reg); | 705 | rt2500pci_set_vgc(rt2x00dev, qual, ++qual->vgc_level_reg); |
705 | qual->vgc_level = qual->vgc_level_reg; | 706 | else if (qual->false_cca < 100 && qual->vgc_level_reg > 0x32) |
706 | } else if (qual->false_cca < 100 && qual->vgc_level_reg > 0x32) { | ||
707 | rt2500pci_set_vgc(rt2x00dev, qual, --qual->vgc_level_reg); | 707 | rt2500pci_set_vgc(rt2x00dev, qual, --qual->vgc_level_reg); |
708 | qual->vgc_level = qual->vgc_level_reg; | ||
709 | } | ||
710 | } | 708 | } |
711 | 709 | ||
712 | /* | 710 | /* |
@@ -1035,7 +1033,8 @@ static void rt2500pci_toggle_rx(struct rt2x00_dev *rt2x00dev, | |||
1035 | static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev, | 1033 | static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev, |
1036 | enum dev_state state) | 1034 | enum dev_state state) |
1037 | { | 1035 | { |
1038 | int mask = (state == STATE_RADIO_IRQ_OFF); | 1036 | int mask = (state == STATE_RADIO_IRQ_OFF) || |
1037 | (state == STATE_RADIO_IRQ_OFF_ISR); | ||
1039 | u32 reg; | 1038 | u32 reg; |
1040 | 1039 | ||
1041 | /* | 1040 | /* |
@@ -1136,7 +1135,9 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1136 | rt2500pci_toggle_rx(rt2x00dev, state); | 1135 | rt2500pci_toggle_rx(rt2x00dev, state); |
1137 | break; | 1136 | break; |
1138 | case STATE_RADIO_IRQ_ON: | 1137 | case STATE_RADIO_IRQ_ON: |
1138 | case STATE_RADIO_IRQ_ON_ISR: | ||
1139 | case STATE_RADIO_IRQ_OFF: | 1139 | case STATE_RADIO_IRQ_OFF: |
1140 | case STATE_RADIO_IRQ_OFF_ISR: | ||
1140 | rt2500pci_toggle_irq(rt2x00dev, state); | 1141 | rt2500pci_toggle_irq(rt2x00dev, state); |
1141 | break; | 1142 | break; |
1142 | case STATE_DEEP_SLEEP: | 1143 | case STATE_DEEP_SLEEP: |
@@ -1233,9 +1234,6 @@ static void rt2500pci_write_beacon(struct queue_entry *entry, | |||
1233 | struct txentry_desc *txdesc) | 1234 | struct txentry_desc *txdesc) |
1234 | { | 1235 | { |
1235 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 1236 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
1236 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | ||
1237 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
1238 | u32 word; | ||
1239 | u32 reg; | 1237 | u32 reg; |
1240 | 1238 | ||
1241 | /* | 1239 | /* |
@@ -1248,9 +1246,15 @@ static void rt2500pci_write_beacon(struct queue_entry *entry, | |||
1248 | 1246 | ||
1249 | rt2x00queue_map_txskb(rt2x00dev, entry->skb); | 1247 | rt2x00queue_map_txskb(rt2x00dev, entry->skb); |
1250 | 1248 | ||
1251 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1249 | /* |
1252 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); | 1250 | * Write the TX descriptor for the beacon. |
1253 | rt2x00_desc_write(entry_priv->desc, 1, word); | 1251 | */ |
1252 | rt2500pci_write_tx_desc(rt2x00dev, entry->skb, txdesc); | ||
1253 | |||
1254 | /* | ||
1255 | * Dump beacon to userspace through debugfs. | ||
1256 | */ | ||
1257 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); | ||
1254 | 1258 | ||
1255 | /* | 1259 | /* |
1256 | * Enable beaconing again. | 1260 | * Enable beaconing again. |
@@ -1366,23 +1370,10 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev, | |||
1366 | } | 1370 | } |
1367 | } | 1371 | } |
1368 | 1372 | ||
1369 | static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance) | 1373 | static irqreturn_t rt2500pci_interrupt_thread(int irq, void *dev_instance) |
1370 | { | 1374 | { |
1371 | struct rt2x00_dev *rt2x00dev = dev_instance; | 1375 | struct rt2x00_dev *rt2x00dev = dev_instance; |
1372 | u32 reg; | 1376 | u32 reg = rt2x00dev->irqvalue[0]; |
1373 | |||
1374 | /* | ||
1375 | * Get the interrupt sources & saved to local variable. | ||
1376 | * Write register value back to clear pending interrupts. | ||
1377 | */ | ||
1378 | rt2x00pci_register_read(rt2x00dev, CSR7, ®); | ||
1379 | rt2x00pci_register_write(rt2x00dev, CSR7, reg); | ||
1380 | |||
1381 | if (!reg) | ||
1382 | return IRQ_NONE; | ||
1383 | |||
1384 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) | ||
1385 | return IRQ_HANDLED; | ||
1386 | 1377 | ||
1387 | /* | 1378 | /* |
1388 | * Handle interrupts, walk through all bits | 1379 | * Handle interrupts, walk through all bits |
@@ -1420,9 +1411,41 @@ static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance) | |||
1420 | if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) | 1411 | if (rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) |
1421 | rt2500pci_txdone(rt2x00dev, QID_AC_BK); | 1412 | rt2500pci_txdone(rt2x00dev, QID_AC_BK); |
1422 | 1413 | ||
1414 | /* Enable interrupts again. */ | ||
1415 | rt2x00dev->ops->lib->set_device_state(rt2x00dev, | ||
1416 | STATE_RADIO_IRQ_ON_ISR); | ||
1417 | |||
1423 | return IRQ_HANDLED; | 1418 | return IRQ_HANDLED; |
1424 | } | 1419 | } |
1425 | 1420 | ||
1421 | static 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, ®); | ||
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 | |||
1426 | /* | 1449 | /* |
1427 | * Device probe functions. | 1450 | * Device probe functions. |
1428 | */ | 1451 | */ |
@@ -1554,9 +1577,8 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1554 | * Check if the BBP tuning should be enabled. | 1577 | * Check if the BBP tuning should be enabled. |
1555 | */ | 1578 | */ |
1556 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); | 1579 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); |
1557 | 1580 | if (!rt2x00_get_field16(eeprom, EEPROM_NIC_DYN_BBP_TUNE)) | |
1558 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_DYN_BBP_TUNE)) | 1581 | __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); |
1559 | __set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags); | ||
1560 | 1582 | ||
1561 | /* | 1583 | /* |
1562 | * Read the RSSI <-> dBm offset information. | 1584 | * Read the RSSI <-> dBm offset information. |
@@ -1861,7 +1883,8 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = { | |||
1861 | .remove_interface = rt2x00mac_remove_interface, | 1883 | .remove_interface = rt2x00mac_remove_interface, |
1862 | .config = rt2x00mac_config, | 1884 | .config = rt2x00mac_config, |
1863 | .configure_filter = rt2x00mac_configure_filter, | 1885 | .configure_filter = rt2x00mac_configure_filter, |
1864 | .set_tim = rt2x00mac_set_tim, | 1886 | .sw_scan_start = rt2x00mac_sw_scan_start, |
1887 | .sw_scan_complete = rt2x00mac_sw_scan_complete, | ||
1865 | .get_stats = rt2x00mac_get_stats, | 1888 | .get_stats = rt2x00mac_get_stats, |
1866 | .bss_info_changed = rt2x00mac_bss_info_changed, | 1889 | .bss_info_changed = rt2x00mac_bss_info_changed, |
1867 | .conf_tx = rt2x00mac_conf_tx, | 1890 | .conf_tx = rt2x00mac_conf_tx, |
@@ -1872,6 +1895,7 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = { | |||
1872 | 1895 | ||
1873 | static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { | 1896 | static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { |
1874 | .irq_handler = rt2500pci_interrupt, | 1897 | .irq_handler = rt2500pci_interrupt, |
1898 | .irq_handler_thread = rt2500pci_interrupt_thread, | ||
1875 | .probe_hw = rt2500pci_probe_hw, | 1899 | .probe_hw = rt2500pci_probe_hw, |
1876 | .initialize = rt2x00pci_initialize, | 1900 | .initialize = rt2x00pci_initialize, |
1877 | .uninitialize = rt2x00pci_uninitialize, | 1901 | .uninitialize = rt2x00pci_uninitialize, |
@@ -1883,7 +1907,6 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { | |||
1883 | .reset_tuner = rt2500pci_reset_tuner, | 1907 | .reset_tuner = rt2500pci_reset_tuner, |
1884 | .link_tuner = rt2500pci_link_tuner, | 1908 | .link_tuner = rt2500pci_link_tuner, |
1885 | .write_tx_desc = rt2500pci_write_tx_desc, | 1909 | .write_tx_desc = rt2500pci_write_tx_desc, |
1886 | .write_tx_data = rt2x00pci_write_tx_data, | ||
1887 | .write_beacon = rt2500pci_write_beacon, | 1910 | .write_beacon = rt2500pci_write_beacon, |
1888 | .kick_tx_queue = rt2500pci_kick_tx_queue, | 1911 | .kick_tx_queue = rt2500pci_kick_tx_queue, |
1889 | .kill_tx_queue = rt2500pci_kill_tx_queue, | 1912 | .kill_tx_queue = rt2500pci_kill_tx_queue, |