aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2011-12-12 05:08:25 -0500
committerLuciano Coelho <coelho@ti.com>2012-04-12 01:44:02 -0400
commit6bac40a63aae9d0942496c9f350dbb7a6c88e3fa (patch)
tree4258025aea5a3a238f907d1751dc19cdb991c1a5 /drivers/net/wireless
parent34785be5e0472ec7270a96c2a05ad5b5a1e25236 (diff)
wlcore/wl12xx: adapt FW status for multiple families
Add room for a private data struct at the end of the common FW status. Add a convenience "counters" struct inside the FW status. The wl12xx family does not currently use the FW status private data. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ti/wl12xx/main.c1
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c18
-rw-r--r--drivers/net/wireless/ti/wlcore/rx.c2
-rw-r--r--drivers/net/wireless/ti/wlcore/rx.h2
-rw-r--r--drivers/net/wireless/ti/wlcore/wl12xx.h27
-rw-r--r--drivers/net/wireless/ti/wlcore/wlcore.h5
6 files changed, 36 insertions, 19 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index be48c47d3ac0..d7dd3def07b5 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -1343,6 +1343,7 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
1343 wl->band_rate_to_idx = wl12xx_band_rate_to_idx; 1343 wl->band_rate_to_idx = wl12xx_band_rate_to_idx;
1344 wl->hw_tx_rate_tbl_size = WL12XX_CONF_HW_RXTX_RATE_MAX; 1344 wl->hw_tx_rate_tbl_size = WL12XX_CONF_HW_RXTX_RATE_MAX;
1345 wl->hw_min_ht_rate = WL12XX_CONF_HW_RXTX_RATE_MCS0; 1345 wl->hw_min_ht_rate = WL12XX_CONF_HW_RXTX_RATE_MCS0;
1346 wl->fw_status_priv_len = 0;
1346 memcpy(&wl->ht_cap, &wl12xx_ht_cap, sizeof(wl12xx_ht_cap)); 1347 memcpy(&wl->ht_cap, &wl12xx_ht_cap, sizeof(wl12xx_ht_cap));
1347 wl12xx_conf_init(wl); 1348 wl12xx_conf_init(wl);
1348 1349
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index b80f08bbfebf..63658f5db54e 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -387,7 +387,7 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl,
387 387
388static void wl12xx_irq_update_links_status(struct wl1271 *wl, 388static void wl12xx_irq_update_links_status(struct wl1271 *wl,
389 struct wl12xx_vif *wlvif, 389 struct wl12xx_vif *wlvif,
390 struct wl12xx_fw_status *status) 390 struct wl_fw_status *status)
391{ 391{
392 struct wl1271_link *lnk; 392 struct wl1271_link *lnk;
393 u32 cur_fw_ps_map; 393 u32 cur_fw_ps_map;
@@ -407,9 +407,10 @@ static void wl12xx_irq_update_links_status(struct wl1271 *wl,
407 407
408 for_each_set_bit(hlid, wlvif->ap.sta_hlid_map, WL12XX_MAX_LINKS) { 408 for_each_set_bit(hlid, wlvif->ap.sta_hlid_map, WL12XX_MAX_LINKS) {
409 lnk = &wl->links[hlid]; 409 lnk = &wl->links[hlid];
410 cnt = status->tx_lnk_free_pkts[hlid] - lnk->prev_freed_pkts; 410 cnt = status->counters.tx_lnk_free_pkts[hlid] -
411 lnk->prev_freed_pkts;
411 412
412 lnk->prev_freed_pkts = status->tx_lnk_free_pkts[hlid]; 413 lnk->prev_freed_pkts = status->counters.tx_lnk_free_pkts[hlid];
413 lnk->allocated_pkts -= cnt; 414 lnk->allocated_pkts -= cnt;
414 415
415 wl12xx_irq_ps_regulate_link(wl, wlvif, hlid, 416 wl12xx_irq_ps_regulate_link(wl, wlvif, hlid,
@@ -418,16 +419,19 @@ static void wl12xx_irq_update_links_status(struct wl1271 *wl,
418} 419}
419 420
420static void wl12xx_fw_status(struct wl1271 *wl, 421static void wl12xx_fw_status(struct wl1271 *wl,
421 struct wl12xx_fw_status *status) 422 struct wl_fw_status *status)
422{ 423{
423 struct wl12xx_vif *wlvif; 424 struct wl12xx_vif *wlvif;
424 struct timespec ts; 425 struct timespec ts;
425 u32 old_tx_blk_count = wl->tx_blocks_available; 426 u32 old_tx_blk_count = wl->tx_blocks_available;
426 int avail, freed_blocks; 427 int avail, freed_blocks;
427 int i; 428 int i;
429 size_t status_len;
430
431 status_len = sizeof(*status) + wl->fw_status_priv_len;
428 432
429 wlcore_raw_read_data(wl, REG_RAW_FW_STATUS_ADDR, status, 433 wlcore_raw_read_data(wl, REG_RAW_FW_STATUS_ADDR, status,
430 sizeof(*status), false); 434 status_len, false);
431 435
432 wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, " 436 wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, "
433 "drv_rx_counter = %d, tx_results_counter = %d)", 437 "drv_rx_counter = %d, tx_results_counter = %d)",
@@ -439,10 +443,10 @@ static void wl12xx_fw_status(struct wl1271 *wl,
439 for (i = 0; i < NUM_TX_QUEUES; i++) { 443 for (i = 0; i < NUM_TX_QUEUES; i++) {
440 /* prevent wrap-around in freed-packets counter */ 444 /* prevent wrap-around in freed-packets counter */
441 wl->tx_allocated_pkts[i] -= 445 wl->tx_allocated_pkts[i] -=
442 (status->tx_released_pkts[i] - 446 (status->counters.tx_released_pkts[i] -
443 wl->tx_pkts_freed[i]) & 0xff; 447 wl->tx_pkts_freed[i]) & 0xff;
444 448
445 wl->tx_pkts_freed[i] = status->tx_released_pkts[i]; 449 wl->tx_pkts_freed[i] = status->counters.tx_released_pkts[i];
446 } 450 }
447 451
448 /* prevent wrap-around in total blocks counter */ 452 /* prevent wrap-around in total blocks counter */
diff --git a/drivers/net/wireless/ti/wlcore/rx.c b/drivers/net/wireless/ti/wlcore/rx.c
index 6bde6e2fce0c..89bd9385e90b 100644
--- a/drivers/net/wireless/ti/wlcore/rx.c
+++ b/drivers/net/wireless/ti/wlcore/rx.c
@@ -199,7 +199,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,
199 return is_data; 199 return is_data;
200} 200}
201 201
202void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status) 202void wl12xx_rx(struct wl1271 *wl, struct wl_fw_status *status)
203{ 203{
204 unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0}; 204 unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0};
205 u32 buf_size; 205 u32 buf_size;
diff --git a/drivers/net/wireless/ti/wlcore/rx.h b/drivers/net/wireless/ti/wlcore/rx.h
index 18eb38be7aa2..6e129e2a8546 100644
--- a/drivers/net/wireless/ti/wlcore/rx.h
+++ b/drivers/net/wireless/ti/wlcore/rx.h
@@ -136,7 +136,7 @@ struct wl1271_rx_descriptor {
136 u8 reserved; 136 u8 reserved;
137} __packed; 137} __packed;
138 138
139void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status); 139void wl12xx_rx(struct wl1271 *wl, struct wl_fw_status *status);
140u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band); 140u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band);
141 141
142#endif 142#endif
diff --git a/drivers/net/wireless/ti/wlcore/wl12xx.h b/drivers/net/wireless/ti/wlcore/wl12xx.h
index b09c9ed4bbd1..a9b220c43e54 100644
--- a/drivers/net/wireless/ti/wlcore/wl12xx.h
+++ b/drivers/net/wireless/ti/wlcore/wl12xx.h
@@ -145,8 +145,21 @@ struct wl1271_stats {
145 145
146#define AP_MAX_STATIONS 8 146#define AP_MAX_STATIONS 8
147 147
148struct wl_fw_packet_counters {
149 /* Cumulative counter of released packets per AC */
150 u8 tx_released_pkts[NUM_TX_QUEUES];
151
152 /* Cumulative counter of freed packets per HLID */
153 u8 tx_lnk_free_pkts[WL12XX_MAX_LINKS];
154
155 /* Cumulative counter of released Voice memory blocks */
156 u8 tx_voice_released_blks;
157
158 u8 padding[3];
159} __packed;
160
148/* FW status registers */ 161/* FW status registers */
149struct wl12xx_fw_status { 162struct wl_fw_status {
150 __le32 intr; 163 __le32 intr;
151 u8 fw_rx_counter; 164 u8 fw_rx_counter;
152 u8 drv_rx_counter; 165 u8 drv_rx_counter;
@@ -173,16 +186,12 @@ struct wl12xx_fw_status {
173 /* Size (in Memory Blocks) of TX pool */ 186 /* Size (in Memory Blocks) of TX pool */
174 __le32 tx_total; 187 __le32 tx_total;
175 188
176 /* Cumulative counter of released packets per AC */ 189 struct wl_fw_packet_counters counters;
177 u8 tx_released_pkts[NUM_TX_QUEUES];
178 190
179 /* Cumulative counter of freed packets per HLID */
180 u8 tx_lnk_free_pkts[WL12XX_MAX_LINKS];
181
182 /* Cumulative counter of released Voice memory blocks */
183 u8 tx_voice_released_blks;
184 u8 padding_1[3];
185 __le32 log_start_addr; 191 __le32 log_start_addr;
192
193 /* Private status to be used by the lower drivers */
194 u8 priv[0];
186} __packed; 195} __packed;
187 196
188struct wl1271_rx_mem_pool_addr { 197struct wl1271_rx_mem_pool_addr {
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index 960aefb19a92..39f9fadfebd9 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -260,7 +260,7 @@ struct wl1271 {
260 u32 buffer_cmd; 260 u32 buffer_cmd;
261 u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; 261 u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
262 262
263 struct wl12xx_fw_status *fw_status; 263 struct wl_fw_status *fw_status;
264 struct wl1271_tx_hw_res_if *tx_res_if; 264 struct wl1271_tx_hw_res_if *tx_res_if;
265 265
266 /* Current chipset configuration */ 266 /* Current chipset configuration */
@@ -346,6 +346,9 @@ struct wl1271 {
346 346
347 /* HW HT (11n) capabilities */ 347 /* HW HT (11n) capabilities */
348 struct ieee80211_sta_ht_cap ht_cap; 348 struct ieee80211_sta_ht_cap ht_cap;
349
350 /* size of the private FW status data */
351 size_t fw_status_priv_len;
349}; 352};
350 353
351int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev); 354int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev);