diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-01-06 17:41:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:27 -0500 |
commit | 837e7f247a8ed3f5577462655f8099a81b360422 (patch) | |
tree | abf59b6ac3a0c27ad80dc282e9465c30eeb9fb55 /drivers/net/wireless/rt2x00/rt2500pci.c | |
parent | 7e56d38d5d0bda89228821902af297a46b5fdb80 (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/rt2500pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 69 |
1 files changed, 21 insertions, 48 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 133967e81f6f..206b50ff831f 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -683,55 +683,35 @@ dynamic_cca_tune: | |||
683 | /* | 683 | /* |
684 | * Initialization functions. | 684 | * Initialization functions. |
685 | */ | 685 | */ |
686 | static void rt2500pci_init_rxring(struct rt2x00_dev *rt2x00dev) | 686 | static void rt2500pci_init_rxentry(struct rt2x00_dev *rt2x00dev, |
687 | struct data_entry *entry) | ||
687 | { | 688 | { |
688 | struct data_ring *ring = rt2x00dev->rx; | 689 | __le32 *rxd = entry->priv; |
689 | __le32 *rxd; | ||
690 | unsigned int i; | ||
691 | u32 word; | 690 | u32 word; |
692 | 691 | ||
693 | memset(ring->data_addr, 0x00, rt2x00_get_ring_size(ring)); | 692 | rt2x00_desc_read(rxd, 1, &word); |
694 | 693 | rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, entry->data_dma); | |
695 | for (i = 0; i < ring->stats.limit; i++) { | 694 | rt2x00_desc_write(rxd, 1, word); |
696 | rxd = ring->entry[i].priv; | ||
697 | |||
698 | rt2x00_desc_read(rxd, 1, &word); | ||
699 | rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, | ||
700 | ring->entry[i].data_dma); | ||
701 | rt2x00_desc_write(rxd, 1, word); | ||
702 | |||
703 | rt2x00_desc_read(rxd, 0, &word); | ||
704 | rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); | ||
705 | rt2x00_desc_write(rxd, 0, word); | ||
706 | } | ||
707 | 695 | ||
708 | rt2x00_ring_index_clear(rt2x00dev->rx); | 696 | rt2x00_desc_read(rxd, 0, &word); |
697 | rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); | ||
698 | rt2x00_desc_write(rxd, 0, word); | ||
709 | } | 699 | } |
710 | 700 | ||
711 | static void rt2500pci_init_txring(struct rt2x00_dev *rt2x00dev, const int queue) | 701 | static void rt2500pci_init_txentry(struct rt2x00_dev *rt2x00dev, |
702 | struct data_entry *entry) | ||
712 | { | 703 | { |
713 | struct data_ring *ring = rt2x00lib_get_ring(rt2x00dev, queue); | 704 | __le32 *txd = entry->priv; |
714 | __le32 *txd; | ||
715 | unsigned int i; | ||
716 | u32 word; | 705 | u32 word; |
717 | 706 | ||
718 | memset(ring->data_addr, 0x00, rt2x00_get_ring_size(ring)); | 707 | rt2x00_desc_read(txd, 1, &word); |
719 | 708 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, entry->data_dma); | |
720 | for (i = 0; i < ring->stats.limit; i++) { | 709 | rt2x00_desc_write(txd, 1, word); |
721 | txd = ring->entry[i].priv; | ||
722 | 710 | ||
723 | rt2x00_desc_read(txd, 1, &word); | 711 | rt2x00_desc_read(txd, 0, &word); |
724 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, | 712 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); |
725 | ring->entry[i].data_dma); | 713 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); |
726 | rt2x00_desc_write(txd, 1, word); | 714 | rt2x00_desc_write(txd, 0, word); |
727 | |||
728 | rt2x00_desc_read(txd, 0, &word); | ||
729 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); | ||
730 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); | ||
731 | rt2x00_desc_write(txd, 0, word); | ||
732 | } | ||
733 | |||
734 | rt2x00_ring_index_clear(ring); | ||
735 | } | 715 | } |
736 | 716 | ||
737 | static int rt2500pci_init_rings(struct rt2x00_dev *rt2x00dev) | 717 | static int rt2500pci_init_rings(struct rt2x00_dev *rt2x00dev) |
@@ -739,15 +719,6 @@ static int rt2500pci_init_rings(struct rt2x00_dev *rt2x00dev) | |||
739 | u32 reg; | 719 | u32 reg; |
740 | 720 | ||
741 | /* | 721 | /* |
742 | * Initialize rings. | ||
743 | */ | ||
744 | rt2500pci_init_rxring(rt2x00dev); | ||
745 | rt2500pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_DATA0); | ||
746 | rt2500pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_DATA1); | ||
747 | rt2500pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_AFTER_BEACON); | ||
748 | rt2500pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_BEACON); | ||
749 | |||
750 | /* | ||
751 | * Initialize registers. | 722 | * Initialize registers. |
752 | */ | 723 | */ |
753 | rt2x00pci_register_read(rt2x00dev, TXCSR2, ®); | 724 | rt2x00pci_register_read(rt2x00dev, TXCSR2, ®); |
@@ -1878,6 +1849,8 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { | |||
1878 | .probe_hw = rt2500pci_probe_hw, | 1849 | .probe_hw = rt2500pci_probe_hw, |
1879 | .initialize = rt2x00pci_initialize, | 1850 | .initialize = rt2x00pci_initialize, |
1880 | .uninitialize = rt2x00pci_uninitialize, | 1851 | .uninitialize = rt2x00pci_uninitialize, |
1852 | .init_rxentry = rt2500pci_init_rxentry, | ||
1853 | .init_txentry = rt2500pci_init_txentry, | ||
1881 | .set_device_state = rt2500pci_set_device_state, | 1854 | .set_device_state = rt2500pci_set_device_state, |
1882 | .rfkill_poll = rt2500pci_rfkill_poll, | 1855 | .rfkill_poll = rt2500pci_rfkill_poll, |
1883 | .link_stats = rt2500pci_link_stats, | 1856 | .link_stats = rt2500pci_link_stats, |