aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/wifi.h
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2011-02-19 17:29:07 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-21 15:39:57 -0500
commite97b775d9bce1d7b51df5bf470ba9c529d93dc66 (patch)
tree7fbcb2f9b7ffb3973fe9768379a8c8026d1e9ef3 /drivers/net/wireless/rtlwifi/wifi.h
parent18d30067d3b0c7e1362b7a866a9873e03a6d7d62 (diff)
rtlwifi: Modify wifi.h for rtl8192cu
Further merge of parameters needed for rtl8192cu. In addition, some changes needed for rtl8192se and rtl8192de are included and additional Hungarian notation is removed. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/wifi.h')
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h285
1 files changed, 239 insertions, 46 deletions
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 328fb40ad901..c0f8140e8874 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -83,6 +83,19 @@
83#define MAC80211_3ADDR_LEN 24 83#define MAC80211_3ADDR_LEN 24
84#define MAC80211_4ADDR_LEN 30 84#define MAC80211_4ADDR_LEN 30
85 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
86enum intf_type { 99enum intf_type {
87 INTF_PCI = 0, 100 INTF_PCI = 0,
88 INTF_USB = 1, 101 INTF_USB = 1,
@@ -114,18 +127,37 @@ enum hardware_type {
114 HARDWARE_TYPE_RTL8192CU, 127 HARDWARE_TYPE_RTL8192CU,
115 HARDWARE_TYPE_RTL8192DE, 128 HARDWARE_TYPE_RTL8192DE,
116 HARDWARE_TYPE_RTL8192DU, 129 HARDWARE_TYPE_RTL8192DU,
130 HARDWARE_TYPE_RTL8723E,
117 HARDWARE_TYPE_RTL8723U, 131 HARDWARE_TYPE_RTL8723U,
118 132
119 /*keep it last*/ 133 /* keep it last */
120 HARDWARE_TYPE_NUM 134 HARDWARE_TYPE_NUM
121}; 135};
122 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)
123#define IS_HARDWARE_TYPE_8192CE(rtlhal) \ 141#define IS_HARDWARE_TYPE_8192CE(rtlhal) \
124 (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CE) 142 (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CE)
125#define IS_HARDWARE_TYPE_8192CU(rtlhal) \ 143#define IS_HARDWARE_TYPE_8192CU(rtlhal) \
126 (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CU) 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)
127#define IS_HARDWARE_TYPE_8723U(rtlhal) \ 151#define IS_HARDWARE_TYPE_8723U(rtlhal) \
128 (rtlhal->hw_type == HARDWARE_TYPE_RTL8723U) 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))
129 161
130enum scan_operation_backup_opt { 162enum scan_operation_backup_opt {
131 SCAN_OPT_BACKUP = 0, 163 SCAN_OPT_BACKUP = 0,
@@ -324,6 +356,7 @@ enum rf_type {
324 RF_1T1R = 0, 356 RF_1T1R = 0,
325 RF_1T2R = 1, 357 RF_1T2R = 1,
326 RF_2T2R = 2, 358 RF_2T2R = 2,
359 RF_2T2R_GREEN = 3,
327}; 360};
328 361
329enum ht_channel_width { 362enum ht_channel_width {
@@ -408,6 +441,7 @@ enum rtl_var_map {
408 RTL_IMR_ATIMEND, /*For 92C,ATIM Window End Interrupt */ 441 RTL_IMR_ATIMEND, /*For 92C,ATIM Window End Interrupt */
409 RTL_IMR_BDOK, /*Beacon Queue DMA OK Interrup */ 442 RTL_IMR_BDOK, /*Beacon Queue DMA OK Interrup */
410 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*/
411 RTL_IMR_TBDOK, /*Transmit Beacon OK interrup */ 445 RTL_IMR_TBDOK, /*Transmit Beacon OK interrup */
412 RTL_IMR_MGNTDOK, /*Management Queue DMA OK Interrupt */ 446 RTL_IMR_MGNTDOK, /*Management Queue DMA OK Interrupt */
413 RTL_IMR_TBDER, /*For 92C,Transmit Beacon Error Interrupt */ 447 RTL_IMR_TBDER, /*For 92C,Transmit Beacon Error Interrupt */
@@ -416,7 +450,8 @@ enum rtl_var_map {
416 RTL_IMR_VIDOK, /*AC_VI DMA OK Interrupt */ 450 RTL_IMR_VIDOK, /*AC_VI DMA OK Interrupt */
417 RTL_IMR_VODOK, /*AC_VO DMA Interrupt */ 451 RTL_IMR_VODOK, /*AC_VO DMA Interrupt */
418 RTL_IMR_ROK, /*Receive DMA OK Interrupt */ 452 RTL_IMR_ROK, /*Receive DMA OK Interrupt */
419 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) */
420 455
421 /*CCK Rates, TxHT = 0 */ 456 /*CCK Rates, TxHT = 0 */
422 RTL_RC_CCK_RATE1M, 457 RTL_RC_CCK_RATE1M,
@@ -492,6 +527,19 @@ enum acm_method {
492 eAcmWay2_SW = 2, 527 eAcmWay2_SW = 2,
493}; 528};
494 529
530enum macphy_mode {
531 SINGLEMAC_SINGLEPHY = 0,
532 DUALMAC_DUALPHY,
533 DUALMAC_SINGLEPHY,
534};
535
536enum band_type {
537 BAND_ON_2_4G = 0,
538 BAND_ON_5G,
539 BAND_ON_BOTH,
540 BANDMAX
541};
542
495/*aci/aifsn Field. 543/*aci/aifsn Field.
496Ref: WMM spec 2.2.2: WME Parameter Element, p.12.*/ 544Ref: WMM spec 2.2.2: WME Parameter Element, p.12.*/
497union aci_aifsn { 545union aci_aifsn {
@@ -625,6 +673,8 @@ struct false_alarm_statistics {
625 u32 cnt_rate_illegal; 673 u32 cnt_rate_illegal;
626 u32 cnt_crc8_fail; 674 u32 cnt_crc8_fail;
627 u32 cnt_mcs_fail; 675 u32 cnt_mcs_fail;
676 u32 cnt_fast_fsync_fail;
677 u32 cnt_sb_search_fail;
628 u32 cnt_ofdm_fail; 678 u32 cnt_ofdm_fail;
629 u32 cnt_cck_fail; 679 u32 cnt_cck_fail;
630 u32 cnt_all; 680 u32 cnt_all;
@@ -712,6 +762,13 @@ struct rtl_rfkill {
712 bool rfkill_state; /*0 is off, 1 is on */ 762 bool rfkill_state; /*0 is off, 1 is on */
713}; 763};
714 764
765#define IQK_MATRIX_REG_NUM 8
766#define IQK_MATRIX_SETTINGS_NUM (1 + 24 + 21)
767struct iqk_matrix_regs {
768 bool b_iqk_done;
769 long value[1][IQK_MATRIX_REG_NUM];
770};
771
715struct phy_parameters { 772struct phy_parameters {
716 u16 length; 773 u16 length;
717 u32 *pdata; 774 u32 *pdata;
@@ -746,8 +803,9 @@ struct rtl_phy {
746 u8 current_channel; 803 u8 current_channel;
747 u8 h2c_box_num; 804 u8 h2c_box_num;
748 u8 set_io_inprogress; 805 u8 set_io_inprogress;
806 u8 lck_inprogress;
749 807
750 /*record for power tracking*/ 808 /* record for power tracking */
751 s32 reg_e94; 809 s32 reg_e94;
752 s32 reg_e9c; 810 s32 reg_e9c;
753 s32 reg_ea4; 811 s32 reg_ea4;
@@ -764,27 +822,32 @@ struct rtl_phy {
764 u32 iqk_mac_backup[IQK_MAC_REG_NUM]; 822 u32 iqk_mac_backup[IQK_MAC_REG_NUM];
765 u32 iqk_bb_backup[10]; 823 u32 iqk_bb_backup[10];
766 824
825 /* Dual mac */
826 bool need_iqk;
827 struct iqk_matrix_regs iqk_matrix_regsetting[IQK_MATRIX_SETTINGS_NUM];
828
767 bool rfpi_enable; 829 bool rfpi_enable;
768 830
769 u8 pwrgroup_cnt; 831 u8 pwrgroup_cnt;
770 u8 cck_high_power; 832 u8 cck_high_power;
771 /* 3 groups of pwr diff by rates*/ 833 /* MAX_PG_GROUP groups of pwr diff by rates */
772 u32 mcs_txpwrlevel_origoffset[4][16]; 834 u32 mcs_txpwrlevel_origoffset[MAX_PG_GROUP][16];
773 u8 default_initialgain[4]; 835 u8 default_initialgain[4];
774 836
775 /*the current Tx power level*/ 837 /* the current Tx power level */
776 u8 cur_cck_txpwridx; 838 u8 cur_cck_txpwridx;
777 u8 cur_ofdm24g_txpwridx; 839 u8 cur_ofdm24g_txpwridx;
778 840
779 u32 rfreg_chnlval[2]; 841 u32 rfreg_chnlval[2];
780 bool apk_done; 842 bool apk_done;
843 u32 reg_rf3c[2]; /* pathA / pathB */
781 844
782 /*fsync*/
783 u8 framesync; 845 u8 framesync;
784 u32 framesync_c34; 846 u32 framesync_c34;
785 847
786 u8 num_total_rfpath; 848 u8 num_total_rfpath;
787 struct phy_parameters hwparam_tables[MAX_TAB]; 849 struct phy_parameters hwparam_tables[MAX_TAB];
850 u16 rf_pathmap;
788}; 851};
789 852
790#define MAX_TID_COUNT 9 853#define MAX_TID_COUNT 9
@@ -825,12 +888,11 @@ struct rtl_io {
825 int (*writeN_async) (struct rtl_priv *rtlpriv, u32 addr, u16 len, 888 int (*writeN_async) (struct rtl_priv *rtlpriv, u32 addr, u16 len,
826 u8 *pdata); 889 u8 *pdata);
827 890
828 u8(*read8_sync) (struct rtl_priv *rtlpriv, u32 addr); 891 u8(*read8_sync) (struct rtl_priv *rtlpriv, u32 addr);
829 u16(*read16_sync) (struct rtl_priv *rtlpriv, u32 addr); 892 u16(*read16_sync) (struct rtl_priv *rtlpriv, u32 addr);
830 u32(*read32_sync) (struct rtl_priv *rtlpriv, u32 addr); 893 u32(*read32_sync) (struct rtl_priv *rtlpriv, u32 addr);
831 int (*readN_sync) (struct rtl_priv *rtlpriv, u32 addr, u16 len, 894 int (*readN_sync) (struct rtl_priv *rtlpriv, u32 addr, u16 len,
832 u8 *pdata); 895 u8 *pdata);
833
834}; 896};
835 897
836struct rtl_mac { 898struct rtl_mac {
@@ -862,16 +924,24 @@ struct rtl_mac {
862 bool act_scanning; 924 bool act_scanning;
863 u8 cnt_after_linked; 925 u8 cnt_after_linked;
864 926
865 /*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;
866 934
867 /*AP*/ u8 bssid[6]; 935 /*AP*/
868 u8 mcs[16]; /*16 bytes mcs for HT rates.*/ 936 u8 bssid[6];
869 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 */
870 u8 ht_enable; 940 u8 ht_enable;
871 u8 sgi_40; 941 u8 sgi_40;
872 u8 sgi_20; 942 u8 sgi_20;
873 u8 bw_40; 943 u8 bw_40;
874 u8 mode; /*wireless mode*/ 944 u8 mode; /* wireless mode */
875 u8 slot_time; 945 u8 slot_time;
876 u8 short_preamble; 946 u8 short_preamble;
877 u8 use_cts_protect; 947 u8 use_cts_protect;
@@ -882,9 +952,11 @@ struct rtl_mac {
882 u8 retry_long; 952 u8 retry_long;
883 u16 assoc_id; 953 u16 assoc_id;
884 954
885 /*IBSS*/ int beacon_interval; 955 /*IBSS*/
956 int beacon_interval;
886 957
887 /*AMPDU*/ u8 min_space_cfg; /*For Min spacing configurations */ 958 /*AMPDU*/
959 u8 min_space_cfg; /*For Min spacing configurations */
888 u8 max_mss_density; 960 u8 max_mss_density;
889 u8 current_ampdu_factor; 961 u8 current_ampdu_factor;
890 u8 current_ampdu_density; 962 u8 current_ampdu_density;
@@ -899,11 +971,13 @@ struct rtl_hal {
899 971
900 enum intf_type interface; 972 enum intf_type interface;
901 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;
902 u8 oem_id; 975 u8 oem_id;
903 u32 version; /*version of chip */ 976 u32 version; /*version of chip */
904 u8 state; /*stop 0, start 1 */ 977 u8 state; /*stop 0, start 1 */
905 978
906 /*firmware */ 979 /*firmware */
980 u32 fwsize;
907 u8 *pfirmware; 981 u8 *pfirmware;
908 u16 fw_version; 982 u16 fw_version;
909 u16 fw_subversion; 983 u16 fw_subversion;
@@ -912,6 +986,39 @@ struct rtl_hal {
912 bool fw_ready; 986 bool fw_ready;
913 /*Reserve page start offset except beacon in TxQ. */ 987 /*Reserve page start offset except beacon in TxQ. */
914 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;
915}; 1022};
916 1023
917struct rtl_security { 1024struct rtl_security {
@@ -936,7 +1043,7 @@ struct rtl_security {
936}; 1043};
937 1044
938struct rtl_dm { 1045struct rtl_dm {
939 /*PHY status for DM (dynamic management) */ 1046 /*PHY status for Dynamic Management */
940 long entry_min_undecoratedsmoothed_pwdb; 1047 long entry_min_undecoratedsmoothed_pwdb;
941 long undecorated_smoothed_pwdb; /*out dm */ 1048 long undecorated_smoothed_pwdb; /*out dm */
942 long entry_max_undecoratedsmoothed_pwdb; 1049 long entry_max_undecoratedsmoothed_pwdb;
@@ -951,33 +1058,46 @@ struct rtl_dm {
951 bool txpower_tracking; 1058 bool txpower_tracking;
952 bool useramask; 1059 bool useramask;
953 bool rfpath_rxenable[4]; 1060 bool rfpath_rxenable[4];
1061 bool inform_fw_driverctrldm;
1062 bool current_mrc_switch;
1063 u8 txpowercount;
954 1064
1065 u8 thermalvalue_rxgain;
955 u8 thermalvalue_iqk; 1066 u8 thermalvalue_iqk;
956 u8 thermalvalue_lck; 1067 u8 thermalvalue_lck;
957 u8 thermalvalue; 1068 u8 thermalvalue;
958 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;
959 u8 dynamic_txhighpower_lvl; /*Tx high power level */ 1073 u8 dynamic_txhighpower_lvl; /*Tx high power level */
960 u8 dm_flag; /*Indicate if each dynamic mechanism's status. */ 1074 u8 dm_flag; /*Indicate each dynamic mechanism's status. */
961 u8 dm_type; 1075 u8 dm_type;
962 u8 txpower_track_control; 1076 u8 txpower_track_control;
963 1077 bool interrupt_migration;
1078 bool disable_tx_int;
964 char ofdm_index[2]; 1079 char ofdm_index[2];
965 char cck_index; 1080 char cck_index;
1081 u8 power_index_backup[6];
966}; 1082};
967 1083
968#define EFUSE_MAX_LOGICAL_SIZE 256 1084#define EFUSE_MAX_LOGICAL_SIZE 256
969 1085
970struct rtl_efuse { 1086struct rtl_efuse {
971 bool autoload_ok; 1087 bool autoLoad_ok;
972 bool bootfromefuse; 1088 bool bootfromefuse;
973 u16 max_physical_size; 1089 u16 max_physical_size;
974 u8 contents[EFUSE_MAX_LOGICAL_SIZE];
975 1090
976 u8 efuse_map[2][EFUSE_MAX_LOGICAL_SIZE]; 1091 u8 efuse_map[2][EFUSE_MAX_LOGICAL_SIZE];
977 u16 efuse_usedbytes; 1092 u16 efuse_usedbytes;
978 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
979 1098
980 u8 autoload_failflag; 1099 u8 autoload_failflag;
1100 u8 autoload_status;
981 1101
982 short epromtype; 1102 short epromtype;
983 u16 eeprom_vid; 1103 u16 eeprom_vid;
@@ -993,43 +1113,61 @@ struct rtl_efuse {
993 u8 dev_addr[6]; 1113 u8 dev_addr[6];
994 1114
995 bool txpwr_fromeprom; 1115 bool txpwr_fromeprom;
1116 u8 eeprom_crystalcap;
996 u8 eeprom_tssi[2]; 1117 u8 eeprom_tssi[2];
997 u8 eeprom_pwrlimit_ht20[3]; 1118 u8 eeprom_tssi_5g[3][2]; /* for 5GL/5GM/5GH band. */
998 u8 eeprom_pwrlimit_ht40[3]; 1119 u8 eeprom_pwrlimit_ht20[CHANNEL_GROUP_MAX];
999 u8 eeprom_chnlarea_txpwr_cck[2][3]; 1120 u8 eeprom_pwrlimit_ht40[CHANNEL_GROUP_MAX];
1000 u8 eeprom_chnlarea_txpwr_ht40_1s[2][3]; 1121 u8 eeprom_chnlarea_txpwr_cck[2][CHANNEL_GROUP_MAX_2G];
1001 u8 eeprom_chnlarea_txpwr_ht40_2sdiif[2][3]; 1122 u8 eeprom_chnlarea_txpwr_ht40_1s[2][CHANNEL_GROUP_MAX];
1002 u8 txpwrlevel_cck[2][14]; 1123 u8 eeprom_chnlarea_txpwr_ht40_2sdiif[2][CHANNEL_GROUP_MAX];
1003 u8 txpwrlevel_ht40_1s[2][14]; /*For HT 40MHZ pwr */ 1124 u8 txpwrlevel_cck[2][CHANNEL_MAX_NUMBER_2G];
1004 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;
1005 1131
1006 /*For power group */ 1132 /*For power group */
1007 u8 pwrgroup_ht20[2][14]; 1133 u8 eeprom_pwrgroup[2][3];
1008 u8 pwrgroup_ht40[2][14]; 1134 u8 pwrgroup_ht20[2][CHANNEL_MAX_NUMBER];
1009 1135 u8 pwrgroup_ht40[2][CHANNEL_MAX_NUMBER];
1010 char txpwr_ht20diff[2][14]; /*HT 20<->40 Pwr diff */ 1136
1011 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];
1012 1144
1013 u8 eeprom_regulatory; 1145 u8 eeprom_regulatory;
1014 u8 eeprom_thermalmeter; 1146 u8 eeprom_thermalmeter;
1015 /*ThermalMeter, index 0 for RFIC0, and 1 for RFIC1 */ 1147 u8 thermalmeter[2]; /*ThermalMeter, index 0 for RFIC0, 1 for RFIC1 */
1016 u8 thermalmeter[2]; 1148 u16 tssi_13dbm;
1149 u8 crystalcap; /* CrystalCap. */
1150 u8 delta_iqk;
1151 u8 delta_lck;
1017 1152
1018 u8 legacy_ht_txpowerdiff; /*Legacy to HT rate power diff */ 1153 u8 legacy_ht_txpowerdiff; /*Legacy to HT rate power diff */
1019 bool apk_thermalmeterignore; 1154 bool apk_thermalmeterignore;
1155
1156 bool b1x1_recvcombine;
1157 bool b1ss_support;
1158
1159 /*channel plan */
1160 u8 channel_plan;
1020}; 1161};
1021 1162
1022struct rtl_ps_ctl { 1163struct rtl_ps_ctl {
1164 bool pwrdomain_protect;
1023 bool set_rfpowerstate_inprogress; 1165 bool set_rfpowerstate_inprogress;
1024 bool in_powersavemode; 1166 bool in_powersavemode;
1025 bool rfchange_inprogress; 1167 bool rfchange_inprogress;
1026 bool swrf_processing; 1168 bool swrf_processing;
1027 bool hwradiooff; 1169 bool hwradiooff;
1028 1170
1029 u32 last_sleep_jiffies;
1030 u32 last_awake_jiffies;
1031 u32 last_delaylps_stamp_jiffies;
1032
1033 /* 1171 /*
1034 * just for PCIE ASPM 1172 * just for PCIE ASPM
1035 * If it supports ASPM, Offset[560h] = 0x40, 1173 * If it supports ASPM, Offset[560h] = 0x40,
@@ -1040,6 +1178,7 @@ struct rtl_ps_ctl {
1040 1178
1041 /*for LPS */ 1179 /*for LPS */
1042 enum rt_psmode dot11_psmode; /*Power save mode configured. */ 1180 enum rt_psmode dot11_psmode; /*Power save mode configured. */
1181 bool swctrl_lps;
1043 bool leisure_ps; 1182 bool leisure_ps;
1044 bool fwctrl_lps; 1183 bool fwctrl_lps;
1045 u8 fwctrl_psmode; 1184 u8 fwctrl_psmode;
@@ -1063,8 +1202,25 @@ struct rtl_ps_ctl {
1063 u8 const_amdpci_aspm; 1202 u8 const_amdpci_aspm;
1064 1203
1065 bool pwrdown_mode; 1204 bool pwrdown_mode;
1205
1066 enum rf_pwrstate inactive_pwrstate; 1206 enum rf_pwrstate inactive_pwrstate;
1067 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;
1068}; 1224};
1069 1225
1070struct rtl_stats { 1226struct rtl_stats {
@@ -1103,6 +1259,7 @@ struct rtl_stats {
1103 u8 rx_drvinfo_size; 1259 u8 rx_drvinfo_size;
1104 u8 rx_bufshift; 1260 u8 rx_bufshift;
1105 bool isampdu; 1261 bool isampdu;
1262 bool isfirst_ampdu;
1106 bool rx_is40Mhzpacket; 1263 bool rx_is40Mhzpacket;
1107 u32 rx_pwdb_all; 1264 u32 rx_pwdb_all;
1108 u8 rx_mimo_signalstrength[4]; /*in 0~100 index */ 1265 u8 rx_mimo_signalstrength[4]; /*in 0~100 index */
@@ -1148,6 +1305,15 @@ struct rtl_tcb_desc {
1148 u8 ratr_index; 1305 u8 ratr_index;
1149 u8 mac_id; 1306 u8 mac_id;
1150 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];
1151}; 1317};
1152 1318
1153struct rtl_hal_ops { 1319struct rtl_hal_ops {
@@ -1159,6 +1325,8 @@ struct rtl_hal_ops {
1159 u32 *p_inta, u32 *p_intb); 1325 u32 *p_inta, u32 *p_intb);
1160 int (*hw_init) (struct ieee80211_hw *hw); 1326 int (*hw_init) (struct ieee80211_hw *hw);
1161 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);
1162 void (*enable_interrupt) (struct ieee80211_hw *hw); 1330 void (*enable_interrupt) (struct ieee80211_hw *hw);
1163 void (*disable_interrupt) (struct ieee80211_hw *hw); 1331 void (*disable_interrupt) (struct ieee80211_hw *hw);
1164 int (*set_network_type) (struct ieee80211_hw *hw, 1332 int (*set_network_type) (struct ieee80211_hw *hw,
@@ -1167,7 +1335,7 @@ struct rtl_hal_ops {
1167 bool check_bssid); 1335 bool check_bssid);
1168 void (*set_bw_mode) (struct ieee80211_hw *hw, 1336 void (*set_bw_mode) (struct ieee80211_hw *hw,
1169 enum nl80211_channel_type ch_type); 1337 enum nl80211_channel_type ch_type);
1170 u8 (*switch_channel) (struct ieee80211_hw *hw); 1338 u8(*switch_channel) (struct ieee80211_hw *hw);
1171 void (*set_qos) (struct ieee80211_hw *hw, int aci); 1339 void (*set_qos) (struct ieee80211_hw *hw, int aci);
1172 void (*set_bcn_reg) (struct ieee80211_hw *hw); 1340 void (*set_bcn_reg) (struct ieee80211_hw *hw);
1173 void (*set_bcn_intv) (struct ieee80211_hw *hw); 1341 void (*set_bcn_intv) (struct ieee80211_hw *hw);
@@ -1219,6 +1387,7 @@ struct rtl_hal_ops {
1219 1387
1220struct rtl_intf_ops { 1388struct rtl_intf_ops {
1221 /*com */ 1389 /*com */
1390 void (*read_efuse_byte)(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf);
1222 int (*adapter_start) (struct ieee80211_hw *hw); 1391 int (*adapter_start) (struct ieee80211_hw *hw);
1223 void (*adapter_stop) (struct ieee80211_hw *hw); 1392 void (*adapter_stop) (struct ieee80211_hw *hw);
1224 1393
@@ -1262,6 +1431,7 @@ struct rtl_hal_usbint_cfg {
1262}; 1431};
1263 1432
1264struct rtl_hal_cfg { 1433struct rtl_hal_cfg {
1434 u8 bar_id;
1265 char *name; 1435 char *name;
1266 char *fw_name; 1436 char *fw_name;
1267 struct rtl_hal_ops *ops; 1437 struct rtl_hal_ops *ops;
@@ -1285,7 +1455,11 @@ struct rtl_locks {
1285 spinlock_t rf_ps_lock; 1455 spinlock_t rf_ps_lock;
1286 spinlock_t rf_lock; 1456 spinlock_t rf_lock;
1287 spinlock_t lps_lock; 1457 spinlock_t lps_lock;
1458 spinlock_t waitq_lock;
1288 spinlock_t tx_urb_lock; 1459 spinlock_t tx_urb_lock;
1460
1461 /*Dual mac*/
1462 spinlock_t cck_and_rw_pagea_lock;
1289}; 1463};
1290 1464
1291struct rtl_works { 1465struct rtl_works {
@@ -1302,12 +1476,20 @@ struct rtl_works {
1302 struct workqueue_struct *rtl_wq; 1476 struct workqueue_struct *rtl_wq;
1303 struct delayed_work watchdog_wq; 1477 struct delayed_work watchdog_wq;
1304 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;
1305}; 1483};
1306 1484
1307struct rtl_debug { 1485struct rtl_debug {
1308 u32 dbgp_type[DBGP_TYPE_MAX]; 1486 u32 dbgp_type[DBGP_TYPE_MAX];
1309 u32 global_debuglevel; 1487 u32 global_debuglevel;
1310 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];
1311}; 1493};
1312 1494
1313struct rtl_priv { 1495struct rtl_priv {
@@ -1358,6 +1540,7 @@ struct rtl_priv {
1358#define rtl_efuse(rtlpriv) (&((rtlpriv)->efuse)) 1540#define rtl_efuse(rtlpriv) (&((rtlpriv)->efuse))
1359#define rtl_psc(rtlpriv) (&((rtlpriv)->psc)) 1541#define rtl_psc(rtlpriv) (&((rtlpriv)->psc))
1360 1542
1543
1361/*************************************** 1544/***************************************
1362 Bluetooth Co-existance Related 1545 Bluetooth Co-existance Related
1363****************************************/ 1546****************************************/
@@ -1441,6 +1624,7 @@ struct bt_coexist_info {
1441 1624
1442}; 1625};
1443 1626
1627
1444/**************************************** 1628/****************************************
1445 mem access macro define start 1629 mem access macro define start
1446 Call endian free function when 1630 Call endian free function when
@@ -1563,10 +1747,15 @@ Set subfield of little-endian 4-byte value to specified value. */
1563 ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \ 1747 ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \
1564 ); 1748 );
1565 1749
1750#define N_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \
1751 (__value) : (((__value + __aligment - 1) / __aligment) * __aligment))
1752
1566/**************************************** 1753/****************************************
1567 mem access macro define end 1754 mem access macro define end
1568****************************************/ 1755****************************************/
1569 1756
1757#define byte(x, n) ((x >> (8 * n)) & 0xff)
1758
1570#define packet_get_type(_packet) (EF1BYTE((_packet).octet[0]) & 0xFC) 1759#define packet_get_type(_packet) (EF1BYTE((_packet).octet[0]) & 0xFC)
1571#define RTL_WATCH_DOG_TIME 2000 1760#define RTL_WATCH_DOG_TIME 2000
1572#define MSECS(t) msecs_to_jiffies(t) 1761#define MSECS(t) msecs_to_jiffies(t)
@@ -1587,6 +1776,8 @@ Set subfield of little-endian 4-byte value to specified value. */
1587#define RT_RF_OFF_LEVL_FW_32K BIT(5) /*FW in 32k */ 1776#define RT_RF_OFF_LEVL_FW_32K BIT(5) /*FW in 32k */
1588/*Always enable ASPM and Clock Req in initialization.*/ 1777/*Always enable ASPM and Clock Req in initialization.*/
1589#define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT(6) 1778#define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT(6)
1779/* no matter RFOFF or SLEEP we set PS_ASPM_LEVL*/
1780#define RT_PS_LEVEL_ASPM BIT(7)
1590/*When LPS is on, disable 2R if no packet is received or transmittd.*/ 1781/*When LPS is on, disable 2R if no packet is received or transmittd.*/
1591#define RT_RF_LPS_DISALBE_2R BIT(30) 1782#define RT_RF_LPS_DISALBE_2R BIT(30)
1592#define RT_RF_LPS_LEVEL_ASPM BIT(31) /*LPS with ASPM */ 1783#define RT_RF_LPS_LEVEL_ASPM BIT(31) /*LPS with ASPM */
@@ -1601,8 +1792,10 @@ Set subfield of little-endian 4-byte value to specified value. */
1601 container_of(container_of(x, struct delayed_work, work), y, z) 1792 container_of(container_of(x, struct delayed_work, work), y, z)
1602 1793
1603#define FILL_OCTET_STRING(_os, _octet, _len) \ 1794#define FILL_OCTET_STRING(_os, _octet, _len) \
1604 (_os).octet = (u8 *)(_octet); \ 1795 do { \
1605 (_os).length = (_len); 1796 (_os). octet = (u8 *)(_octet); \
1797 (_os). length = (_len); \
1798 } while (0);
1606 1799
1607#define CP_MACADDR(des, src) \ 1800#define CP_MACADDR(des, src) \
1608 memcpy((des), (src), ETH_ALEN) 1801 memcpy((des), (src), ETH_ALEN)