diff options
author | Ido Yariv <ido@wizery.com> | 2011-03-01 08:14:39 -0500 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-03-03 09:10:46 -0500 |
commit | 606ea9fa0b2c01ffafb6beae92ea8e2b1473520b (patch) | |
tree | 8a7c4b0978e896fa26d0e2211823afa8f17507c9 | |
parent | 8aad24642a7c06832a75f1d20e8e3112b4fbd815 (diff) |
wl12xx: Do end-of-transactions transfers only if needed
On newer hardware revisions, there is no need to write the host's
counter at the end of a RX transaction. The same applies to writing the
number of packets at the end of a TX transaction.
It is generally a good idea to avoid unnecessary SDIO/SPI transfers.
Throughput and CPU usage are improved when avoiding these.
Send the host's RX counter and the TX packet count only if needed, based
on the hardware revision.
[Changed WL12XX_QUIRK_END_OF_TRANSACTION to use BIT(0) -- Luca]
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r-- | drivers/net/wireless/wl12xx/boot.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/boot.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/rx.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/tx.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl12xx.h | 8 |
6 files changed, 32 insertions, 3 deletions
diff --git a/drivers/net/wireless/wl12xx/boot.c b/drivers/net/wireless/wl12xx/boot.c index 1ffbad67d2d8..6934dffd5174 100644 --- a/drivers/net/wireless/wl12xx/boot.c +++ b/drivers/net/wireless/wl12xx/boot.c | |||
@@ -488,6 +488,9 @@ static void wl1271_boot_hw_version(struct wl1271 *wl) | |||
488 | fuse = (fuse & PG_VER_MASK) >> PG_VER_OFFSET; | 488 | fuse = (fuse & PG_VER_MASK) >> PG_VER_OFFSET; |
489 | 489 | ||
490 | wl->hw_pg_ver = (s8)fuse; | 490 | wl->hw_pg_ver = (s8)fuse; |
491 | |||
492 | if (((wl->hw_pg_ver & PG_MAJOR_VER_MASK) >> PG_MAJOR_VER_OFFSET) < 3) | ||
493 | wl->quirks |= WL12XX_QUIRK_END_OF_TRANSACTION; | ||
491 | } | 494 | } |
492 | 495 | ||
493 | /* uploads NVS and firmware */ | 496 | /* uploads NVS and firmware */ |
diff --git a/drivers/net/wireless/wl12xx/boot.h b/drivers/net/wireless/wl12xx/boot.h index d67dcffa31eb..17229b86fc71 100644 --- a/drivers/net/wireless/wl12xx/boot.h +++ b/drivers/net/wireless/wl12xx/boot.h | |||
@@ -59,6 +59,11 @@ struct wl1271_static_data { | |||
59 | #define PG_VER_MASK 0x3c | 59 | #define PG_VER_MASK 0x3c |
60 | #define PG_VER_OFFSET 2 | 60 | #define PG_VER_OFFSET 2 |
61 | 61 | ||
62 | #define PG_MAJOR_VER_MASK 0x3 | ||
63 | #define PG_MAJOR_VER_OFFSET 0x0 | ||
64 | #define PG_MINOR_VER_MASK 0xc | ||
65 | #define PG_MINOR_VER_OFFSET 0x2 | ||
66 | |||
62 | #define CMD_MBOX_ADDRESS 0x407B4 | 67 | #define CMD_MBOX_ADDRESS 0x407B4 |
63 | 68 | ||
64 | #define POLARITY_LOW BIT(1) | 69 | #define POLARITY_LOW BIT(1) |
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index 65e8a0cc92d0..ba34ac3a440d 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -3404,6 +3404,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
3404 | wl->last_tx_hlid = 0; | 3404 | wl->last_tx_hlid = 0; |
3405 | wl->ap_ps_map = 0; | 3405 | wl->ap_ps_map = 0; |
3406 | wl->ap_fw_ps_map = 0; | 3406 | wl->ap_fw_ps_map = 0; |
3407 | wl->quirks = 0; | ||
3407 | 3408 | ||
3408 | memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map)); | 3409 | memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map)); |
3409 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) | 3410 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) |
diff --git a/drivers/net/wireless/wl12xx/rx.c b/drivers/net/wireless/wl12xx/rx.c index 3d13d7a83ea1..4e7a3b311321 100644 --- a/drivers/net/wireless/wl12xx/rx.c +++ b/drivers/net/wireless/wl12xx/rx.c | |||
@@ -198,7 +198,13 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status) | |||
198 | pkt_offset += pkt_length; | 198 | pkt_offset += pkt_length; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | wl1271_write32(wl, RX_DRIVER_COUNTER_ADDRESS, wl->rx_counter); | 201 | |
202 | /* | ||
203 | * Write the driver's packet counter to the FW. This is only required | ||
204 | * for older hardware revisions | ||
205 | */ | ||
206 | if (wl->quirks & WL12XX_QUIRK_END_OF_TRANSACTION) | ||
207 | wl1271_write32(wl, RX_DRIVER_COUNTER_ADDRESS, wl->rx_counter); | ||
202 | } | 208 | } |
203 | 209 | ||
204 | void wl1271_set_default_filters(struct wl1271 *wl) | 210 | void wl1271_set_default_filters(struct wl1271 *wl) |
diff --git a/drivers/net/wireless/wl12xx/tx.c b/drivers/net/wireless/wl12xx/tx.c index 37d354ddd58e..455954edf83e 100644 --- a/drivers/net/wireless/wl12xx/tx.c +++ b/drivers/net/wireless/wl12xx/tx.c | |||
@@ -506,8 +506,14 @@ out_ack: | |||
506 | sent_packets = true; | 506 | sent_packets = true; |
507 | } | 507 | } |
508 | if (sent_packets) { | 508 | if (sent_packets) { |
509 | /* interrupt the firmware with the new packets */ | 509 | /* |
510 | wl1271_write32(wl, WL1271_HOST_WR_ACCESS, wl->tx_packets_count); | 510 | * Interrupt the firmware with the new packets. This is only |
511 | * required for older hardware revisions | ||
512 | */ | ||
513 | if (wl->quirks & WL12XX_QUIRK_END_OF_TRANSACTION) | ||
514 | wl1271_write32(wl, WL1271_HOST_WR_ACCESS, | ||
515 | wl->tx_packets_count); | ||
516 | |||
511 | wl1271_handle_tx_low_watermark(wl); | 517 | wl1271_handle_tx_low_watermark(wl); |
512 | } | 518 | } |
513 | 519 | ||
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h index 7132bc7dd2cf..ea1eee7895cf 100644 --- a/drivers/net/wireless/wl12xx/wl12xx.h +++ b/drivers/net/wireless/wl12xx/wl12xx.h | |||
@@ -535,6 +535,9 @@ struct wl1271 { | |||
535 | 535 | ||
536 | /* AP-mode - a bitmap of links currently in PS mode in mac80211 */ | 536 | /* AP-mode - a bitmap of links currently in PS mode in mac80211 */ |
537 | unsigned long ap_ps_map; | 537 | unsigned long ap_ps_map; |
538 | |||
539 | /* Quirks of specific hardware revisions */ | ||
540 | unsigned int quirks; | ||
538 | }; | 541 | }; |
539 | 542 | ||
540 | struct wl1271_station { | 543 | struct wl1271_station { |
@@ -562,4 +565,9 @@ int wl1271_plt_stop(struct wl1271 *wl); | |||
562 | #define HW_BG_RATES_MASK 0xffff | 565 | #define HW_BG_RATES_MASK 0xffff |
563 | #define HW_HT_RATES_OFFSET 16 | 566 | #define HW_HT_RATES_OFFSET 16 |
564 | 567 | ||
568 | /* Quirks */ | ||
569 | |||
570 | /* Each RX/TX transaction requires an end-of-transaction transfer */ | ||
571 | #define WL12XX_QUIRK_END_OF_TRANSACTION BIT(0) | ||
572 | |||
565 | #endif | 573 | #endif |