diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 158 |
1 files changed, 1 insertions, 157 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index f5b864b1a55d..ce2e893856c1 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -1119,162 +1119,6 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1119 | return 0; | 1119 | return 0; |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | /* | ||
1123 | * IEEE80211 stack callback functions. | ||
1124 | */ | ||
1125 | static void rt2800usb_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, | ||
1126 | u32 *iv32, u16 *iv16) | ||
1127 | { | ||
1128 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
1129 | struct mac_iveiv_entry iveiv_entry; | ||
1130 | u32 offset; | ||
1131 | |||
1132 | offset = MAC_IVEIV_ENTRY(hw_key_idx); | ||
1133 | rt2800_register_multiread(rt2x00dev, offset, | ||
1134 | &iveiv_entry, sizeof(iveiv_entry)); | ||
1135 | |||
1136 | memcpy(&iveiv_entry.iv[0], iv16, sizeof(iv16)); | ||
1137 | memcpy(&iveiv_entry.iv[4], iv32, sizeof(iv32)); | ||
1138 | } | ||
1139 | |||
1140 | static int rt2800usb_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | ||
1141 | { | ||
1142 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
1143 | u32 reg; | ||
1144 | bool enabled = (value < IEEE80211_MAX_RTS_THRESHOLD); | ||
1145 | |||
1146 | rt2800_register_read(rt2x00dev, TX_RTS_CFG, ®); | ||
1147 | rt2x00_set_field32(®, TX_RTS_CFG_RTS_THRES, value); | ||
1148 | rt2800_register_write(rt2x00dev, TX_RTS_CFG, reg); | ||
1149 | |||
1150 | rt2800_register_read(rt2x00dev, CCK_PROT_CFG, ®); | ||
1151 | rt2x00_set_field32(®, CCK_PROT_CFG_RTS_TH_EN, enabled); | ||
1152 | rt2800_register_write(rt2x00dev, CCK_PROT_CFG, reg); | ||
1153 | |||
1154 | rt2800_register_read(rt2x00dev, OFDM_PROT_CFG, ®); | ||
1155 | rt2x00_set_field32(®, OFDM_PROT_CFG_RTS_TH_EN, enabled); | ||
1156 | rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); | ||
1157 | |||
1158 | rt2800_register_read(rt2x00dev, MM20_PROT_CFG, ®); | ||
1159 | rt2x00_set_field32(®, MM20_PROT_CFG_RTS_TH_EN, enabled); | ||
1160 | rt2800_register_write(rt2x00dev, MM20_PROT_CFG, reg); | ||
1161 | |||
1162 | rt2800_register_read(rt2x00dev, MM40_PROT_CFG, ®); | ||
1163 | rt2x00_set_field32(®, MM40_PROT_CFG_RTS_TH_EN, enabled); | ||
1164 | rt2800_register_write(rt2x00dev, MM40_PROT_CFG, reg); | ||
1165 | |||
1166 | rt2800_register_read(rt2x00dev, GF20_PROT_CFG, ®); | ||
1167 | rt2x00_set_field32(®, GF20_PROT_CFG_RTS_TH_EN, enabled); | ||
1168 | rt2800_register_write(rt2x00dev, GF20_PROT_CFG, reg); | ||
1169 | |||
1170 | rt2800_register_read(rt2x00dev, GF40_PROT_CFG, ®); | ||
1171 | rt2x00_set_field32(®, GF40_PROT_CFG_RTS_TH_EN, enabled); | ||
1172 | rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg); | ||
1173 | |||
1174 | return 0; | ||
1175 | } | ||
1176 | |||
1177 | static int rt2800usb_conf_tx(struct ieee80211_hw *hw, u16 queue_idx, | ||
1178 | const struct ieee80211_tx_queue_params *params) | ||
1179 | { | ||
1180 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
1181 | struct data_queue *queue; | ||
1182 | struct rt2x00_field32 field; | ||
1183 | int retval; | ||
1184 | u32 reg; | ||
1185 | u32 offset; | ||
1186 | |||
1187 | /* | ||
1188 | * First pass the configuration through rt2x00lib, that will | ||
1189 | * update the queue settings and validate the input. After that | ||
1190 | * we are free to update the registers based on the value | ||
1191 | * in the queue parameter. | ||
1192 | */ | ||
1193 | retval = rt2x00mac_conf_tx(hw, queue_idx, params); | ||
1194 | if (retval) | ||
1195 | return retval; | ||
1196 | |||
1197 | /* | ||
1198 | * We only need to perform additional register initialization | ||
1199 | * for WMM queues/ | ||
1200 | */ | ||
1201 | if (queue_idx >= 4) | ||
1202 | return 0; | ||
1203 | |||
1204 | queue = rt2x00queue_get_queue(rt2x00dev, queue_idx); | ||
1205 | |||
1206 | /* Update WMM TXOP register */ | ||
1207 | offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2))); | ||
1208 | field.bit_offset = (queue_idx & 1) * 16; | ||
1209 | field.bit_mask = 0xffff << field.bit_offset; | ||
1210 | |||
1211 | rt2800_register_read(rt2x00dev, offset, ®); | ||
1212 | rt2x00_set_field32(®, field, queue->txop); | ||
1213 | rt2800_register_write(rt2x00dev, offset, reg); | ||
1214 | |||
1215 | /* Update WMM registers */ | ||
1216 | field.bit_offset = queue_idx * 4; | ||
1217 | field.bit_mask = 0xf << field.bit_offset; | ||
1218 | |||
1219 | rt2800_register_read(rt2x00dev, WMM_AIFSN_CFG, ®); | ||
1220 | rt2x00_set_field32(®, field, queue->aifs); | ||
1221 | rt2800_register_write(rt2x00dev, WMM_AIFSN_CFG, reg); | ||
1222 | |||
1223 | rt2800_register_read(rt2x00dev, WMM_CWMIN_CFG, ®); | ||
1224 | rt2x00_set_field32(®, field, queue->cw_min); | ||
1225 | rt2800_register_write(rt2x00dev, WMM_CWMIN_CFG, reg); | ||
1226 | |||
1227 | rt2800_register_read(rt2x00dev, WMM_CWMAX_CFG, ®); | ||
1228 | rt2x00_set_field32(®, field, queue->cw_max); | ||
1229 | rt2800_register_write(rt2x00dev, WMM_CWMAX_CFG, reg); | ||
1230 | |||
1231 | /* Update EDCA registers */ | ||
1232 | offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx); | ||
1233 | |||
1234 | rt2800_register_read(rt2x00dev, offset, ®); | ||
1235 | rt2x00_set_field32(®, EDCA_AC0_CFG_TX_OP, queue->txop); | ||
1236 | rt2x00_set_field32(®, EDCA_AC0_CFG_AIFSN, queue->aifs); | ||
1237 | rt2x00_set_field32(®, EDCA_AC0_CFG_CWMIN, queue->cw_min); | ||
1238 | rt2x00_set_field32(®, EDCA_AC0_CFG_CWMAX, queue->cw_max); | ||
1239 | rt2800_register_write(rt2x00dev, offset, reg); | ||
1240 | |||
1241 | return 0; | ||
1242 | } | ||
1243 | |||
1244 | static u64 rt2800usb_get_tsf(struct ieee80211_hw *hw) | ||
1245 | { | ||
1246 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
1247 | u64 tsf; | ||
1248 | u32 reg; | ||
1249 | |||
1250 | rt2800_register_read(rt2x00dev, TSF_TIMER_DW1, ®); | ||
1251 | tsf = (u64) rt2x00_get_field32(reg, TSF_TIMER_DW1_HIGH_WORD) << 32; | ||
1252 | rt2800_register_read(rt2x00dev, TSF_TIMER_DW0, ®); | ||
1253 | tsf |= rt2x00_get_field32(reg, TSF_TIMER_DW0_LOW_WORD); | ||
1254 | |||
1255 | return tsf; | ||
1256 | } | ||
1257 | |||
1258 | static const struct ieee80211_ops rt2800usb_mac80211_ops = { | ||
1259 | .tx = rt2x00mac_tx, | ||
1260 | .start = rt2x00mac_start, | ||
1261 | .stop = rt2x00mac_stop, | ||
1262 | .add_interface = rt2x00mac_add_interface, | ||
1263 | .remove_interface = rt2x00mac_remove_interface, | ||
1264 | .config = rt2x00mac_config, | ||
1265 | .configure_filter = rt2x00mac_configure_filter, | ||
1266 | .set_tim = rt2x00mac_set_tim, | ||
1267 | .set_key = rt2x00mac_set_key, | ||
1268 | .get_stats = rt2x00mac_get_stats, | ||
1269 | .get_tkip_seq = rt2800usb_get_tkip_seq, | ||
1270 | .set_rts_threshold = rt2800usb_set_rts_threshold, | ||
1271 | .bss_info_changed = rt2x00mac_bss_info_changed, | ||
1272 | .conf_tx = rt2800usb_conf_tx, | ||
1273 | .get_tx_stats = rt2x00mac_get_tx_stats, | ||
1274 | .get_tsf = rt2800usb_get_tsf, | ||
1275 | .rfkill_poll = rt2x00mac_rfkill_poll, | ||
1276 | }; | ||
1277 | |||
1278 | static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { | 1122 | static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { |
1279 | .probe_hw = rt2800usb_probe_hw, | 1123 | .probe_hw = rt2800usb_probe_hw, |
1280 | .get_firmware_name = rt2800usb_get_firmware_name, | 1124 | .get_firmware_name = rt2800usb_get_firmware_name, |
@@ -1336,7 +1180,7 @@ static const struct rt2x00_ops rt2800usb_ops = { | |||
1336 | .tx = &rt2800usb_queue_tx, | 1180 | .tx = &rt2800usb_queue_tx, |
1337 | .bcn = &rt2800usb_queue_bcn, | 1181 | .bcn = &rt2800usb_queue_bcn, |
1338 | .lib = &rt2800usb_rt2x00_ops, | 1182 | .lib = &rt2800usb_rt2x00_ops, |
1339 | .hw = &rt2800usb_mac80211_ops, | 1183 | .hw = &rt2800_mac80211_ops, |
1340 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS | 1184 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS |
1341 | .debugfs = &rt2800_rt2x00debug, | 1185 | .debugfs = &rt2800_rt2x00debug, |
1342 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ | 1186 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ |