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 | |
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')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 83 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 69 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 46 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.c | 60 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 88 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 4 |
9 files changed, 163 insertions, 204 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 | */ |
595 | static void rt2400pci_init_rxring(struct rt2x00_dev *rt2x00dev) | 595 | static 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 | ||
625 | static void rt2400pci_init_txring(struct rt2x00_dev *rt2x00dev, const int queue) | 614 | static 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 | ||
656 | static int rt2400pci_init_rings(struct rt2x00_dev *rt2x00dev) | 634 | static 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, ®); | 641 | rt2x00pci_register_read(rt2x00dev, TXCSR2, ®); |
@@ -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, |
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, |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 86549d5b64b3..46491eec377d 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -920,8 +920,6 @@ static int rt2500usb_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
920 | return -EIO; | 920 | return -EIO; |
921 | } | 921 | } |
922 | 922 | ||
923 | rt2x00usb_enable_radio(rt2x00dev); | ||
924 | |||
925 | /* | 923 | /* |
926 | * Enable LED | 924 | * Enable LED |
927 | */ | 925 | */ |
@@ -1776,6 +1774,8 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { | |||
1776 | .probe_hw = rt2500usb_probe_hw, | 1774 | .probe_hw = rt2500usb_probe_hw, |
1777 | .initialize = rt2x00usb_initialize, | 1775 | .initialize = rt2x00usb_initialize, |
1778 | .uninitialize = rt2x00usb_uninitialize, | 1776 | .uninitialize = rt2x00usb_uninitialize, |
1777 | .init_rxentry = rt2x00usb_init_rxentry, | ||
1778 | .init_txentry = rt2x00usb_init_txentry, | ||
1779 | .set_device_state = rt2500usb_set_device_state, | 1779 | .set_device_state = rt2500usb_set_device_state, |
1780 | .link_stats = rt2500usb_link_stats, | 1780 | .link_stats = rt2500usb_link_stats, |
1781 | .reset_tuner = rt2500usb_reset_tuner, | 1781 | .reset_tuner = rt2500usb_reset_tuner, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 0cd847c5241e..2cdde79e6d9b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -474,6 +474,14 @@ struct rt2x00lib_ops { | |||
474 | void (*uninitialize) (struct rt2x00_dev *rt2x00dev); | 474 | void (*uninitialize) (struct rt2x00_dev *rt2x00dev); |
475 | 475 | ||
476 | /* | 476 | /* |
477 | * Ring initialization handlers | ||
478 | */ | ||
479 | void (*init_rxentry) (struct rt2x00_dev *rt2x00dev, | ||
480 | struct data_entry *entry); | ||
481 | void (*init_txentry) (struct rt2x00_dev *rt2x00dev, | ||
482 | struct data_entry *entry); | ||
483 | |||
484 | /* | ||
477 | * Radio control handlers. | 485 | * Radio control handlers. |
478 | */ | 486 | */ |
479 | int (*set_device_state) (struct rt2x00_dev *rt2x00dev, | 487 | int (*set_device_state) (struct rt2x00_dev *rt2x00dev, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index a11421274f79..b26c634f210b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -103,6 +103,46 @@ void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * Ring initialization | ||
107 | */ | ||
108 | static void rt2x00lib_init_rxrings(struct rt2x00_dev *rt2x00dev) | ||
109 | { | ||
110 | struct data_ring *ring = rt2x00dev->rx; | ||
111 | unsigned int i; | ||
112 | |||
113 | if (!rt2x00dev->ops->lib->init_rxentry) | ||
114 | return; | ||
115 | |||
116 | if (ring->data_addr) | ||
117 | memset(ring->data_addr, 0, rt2x00_get_ring_size(ring)); | ||
118 | |||
119 | for (i = 0; i < ring->stats.limit; i++) | ||
120 | rt2x00dev->ops->lib->init_rxentry(rt2x00dev, &ring->entry[i]); | ||
121 | |||
122 | rt2x00_ring_index_clear(ring); | ||
123 | } | ||
124 | |||
125 | static void rt2x00lib_init_txrings(struct rt2x00_dev *rt2x00dev) | ||
126 | { | ||
127 | struct data_ring *ring; | ||
128 | unsigned int i; | ||
129 | |||
130 | if (!rt2x00dev->ops->lib->init_txentry) | ||
131 | return; | ||
132 | |||
133 | txringall_for_each(rt2x00dev, ring) { | ||
134 | if (ring->data_addr) | ||
135 | memset(ring->data_addr, 0, rt2x00_get_ring_size(ring)); | ||
136 | |||
137 | for (i = 0; i < ring->stats.limit; i++) | ||
138 | rt2x00dev->ops->lib->init_txentry(rt2x00dev, | ||
139 | &ring->entry[i]); | ||
140 | |||
141 | rt2x00_ring_index_clear(ring); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | /* | ||
106 | * Radio control handlers. | 146 | * Radio control handlers. |
107 | */ | 147 | */ |
108 | int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) | 148 | int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) |
@@ -118,6 +158,12 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
118 | return 0; | 158 | return 0; |
119 | 159 | ||
120 | /* | 160 | /* |
161 | * Initialize all data rings. | ||
162 | */ | ||
163 | rt2x00lib_init_rxrings(rt2x00dev); | ||
164 | rt2x00lib_init_txrings(rt2x00dev); | ||
165 | |||
166 | /* | ||
121 | * Enable radio. | 167 | * Enable radio. |
122 | */ | 168 | */ |
123 | status = rt2x00dev->ops->lib->set_device_state(rt2x00dev, | 169 | status = rt2x00dev->ops->lib->set_device_state(rt2x00dev, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index fa0cdd8b3e1a..63726a152a1a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -333,43 +333,6 @@ skip_entry: | |||
333 | /* | 333 | /* |
334 | * Radio handlers | 334 | * Radio handlers |
335 | */ | 335 | */ |
336 | void rt2x00usb_enable_radio(struct rt2x00_dev *rt2x00dev) | ||
337 | { | ||
338 | struct usb_device *usb_dev = | ||
339 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); | ||
340 | struct data_ring *ring; | ||
341 | struct data_entry *entry; | ||
342 | unsigned int i; | ||
343 | |||
344 | /* | ||
345 | * Initialize the TX rings | ||
346 | */ | ||
347 | txringall_for_each(rt2x00dev, ring) { | ||
348 | for (i = 0; i < ring->stats.limit; i++) | ||
349 | ring->entry[i].flags = 0; | ||
350 | |||
351 | rt2x00_ring_index_clear(ring); | ||
352 | } | ||
353 | |||
354 | /* | ||
355 | * Initialize and start the RX ring. | ||
356 | */ | ||
357 | rt2x00_ring_index_clear(rt2x00dev->rx); | ||
358 | |||
359 | for (i = 0; i < rt2x00dev->rx->stats.limit; i++) { | ||
360 | entry = &rt2x00dev->rx->entry[i]; | ||
361 | |||
362 | usb_fill_bulk_urb(entry->priv, usb_dev, | ||
363 | usb_rcvbulkpipe(usb_dev, 1), | ||
364 | entry->skb->data, entry->skb->len, | ||
365 | rt2x00usb_interrupt_rxdone, entry); | ||
366 | |||
367 | __set_bit(ENTRY_OWNER_NIC, &entry->flags); | ||
368 | usb_submit_urb(entry->priv, GFP_ATOMIC); | ||
369 | } | ||
370 | } | ||
371 | EXPORT_SYMBOL_GPL(rt2x00usb_enable_radio); | ||
372 | |||
373 | void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev) | 336 | void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev) |
374 | { | 337 | { |
375 | struct data_ring *ring; | 338 | struct data_ring *ring; |
@@ -391,6 +354,29 @@ EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio); | |||
391 | /* | 354 | /* |
392 | * Device initialization handlers. | 355 | * Device initialization handlers. |
393 | */ | 356 | */ |
357 | void rt2x00usb_init_rxentry(struct rt2x00_dev *rt2x00dev, | ||
358 | struct data_entry *entry) | ||
359 | { | ||
360 | struct usb_device *usb_dev = | ||
361 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); | ||
362 | |||
363 | usb_fill_bulk_urb(entry->priv, usb_dev, | ||
364 | usb_rcvbulkpipe(usb_dev, 1), | ||
365 | entry->skb->data, entry->skb->len, | ||
366 | rt2x00usb_interrupt_rxdone, entry); | ||
367 | |||
368 | __set_bit(ENTRY_OWNER_NIC, &entry->flags); | ||
369 | usb_submit_urb(entry->priv, GFP_ATOMIC); | ||
370 | } | ||
371 | EXPORT_SYMBOL_GPL(rt2x00usb_init_rxentry); | ||
372 | |||
373 | void rt2x00usb_init_txentry(struct rt2x00_dev *rt2x00dev, | ||
374 | struct data_entry *entry) | ||
375 | { | ||
376 | entry->flags = 0; | ||
377 | } | ||
378 | EXPORT_SYMBOL_GPL(rt2x00usb_init_txentry); | ||
379 | |||
394 | static int rt2x00usb_alloc_urb(struct rt2x00_dev *rt2x00dev, | 380 | static int rt2x00usb_alloc_urb(struct rt2x00_dev *rt2x00dev, |
395 | struct data_ring *ring) | 381 | struct data_ring *ring) |
396 | { | 382 | { |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index 2fa45c57a73f..e40df4050cd0 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -154,7 +154,6 @@ static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev, | |||
154 | /* | 154 | /* |
155 | * Radio handlers | 155 | * Radio handlers |
156 | */ | 156 | */ |
157 | void rt2x00usb_enable_radio(struct rt2x00_dev *rt2x00dev); | ||
158 | void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev); | 157 | void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev); |
159 | 158 | ||
160 | /* | 159 | /* |
@@ -167,6 +166,10 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
167 | /* | 166 | /* |
168 | * Device initialization handlers. | 167 | * Device initialization handlers. |
169 | */ | 168 | */ |
169 | void rt2x00usb_init_rxentry(struct rt2x00_dev *rt2x00dev, | ||
170 | struct data_entry *entry); | ||
171 | void rt2x00usb_init_txentry(struct rt2x00_dev *rt2x00dev, | ||
172 | struct data_entry *entry); | ||
170 | int rt2x00usb_initialize(struct rt2x00_dev *rt2x00dev); | 173 | int rt2x00usb_initialize(struct rt2x00_dev *rt2x00dev); |
171 | void rt2x00usb_uninitialize(struct rt2x00_dev *rt2x00dev); | 174 | void rt2x00usb_uninitialize(struct rt2x00_dev *rt2x00dev); |
172 | 175 | ||
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index eb8102486b5b..88d169800886 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -989,66 +989,46 @@ static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, void *data, | |||
989 | return 0; | 989 | return 0; |
990 | } | 990 | } |
991 | 991 | ||
992 | static void rt61pci_init_rxring(struct rt2x00_dev *rt2x00dev) | 992 | static void rt61pci_init_rxentry(struct rt2x00_dev *rt2x00dev, |
993 | struct data_entry *entry) | ||
993 | { | 994 | { |
994 | struct data_ring *ring = rt2x00dev->rx; | 995 | __le32 *rxd = entry->priv; |
995 | __le32 *rxd; | ||
996 | unsigned int i; | ||
997 | u32 word; | 996 | u32 word; |
998 | 997 | ||
999 | memset(ring->data_addr, 0x00, rt2x00_get_ring_size(ring)); | 998 | rt2x00_desc_read(rxd, 5, &word); |
1000 | 999 | rt2x00_set_field32(&word, RXD_W5_BUFFER_PHYSICAL_ADDRESS, | |
1001 | for (i = 0; i < ring->stats.limit; i++) { | 1000 | entry->data_dma); |
1002 | rxd = ring->entry[i].priv; | 1001 | rt2x00_desc_write(rxd, 5, word); |
1003 | |||
1004 | rt2x00_desc_read(rxd, 5, &word); | ||
1005 | rt2x00_set_field32(&word, RXD_W5_BUFFER_PHYSICAL_ADDRESS, | ||
1006 | ring->entry[i].data_dma); | ||
1007 | rt2x00_desc_write(rxd, 5, word); | ||
1008 | |||
1009 | rt2x00_desc_read(rxd, 0, &word); | ||
1010 | rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); | ||
1011 | rt2x00_desc_write(rxd, 0, word); | ||
1012 | } | ||
1013 | 1002 | ||
1014 | rt2x00_ring_index_clear(rt2x00dev->rx); | 1003 | rt2x00_desc_read(rxd, 0, &word); |
1004 | rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); | ||
1005 | rt2x00_desc_write(rxd, 0, word); | ||
1015 | } | 1006 | } |
1016 | 1007 | ||
1017 | static void rt61pci_init_txring(struct rt2x00_dev *rt2x00dev, const int queue) | 1008 | static void rt61pci_init_txentry(struct rt2x00_dev *rt2x00dev, |
1009 | struct data_entry *entry) | ||
1018 | { | 1010 | { |
1019 | struct data_ring *ring = rt2x00lib_get_ring(rt2x00dev, queue); | 1011 | __le32 *txd = entry->priv; |
1020 | __le32 *txd; | ||
1021 | unsigned int i; | ||
1022 | u32 word; | 1012 | u32 word; |
1023 | 1013 | ||
1024 | memset(ring->data_addr, 0x00, rt2x00_get_ring_size(ring)); | 1014 | rt2x00_desc_read(txd, 1, &word); |
1025 | 1015 | rt2x00_set_field32(&word, TXD_W1_BUFFER_COUNT, 1); | |
1026 | for (i = 0; i < ring->stats.limit; i++) { | 1016 | rt2x00_desc_write(txd, 1, word); |
1027 | txd = ring->entry[i].priv; | ||
1028 | |||
1029 | rt2x00_desc_read(txd, 1, &word); | ||
1030 | rt2x00_set_field32(&word, TXD_W1_BUFFER_COUNT, 1); | ||
1031 | rt2x00_desc_write(txd, 1, word); | ||
1032 | |||
1033 | rt2x00_desc_read(txd, 5, &word); | ||
1034 | rt2x00_set_field32(&word, TXD_W5_PID_TYPE, | ||
1035 | ring->queue_idx); | ||
1036 | rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE, | ||
1037 | ring->entry[i].entry_idx); | ||
1038 | rt2x00_desc_write(txd, 5, word); | ||
1039 | 1017 | ||
1040 | rt2x00_desc_read(txd, 6, &word); | 1018 | rt2x00_desc_read(txd, 5, &word); |
1041 | rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, | 1019 | rt2x00_set_field32(&word, TXD_W5_PID_TYPE, entry->ring->queue_idx); |
1042 | ring->entry[i].data_dma); | 1020 | rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE, entry->entry_idx); |
1043 | rt2x00_desc_write(txd, 6, word); | 1021 | rt2x00_desc_write(txd, 5, word); |
1044 | 1022 | ||
1045 | rt2x00_desc_read(txd, 0, &word); | 1023 | rt2x00_desc_read(txd, 6, &word); |
1046 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); | 1024 | rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, |
1047 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); | 1025 | entry->data_dma); |
1048 | rt2x00_desc_write(txd, 0, word); | 1026 | rt2x00_desc_write(txd, 6, word); |
1049 | } | ||
1050 | 1027 | ||
1051 | rt2x00_ring_index_clear(ring); | 1028 | rt2x00_desc_read(txd, 0, &word); |
1029 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); | ||
1030 | rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); | ||
1031 | rt2x00_desc_write(txd, 0, word); | ||
1052 | } | 1032 | } |
1053 | 1033 | ||
1054 | static int rt61pci_init_rings(struct rt2x00_dev *rt2x00dev) | 1034 | static int rt61pci_init_rings(struct rt2x00_dev *rt2x00dev) |
@@ -1056,16 +1036,6 @@ static int rt61pci_init_rings(struct rt2x00_dev *rt2x00dev) | |||
1056 | u32 reg; | 1036 | u32 reg; |
1057 | 1037 | ||
1058 | /* | 1038 | /* |
1059 | * Initialize rings. | ||
1060 | */ | ||
1061 | rt61pci_init_rxring(rt2x00dev); | ||
1062 | rt61pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_DATA0); | ||
1063 | rt61pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_DATA1); | ||
1064 | rt61pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_DATA2); | ||
1065 | rt61pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_DATA3); | ||
1066 | rt61pci_init_txring(rt2x00dev, IEEE80211_TX_QUEUE_DATA4); | ||
1067 | |||
1068 | /* | ||
1069 | * Initialize registers. | 1039 | * Initialize registers. |
1070 | */ | 1040 | */ |
1071 | rt2x00pci_register_read(rt2x00dev, TX_RING_CSR0, ®); | 1041 | rt2x00pci_register_read(rt2x00dev, TX_RING_CSR0, ®); |
@@ -2486,6 +2456,8 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = { | |||
2486 | .load_firmware = rt61pci_load_firmware, | 2456 | .load_firmware = rt61pci_load_firmware, |
2487 | .initialize = rt2x00pci_initialize, | 2457 | .initialize = rt2x00pci_initialize, |
2488 | .uninitialize = rt2x00pci_uninitialize, | 2458 | .uninitialize = rt2x00pci_uninitialize, |
2459 | .init_rxentry = rt61pci_init_rxentry, | ||
2460 | .init_txentry = rt61pci_init_txentry, | ||
2489 | .set_device_state = rt61pci_set_device_state, | 2461 | .set_device_state = rt61pci_set_device_state, |
2490 | .rfkill_poll = rt61pci_rfkill_poll, | 2462 | .rfkill_poll = rt61pci_rfkill_poll, |
2491 | .link_stats = rt61pci_link_stats, | 2463 | .link_stats = rt61pci_link_stats, |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index beaa264f6af7..78217dcb4638 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1136,8 +1136,6 @@ static int rt73usb_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
1136 | return -EIO; | 1136 | return -EIO; |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | rt2x00usb_enable_radio(rt2x00dev); | ||
1140 | |||
1141 | /* | 1139 | /* |
1142 | * Enable LED | 1140 | * Enable LED |
1143 | */ | 1141 | */ |
@@ -2033,6 +2031,8 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | |||
2033 | .load_firmware = rt73usb_load_firmware, | 2031 | .load_firmware = rt73usb_load_firmware, |
2034 | .initialize = rt2x00usb_initialize, | 2032 | .initialize = rt2x00usb_initialize, |
2035 | .uninitialize = rt2x00usb_uninitialize, | 2033 | .uninitialize = rt2x00usb_uninitialize, |
2034 | .init_rxentry = rt2x00usb_init_rxentry, | ||
2035 | .init_txentry = rt2x00usb_init_txentry, | ||
2036 | .set_device_state = rt73usb_set_device_state, | 2036 | .set_device_state = rt73usb_set_device_state, |
2037 | .link_stats = rt73usb_link_stats, | 2037 | .link_stats = rt73usb_link_stats, |
2038 | .reset_tuner = rt73usb_reset_tuner, | 2038 | .reset_tuner = rt73usb_reset_tuner, |