diff options
author | Gertjan van Wingerde <gwingerde@gmail.com> | 2010-05-08 17:40:21 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-10 14:56:48 -0400 |
commit | 59679b91d1d33ebe90b72ffded9a57dba788fa6b (patch) | |
tree | addddfcdcf0f1a8c0bdf371075485d9f06b2ede8 /drivers/net/wireless/rt2x00/rt2800usb.c | |
parent | 78b8f3b0ddb061af1e3907f9c4bca76eae39f79f (diff) |
rt2x00: Factor out TXWI writing to common rt2800 code.
TXWI writing is exactly the same for rt2800pci and rt2800usb, so
make it common code.
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/rt2800usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 50 |
1 files changed, 3 insertions, 47 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index df7ad981b808..b39b858e0cf1 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -401,59 +401,15 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
401 | { | 401 | { |
402 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 402 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
403 | __le32 *txi = skbdesc->desc; | 403 | __le32 *txi = skbdesc->desc; |
404 | __le32 *txwi = &txi[TXINFO_DESC_SIZE / sizeof(__le32)]; | ||
405 | u32 word; | 404 | u32 word; |
406 | 405 | ||
407 | /* | 406 | /* |
408 | * Initialize TX Info descriptor | 407 | * Initialize TXWI descriptor |
409 | */ | 408 | */ |
410 | rt2x00_desc_read(txwi, 0, &word); | 409 | rt2800_write_txwi(skb, txdesc); |
411 | rt2x00_set_field32(&word, TXWI_W0_FRAG, | ||
412 | test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); | ||
413 | rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, 0); | ||
414 | rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); | ||
415 | rt2x00_set_field32(&word, TXWI_W0_TS, | ||
416 | test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); | ||
417 | rt2x00_set_field32(&word, TXWI_W0_AMPDU, | ||
418 | test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); | ||
419 | rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, txdesc->mpdu_density); | ||
420 | rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->txop); | ||
421 | rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->mcs); | ||
422 | rt2x00_set_field32(&word, TXWI_W0_BW, | ||
423 | test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); | ||
424 | rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, | ||
425 | test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); | ||
426 | rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->stbc); | ||
427 | rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); | ||
428 | rt2x00_desc_write(txwi, 0, word); | ||
429 | |||
430 | rt2x00_desc_read(txwi, 1, &word); | ||
431 | rt2x00_set_field32(&word, TXWI_W1_ACK, | ||
432 | test_bit(ENTRY_TXD_ACK, &txdesc->flags)); | ||
433 | rt2x00_set_field32(&word, TXWI_W1_NSEQ, | ||
434 | test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); | ||
435 | rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size); | ||
436 | rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, | ||
437 | test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? | ||
438 | txdesc->key_idx : 0xff); | ||
439 | rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, | ||
440 | txdesc->length); | ||
441 | rt2x00_set_field32(&word, TXWI_W1_PACKETID, | ||
442 | skbdesc->entry->queue->qid + 1); | ||
443 | rt2x00_desc_write(txwi, 1, word); | ||
444 | 410 | ||
445 | /* | 411 | /* |
446 | * Always write 0 to IV/EIV fields, hardware will insert the IV | 412 | * Initialize TXINFO descriptor |
447 | * from the IVEIV register when TXINFO_W0_WIV is set to 0. | ||
448 | * When TXINFO_W0_WIV is set to 1 it will use the IV data | ||
449 | * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which | ||
450 | * crypto entry in the registers should be used to encrypt the frame. | ||
451 | */ | ||
452 | _rt2x00_desc_write(txwi, 2, 0 /* skbdesc->iv[0] */); | ||
453 | _rt2x00_desc_write(txwi, 3, 0 /* skbdesc->iv[1] */); | ||
454 | |||
455 | /* | ||
456 | * Initialize TX descriptor | ||
457 | */ | 413 | */ |
458 | rt2x00_desc_read(txi, 0, &word); | 414 | rt2x00_desc_read(txi, 0, &word); |
459 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, | 415 | rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, |