aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2800lib.c
diff options
context:
space:
mode:
authorGertjan van Wingerde <gwingerde@gmail.com>2010-04-11 08:31:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-12 15:22:12 -0400
commita9dce1494af33534867b8c7fab7351274fd651ca (patch)
treea468ca0ee8243cca745b5b1d2df54bcca0f72c78 /drivers/net/wireless/rt2x00/rt2800lib.c
parent8d0c9b65c904c6943566ccd2919c6a5ee6292c6b (diff)
rt2x00: Align rt2800 register initialization with vendor driver.
Align the rt2800 register initializations with the latest versions of the Ralink vendor driver. This patch is also preparation for the addition of support for RT3070 / RT3071 / RT3090 / RT3390 based devices. Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c130
1 files changed, 95 insertions, 35 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 8a4ed7642bcf..1890b9aea492 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -359,11 +359,6 @@ static int rt2800_blink_set(struct led_classdev *led_cdev,
359 rt2800_register_read(led->rt2x00dev, LED_CFG, &reg); 359 rt2800_register_read(led->rt2x00dev, LED_CFG, &reg);
360 rt2x00_set_field32(&reg, LED_CFG_ON_PERIOD, *delay_on); 360 rt2x00_set_field32(&reg, LED_CFG_ON_PERIOD, *delay_on);
361 rt2x00_set_field32(&reg, LED_CFG_OFF_PERIOD, *delay_off); 361 rt2x00_set_field32(&reg, LED_CFG_OFF_PERIOD, *delay_off);
362 rt2x00_set_field32(&reg, LED_CFG_SLOW_BLINK_PERIOD, 3);
363 rt2x00_set_field32(&reg, LED_CFG_R_LED_MODE, 3);
364 rt2x00_set_field32(&reg, LED_CFG_G_LED_MODE, 3);
365 rt2x00_set_field32(&reg, LED_CFG_Y_LED_MODE, 3);
366 rt2x00_set_field32(&reg, LED_CFG_LED_POLAR, 1);
367 rt2800_register_write(led->rt2x00dev, LED_CFG, reg); 362 rt2800_register_write(led->rt2x00dev, LED_CFG, reg);
368 363
369 return 0; 364 return 0;
@@ -609,10 +604,6 @@ void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp)
609{ 604{
610 u32 reg; 605 u32 reg;
611 606
612 rt2800_register_read(rt2x00dev, TX_TIMEOUT_CFG, &reg);
613 rt2x00_set_field32(&reg, TX_TIMEOUT_CFG_RX_ACK_TIMEOUT, 0x20);
614 rt2800_register_write(rt2x00dev, TX_TIMEOUT_CFG, reg);
615
616 rt2800_register_read(rt2x00dev, AUTO_RSP_CFG, &reg); 607 rt2800_register_read(rt2x00dev, AUTO_RSP_CFG, &reg);
617 rt2x00_set_field32(&reg, AUTO_RSP_CFG_BAC_ACK_POLICY, 608 rt2x00_set_field32(&reg, AUTO_RSP_CFG_BAC_ACK_POLICY,
618 !!erp->short_preamble); 609 !!erp->short_preamble);
@@ -631,15 +622,12 @@ void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp)
631 622
632 rt2800_register_read(rt2x00dev, BKOFF_SLOT_CFG, &reg); 623 rt2800_register_read(rt2x00dev, BKOFF_SLOT_CFG, &reg);
633 rt2x00_set_field32(&reg, BKOFF_SLOT_CFG_SLOT_TIME, erp->slot_time); 624 rt2x00_set_field32(&reg, BKOFF_SLOT_CFG_SLOT_TIME, erp->slot_time);
634 rt2x00_set_field32(&reg, BKOFF_SLOT_CFG_CC_DELAY_TIME, 2);
635 rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); 625 rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg);
636 626
637 rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, &reg); 627 rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, &reg);
638 rt2x00_set_field32(&reg, XIFS_TIME_CFG_CCKM_SIFS_TIME, erp->sifs); 628 rt2x00_set_field32(&reg, XIFS_TIME_CFG_CCKM_SIFS_TIME, erp->sifs);
639 rt2x00_set_field32(&reg, XIFS_TIME_CFG_OFDM_SIFS_TIME, erp->sifs); 629 rt2x00_set_field32(&reg, XIFS_TIME_CFG_OFDM_SIFS_TIME, erp->sifs);
640 rt2x00_set_field32(&reg, XIFS_TIME_CFG_OFDM_XIFS_TIME, 4);
641 rt2x00_set_field32(&reg, XIFS_TIME_CFG_EIFS, erp->eifs); 630 rt2x00_set_field32(&reg, XIFS_TIME_CFG_EIFS, erp->eifs);
642 rt2x00_set_field32(&reg, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1);
643 rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg); 631 rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg);
644 632
645 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg); 633 rt2800_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
@@ -984,10 +972,6 @@ static void rt2800_config_retry_limit(struct rt2x00_dev *rt2x00dev,
984 libconf->conf->short_frame_max_tx_count); 972 libconf->conf->short_frame_max_tx_count);
985 rt2x00_set_field32(&reg, TX_RTY_CFG_LONG_RTY_LIMIT, 973 rt2x00_set_field32(&reg, TX_RTY_CFG_LONG_RTY_LIMIT,
986 libconf->conf->long_frame_max_tx_count); 974 libconf->conf->long_frame_max_tx_count);
987 rt2x00_set_field32(&reg, TX_RTY_CFG_LONG_RTY_THRE, 2000);
988 rt2x00_set_field32(&reg, TX_RTY_CFG_NON_AGG_RTY_MODE, 0);
989 rt2x00_set_field32(&reg, TX_RTY_CFG_AGG_RTY_MODE, 0);
990 rt2x00_set_field32(&reg, TX_RTY_CFG_TX_AUTO_FB_ENABLE, 1);
991 rt2800_register_write(rt2x00dev, TX_RTY_CFG, reg); 975 rt2800_register_write(rt2x00dev, TX_RTY_CFG, reg);
992} 976}
993 977
@@ -1110,6 +1094,14 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1110 u32 reg; 1094 u32 reg;
1111 unsigned int i; 1095 unsigned int i;
1112 1096
1097 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
1098 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
1099 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_DMA_BUSY, 0);
1100 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
1101 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_RX_DMA_BUSY, 0);
1102 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
1103 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
1104
1113 if (rt2x00_is_usb(rt2x00dev)) { 1105 if (rt2x00_is_usb(rt2x00dev)) {
1114 /* 1106 /*
1115 * Wait until BBP and RF are ready. 1107 * Wait until BBP and RF are ready.
@@ -1129,8 +1121,25 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1129 rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, &reg); 1121 rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, &reg);
1130 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 1122 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL,
1131 reg & ~0x00002000); 1123 reg & ~0x00002000);
1132 } else if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) 1124 } else if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) {
1125 /*
1126 * Reset DMA indexes
1127 */
1128 rt2800_register_read(rt2x00dev, WPDMA_RST_IDX, &reg);
1129 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX0, 1);
1130 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX1, 1);
1131 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX2, 1);
1132 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX3, 1);
1133 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX4, 1);
1134 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DTX_IDX5, 1);
1135 rt2x00_set_field32(&reg, WPDMA_RST_IDX_DRX_IDX0, 1);
1136 rt2800_register_write(rt2x00dev, WPDMA_RST_IDX, reg);
1137
1138 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f);
1139 rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00);
1140
1133 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); 1141 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
1142 }
1134 1143
1135 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); 1144 rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
1136 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1); 1145 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
@@ -1175,6 +1184,13 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1175 rt2x00_set_field32(&reg, BCN_TIME_CFG_TX_TIME_COMPENSATE, 0); 1184 rt2x00_set_field32(&reg, BCN_TIME_CFG_TX_TIME_COMPENSATE, 0);
1176 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); 1185 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
1177 1186
1187 rt2800_config_filter(rt2x00dev, FIF_ALLMULTI);
1188
1189 rt2800_register_read(rt2x00dev, BKOFF_SLOT_CFG, &reg);
1190 rt2x00_set_field32(&reg, BKOFF_SLOT_CFG_SLOT_TIME, 9);
1191 rt2x00_set_field32(&reg, BKOFF_SLOT_CFG_CC_DELAY_TIME, 2);
1192 rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg);
1193
1178 if (rt2x00_is_usb(rt2x00dev) && 1194 if (rt2x00_is_usb(rt2x00dev) &&
1179 rt2x00_rt_rev(rt2x00dev, RT3070, REV_RT3070E)) { 1195 rt2x00_rt_rev(rt2x00dev, RT3070, REV_RT3070E)) {
1180 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); 1196 rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400);
@@ -1198,6 +1214,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1198 1214
1199 rt2800_register_read(rt2x00dev, TX_TIMEOUT_CFG, &reg); 1215 rt2800_register_read(rt2x00dev, TX_TIMEOUT_CFG, &reg);
1200 rt2x00_set_field32(&reg, TX_TIMEOUT_CFG_MPDU_LIFETIME, 9); 1216 rt2x00_set_field32(&reg, TX_TIMEOUT_CFG_MPDU_LIFETIME, 9);
1217 rt2x00_set_field32(&reg, TX_TIMEOUT_CFG_RX_ACK_TIMEOUT, 32);
1201 rt2x00_set_field32(&reg, TX_TIMEOUT_CFG_TX_OP_TIMEOUT, 10); 1218 rt2x00_set_field32(&reg, TX_TIMEOUT_CFG_TX_OP_TIMEOUT, 10);
1202 rt2800_register_write(rt2x00dev, TX_TIMEOUT_CFG, reg); 1219 rt2800_register_write(rt2x00dev, TX_TIMEOUT_CFG, reg);
1203 1220
@@ -1213,38 +1230,61 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1213 rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_MPDU, 0); 1230 rt2x00_set_field32(&reg, MAX_LEN_CFG_MIN_MPDU, 0);
1214 rt2800_register_write(rt2x00dev, MAX_LEN_CFG, reg); 1231 rt2800_register_write(rt2x00dev, MAX_LEN_CFG, reg);
1215 1232
1233 rt2800_register_read(rt2x00dev, LED_CFG, &reg);
1234 rt2x00_set_field32(&reg, LED_CFG_ON_PERIOD, 70);
1235 rt2x00_set_field32(&reg, LED_CFG_OFF_PERIOD, 30);
1236 rt2x00_set_field32(&reg, LED_CFG_SLOW_BLINK_PERIOD, 3);
1237 rt2x00_set_field32(&reg, LED_CFG_R_LED_MODE, 3);
1238 rt2x00_set_field32(&reg, LED_CFG_G_LED_MODE, 3);
1239 rt2x00_set_field32(&reg, LED_CFG_Y_LED_MODE, 3);
1240 rt2x00_set_field32(&reg, LED_CFG_LED_POLAR, 1);
1241 rt2800_register_write(rt2x00dev, LED_CFG, reg);
1242
1216 rt2800_register_write(rt2x00dev, PBF_MAX_PCNT, 0x1f3fbf9f); 1243 rt2800_register_write(rt2x00dev, PBF_MAX_PCNT, 0x1f3fbf9f);
1217 1244
1245 rt2800_register_read(rt2x00dev, TX_RTY_CFG, &reg);
1246 rt2x00_set_field32(&reg, TX_RTY_CFG_SHORT_RTY_LIMIT, 15);
1247 rt2x00_set_field32(&reg, TX_RTY_CFG_LONG_RTY_LIMIT, 31);
1248 rt2x00_set_field32(&reg, TX_RTY_CFG_LONG_RTY_THRE, 2000);
1249 rt2x00_set_field32(&reg, TX_RTY_CFG_NON_AGG_RTY_MODE, 0);
1250 rt2x00_set_field32(&reg, TX_RTY_CFG_AGG_RTY_MODE, 0);
1251 rt2x00_set_field32(&reg, TX_RTY_CFG_TX_AUTO_FB_ENABLE, 1);
1252 rt2800_register_write(rt2x00dev, TX_RTY_CFG, reg);
1253
1218 rt2800_register_read(rt2x00dev, AUTO_RSP_CFG, &reg); 1254 rt2800_register_read(rt2x00dev, AUTO_RSP_CFG, &reg);
1219 rt2x00_set_field32(&reg, AUTO_RSP_CFG_AUTORESPONDER, 1); 1255 rt2x00_set_field32(&reg, AUTO_RSP_CFG_AUTORESPONDER, 1);
1256 rt2x00_set_field32(&reg, AUTO_RSP_CFG_BAC_ACK_POLICY, 1);
1220 rt2x00_set_field32(&reg, AUTO_RSP_CFG_CTS_40_MMODE, 0); 1257 rt2x00_set_field32(&reg, AUTO_RSP_CFG_CTS_40_MMODE, 0);
1221 rt2x00_set_field32(&reg, AUTO_RSP_CFG_CTS_40_MREF, 0); 1258 rt2x00_set_field32(&reg, AUTO_RSP_CFG_CTS_40_MREF, 0);
1259 rt2x00_set_field32(&reg, AUTO_RSP_CFG_AR_PREAMBLE, 1);
1222 rt2x00_set_field32(&reg, AUTO_RSP_CFG_DUAL_CTS_EN, 0); 1260 rt2x00_set_field32(&reg, AUTO_RSP_CFG_DUAL_CTS_EN, 0);
1223 rt2x00_set_field32(&reg, AUTO_RSP_CFG_ACK_CTS_PSM_BIT, 0); 1261 rt2x00_set_field32(&reg, AUTO_RSP_CFG_ACK_CTS_PSM_BIT, 0);
1224 rt2800_register_write(rt2x00dev, AUTO_RSP_CFG, reg); 1262 rt2800_register_write(rt2x00dev, AUTO_RSP_CFG, reg);
1225 1263
1226 rt2800_register_read(rt2x00dev, CCK_PROT_CFG, &reg); 1264 rt2800_register_read(rt2x00dev, CCK_PROT_CFG, &reg);
1227 rt2x00_set_field32(&reg, CCK_PROT_CFG_PROTECT_RATE, 8); 1265 rt2x00_set_field32(&reg, CCK_PROT_CFG_PROTECT_RATE, 3);
1228 rt2x00_set_field32(&reg, CCK_PROT_CFG_PROTECT_CTRL, 0); 1266 rt2x00_set_field32(&reg, CCK_PROT_CFG_PROTECT_CTRL, 0);
1229 rt2x00_set_field32(&reg, CCK_PROT_CFG_PROTECT_NAV, 1); 1267 rt2x00_set_field32(&reg, CCK_PROT_CFG_PROTECT_NAV, 1);
1230 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_CCK, 1); 1268 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_CCK, 1);
1231 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_OFDM, 1); 1269 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_OFDM, 1);
1232 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_MM20, 1); 1270 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_MM20, 1);
1233 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_MM40, 1); 1271 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_MM40, 0);
1234 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_GF20, 1); 1272 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_GF20, 1);
1235 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_GF40, 1); 1273 rt2x00_set_field32(&reg, CCK_PROT_CFG_TX_OP_ALLOW_GF40, 0);
1274 rt2x00_set_field32(&reg, CCK_PROT_CFG_RTS_TH_EN, 1);
1236 rt2800_register_write(rt2x00dev, CCK_PROT_CFG, reg); 1275 rt2800_register_write(rt2x00dev, CCK_PROT_CFG, reg);
1237 1276
1238 rt2800_register_read(rt2x00dev, OFDM_PROT_CFG, &reg); 1277 rt2800_register_read(rt2x00dev, OFDM_PROT_CFG, &reg);
1239 rt2x00_set_field32(&reg, OFDM_PROT_CFG_PROTECT_RATE, 8); 1278 rt2x00_set_field32(&reg, OFDM_PROT_CFG_PROTECT_RATE, 3);
1240 rt2x00_set_field32(&reg, OFDM_PROT_CFG_PROTECT_CTRL, 0); 1279 rt2x00_set_field32(&reg, OFDM_PROT_CFG_PROTECT_CTRL, 0);
1241 rt2x00_set_field32(&reg, OFDM_PROT_CFG_PROTECT_NAV, 1); 1280 rt2x00_set_field32(&reg, OFDM_PROT_CFG_PROTECT_NAV, 1);
1242 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_CCK, 1); 1281 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_CCK, 1);
1243 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_OFDM, 1); 1282 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_OFDM, 1);
1244 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_MM20, 1); 1283 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_MM20, 1);
1245 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_MM40, 1); 1284 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_MM40, 0);
1246 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_GF20, 1); 1285 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_GF20, 1);
1247 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_GF40, 1); 1286 rt2x00_set_field32(&reg, OFDM_PROT_CFG_TX_OP_ALLOW_GF40, 0);
1287 rt2x00_set_field32(&reg, OFDM_PROT_CFG_RTS_TH_EN, 1);
1248 rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); 1288 rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg);
1249 1289
1250 rt2800_register_read(rt2x00dev, MM20_PROT_CFG, &reg); 1290 rt2800_register_read(rt2x00dev, MM20_PROT_CFG, &reg);
@@ -1257,11 +1297,13 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1257 rt2x00_set_field32(&reg, MM20_PROT_CFG_TX_OP_ALLOW_MM40, 0); 1297 rt2x00_set_field32(&reg, MM20_PROT_CFG_TX_OP_ALLOW_MM40, 0);
1258 rt2x00_set_field32(&reg, MM20_PROT_CFG_TX_OP_ALLOW_GF20, 1); 1298 rt2x00_set_field32(&reg, MM20_PROT_CFG_TX_OP_ALLOW_GF20, 1);
1259 rt2x00_set_field32(&reg, MM20_PROT_CFG_TX_OP_ALLOW_GF40, 0); 1299 rt2x00_set_field32(&reg, MM20_PROT_CFG_TX_OP_ALLOW_GF40, 0);
1300 rt2x00_set_field32(&reg, MM20_PROT_CFG_RTS_TH_EN, 0);
1260 rt2800_register_write(rt2x00dev, MM20_PROT_CFG, reg); 1301 rt2800_register_write(rt2x00dev, MM20_PROT_CFG, reg);
1261 1302
1262 rt2800_register_read(rt2x00dev, MM40_PROT_CFG, &reg); 1303 rt2800_register_read(rt2x00dev, MM40_PROT_CFG, &reg);
1263 rt2x00_set_field32(&reg, MM40_PROT_CFG_PROTECT_RATE, 0x4084); 1304 rt2x00_set_field32(&reg, MM40_PROT_CFG_PROTECT_RATE, 0x4084);
1264 rt2x00_set_field32(&reg, MM40_PROT_CFG_PROTECT_CTRL, 0); 1305 rt2x00_set_field32(&reg, MM40_PROT_CFG_PROTECT_CTRL,
1306 !rt2x00_is_usb(rt2x00dev));
1265 rt2x00_set_field32(&reg, MM40_PROT_CFG_PROTECT_NAV, 1); 1307 rt2x00_set_field32(&reg, MM40_PROT_CFG_PROTECT_NAV, 1);
1266 rt2x00_set_field32(&reg, MM40_PROT_CFG_TX_OP_ALLOW_CCK, 1); 1308 rt2x00_set_field32(&reg, MM40_PROT_CFG_TX_OP_ALLOW_CCK, 1);
1267 rt2x00_set_field32(&reg, MM40_PROT_CFG_TX_OP_ALLOW_OFDM, 1); 1309 rt2x00_set_field32(&reg, MM40_PROT_CFG_TX_OP_ALLOW_OFDM, 1);
@@ -1269,6 +1311,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1269 rt2x00_set_field32(&reg, MM40_PROT_CFG_TX_OP_ALLOW_MM40, 1); 1311 rt2x00_set_field32(&reg, MM40_PROT_CFG_TX_OP_ALLOW_MM40, 1);
1270 rt2x00_set_field32(&reg, MM40_PROT_CFG_TX_OP_ALLOW_GF20, 1); 1312 rt2x00_set_field32(&reg, MM40_PROT_CFG_TX_OP_ALLOW_GF20, 1);
1271 rt2x00_set_field32(&reg, MM40_PROT_CFG_TX_OP_ALLOW_GF40, 1); 1313 rt2x00_set_field32(&reg, MM40_PROT_CFG_TX_OP_ALLOW_GF40, 1);
1314 rt2x00_set_field32(&reg, MM40_PROT_CFG_RTS_TH_EN, 0);
1272 rt2800_register_write(rt2x00dev, MM40_PROT_CFG, reg); 1315 rt2800_register_write(rt2x00dev, MM40_PROT_CFG, reg);
1273 1316
1274 rt2800_register_read(rt2x00dev, GF20_PROT_CFG, &reg); 1317 rt2800_register_read(rt2x00dev, GF20_PROT_CFG, &reg);
@@ -1281,6 +1324,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1281 rt2x00_set_field32(&reg, GF20_PROT_CFG_TX_OP_ALLOW_MM40, 0); 1324 rt2x00_set_field32(&reg, GF20_PROT_CFG_TX_OP_ALLOW_MM40, 0);
1282 rt2x00_set_field32(&reg, GF20_PROT_CFG_TX_OP_ALLOW_GF20, 1); 1325 rt2x00_set_field32(&reg, GF20_PROT_CFG_TX_OP_ALLOW_GF20, 1);
1283 rt2x00_set_field32(&reg, GF20_PROT_CFG_TX_OP_ALLOW_GF40, 0); 1326 rt2x00_set_field32(&reg, GF20_PROT_CFG_TX_OP_ALLOW_GF40, 0);
1327 rt2x00_set_field32(&reg, GF20_PROT_CFG_RTS_TH_EN, 0);
1284 rt2800_register_write(rt2x00dev, GF20_PROT_CFG, reg); 1328 rt2800_register_write(rt2x00dev, GF20_PROT_CFG, reg);
1285 1329
1286 rt2800_register_read(rt2x00dev, GF40_PROT_CFG, &reg); 1330 rt2800_register_read(rt2x00dev, GF40_PROT_CFG, &reg);
@@ -1293,6 +1337,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1293 rt2x00_set_field32(&reg, GF40_PROT_CFG_TX_OP_ALLOW_MM40, 1); 1337 rt2x00_set_field32(&reg, GF40_PROT_CFG_TX_OP_ALLOW_MM40, 1);
1294 rt2x00_set_field32(&reg, GF40_PROT_CFG_TX_OP_ALLOW_GF20, 1); 1338 rt2x00_set_field32(&reg, GF40_PROT_CFG_TX_OP_ALLOW_GF20, 1);
1295 rt2x00_set_field32(&reg, GF40_PROT_CFG_TX_OP_ALLOW_GF40, 1); 1339 rt2x00_set_field32(&reg, GF40_PROT_CFG_TX_OP_ALLOW_GF40, 1);
1340 rt2x00_set_field32(&reg, GF40_PROT_CFG_RTS_TH_EN, 0);
1296 rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg); 1341 rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg);
1297 1342
1298 if (rt2x00_is_usb(rt2x00dev)) { 1343 if (rt2x00_is_usb(rt2x00dev)) {
@@ -1322,6 +1367,15 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1322 rt2800_register_write(rt2x00dev, TX_RTS_CFG, reg); 1367 rt2800_register_write(rt2x00dev, TX_RTS_CFG, reg);
1323 1368
1324 rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca); 1369 rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca);
1370
1371 rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, &reg);
1372 rt2x00_set_field32(&reg, XIFS_TIME_CFG_CCKM_SIFS_TIME, 32);
1373 rt2x00_set_field32(&reg, XIFS_TIME_CFG_OFDM_SIFS_TIME, 32);
1374 rt2x00_set_field32(&reg, XIFS_TIME_CFG_OFDM_XIFS_TIME, 4);
1375 rt2x00_set_field32(&reg, XIFS_TIME_CFG_EIFS, 314);
1376 rt2x00_set_field32(&reg, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1);
1377 rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg);
1378
1325 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); 1379 rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
1326 1380
1327 /* 1381 /*
@@ -1471,26 +1525,32 @@ int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
1471 1525
1472 rt2800_bbp_write(rt2x00dev, 65, 0x2c); 1526 rt2800_bbp_write(rt2x00dev, 65, 0x2c);
1473 rt2800_bbp_write(rt2x00dev, 66, 0x38); 1527 rt2800_bbp_write(rt2x00dev, 66, 0x38);
1474 rt2800_bbp_write(rt2x00dev, 69, 0x12); 1528
1529 if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) {
1530 rt2800_bbp_write(rt2x00dev, 69, 0x16);
1531 rt2800_bbp_write(rt2x00dev, 73, 0x12);
1532 } else {
1533 rt2800_bbp_write(rt2x00dev, 69, 0x12);
1534 rt2800_bbp_write(rt2x00dev, 73, 0x10);
1535 }
1536
1475 rt2800_bbp_write(rt2x00dev, 70, 0x0a); 1537 rt2800_bbp_write(rt2x00dev, 70, 0x0a);
1476 rt2800_bbp_write(rt2x00dev, 73, 0x10);
1477 rt2800_bbp_write(rt2x00dev, 81, 0x37); 1538 rt2800_bbp_write(rt2x00dev, 81, 0x37);
1478 rt2800_bbp_write(rt2x00dev, 82, 0x62); 1539 rt2800_bbp_write(rt2x00dev, 82, 0x62);
1479 rt2800_bbp_write(rt2x00dev, 83, 0x6a); 1540 rt2800_bbp_write(rt2x00dev, 83, 0x6a);
1480 rt2800_bbp_write(rt2x00dev, 84, 0x99); 1541
1542 if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860D) ||
1543 rt2x00_rt_rev(rt2x00dev, RT2870, REV_RT2870D))
1544 rt2800_bbp_write(rt2x00dev, 84, 0x19);
1545 else
1546 rt2800_bbp_write(rt2x00dev, 84, 0x99);
1547
1481 rt2800_bbp_write(rt2x00dev, 86, 0x00); 1548 rt2800_bbp_write(rt2x00dev, 86, 0x00);
1482 rt2800_bbp_write(rt2x00dev, 91, 0x04); 1549 rt2800_bbp_write(rt2x00dev, 91, 0x04);
1483 rt2800_bbp_write(rt2x00dev, 92, 0x00); 1550 rt2800_bbp_write(rt2x00dev, 92, 0x00);
1484 rt2800_bbp_write(rt2x00dev, 103, 0x00); 1551 rt2800_bbp_write(rt2x00dev, 103, 0x00);
1485 rt2800_bbp_write(rt2x00dev, 105, 0x05); 1552 rt2800_bbp_write(rt2x00dev, 105, 0x05);
1486 1553 rt2800_bbp_write(rt2x00dev, 106, 0x35);
1487 if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) {
1488 rt2800_bbp_write(rt2x00dev, 69, 0x16);
1489 rt2800_bbp_write(rt2x00dev, 73, 0x12);
1490 }
1491
1492 if (rt2x00_rt_rev_gte(rt2x00dev, RT2860, REV_RT2860D))
1493 rt2800_bbp_write(rt2x00dev, 84, 0x19);
1494 1554
1495 if (rt2x00_rt(rt2x00dev, RT2872)) { 1555 if (rt2x00_rt(rt2x00dev, RT2872)) {
1496 rt2800_bbp_write(rt2x00dev, 31, 0x08); 1556 rt2800_bbp_write(rt2x00dev, 31, 0x08);