aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2400pci.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-14 23:40:34 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-14 23:40:34 -0400
commitfc943b12e48f9341bce48c2fadf094cc721aab93 (patch)
tree8c3244d7f5fae4edbfe0a5103789b0bc5c64f478 /drivers/net/wireless/rt2x00/rt2400pci.c
parent72d9794f444734af56ef12833b496326643e2964 (diff)
parent4c9adafff7d910f142fe44fae37ed12c6b99f20f (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2400pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c89
1 files changed, 35 insertions, 54 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 91cbd9e560bd..4c0538d6099b 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1069,6 +1069,40 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1069/* 1069/*
1070 * TX data initialization 1070 * TX data initialization
1071 */ 1071 */
1072static void rt2400pci_write_beacon(struct queue_entry *entry)
1073{
1074 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1075 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
1076 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1077 u32 word;
1078 u32 reg;
1079
1080 /*
1081 * Disable beaconing while we are reloading the beacon data,
1082 * otherwise we might be sending out invalid data.
1083 */
1084 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
1085 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
1086 rt2x00_set_field32(&reg, CSR14_TBCN, 0);
1087 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
1088 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1089
1090 /*
1091 * Replace rt2x00lib allocated descriptor with the
1092 * pointer to the _real_ hardware descriptor.
1093 * After that, map the beacon to DMA and update the
1094 * descriptor.
1095 */
1096 memcpy(entry_priv->desc, skbdesc->desc, skbdesc->desc_len);
1097 skbdesc->desc = entry_priv->desc;
1098
1099 rt2x00queue_map_txskb(rt2x00dev, entry->skb);
1100
1101 rt2x00_desc_read(entry_priv->desc, 1, &word);
1102 rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma);
1103 rt2x00_desc_write(entry_priv->desc, 1, word);
1104}
1105
1072static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1106static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1073 const enum data_queue_qid queue) 1107 const enum data_queue_qid queue)
1074{ 1108{
@@ -1515,59 +1549,6 @@ static u64 rt2400pci_get_tsf(struct ieee80211_hw *hw)
1515 return tsf; 1549 return tsf;
1516} 1550}
1517 1551
1518static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
1519{
1520 struct rt2x00_dev *rt2x00dev = hw->priv;
1521 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1522 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
1523 struct queue_entry_priv_pci *entry_priv;
1524 struct skb_frame_desc *skbdesc;
1525 struct txentry_desc txdesc;
1526 u32 reg;
1527
1528 if (unlikely(!intf->beacon))
1529 return -ENOBUFS;
1530 entry_priv = intf->beacon->priv_data;
1531
1532 /*
1533 * Copy all TX descriptor information into txdesc,
1534 * after that we are free to use the skb->cb array
1535 * for our information.
1536 */
1537 intf->beacon->skb = skb;
1538 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc);
1539
1540 /*
1541 * Fill in skb descriptor
1542 */
1543 skbdesc = get_skb_frame_desc(skb);
1544 memset(skbdesc, 0, sizeof(*skbdesc));
1545 skbdesc->desc = entry_priv->desc;
1546 skbdesc->desc_len = intf->beacon->queue->desc_size;
1547 skbdesc->entry = intf->beacon;
1548
1549 /*
1550 * Disable beaconing while we are reloading the beacon data,
1551 * otherwise we might be sending out invalid data.
1552 */
1553 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
1554 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
1555 rt2x00_set_field32(&reg, CSR14_TBCN, 0);
1556 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
1557 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1558
1559 /*
1560 * Enable beacon generation.
1561 * Write entire beacon with descriptor to register,
1562 * and kick the beacon generator.
1563 */
1564 rt2x00queue_map_txskb(rt2x00dev, intf->beacon->skb);
1565 rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc);
1566 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON);
1567
1568 return 0;
1569}
1570
1571static int rt2400pci_tx_last_beacon(struct ieee80211_hw *hw) 1552static int rt2400pci_tx_last_beacon(struct ieee80211_hw *hw)
1572{ 1553{
1573 struct rt2x00_dev *rt2x00dev = hw->priv; 1554 struct rt2x00_dev *rt2x00dev = hw->priv;
@@ -1592,7 +1573,6 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = {
1592 .conf_tx = rt2400pci_conf_tx, 1573 .conf_tx = rt2400pci_conf_tx,
1593 .get_tx_stats = rt2x00mac_get_tx_stats, 1574 .get_tx_stats = rt2x00mac_get_tx_stats,
1594 .get_tsf = rt2400pci_get_tsf, 1575 .get_tsf = rt2400pci_get_tsf,
1595 .beacon_update = rt2400pci_beacon_update,
1596 .tx_last_beacon = rt2400pci_tx_last_beacon, 1576 .tx_last_beacon = rt2400pci_tx_last_beacon,
1597}; 1577};
1598 1578
@@ -1610,6 +1590,7 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
1610 .link_tuner = rt2400pci_link_tuner, 1590 .link_tuner = rt2400pci_link_tuner,
1611 .write_tx_desc = rt2400pci_write_tx_desc, 1591 .write_tx_desc = rt2400pci_write_tx_desc,
1612 .write_tx_data = rt2x00pci_write_tx_data, 1592 .write_tx_data = rt2x00pci_write_tx_data,
1593 .write_beacon = rt2400pci_write_beacon,
1613 .kick_tx_queue = rt2400pci_kick_tx_queue, 1594 .kick_tx_queue = rt2400pci_kick_tx_queue,
1614 .fill_rxdone = rt2400pci_fill_rxdone, 1595 .fill_rxdone = rt2400pci_fill_rxdone,
1615 .config_filter = rt2400pci_config_filter, 1596 .config_filter = rt2400pci_config_filter,