aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/realtek/rtlwifi/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/realtek/rtlwifi/pci.c')
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/pci.c275
1 files changed, 133 insertions, 142 deletions
diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
index eb12818b46b3..c2575b0b9440 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
@@ -54,8 +54,7 @@ static const u8 ac_to_hwq[] = {
54 BK_QUEUE 54 BK_QUEUE
55}; 55};
56 56
57static u8 _rtl_mac_to_hwqueue(struct ieee80211_hw *hw, 57static u8 _rtl_mac_to_hwqueue(struct ieee80211_hw *hw, struct sk_buff *skb)
58 struct sk_buff *skb)
59{ 58{
60 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 59 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
61 __le16 fc = rtl_get_fc(skb); 60 __le16 fc = rtl_get_fc(skb);
@@ -104,20 +103,18 @@ static void _rtl_pci_update_default_setting(struct ieee80211_hw *hw)
104 break; 103 break;
105 104
106 case 3: 105 case 3:
107 /* 106 /* Always enable ASPM and Clock Req
108 * Always enable ASPM and Clock Req
109 * from initialization to halt. 107 * from initialization to halt.
110 * */ 108 */
111 ppsc->reg_rfps_level &= ~(RT_RF_LPS_LEVEL_ASPM); 109 ppsc->reg_rfps_level &= ~(RT_RF_LPS_LEVEL_ASPM);
112 ppsc->reg_rfps_level |= (RT_RF_PS_LEVEL_ALWAYS_ASPM | 110 ppsc->reg_rfps_level |= (RT_RF_PS_LEVEL_ALWAYS_ASPM |
113 RT_RF_OFF_LEVL_CLK_REQ); 111 RT_RF_OFF_LEVL_CLK_REQ);
114 break; 112 break;
115 113
116 case 4: 114 case 4:
117 /* 115 /* Always enable ASPM without Clock Req
118 * Always enable ASPM without Clock Req
119 * from initialization to halt. 116 * from initialization to halt.
120 * */ 117 */
121 ppsc->reg_rfps_level &= ~(RT_RF_LPS_LEVEL_ASPM | 118 ppsc->reg_rfps_level &= ~(RT_RF_LPS_LEVEL_ASPM |
122 RT_RF_OFF_LEVL_CLK_REQ); 119 RT_RF_OFF_LEVL_CLK_REQ);
123 ppsc->reg_rfps_level |= RT_RF_PS_LEVEL_ALWAYS_ASPM; 120 ppsc->reg_rfps_level |= RT_RF_PS_LEVEL_ALWAYS_ASPM;
@@ -146,32 +143,19 @@ static void _rtl_pci_update_default_setting(struct ieee80211_hw *hw)
146 143
147 /*Set HW definition to determine if it supports ASPM. */ 144 /*Set HW definition to determine if it supports ASPM. */
148 switch (rtlpci->const_support_pciaspm) { 145 switch (rtlpci->const_support_pciaspm) {
149 case 0:{ 146 case 0:
150 /*Not support ASPM. */ 147 /*Not support ASPM. */
151 bool support_aspm = false; 148 ppsc->support_aspm = false;
152 ppsc->support_aspm = support_aspm; 149 break;
153 break; 150 case 1:
154 } 151 /*Support ASPM. */
155 case 1:{ 152 ppsc->support_aspm = true;
156 /*Support ASPM. */ 153 ppsc->support_backdoor = true;
157 bool support_aspm = true; 154 break;
158 bool support_backdoor = true;
159 ppsc->support_aspm = support_aspm;
160
161 /*if (priv->oem_id == RT_CID_TOSHIBA &&
162 !priv->ndis_adapter.amd_l1_patch)
163 support_backdoor = false; */
164
165 ppsc->support_backdoor = support_backdoor;
166
167 break;
168 }
169 case 2: 155 case 2:
170 /*ASPM value set by chipset. */ 156 /*ASPM value set by chipset. */
171 if (pcibridge_vendor == PCI_BRIDGE_VENDOR_INTEL) { 157 if (pcibridge_vendor == PCI_BRIDGE_VENDOR_INTEL)
172 bool support_aspm = true; 158 ppsc->support_aspm = true;
173 ppsc->support_aspm = support_aspm;
174 }
175 break; 159 break;
176 default: 160 default:
177 pr_err("switch case %#x not processed\n", 161 pr_err("switch case %#x not processed\n",
@@ -180,10 +164,11 @@ static void _rtl_pci_update_default_setting(struct ieee80211_hw *hw)
180 } 164 }
181 165
182 /* toshiba aspm issue, toshiba will set aspm selfly 166 /* toshiba aspm issue, toshiba will set aspm selfly
183 * so we should not set aspm in driver */ 167 * so we should not set aspm in driver
168 */
184 pci_read_config_byte(rtlpci->pdev, 0x80, &init_aspm); 169 pci_read_config_byte(rtlpci->pdev, 0x80, &init_aspm);
185 if (rtlpriv->rtlhal.hw_type == HARDWARE_TYPE_RTL8192SE && 170 if (rtlpriv->rtlhal.hw_type == HARDWARE_TYPE_RTL8192SE &&
186 init_aspm == 0x43) 171 init_aspm == 0x43)
187 ppsc->support_aspm = false; 172 ppsc->support_aspm = false;
188} 173}
189 174
@@ -263,8 +248,7 @@ static void rtl_pci_disable_aspm(struct ieee80211_hw *hw)
263 udelay(50); 248 udelay(50);
264} 249}
265 250
266/* 251/*Enable RTL8192SE ASPM & Enable Pci Bridge ASPM for
267 *Enable RTL8192SE ASPM & Enable Pci Bridge ASPM for
268 *power saving We should follow the sequence to enable 252 *power saving We should follow the sequence to enable
269 *RTL8192SE first then enable Pci Bridge ASPM 253 *RTL8192SE first then enable Pci Bridge ASPM
270 *or the system will show bluescreen. 254 *or the system will show bluescreen.
@@ -334,7 +318,7 @@ static bool rtl_pci_get_amd_l1_patch(struct ieee80211_hw *hw)
334 318
335 bool status = false; 319 bool status = false;
336 u8 offset_e0; 320 u8 offset_e0;
337 unsigned offset_e4; 321 unsigned int offset_e4;
338 322
339 pci_write_config_byte(rtlpci->pdev, 0xe0, 0xa0); 323 pci_write_config_byte(rtlpci->pdev, 0xe0, 0xa0);
340 324
@@ -369,12 +353,12 @@ static bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw,
369 "tpcipriv->ndis_adapter.funcnumber %x\n", 353 "tpcipriv->ndis_adapter.funcnumber %x\n",
370 tpcipriv->ndis_adapter.funcnumber); 354 tpcipriv->ndis_adapter.funcnumber);
371 355
372 if ((pcipriv->ndis_adapter.busnumber == 356 if (pcipriv->ndis_adapter.busnumber ==
373 tpcipriv->ndis_adapter.busnumber) && 357 tpcipriv->ndis_adapter.busnumber &&
374 (pcipriv->ndis_adapter.devnumber == 358 pcipriv->ndis_adapter.devnumber ==
375 tpcipriv->ndis_adapter.devnumber) && 359 tpcipriv->ndis_adapter.devnumber &&
376 (pcipriv->ndis_adapter.funcnumber != 360 pcipriv->ndis_adapter.funcnumber !=
377 tpcipriv->ndis_adapter.funcnumber)) { 361 tpcipriv->ndis_adapter.funcnumber) {
378 find_buddy_priv = true; 362 find_buddy_priv = true;
379 break; 363 break;
380 } 364 }
@@ -407,7 +391,7 @@ static void rtl_pci_get_linkcontrol_field(struct ieee80211_hw *hw)
407} 391}
408 392
409static void rtl_pci_parse_configuration(struct pci_dev *pdev, 393static void rtl_pci_parse_configuration(struct pci_dev *pdev,
410 struct ieee80211_hw *hw) 394 struct ieee80211_hw *hw)
411{ 395{
412 struct rtl_priv *rtlpriv = rtl_priv(hw); 396 struct rtl_priv *rtlpriv = rtl_priv(hw);
413 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); 397 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
@@ -441,7 +425,6 @@ static void rtl_pci_init_aspm(struct ieee80211_hw *hw)
441 rtl_pci_enable_aspm(hw); 425 rtl_pci_enable_aspm(hw);
442 RT_SET_PS_LEVEL(ppsc, RT_RF_PS_LEVEL_ALWAYS_ASPM); 426 RT_SET_PS_LEVEL(ppsc, RT_RF_PS_LEVEL_ALWAYS_ASPM);
443 } 427 }
444
445} 428}
446 429
447static void _rtl_pci_io_handler_init(struct device *dev, 430static void _rtl_pci_io_handler_init(struct device *dev,
@@ -458,11 +441,11 @@ static void _rtl_pci_io_handler_init(struct device *dev,
458 rtlpriv->io.read8_sync = pci_read8_sync; 441 rtlpriv->io.read8_sync = pci_read8_sync;
459 rtlpriv->io.read16_sync = pci_read16_sync; 442 rtlpriv->io.read16_sync = pci_read16_sync;
460 rtlpriv->io.read32_sync = pci_read32_sync; 443 rtlpriv->io.read32_sync = pci_read32_sync;
461
462} 444}
463 445
464static bool _rtl_update_earlymode_info(struct ieee80211_hw *hw, 446static bool _rtl_update_earlymode_info(struct ieee80211_hw *hw,
465 struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc, u8 tid) 447 struct sk_buff *skb,
448 struct rtl_tcb_desc *tcb_desc, u8 tid)
466{ 449{
467 struct rtl_priv *rtlpriv = rtl_priv(hw); 450 struct rtl_priv *rtlpriv = rtl_priv(hw);
468 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 451 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
@@ -520,13 +503,15 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw)
520 (rtlpriv->buddy_priv && 503 (rtlpriv->buddy_priv &&
521 rtlpriv->buddy_priv->easy_concurrent_ctl.switch_in_process))) 504 rtlpriv->buddy_priv->easy_concurrent_ctl.switch_in_process)))
522 return; 505 return;
523 /* we juse use em for BE/BK/VI/VO */ 506 /* we just use em for BE/BK/VI/VO */
524 for (tid = 7; tid >= 0; tid--) { 507 for (tid = 7; tid >= 0; tid--) {
525 u8 hw_queue = ac_to_hwq[rtl_tid_to_ac(tid)]; 508 u8 hw_queue = ac_to_hwq[rtl_tid_to_ac(tid)];
526 struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; 509 struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue];
510
527 while (!mac->act_scanning && 511 while (!mac->act_scanning &&
528 rtlpriv->psc.rfpwr_state == ERFON) { 512 rtlpriv->psc.rfpwr_state == ERFON) {
529 struct rtl_tcb_desc tcb_desc; 513 struct rtl_tcb_desc tcb_desc;
514
530 memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); 515 memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
531 516
532 spin_lock_bh(&rtlpriv->locks.waitq_lock); 517 spin_lock_bh(&rtlpriv->locks.waitq_lock);
@@ -541,7 +526,8 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw)
541 spin_unlock_bh(&rtlpriv->locks.waitq_lock); 526 spin_unlock_bh(&rtlpriv->locks.waitq_lock);
542 527
543 /* Some macaddr can't do early mode. like 528 /* Some macaddr can't do early mode. like
544 * multicast/broadcast/no_qos data */ 529 * multicast/broadcast/no_qos data
530 */
545 info = IEEE80211_SKB_CB(skb); 531 info = IEEE80211_SKB_CB(skb);
546 if (info->flags & IEEE80211_TX_CTL_AMPDU) 532 if (info->flags & IEEE80211_TX_CTL_AMPDU)
547 _rtl_update_earlymode_info(hw, skb, 533 _rtl_update_earlymode_info(hw, skb,
@@ -552,7 +538,6 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw)
552 } 538 }
553} 539}
554 540
555
556static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio) 541static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
557{ 542{
558 struct rtl_priv *rtlpriv = rtl_priv(hw); 543 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -603,7 +588,6 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
603 if (prio == TXCMD_QUEUE) { 588 if (prio == TXCMD_QUEUE) {
604 dev_kfree_skb(skb); 589 dev_kfree_skb(skb);
605 goto tx_status_ok; 590 goto tx_status_ok;
606
607 } 591 }
608 592
609 /* for sw LPS, just after NULL skb send out, we can 593 /* for sw LPS, just after NULL skb send out, we can
@@ -643,15 +627,12 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
643 ieee80211_tx_status_irqsafe(hw, skb); 627 ieee80211_tx_status_irqsafe(hw, skb);
644 628
645 if ((ring->entries - skb_queue_len(&ring->queue)) <= 4) { 629 if ((ring->entries - skb_queue_len(&ring->queue)) <= 4) {
646
647 RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, 630 RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG,
648 "more desc left, wake skb_queue@%d, ring->idx = %d, skb_queue_len = 0x%x\n", 631 "more desc left, wake skb_queue@%d, ring->idx = %d, skb_queue_len = 0x%x\n",
649 prio, ring->idx, 632 prio, ring->idx,
650 skb_queue_len(&ring->queue)); 633 skb_queue_len(&ring->queue));
651 634
652 ieee80211_wake_queue(hw, 635 ieee80211_wake_queue(hw, skb_get_queue_mapping(skb));
653 skb_get_queue_mapping
654 (skb));
655 } 636 }
656tx_status_ok: 637tx_status_ok:
657 skb = NULL; 638 skb = NULL;
@@ -659,7 +640,7 @@ tx_status_ok:
659 640
660 if (((rtlpriv->link_info.num_rx_inperiod + 641 if (((rtlpriv->link_info.num_rx_inperiod +
661 rtlpriv->link_info.num_tx_inperiod) > 8) || 642 rtlpriv->link_info.num_tx_inperiod) > 8) ||
662 (rtlpriv->link_info.num_rx_inperiod > 2)) 643 rtlpriv->link_info.num_rx_inperiod > 2)
663 rtl_lps_leave(hw); 644 rtl_lps_leave(hw);
664} 645}
665 646
@@ -817,7 +798,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
817 new_skb = dev_alloc_skb(rtlpci->rxbuffersize); 798 new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
818 if (unlikely(!new_skb)) 799 if (unlikely(!new_skb))
819 goto no_new; 800 goto no_new;
820 memset(&rx_status , 0 , sizeof(rx_status)); 801 memset(&rx_status, 0, sizeof(rx_status));
821 rtlpriv->cfg->ops->query_rx_desc(hw, &stats, 802 rtlpriv->cfg->ops->query_rx_desc(hw, &stats,
822 &rx_status, (u8 *)pdesc, skb); 803 &rx_status, (u8 *)pdesc, skb);
823 804
@@ -847,12 +828,11 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
847 /* handle command packet here */ 828 /* handle command packet here */
848 if (rtlpriv->cfg->ops->rx_command_packet && 829 if (rtlpriv->cfg->ops->rx_command_packet &&
849 rtlpriv->cfg->ops->rx_command_packet(hw, &stats, skb)) { 830 rtlpriv->cfg->ops->rx_command_packet(hw, &stats, skb)) {
850 dev_kfree_skb_any(skb); 831 dev_kfree_skb_any(skb);
851 goto new_trx_end; 832 goto new_trx_end;
852 } 833 }
853 834
854 /* 835 /* NOTICE This can not be use for mac80211,
855 * NOTICE This can not be use for mac80211,
856 * this is done in mac80211 code, 836 * this is done in mac80211 code,
857 * if done here sec DHCP will fail 837 * if done here sec DHCP will fail
858 * skb_trim(skb, skb->len - 4); 838 * skb_trim(skb, skb->len - 4);
@@ -889,9 +869,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
889 /* for sw lps */ 869 /* for sw lps */
890 rtl_swlps_beacon(hw, (void *)skb->data, skb->len); 870 rtl_swlps_beacon(hw, (void *)skb->data, skb->len);
891 rtl_recognize_peer(hw, (void *)skb->data, skb->len); 871 rtl_recognize_peer(hw, (void *)skb->data, skb->len);
892 if ((rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP) && 872 if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP &&
893 (rtlpriv->rtlhal.current_bandtype == 873 rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G &&
894 BAND_ON_2_4G) &&
895 (ieee80211_is_beacon(fc) || 874 (ieee80211_is_beacon(fc) ||
896 ieee80211_is_probe_resp(fc))) { 875 ieee80211_is_probe_resp(fc))) {
897 dev_kfree_skb_any(skb); 876 dev_kfree_skb_any(skb);
@@ -913,7 +892,7 @@ new_trx_end:
913 } 892 }
914 if (((rtlpriv->link_info.num_rx_inperiod + 893 if (((rtlpriv->link_info.num_rx_inperiod +
915 rtlpriv->link_info.num_tx_inperiod) > 8) || 894 rtlpriv->link_info.num_tx_inperiod) > 8) ||
916 (rtlpriv->link_info.num_rx_inperiod > 2)) 895 rtlpriv->link_info.num_rx_inperiod > 2)
917 rtl_lps_leave(hw); 896 rtl_lps_leave(hw);
918 skb = new_skb; 897 skb = new_skb;
919no_new: 898no_new:
@@ -947,35 +926,34 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
947 unsigned long flags; 926 unsigned long flags;
948 u32 inta = 0; 927 u32 inta = 0;
949 u32 intb = 0; 928 u32 intb = 0;
929 u32 intc = 0;
930 u32 intd = 0;
950 irqreturn_t ret = IRQ_HANDLED; 931 irqreturn_t ret = IRQ_HANDLED;
951 932
952 if (rtlpci->irq_enabled == 0) 933 if (rtlpci->irq_enabled == 0)
953 return ret; 934 return ret;
954 935
955 spin_lock_irqsave(&rtlpriv->locks.irq_th_lock , flags); 936 spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
956 rtlpriv->cfg->ops->disable_interrupt(hw); 937 rtlpriv->cfg->ops->disable_interrupt(hw);
957 938
958 /*read ISR: 4/8bytes */ 939 /*read ISR: 4/8bytes */
959 rtlpriv->cfg->ops->interrupt_recognized(hw, &inta, &intb); 940 rtlpriv->cfg->ops->interrupt_recognized(hw, &inta, &intb, &intc, &intd);
960 941
961 /*Shared IRQ or HW disappared */ 942 /*Shared IRQ or HW disappeared */
962 if (!inta || inta == 0xffff) 943 if (!inta || inta == 0xffff)
963 goto done; 944 goto done;
964 945
965 /*<1> beacon related */ 946 /*<1> beacon related */
966 if (inta & rtlpriv->cfg->maps[RTL_IMR_TBDOK]) { 947 if (inta & rtlpriv->cfg->maps[RTL_IMR_TBDOK])
967 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 948 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
968 "beacon ok interrupt!\n"); 949 "beacon ok interrupt!\n");
969 }
970 950
971 if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_TBDER])) { 951 if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_TBDER]))
972 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 952 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
973 "beacon err interrupt!\n"); 953 "beacon err interrupt!\n");
974 }
975 954
976 if (inta & rtlpriv->cfg->maps[RTL_IMR_BDOK]) { 955 if (inta & rtlpriv->cfg->maps[RTL_IMR_BDOK])
977 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, "beacon interrupt!\n"); 956 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, "beacon interrupt!\n");
978 }
979 957
980 if (inta & rtlpriv->cfg->maps[RTL_IMR_BCNINT]) { 958 if (inta & rtlpriv->cfg->maps[RTL_IMR_BCNINT]) {
981 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 959 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
@@ -1031,6 +1009,16 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
1031 _rtl_pci_tx_isr(hw, VO_QUEUE); 1009 _rtl_pci_tx_isr(hw, VO_QUEUE);
1032 } 1010 }
1033 1011
1012 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8822BE) {
1013 if (intd & rtlpriv->cfg->maps[RTL_IMR_H2CDOK]) {
1014 rtlpriv->link_info.num_tx_inperiod++;
1015
1016 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
1017 "H2C TX OK interrupt!\n");
1018 _rtl_pci_tx_isr(hw, H2C_QUEUE);
1019 }
1020 }
1021
1034 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) { 1022 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) {
1035 if (inta & rtlpriv->cfg->maps[RTL_IMR_COMDOK]) { 1023 if (inta & rtlpriv->cfg->maps[RTL_IMR_COMDOK]) {
1036 rtlpriv->link_info.num_tx_inperiod++; 1024 rtlpriv->link_info.num_tx_inperiod++;
@@ -1130,7 +1118,7 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
1130 1118
1131 /*NB: the beacon data buffer must be 32-bit aligned. */ 1119 /*NB: the beacon data buffer must be 32-bit aligned. */
1132 pskb = ieee80211_beacon_get(hw, mac->vif); 1120 pskb = ieee80211_beacon_get(hw, mac->vif);
1133 if (pskb == NULL) 1121 if (!pskb)
1134 return; 1122 return;
1135 hdr = rtl_get_hdr(pskb); 1123 hdr = rtl_get_hdr(pskb);
1136 info = IEEE80211_SKB_CB(pskb); 1124 info = IEEE80211_SKB_CB(pskb);
@@ -1152,7 +1140,6 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
1152 rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, 1140 rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN,
1153 &temp_one); 1141 &temp_one);
1154 } 1142 }
1155 return;
1156} 1143}
1157 1144
1158static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw) 1145static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw)
@@ -1165,14 +1152,15 @@ static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw)
1165 1152
1166 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192EE) 1153 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192EE)
1167 desc_num = TX_DESC_NUM_92E; 1154 desc_num = TX_DESC_NUM_92E;
1155 else if (rtlhal->hw_type == HARDWARE_TYPE_RTL8822BE)
1156 desc_num = TX_DESC_NUM_8822B;
1168 else 1157 else
1169 desc_num = RT_TXDESC_NUM; 1158 desc_num = RT_TXDESC_NUM;
1170 1159
1171 for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) 1160 for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++)
1172 rtlpci->txringcount[i] = desc_num; 1161 rtlpci->txringcount[i] = desc_num;
1173 1162
1174 /* 1163 /*we just alloc 2 desc for beacon queue,
1175 *we just alloc 2 desc for beacon queue,
1176 *because we just need first desc in hw beacon. 1164 *because we just need first desc in hw beacon.
1177 */ 1165 */
1178 rtlpci->txringcount[BEACON_QUEUE] = 2; 1166 rtlpci->txringcount[BEACON_QUEUE] = 2;
@@ -1189,7 +1177,7 @@ static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw)
1189} 1177}
1190 1178
1191static void _rtl_pci_init_struct(struct ieee80211_hw *hw, 1179static void _rtl_pci_init_struct(struct ieee80211_hw *hw,
1192 struct pci_dev *pdev) 1180 struct pci_dev *pdev)
1193{ 1181{
1194 struct rtl_priv *rtlpriv = rtl_priv(hw); 1182 struct rtl_priv *rtlpriv = rtl_priv(hw);
1195 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 1183 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
@@ -1361,7 +1349,7 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx)
1361} 1349}
1362 1350
1363static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw, 1351static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw,
1364 unsigned int prio) 1352 unsigned int prio)
1365{ 1353{
1366 struct rtl_priv *rtlpriv = rtl_priv(hw); 1354 struct rtl_priv *rtlpriv = rtl_priv(hw);
1367 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1355 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
@@ -1378,8 +1366,7 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw,
1378 entry = (u8 *)(&ring->desc[ring->idx]); 1366 entry = (u8 *)(&ring->desc[ring->idx]);
1379 1367
1380 pci_unmap_single(rtlpci->pdev, 1368 pci_unmap_single(rtlpci->pdev,
1381 rtlpriv->cfg-> 1369 rtlpriv->cfg->ops->get_desc(hw, (u8 *)entry,
1382 ops->get_desc(hw, (u8 *)entry,
1383 true, 1370 true,
1384 HW_DESC_TXBUFF_ADDR), 1371 HW_DESC_TXBUFF_ADDR),
1385 skb->len, PCI_DMA_TODEVICE); 1372 skb->len, PCI_DMA_TODEVICE);
@@ -1451,8 +1438,7 @@ static int _rtl_pci_init_trx_ring(struct ieee80211_hw *hw)
1451 } 1438 }
1452 1439
1453 for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) { 1440 for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) {
1454 ret = _rtl_pci_init_tx_ring(hw, i, 1441 ret = _rtl_pci_init_tx_ring(hw, i, rtlpci->txringcount[i]);
1455 rtlpci->txringcount[i]);
1456 if (ret) 1442 if (ret)
1457 goto err_free_rings; 1443 goto err_free_rings;
1458 } 1444 }
@@ -1500,7 +1486,7 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw)
1500 /* force the rx_ring[RX_MPDU_QUEUE/ 1486 /* force the rx_ring[RX_MPDU_QUEUE/
1501 * RX_CMD_QUEUE].idx to the first one 1487 * RX_CMD_QUEUE].idx to the first one
1502 *new trx flow, do nothing 1488 *new trx flow, do nothing
1503 */ 1489 */
1504 if (!rtlpriv->use_new_trx_flow && 1490 if (!rtlpriv->use_new_trx_flow &&
1505 rtlpci->rx_ring[rxring_idx].desc) { 1491 rtlpci->rx_ring[rxring_idx].desc) {
1506 struct rtl_rx_desc *entry = NULL; 1492 struct rtl_rx_desc *entry = NULL;
@@ -1510,8 +1496,8 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw)
1510 entry = &rtlpci->rx_ring[rxring_idx].desc[i]; 1496 entry = &rtlpci->rx_ring[rxring_idx].desc[i];
1511 bufferaddress = 1497 bufferaddress =
1512 rtlpriv->cfg->ops->get_desc(hw, (u8 *)entry, 1498 rtlpriv->cfg->ops->get_desc(hw, (u8 *)entry,
1513 false , HW_DESC_RXBUFF_ADDR); 1499 false, HW_DESC_RXBUFF_ADDR);
1514 memset((u8 *)entry , 0 , 1500 memset((u8 *)entry, 0,
1515 sizeof(*rtlpci->rx_ring 1501 sizeof(*rtlpci->rx_ring
1516 [rxring_idx].desc));/*clear one entry*/ 1502 [rxring_idx].desc));/*clear one entry*/
1517 if (rtlpriv->use_new_trx_flow) { 1503 if (rtlpriv->use_new_trx_flow) {
@@ -1540,8 +1526,7 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw)
1540 rtlpci->rx_ring[rxring_idx].idx = 0; 1526 rtlpci->rx_ring[rxring_idx].idx = 0;
1541 } 1527 }
1542 1528
1543 /* 1529 /*after reset, release previous pending packet,
1544 *after reset, release previous pending packet,
1545 *and force the tx idx to the first one 1530 *and force the tx idx to the first one
1546 */ 1531 */
1547 spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); 1532 spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
@@ -1642,7 +1627,7 @@ static int rtl_pci_tx(struct ieee80211_hw *hw,
1642 1627
1643 if (rtlpriv->psc.sw_ps_enabled) { 1628 if (rtlpriv->psc.sw_ps_enabled) {
1644 if (ieee80211_is_data(fc) && !ieee80211_is_nullfunc(fc) && 1629 if (ieee80211_is_data(fc) && !ieee80211_is_nullfunc(fc) &&
1645 !ieee80211_has_pm(fc)) 1630 !ieee80211_has_pm(fc))
1646 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); 1631 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
1647 } 1632 }
1648 1633
@@ -1674,7 +1659,7 @@ static int rtl_pci_tx(struct ieee80211_hw *hw,
1674 own = (u8)rtlpriv->cfg->ops->get_desc(hw, (u8 *)pdesc, 1659 own = (u8)rtlpriv->cfg->ops->get_desc(hw, (u8 *)pdesc,
1675 true, HW_DESC_OWN); 1660 true, HW_DESC_OWN);
1676 1661
1677 if ((own == 1) && (hw_queue != BEACON_QUEUE)) { 1662 if (own == 1 && hw_queue != BEACON_QUEUE) {
1678 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1663 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1679 "No more TX desc@%d, ring->idx = %d, idx = %d, skb_queue_len = 0x%x\n", 1664 "No more TX desc@%d, ring->idx = %d, idx = %d, skb_queue_len = 0x%x\n",
1680 hw_queue, ring->idx, idx, 1665 hw_queue, ring->idx, idx,
@@ -1688,11 +1673,10 @@ static int rtl_pci_tx(struct ieee80211_hw *hw,
1688 1673
1689 if (rtlpriv->cfg->ops->get_available_desc && 1674 if (rtlpriv->cfg->ops->get_available_desc &&
1690 rtlpriv->cfg->ops->get_available_desc(hw, hw_queue) == 0) { 1675 rtlpriv->cfg->ops->get_available_desc(hw, hw_queue) == 0) {
1691 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1676 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1692 "get_available_desc fail\n"); 1677 "get_available_desc fail\n");
1693 spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, 1678 spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
1694 flags); 1679 return skb->len;
1695 return skb->len;
1696 } 1680 }
1697 1681
1698 if (ieee80211_is_data(fc)) 1682 if (ieee80211_is_data(fc))
@@ -1751,7 +1735,7 @@ static void rtl_pci_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
1751 ring = &pcipriv->dev.tx_ring[queue_id]; 1735 ring = &pcipriv->dev.tx_ring[queue_id];
1752 queue_len = skb_queue_len(&ring->queue); 1736 queue_len = skb_queue_len(&ring->queue);
1753 if (queue_len == 0 || queue_id == BEACON_QUEUE || 1737 if (queue_len == 0 || queue_id == BEACON_QUEUE ||
1754 queue_id == TXCMD_QUEUE) { 1738 queue_id == TXCMD_QUEUE) {
1755 queue_id--; 1739 queue_id--;
1756 continue; 1740 continue;
1757 } else { 1741 } else {
@@ -1761,7 +1745,7 @@ static void rtl_pci_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
1761 1745
1762 /* we just wait 1s for all queues */ 1746 /* we just wait 1s for all queues */
1763 if (rtlpriv->psc.rfpwr_state == ERFOFF || 1747 if (rtlpriv->psc.rfpwr_state == ERFOFF ||
1764 is_hal_stop(rtlhal) || i >= 200) 1748 is_hal_stop(rtlhal) || i >= 200)
1765 return; 1749 return;
1766 } 1750 }
1767} 1751}
@@ -1779,7 +1763,6 @@ static void rtl_pci_deinit(struct ieee80211_hw *hw)
1779 1763
1780 flush_workqueue(rtlpriv->works.rtl_wq); 1764 flush_workqueue(rtlpriv->works.rtl_wq);
1781 destroy_workqueue(rtlpriv->works.rtl_wq); 1765 destroy_workqueue(rtlpriv->works.rtl_wq);
1782
1783} 1766}
1784 1767
1785static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev) 1768static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
@@ -1837,7 +1820,7 @@ static int rtl_pci_start(struct ieee80211_hw *hw)
1837 1820
1838 rtlpci->up_first_time = false; 1821 rtlpci->up_first_time = false;
1839 1822
1840 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "rtl_pci_start OK\n"); 1823 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%s OK\n", __func__);
1841 return 0; 1824 return 0;
1842} 1825}
1843 1826
@@ -1848,13 +1831,12 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
1848 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 1831 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
1849 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 1832 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1850 unsigned long flags; 1833 unsigned long flags;
1851 u8 RFInProgressTimeOut = 0; 1834 u8 rf_timeout = 0;
1852 1835
1853 if (rtlpriv->cfg->ops->get_btc_status()) 1836 if (rtlpriv->cfg->ops->get_btc_status())
1854 rtlpriv->btcoexist.btc_ops->btc_halt_notify(); 1837 rtlpriv->btcoexist.btc_ops->btc_halt_notify();
1855 1838
1856 /* 1839 /*should be before disable interrupt&adapter
1857 *should be before disable interrupt&adapter
1858 *and will do it immediately. 1840 *and will do it immediately.
1859 */ 1841 */
1860 set_hal_stop(rtlhal); 1842 set_hal_stop(rtlhal);
@@ -1866,12 +1848,12 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
1866 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); 1848 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags);
1867 while (ppsc->rfchange_inprogress) { 1849 while (ppsc->rfchange_inprogress) {
1868 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flags); 1850 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flags);
1869 if (RFInProgressTimeOut > 100) { 1851 if (rf_timeout > 100) {
1870 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); 1852 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags);
1871 break; 1853 break;
1872 } 1854 }
1873 mdelay(1); 1855 mdelay(1);
1874 RFInProgressTimeOut++; 1856 rf_timeout++;
1875 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); 1857 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags);
1876 } 1858 }
1877 ppsc->rfchange_inprogress = true; 1859 ppsc->rfchange_inprogress = true;
@@ -1891,7 +1873,7 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
1891} 1873}
1892 1874
1893static bool _rtl_pci_find_adapter(struct pci_dev *pdev, 1875static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1894 struct ieee80211_hw *hw) 1876 struct ieee80211_hw *hw)
1895{ 1877{
1896 struct rtl_priv *rtlpriv = rtl_priv(hw); 1878 struct rtl_priv *rtlpriv = rtl_priv(hw);
1897 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); 1879 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
@@ -1946,13 +1928,12 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1946 venderid, deviceid); 1928 venderid, deviceid);
1947 rtlhal->hw_type = HARDWARE_TYPE_RTL8192SE; 1929 rtlhal->hw_type = HARDWARE_TYPE_RTL8192SE;
1948 break; 1930 break;
1949
1950 } 1931 }
1951 } else if (deviceid == RTL_PCI_8723AE_DID) { 1932 } else if (deviceid == RTL_PCI_8723AE_DID) {
1952 rtlhal->hw_type = HARDWARE_TYPE_RTL8723AE; 1933 rtlhal->hw_type = HARDWARE_TYPE_RTL8723AE;
1953 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1934 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1954 "8723AE PCI-E is found - " 1935 "8723AE PCI-E is found - vid/did=%x/%x\n",
1955 "vid/did=%x/%x\n", venderid, deviceid); 1936 venderid, deviceid);
1956 } else if (deviceid == RTL_PCI_8192CET_DID || 1937 } else if (deviceid == RTL_PCI_8192CET_DID ||
1957 deviceid == RTL_PCI_8192CE_DID || 1938 deviceid == RTL_PCI_8192CE_DID ||
1958 deviceid == RTL_PCI_8191CE_DID || 1939 deviceid == RTL_PCI_8191CE_DID ||
@@ -1972,21 +1953,26 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1972 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1953 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1973 "Find adapter, Hardware type is 8188EE\n"); 1954 "Find adapter, Hardware type is 8188EE\n");
1974 } else if (deviceid == RTL_PCI_8723BE_DID) { 1955 } else if (deviceid == RTL_PCI_8723BE_DID) {
1975 rtlhal->hw_type = HARDWARE_TYPE_RTL8723BE; 1956 rtlhal->hw_type = HARDWARE_TYPE_RTL8723BE;
1976 RT_TRACE(rtlpriv, COMP_INIT , DBG_LOUD, 1957 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1977 "Find adapter, Hardware type is 8723BE\n"); 1958 "Find adapter, Hardware type is 8723BE\n");
1978 } else if (deviceid == RTL_PCI_8192EE_DID) { 1959 } else if (deviceid == RTL_PCI_8192EE_DID) {
1979 rtlhal->hw_type = HARDWARE_TYPE_RTL8192EE; 1960 rtlhal->hw_type = HARDWARE_TYPE_RTL8192EE;
1980 RT_TRACE(rtlpriv, COMP_INIT , DBG_LOUD, 1961 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1981 "Find adapter, Hardware type is 8192EE\n"); 1962 "Find adapter, Hardware type is 8192EE\n");
1982 } else if (deviceid == RTL_PCI_8821AE_DID) { 1963 } else if (deviceid == RTL_PCI_8821AE_DID) {
1983 rtlhal->hw_type = HARDWARE_TYPE_RTL8821AE; 1964 rtlhal->hw_type = HARDWARE_TYPE_RTL8821AE;
1984 RT_TRACE(rtlpriv, COMP_INIT , DBG_LOUD, 1965 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1985 "Find adapter, Hardware type is 8821AE\n"); 1966 "Find adapter, Hardware type is 8821AE\n");
1986 } else if (deviceid == RTL_PCI_8812AE_DID) { 1967 } else if (deviceid == RTL_PCI_8812AE_DID) {
1987 rtlhal->hw_type = HARDWARE_TYPE_RTL8812AE; 1968 rtlhal->hw_type = HARDWARE_TYPE_RTL8812AE;
1988 RT_TRACE(rtlpriv, COMP_INIT , DBG_LOUD, 1969 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1989 "Find adapter, Hardware type is 8812AE\n"); 1970 "Find adapter, Hardware type is 8812AE\n");
1971 } else if (deviceid == RTL_PCI_8822BE_DID) {
1972 rtlhal->hw_type = HARDWARE_TYPE_RTL8822BE;
1973 rtlhal->bandset = BAND_ON_BOTH;
1974 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1975 "Find adapter, Hardware type is 8822BE\n");
1990 } else { 1976 } else {
1991 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1977 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1992 "Err: Unknown device - vid/did=%x/%x\n", 1978 "Err: Unknown device - vid/did=%x/%x\n",
@@ -2014,11 +2000,17 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
2014 } 2000 }
2015 } 2001 }
2016 2002
2017 /* 92ee use new trx flow */ 2003 switch (rtlhal->hw_type) {
2018 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192EE) 2004 case HARDWARE_TYPE_RTL8192EE:
2005 case HARDWARE_TYPE_RTL8822BE:
2006 /* use new trx flow */
2019 rtlpriv->use_new_trx_flow = true; 2007 rtlpriv->use_new_trx_flow = true;
2020 else 2008 break;
2009
2010 default:
2021 rtlpriv->use_new_trx_flow = false; 2011 rtlpriv->use_new_trx_flow = false;
2012 break;
2013 }
2022 2014
2023 /*find bus info */ 2015 /*find bus info */
2024 pcipriv->ndis_adapter.busnumber = pdev->bus->number; 2016 pcipriv->ndis_adapter.busnumber = pdev->bus->number;
@@ -2109,7 +2101,7 @@ static int rtl_pci_intr_mode_msi(struct ieee80211_hw *hw)
2109 2101
2110 rtlpci->using_msi = true; 2102 rtlpci->using_msi = true;
2111 2103
2112 RT_TRACE(rtlpriv, COMP_INIT|COMP_INTR, DBG_DMESG, 2104 RT_TRACE(rtlpriv, COMP_INIT | COMP_INTR, DBG_DMESG,
2113 "MSI Interrupt Mode!\n"); 2105 "MSI Interrupt Mode!\n");
2114 return 0; 2106 return 0;
2115} 2107}
@@ -2127,7 +2119,7 @@ static int rtl_pci_intr_mode_legacy(struct ieee80211_hw *hw)
2127 return ret; 2119 return ret;
2128 2120
2129 rtlpci->using_msi = false; 2121 rtlpci->using_msi = false;
2130 RT_TRACE(rtlpriv, COMP_INIT|COMP_INTR, DBG_DMESG, 2122 RT_TRACE(rtlpriv, COMP_INIT | COMP_INTR, DBG_DMESG,
2131 "Pin-based Interrupt Mode!\n"); 2123 "Pin-based Interrupt Mode!\n");
2132 return 0; 2124 return 0;
2133} 2125}
@@ -2164,7 +2156,7 @@ static void platform_enable_dma64(struct pci_dev *pdev, bool dma64)
2164} 2156}
2165 2157
2166int rtl_pci_probe(struct pci_dev *pdev, 2158int rtl_pci_probe(struct pci_dev *pdev,
2167 const struct pci_device_id *id) 2159 const struct pci_device_id *id)
2168{ 2160{
2169 struct ieee80211_hw *hw = NULL; 2161 struct ieee80211_hw *hw = NULL;
2170 2162
@@ -2343,7 +2335,6 @@ fail1:
2343 pci_disable_device(pdev); 2335 pci_disable_device(pdev);
2344 2336
2345 return err; 2337 return err;
2346
2347} 2338}
2348EXPORT_SYMBOL(rtl_pci_probe); 2339EXPORT_SYMBOL(rtl_pci_probe);
2349 2340
@@ -2402,20 +2393,20 @@ EXPORT_SYMBOL(rtl_pci_disconnect);
2402 2393
2403#ifdef CONFIG_PM_SLEEP 2394#ifdef CONFIG_PM_SLEEP
2404/*************************************** 2395/***************************************
2405kernel pci power state define: 2396 * kernel pci power state define:
2406PCI_D0 ((pci_power_t __force) 0) 2397 * PCI_D0 ((pci_power_t __force) 0)
2407PCI_D1 ((pci_power_t __force) 1) 2398 * PCI_D1 ((pci_power_t __force) 1)
2408PCI_D2 ((pci_power_t __force) 2) 2399 * PCI_D2 ((pci_power_t __force) 2)
2409PCI_D3hot ((pci_power_t __force) 3) 2400 * PCI_D3hot ((pci_power_t __force) 3)
2410PCI_D3cold ((pci_power_t __force) 4) 2401 * PCI_D3cold ((pci_power_t __force) 4)
2411PCI_UNKNOWN ((pci_power_t __force) 5) 2402 * PCI_UNKNOWN ((pci_power_t __force) 5)
2412 2403
2413This function is called when system 2404 * This function is called when system
2414goes into suspend state mac80211 will 2405 * goes into suspend state mac80211 will
2415call rtl_mac_stop() from the mac80211 2406 * call rtl_mac_stop() from the mac80211
2416suspend function first, So there is 2407 * suspend function first, So there is
2417no need to call hw_disable here. 2408 * no need to call hw_disable here.
2418****************************************/ 2409 ****************************************/
2419int rtl_pci_suspend(struct device *dev) 2410int rtl_pci_suspend(struct device *dev)
2420{ 2411{
2421 struct pci_dev *pdev = to_pci_dev(dev); 2412 struct pci_dev *pdev = to_pci_dev(dev);