diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-02-22 15:10:22 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-02-22 15:10:22 -0500 |
commit | 5db5e44cdcdc5ee9cc821bd4d63445af0bb34bce (patch) | |
tree | b5e5787a6d5c15e589d275c7434ebbf341257234 /drivers/net/wireless/rtlwifi/wifi.h | |
parent | db62983a1e4b2af9e79c97af768f0c8b80bd93f0 (diff) | |
parent | 320d6c1b56de5f461c6062625b9664095f90ee95 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Diffstat (limited to 'drivers/net/wireless/rtlwifi/wifi.h')
-rw-r--r-- | drivers/net/wireless/rtlwifi/wifi.h | 667 |
1 files changed, 490 insertions, 177 deletions
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index d44d79613d2d..4b90b35f211e 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 | ||
@@ -82,6 +83,19 @@ | |||
82 | #define MAC80211_3ADDR_LEN 24 | 83 | #define MAC80211_3ADDR_LEN 24 |
83 | #define MAC80211_4ADDR_LEN 30 | 84 | #define MAC80211_4ADDR_LEN 30 |
84 | 85 | ||
86 | #define CHANNEL_MAX_NUMBER (14 + 24 + 21) /* 14 is the max channel no */ | ||
87 | #define CHANNEL_GROUP_MAX (3 + 9) /* ch1~3, 4~9, 10~14 = three groups */ | ||
88 | #define MAX_PG_GROUP 13 | ||
89 | #define CHANNEL_GROUP_MAX_2G 3 | ||
90 | #define CHANNEL_GROUP_IDX_5GL 3 | ||
91 | #define CHANNEL_GROUP_IDX_5GM 6 | ||
92 | #define CHANNEL_GROUP_IDX_5GH 9 | ||
93 | #define CHANNEL_GROUP_MAX_5G 9 | ||
94 | #define CHANNEL_MAX_NUMBER_2G 14 | ||
95 | #define AVG_THERMAL_NUM 8 | ||
96 | |||
97 | /* for early mode */ | ||
98 | #define EM_HDR_LEN 8 | ||
85 | enum intf_type { | 99 | enum intf_type { |
86 | INTF_PCI = 0, | 100 | INTF_PCI = 0, |
87 | INTF_USB = 1, | 101 | INTF_USB = 1, |
@@ -113,11 +127,38 @@ enum hardware_type { | |||
113 | HARDWARE_TYPE_RTL8192CU, | 127 | HARDWARE_TYPE_RTL8192CU, |
114 | HARDWARE_TYPE_RTL8192DE, | 128 | HARDWARE_TYPE_RTL8192DE, |
115 | HARDWARE_TYPE_RTL8192DU, | 129 | HARDWARE_TYPE_RTL8192DU, |
130 | HARDWARE_TYPE_RTL8723E, | ||
131 | HARDWARE_TYPE_RTL8723U, | ||
116 | 132 | ||
117 | /*keep it last*/ | 133 | /* keep it last */ |
118 | HARDWARE_TYPE_NUM | 134 | HARDWARE_TYPE_NUM |
119 | }; | 135 | }; |
120 | 136 | ||
137 | #define IS_HARDWARE_TYPE_8192SU(rtlhal) \ | ||
138 | (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SU) | ||
139 | #define IS_HARDWARE_TYPE_8192SE(rtlhal) \ | ||
140 | (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) | ||
141 | #define IS_HARDWARE_TYPE_8192CE(rtlhal) \ | ||
142 | (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CE) | ||
143 | #define IS_HARDWARE_TYPE_8192CU(rtlhal) \ | ||
144 | (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CU) | ||
145 | #define IS_HARDWARE_TYPE_8192DE(rtlhal) \ | ||
146 | (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DE) | ||
147 | #define IS_HARDWARE_TYPE_8192DU(rtlhal) \ | ||
148 | (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DU) | ||
149 | #define IS_HARDWARE_TYPE_8723E(rtlhal) \ | ||
150 | (rtlhal->hw_type == HARDWARE_TYPE_RTL8723E) | ||
151 | #define IS_HARDWARE_TYPE_8723U(rtlhal) \ | ||
152 | (rtlhal->hw_type == HARDWARE_TYPE_RTL8723U) | ||
153 | #define IS_HARDWARE_TYPE_8192S(rtlhal) \ | ||
154 | (IS_HARDWARE_TYPE_8192SE(rtlhal) || IS_HARDWARE_TYPE_8192SU(rtlhal)) | ||
155 | #define IS_HARDWARE_TYPE_8192C(rtlhal) \ | ||
156 | (IS_HARDWARE_TYPE_8192CE(rtlhal) || IS_HARDWARE_TYPE_8192CU(rtlhal)) | ||
157 | #define IS_HARDWARE_TYPE_8192D(rtlhal) \ | ||
158 | (IS_HARDWARE_TYPE_8192DE(rtlhal) || IS_HARDWARE_TYPE_8192DU(rtlhal)) | ||
159 | #define IS_HARDWARE_TYPE_8723(rtlhal) \ | ||
160 | (IS_HARDWARE_TYPE_8723E(rtlhal) || IS_HARDWARE_TYPE_8723U(rtlhal)) | ||
161 | |||
121 | enum scan_operation_backup_opt { | 162 | enum scan_operation_backup_opt { |
122 | SCAN_OPT_BACKUP = 0, | 163 | SCAN_OPT_BACKUP = 0, |
123 | SCAN_OPT_RESTORE, | 164 | SCAN_OPT_RESTORE, |
@@ -315,6 +356,7 @@ enum rf_type { | |||
315 | RF_1T1R = 0, | 356 | RF_1T1R = 0, |
316 | RF_1T2R = 1, | 357 | RF_1T2R = 1, |
317 | RF_2T2R = 2, | 358 | RF_2T2R = 2, |
359 | RF_2T2R_GREEN = 3, | ||
318 | }; | 360 | }; |
319 | 361 | ||
320 | enum ht_channel_width { | 362 | enum ht_channel_width { |
@@ -359,6 +401,8 @@ enum rtl_var_map { | |||
359 | EFUSE_LOADER_CLK_EN, | 401 | EFUSE_LOADER_CLK_EN, |
360 | EFUSE_ANA8M, | 402 | EFUSE_ANA8M, |
361 | EFUSE_HWSET_MAX_SIZE, | 403 | EFUSE_HWSET_MAX_SIZE, |
404 | EFUSE_MAX_SECTION_MAP, | ||
405 | EFUSE_REAL_CONTENT_SIZE, | ||
362 | 406 | ||
363 | /*CAM map */ | 407 | /*CAM map */ |
364 | RWCAM, | 408 | RWCAM, |
@@ -397,6 +441,7 @@ enum rtl_var_map { | |||
397 | RTL_IMR_ATIMEND, /*For 92C,ATIM Window End Interrupt */ | 441 | RTL_IMR_ATIMEND, /*For 92C,ATIM Window End Interrupt */ |
398 | RTL_IMR_BDOK, /*Beacon Queue DMA OK Interrup */ | 442 | RTL_IMR_BDOK, /*Beacon Queue DMA OK Interrup */ |
399 | RTL_IMR_HIGHDOK, /*High Queue DMA OK Interrupt */ | 443 | RTL_IMR_HIGHDOK, /*High Queue DMA OK Interrupt */ |
444 | RTL_IMR_COMDOK, /*Command Queue DMA OK Interrupt*/ | ||
400 | RTL_IMR_TBDOK, /*Transmit Beacon OK interrup */ | 445 | RTL_IMR_TBDOK, /*Transmit Beacon OK interrup */ |
401 | RTL_IMR_MGNTDOK, /*Management Queue DMA OK Interrupt */ | 446 | RTL_IMR_MGNTDOK, /*Management Queue DMA OK Interrupt */ |
402 | RTL_IMR_TBDER, /*For 92C,Transmit Beacon Error Interrupt */ | 447 | RTL_IMR_TBDER, /*For 92C,Transmit Beacon Error Interrupt */ |
@@ -405,7 +450,8 @@ enum rtl_var_map { | |||
405 | RTL_IMR_VIDOK, /*AC_VI DMA OK Interrupt */ | 450 | RTL_IMR_VIDOK, /*AC_VI DMA OK Interrupt */ |
406 | RTL_IMR_VODOK, /*AC_VO DMA Interrupt */ | 451 | RTL_IMR_VODOK, /*AC_VO DMA Interrupt */ |
407 | RTL_IMR_ROK, /*Receive DMA OK Interrupt */ | 452 | RTL_IMR_ROK, /*Receive DMA OK Interrupt */ |
408 | RTL_IBSS_INT_MASKS, /*(RTL_IMR_BcnInt|RTL_IMR_TBDOK|RTL_IMR_TBDER)*/ | 453 | RTL_IBSS_INT_MASKS, /*(RTL_IMR_BcnInt | RTL_IMR_TBDOK | |
454 | * RTL_IMR_TBDER) */ | ||
409 | 455 | ||
410 | /*CCK Rates, TxHT = 0 */ | 456 | /*CCK Rates, TxHT = 0 */ |
411 | RTL_RC_CCK_RATE1M, | 457 | RTL_RC_CCK_RATE1M, |
@@ -481,6 +527,19 @@ enum acm_method { | |||
481 | eAcmWay2_SW = 2, | 527 | eAcmWay2_SW = 2, |
482 | }; | 528 | }; |
483 | 529 | ||
530 | enum macphy_mode { | ||
531 | SINGLEMAC_SINGLEPHY = 0, | ||
532 | DUALMAC_DUALPHY, | ||
533 | DUALMAC_SINGLEPHY, | ||
534 | }; | ||
535 | |||
536 | enum band_type { | ||
537 | BAND_ON_2_4G = 0, | ||
538 | BAND_ON_5G, | ||
539 | BAND_ON_BOTH, | ||
540 | BANDMAX | ||
541 | }; | ||
542 | |||
484 | /*aci/aifsn Field. | 543 | /*aci/aifsn Field. |
485 | Ref: WMM spec 2.2.2: WME Parameter Element, p.12.*/ | 544 | Ref: WMM spec 2.2.2: WME Parameter Element, p.12.*/ |
486 | union aci_aifsn { | 545 | union aci_aifsn { |
@@ -505,6 +564,17 @@ enum wireless_mode { | |||
505 | WIRELESS_MODE_N_5G = 0x20 | 564 | WIRELESS_MODE_N_5G = 0x20 |
506 | }; | 565 | }; |
507 | 566 | ||
567 | #define IS_WIRELESS_MODE_A(wirelessmode) \ | ||
568 | (wirelessmode == WIRELESS_MODE_A) | ||
569 | #define IS_WIRELESS_MODE_B(wirelessmode) \ | ||
570 | (wirelessmode == WIRELESS_MODE_B) | ||
571 | #define IS_WIRELESS_MODE_G(wirelessmode) \ | ||
572 | (wirelessmode == WIRELESS_MODE_G) | ||
573 | #define IS_WIRELESS_MODE_N_24G(wirelessmode) \ | ||
574 | (wirelessmode == WIRELESS_MODE_N_24G) | ||
575 | #define IS_WIRELESS_MODE_N_5G(wirelessmode) \ | ||
576 | (wirelessmode == WIRELESS_MODE_N_5G) | ||
577 | |||
508 | enum ratr_table_mode { | 578 | enum ratr_table_mode { |
509 | RATR_INX_WIRELESS_NGB = 0, | 579 | RATR_INX_WIRELESS_NGB = 0, |
510 | RATR_INX_WIRELESS_NG = 1, | 580 | RATR_INX_WIRELESS_NG = 1, |
@@ -574,11 +644,11 @@ struct rtl_probe_rsp { | |||
574 | struct rtl_led { | 644 | struct rtl_led { |
575 | void *hw; | 645 | void *hw; |
576 | enum rtl_led_pin ledpin; | 646 | enum rtl_led_pin ledpin; |
577 | bool b_ledon; | 647 | bool ledon; |
578 | }; | 648 | }; |
579 | 649 | ||
580 | struct rtl_led_ctl { | 650 | struct rtl_led_ctl { |
581 | bool bled_opendrain; | 651 | bool led_opendrain; |
582 | struct rtl_led sw_led0; | 652 | struct rtl_led sw_led0; |
583 | struct rtl_led sw_led1; | 653 | struct rtl_led sw_led1; |
584 | }; | 654 | }; |
@@ -603,6 +673,8 @@ struct false_alarm_statistics { | |||
603 | u32 cnt_rate_illegal; | 673 | u32 cnt_rate_illegal; |
604 | u32 cnt_crc8_fail; | 674 | u32 cnt_crc8_fail; |
605 | u32 cnt_mcs_fail; | 675 | u32 cnt_mcs_fail; |
676 | u32 cnt_fast_fsync_fail; | ||
677 | u32 cnt_sb_search_fail; | ||
606 | u32 cnt_ofdm_fail; | 678 | u32 cnt_ofdm_fail; |
607 | u32 cnt_cck_fail; | 679 | u32 cnt_cck_fail; |
608 | u32 cnt_all; | 680 | u32 cnt_all; |
@@ -690,6 +762,32 @@ struct rtl_rfkill { | |||
690 | bool rfkill_state; /*0 is off, 1 is on */ | 762 | bool rfkill_state; /*0 is off, 1 is on */ |
691 | }; | 763 | }; |
692 | 764 | ||
765 | #define IQK_MATRIX_REG_NUM 8 | ||
766 | #define IQK_MATRIX_SETTINGS_NUM (1 + 24 + 21) | ||
767 | struct iqk_matrix_regs { | ||
768 | bool b_iqk_done; | ||
769 | long value[1][IQK_MATRIX_REG_NUM]; | ||
770 | }; | ||
771 | |||
772 | struct phy_parameters { | ||
773 | u16 length; | ||
774 | u32 *pdata; | ||
775 | }; | ||
776 | |||
777 | enum hw_param_tab_index { | ||
778 | PHY_REG_2T, | ||
779 | PHY_REG_1T, | ||
780 | PHY_REG_PG, | ||
781 | RADIOA_2T, | ||
782 | RADIOB_2T, | ||
783 | RADIOA_1T, | ||
784 | RADIOB_1T, | ||
785 | MAC_REG, | ||
786 | AGCTAB_2T, | ||
787 | AGCTAB_1T, | ||
788 | MAX_TAB | ||
789 | }; | ||
790 | |||
693 | struct rtl_phy { | 791 | struct rtl_phy { |
694 | struct bb_reg_def phyreg_def[4]; /*Radio A/B/C/D */ | 792 | struct bb_reg_def phyreg_def[4]; /*Radio A/B/C/D */ |
695 | struct init_gain initgain_backup; | 793 | struct init_gain initgain_backup; |
@@ -705,8 +803,9 @@ struct rtl_phy { | |||
705 | u8 current_channel; | 803 | u8 current_channel; |
706 | u8 h2c_box_num; | 804 | u8 h2c_box_num; |
707 | u8 set_io_inprogress; | 805 | u8 set_io_inprogress; |
806 | u8 lck_inprogress; | ||
708 | 807 | ||
709 | /*record for power tracking*/ | 808 | /* record for power tracking */ |
710 | s32 reg_e94; | 809 | s32 reg_e94; |
711 | s32 reg_e9c; | 810 | s32 reg_e9c; |
712 | s32 reg_ea4; | 811 | s32 reg_ea4; |
@@ -723,26 +822,32 @@ struct rtl_phy { | |||
723 | u32 iqk_mac_backup[IQK_MAC_REG_NUM]; | 822 | u32 iqk_mac_backup[IQK_MAC_REG_NUM]; |
724 | u32 iqk_bb_backup[10]; | 823 | u32 iqk_bb_backup[10]; |
725 | 824 | ||
726 | bool b_rfpi_enable; | 825 | /* Dual mac */ |
826 | bool need_iqk; | ||
827 | struct iqk_matrix_regs iqk_matrix_regsetting[IQK_MATRIX_SETTINGS_NUM]; | ||
828 | |||
829 | bool rfpi_enable; | ||
727 | 830 | ||
728 | u8 pwrgroup_cnt; | 831 | u8 pwrgroup_cnt; |
729 | u8 bcck_high_power; | 832 | u8 cck_high_power; |
730 | /* 3 groups of pwr diff by rates*/ | 833 | /* MAX_PG_GROUP groups of pwr diff by rates */ |
731 | u32 mcs_txpwrlevel_origoffset[4][16]; | 834 | u32 mcs_txpwrlevel_origoffset[MAX_PG_GROUP][16]; |
732 | u8 default_initialgain[4]; | 835 | u8 default_initialgain[4]; |
733 | 836 | ||
734 | /*the current Tx power level*/ | 837 | /* the current Tx power level */ |
735 | u8 cur_cck_txpwridx; | 838 | u8 cur_cck_txpwridx; |
736 | u8 cur_ofdm24g_txpwridx; | 839 | u8 cur_ofdm24g_txpwridx; |
737 | 840 | ||
738 | u32 rfreg_chnlval[2]; | 841 | u32 rfreg_chnlval[2]; |
739 | bool b_apk_done; | 842 | bool apk_done; |
843 | u32 reg_rf3c[2]; /* pathA / pathB */ | ||
740 | 844 | ||
741 | /*fsync*/ | ||
742 | u8 framesync; | 845 | u8 framesync; |
743 | u32 framesync_c34; | 846 | u32 framesync_c34; |
744 | 847 | ||
745 | u8 num_total_rfpath; | 848 | u8 num_total_rfpath; |
849 | struct phy_parameters hwparam_tables[MAX_TAB]; | ||
850 | u16 rf_pathmap; | ||
746 | }; | 851 | }; |
747 | 852 | ||
748 | #define MAX_TID_COUNT 9 | 853 | #define MAX_TID_COUNT 9 |
@@ -768,6 +873,7 @@ struct rtl_tid_data { | |||
768 | struct rtl_priv; | 873 | struct rtl_priv; |
769 | struct rtl_io { | 874 | struct rtl_io { |
770 | struct device *dev; | 875 | struct device *dev; |
876 | struct mutex bb_mutex; | ||
771 | 877 | ||
772 | /*PCI MEM map */ | 878 | /*PCI MEM map */ |
773 | unsigned long pci_mem_end; /*shared mem end */ | 879 | unsigned long pci_mem_end; /*shared mem end */ |
@@ -779,11 +885,14 @@ struct rtl_io { | |||
779 | void (*write8_async) (struct rtl_priv *rtlpriv, u32 addr, u8 val); | 885 | void (*write8_async) (struct rtl_priv *rtlpriv, u32 addr, u8 val); |
780 | void (*write16_async) (struct rtl_priv *rtlpriv, u32 addr, u16 val); | 886 | void (*write16_async) (struct rtl_priv *rtlpriv, u32 addr, u16 val); |
781 | void (*write32_async) (struct rtl_priv *rtlpriv, u32 addr, u32 val); | 887 | void (*write32_async) (struct rtl_priv *rtlpriv, u32 addr, u32 val); |
782 | 888 | int (*writeN_async) (struct rtl_priv *rtlpriv, u32 addr, u16 len, | |
783 | u8(*read8_sync) (struct rtl_priv *rtlpriv, u32 addr); | 889 | u8 *pdata); |
784 | u16(*read16_sync) (struct rtl_priv *rtlpriv, u32 addr); | 890 | |
785 | u32(*read32_sync) (struct rtl_priv *rtlpriv, u32 addr); | 891 | u8(*read8_sync) (struct rtl_priv *rtlpriv, u32 addr); |
786 | 892 | u16(*read16_sync) (struct rtl_priv *rtlpriv, u32 addr); | |
893 | u32(*read32_sync) (struct rtl_priv *rtlpriv, u32 addr); | ||
894 | int (*readN_sync) (struct rtl_priv *rtlpriv, u32 addr, u16 len, | ||
895 | u8 *pdata); | ||
787 | }; | 896 | }; |
788 | 897 | ||
789 | struct rtl_mac { | 898 | struct rtl_mac { |
@@ -815,16 +924,24 @@ struct rtl_mac { | |||
815 | bool act_scanning; | 924 | bool act_scanning; |
816 | u8 cnt_after_linked; | 925 | u8 cnt_after_linked; |
817 | 926 | ||
818 | /*RDG*/ bool rdg_en; | 927 | /* early mode */ |
928 | /* skb wait queue */ | ||
929 | struct sk_buff_head skb_waitq[MAX_TID_COUNT]; | ||
930 | u8 earlymode_threshold; | ||
931 | |||
932 | /*RDG*/ | ||
933 | bool rdg_en; | ||
819 | 934 | ||
820 | /*AP*/ u8 bssid[6]; | 935 | /*AP*/ |
821 | u8 mcs[16]; /*16 bytes mcs for HT rates.*/ | 936 | u8 bssid[6]; |
822 | u32 basic_rates; /*b/g rates*/ | 937 | u32 vendor; |
938 | u8 mcs[16]; /* 16 bytes mcs for HT rates. */ | ||
939 | u32 basic_rates; /* b/g rates */ | ||
823 | u8 ht_enable; | 940 | u8 ht_enable; |
824 | u8 sgi_40; | 941 | u8 sgi_40; |
825 | u8 sgi_20; | 942 | u8 sgi_20; |
826 | u8 bw_40; | 943 | u8 bw_40; |
827 | u8 mode; /*wireless mode*/ | 944 | u8 mode; /* wireless mode */ |
828 | u8 slot_time; | 945 | u8 slot_time; |
829 | u8 short_preamble; | 946 | u8 short_preamble; |
830 | u8 use_cts_protect; | 947 | u8 use_cts_protect; |
@@ -835,9 +952,11 @@ struct rtl_mac { | |||
835 | u8 retry_long; | 952 | u8 retry_long; |
836 | u16 assoc_id; | 953 | u16 assoc_id; |
837 | 954 | ||
838 | /*IBSS*/ int beacon_interval; | 955 | /*IBSS*/ |
956 | int beacon_interval; | ||
839 | 957 | ||
840 | /*AMPDU*/ u8 min_space_cfg; /*For Min spacing configurations */ | 958 | /*AMPDU*/ |
959 | u8 min_space_cfg; /*For Min spacing configurations */ | ||
841 | u8 max_mss_density; | 960 | u8 max_mss_density; |
842 | u8 current_ampdu_factor; | 961 | u8 current_ampdu_factor; |
843 | u8 current_ampdu_density; | 962 | u8 current_ampdu_density; |
@@ -852,17 +971,54 @@ struct rtl_hal { | |||
852 | 971 | ||
853 | enum intf_type interface; | 972 | enum intf_type interface; |
854 | u16 hw_type; /*92c or 92d or 92s and so on */ | 973 | u16 hw_type; /*92c or 92d or 92s and so on */ |
974 | u8 ic_class; | ||
855 | u8 oem_id; | 975 | u8 oem_id; |
856 | u8 version; /*version of chip */ | 976 | u32 version; /*version of chip */ |
857 | u8 state; /*stop 0, start 1 */ | 977 | u8 state; /*stop 0, start 1 */ |
858 | 978 | ||
859 | /*firmware */ | 979 | /*firmware */ |
980 | u32 fwsize; | ||
860 | u8 *pfirmware; | 981 | u8 *pfirmware; |
861 | bool b_h2c_setinprogress; | 982 | u16 fw_version; |
983 | u16 fw_subversion; | ||
984 | bool h2c_setinprogress; | ||
862 | u8 last_hmeboxnum; | 985 | u8 last_hmeboxnum; |
863 | bool bfw_ready; | 986 | bool fw_ready; |
864 | /*Reserve page start offset except beacon in TxQ. */ | 987 | /*Reserve page start offset except beacon in TxQ. */ |
865 | u8 fw_rsvdpage_startoffset; | 988 | u8 fw_rsvdpage_startoffset; |
989 | u8 h2c_txcmd_seq; | ||
990 | |||
991 | /* FW Cmd IO related */ | ||
992 | u16 fwcmd_iomap; | ||
993 | u32 fwcmd_ioparam; | ||
994 | bool set_fwcmd_inprogress; | ||
995 | u8 current_fwcmd_io; | ||
996 | |||
997 | /**/ | ||
998 | bool driver_going2unload; | ||
999 | |||
1000 | /*AMPDU init min space*/ | ||
1001 | u8 minspace_cfg; /*For Min spacing configurations */ | ||
1002 | |||
1003 | /* Dual mac */ | ||
1004 | enum macphy_mode macphymode; | ||
1005 | enum band_type current_bandtype; /* 0:2.4G, 1:5G */ | ||
1006 | enum band_type current_bandtypebackup; | ||
1007 | enum band_type bandset; | ||
1008 | /* dual MAC 0--Mac0 1--Mac1 */ | ||
1009 | u32 interfaceindex; | ||
1010 | /* just for DualMac S3S4 */ | ||
1011 | u8 macphyctl_reg; | ||
1012 | bool earlymode_enable; | ||
1013 | /* Dual mac*/ | ||
1014 | bool during_mac0init_radiob; | ||
1015 | bool during_mac1init_radioa; | ||
1016 | bool reloadtxpowerindex; | ||
1017 | /* True if IMR or IQK have done | ||
1018 | for 2.4G in scan progress */ | ||
1019 | bool load_imrandiqk_setting_for2g; | ||
1020 | |||
1021 | bool disable_amsdu_8k; | ||
866 | }; | 1022 | }; |
867 | 1023 | ||
868 | struct rtl_security { | 1024 | struct rtl_security { |
@@ -887,48 +1043,61 @@ struct rtl_security { | |||
887 | }; | 1043 | }; |
888 | 1044 | ||
889 | struct rtl_dm { | 1045 | struct rtl_dm { |
890 | /*PHY status for DM */ | 1046 | /*PHY status for Dynamic Management */ |
891 | long entry_min_undecoratedsmoothed_pwdb; | 1047 | long entry_min_undecoratedsmoothed_pwdb; |
892 | long undecorated_smoothed_pwdb; /*out dm */ | 1048 | long undecorated_smoothed_pwdb; /*out dm */ |
893 | long entry_max_undecoratedsmoothed_pwdb; | 1049 | long entry_max_undecoratedsmoothed_pwdb; |
894 | bool b_dm_initialgain_enable; | 1050 | bool dm_initialgain_enable; |
895 | bool bdynamic_txpower_enable; | 1051 | bool dynamic_txpower_enable; |
896 | bool bcurrent_turbo_edca; | 1052 | bool current_turbo_edca; |
897 | bool bis_any_nonbepkts; /*out dm */ | 1053 | bool is_any_nonbepkts; /*out dm */ |
898 | bool bis_cur_rdlstate; | 1054 | bool is_cur_rdlstate; |
899 | bool btxpower_trackingInit; | 1055 | bool txpower_trackingInit; |
900 | bool b_disable_framebursting; | 1056 | bool disable_framebursting; |
901 | bool b_cck_inch14; | 1057 | bool cck_inch14; |
902 | bool btxpower_tracking; | 1058 | bool txpower_tracking; |
903 | bool b_useramask; | 1059 | bool useramask; |
904 | bool brfpath_rxenable[4]; | 1060 | bool rfpath_rxenable[4]; |
905 | 1061 | bool inform_fw_driverctrldm; | |
1062 | bool current_mrc_switch; | ||
1063 | u8 txpowercount; | ||
1064 | |||
1065 | u8 thermalvalue_rxgain; | ||
906 | u8 thermalvalue_iqk; | 1066 | u8 thermalvalue_iqk; |
907 | u8 thermalvalue_lck; | 1067 | u8 thermalvalue_lck; |
908 | u8 thermalvalue; | 1068 | u8 thermalvalue; |
909 | u8 last_dtp_lvl; | 1069 | u8 last_dtp_lvl; |
1070 | u8 thermalvalue_avg[AVG_THERMAL_NUM]; | ||
1071 | u8 thermalvalue_avg_index; | ||
1072 | bool done_txpower; | ||
910 | u8 dynamic_txhighpower_lvl; /*Tx high power level */ | 1073 | u8 dynamic_txhighpower_lvl; /*Tx high power level */ |
911 | u8 dm_flag; /*Indicate if each dynamic mechanism's status. */ | 1074 | u8 dm_flag; /*Indicate each dynamic mechanism's status. */ |
912 | u8 dm_type; | 1075 | u8 dm_type; |
913 | u8 txpower_track_control; | 1076 | u8 txpower_track_control; |
914 | 1077 | bool interrupt_migration; | |
1078 | bool disable_tx_int; | ||
915 | char ofdm_index[2]; | 1079 | char ofdm_index[2]; |
916 | char cck_index; | 1080 | char cck_index; |
1081 | u8 power_index_backup[6]; | ||
917 | }; | 1082 | }; |
918 | 1083 | ||
919 | #define EFUSE_MAX_LOGICAL_SIZE 128 | 1084 | #define EFUSE_MAX_LOGICAL_SIZE 256 |
920 | 1085 | ||
921 | struct rtl_efuse { | 1086 | struct rtl_efuse { |
922 | bool bautoLoad_ok; | 1087 | bool autoLoad_ok; |
923 | bool bootfromefuse; | 1088 | bool bootfromefuse; |
924 | u16 max_physical_size; | 1089 | u16 max_physical_size; |
925 | u8 contents[EFUSE_MAX_LOGICAL_SIZE]; | ||
926 | 1090 | ||
927 | u8 efuse_map[2][EFUSE_MAX_LOGICAL_SIZE]; | 1091 | u8 efuse_map[2][EFUSE_MAX_LOGICAL_SIZE]; |
928 | u16 efuse_usedbytes; | 1092 | u16 efuse_usedbytes; |
929 | u8 efuse_usedpercentage; | 1093 | u8 efuse_usedpercentage; |
1094 | #ifdef EFUSE_REPG_WORKAROUND | ||
1095 | bool efuse_re_pg_sec1flag; | ||
1096 | u8 efuse_re_pg_data[8]; | ||
1097 | #endif | ||
930 | 1098 | ||
931 | u8 autoload_failflag; | 1099 | u8 autoload_failflag; |
1100 | u8 autoload_status; | ||
932 | 1101 | ||
933 | short epromtype; | 1102 | short epromtype; |
934 | u16 eeprom_vid; | 1103 | u16 eeprom_vid; |
@@ -938,69 +1107,90 @@ struct rtl_efuse { | |||
938 | u8 eeprom_oemid; | 1107 | u8 eeprom_oemid; |
939 | u16 eeprom_channelplan; | 1108 | u16 eeprom_channelplan; |
940 | u8 eeprom_version; | 1109 | u8 eeprom_version; |
1110 | u8 board_type; | ||
1111 | u8 external_pa; | ||
941 | 1112 | ||
942 | u8 dev_addr[6]; | 1113 | u8 dev_addr[6]; |
943 | 1114 | ||
944 | bool b_txpwr_fromeprom; | 1115 | bool txpwr_fromeprom; |
1116 | u8 eeprom_crystalcap; | ||
945 | u8 eeprom_tssi[2]; | 1117 | u8 eeprom_tssi[2]; |
946 | u8 eeprom_pwrlimit_ht20[3]; | 1118 | u8 eeprom_tssi_5g[3][2]; /* for 5GL/5GM/5GH band. */ |
947 | u8 eeprom_pwrlimit_ht40[3]; | 1119 | u8 eeprom_pwrlimit_ht20[CHANNEL_GROUP_MAX]; |
948 | u8 eeprom_chnlarea_txpwr_cck[2][3]; | 1120 | u8 eeprom_pwrlimit_ht40[CHANNEL_GROUP_MAX]; |
949 | u8 eeprom_chnlarea_txpwr_ht40_1s[2][3]; | 1121 | u8 eeprom_chnlarea_txpwr_cck[2][CHANNEL_GROUP_MAX_2G]; |
950 | u8 eeprom_chnlarea_txpwr_ht40_2sdiif[2][3]; | 1122 | u8 eeprom_chnlarea_txpwr_ht40_1s[2][CHANNEL_GROUP_MAX]; |
951 | u8 txpwrlevel_cck[2][14]; | 1123 | u8 eeprom_chnlarea_txpwr_ht40_2sdiif[2][CHANNEL_GROUP_MAX]; |
952 | u8 txpwrlevel_ht40_1s[2][14]; /*For HT 40MHZ pwr */ | 1124 | u8 txpwrlevel_cck[2][CHANNEL_MAX_NUMBER_2G]; |
953 | u8 txpwrlevel_ht40_2s[2][14]; /*For HT 40MHZ pwr */ | 1125 | u8 txpwrlevel_ht40_1s[2][CHANNEL_MAX_NUMBER]; /*For HT 40MHZ pwr */ |
1126 | u8 txpwrlevel_ht40_2s[2][CHANNEL_MAX_NUMBER]; /*For HT 40MHZ pwr */ | ||
1127 | |||
1128 | u8 internal_pa_5g[2]; /* pathA / pathB */ | ||
1129 | u8 eeprom_c9; | ||
1130 | u8 eeprom_cc; | ||
954 | 1131 | ||
955 | /*For power group */ | 1132 | /*For power group */ |
956 | u8 pwrgroup_ht20[2][14]; | 1133 | u8 eeprom_pwrgroup[2][3]; |
957 | u8 pwrgroup_ht40[2][14]; | 1134 | u8 pwrgroup_ht20[2][CHANNEL_MAX_NUMBER]; |
958 | 1135 | u8 pwrgroup_ht40[2][CHANNEL_MAX_NUMBER]; | |
959 | char txpwr_ht20diff[2][14]; /*HT 20<->40 Pwr diff */ | 1136 | |
960 | u8 txpwr_legacyhtdiff[2][14]; /*For HT<->legacy pwr diff */ | 1137 | char txpwr_ht20diff[2][CHANNEL_MAX_NUMBER]; /*HT 20<->40 Pwr diff */ |
1138 | /*For HT<->legacy pwr diff*/ | ||
1139 | u8 txpwr_legacyhtdiff[2][CHANNEL_MAX_NUMBER]; | ||
1140 | u8 txpwr_safetyflag; /* Band edge enable flag */ | ||
1141 | u16 eeprom_txpowerdiff; | ||
1142 | u8 legacy_httxpowerdiff; /* Legacy to HT rate power diff */ | ||
1143 | u8 antenna_txpwdiff[3]; | ||
961 | 1144 | ||
962 | u8 eeprom_regulatory; | 1145 | u8 eeprom_regulatory; |
963 | u8 eeprom_thermalmeter; | 1146 | u8 eeprom_thermalmeter; |
964 | /*ThermalMeter, index 0 for RFIC0, and 1 for RFIC1 */ | 1147 | u8 thermalmeter[2]; /*ThermalMeter, index 0 for RFIC0, 1 for RFIC1 */ |
965 | u8 thermalmeter[2]; | 1148 | u16 tssi_13dbm; |
1149 | u8 crystalcap; /* CrystalCap. */ | ||
1150 | u8 delta_iqk; | ||
1151 | u8 delta_lck; | ||
966 | 1152 | ||
967 | u8 legacy_ht_txpowerdiff; /*Legacy to HT rate power diff */ | 1153 | u8 legacy_ht_txpowerdiff; /*Legacy to HT rate power diff */ |
968 | bool b_apk_thermalmeterignore; | 1154 | bool apk_thermalmeterignore; |
1155 | |||
1156 | bool b1x1_recvcombine; | ||
1157 | bool b1ss_support; | ||
1158 | |||
1159 | /*channel plan */ | ||
1160 | u8 channel_plan; | ||
969 | }; | 1161 | }; |
970 | 1162 | ||
971 | struct rtl_ps_ctl { | 1163 | struct rtl_ps_ctl { |
1164 | bool pwrdomain_protect; | ||
972 | bool set_rfpowerstate_inprogress; | 1165 | bool set_rfpowerstate_inprogress; |
973 | bool b_in_powersavemode; | 1166 | bool in_powersavemode; |
974 | bool rfchange_inprogress; | 1167 | bool rfchange_inprogress; |
975 | bool b_swrf_processing; | 1168 | bool swrf_processing; |
976 | bool b_hwradiooff; | 1169 | bool hwradiooff; |
977 | |||
978 | u32 last_sleep_jiffies; | ||
979 | u32 last_awake_jiffies; | ||
980 | u32 last_delaylps_stamp_jiffies; | ||
981 | 1170 | ||
982 | /* | 1171 | /* |
983 | * just for PCIE ASPM | 1172 | * just for PCIE ASPM |
984 | * If it supports ASPM, Offset[560h] = 0x40, | 1173 | * If it supports ASPM, Offset[560h] = 0x40, |
985 | * otherwise Offset[560h] = 0x00. | 1174 | * otherwise Offset[560h] = 0x00. |
986 | * */ | 1175 | * */ |
987 | bool b_support_aspm; | 1176 | bool support_aspm; |
988 | bool b_support_backdoor; | 1177 | bool support_backdoor; |
989 | 1178 | ||
990 | /*for LPS */ | 1179 | /*for LPS */ |
991 | enum rt_psmode dot11_psmode; /*Power save mode configured. */ | 1180 | enum rt_psmode dot11_psmode; /*Power save mode configured. */ |
992 | bool b_leisure_ps; | 1181 | bool swctrl_lps; |
993 | bool b_fwctrl_lps; | 1182 | bool leisure_ps; |
1183 | bool fwctrl_lps; | ||
994 | u8 fwctrl_psmode; | 1184 | u8 fwctrl_psmode; |
995 | /*For Fw control LPS mode */ | 1185 | /*For Fw control LPS mode */ |
996 | u8 b_reg_fwctrl_lps; | 1186 | u8 reg_fwctrl_lps; |
997 | /*Record Fw PS mode status. */ | 1187 | /*Record Fw PS mode status. */ |
998 | bool b_fw_current_inpsmode; | 1188 | bool fw_current_inpsmode; |
999 | u8 reg_max_lps_awakeintvl; | 1189 | u8 reg_max_lps_awakeintvl; |
1000 | bool report_linked; | 1190 | bool report_linked; |
1001 | 1191 | ||
1002 | /*for IPS */ | 1192 | /*for IPS */ |
1003 | bool b_inactiveps; | 1193 | bool inactiveps; |
1004 | 1194 | ||
1005 | u32 rfoff_reason; | 1195 | u32 rfoff_reason; |
1006 | 1196 | ||
@@ -1011,8 +1201,26 @@ struct rtl_ps_ctl { | |||
1011 | /*just for PCIE ASPM */ | 1201 | /*just for PCIE ASPM */ |
1012 | u8 const_amdpci_aspm; | 1202 | u8 const_amdpci_aspm; |
1013 | 1203 | ||
1204 | bool pwrdown_mode; | ||
1205 | |||
1014 | enum rf_pwrstate inactive_pwrstate; | 1206 | enum rf_pwrstate inactive_pwrstate; |
1015 | enum rf_pwrstate rfpwr_state; /*cur power state */ | 1207 | enum rf_pwrstate rfpwr_state; /*cur power state */ |
1208 | |||
1209 | /* for SW LPS*/ | ||
1210 | bool sw_ps_enabled; | ||
1211 | bool state; | ||
1212 | bool state_inap; | ||
1213 | bool multi_buffered; | ||
1214 | u16 nullfunc_seq; | ||
1215 | unsigned int dtim_counter; | ||
1216 | unsigned int sleep_ms; | ||
1217 | unsigned long last_sleep_jiffies; | ||
1218 | unsigned long last_awake_jiffies; | ||
1219 | unsigned long last_delaylps_stamp_jiffies; | ||
1220 | unsigned long last_dtim; | ||
1221 | unsigned long last_beacon; | ||
1222 | unsigned long last_action; | ||
1223 | unsigned long last_slept; | ||
1016 | }; | 1224 | }; |
1017 | 1225 | ||
1018 | struct rtl_stats { | 1226 | struct rtl_stats { |
@@ -1038,10 +1246,10 @@ struct rtl_stats { | |||
1038 | s32 recvsignalpower; | 1246 | s32 recvsignalpower; |
1039 | s8 rxpower; /*in dBm Translate from PWdB */ | 1247 | s8 rxpower; /*in dBm Translate from PWdB */ |
1040 | u8 signalstrength; /*in 0-100 index. */ | 1248 | u8 signalstrength; /*in 0-100 index. */ |
1041 | u16 b_hwerror:1; | 1249 | u16 hwerror:1; |
1042 | u16 b_crc:1; | 1250 | u16 crc:1; |
1043 | u16 b_icv:1; | 1251 | u16 icv:1; |
1044 | u16 b_shortpreamble:1; | 1252 | u16 shortpreamble:1; |
1045 | u16 antenna:1; | 1253 | u16 antenna:1; |
1046 | u16 decrypted:1; | 1254 | u16 decrypted:1; |
1047 | u16 wakeup:1; | 1255 | u16 wakeup:1; |
@@ -1050,15 +1258,16 @@ struct rtl_stats { | |||
1050 | 1258 | ||
1051 | u8 rx_drvinfo_size; | 1259 | u8 rx_drvinfo_size; |
1052 | u8 rx_bufshift; | 1260 | u8 rx_bufshift; |
1053 | bool b_isampdu; | 1261 | bool isampdu; |
1262 | bool isfirst_ampdu; | ||
1054 | bool rx_is40Mhzpacket; | 1263 | bool rx_is40Mhzpacket; |
1055 | u32 rx_pwdb_all; | 1264 | u32 rx_pwdb_all; |
1056 | u8 rx_mimo_signalstrength[4]; /*in 0~100 index */ | 1265 | u8 rx_mimo_signalstrength[4]; /*in 0~100 index */ |
1057 | s8 rx_mimo_signalquality[2]; | 1266 | s8 rx_mimo_signalquality[2]; |
1058 | bool b_packet_matchbssid; | 1267 | bool packet_matchbssid; |
1059 | bool b_is_cck; | 1268 | bool is_cck; |
1060 | bool b_packet_toself; | 1269 | bool packet_toself; |
1061 | bool b_packet_beacon; /*for rssi */ | 1270 | bool packet_beacon; /*for rssi */ |
1062 | char cck_adc_pwdb[4]; /*for rx path selection */ | 1271 | char cck_adc_pwdb[4]; /*for rx path selection */ |
1063 | }; | 1272 | }; |
1064 | 1273 | ||
@@ -1069,23 +1278,23 @@ struct rt_link_detect { | |||
1069 | u32 num_tx_inperiod; | 1278 | u32 num_tx_inperiod; |
1070 | u32 num_rx_inperiod; | 1279 | u32 num_rx_inperiod; |
1071 | 1280 | ||
1072 | bool b_busytraffic; | 1281 | bool busytraffic; |
1073 | bool b_higher_busytraffic; | 1282 | bool higher_busytraffic; |
1074 | bool b_higher_busyrxtraffic; | 1283 | bool higher_busyrxtraffic; |
1075 | }; | 1284 | }; |
1076 | 1285 | ||
1077 | struct rtl_tcb_desc { | 1286 | struct rtl_tcb_desc { |
1078 | u8 b_packet_bw:1; | 1287 | u8 packet_bw:1; |
1079 | u8 b_multicast:1; | 1288 | u8 multicast:1; |
1080 | u8 b_broadcast:1; | 1289 | u8 broadcast:1; |
1081 | 1290 | ||
1082 | u8 b_rts_stbc:1; | 1291 | u8 rts_stbc:1; |
1083 | u8 b_rts_enable:1; | 1292 | u8 rts_enable:1; |
1084 | u8 b_cts_enable:1; | 1293 | u8 cts_enable:1; |
1085 | u8 b_rts_use_shortpreamble:1; | 1294 | u8 rts_use_shortpreamble:1; |
1086 | u8 b_rts_use_shortgi:1; | 1295 | u8 rts_use_shortgi:1; |
1087 | u8 rts_sc:1; | 1296 | u8 rts_sc:1; |
1088 | u8 b_rts_bw:1; | 1297 | u8 rts_bw:1; |
1089 | u8 rts_rate; | 1298 | u8 rts_rate; |
1090 | 1299 | ||
1091 | u8 use_shortgi:1; | 1300 | u8 use_shortgi:1; |
@@ -1096,20 +1305,34 @@ struct rtl_tcb_desc { | |||
1096 | u8 ratr_index; | 1305 | u8 ratr_index; |
1097 | u8 mac_id; | 1306 | u8 mac_id; |
1098 | u8 hw_rate; | 1307 | u8 hw_rate; |
1308 | |||
1309 | u8 last_inipkt:1; | ||
1310 | u8 cmd_or_init:1; | ||
1311 | u8 queue_index; | ||
1312 | |||
1313 | /* early mode */ | ||
1314 | u8 empkt_num; | ||
1315 | /* The max value by HW */ | ||
1316 | u32 empkt_len[5]; | ||
1099 | }; | 1317 | }; |
1100 | 1318 | ||
1101 | struct rtl_hal_ops { | 1319 | struct rtl_hal_ops { |
1102 | int (*init_sw_vars) (struct ieee80211_hw *hw); | 1320 | int (*init_sw_vars) (struct ieee80211_hw *hw); |
1103 | void (*deinit_sw_vars) (struct ieee80211_hw *hw); | 1321 | void (*deinit_sw_vars) (struct ieee80211_hw *hw); |
1322 | void (*read_chip_version)(struct ieee80211_hw *hw); | ||
1104 | void (*read_eeprom_info) (struct ieee80211_hw *hw); | 1323 | void (*read_eeprom_info) (struct ieee80211_hw *hw); |
1105 | void (*interrupt_recognized) (struct ieee80211_hw *hw, | 1324 | void (*interrupt_recognized) (struct ieee80211_hw *hw, |
1106 | u32 *p_inta, u32 *p_intb); | 1325 | u32 *p_inta, u32 *p_intb); |
1107 | int (*hw_init) (struct ieee80211_hw *hw); | 1326 | int (*hw_init) (struct ieee80211_hw *hw); |
1108 | void (*hw_disable) (struct ieee80211_hw *hw); | 1327 | void (*hw_disable) (struct ieee80211_hw *hw); |
1328 | void (*hw_suspend) (struct ieee80211_hw *hw); | ||
1329 | void (*hw_resume) (struct ieee80211_hw *hw); | ||
1109 | void (*enable_interrupt) (struct ieee80211_hw *hw); | 1330 | void (*enable_interrupt) (struct ieee80211_hw *hw); |
1110 | void (*disable_interrupt) (struct ieee80211_hw *hw); | 1331 | void (*disable_interrupt) (struct ieee80211_hw *hw); |
1111 | int (*set_network_type) (struct ieee80211_hw *hw, | 1332 | int (*set_network_type) (struct ieee80211_hw *hw, |
1112 | enum nl80211_iftype type); | 1333 | enum nl80211_iftype type); |
1334 | void (*set_chk_bssid)(struct ieee80211_hw *hw, | ||
1335 | bool check_bssid); | ||
1113 | void (*set_bw_mode) (struct ieee80211_hw *hw, | 1336 | void (*set_bw_mode) (struct ieee80211_hw *hw, |
1114 | enum nl80211_channel_type ch_type); | 1337 | enum nl80211_channel_type ch_type); |
1115 | u8(*switch_channel) (struct ieee80211_hw *hw); | 1338 | u8(*switch_channel) (struct ieee80211_hw *hw); |
@@ -1126,23 +1349,26 @@ struct rtl_hal_ops { | |||
1126 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, | 1349 | struct ieee80211_hdr *hdr, u8 *pdesc_tx, |
1127 | struct ieee80211_tx_info *info, | 1350 | struct ieee80211_tx_info *info, |
1128 | struct sk_buff *skb, unsigned int queue_index); | 1351 | struct sk_buff *skb, unsigned int queue_index); |
1352 | void (*fill_fake_txdesc) (struct ieee80211_hw *hw, u8 * pDesc, | ||
1353 | u32 buffer_len, bool bIsPsPoll); | ||
1129 | void (*fill_tx_cmddesc) (struct ieee80211_hw *hw, u8 *pdesc, | 1354 | void (*fill_tx_cmddesc) (struct ieee80211_hw *hw, u8 *pdesc, |
1130 | bool b_firstseg, bool b_lastseg, | 1355 | bool firstseg, bool lastseg, |
1131 | struct sk_buff *skb); | 1356 | struct sk_buff *skb); |
1132 | bool(*query_rx_desc) (struct ieee80211_hw *hw, | 1357 | bool (*cmd_send_packet)(struct ieee80211_hw *hw, struct sk_buff *skb); |
1358 | bool (*query_rx_desc) (struct ieee80211_hw *hw, | ||
1133 | struct rtl_stats *stats, | 1359 | struct rtl_stats *stats, |
1134 | struct ieee80211_rx_status *rx_status, | 1360 | struct ieee80211_rx_status *rx_status, |
1135 | u8 *pdesc, struct sk_buff *skb); | 1361 | u8 *pdesc, struct sk_buff *skb); |
1136 | void (*set_channel_access) (struct ieee80211_hw *hw); | 1362 | void (*set_channel_access) (struct ieee80211_hw *hw); |
1137 | bool(*radio_onoff_checking) (struct ieee80211_hw *hw, u8 *valid); | 1363 | bool (*radio_onoff_checking) (struct ieee80211_hw *hw, u8 *valid); |
1138 | void (*dm_watchdog) (struct ieee80211_hw *hw); | 1364 | void (*dm_watchdog) (struct ieee80211_hw *hw); |
1139 | void (*scan_operation_backup) (struct ieee80211_hw *hw, u8 operation); | 1365 | void (*scan_operation_backup) (struct ieee80211_hw *hw, u8 operation); |
1140 | bool(*set_rf_power_state) (struct ieee80211_hw *hw, | 1366 | bool (*set_rf_power_state) (struct ieee80211_hw *hw, |
1141 | enum rf_pwrstate rfpwr_state); | 1367 | enum rf_pwrstate rfpwr_state); |
1142 | void (*led_control) (struct ieee80211_hw *hw, | 1368 | void (*led_control) (struct ieee80211_hw *hw, |
1143 | enum led_ctl_mode ledaction); | 1369 | enum led_ctl_mode ledaction); |
1144 | void (*set_desc) (u8 *pdesc, bool istx, u8 desc_name, u8 *val); | 1370 | void (*set_desc) (u8 *pdesc, bool istx, u8 desc_name, u8 *val); |
1145 | u32(*get_desc) (u8 *pdesc, bool istx, u8 desc_name); | 1371 | u32 (*get_desc) (u8 *pdesc, bool istx, u8 desc_name); |
1146 | void (*tx_polling) (struct ieee80211_hw *hw, unsigned int hw_queue); | 1372 | void (*tx_polling) (struct ieee80211_hw *hw, unsigned int hw_queue); |
1147 | void (*enable_hw_sec) (struct ieee80211_hw *hw); | 1373 | void (*enable_hw_sec) (struct ieee80211_hw *hw); |
1148 | void (*set_key) (struct ieee80211_hw *hw, u32 key_index, | 1374 | void (*set_key) (struct ieee80211_hw *hw, u32 key_index, |
@@ -1150,10 +1376,10 @@ struct rtl_hal_ops { | |||
1150 | bool is_wepkey, bool clear_all); | 1376 | bool is_wepkey, bool clear_all); |
1151 | void (*init_sw_leds) (struct ieee80211_hw *hw); | 1377 | void (*init_sw_leds) (struct ieee80211_hw *hw); |
1152 | void (*deinit_sw_leds) (struct ieee80211_hw *hw); | 1378 | void (*deinit_sw_leds) (struct ieee80211_hw *hw); |
1153 | u32(*get_bbreg) (struct ieee80211_hw *hw, u32 regaddr, u32 bitmask); | 1379 | u32 (*get_bbreg) (struct ieee80211_hw *hw, u32 regaddr, u32 bitmask); |
1154 | void (*set_bbreg) (struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, | 1380 | void (*set_bbreg) (struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, |
1155 | u32 data); | 1381 | u32 data); |
1156 | u32(*get_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, | 1382 | u32 (*get_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, |
1157 | u32 regaddr, u32 bitmask); | 1383 | u32 regaddr, u32 bitmask); |
1158 | void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, | 1384 | void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, |
1159 | u32 regaddr, u32 bitmask, u32 data); | 1385 | u32 regaddr, u32 bitmask, u32 data); |
@@ -1161,11 +1387,13 @@ struct rtl_hal_ops { | |||
1161 | 1387 | ||
1162 | struct rtl_intf_ops { | 1388 | struct rtl_intf_ops { |
1163 | /*com */ | 1389 | /*com */ |
1390 | void (*read_efuse_byte)(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf); | ||
1164 | int (*adapter_start) (struct ieee80211_hw *hw); | 1391 | int (*adapter_start) (struct ieee80211_hw *hw); |
1165 | void (*adapter_stop) (struct ieee80211_hw *hw); | 1392 | void (*adapter_stop) (struct ieee80211_hw *hw); |
1166 | 1393 | ||
1167 | int (*adapter_tx) (struct ieee80211_hw *hw, struct sk_buff *skb); | 1394 | int (*adapter_tx) (struct ieee80211_hw *hw, struct sk_buff *skb); |
1168 | int (*reset_trx_ring) (struct ieee80211_hw *hw); | 1395 | int (*reset_trx_ring) (struct ieee80211_hw *hw); |
1396 | bool (*waitq_insert) (struct ieee80211_hw *hw, struct sk_buff *skb); | ||
1169 | 1397 | ||
1170 | /*pci */ | 1398 | /*pci */ |
1171 | void (*disable_aspm) (struct ieee80211_hw *hw); | 1399 | void (*disable_aspm) (struct ieee80211_hw *hw); |
@@ -1179,11 +1407,36 @@ struct rtl_mod_params { | |||
1179 | int sw_crypto; | 1407 | int sw_crypto; |
1180 | }; | 1408 | }; |
1181 | 1409 | ||
1410 | struct rtl_hal_usbint_cfg { | ||
1411 | /* data - rx */ | ||
1412 | u32 in_ep_num; | ||
1413 | u32 rx_urb_num; | ||
1414 | u32 rx_max_size; | ||
1415 | |||
1416 | /* op - rx */ | ||
1417 | void (*usb_rx_hdl)(struct ieee80211_hw *, struct sk_buff *); | ||
1418 | void (*usb_rx_segregate_hdl)(struct ieee80211_hw *, struct sk_buff *, | ||
1419 | struct sk_buff_head *); | ||
1420 | |||
1421 | /* tx */ | ||
1422 | void (*usb_tx_cleanup)(struct ieee80211_hw *, struct sk_buff *); | ||
1423 | int (*usb_tx_post_hdl)(struct ieee80211_hw *, struct urb *, | ||
1424 | struct sk_buff *); | ||
1425 | struct sk_buff *(*usb_tx_aggregate_hdl)(struct ieee80211_hw *, | ||
1426 | struct sk_buff_head *); | ||
1427 | |||
1428 | /* endpoint mapping */ | ||
1429 | int (*usb_endpoint_mapping)(struct ieee80211_hw *hw); | ||
1430 | u16 (*usb_mq_to_hwq)(__le16 fc, u16 mac80211_queue_index); | ||
1431 | }; | ||
1432 | |||
1182 | struct rtl_hal_cfg { | 1433 | struct rtl_hal_cfg { |
1434 | u8 bar_id; | ||
1183 | char *name; | 1435 | char *name; |
1184 | char *fw_name; | 1436 | char *fw_name; |
1185 | struct rtl_hal_ops *ops; | 1437 | struct rtl_hal_ops *ops; |
1186 | struct rtl_mod_params *mod_params; | 1438 | struct rtl_mod_params *mod_params; |
1439 | struct rtl_hal_usbint_cfg *usb_interface_cfg; | ||
1187 | 1440 | ||
1188 | /*this map used for some registers or vars | 1441 | /*this map used for some registers or vars |
1189 | defined int HAL but used in MAIN */ | 1442 | defined int HAL but used in MAIN */ |
@@ -1202,6 +1455,11 @@ struct rtl_locks { | |||
1202 | spinlock_t rf_ps_lock; | 1455 | spinlock_t rf_ps_lock; |
1203 | spinlock_t rf_lock; | 1456 | spinlock_t rf_lock; |
1204 | spinlock_t lps_lock; | 1457 | spinlock_t lps_lock; |
1458 | spinlock_t waitq_lock; | ||
1459 | spinlock_t tx_urb_lock; | ||
1460 | |||
1461 | /*Dual mac*/ | ||
1462 | spinlock_t cck_and_rw_pagea_lock; | ||
1205 | }; | 1463 | }; |
1206 | 1464 | ||
1207 | struct rtl_works { | 1465 | struct rtl_works { |
@@ -1218,12 +1476,20 @@ struct rtl_works { | |||
1218 | struct workqueue_struct *rtl_wq; | 1476 | struct workqueue_struct *rtl_wq; |
1219 | struct delayed_work watchdog_wq; | 1477 | struct delayed_work watchdog_wq; |
1220 | struct delayed_work ips_nic_off_wq; | 1478 | struct delayed_work ips_nic_off_wq; |
1479 | |||
1480 | /* For SW LPS */ | ||
1481 | struct delayed_work ps_work; | ||
1482 | struct delayed_work ps_rfon_wq; | ||
1221 | }; | 1483 | }; |
1222 | 1484 | ||
1223 | struct rtl_debug { | 1485 | struct rtl_debug { |
1224 | u32 dbgp_type[DBGP_TYPE_MAX]; | 1486 | u32 dbgp_type[DBGP_TYPE_MAX]; |
1225 | u32 global_debuglevel; | 1487 | u32 global_debuglevel; |
1226 | u64 global_debugcomponents; | 1488 | u64 global_debugcomponents; |
1489 | |||
1490 | /* add for proc debug */ | ||
1491 | struct proc_dir_entry *proc_dir; | ||
1492 | char proc_name[20]; | ||
1227 | }; | 1493 | }; |
1228 | 1494 | ||
1229 | struct rtl_priv { | 1495 | struct rtl_priv { |
@@ -1274,6 +1540,91 @@ struct rtl_priv { | |||
1274 | #define rtl_efuse(rtlpriv) (&((rtlpriv)->efuse)) | 1540 | #define rtl_efuse(rtlpriv) (&((rtlpriv)->efuse)) |
1275 | #define rtl_psc(rtlpriv) (&((rtlpriv)->psc)) | 1541 | #define rtl_psc(rtlpriv) (&((rtlpriv)->psc)) |
1276 | 1542 | ||
1543 | |||
1544 | /*************************************** | ||
1545 | Bluetooth Co-existance Related | ||
1546 | ****************************************/ | ||
1547 | |||
1548 | enum bt_ant_num { | ||
1549 | ANT_X2 = 0, | ||
1550 | ANT_X1 = 1, | ||
1551 | }; | ||
1552 | |||
1553 | enum bt_co_type { | ||
1554 | BT_2WIRE = 0, | ||
1555 | BT_ISSC_3WIRE = 1, | ||
1556 | BT_ACCEL = 2, | ||
1557 | BT_CSR_BC4 = 3, | ||
1558 | BT_CSR_BC8 = 4, | ||
1559 | BT_RTL8756 = 5, | ||
1560 | }; | ||
1561 | |||
1562 | enum bt_cur_state { | ||
1563 | BT_OFF = 0, | ||
1564 | BT_ON = 1, | ||
1565 | }; | ||
1566 | |||
1567 | enum bt_service_type { | ||
1568 | BT_SCO = 0, | ||
1569 | BT_A2DP = 1, | ||
1570 | BT_HID = 2, | ||
1571 | BT_HID_IDLE = 3, | ||
1572 | BT_SCAN = 4, | ||
1573 | BT_IDLE = 5, | ||
1574 | BT_OTHER_ACTION = 6, | ||
1575 | BT_BUSY = 7, | ||
1576 | BT_OTHERBUSY = 8, | ||
1577 | BT_PAN = 9, | ||
1578 | }; | ||
1579 | |||
1580 | enum bt_radio_shared { | ||
1581 | BT_RADIO_SHARED = 0, | ||
1582 | BT_RADIO_INDIVIDUAL = 1, | ||
1583 | }; | ||
1584 | |||
1585 | struct bt_coexist_info { | ||
1586 | |||
1587 | /* EEPROM BT info. */ | ||
1588 | u8 eeprom_bt_coexist; | ||
1589 | u8 eeprom_bt_type; | ||
1590 | u8 eeprom_bt_ant_num; | ||
1591 | u8 eeprom_bt_ant_isolation; | ||
1592 | u8 eeprom_bt_radio_shared; | ||
1593 | |||
1594 | u8 bt_coexistence; | ||
1595 | u8 bt_ant_num; | ||
1596 | u8 bt_coexist_type; | ||
1597 | u8 bt_state; | ||
1598 | u8 bt_cur_state; /* 0:on, 1:off */ | ||
1599 | u8 bt_ant_isolation; /* 0:good, 1:bad */ | ||
1600 | u8 bt_pape_ctrl; /* 0:SW, 1:SW/HW dynamic */ | ||
1601 | u8 bt_service; | ||
1602 | u8 bt_radio_shared_type; | ||
1603 | u8 bt_rfreg_origin_1e; | ||
1604 | u8 bt_rfreg_origin_1f; | ||
1605 | u8 bt_rssi_state; | ||
1606 | u32 ratio_tx; | ||
1607 | u32 ratio_pri; | ||
1608 | u32 bt_edca_ul; | ||
1609 | u32 bt_edca_dl; | ||
1610 | |||
1611 | bool b_init_set; | ||
1612 | bool b_bt_busy_traffic; | ||
1613 | bool b_bt_traffic_mode_set; | ||
1614 | bool b_bt_non_traffic_mode_set; | ||
1615 | |||
1616 | bool b_fw_coexist_all_off; | ||
1617 | bool b_sw_coexist_all_off; | ||
1618 | u32 current_state; | ||
1619 | u32 previous_state; | ||
1620 | u8 bt_pre_rssi_state; | ||
1621 | |||
1622 | u8 b_reg_bt_iso; | ||
1623 | u8 b_reg_bt_sco; | ||
1624 | |||
1625 | }; | ||
1626 | |||
1627 | |||
1277 | /**************************************** | 1628 | /**************************************** |
1278 | mem access macro define start | 1629 | mem access macro define start |
1279 | Call endian free function when | 1630 | Call endian free function when |
@@ -1281,7 +1632,7 @@ struct rtl_priv { | |||
1281 | 2. Before write integer to IO. | 1632 | 2. Before write integer to IO. |
1282 | 3. After read integer from IO. | 1633 | 3. After read integer from IO. |
1283 | ****************************************/ | 1634 | ****************************************/ |
1284 | /* Convert little data endian to host */ | 1635 | /* Convert little data endian to host ordering */ |
1285 | #define EF1BYTE(_val) \ | 1636 | #define EF1BYTE(_val) \ |
1286 | ((u8)(_val)) | 1637 | ((u8)(_val)) |
1287 | #define EF2BYTE(_val) \ | 1638 | #define EF2BYTE(_val) \ |
@@ -1289,27 +1640,21 @@ struct rtl_priv { | |||
1289 | #define EF4BYTE(_val) \ | 1640 | #define EF4BYTE(_val) \ |
1290 | (le32_to_cpu(_val)) | 1641 | (le32_to_cpu(_val)) |
1291 | 1642 | ||
1292 | /* Read data from memory */ | 1643 | /* Read le16 data from memory and convert to host ordering */ |
1293 | #define READEF1BYTE(_ptr) \ | ||
1294 | EF1BYTE(*((u8 *)(_ptr))) | ||
1295 | #define READEF2BYTE(_ptr) \ | 1644 | #define READEF2BYTE(_ptr) \ |
1296 | EF2BYTE(*((u16 *)(_ptr))) | 1645 | EF2BYTE(*((u16 *)(_ptr))) |
1297 | #define READEF4BYTE(_ptr) \ | ||
1298 | EF4BYTE(*((u32 *)(_ptr))) | ||
1299 | 1646 | ||
1300 | /* Write data to memory */ | 1647 | /* Write le16 data to memory in host ordering */ |
1301 | #define WRITEEF1BYTE(_ptr, _val) \ | ||
1302 | (*((u8 *)(_ptr))) = EF1BYTE(_val) | ||
1303 | #define WRITEEF2BYTE(_ptr, _val) \ | 1648 | #define WRITEEF2BYTE(_ptr, _val) \ |
1304 | (*((u16 *)(_ptr))) = EF2BYTE(_val) | 1649 | (*((u16 *)(_ptr))) = EF2BYTE(_val) |
1305 | #define WRITEEF4BYTE(_ptr, _val) \ | 1650 | |
1306 | (*((u32 *)(_ptr))) = EF4BYTE(_val) | 1651 | /* Create a bit mask |
1307 | 1652 | * Examples: | |
1308 | /*Example: | 1653 | * BIT_LEN_MASK_32(0) => 0x00000000 |
1309 | BIT_LEN_MASK_32(0) => 0x00000000 | 1654 | * BIT_LEN_MASK_32(1) => 0x00000001 |
1310 | BIT_LEN_MASK_32(1) => 0x00000001 | 1655 | * BIT_LEN_MASK_32(2) => 0x00000003 |
1311 | BIT_LEN_MASK_32(2) => 0x00000003 | 1656 | * BIT_LEN_MASK_32(32) => 0xFFFFFFFF |
1312 | BIT_LEN_MASK_32(32) => 0xFFFFFFFF*/ | 1657 | */ |
1313 | #define BIT_LEN_MASK_32(__bitlen) \ | 1658 | #define BIT_LEN_MASK_32(__bitlen) \ |
1314 | (0xFFFFFFFF >> (32 - (__bitlen))) | 1659 | (0xFFFFFFFF >> (32 - (__bitlen))) |
1315 | #define BIT_LEN_MASK_16(__bitlen) \ | 1660 | #define BIT_LEN_MASK_16(__bitlen) \ |
@@ -1317,9 +1662,11 @@ BIT_LEN_MASK_32(32) => 0xFFFFFFFF*/ | |||
1317 | #define BIT_LEN_MASK_8(__bitlen) \ | 1662 | #define BIT_LEN_MASK_8(__bitlen) \ |
1318 | (0xFF >> (8 - (__bitlen))) | 1663 | (0xFF >> (8 - (__bitlen))) |
1319 | 1664 | ||
1320 | /*Example: | 1665 | /* Create an offset bit mask |
1321 | BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003 | 1666 | * Examples: |
1322 | BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000*/ | 1667 | * BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003 |
1668 | * BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000 | ||
1669 | */ | ||
1323 | #define BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen) \ | 1670 | #define BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen) \ |
1324 | (BIT_LEN_MASK_32(__bitlen) << (__bitoffset)) | 1671 | (BIT_LEN_MASK_32(__bitlen) << (__bitoffset)) |
1325 | #define BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen) \ | 1672 | #define BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen) \ |
@@ -1328,8 +1675,9 @@ BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000*/ | |||
1328 | (BIT_LEN_MASK_8(__bitlen) << (__bitoffset)) | 1675 | (BIT_LEN_MASK_8(__bitlen) << (__bitoffset)) |
1329 | 1676 | ||
1330 | /*Description: | 1677 | /*Description: |
1331 | Return 4-byte value in host byte ordering from | 1678 | * Return 4-byte value in host byte ordering from |
1332 | 4-byte pointer in little-endian system.*/ | 1679 | * 4-byte pointer in little-endian system. |
1680 | */ | ||
1333 | #define LE_P4BYTE_TO_HOST_4BYTE(__pstart) \ | 1681 | #define LE_P4BYTE_TO_HOST_4BYTE(__pstart) \ |
1334 | (EF4BYTE(*((u32 *)(__pstart)))) | 1682 | (EF4BYTE(*((u32 *)(__pstart)))) |
1335 | #define LE_P2BYTE_TO_HOST_2BYTE(__pstart) \ | 1683 | #define LE_P2BYTE_TO_HOST_2BYTE(__pstart) \ |
@@ -1337,28 +1685,10 @@ Return 4-byte value in host byte ordering from | |||
1337 | #define LE_P1BYTE_TO_HOST_1BYTE(__pstart) \ | 1685 | #define LE_P1BYTE_TO_HOST_1BYTE(__pstart) \ |
1338 | (EF1BYTE(*((u8 *)(__pstart)))) | 1686 | (EF1BYTE(*((u8 *)(__pstart)))) |
1339 | 1687 | ||
1340 | /*Description: | 1688 | /* Description: |
1341 | Translate subfield (continuous bits in little-endian) of 4-byte | 1689 | * Mask subfield (continuous bits in little-endian) of 4-byte value |
1342 | value to host byte ordering.*/ | 1690 | * and return the result in 4-byte value in host byte ordering. |
1343 | #define LE_BITS_TO_4BYTE(__pstart, __bitoffset, __bitlen) \ | 1691 | */ |
1344 | ( \ | ||
1345 | (LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset)) & \ | ||
1346 | BIT_LEN_MASK_32(__bitlen) \ | ||
1347 | ) | ||
1348 | #define LE_BITS_TO_2BYTE(__pstart, __bitoffset, __bitlen) \ | ||
1349 | ( \ | ||
1350 | (LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset)) & \ | ||
1351 | BIT_LEN_MASK_16(__bitlen) \ | ||
1352 | ) | ||
1353 | #define LE_BITS_TO_1BYTE(__pstart, __bitoffset, __bitlen) \ | ||
1354 | ( \ | ||
1355 | (LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset)) & \ | ||
1356 | BIT_LEN_MASK_8(__bitlen) \ | ||
1357 | ) | ||
1358 | |||
1359 | /*Description: | ||
1360 | Mask subfield (continuous bits in little-endian) of 4-byte value | ||
1361 | and return the result in 4-byte value in host byte ordering.*/ | ||
1362 | #define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) \ | 1692 | #define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) \ |
1363 | ( \ | 1693 | ( \ |
1364 | LE_P4BYTE_TO_HOST_4BYTE(__pstart) & \ | 1694 | LE_P4BYTE_TO_HOST_4BYTE(__pstart) & \ |
@@ -1375,20 +1705,9 @@ and return the result in 4-byte value in host byte ordering.*/ | |||
1375 | (~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)) \ | 1705 | (~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)) \ |
1376 | ) | 1706 | ) |
1377 | 1707 | ||
1378 | /*Description: | 1708 | /* Description: |
1379 | Set subfield of little-endian 4-byte value to specified value. */ | 1709 | * Set subfield of little-endian 4-byte value to specified value. |
1380 | #define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \ | 1710 | */ |
1381 | *((u32 *)(__pstart)) = EF4BYTE \ | ||
1382 | ( \ | ||
1383 | LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \ | ||
1384 | ((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \ | ||
1385 | ); | ||
1386 | #define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \ | ||
1387 | *((u16 *)(__pstart)) = EF2BYTE \ | ||
1388 | ( \ | ||
1389 | LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \ | ||
1390 | ((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \ | ||
1391 | ); | ||
1392 | #define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \ | 1711 | #define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \ |
1393 | *((u8 *)(__pstart)) = EF1BYTE \ | 1712 | *((u8 *)(__pstart)) = EF1BYTE \ |
1394 | ( \ | 1713 | ( \ |
@@ -1400,13 +1719,14 @@ Set subfield of little-endian 4-byte value to specified value. */ | |||
1400 | mem access macro define end | 1719 | mem access macro define end |
1401 | ****************************************/ | 1720 | ****************************************/ |
1402 | 1721 | ||
1403 | #define packet_get_type(_packet) (EF1BYTE((_packet).octet[0]) & 0xFC) | 1722 | #define byte(x, n) ((x >> (8 * n)) & 0xff) |
1723 | |||
1404 | #define RTL_WATCH_DOG_TIME 2000 | 1724 | #define RTL_WATCH_DOG_TIME 2000 |
1405 | #define MSECS(t) msecs_to_jiffies(t) | 1725 | #define MSECS(t) msecs_to_jiffies(t) |
1406 | #define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS) | 1726 | #define WLAN_FC_GET_VERS(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_VERS) |
1407 | #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) | 1727 | #define WLAN_FC_GET_TYPE(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_FTYPE) |
1408 | #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) | 1728 | #define WLAN_FC_GET_STYPE(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_STYPE) |
1409 | #define WLAN_FC_MORE_DATA(fc) ((fc) & IEEE80211_FCTL_MOREDATA) | 1729 | #define WLAN_FC_MORE_DATA(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_MOREDATA) |
1410 | #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) | 1730 | #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) |
1411 | #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) | 1731 | #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) |
1412 | #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) | 1732 | #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) |
@@ -1420,6 +1740,8 @@ Set subfield of little-endian 4-byte value to specified value. */ | |||
1420 | #define RT_RF_OFF_LEVL_FW_32K BIT(5) /*FW in 32k */ | 1740 | #define RT_RF_OFF_LEVL_FW_32K BIT(5) /*FW in 32k */ |
1421 | /*Always enable ASPM and Clock Req in initialization.*/ | 1741 | /*Always enable ASPM and Clock Req in initialization.*/ |
1422 | #define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT(6) | 1742 | #define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT(6) |
1743 | /* no matter RFOFF or SLEEP we set PS_ASPM_LEVL*/ | ||
1744 | #define RT_PS_LEVEL_ASPM BIT(7) | ||
1423 | /*When LPS is on, disable 2R if no packet is received or transmittd.*/ | 1745 | /*When LPS is on, disable 2R if no packet is received or transmittd.*/ |
1424 | #define RT_RF_LPS_DISALBE_2R BIT(30) | 1746 | #define RT_RF_LPS_DISALBE_2R BIT(30) |
1425 | #define RT_RF_LPS_LEVEL_ASPM BIT(31) /*LPS with ASPM */ | 1747 | #define RT_RF_LPS_LEVEL_ASPM BIT(31) /*LPS with ASPM */ |
@@ -1433,15 +1755,6 @@ Set subfield of little-endian 4-byte value to specified value. */ | |||
1433 | #define container_of_dwork_rtl(x, y, z) \ | 1755 | #define container_of_dwork_rtl(x, y, z) \ |
1434 | container_of(container_of(x, struct delayed_work, work), y, z) | 1756 | container_of(container_of(x, struct delayed_work, work), y, z) |
1435 | 1757 | ||
1436 | #define FILL_OCTET_STRING(_os, _octet, _len) \ | ||
1437 | (_os).octet = (u8 *)(_octet); \ | ||
1438 | (_os).length = (_len); | ||
1439 | |||
1440 | #define CP_MACADDR(des, src) \ | ||
1441 | ((des)[0] = (src)[0], (des)[1] = (src)[1],\ | ||
1442 | (des)[2] = (src)[2], (des)[3] = (src)[3],\ | ||
1443 | (des)[4] = (src)[4], (des)[5] = (src)[5]) | ||
1444 | |||
1445 | static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr) | 1758 | static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr) |
1446 | { | 1759 | { |
1447 | return rtlpriv->io.read8_sync(rtlpriv, addr); | 1760 | return rtlpriv->io.read8_sync(rtlpriv, addr); |