aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2011-02-11 15:27:46 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-11 16:16:37 -0500
commit62e63975f47fcc0ebcaca04669098fe3ca7b20a2 (patch)
tree727edc69707087aecaf2c7443e8747b91795fee4 /drivers/net/wireless/rtlwifi
parentcaebbb7a4ac3e31b259954b757b15b8f0ac708d5 (diff)
rtlwifi: Modify core routines
The rtlwifi core needs some changes before inclusion of a driver for the RTL8192CU USB device. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: <chaoming_li@realsil.com.cn> Signed-off-by: <george0505@realtek.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi')
-rw-r--r--drivers/net/wireless/rtlwifi/base.h1
-rw-r--r--drivers/net/wireless/rtlwifi/debug.h1
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c85
-rw-r--r--drivers/net/wireless/rtlwifi/pci.h12
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h45
5 files changed, 56 insertions, 88 deletions
diff --git a/drivers/net/wireless/rtlwifi/base.h b/drivers/net/wireless/rtlwifi/base.h
index 3de5a14745f1..c95982b030da 100644
--- a/drivers/net/wireless/rtlwifi/base.h
+++ b/drivers/net/wireless/rtlwifi/base.h
@@ -30,6 +30,7 @@
30#define __RTL_BASE_H__ 30#define __RTL_BASE_H__
31 31
32#define RTL_DUMMY_OFFSET 0 32#define RTL_DUMMY_OFFSET 0
33#define RTL_RX_DESC_SIZE 24
33#define RTL_DUMMY_UNIT 8 34#define RTL_DUMMY_UNIT 8
34#define RTL_TX_DUMMY_SIZE (RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT) 35#define RTL_TX_DUMMY_SIZE (RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT)
35#define RTL_TX_DESC_SIZE 32 36#define RTL_TX_DESC_SIZE 32
diff --git a/drivers/net/wireless/rtlwifi/debug.h b/drivers/net/wireless/rtlwifi/debug.h
index 08bdec2ceda4..e4aa8687408c 100644
--- a/drivers/net/wireless/rtlwifi/debug.h
+++ b/drivers/net/wireless/rtlwifi/debug.h
@@ -105,6 +105,7 @@
105#define COMP_MAC80211 BIT(26) 105#define COMP_MAC80211 BIT(26)
106#define COMP_REGD BIT(27) 106#define COMP_REGD BIT(27)
107#define COMP_CHAN BIT(28) 107#define COMP_CHAN BIT(28)
108#define COMP_USB BIT(29)
108 109
109/*-------------------------------------------------------------- 110/*--------------------------------------------------------------
110 Define the rt_print components 111 Define the rt_print components
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 1758d4463247..a508ea51a1f8 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -690,75 +690,6 @@ done:
690 690
691} 691}
692 692
693void _rtl_pci_tx_interrupt(struct ieee80211_hw *hw)
694{
695 struct rtl_priv *rtlpriv = rtl_priv(hw);
696 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
697 int prio;
698
699 for (prio = 0; prio < RTL_PCI_MAX_TX_QUEUE_COUNT; prio++) {
700 struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[prio];
701
702 while (skb_queue_len(&ring->queue)) {
703 struct rtl_tx_desc *entry = &ring->desc[ring->idx];
704 struct sk_buff *skb;
705 struct ieee80211_tx_info *info;
706 u8 own;
707
708 /*
709 *beacon packet will only use the first
710 *descriptor defautly, and the own may not
711 *be cleared by the hardware, and
712 *beacon will free in prepare beacon
713 */
714 if (prio == BEACON_QUEUE || prio == TXCMD_QUEUE ||
715 prio == HCCA_QUEUE)
716 break;
717
718 own = (u8)rtlpriv->cfg->ops->get_desc((u8 *)entry,
719 true,
720 HW_DESC_OWN);
721
722 if (own)
723 break;
724
725 skb = __skb_dequeue(&ring->queue);
726 pci_unmap_single(rtlpci->pdev,
727 le32_to_cpu(rtlpriv->cfg->ops->
728 get_desc((u8 *) entry,
729 true,
730 HW_DESC_TXBUFF_ADDR)),
731 skb->len, PCI_DMA_TODEVICE);
732
733 ring->idx = (ring->idx + 1) % ring->entries;
734
735 info = IEEE80211_SKB_CB(skb);
736 ieee80211_tx_info_clear_status(info);
737
738 info->flags |= IEEE80211_TX_STAT_ACK;
739 /*info->status.rates[0].count = 1; */
740
741 ieee80211_tx_status_irqsafe(hw, skb);
742
743 if ((ring->entries - skb_queue_len(&ring->queue))
744 == 2 && prio != BEACON_QUEUE) {
745 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
746 ("more desc left, wake "
747 "skb_queue@%d,ring->idx = %d,"
748 "skb_queue_len = 0x%d\n",
749 prio, ring->idx,
750 skb_queue_len(&ring->queue)));
751
752 ieee80211_wake_queue(hw,
753 skb_get_queue_mapping
754 (skb));
755 }
756
757 skb = NULL;
758 }
759 }
760}
761
762static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id) 693static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
763{ 694{
764 struct ieee80211_hw *hw = dev_id; 695 struct ieee80211_hw *hw = dev_id;
@@ -1273,7 +1204,7 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw)
1273 return 0; 1204 return 0;
1274} 1205}
1275 1206
1276unsigned int _rtl_mac_to_hwqueue(u16 fc, 1207static unsigned int _rtl_mac_to_hwqueue(u16 fc,
1277 unsigned int mac80211_queue_index) 1208 unsigned int mac80211_queue_index)
1278{ 1209{
1279 unsigned int hw_queue_index; 1210 unsigned int hw_queue_index;
@@ -1312,7 +1243,7 @@ out:
1312 return hw_queue_index; 1243 return hw_queue_index;
1313} 1244}
1314 1245
1315int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1246static int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
1316{ 1247{
1317 struct rtl_priv *rtlpriv = rtl_priv(hw); 1248 struct rtl_priv *rtlpriv = rtl_priv(hw);
1318 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 1249 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
@@ -1429,7 +1360,7 @@ int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
1429 return 0; 1360 return 0;
1430} 1361}
1431 1362
1432void rtl_pci_deinit(struct ieee80211_hw *hw) 1363static void rtl_pci_deinit(struct ieee80211_hw *hw)
1433{ 1364{
1434 struct rtl_priv *rtlpriv = rtl_priv(hw); 1365 struct rtl_priv *rtlpriv = rtl_priv(hw);
1435 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1366 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
@@ -1444,7 +1375,7 @@ void rtl_pci_deinit(struct ieee80211_hw *hw)
1444 1375
1445} 1376}
1446 1377
1447int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev) 1378static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
1448{ 1379{
1449 struct rtl_priv *rtlpriv = rtl_priv(hw); 1380 struct rtl_priv *rtlpriv = rtl_priv(hw);
1450 int err; 1381 int err;
@@ -1461,7 +1392,7 @@ int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
1461 return 1; 1392 return 1;
1462} 1393}
1463 1394
1464int rtl_pci_start(struct ieee80211_hw *hw) 1395static int rtl_pci_start(struct ieee80211_hw *hw)
1465{ 1396{
1466 struct rtl_priv *rtlpriv = rtl_priv(hw); 1397 struct rtl_priv *rtlpriv = rtl_priv(hw);
1467 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 1398 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
@@ -1496,7 +1427,7 @@ int rtl_pci_start(struct ieee80211_hw *hw)
1496 return 0; 1427 return 0;
1497} 1428}
1498 1429
1499void rtl_pci_stop(struct ieee80211_hw *hw) 1430static void rtl_pci_stop(struct ieee80211_hw *hw)
1500{ 1431{
1501 struct rtl_priv *rtlpriv = rtl_priv(hw); 1432 struct rtl_priv *rtlpriv = rtl_priv(hw);
1502 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1433 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
@@ -1838,7 +1769,7 @@ fail3:
1838 ieee80211_free_hw(hw); 1769 ieee80211_free_hw(hw);
1839 1770
1840 if (rtlpriv->io.pci_mem_start != 0) 1771 if (rtlpriv->io.pci_mem_start != 0)
1841 pci_iounmap(pdev, (void *)rtlpriv->io.pci_mem_start); 1772 pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start);
1842 1773
1843fail2: 1774fail2:
1844 pci_release_regions(pdev); 1775 pci_release_regions(pdev);
@@ -1888,7 +1819,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
1888 } 1819 }
1889 1820
1890 if (rtlpriv->io.pci_mem_start != 0) { 1821 if (rtlpriv->io.pci_mem_start != 0) {
1891 pci_iounmap(pdev, (void *)rtlpriv->io.pci_mem_start); 1822 pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start);
1892 pci_release_regions(pdev); 1823 pci_release_regions(pdev);
1893 } 1824 }
1894 1825
diff --git a/drivers/net/wireless/rtlwifi/pci.h b/drivers/net/wireless/rtlwifi/pci.h
index d36a66939958..0caa81429726 100644
--- a/drivers/net/wireless/rtlwifi/pci.h
+++ b/drivers/net/wireless/rtlwifi/pci.h
@@ -244,34 +244,34 @@ int rtl_pci_resume(struct pci_dev *pdev);
244 244
245static inline u8 pci_read8_sync(struct rtl_priv *rtlpriv, u32 addr) 245static inline u8 pci_read8_sync(struct rtl_priv *rtlpriv, u32 addr)
246{ 246{
247 return 0xff & readb((u8 *) rtlpriv->io.pci_mem_start + addr); 247 return readb((u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
248} 248}
249 249
250static inline u16 pci_read16_sync(struct rtl_priv *rtlpriv, u32 addr) 250static inline u16 pci_read16_sync(struct rtl_priv *rtlpriv, u32 addr)
251{ 251{
252 return readw((u8 *) rtlpriv->io.pci_mem_start + addr); 252 return readw((u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
253} 253}
254 254
255static inline u32 pci_read32_sync(struct rtl_priv *rtlpriv, u32 addr) 255static inline u32 pci_read32_sync(struct rtl_priv *rtlpriv, u32 addr)
256{ 256{
257 return readl((u8 *) rtlpriv->io.pci_mem_start + addr); 257 return readl((u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
258} 258}
259 259
260static inline void pci_write8_async(struct rtl_priv *rtlpriv, u32 addr, u8 val) 260static inline void pci_write8_async(struct rtl_priv *rtlpriv, u32 addr, u8 val)
261{ 261{
262 writeb(val, (u8 *) rtlpriv->io.pci_mem_start + addr); 262 writeb(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
263} 263}
264 264
265static inline void pci_write16_async(struct rtl_priv *rtlpriv, 265static inline void pci_write16_async(struct rtl_priv *rtlpriv,
266 u32 addr, u16 val) 266 u32 addr, u16 val)
267{ 267{
268 writew(val, (u8 *) rtlpriv->io.pci_mem_start + addr); 268 writew(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
269} 269}
270 270
271static inline void pci_write32_async(struct rtl_priv *rtlpriv, 271static inline void pci_write32_async(struct rtl_priv *rtlpriv,
272 u32 addr, u32 val) 272 u32 addr, u32 val)
273{ 273{
274 writel(val, (u8 *) rtlpriv->io.pci_mem_start + addr); 274 writel(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
275} 275}
276 276
277static inline void rtl_pci_raw_write_port_ulong(u32 port, u32 val) 277static inline void rtl_pci_raw_write_port_ulong(u32 port, u32 val)
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index d44d79613d2d..ef44b75a66d2 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -34,6 +34,7 @@
34#include <linux/firmware.h> 34#include <linux/firmware.h>
35#include <linux/version.h> 35#include <linux/version.h>
36#include <linux/etherdevice.h> 36#include <linux/etherdevice.h>
37#include <linux/usb.h>
37#include <net/mac80211.h> 38#include <net/mac80211.h>
38#include "debug.h" 39#include "debug.h"
39 40
@@ -118,6 +119,9 @@ enum hardware_type {
118 HARDWARE_TYPE_NUM 119 HARDWARE_TYPE_NUM
119}; 120};
120 121
122#define IS_HARDWARE_TYPE_8192CE(rtlhal) \
123 (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CE)
124
121enum scan_operation_backup_opt { 125enum scan_operation_backup_opt {
122 SCAN_OPT_BACKUP = 0, 126 SCAN_OPT_BACKUP = 0,
123 SCAN_OPT_RESTORE, 127 SCAN_OPT_RESTORE,
@@ -768,6 +772,7 @@ struct rtl_tid_data {
768struct rtl_priv; 772struct rtl_priv;
769struct rtl_io { 773struct rtl_io {
770 struct device *dev; 774 struct device *dev;
775 struct mutex bb_mutex;
771 776
772 /*PCI MEM map */ 777 /*PCI MEM map */
773 unsigned long pci_mem_end; /*shared mem end */ 778 unsigned long pci_mem_end; /*shared mem end */
@@ -779,10 +784,14 @@ struct rtl_io {
779 void (*write8_async) (struct rtl_priv *rtlpriv, u32 addr, u8 val); 784 void (*write8_async) (struct rtl_priv *rtlpriv, u32 addr, u8 val);
780 void (*write16_async) (struct rtl_priv *rtlpriv, u32 addr, u16 val); 785 void (*write16_async) (struct rtl_priv *rtlpriv, u32 addr, u16 val);
781 void (*write32_async) (struct rtl_priv *rtlpriv, u32 addr, u32 val); 786 void (*write32_async) (struct rtl_priv *rtlpriv, u32 addr, u32 val);
787 int (*writeN_async) (struct rtl_priv *rtlpriv, u32 addr, u16 len,
788 u8 *pdata);
782 789
783 u8(*read8_sync) (struct rtl_priv *rtlpriv, u32 addr); 790 u8(*read8_sync) (struct rtl_priv *rtlpriv, u32 addr);
784 u16(*read16_sync) (struct rtl_priv *rtlpriv, u32 addr); 791 u16(*read16_sync) (struct rtl_priv *rtlpriv, u32 addr);
785 u32(*read32_sync) (struct rtl_priv *rtlpriv, u32 addr); 792 u32(*read32_sync) (struct rtl_priv *rtlpriv, u32 addr);
793 int (*readN_sync) (struct rtl_priv *rtlpriv, u32 addr, u16 len,
794 u8 *pdata);
786 795
787}; 796};
788 797
@@ -1101,6 +1110,7 @@ struct rtl_tcb_desc {
1101struct rtl_hal_ops { 1110struct rtl_hal_ops {
1102 int (*init_sw_vars) (struct ieee80211_hw *hw); 1111 int (*init_sw_vars) (struct ieee80211_hw *hw);
1103 void (*deinit_sw_vars) (struct ieee80211_hw *hw); 1112 void (*deinit_sw_vars) (struct ieee80211_hw *hw);
1113 void (*read_chip_version)(struct ieee80211_hw *hw);
1104 void (*read_eeprom_info) (struct ieee80211_hw *hw); 1114 void (*read_eeprom_info) (struct ieee80211_hw *hw);
1105 void (*interrupt_recognized) (struct ieee80211_hw *hw, 1115 void (*interrupt_recognized) (struct ieee80211_hw *hw,
1106 u32 *p_inta, u32 *p_intb); 1116 u32 *p_inta, u32 *p_intb);
@@ -1129,7 +1139,8 @@ struct rtl_hal_ops {
1129 void (*fill_tx_cmddesc) (struct ieee80211_hw *hw, u8 *pdesc, 1139 void (*fill_tx_cmddesc) (struct ieee80211_hw *hw, u8 *pdesc,
1130 bool b_firstseg, bool b_lastseg, 1140 bool b_firstseg, bool b_lastseg,
1131 struct sk_buff *skb); 1141 struct sk_buff *skb);
1132 bool(*query_rx_desc) (struct ieee80211_hw *hw, 1142 bool (*cmd_send_packet)(struct ieee80211_hw *hw, struct sk_buff *skb);
1143 bool(*query_rx_desc) (struct ieee80211_hw *hw,
1133 struct rtl_stats *stats, 1144 struct rtl_stats *stats,
1134 struct ieee80211_rx_status *rx_status, 1145 struct ieee80211_rx_status *rx_status,
1135 u8 *pdesc, struct sk_buff *skb); 1146 u8 *pdesc, struct sk_buff *skb);
@@ -1166,6 +1177,7 @@ struct rtl_intf_ops {
1166 1177
1167 int (*adapter_tx) (struct ieee80211_hw *hw, struct sk_buff *skb); 1178 int (*adapter_tx) (struct ieee80211_hw *hw, struct sk_buff *skb);
1168 int (*reset_trx_ring) (struct ieee80211_hw *hw); 1179 int (*reset_trx_ring) (struct ieee80211_hw *hw);
1180 bool (*waitq_insert) (struct ieee80211_hw *hw, struct sk_buff *skb);
1169 1181
1170 /*pci */ 1182 /*pci */
1171 void (*disable_aspm) (struct ieee80211_hw *hw); 1183 void (*disable_aspm) (struct ieee80211_hw *hw);
@@ -1179,11 +1191,35 @@ struct rtl_mod_params {
1179 int sw_crypto; 1191 int sw_crypto;
1180}; 1192};
1181 1193
1194struct rtl_hal_usbint_cfg {
1195 /* data - rx */
1196 u32 in_ep_num;
1197 u32 rx_urb_num;
1198 u32 rx_max_size;
1199
1200 /* op - rx */
1201 void (*usb_rx_hdl)(struct ieee80211_hw *, struct sk_buff *);
1202 void (*usb_rx_segregate_hdl)(struct ieee80211_hw *, struct sk_buff *,
1203 struct sk_buff_head *);
1204
1205 /* tx */
1206 void (*usb_tx_cleanup)(struct ieee80211_hw *, struct sk_buff *);
1207 int (*usb_tx_post_hdl)(struct ieee80211_hw *, struct urb *,
1208 struct sk_buff *);
1209 struct sk_buff *(*usb_tx_aggregate_hdl)(struct ieee80211_hw *,
1210 struct sk_buff_head *);
1211
1212 /* endpoint mapping */
1213 int (*usb_endpoint_mapping)(struct ieee80211_hw *hw);
1214 u16 (*usb_mq_to_hwq)(u16 fc, u16 mac80211_queue_index);
1215};
1216
1182struct rtl_hal_cfg { 1217struct rtl_hal_cfg {
1183 char *name; 1218 char *name;
1184 char *fw_name; 1219 char *fw_name;
1185 struct rtl_hal_ops *ops; 1220 struct rtl_hal_ops *ops;
1186 struct rtl_mod_params *mod_params; 1221 struct rtl_mod_params *mod_params;
1222 struct rtl_hal_usbint_cfg *usb_interface_cfg;
1187 1223
1188 /*this map used for some registers or vars 1224 /*this map used for some registers or vars
1189 defined int HAL but used in MAIN */ 1225 defined int HAL but used in MAIN */
@@ -1202,6 +1238,7 @@ struct rtl_locks {
1202 spinlock_t rf_ps_lock; 1238 spinlock_t rf_ps_lock;
1203 spinlock_t rf_lock; 1239 spinlock_t rf_lock;
1204 spinlock_t lps_lock; 1240 spinlock_t lps_lock;
1241 spinlock_t tx_urb_lock;
1205}; 1242};
1206 1243
1207struct rtl_works { 1244struct rtl_works {
@@ -1437,10 +1474,8 @@ Set subfield of little-endian 4-byte value to specified value. */
1437 (_os).octet = (u8 *)(_octet); \ 1474 (_os).octet = (u8 *)(_octet); \
1438 (_os).length = (_len); 1475 (_os).length = (_len);
1439 1476
1440#define CP_MACADDR(des, src) \ 1477#define CP_MACADDR(des, src) \
1441 ((des)[0] = (src)[0], (des)[1] = (src)[1],\ 1478 memcpy((des), (src), ETH_ALEN)
1442 (des)[2] = (src)[2], (des)[3] = (src)[3],\
1443 (des)[4] = (src)[4], (des)[5] = (src)[5])
1444 1479
1445static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr) 1480static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr)
1446{ 1481{