diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 154 |
1 files changed, 86 insertions, 68 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index c2a555d5376b..2214c3231727 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -327,7 +327,8 @@ static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev, | |||
327 | } | 327 | } |
328 | 328 | ||
329 | static void rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev, | 329 | static void rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev, |
330 | struct rt2x00lib_erp *erp) | 330 | struct rt2x00lib_erp *erp, |
331 | u32 changed) | ||
331 | { | 332 | { |
332 | int preamble_mask; | 333 | int preamble_mask; |
333 | u32 reg; | 334 | u32 reg; |
@@ -335,59 +336,73 @@ static void rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev, | |||
335 | /* | 336 | /* |
336 | * When short preamble is enabled, we should set bit 0x08 | 337 | * When short preamble is enabled, we should set bit 0x08 |
337 | */ | 338 | */ |
338 | preamble_mask = erp->short_preamble << 3; | 339 | if (changed & BSS_CHANGED_ERP_PREAMBLE) { |
339 | 340 | preamble_mask = erp->short_preamble << 3; | |
340 | rt2x00pci_register_read(rt2x00dev, TXCSR1, ®); | 341 | |
341 | rt2x00_set_field32(®, TXCSR1_ACK_TIMEOUT, 0x162); | 342 | rt2x00pci_register_read(rt2x00dev, TXCSR1, ®); |
342 | rt2x00_set_field32(®, TXCSR1_ACK_CONSUME_TIME, 0xa2); | 343 | rt2x00_set_field32(®, TXCSR1_ACK_TIMEOUT, 0x162); |
343 | rt2x00_set_field32(®, TXCSR1_TSF_OFFSET, IEEE80211_HEADER); | 344 | rt2x00_set_field32(®, TXCSR1_ACK_CONSUME_TIME, 0xa2); |
344 | rt2x00_set_field32(®, TXCSR1_AUTORESPONDER, 1); | 345 | rt2x00_set_field32(®, TXCSR1_TSF_OFFSET, IEEE80211_HEADER); |
345 | rt2x00pci_register_write(rt2x00dev, TXCSR1, reg); | 346 | rt2x00_set_field32(®, TXCSR1_AUTORESPONDER, 1); |
346 | 347 | rt2x00pci_register_write(rt2x00dev, TXCSR1, reg); | |
347 | rt2x00pci_register_read(rt2x00dev, ARCSR2, ®); | 348 | |
348 | rt2x00_set_field32(®, ARCSR2_SIGNAL, 0x00); | 349 | rt2x00pci_register_read(rt2x00dev, ARCSR2, ®); |
349 | rt2x00_set_field32(®, ARCSR2_SERVICE, 0x04); | 350 | rt2x00_set_field32(®, ARCSR2_SIGNAL, 0x00); |
350 | rt2x00_set_field32(®, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 10)); | 351 | rt2x00_set_field32(®, ARCSR2_SERVICE, 0x04); |
351 | rt2x00pci_register_write(rt2x00dev, ARCSR2, reg); | 352 | rt2x00_set_field32(®, ARCSR2_LENGTH, |
352 | 353 | GET_DURATION(ACK_SIZE, 10)); | |
353 | rt2x00pci_register_read(rt2x00dev, ARCSR3, ®); | 354 | rt2x00pci_register_write(rt2x00dev, ARCSR2, reg); |
354 | rt2x00_set_field32(®, ARCSR3_SIGNAL, 0x01 | preamble_mask); | 355 | |
355 | rt2x00_set_field32(®, ARCSR3_SERVICE, 0x04); | 356 | rt2x00pci_register_read(rt2x00dev, ARCSR3, ®); |
356 | rt2x00_set_field32(®, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 20)); | 357 | rt2x00_set_field32(®, ARCSR3_SIGNAL, 0x01 | preamble_mask); |
357 | rt2x00pci_register_write(rt2x00dev, ARCSR3, reg); | 358 | rt2x00_set_field32(®, ARCSR3_SERVICE, 0x04); |
358 | 359 | rt2x00_set_field32(®, ARCSR2_LENGTH, | |
359 | rt2x00pci_register_read(rt2x00dev, ARCSR4, ®); | 360 | GET_DURATION(ACK_SIZE, 20)); |
360 | rt2x00_set_field32(®, ARCSR4_SIGNAL, 0x02 | preamble_mask); | 361 | rt2x00pci_register_write(rt2x00dev, ARCSR3, reg); |
361 | rt2x00_set_field32(®, ARCSR4_SERVICE, 0x04); | 362 | |
362 | rt2x00_set_field32(®, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 55)); | 363 | rt2x00pci_register_read(rt2x00dev, ARCSR4, ®); |
363 | rt2x00pci_register_write(rt2x00dev, ARCSR4, reg); | 364 | rt2x00_set_field32(®, ARCSR4_SIGNAL, 0x02 | preamble_mask); |
364 | 365 | rt2x00_set_field32(®, ARCSR4_SERVICE, 0x04); | |
365 | rt2x00pci_register_read(rt2x00dev, ARCSR5, ®); | 366 | rt2x00_set_field32(®, ARCSR2_LENGTH, |
366 | rt2x00_set_field32(®, ARCSR5_SIGNAL, 0x03 | preamble_mask); | 367 | GET_DURATION(ACK_SIZE, 55)); |
367 | rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84); | 368 | rt2x00pci_register_write(rt2x00dev, ARCSR4, reg); |
368 | rt2x00_set_field32(®, ARCSR2_LENGTH, GET_DURATION(ACK_SIZE, 110)); | 369 | |
369 | rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); | 370 | rt2x00pci_register_read(rt2x00dev, ARCSR5, ®); |
370 | 371 | rt2x00_set_field32(®, ARCSR5_SIGNAL, 0x03 | preamble_mask); | |
371 | rt2x00pci_register_write(rt2x00dev, ARCSR1, erp->basic_rates); | 372 | rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84); |
373 | rt2x00_set_field32(®, ARCSR2_LENGTH, | ||
374 | GET_DURATION(ACK_SIZE, 110)); | ||
375 | rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); | ||
376 | } | ||
372 | 377 | ||
373 | rt2x00pci_register_read(rt2x00dev, CSR11, ®); | 378 | if (changed & BSS_CHANGED_BASIC_RATES) |
374 | rt2x00_set_field32(®, CSR11_SLOT_TIME, erp->slot_time); | 379 | rt2x00pci_register_write(rt2x00dev, ARCSR1, erp->basic_rates); |
375 | rt2x00pci_register_write(rt2x00dev, CSR11, reg); | ||
376 | 380 | ||
377 | rt2x00pci_register_read(rt2x00dev, CSR12, ®); | 381 | if (changed & BSS_CHANGED_ERP_SLOT) { |
378 | rt2x00_set_field32(®, CSR12_BEACON_INTERVAL, erp->beacon_int * 16); | 382 | rt2x00pci_register_read(rt2x00dev, CSR11, ®); |
379 | rt2x00_set_field32(®, CSR12_CFP_MAX_DURATION, erp->beacon_int * 16); | 383 | rt2x00_set_field32(®, CSR11_SLOT_TIME, erp->slot_time); |
380 | rt2x00pci_register_write(rt2x00dev, CSR12, reg); | 384 | rt2x00pci_register_write(rt2x00dev, CSR11, reg); |
381 | 385 | ||
382 | rt2x00pci_register_read(rt2x00dev, CSR18, ®); | 386 | rt2x00pci_register_read(rt2x00dev, CSR18, ®); |
383 | rt2x00_set_field32(®, CSR18_SIFS, erp->sifs); | 387 | rt2x00_set_field32(®, CSR18_SIFS, erp->sifs); |
384 | rt2x00_set_field32(®, CSR18_PIFS, erp->pifs); | 388 | rt2x00_set_field32(®, CSR18_PIFS, erp->pifs); |
385 | rt2x00pci_register_write(rt2x00dev, CSR18, reg); | 389 | rt2x00pci_register_write(rt2x00dev, CSR18, reg); |
390 | |||
391 | rt2x00pci_register_read(rt2x00dev, CSR19, ®); | ||
392 | rt2x00_set_field32(®, CSR19_DIFS, erp->difs); | ||
393 | rt2x00_set_field32(®, CSR19_EIFS, erp->eifs); | ||
394 | rt2x00pci_register_write(rt2x00dev, CSR19, reg); | ||
395 | } | ||
396 | |||
397 | if (changed & BSS_CHANGED_BEACON_INT) { | ||
398 | rt2x00pci_register_read(rt2x00dev, CSR12, ®); | ||
399 | rt2x00_set_field32(®, CSR12_BEACON_INTERVAL, | ||
400 | erp->beacon_int * 16); | ||
401 | rt2x00_set_field32(®, CSR12_CFP_MAX_DURATION, | ||
402 | erp->beacon_int * 16); | ||
403 | rt2x00pci_register_write(rt2x00dev, CSR12, reg); | ||
404 | } | ||
386 | 405 | ||
387 | rt2x00pci_register_read(rt2x00dev, CSR19, ®); | ||
388 | rt2x00_set_field32(®, CSR19_DIFS, erp->difs); | ||
389 | rt2x00_set_field32(®, CSR19_EIFS, erp->eifs); | ||
390 | rt2x00pci_register_write(rt2x00dev, CSR19, reg); | ||
391 | } | 406 | } |
392 | 407 | ||
393 | static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev, | 408 | static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev, |
@@ -1161,12 +1176,11 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
1161 | /* | 1176 | /* |
1162 | * TX descriptor initialization | 1177 | * TX descriptor initialization |
1163 | */ | 1178 | */ |
1164 | static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | 1179 | static void rt2500pci_write_tx_desc(struct queue_entry *entry, |
1165 | struct sk_buff *skb, | ||
1166 | struct txentry_desc *txdesc) | 1180 | struct txentry_desc *txdesc) |
1167 | { | 1181 | { |
1168 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1182 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
1169 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; | 1183 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
1170 | __le32 *txd = entry_priv->desc; | 1184 | __le32 *txd = entry_priv->desc; |
1171 | u32 word; | 1185 | u32 word; |
1172 | 1186 | ||
@@ -1249,7 +1263,7 @@ static void rt2500pci_write_beacon(struct queue_entry *entry, | |||
1249 | /* | 1263 | /* |
1250 | * Write the TX descriptor for the beacon. | 1264 | * Write the TX descriptor for the beacon. |
1251 | */ | 1265 | */ |
1252 | rt2500pci_write_tx_desc(rt2x00dev, entry->skb, txdesc); | 1266 | rt2500pci_write_tx_desc(entry, txdesc); |
1253 | 1267 | ||
1254 | /* | 1268 | /* |
1255 | * Dump beacon to userspace through debugfs. | 1269 | * Dump beacon to userspace through debugfs. |
@@ -1265,24 +1279,24 @@ static void rt2500pci_write_beacon(struct queue_entry *entry, | |||
1265 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 1279 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); |
1266 | } | 1280 | } |
1267 | 1281 | ||
1268 | static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 1282 | static void rt2500pci_kick_tx_queue(struct data_queue *queue) |
1269 | const enum data_queue_qid queue) | ||
1270 | { | 1283 | { |
1284 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1271 | u32 reg; | 1285 | u32 reg; |
1272 | 1286 | ||
1273 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | 1287 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); |
1274 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue == QID_AC_BE)); | 1288 | rt2x00_set_field32(®, TXCSR0_KICK_PRIO, (queue->qid == QID_AC_BE)); |
1275 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue == QID_AC_BK)); | 1289 | rt2x00_set_field32(®, TXCSR0_KICK_TX, (queue->qid == QID_AC_BK)); |
1276 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, (queue == QID_ATIM)); | 1290 | rt2x00_set_field32(®, TXCSR0_KICK_ATIM, (queue->qid == QID_ATIM)); |
1277 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); | 1291 | rt2x00pci_register_write(rt2x00dev, TXCSR0, reg); |
1278 | } | 1292 | } |
1279 | 1293 | ||
1280 | static void rt2500pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev, | 1294 | static void rt2500pci_kill_tx_queue(struct data_queue *queue) |
1281 | const enum data_queue_qid qid) | ||
1282 | { | 1295 | { |
1296 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; | ||
1283 | u32 reg; | 1297 | u32 reg; |
1284 | 1298 | ||
1285 | if (qid == QID_BEACON) { | 1299 | if (queue->qid == QID_BEACON) { |
1286 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); | 1300 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); |
1287 | } else { | 1301 | } else { |
1288 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); | 1302 | rt2x00pci_register_read(rt2x00dev, TXCSR0, ®); |
@@ -1795,19 +1809,23 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1795 | /* | 1809 | /* |
1796 | * Create channel information array | 1810 | * Create channel information array |
1797 | */ | 1811 | */ |
1798 | info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); | 1812 | info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); |
1799 | if (!info) | 1813 | if (!info) |
1800 | return -ENOMEM; | 1814 | return -ENOMEM; |
1801 | 1815 | ||
1802 | spec->channels_info = info; | 1816 | spec->channels_info = info; |
1803 | 1817 | ||
1804 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); | 1818 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); |
1805 | for (i = 0; i < 14; i++) | 1819 | for (i = 0; i < 14; i++) { |
1806 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 1820 | info[i].max_power = MAX_TXPOWER; |
1821 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
1822 | } | ||
1807 | 1823 | ||
1808 | if (spec->num_channels > 14) { | 1824 | if (spec->num_channels > 14) { |
1809 | for (i = 14; i < spec->num_channels; i++) | 1825 | for (i = 14; i < spec->num_channels; i++) { |
1810 | info[i].tx_power1 = DEFAULT_TXPOWER; | 1826 | info[i].max_power = MAX_TXPOWER; |
1827 | info[i].default_power1 = DEFAULT_TXPOWER; | ||
1828 | } | ||
1811 | } | 1829 | } |
1812 | 1830 | ||
1813 | return 0; | 1831 | return 0; |