aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1251_tx.c
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2009-08-07 06:32:56 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:13:36 -0400
commit0764de64c8628f653c7e8493017d6bd8d43f4e3b (patch)
tree31a9f7ed97caf521e37166c79d3a39fbad920941 /drivers/net/wireless/wl12xx/wl1251_tx.c
parentb8010790c480f495520fd458197f86d758f0c83a (diff)
wl1251: separate bus i/o code into io.c
In order to eventually support wl1251 spi and sdio interfaces, move the register and memory transfer functions to a common file. Also rename wl1251_spi_mem_{read,write} to indicate its common usage. We still use spi_read internally until SDIO interface is introduced so nothing functional should change here. Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1251_tx.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_tx.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251_tx.c b/drivers/net/wireless/wl12xx/wl1251_tx.c
index 2652a222383a..7ddc9a346304 100644
--- a/drivers/net/wireless/wl12xx/wl1251_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1251_tx.c
@@ -30,6 +30,7 @@
30#include "wl1251_spi.h" 30#include "wl1251_spi.h"
31#include "wl1251_tx.h" 31#include "wl1251_tx.h"
32#include "wl1251_ps.h" 32#include "wl1251_ps.h"
33#include "wl1251_io.h"
33 34
34static bool wl1251_tx_double_buffer_busy(struct wl1251 *wl, u32 data_out_count) 35static bool wl1251_tx_double_buffer_busy(struct wl1251 *wl, u32 data_out_count)
35{ 36{
@@ -235,7 +236,7 @@ static int wl1251_tx_send_packet(struct wl1251 *wl, struct sk_buff *skb,
235 else 236 else
236 addr = wl->data_path->tx_packet_ring_addr; 237 addr = wl->data_path->tx_packet_ring_addr;
237 238
238 wl1251_spi_mem_write(wl, addr, skb->data, len); 239 wl1251_mem_write(wl, addr, skb->data, len);
239 240
240 wl1251_debug(DEBUG_TX, "tx id %u skb 0x%p payload %u rate 0x%x", 241 wl1251_debug(DEBUG_TX, "tx id %u skb 0x%p payload %u rate 0x%x",
241 tx_hdr->id, skb, tx_hdr->length, tx_hdr->rate); 242 tx_hdr->id, skb, tx_hdr->length, tx_hdr->rate);
@@ -451,7 +452,7 @@ void wl1251_tx_complete(struct wl1251 *wl)
451 return; 452 return;
452 453
453 /* First we read the result */ 454 /* First we read the result */
454 wl1251_spi_mem_read(wl, wl->data_path->tx_complete_addr, 455 wl1251_mem_read(wl, wl->data_path->tx_complete_addr,
455 result, sizeof(result)); 456 result, sizeof(result));
456 457
457 result_index = wl->next_tx_complete; 458 result_index = wl->next_tx_complete;
@@ -482,41 +483,41 @@ void wl1251_tx_complete(struct wl1251 *wl)
482 */ 483 */
483 if (result_index > wl->next_tx_complete) { 484 if (result_index > wl->next_tx_complete) {
484 /* Only 1 write is needed */ 485 /* Only 1 write is needed */
485 wl1251_spi_mem_write(wl, 486 wl1251_mem_write(wl,
486 wl->data_path->tx_complete_addr + 487 wl->data_path->tx_complete_addr +
487 (wl->next_tx_complete * 488 (wl->next_tx_complete *
488 sizeof(struct tx_result)), 489 sizeof(struct tx_result)),
489 &result[wl->next_tx_complete], 490 &result[wl->next_tx_complete],
490 num_complete * 491 num_complete *
491 sizeof(struct tx_result)); 492 sizeof(struct tx_result));
492 493
493 494
494 } else if (result_index < wl->next_tx_complete) { 495 } else if (result_index < wl->next_tx_complete) {
495 /* 2 writes are needed */ 496 /* 2 writes are needed */
496 wl1251_spi_mem_write(wl, 497 wl1251_mem_write(wl,
497 wl->data_path->tx_complete_addr + 498 wl->data_path->tx_complete_addr +
498 (wl->next_tx_complete * 499 (wl->next_tx_complete *
499 sizeof(struct tx_result)), 500 sizeof(struct tx_result)),
500 &result[wl->next_tx_complete], 501 &result[wl->next_tx_complete],
501 (FW_TX_CMPLT_BLOCK_SIZE - 502 (FW_TX_CMPLT_BLOCK_SIZE -
502 wl->next_tx_complete) * 503 wl->next_tx_complete) *
503 sizeof(struct tx_result)); 504 sizeof(struct tx_result));
504 505
505 wl1251_spi_mem_write(wl, 506 wl1251_mem_write(wl,
506 wl->data_path->tx_complete_addr, 507 wl->data_path->tx_complete_addr,
507 result, 508 result,
508 (num_complete - 509 (num_complete -
509 FW_TX_CMPLT_BLOCK_SIZE + 510 FW_TX_CMPLT_BLOCK_SIZE +
510 wl->next_tx_complete) * 511 wl->next_tx_complete) *
511 sizeof(struct tx_result)); 512 sizeof(struct tx_result));
512 513
513 } else { 514 } else {
514 /* We have to write the whole array */ 515 /* We have to write the whole array */
515 wl1251_spi_mem_write(wl, 516 wl1251_mem_write(wl,
516 wl->data_path->tx_complete_addr, 517 wl->data_path->tx_complete_addr,
517 result, 518 result,
518 FW_TX_CMPLT_BLOCK_SIZE * 519 FW_TX_CMPLT_BLOCK_SIZE *
519 sizeof(struct tx_result)); 520 sizeof(struct tx_result));
520 } 521 }
521 522
522 } 523 }