diff options
author | Gertjan van Wingerde <gwingerde@gmail.com> | 2010-06-03 04:51:53 -0400 |
---|---|---|
committer | Ivo van Doorn <IvDoorn@gmail.com> | 2010-06-03 04:51:53 -0400 |
commit | f0194b2d5d01b99555fd8a6e42281809086f1ab1 (patch) | |
tree | 74eb78ca8c5b66c55e0bf4bfb6270e8c7e08384a /drivers/net/wireless/rt2x00/rt2800lib.c | |
parent | 96b61bafe22b2f2abcc833d651739edb977f1b1e (diff) |
rt2x00: Centralize rt2800 beacon writing.
The beacon writing functions of rt2800pci and rt2800usb are now identical.
Move them to rt2800lib to only have one central function.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800lib.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 3258301aa29c..1556e324cecc 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -379,6 +379,67 @@ void rt2800_process_rxwi(struct sk_buff *skb, struct rxdone_entry_desc *rxdesc) | |||
379 | } | 379 | } |
380 | EXPORT_SYMBOL_GPL(rt2800_process_rxwi); | 380 | EXPORT_SYMBOL_GPL(rt2800_process_rxwi); |
381 | 381 | ||
382 | void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) | ||
383 | { | ||
384 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
385 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
386 | unsigned int beacon_base; | ||
387 | u32 reg; | ||
388 | |||
389 | /* | ||
390 | * Disable beaconing while we are reloading the beacon data, | ||
391 | * otherwise we might be sending out invalid data. | ||
392 | */ | ||
393 | rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); | ||
394 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); | ||
395 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
396 | |||
397 | /* | ||
398 | * Add space for the TXWI in front of the skb. | ||
399 | */ | ||
400 | skb_push(entry->skb, TXWI_DESC_SIZE); | ||
401 | memset(entry->skb, 0, TXWI_DESC_SIZE); | ||
402 | |||
403 | /* | ||
404 | * Register descriptor details in skb frame descriptor. | ||
405 | */ | ||
406 | skbdesc->flags |= SKBDESC_DESC_IN_SKB; | ||
407 | skbdesc->desc = entry->skb->data; | ||
408 | skbdesc->desc_len = TXWI_DESC_SIZE; | ||
409 | |||
410 | /* | ||
411 | * Add the TXWI for the beacon to the skb. | ||
412 | */ | ||
413 | rt2800_write_txwi((__le32 *)entry->skb->data, txdesc); | ||
414 | |||
415 | /* | ||
416 | * Dump beacon to userspace through debugfs. | ||
417 | */ | ||
418 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); | ||
419 | |||
420 | /* | ||
421 | * Write entire beacon with TXWI to register. | ||
422 | */ | ||
423 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | ||
424 | rt2800_register_multiwrite(rt2x00dev, beacon_base, | ||
425 | entry->skb->data, entry->skb->len); | ||
426 | |||
427 | /* | ||
428 | * Enable beaconing again. | ||
429 | */ | ||
430 | rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); | ||
431 | rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); | ||
432 | rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); | ||
433 | rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); | ||
434 | |||
435 | /* | ||
436 | * Clean up beacon skb. | ||
437 | */ | ||
438 | dev_kfree_skb_any(entry->skb); | ||
439 | entry->skb = NULL; | ||
440 | } | ||
441 | EXPORT_SYMBOL(rt2800_write_beacon); | ||
442 | |||
382 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS | 443 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS |
383 | const struct rt2x00debug rt2800_rt2x00debug = { | 444 | const struct rt2x00debug rt2800_rt2x00debug = { |
384 | .owner = THIS_MODULE, | 445 | .owner = THIS_MODULE, |