diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt61pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 88 |
1 files changed, 30 insertions, 58 deletions
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, |