aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2400pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-01-06 17:41:45 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:27 -0500
commit837e7f247a8ed3f5577462655f8099a81b360422 (patch)
treeabf59b6ac3a0c27ad80dc282e9465c30eeb9fb55 /drivers/net/wireless/rt2x00/rt2400pci.c
parent7e56d38d5d0bda89228821902af297a46b5fdb80 (diff)
rt2x00: Move init_txring and init_rxring into rt2x00lib
Prior to enabling the radio rt2x00lib should go through all rings and for each entry should call the callback function init_txentry() and init_rxentry(). Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2400pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c83
1 files changed, 27 insertions, 56 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 95db2ccbc9a6..f4d0c779ac78 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -592,65 +592,43 @@ static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev)
592/* 592/*
593 * Initialization functions. 593 * Initialization functions.
594 */ 594 */
595static void rt2400pci_init_rxring(struct rt2x00_dev *rt2x00dev) 595static void rt2400pci_init_rxentry(struct rt2x00_dev *rt2x00dev,
596 struct data_entry *entry)
596{ 597{
597 struct data_ring *ring = rt2x00dev->rx; 598 __le32 *rxd = entry->priv;
598 __le32 *rxd;
599 unsigned int i;
600 u32 word; 599 u32 word;
601 600
602 memset(ring->data_addr, 0x00, rt2x00_get_ring_size(ring)); 601 rt2x00_desc_read(rxd, 2, &word);
603 602 rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH, entry->ring->data_size);
604 for (i = 0; i < ring->stats.limit; i++) { 603 rt2x00_desc_write(rxd, 2, word);
605 rxd = ring->entry[i].priv;
606 604
607 rt2x00_desc_read(rxd, 2, &word); 605 rt2x00_desc_read(rxd, 1, &word);
608 rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH, 606 rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, entry->data_dma);
609 ring->data_size); 607 rt2x00_desc_write(rxd, 1, word);
610 rt2x00_desc_write(rxd, 2, word);
611
612 rt2x00_desc_read(rxd, 1, &word);
613 rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS,
614 ring->entry[i].data_dma);
615 rt2x00_desc_write(rxd, 1, word);
616
617 rt2x00_desc_read(rxd, 0, &word);
618 rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1);
619 rt2x00_desc_write(rxd, 0, word);
620 }
621 608
622 rt2x00_ring_index_clear(rt2x00dev->rx); 609 rt2x00_desc_read(rxd, 0, &word);
610 rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1);
611 rt2x00_desc_write(rxd, 0, word);
623} 612}
624 613
625static void rt2400pci_init_txring(struct rt2x00_dev *rt2x00dev, const int queue) 614static void rt2400pci_init_txentry(struct rt2x00_dev *rt2x00dev,
615 struct data_entry *entry)
626{ 616{
627 struct data_ring *ring = rt2x00lib_get_ring(rt2x00dev, queue); 617 __le32 *txd = entry->priv;
628 __le32 *txd;
629 unsigned int i;
630 u32 word; 618 u32 word;
631 619
632 memset(ring->data_addr, 0x00, rt2x00_get_ring_size(ring)); 620 rt2x00_desc_read(txd, 1, &word);
633 621 rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, entry->data_dma);
634 for (i = 0; i < ring->stats.limit; i++) { 622 rt2x00_desc_write(txd, 1, word);
635 txd = ring->entry[i].priv;
636
637 rt2x00_desc_read(txd, 1, &word);
638 rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS,
639 ring->entry[i].data_dma);
640 rt2x00_desc_write(txd, 1, word);
641 623
642 rt2x00_desc_read(txd, 2, &word); 624 rt2x00_desc_read(txd, 2, &word);
643 rt2x00_set_field32(&word, TXD_W2_BUFFER_LENGTH, 625 rt2x00_set_field32(&word, TXD_W2_BUFFER_LENGTH, entry->ring->data_size);
644 ring->data_size); 626 rt2x00_desc_write(txd, 2, word);
645 rt2x00_desc_write(txd, 2, word);
646
647 rt2x00_desc_read(txd, 0, &word);
648 rt2x00_set_field32(&word, TXD_W0_VALID, 0);
649 rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0);
650 rt2x00_desc_write(txd, 0, word);
651 }
652 627
653 rt2x00_ring_index_clear(ring); 628 rt2x00_desc_read(txd, 0, &word);
629 rt2x00_set_field32(&word, TXD_W0_VALID, 0);
630 rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0);
631 rt2x00_desc_write(txd, 0, word);
654} 632}
655 633
656static int rt2400pci_init_rings(struct rt2x00_dev *rt2x00dev) 634static int rt2400pci_init_rings(struct rt2x00_dev *rt2x00dev)
@@ -658,15 +636,6 @@ static int rt2400pci_init_rings(struct rt2x00_dev *rt2x00dev)
658 u32 reg; 636 u32 reg;
659 637
660 /* 638 /*
661 * Initialize rings.
662 */
663 rt2400pci_init_rxring(rt2x00dev);
664 rt2400pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_DATA0);
665 rt2400pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_DATA1);
666 rt2400pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_AFTER_BEACON);
667 rt2400pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_BEACON);
668
669 /*
670 * Initialize registers. 639 * Initialize registers.
671 */ 640 */
672 rt2x00pci_register_read(rt2x00dev, TXCSR2, &reg); 641 rt2x00pci_register_read(rt2x00dev, TXCSR2, &reg);
@@ -1569,6 +1538,8 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
1569 .probe_hw = rt2400pci_probe_hw, 1538 .probe_hw = rt2400pci_probe_hw,
1570 .initialize = rt2x00pci_initialize, 1539 .initialize = rt2x00pci_initialize,
1571 .uninitialize = rt2x00pci_uninitialize, 1540 .uninitialize = rt2x00pci_uninitialize,
1541 .init_rxentry = rt2400pci_init_rxentry,
1542 .init_txentry = rt2400pci_init_txentry,
1572 .set_device_state = rt2400pci_set_device_state, 1543 .set_device_state = rt2400pci_set_device_state,
1573 .rfkill_poll = rt2400pci_rfkill_poll, 1544 .rfkill_poll = rt2400pci_rfkill_poll,
1574 .link_stats = rt2400pci_link_stats, 1545 .link_stats = rt2400pci_link_stats,