aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c98
1 files changed, 52 insertions, 46 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 0a54b651220..6a558bf74f1 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -246,53 +246,53 @@ static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)
246/* 246/*
247 * Configuration handlers. 247 * Configuration handlers.
248 */ 248 */
249static void rt2500pci_config_mac_addr(struct rt2x00_dev *rt2x00dev, 249static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev,
250 __le32 *mac) 250 struct rt2x00_intf *intf,
251{ 251 struct rt2x00intf_conf *conf,
252 rt2x00pci_register_multiwrite(rt2x00dev, CSR3, mac, 252 const unsigned int flags)
253 (2 * sizeof(__le32)));
254}
255
256static void rt2500pci_config_bssid(struct rt2x00_dev *rt2x00dev,
257 __le32 *bssid)
258{
259 rt2x00pci_register_multiwrite(rt2x00dev, CSR5, bssid,
260 (2 * sizeof(__le32)));
261}
262
263static void rt2500pci_config_type(struct rt2x00_dev *rt2x00dev, const int type,
264 const int tsf_sync)
265{ 253{
266 struct data_queue *queue = 254 struct data_queue *queue =
267 rt2x00queue_get_queue(rt2x00dev, IEEE80211_TX_QUEUE_BEACON); 255 rt2x00queue_get_queue(rt2x00dev, IEEE80211_TX_QUEUE_BEACON);
256 unsigned int bcn_preload;
268 u32 reg; 257 u32 reg;
269 258
270 rt2x00pci_register_write(rt2x00dev, CSR14, 0); 259 if (flags & CONFIG_UPDATE_TYPE) {
260 rt2x00pci_register_write(rt2x00dev, CSR14, 0);
271 261
272 /* 262 /*
273 * Enable beacon config 263 * Enable beacon config
274 */ 264 */
275 rt2x00pci_register_read(rt2x00dev, BCNCSR1, &reg); 265 bcn_preload = PREAMBLE + get_duration(IEEE80211_HEADER, 20);
276 rt2x00_set_field32(&reg, BCNCSR1_PRELOAD, 266 rt2x00pci_register_read(rt2x00dev, BCNCSR1, &reg);
277 PREAMBLE + get_duration(IEEE80211_HEADER, 20)); 267 rt2x00_set_field32(&reg, BCNCSR1_PRELOAD, bcn_preload);
278 rt2x00_set_field32(&reg, BCNCSR1_BEACON_CWMIN, queue->cw_min); 268 rt2x00_set_field32(&reg, BCNCSR1_BEACON_CWMIN, queue->cw_min);
279 rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg); 269 rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg);
280 270
281 /* 271 /*
282 * Enable synchronisation. 272 * Enable synchronisation.
283 */ 273 */
284 rt2x00pci_register_read(rt2x00dev, CSR14, &reg); 274 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
285 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1); 275 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 1);
286 rt2x00_set_field32(&reg, CSR14_TBCN, (tsf_sync == TSF_SYNC_BEACON)); 276 rt2x00_set_field32(&reg, CSR14_TBCN,
287 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0); 277 (conf->sync == TSF_SYNC_BEACON));
288 rt2x00_set_field32(&reg, CSR14_TSF_SYNC, tsf_sync); 278 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
289 rt2x00pci_register_write(rt2x00dev, CSR14, reg); 279 rt2x00_set_field32(&reg, CSR14_TSF_SYNC, conf->sync);
280 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
281 }
282
283 if (flags & CONFIG_UPDATE_MAC)
284 rt2x00pci_register_multiwrite(rt2x00dev, CSR3,
285 conf->mac, sizeof(conf->mac));
286
287 if (flags & CONFIG_UPDATE_BSSID)
288 rt2x00pci_register_multiwrite(rt2x00dev, CSR5,
289 conf->bssid, sizeof(conf->bssid));
290} 290}
291 291
292static void rt2500pci_config_preamble(struct rt2x00_dev *rt2x00dev, 292static int rt2500pci_config_preamble(struct rt2x00_dev *rt2x00dev,
293 const int short_preamble, 293 const int short_preamble,
294 const int ack_timeout, 294 const int ack_timeout,
295 const int ack_consume_time) 295 const int ack_consume_time)
296{ 296{
297 int preamble_mask; 297 int preamble_mask;
298 u32 reg; 298 u32 reg;
@@ -330,6 +330,8 @@ static void rt2500pci_config_preamble(struct rt2x00_dev *rt2x00dev,
330 rt2x00_set_field32(&reg, ARCSR5_SERVICE, 0x84); 330 rt2x00_set_field32(&reg, ARCSR5_SERVICE, 0x84);
331 rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110)); 331 rt2x00_set_field32(&reg, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110));
332 rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); 332 rt2x00pci_register_write(rt2x00dev, ARCSR5, reg);
333
334 return 0;
333} 335}
334 336
335static void rt2500pci_config_phymode(struct rt2x00_dev *rt2x00dev, 337static void rt2500pci_config_phymode(struct rt2x00_dev *rt2x00dev,
@@ -529,8 +531,8 @@ static void rt2500pci_config_duration(struct rt2x00_dev *rt2x00dev,
529} 531}
530 532
531static void rt2500pci_config(struct rt2x00_dev *rt2x00dev, 533static void rt2500pci_config(struct rt2x00_dev *rt2x00dev,
532 const unsigned int flags, 534 struct rt2x00lib_conf *libconf,
533 struct rt2x00lib_conf *libconf) 535 const unsigned int flags)
534{ 536{
535 if (flags & CONFIG_UPDATE_PHYMODE) 537 if (flags & CONFIG_UPDATE_PHYMODE)
536 rt2500pci_config_phymode(rt2x00dev, libconf->basic_rates); 538 rt2500pci_config_phymode(rt2x00dev, libconf->basic_rates);
@@ -609,9 +611,10 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev)
609 /* 611 /*
610 * To prevent collisions with MAC ASIC on chipsets 612 * To prevent collisions with MAC ASIC on chipsets
611 * up to version C the link tuning should halt after 20 613 * up to version C the link tuning should halt after 20
612 * seconds. 614 * seconds while being associated.
613 */ 615 */
614 if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D && 616 if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D &&
617 rt2x00dev->intf_associated &&
615 rt2x00dev->link.count > 20) 618 rt2x00dev->link.count > 20)
616 return; 619 return;
617 620
@@ -619,9 +622,12 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev)
619 622
620 /* 623 /*
621 * Chipset versions C and lower should directly continue 624 * Chipset versions C and lower should directly continue
622 * to the dynamic CCA tuning. 625 * to the dynamic CCA tuning. Chipset version D and higher
626 * should go straight to dynamic CCA tuning when they
627 * are not associated.
623 */ 628 */
624 if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D) 629 if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D ||
630 !rt2x00dev->intf_associated)
625 goto dynamic_cca_tune; 631 goto dynamic_cca_tune;
626 632
627 /* 633 /*
@@ -1861,9 +1867,7 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
1861 .write_tx_data = rt2x00pci_write_tx_data, 1867 .write_tx_data = rt2x00pci_write_tx_data,
1862 .kick_tx_queue = rt2500pci_kick_tx_queue, 1868 .kick_tx_queue = rt2500pci_kick_tx_queue,
1863 .fill_rxdone = rt2500pci_fill_rxdone, 1869 .fill_rxdone = rt2500pci_fill_rxdone,
1864 .config_mac_addr = rt2500pci_config_mac_addr, 1870 .config_intf = rt2500pci_config_intf,
1865 .config_bssid = rt2500pci_config_bssid,
1866 .config_type = rt2500pci_config_type,
1867 .config_preamble = rt2500pci_config_preamble, 1871 .config_preamble = rt2500pci_config_preamble,
1868 .config = rt2500pci_config, 1872 .config = rt2500pci_config,
1869}; 1873};
@@ -1898,6 +1902,8 @@ static const struct data_queue_desc rt2500pci_queue_atim = {
1898 1902
1899static const struct rt2x00_ops rt2500pci_ops = { 1903static const struct rt2x00_ops rt2500pci_ops = {
1900 .name = KBUILD_MODNAME, 1904 .name = KBUILD_MODNAME,
1905 .max_sta_intf = 1,
1906 .max_ap_intf = 1,
1901 .eeprom_size = EEPROM_SIZE, 1907 .eeprom_size = EEPROM_SIZE,
1902 .rf_size = RF_SIZE, 1908 .rf_size = RF_SIZE,
1903 .rx = &rt2500pci_queue_rx, 1909 .rx = &rt2500pci_queue_rx,