diff options
author | John W. Linville <linville@tuxdriver.com> | 2010-10-05 13:50:27 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-05 13:50:27 -0400 |
commit | 46bf695802bb090d9d0d0fec6bb5b46c24b17d4e (patch) | |
tree | 788afdbec413608f6331ffbac4153f0f6736e6b7 | |
parent | e7480bbb926c5816e4fbfca70748096bbe0e4978 (diff) | |
parent | 4b48e6876b641e1138f37a0fc11fb6a4fc3e24e1 (diff) |
Merge branch 'wireless-next' of git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx
23 files changed, 784 insertions, 538 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 6cb1c759eeaa..529bfee8c4b2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -6321,7 +6321,7 @@ WL1271 WIRELESS DRIVER | |||
6321 | M: Luciano Coelho <luciano.coelho@nokia.com> | 6321 | M: Luciano Coelho <luciano.coelho@nokia.com> |
6322 | L: linux-wireless@vger.kernel.org | 6322 | L: linux-wireless@vger.kernel.org |
6323 | W: http://wireless.kernel.org | 6323 | W: http://wireless.kernel.org |
6324 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git | 6324 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git |
6325 | S: Maintained | 6325 | S: Maintained |
6326 | F: drivers/net/wireless/wl12xx/wl1271* | 6326 | F: drivers/net/wireless/wl12xx/wl1271* |
6327 | F: include/linux/wl12xx.h | 6327 | F: include/linux/wl12xx.h |
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c index 6aa0728fa15d..189a6d1600b2 100644 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c | |||
@@ -213,7 +213,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { | |||
213 | { | 213 | { |
214 | .name = "wl1271", | 214 | .name = "wl1271", |
215 | .mmc = 3, | 215 | .mmc = 3, |
216 | .wires = 4, | 216 | .caps = MMC_CAP_4_BIT_DATA, |
217 | .gpio_wp = -EINVAL, | 217 | .gpio_wp = -EINVAL, |
218 | .gpio_cd = -EINVAL, | 218 | .gpio_cd = -EINVAL, |
219 | .nonremovable = true, | 219 | .nonremovable = true, |
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index 4134f4495b95..8a4cd763e5a2 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -117,10 +117,7 @@ enum { | |||
117 | #define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff)) | 117 | #define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff)) |
118 | #define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff)) | 118 | #define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff)) |
119 | 119 | ||
120 | /* | 120 | #define WL1271_CIPHER_SUITE_GEM 0x00147201 |
121 | * Enable/disable 802.11a support for WL1273 | ||
122 | */ | ||
123 | #undef WL1271_80211A_ENABLED | ||
124 | 121 | ||
125 | #define WL1271_BUSY_WORD_CNT 1 | 122 | #define WL1271_BUSY_WORD_CNT 1 |
126 | #define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32)) | 123 | #define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32)) |
@@ -133,6 +130,8 @@ enum { | |||
133 | 130 | ||
134 | #define ACX_TX_DESCRIPTORS 32 | 131 | #define ACX_TX_DESCRIPTORS 32 |
135 | 132 | ||
133 | #define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) | ||
134 | |||
136 | enum wl1271_state { | 135 | enum wl1271_state { |
137 | WL1271_STATE_OFF, | 136 | WL1271_STATE_OFF, |
138 | WL1271_STATE_ON, | 137 | WL1271_STATE_ON, |
@@ -301,6 +300,7 @@ struct wl1271_rx_mem_pool_addr { | |||
301 | struct wl1271_scan { | 300 | struct wl1271_scan { |
302 | struct cfg80211_scan_request *req; | 301 | struct cfg80211_scan_request *req; |
303 | bool *scanned_ch; | 302 | bool *scanned_ch; |
303 | bool failed; | ||
304 | u8 state; | 304 | u8 state; |
305 | u8 ssid[IW_ESSID_MAX_SIZE+1]; | 305 | u8 ssid[IW_ESSID_MAX_SIZE+1]; |
306 | size_t ssid_len; | 306 | size_t ssid_len; |
@@ -350,6 +350,7 @@ struct wl1271 { | |||
350 | #define WL1271_FLAG_IDLE (10) | 350 | #define WL1271_FLAG_IDLE (10) |
351 | #define WL1271_FLAG_IDLE_REQUESTED (11) | 351 | #define WL1271_FLAG_IDLE_REQUESTED (11) |
352 | #define WL1271_FLAG_PSPOLL_FAILURE (12) | 352 | #define WL1271_FLAG_PSPOLL_FAILURE (12) |
353 | #define WL1271_FLAG_STA_STATE_SENT (13) | ||
353 | unsigned long flags; | 354 | unsigned long flags; |
354 | 355 | ||
355 | struct wl1271_partition_set part; | 356 | struct wl1271_partition_set part; |
@@ -362,6 +363,7 @@ struct wl1271 { | |||
362 | u8 *fw; | 363 | u8 *fw; |
363 | size_t fw_len; | 364 | size_t fw_len; |
364 | struct wl1271_nvs_file *nvs; | 365 | struct wl1271_nvs_file *nvs; |
366 | size_t nvs_len; | ||
365 | 367 | ||
366 | s8 hw_pg_ver; | 368 | s8 hw_pg_ver; |
367 | 369 | ||
@@ -408,9 +410,15 @@ struct wl1271 { | |||
408 | /* Rx memory pool address */ | 410 | /* Rx memory pool address */ |
409 | struct wl1271_rx_mem_pool_addr rx_mem_pool_addr; | 411 | struct wl1271_rx_mem_pool_addr rx_mem_pool_addr; |
410 | 412 | ||
413 | /* Intermediate buffer, used for packet aggregation */ | ||
414 | u8 *aggr_buf; | ||
415 | |||
411 | /* The target interrupt mask */ | 416 | /* The target interrupt mask */ |
412 | struct work_struct irq_work; | 417 | struct work_struct irq_work; |
413 | 418 | ||
419 | /* Hardware recovery work */ | ||
420 | struct work_struct recovery_work; | ||
421 | |||
414 | /* The mbox event mask */ | 422 | /* The mbox event mask */ |
415 | u32 event_mask; | 423 | u32 event_mask; |
416 | 424 | ||
@@ -419,6 +427,7 @@ struct wl1271 { | |||
419 | 427 | ||
420 | /* Are we currently scanning */ | 428 | /* Are we currently scanning */ |
421 | struct wl1271_scan scan; | 429 | struct wl1271_scan scan; |
430 | struct delayed_work scan_complete_work; | ||
422 | 431 | ||
423 | /* Our association ID */ | 432 | /* Our association ID */ |
424 | u16 aid; | 433 | u16 aid; |
@@ -475,6 +484,8 @@ struct wl1271 { | |||
475 | 484 | ||
476 | bool sg_enabled; | 485 | bool sg_enabled; |
477 | 486 | ||
487 | bool enable_11a; | ||
488 | |||
478 | struct list_head list; | 489 | struct list_head list; |
479 | 490 | ||
480 | /* Most recently reported noise in dBm */ | 491 | /* Most recently reported noise in dBm */ |
@@ -498,14 +509,4 @@ int wl1271_plt_stop(struct wl1271 *wl); | |||
498 | #define WL1271_PRE_POWER_ON_SLEEP 20 /* in miliseconds */ | 509 | #define WL1271_PRE_POWER_ON_SLEEP 20 /* in miliseconds */ |
499 | #define WL1271_POWER_ON_SLEEP 200 /* in miliseconds */ | 510 | #define WL1271_POWER_ON_SLEEP 200 /* in miliseconds */ |
500 | 511 | ||
501 | static inline bool wl1271_11a_enabled(void) | ||
502 | { | ||
503 | /* FIXME: this could be determined based on the NVS-INI file */ | ||
504 | #ifdef WL1271_80211A_ENABLED | ||
505 | return true; | ||
506 | #else | ||
507 | return false; | ||
508 | #endif | ||
509 | } | ||
510 | |||
511 | #endif | 512 | #endif |
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.c b/drivers/net/wireless/wl12xx/wl1271_acx.c index f03ad088db8b..618993405262 100644 --- a/drivers/net/wireless/wl12xx/wl1271_acx.c +++ b/drivers/net/wireless/wl12xx/wl1271_acx.c | |||
@@ -86,40 +86,6 @@ out: | |||
86 | return ret; | 86 | return ret; |
87 | } | 87 | } |
88 | 88 | ||
89 | int wl1271_acx_fw_version(struct wl1271 *wl, char *buf, size_t len) | ||
90 | { | ||
91 | struct acx_revision *rev; | ||
92 | int ret; | ||
93 | |||
94 | wl1271_debug(DEBUG_ACX, "acx fw rev"); | ||
95 | |||
96 | rev = kzalloc(sizeof(*rev), GFP_KERNEL); | ||
97 | if (!rev) { | ||
98 | ret = -ENOMEM; | ||
99 | goto out; | ||
100 | } | ||
101 | |||
102 | ret = wl1271_cmd_interrogate(wl, ACX_FW_REV, rev, sizeof(*rev)); | ||
103 | if (ret < 0) { | ||
104 | wl1271_warning("ACX_FW_REV interrogate failed"); | ||
105 | goto out; | ||
106 | } | ||
107 | |||
108 | /* be careful with the buffer sizes */ | ||
109 | strncpy(buf, rev->fw_version, min(len, sizeof(rev->fw_version))); | ||
110 | |||
111 | /* | ||
112 | * if the firmware version string is exactly | ||
113 | * sizeof(rev->fw_version) long or fw_len is less than | ||
114 | * sizeof(rev->fw_version) it won't be null terminated | ||
115 | */ | ||
116 | buf[min(len, sizeof(rev->fw_version)) - 1] = '\0'; | ||
117 | |||
118 | out: | ||
119 | kfree(rev); | ||
120 | return ret; | ||
121 | } | ||
122 | |||
123 | int wl1271_acx_tx_power(struct wl1271 *wl, int power) | 89 | int wl1271_acx_tx_power(struct wl1271 *wl, int power) |
124 | { | 90 | { |
125 | struct acx_current_tx_power *acx; | 91 | struct acx_current_tx_power *acx; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.h b/drivers/net/wireless/wl12xx/wl1271_acx.h index 4235bc56f750..ebb341d36e8c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_acx.h +++ b/drivers/net/wireless/wl12xx/wl1271_acx.h | |||
@@ -100,35 +100,6 @@ struct acx_error_counter { | |||
100 | __le32 seq_num_miss; | 100 | __le32 seq_num_miss; |
101 | } __packed; | 101 | } __packed; |
102 | 102 | ||
103 | struct acx_revision { | ||
104 | struct acx_header header; | ||
105 | |||
106 | /* | ||
107 | * The WiLink firmware version, an ASCII string x.x.x.x, | ||
108 | * that uniquely identifies the current firmware. | ||
109 | * The left most digit is incremented each time a | ||
110 | * significant change is made to the firmware, such as | ||
111 | * code redesign or new platform support. | ||
112 | * The second digit is incremented when major enhancements | ||
113 | * are added or major fixes are made. | ||
114 | * The third digit is incremented for each GA release. | ||
115 | * The fourth digit is incremented for each build. | ||
116 | * The first two digits identify a firmware release version, | ||
117 | * in other words, a unique set of features. | ||
118 | * The first three digits identify a GA release. | ||
119 | */ | ||
120 | char fw_version[20]; | ||
121 | |||
122 | /* | ||
123 | * This 4 byte field specifies the WiLink hardware version. | ||
124 | * bits 0 - 15: Reserved. | ||
125 | * bits 16 - 23: Version ID - The WiLink version ID | ||
126 | * (1 = first spin, 2 = second spin, and so on). | ||
127 | * bits 24 - 31: Chip ID - The WiLink chip ID. | ||
128 | */ | ||
129 | __le32 hw_version; | ||
130 | } __packed; | ||
131 | |||
132 | enum wl1271_psm_mode { | 103 | enum wl1271_psm_mode { |
133 | /* Active mode */ | 104 | /* Active mode */ |
134 | WL1271_PSM_CAM = 0, | 105 | WL1271_PSM_CAM = 0, |
@@ -1060,7 +1031,6 @@ enum { | |||
1060 | ACX_PEER_HT_CAP = 0x0057, | 1031 | ACX_PEER_HT_CAP = 0x0057, |
1061 | ACX_HT_BSS_OPERATION = 0x0058, | 1032 | ACX_HT_BSS_OPERATION = 0x0058, |
1062 | ACX_COEX_ACTIVITY = 0x0059, | 1033 | ACX_COEX_ACTIVITY = 0x0059, |
1063 | ACX_SET_SMART_REFLEX_DEBUG = 0x005A, | ||
1064 | ACX_SET_DCO_ITRIM_PARAMS = 0x0061, | 1034 | ACX_SET_DCO_ITRIM_PARAMS = 0x0061, |
1065 | DOT11_RX_MSDU_LIFE_TIME = 0x1004, | 1035 | DOT11_RX_MSDU_LIFE_TIME = 0x1004, |
1066 | DOT11_CUR_TX_PWR = 0x100D, | 1036 | DOT11_CUR_TX_PWR = 0x100D, |
@@ -1077,7 +1047,6 @@ enum { | |||
1077 | 1047 | ||
1078 | int wl1271_acx_wake_up_conditions(struct wl1271 *wl); | 1048 | int wl1271_acx_wake_up_conditions(struct wl1271 *wl); |
1079 | int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth); | 1049 | int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth); |
1080 | int wl1271_acx_fw_version(struct wl1271 *wl, char *buf, size_t len); | ||
1081 | int wl1271_acx_tx_power(struct wl1271 *wl, int power); | 1050 | int wl1271_acx_tx_power(struct wl1271 *wl, int power); |
1082 | int wl1271_acx_feature_cfg(struct wl1271 *wl); | 1051 | int wl1271_acx_feature_cfg(struct wl1271 *wl); |
1083 | int wl1271_acx_mem_map(struct wl1271 *wl, | 1052 | int wl1271_acx_mem_map(struct wl1271 *wl, |
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c index e5a7f042645f..b91021242098 100644 --- a/drivers/net/wireless/wl12xx/wl1271_boot.c +++ b/drivers/net/wireless/wl12xx/wl1271_boot.c | |||
@@ -225,6 +225,28 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl) | |||
225 | if (wl->nvs == NULL) | 225 | if (wl->nvs == NULL) |
226 | return -ENODEV; | 226 | return -ENODEV; |
227 | 227 | ||
228 | /* | ||
229 | * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band | ||
230 | * configurations) can be removed when those NVS files stop floating | ||
231 | * around. | ||
232 | */ | ||
233 | if (wl->nvs_len == sizeof(struct wl1271_nvs_file) || | ||
234 | wl->nvs_len == WL1271_INI_LEGACY_NVS_FILE_SIZE) { | ||
235 | if (wl->nvs->general_params.dual_mode_select) | ||
236 | wl->enable_11a = true; | ||
237 | } | ||
238 | |||
239 | if (wl->nvs_len != sizeof(struct wl1271_nvs_file) && | ||
240 | (wl->nvs_len != WL1271_INI_LEGACY_NVS_FILE_SIZE || | ||
241 | wl->enable_11a)) { | ||
242 | wl1271_error("nvs size is not as expected: %zu != %zu", | ||
243 | wl->nvs_len, sizeof(struct wl1271_nvs_file)); | ||
244 | kfree(wl->nvs); | ||
245 | wl->nvs = NULL; | ||
246 | wl->nvs_len = 0; | ||
247 | return -EILSEQ; | ||
248 | } | ||
249 | |||
228 | /* only the first part of the NVS needs to be uploaded */ | 250 | /* only the first part of the NVS needs to be uploaded */ |
229 | nvs_len = sizeof(wl->nvs->nvs); | 251 | nvs_len = sizeof(wl->nvs->nvs); |
230 | nvs_ptr = (u8 *)wl->nvs->nvs; | 252 | nvs_ptr = (u8 *)wl->nvs->nvs; |
@@ -251,8 +273,10 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl) | |||
251 | burst_len = nvs_ptr[0]; | 273 | burst_len = nvs_ptr[0]; |
252 | dest_addr = (nvs_ptr[1] & 0xfe) | ((u32)(nvs_ptr[2] << 8)); | 274 | dest_addr = (nvs_ptr[1] & 0xfe) | ((u32)(nvs_ptr[2] << 8)); |
253 | 275 | ||
254 | /* FIXME: Due to our new wl1271_translate_reg_addr function, | 276 | /* |
255 | we need to add the REGISTER_BASE to the destination */ | 277 | * Due to our new wl1271_translate_reg_addr function, |
278 | * we need to add the REGISTER_BASE to the destination | ||
279 | */ | ||
256 | dest_addr += REGISTERS_BASE; | 280 | dest_addr += REGISTERS_BASE; |
257 | 281 | ||
258 | /* We move our pointer to the data */ | 282 | /* We move our pointer to the data */ |
@@ -280,8 +304,6 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl) | |||
280 | ALIGN(nvs_ptr - (u8 *)wl->nvs->nvs + 7, 4); | 304 | ALIGN(nvs_ptr - (u8 *)wl->nvs->nvs + 7, 4); |
281 | nvs_len -= nvs_ptr - (u8 *)wl->nvs->nvs; | 305 | nvs_len -= nvs_ptr - (u8 *)wl->nvs->nvs; |
282 | 306 | ||
283 | /* FIXME: The driver sets the partition here, but this is not needed, | ||
284 | since it sets to the same one as currently in use */ | ||
285 | /* Now we must set the partition correctly */ | 307 | /* Now we must set the partition correctly */ |
286 | wl1271_set_partition(wl, &part_table[PART_WORK]); | 308 | wl1271_set_partition(wl, &part_table[PART_WORK]); |
287 | 309 | ||
@@ -291,9 +313,6 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl) | |||
291 | return -ENOMEM; | 313 | return -ENOMEM; |
292 | 314 | ||
293 | /* And finally we upload the NVS tables */ | 315 | /* And finally we upload the NVS tables */ |
294 | /* FIXME: In wl1271, we upload everything at once. | ||
295 | No endianness handling needed here?! The ref driver doesn't do | ||
296 | anything about it at this point */ | ||
297 | wl1271_write(wl, CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, false); | 316 | wl1271_write(wl, CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, false); |
298 | 317 | ||
299 | kfree(nvs_aligned); | 318 | kfree(nvs_aligned); |
@@ -491,10 +510,7 @@ int wl1271_boot(struct wl1271 *wl) | |||
491 | 510 | ||
492 | wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause); | 511 | wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause); |
493 | 512 | ||
494 | pause &= ~(WU_COUNTER_PAUSE_VAL); /* FIXME: This should probably be | 513 | pause &= ~(WU_COUNTER_PAUSE_VAL); |
495 | * WU_COUNTER_PAUSE_VAL instead of | ||
496 | * 0x3ff (magic number ). How does | ||
497 | * this work?! */ | ||
498 | pause |= WU_COUNTER_PAUSE_VAL; | 514 | pause |= WU_COUNTER_PAUSE_VAL; |
499 | wl1271_write32(wl, WU_COUNTER_PAUSE, pause); | 515 | wl1271_write32(wl, WU_COUNTER_PAUSE, pause); |
500 | 516 | ||
@@ -548,7 +564,6 @@ int wl1271_boot(struct wl1271 *wl) | |||
548 | if (ret < 0) | 564 | if (ret < 0) |
549 | goto out; | 565 | goto out; |
550 | 566 | ||
551 | /* FIXME: Need to check whether this is really what we want */ | ||
552 | wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, | 567 | wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, |
553 | WL1271_ACX_ALL_EVENTS_VECTOR); | 568 | WL1271_ACX_ALL_EVENTS_VECTOR); |
554 | 569 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c index ce503ddd5a41..596e333919ae 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c | |||
@@ -94,6 +94,7 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, | |||
94 | status = le16_to_cpu(cmd->status); | 94 | status = le16_to_cpu(cmd->status); |
95 | if (status != CMD_STATUS_SUCCESS) { | 95 | if (status != CMD_STATUS_SUCCESS) { |
96 | wl1271_error("command execute failure %d", status); | 96 | wl1271_error("command execute failure %d", status); |
97 | ieee80211_queue_work(wl->hw, &wl->recovery_work); | ||
97 | ret = -EIO; | 98 | ret = -EIO; |
98 | } | 99 | } |
99 | 100 | ||
@@ -170,6 +171,39 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl) | |||
170 | return ret; | 171 | return ret; |
171 | } | 172 | } |
172 | 173 | ||
174 | int wl1271_cmd_ext_radio_parms(struct wl1271 *wl) | ||
175 | { | ||
176 | struct wl1271_ext_radio_parms_cmd *ext_radio_parms; | ||
177 | struct conf_rf_settings *rf = &wl->conf.rf; | ||
178 | int ret; | ||
179 | |||
180 | if (!wl->nvs) | ||
181 | return -ENODEV; | ||
182 | |||
183 | ext_radio_parms = kzalloc(sizeof(*ext_radio_parms), GFP_KERNEL); | ||
184 | if (!ext_radio_parms) | ||
185 | return -ENOMEM; | ||
186 | |||
187 | ext_radio_parms->test.id = TEST_CMD_INI_FILE_RF_EXTENDED_PARAM; | ||
188 | |||
189 | memcpy(ext_radio_parms->tx_per_channel_power_compensation_2, | ||
190 | rf->tx_per_channel_power_compensation_2, | ||
191 | CONF_TX_PWR_COMPENSATION_LEN_2); | ||
192 | memcpy(ext_radio_parms->tx_per_channel_power_compensation_5, | ||
193 | rf->tx_per_channel_power_compensation_5, | ||
194 | CONF_TX_PWR_COMPENSATION_LEN_5); | ||
195 | |||
196 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_EXT_RADIO_PARAM: ", | ||
197 | ext_radio_parms, sizeof(*ext_radio_parms)); | ||
198 | |||
199 | ret = wl1271_cmd_test(wl, ext_radio_parms, sizeof(*ext_radio_parms), 0); | ||
200 | if (ret < 0) | ||
201 | wl1271_warning("TEST_CMD_INI_FILE_RF_EXTENDED_PARAM failed"); | ||
202 | |||
203 | kfree(ext_radio_parms); | ||
204 | return ret; | ||
205 | } | ||
206 | |||
173 | /* | 207 | /* |
174 | * Poll the mailbox event field until any of the bits in the mask is set or a | 208 | * Poll the mailbox event field until any of the bits in the mask is set or a |
175 | * timeout occurs (WL1271_EVENT_TIMEOUT in msecs) | 209 | * timeout occurs (WL1271_EVENT_TIMEOUT in msecs) |
@@ -182,8 +216,10 @@ static int wl1271_cmd_wait_for_event(struct wl1271 *wl, u32 mask) | |||
182 | timeout = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT); | 216 | timeout = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT); |
183 | 217 | ||
184 | do { | 218 | do { |
185 | if (time_after(jiffies, timeout)) | 219 | if (time_after(jiffies, timeout)) { |
220 | ieee80211_queue_work(wl->hw, &wl->recovery_work); | ||
186 | return -ETIMEDOUT; | 221 | return -ETIMEDOUT; |
222 | } | ||
187 | 223 | ||
188 | msleep(1); | 224 | msleep(1); |
189 | 225 | ||
@@ -390,18 +426,11 @@ out: | |||
390 | return ret; | 426 | return ret; |
391 | } | 427 | } |
392 | 428 | ||
393 | int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send) | 429 | int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, u32 rates, bool send) |
394 | { | 430 | { |
395 | struct wl1271_cmd_ps_params *ps_params = NULL; | 431 | struct wl1271_cmd_ps_params *ps_params = NULL; |
396 | int ret = 0; | 432 | int ret = 0; |
397 | 433 | ||
398 | /* FIXME: this should be in ps.c */ | ||
399 | ret = wl1271_acx_wake_up_conditions(wl); | ||
400 | if (ret < 0) { | ||
401 | wl1271_error("couldn't set wake up conditions"); | ||
402 | goto out; | ||
403 | } | ||
404 | |||
405 | wl1271_debug(DEBUG_CMD, "cmd set ps mode"); | 434 | wl1271_debug(DEBUG_CMD, "cmd set ps mode"); |
406 | 435 | ||
407 | ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL); | 436 | ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL); |
@@ -412,9 +441,9 @@ int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send) | |||
412 | 441 | ||
413 | ps_params->ps_mode = ps_mode; | 442 | ps_params->ps_mode = ps_mode; |
414 | ps_params->send_null_data = send; | 443 | ps_params->send_null_data = send; |
415 | ps_params->retries = 5; | 444 | ps_params->retries = wl->conf.conn.psm_entry_nullfunc_retries; |
416 | ps_params->hang_over_period = 1; | 445 | ps_params->hang_over_period = wl->conf.conn.psm_entry_hangover_period; |
417 | ps_params->null_data_rate = cpu_to_le32(wl->basic_rate_set); | 446 | ps_params->null_data_rate = cpu_to_le32(rates); |
418 | 447 | ||
419 | ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params, | 448 | ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params, |
420 | sizeof(*ps_params), 0); | 449 | sizeof(*ps_params), 0); |
@@ -428,41 +457,6 @@ out: | |||
428 | return ret; | 457 | return ret; |
429 | } | 458 | } |
430 | 459 | ||
431 | int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, | ||
432 | size_t len) | ||
433 | { | ||
434 | struct cmd_read_write_memory *cmd; | ||
435 | int ret = 0; | ||
436 | |||
437 | wl1271_debug(DEBUG_CMD, "cmd read memory"); | ||
438 | |||
439 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | ||
440 | if (!cmd) { | ||
441 | ret = -ENOMEM; | ||
442 | goto out; | ||
443 | } | ||
444 | |||
445 | WARN_ON(len > MAX_READ_SIZE); | ||
446 | len = min_t(size_t, len, MAX_READ_SIZE); | ||
447 | |||
448 | cmd->addr = cpu_to_le32(addr); | ||
449 | cmd->size = cpu_to_le32(len); | ||
450 | |||
451 | ret = wl1271_cmd_send(wl, CMD_READ_MEMORY, cmd, sizeof(*cmd), | ||
452 | sizeof(*cmd)); | ||
453 | if (ret < 0) { | ||
454 | wl1271_error("read memory command failed: %d", ret); | ||
455 | goto out; | ||
456 | } | ||
457 | |||
458 | /* the read command got in */ | ||
459 | memcpy(answer, cmd->value, len); | ||
460 | |||
461 | out: | ||
462 | kfree(cmd); | ||
463 | return ret; | ||
464 | } | ||
465 | |||
466 | int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, | 460 | int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, |
467 | void *buf, size_t buf_len, int index, u32 rates) | 461 | void *buf, size_t buf_len, int index, u32 rates) |
468 | { | 462 | { |
@@ -523,7 +517,7 @@ int wl1271_cmd_build_null_data(struct wl1271 *wl) | |||
523 | } | 517 | } |
524 | 518 | ||
525 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, ptr, size, 0, | 519 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, ptr, size, 0, |
526 | WL1271_RATE_AUTOMATIC); | 520 | wl->basic_rate); |
527 | 521 | ||
528 | out: | 522 | out: |
529 | dev_kfree_skb(skb); | 523 | dev_kfree_skb(skb); |
@@ -546,7 +540,7 @@ int wl1271_cmd_build_klv_null_data(struct wl1271 *wl) | |||
546 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, | 540 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, |
547 | skb->data, skb->len, | 541 | skb->data, skb->len, |
548 | CMD_TEMPL_KLV_IDX_NULL_DATA, | 542 | CMD_TEMPL_KLV_IDX_NULL_DATA, |
549 | WL1271_RATE_AUTOMATIC); | 543 | wl->basic_rate); |
550 | 544 | ||
551 | out: | 545 | out: |
552 | dev_kfree_skb(skb); | 546 | dev_kfree_skb(skb); |
@@ -623,7 +617,7 @@ int wl1271_build_qos_null_data(struct wl1271 *wl) | |||
623 | 617 | ||
624 | return wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, &template, | 618 | return wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, &template, |
625 | sizeof(template), 0, | 619 | sizeof(template), 0, |
626 | WL1271_RATE_AUTOMATIC); | 620 | wl->basic_rate); |
627 | } | 621 | } |
628 | 622 | ||
629 | int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id) | 623 | int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id) |
@@ -746,3 +740,31 @@ out_free: | |||
746 | out: | 740 | out: |
747 | return ret; | 741 | return ret; |
748 | } | 742 | } |
743 | |||
744 | int wl1271_cmd_set_sta_state(struct wl1271 *wl) | ||
745 | { | ||
746 | struct wl1271_cmd_set_sta_state *cmd; | ||
747 | int ret = 0; | ||
748 | |||
749 | wl1271_debug(DEBUG_CMD, "cmd set sta state"); | ||
750 | |||
751 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | ||
752 | if (!cmd) { | ||
753 | ret = -ENOMEM; | ||
754 | goto out; | ||
755 | } | ||
756 | |||
757 | cmd->state = WL1271_CMD_STA_STATE_CONNECTED; | ||
758 | |||
759 | ret = wl1271_cmd_send(wl, CMD_SET_STA_STATE, cmd, sizeof(*cmd), 0); | ||
760 | if (ret < 0) { | ||
761 | wl1271_error("failed to send set STA state command"); | ||
762 | goto out_free; | ||
763 | } | ||
764 | |||
765 | out_free: | ||
766 | kfree(cmd); | ||
767 | |||
768 | out: | ||
769 | return ret; | ||
770 | } | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h index af577ee8eb02..a0caf4fc37b1 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.h +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h | |||
@@ -33,12 +33,13 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, | |||
33 | size_t res_len); | 33 | size_t res_len); |
34 | int wl1271_cmd_general_parms(struct wl1271 *wl); | 34 | int wl1271_cmd_general_parms(struct wl1271 *wl); |
35 | int wl1271_cmd_radio_parms(struct wl1271 *wl); | 35 | int wl1271_cmd_radio_parms(struct wl1271 *wl); |
36 | int wl1271_cmd_ext_radio_parms(struct wl1271 *wl); | ||
36 | int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type); | 37 | int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type); |
37 | int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); | 38 | int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); |
38 | int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); | 39 | int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); |
39 | int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len); | 40 | int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len); |
40 | int wl1271_cmd_data_path(struct wl1271 *wl, bool enable); | 41 | int wl1271_cmd_data_path(struct wl1271 *wl, bool enable); |
41 | int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send); | 42 | int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, u32 rates, bool send); |
42 | int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, | 43 | int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, |
43 | size_t len); | 44 | size_t len); |
44 | int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, | 45 | int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, |
@@ -55,6 +56,7 @@ int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, | |||
55 | u8 key_size, const u8 *key, const u8 *addr, | 56 | u8 key_size, const u8 *key, const u8 *addr, |
56 | u32 tx_seq_32, u16 tx_seq_16); | 57 | u32 tx_seq_32, u16 tx_seq_16); |
57 | int wl1271_cmd_disconnect(struct wl1271 *wl); | 58 | int wl1271_cmd_disconnect(struct wl1271 *wl); |
59 | int wl1271_cmd_set_sta_state(struct wl1271 *wl); | ||
58 | 60 | ||
59 | enum wl1271_commands { | 61 | enum wl1271_commands { |
60 | CMD_INTERROGATE = 1, /*use this to read information elements*/ | 62 | CMD_INTERROGATE = 1, /*use this to read information elements*/ |
@@ -160,41 +162,6 @@ enum { | |||
160 | MAX_COMMAND_STATUS = 0xff | 162 | MAX_COMMAND_STATUS = 0xff |
161 | }; | 163 | }; |
162 | 164 | ||
163 | |||
164 | /* | ||
165 | * CMD_READ_MEMORY | ||
166 | * | ||
167 | * The host issues this command to read the WiLink device memory/registers. | ||
168 | * | ||
169 | * Note: The Base Band address has special handling (16 bits registers and | ||
170 | * addresses). For more information, see the hardware specification. | ||
171 | */ | ||
172 | /* | ||
173 | * CMD_WRITE_MEMORY | ||
174 | * | ||
175 | * The host issues this command to write the WiLink device memory/registers. | ||
176 | * | ||
177 | * The Base Band address has special handling (16 bits registers and | ||
178 | * addresses). For more information, see the hardware specification. | ||
179 | */ | ||
180 | #define MAX_READ_SIZE 256 | ||
181 | |||
182 | struct cmd_read_write_memory { | ||
183 | struct wl1271_cmd_header header; | ||
184 | |||
185 | /* The address of the memory to read from or write to.*/ | ||
186 | __le32 addr; | ||
187 | |||
188 | /* The amount of data in bytes to read from or write to the WiLink | ||
189 | * device.*/ | ||
190 | __le32 size; | ||
191 | |||
192 | /* The actual value read from or written to the Wilink. The source | ||
193 | of this field is the Host in WRITE command or the Wilink in READ | ||
194 | command. */ | ||
195 | u8 value[MAX_READ_SIZE]; | ||
196 | } __packed; | ||
197 | |||
198 | #define CMDMBOX_HEADER_LEN 4 | 165 | #define CMDMBOX_HEADER_LEN 4 |
199 | #define CMDMBOX_INFO_ELEM_HEADER_LEN 4 | 166 | #define CMDMBOX_INFO_ELEM_HEADER_LEN 4 |
200 | 167 | ||
@@ -313,7 +280,7 @@ enum wl1271_cmd_key_type { | |||
313 | KEY_WEP = 1, | 280 | KEY_WEP = 1, |
314 | KEY_TKIP = 2, | 281 | KEY_TKIP = 2, |
315 | KEY_AES = 3, | 282 | KEY_AES = 3, |
316 | KEY_GEM = 4 | 283 | KEY_GEM = 4, |
317 | }; | 284 | }; |
318 | 285 | ||
319 | /* FIXME: Add description for key-types */ | 286 | /* FIXME: Add description for key-types */ |
@@ -358,13 +325,14 @@ enum wl1271_channel_tune_bands { | |||
358 | WL1271_CHANNEL_TUNE_BAND_4_9 | 325 | WL1271_CHANNEL_TUNE_BAND_4_9 |
359 | }; | 326 | }; |
360 | 327 | ||
361 | #define WL1271_PD_REFERENCE_POINT_BAND_B_G 0 | 328 | #define WL1271_PD_REFERENCE_POINT_BAND_B_G 0 |
362 | 329 | ||
363 | #define TEST_CMD_P2G_CAL 0x02 | 330 | #define TEST_CMD_P2G_CAL 0x02 |
364 | #define TEST_CMD_CHANNEL_TUNE 0x0d | 331 | #define TEST_CMD_CHANNEL_TUNE 0x0d |
365 | #define TEST_CMD_UPDATE_PD_REFERENCE_POINT 0x1d | 332 | #define TEST_CMD_UPDATE_PD_REFERENCE_POINT 0x1d |
366 | #define TEST_CMD_INI_FILE_RADIO_PARAM 0x19 | 333 | #define TEST_CMD_INI_FILE_RADIO_PARAM 0x19 |
367 | #define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E | 334 | #define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E |
335 | #define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26 | ||
368 | 336 | ||
369 | struct wl1271_general_parms_cmd { | 337 | struct wl1271_general_parms_cmd { |
370 | struct wl1271_cmd_header header; | 338 | struct wl1271_cmd_header header; |
@@ -397,6 +365,16 @@ struct wl1271_radio_parms_cmd { | |||
397 | u8 padding3[2]; | 365 | u8 padding3[2]; |
398 | } __packed; | 366 | } __packed; |
399 | 367 | ||
368 | struct wl1271_ext_radio_parms_cmd { | ||
369 | struct wl1271_cmd_header header; | ||
370 | |||
371 | struct wl1271_cmd_test_header test; | ||
372 | |||
373 | u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2]; | ||
374 | u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5]; | ||
375 | u8 padding[3]; | ||
376 | } __packed; | ||
377 | |||
400 | struct wl1271_cmd_cal_channel_tune { | 378 | struct wl1271_cmd_cal_channel_tune { |
401 | struct wl1271_cmd_header header; | 379 | struct wl1271_cmd_header header; |
402 | 380 | ||
@@ -469,4 +447,13 @@ struct wl1271_cmd_disconnect { | |||
469 | u8 padding; | 447 | u8 padding; |
470 | } __packed; | 448 | } __packed; |
471 | 449 | ||
450 | #define WL1271_CMD_STA_STATE_CONNECTED 1 | ||
451 | |||
452 | struct wl1271_cmd_set_sta_state { | ||
453 | struct wl1271_cmd_header header; | ||
454 | |||
455 | u8 state; | ||
456 | u8 padding[3]; | ||
457 | } __packed; | ||
458 | |||
472 | #endif /* __WL1271_CMD_H__ */ | 459 | #endif /* __WL1271_CMD_H__ */ |
diff --git a/drivers/net/wireless/wl12xx/wl1271_conf.h b/drivers/net/wireless/wl12xx/wl1271_conf.h index 0435ffda8f73..5f78a6cb1433 100644 --- a/drivers/net/wireless/wl12xx/wl1271_conf.h +++ b/drivers/net/wireless/wl12xx/wl1271_conf.h | |||
@@ -595,7 +595,7 @@ struct conf_tx_ac_category { | |||
595 | u16 tx_op_limit; | 595 | u16 tx_op_limit; |
596 | }; | 596 | }; |
597 | 597 | ||
598 | #define CONF_TX_MAX_TID_COUNT 7 | 598 | #define CONF_TX_MAX_TID_COUNT 8 |
599 | 599 | ||
600 | enum { | 600 | enum { |
601 | CONF_CHANNEL_TYPE_DCF = 0, /* DC/LEGACY*/ | 601 | CONF_CHANNEL_TYPE_DCF = 0, /* DC/LEGACY*/ |
@@ -912,6 +912,22 @@ struct conf_conn_settings { | |||
912 | u8 psm_entry_retries; | 912 | u8 psm_entry_retries; |
913 | 913 | ||
914 | /* | 914 | /* |
915 | * Specifies the maximum number of times to try transmit the PSM entry | ||
916 | * null-func frame for each PSM entry attempt | ||
917 | * | ||
918 | * Range 0 - 255 | ||
919 | */ | ||
920 | u8 psm_entry_nullfunc_retries; | ||
921 | |||
922 | /* | ||
923 | * Specifies the time to linger in active mode after successfully | ||
924 | * transmitting the PSM entry null-func frame. | ||
925 | * | ||
926 | * Range 0 - 255 TU's | ||
927 | */ | ||
928 | u8 psm_entry_hangover_period; | ||
929 | |||
930 | /* | ||
915 | * | 931 | * |
916 | * Specifies the interval of the connection keep-alive null-func | 932 | * Specifies the interval of the connection keep-alive null-func |
917 | * frame in ms. | 933 | * frame in ms. |
@@ -1016,6 +1032,64 @@ struct conf_roam_trigger_settings { | |||
1016 | u8 avg_weight_snr_data; | 1032 | u8 avg_weight_snr_data; |
1017 | }; | 1033 | }; |
1018 | 1034 | ||
1035 | struct conf_scan_settings { | ||
1036 | /* | ||
1037 | * The minimum time to wait on each channel for active scans | ||
1038 | * | ||
1039 | * Range: 0 - 65536 tu | ||
1040 | */ | ||
1041 | u16 min_dwell_time_active; | ||
1042 | |||
1043 | /* | ||
1044 | * The maximum time to wait on each channel for active scans | ||
1045 | * | ||
1046 | * Range: 0 - 65536 tu | ||
1047 | */ | ||
1048 | u16 max_dwell_time_active; | ||
1049 | |||
1050 | /* | ||
1051 | * The maximum time to wait on each channel for passive scans | ||
1052 | * | ||
1053 | * Range: 0 - 65536 tu | ||
1054 | */ | ||
1055 | u16 min_dwell_time_passive; | ||
1056 | |||
1057 | /* | ||
1058 | * The maximum time to wait on each channel for passive scans | ||
1059 | * | ||
1060 | * Range: 0 - 65536 tu | ||
1061 | */ | ||
1062 | u16 max_dwell_time_passive; | ||
1063 | |||
1064 | /* | ||
1065 | * Number of probe requests to transmit on each active scan channel | ||
1066 | * | ||
1067 | * Range: u8 | ||
1068 | */ | ||
1069 | u16 num_probe_reqs; | ||
1070 | |||
1071 | }; | ||
1072 | |||
1073 | /* these are number of channels on the band divided by two, rounded up */ | ||
1074 | #define CONF_TX_PWR_COMPENSATION_LEN_2 7 | ||
1075 | #define CONF_TX_PWR_COMPENSATION_LEN_5 18 | ||
1076 | |||
1077 | struct conf_rf_settings { | ||
1078 | /* | ||
1079 | * Per channel power compensation for 2.4GHz | ||
1080 | * | ||
1081 | * Range: s8 | ||
1082 | */ | ||
1083 | u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2]; | ||
1084 | |||
1085 | /* | ||
1086 | * Per channel power compensation for 5GHz | ||
1087 | * | ||
1088 | * Range: s8 | ||
1089 | */ | ||
1090 | u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5]; | ||
1091 | }; | ||
1092 | |||
1019 | struct conf_drv_settings { | 1093 | struct conf_drv_settings { |
1020 | struct conf_sg_settings sg; | 1094 | struct conf_sg_settings sg; |
1021 | struct conf_rx_settings rx; | 1095 | struct conf_rx_settings rx; |
@@ -1024,6 +1098,8 @@ struct conf_drv_settings { | |||
1024 | struct conf_itrim_settings itrim; | 1098 | struct conf_itrim_settings itrim; |
1025 | struct conf_pm_config_settings pm_config; | 1099 | struct conf_pm_config_settings pm_config; |
1026 | struct conf_roam_trigger_settings roam_trigger; | 1100 | struct conf_roam_trigger_settings roam_trigger; |
1101 | struct conf_scan_settings scan; | ||
1102 | struct conf_rf_settings rf; | ||
1027 | }; | 1103 | }; |
1028 | 1104 | ||
1029 | #endif | 1105 | #endif |
diff --git a/drivers/net/wireless/wl12xx/wl1271_event.c b/drivers/net/wireless/wl12xx/wl1271_event.c index 25ce2cd5e3f3..7b3f50382963 100644 --- a/drivers/net/wireless/wl12xx/wl1271_event.c +++ b/drivers/net/wireless/wl12xx/wl1271_event.c | |||
@@ -41,6 +41,9 @@ void wl1271_pspoll_work(struct work_struct *work) | |||
41 | 41 | ||
42 | mutex_lock(&wl->mutex); | 42 | mutex_lock(&wl->mutex); |
43 | 43 | ||
44 | if (unlikely(wl->state == WL1271_STATE_OFF)) | ||
45 | goto out; | ||
46 | |||
44 | if (!test_and_clear_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags)) | 47 | if (!test_and_clear_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags)) |
45 | goto out; | 48 | goto out; |
46 | 49 | ||
@@ -52,7 +55,7 @@ void wl1271_pspoll_work(struct work_struct *work) | |||
52 | * delivery failure occurred, and no-one changed state since, so | 55 | * delivery failure occurred, and no-one changed state since, so |
53 | * we should go back to powersave. | 56 | * we should go back to powersave. |
54 | */ | 57 | */ |
55 | wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, true); | 58 | wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, wl->basic_rate, true); |
56 | 59 | ||
57 | out: | 60 | out: |
58 | mutex_unlock(&wl->mutex); | 61 | mutex_unlock(&wl->mutex); |
@@ -70,7 +73,8 @@ static void wl1271_event_pspoll_delivery_fail(struct wl1271 *wl) | |||
70 | 73 | ||
71 | /* force active mode receive data from the AP */ | 74 | /* force active mode receive data from the AP */ |
72 | if (test_bit(WL1271_FLAG_PSM, &wl->flags)) { | 75 | if (test_bit(WL1271_FLAG_PSM, &wl->flags)) { |
73 | ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, true); | 76 | ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, |
77 | wl->basic_rate, true); | ||
74 | if (ret < 0) | 78 | if (ret < 0) |
75 | return; | 79 | return; |
76 | set_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags); | 80 | set_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags); |
@@ -91,6 +95,7 @@ static int wl1271_event_ps_report(struct wl1271 *wl, | |||
91 | bool *beacon_loss) | 95 | bool *beacon_loss) |
92 | { | 96 | { |
93 | int ret = 0; | 97 | int ret = 0; |
98 | u32 total_retries = wl->conf.conn.psm_entry_retries; | ||
94 | 99 | ||
95 | wl1271_debug(DEBUG_EVENT, "ps_status: 0x%x", mbox->ps_status); | 100 | wl1271_debug(DEBUG_EVENT, "ps_status: 0x%x", mbox->ps_status); |
96 | 101 | ||
@@ -104,10 +109,10 @@ static int wl1271_event_ps_report(struct wl1271 *wl, | |||
104 | break; | 109 | break; |
105 | } | 110 | } |
106 | 111 | ||
107 | if (wl->psm_entry_retry < wl->conf.conn.psm_entry_retries) { | 112 | if (wl->psm_entry_retry < total_retries) { |
108 | wl->psm_entry_retry++; | 113 | wl->psm_entry_retry++; |
109 | ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, | 114 | ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, |
110 | true); | 115 | wl->basic_rate, true); |
111 | } else { | 116 | } else { |
112 | wl1271_info("No ack to nullfunc from AP."); | 117 | wl1271_info("No ack to nullfunc from AP."); |
113 | wl->psm_entry_retry = 0; | 118 | wl->psm_entry_retry = 0; |
@@ -143,7 +148,7 @@ static int wl1271_event_ps_report(struct wl1271 *wl, | |||
143 | /* make sure the firmware goes to active mode - the frame to | 148 | /* make sure the firmware goes to active mode - the frame to |
144 | be sent next will indicate to the AP, that we are active. */ | 149 | be sent next will indicate to the AP, that we are active. */ |
145 | ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, | 150 | ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, |
146 | false); | 151 | wl->basic_rate, false); |
147 | break; | 152 | break; |
148 | case EVENT_EXIT_POWER_SAVE_SUCCESS: | 153 | case EVENT_EXIT_POWER_SAVE_SUCCESS: |
149 | default: | 154 | default: |
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c index 4447af1557f5..8044bba70ee7 100644 --- a/drivers/net/wireless/wl12xx/wl1271_init.c +++ b/drivers/net/wireless/wl12xx/wl1271_init.c | |||
@@ -53,6 +53,7 @@ static int wl1271_init_hwenc_config(struct wl1271 *wl) | |||
53 | int wl1271_init_templates_config(struct wl1271 *wl) | 53 | int wl1271_init_templates_config(struct wl1271 *wl) |
54 | { | 54 | { |
55 | int ret, i; | 55 | int ret, i; |
56 | size_t size; | ||
56 | 57 | ||
57 | /* send empty templates for fw memory reservation */ | 58 | /* send empty templates for fw memory reservation */ |
58 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL, | 59 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL, |
@@ -61,14 +62,12 @@ int wl1271_init_templates_config(struct wl1271 *wl) | |||
61 | if (ret < 0) | 62 | if (ret < 0) |
62 | return ret; | 63 | return ret; |
63 | 64 | ||
64 | if (wl1271_11a_enabled()) { | 65 | size = sizeof(struct wl12xx_probe_req_template); |
65 | size_t size = sizeof(struct wl12xx_probe_req_template); | 66 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5, |
66 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5, | 67 | NULL, size, 0, |
67 | NULL, size, 0, | 68 | WL1271_RATE_AUTOMATIC); |
68 | WL1271_RATE_AUTOMATIC); | 69 | if (ret < 0) |
69 | if (ret < 0) | 70 | return ret; |
70 | return ret; | ||
71 | } | ||
72 | 71 | ||
73 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL, | 72 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, NULL, |
74 | sizeof(struct wl12xx_null_data_template), | 73 | sizeof(struct wl12xx_null_data_template), |
@@ -223,6 +222,10 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
223 | if (ret < 0) | 222 | if (ret < 0) |
224 | return ret; | 223 | return ret; |
225 | 224 | ||
225 | ret = wl1271_cmd_ext_radio_parms(wl); | ||
226 | if (ret < 0) | ||
227 | return ret; | ||
228 | |||
226 | /* Template settings */ | 229 | /* Template settings */ |
227 | ret = wl1271_init_templates_config(wl); | 230 | ret = wl1271_init_templates_config(wl); |
228 | if (ret < 0) | 231 | if (ret < 0) |
@@ -291,8 +294,16 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
291 | if (ret < 0) | 294 | if (ret < 0) |
292 | goto out_free_memmap; | 295 | goto out_free_memmap; |
293 | 296 | ||
294 | /* Default TID configuration */ | 297 | /* Default TID/AC configuration */ |
298 | BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count); | ||
295 | for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { | 299 | for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { |
300 | conf_ac = &wl->conf.tx.ac_conf[i]; | ||
301 | ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min, | ||
302 | conf_ac->cw_max, conf_ac->aifsn, | ||
303 | conf_ac->tx_op_limit); | ||
304 | if (ret < 0) | ||
305 | goto out_free_memmap; | ||
306 | |||
296 | conf_tid = &wl->conf.tx.tid_conf[i]; | 307 | conf_tid = &wl->conf.tx.tid_conf[i]; |
297 | ret = wl1271_acx_tid_cfg(wl, conf_tid->queue_id, | 308 | ret = wl1271_acx_tid_cfg(wl, conf_tid->queue_id, |
298 | conf_tid->channel_type, | 309 | conf_tid->channel_type, |
@@ -305,16 +316,6 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
305 | goto out_free_memmap; | 316 | goto out_free_memmap; |
306 | } | 317 | } |
307 | 318 | ||
308 | /* Default AC configuration */ | ||
309 | for (i = 0; i < wl->conf.tx.ac_conf_count; i++) { | ||
310 | conf_ac = &wl->conf.tx.ac_conf[i]; | ||
311 | ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min, | ||
312 | conf_ac->cw_max, conf_ac->aifsn, | ||
313 | conf_ac->tx_op_limit); | ||
314 | if (ret < 0) | ||
315 | goto out_free_memmap; | ||
316 | } | ||
317 | |||
318 | /* Configure TX rate classes */ | 319 | /* Configure TX rate classes */ |
319 | ret = wl1271_acx_rate_policies(wl); | 320 | ret = wl1271_acx_rate_policies(wl); |
320 | if (ret < 0) | 321 | if (ret < 0) |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 776cd7c41148..48a4b9961ae6 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -124,28 +124,28 @@ static struct conf_drv_settings default_conf = { | |||
124 | }, | 124 | }, |
125 | .ac_conf_count = 4, | 125 | .ac_conf_count = 4, |
126 | .ac_conf = { | 126 | .ac_conf = { |
127 | [0] = { | 127 | [CONF_TX_AC_BE] = { |
128 | .ac = CONF_TX_AC_BE, | 128 | .ac = CONF_TX_AC_BE, |
129 | .cw_min = 15, | 129 | .cw_min = 15, |
130 | .cw_max = 63, | 130 | .cw_max = 63, |
131 | .aifsn = 3, | 131 | .aifsn = 3, |
132 | .tx_op_limit = 0, | 132 | .tx_op_limit = 0, |
133 | }, | 133 | }, |
134 | [1] = { | 134 | [CONF_TX_AC_BK] = { |
135 | .ac = CONF_TX_AC_BK, | 135 | .ac = CONF_TX_AC_BK, |
136 | .cw_min = 15, | 136 | .cw_min = 15, |
137 | .cw_max = 63, | 137 | .cw_max = 63, |
138 | .aifsn = 7, | 138 | .aifsn = 7, |
139 | .tx_op_limit = 0, | 139 | .tx_op_limit = 0, |
140 | }, | 140 | }, |
141 | [2] = { | 141 | [CONF_TX_AC_VI] = { |
142 | .ac = CONF_TX_AC_VI, | 142 | .ac = CONF_TX_AC_VI, |
143 | .cw_min = 15, | 143 | .cw_min = 15, |
144 | .cw_max = 63, | 144 | .cw_max = 63, |
145 | .aifsn = CONF_TX_AIFS_PIFS, | 145 | .aifsn = CONF_TX_AIFS_PIFS, |
146 | .tx_op_limit = 3008, | 146 | .tx_op_limit = 3008, |
147 | }, | 147 | }, |
148 | [3] = { | 148 | [CONF_TX_AC_VO] = { |
149 | .ac = CONF_TX_AC_VO, | 149 | .ac = CONF_TX_AC_VO, |
150 | .cw_min = 15, | 150 | .cw_min = 15, |
151 | .cw_max = 63, | 151 | .cw_max = 63, |
@@ -153,64 +153,40 @@ static struct conf_drv_settings default_conf = { | |||
153 | .tx_op_limit = 1504, | 153 | .tx_op_limit = 1504, |
154 | }, | 154 | }, |
155 | }, | 155 | }, |
156 | .tid_conf_count = 7, | 156 | .tid_conf_count = 4, |
157 | .tid_conf = { | 157 | .tid_conf = { |
158 | [0] = { | 158 | [CONF_TX_AC_BE] = { |
159 | .queue_id = 0, | 159 | .queue_id = CONF_TX_AC_BE, |
160 | .channel_type = CONF_CHANNEL_TYPE_DCF, | 160 | .channel_type = CONF_CHANNEL_TYPE_EDCF, |
161 | .tsid = CONF_TX_AC_BE, | ||
162 | .ps_scheme = CONF_PS_SCHEME_LEGACY, | ||
163 | .ack_policy = CONF_ACK_POLICY_LEGACY, | ||
164 | .apsd_conf = {0, 0}, | ||
165 | }, | ||
166 | [1] = { | ||
167 | .queue_id = 1, | ||
168 | .channel_type = CONF_CHANNEL_TYPE_DCF, | ||
169 | .tsid = CONF_TX_AC_BE, | 161 | .tsid = CONF_TX_AC_BE, |
170 | .ps_scheme = CONF_PS_SCHEME_LEGACY, | 162 | .ps_scheme = CONF_PS_SCHEME_LEGACY, |
171 | .ack_policy = CONF_ACK_POLICY_LEGACY, | 163 | .ack_policy = CONF_ACK_POLICY_LEGACY, |
172 | .apsd_conf = {0, 0}, | 164 | .apsd_conf = {0, 0}, |
173 | }, | 165 | }, |
174 | [2] = { | 166 | [CONF_TX_AC_BK] = { |
175 | .queue_id = 2, | 167 | .queue_id = CONF_TX_AC_BK, |
176 | .channel_type = CONF_CHANNEL_TYPE_DCF, | 168 | .channel_type = CONF_CHANNEL_TYPE_EDCF, |
177 | .tsid = CONF_TX_AC_BE, | 169 | .tsid = CONF_TX_AC_BK, |
178 | .ps_scheme = CONF_PS_SCHEME_LEGACY, | 170 | .ps_scheme = CONF_PS_SCHEME_LEGACY, |
179 | .ack_policy = CONF_ACK_POLICY_LEGACY, | 171 | .ack_policy = CONF_ACK_POLICY_LEGACY, |
180 | .apsd_conf = {0, 0}, | 172 | .apsd_conf = {0, 0}, |
181 | }, | 173 | }, |
182 | [3] = { | 174 | [CONF_TX_AC_VI] = { |
183 | .queue_id = 3, | 175 | .queue_id = CONF_TX_AC_VI, |
184 | .channel_type = CONF_CHANNEL_TYPE_DCF, | 176 | .channel_type = CONF_CHANNEL_TYPE_EDCF, |
185 | .tsid = CONF_TX_AC_BE, | 177 | .tsid = CONF_TX_AC_VI, |
186 | .ps_scheme = CONF_PS_SCHEME_LEGACY, | ||
187 | .ack_policy = CONF_ACK_POLICY_LEGACY, | ||
188 | .apsd_conf = {0, 0}, | ||
189 | }, | ||
190 | [4] = { | ||
191 | .queue_id = 4, | ||
192 | .channel_type = CONF_CHANNEL_TYPE_DCF, | ||
193 | .tsid = CONF_TX_AC_BE, | ||
194 | .ps_scheme = CONF_PS_SCHEME_LEGACY, | 178 | .ps_scheme = CONF_PS_SCHEME_LEGACY, |
195 | .ack_policy = CONF_ACK_POLICY_LEGACY, | 179 | .ack_policy = CONF_ACK_POLICY_LEGACY, |
196 | .apsd_conf = {0, 0}, | 180 | .apsd_conf = {0, 0}, |
197 | }, | 181 | }, |
198 | [5] = { | 182 | [CONF_TX_AC_VO] = { |
199 | .queue_id = 5, | 183 | .queue_id = CONF_TX_AC_VO, |
200 | .channel_type = CONF_CHANNEL_TYPE_DCF, | 184 | .channel_type = CONF_CHANNEL_TYPE_EDCF, |
201 | .tsid = CONF_TX_AC_BE, | 185 | .tsid = CONF_TX_AC_VO, |
202 | .ps_scheme = CONF_PS_SCHEME_LEGACY, | 186 | .ps_scheme = CONF_PS_SCHEME_LEGACY, |
203 | .ack_policy = CONF_ACK_POLICY_LEGACY, | 187 | .ack_policy = CONF_ACK_POLICY_LEGACY, |
204 | .apsd_conf = {0, 0}, | 188 | .apsd_conf = {0, 0}, |
205 | }, | 189 | }, |
206 | [6] = { | ||
207 | .queue_id = 6, | ||
208 | .channel_type = CONF_CHANNEL_TYPE_DCF, | ||
209 | .tsid = CONF_TX_AC_BE, | ||
210 | .ps_scheme = CONF_PS_SCHEME_LEGACY, | ||
211 | .ack_policy = CONF_ACK_POLICY_LEGACY, | ||
212 | .apsd_conf = {0, 0}, | ||
213 | } | ||
214 | }, | 190 | }, |
215 | .frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD, | 191 | .frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD, |
216 | .tx_compl_timeout = 700, | 192 | .tx_compl_timeout = 700, |
@@ -238,7 +214,9 @@ static struct conf_drv_settings default_conf = { | |||
238 | .ps_poll_recovery_period = 700, | 214 | .ps_poll_recovery_period = 700, |
239 | .bet_enable = CONF_BET_MODE_ENABLE, | 215 | .bet_enable = CONF_BET_MODE_ENABLE, |
240 | .bet_max_consecutive = 10, | 216 | .bet_max_consecutive = 10, |
241 | .psm_entry_retries = 3, | 217 | .psm_entry_retries = 5, |
218 | .psm_entry_nullfunc_retries = 3, | ||
219 | .psm_entry_hangover_period = 1, | ||
242 | .keep_alive_interval = 55000, | 220 | .keep_alive_interval = 55000, |
243 | .max_listen_interval = 20, | 221 | .max_listen_interval = 20, |
244 | }, | 222 | }, |
@@ -251,15 +229,34 @@ static struct conf_drv_settings default_conf = { | |||
251 | .host_fast_wakeup_support = false | 229 | .host_fast_wakeup_support = false |
252 | }, | 230 | }, |
253 | .roam_trigger = { | 231 | .roam_trigger = { |
254 | /* FIXME: due to firmware bug, must use value 1 for now */ | ||
255 | .trigger_pacing = 1, | 232 | .trigger_pacing = 1, |
256 | .avg_weight_rssi_beacon = 20, | 233 | .avg_weight_rssi_beacon = 20, |
257 | .avg_weight_rssi_data = 10, | 234 | .avg_weight_rssi_data = 10, |
258 | .avg_weight_snr_beacon = 20, | 235 | .avg_weight_snr_beacon = 20, |
259 | .avg_weight_snr_data = 10 | 236 | .avg_weight_snr_data = 10 |
260 | } | 237 | }, |
238 | .scan = { | ||
239 | .min_dwell_time_active = 7500, | ||
240 | .max_dwell_time_active = 30000, | ||
241 | .min_dwell_time_passive = 30000, | ||
242 | .max_dwell_time_passive = 60000, | ||
243 | .num_probe_reqs = 2, | ||
244 | }, | ||
245 | .rf = { | ||
246 | .tx_per_channel_power_compensation_2 = { | ||
247 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
248 | }, | ||
249 | .tx_per_channel_power_compensation_5 = { | ||
250 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
251 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
252 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
253 | }, | ||
254 | }, | ||
261 | }; | 255 | }; |
262 | 256 | ||
257 | static void __wl1271_op_remove_interface(struct wl1271 *wl); | ||
258 | |||
259 | |||
263 | static void wl1271_device_release(struct device *dev) | 260 | static void wl1271_device_release(struct device *dev) |
264 | { | 261 | { |
265 | 262 | ||
@@ -277,6 +274,67 @@ static struct platform_device wl1271_device = { | |||
277 | 274 | ||
278 | static LIST_HEAD(wl_list); | 275 | static LIST_HEAD(wl_list); |
279 | 276 | ||
277 | static int wl1271_dev_notify(struct notifier_block *me, unsigned long what, | ||
278 | void *arg) | ||
279 | { | ||
280 | struct net_device *dev = arg; | ||
281 | struct wireless_dev *wdev; | ||
282 | struct wiphy *wiphy; | ||
283 | struct ieee80211_hw *hw; | ||
284 | struct wl1271 *wl; | ||
285 | struct wl1271 *wl_temp; | ||
286 | int ret = 0; | ||
287 | |||
288 | /* Check that this notification is for us. */ | ||
289 | if (what != NETDEV_CHANGE) | ||
290 | return NOTIFY_DONE; | ||
291 | |||
292 | wdev = dev->ieee80211_ptr; | ||
293 | if (wdev == NULL) | ||
294 | return NOTIFY_DONE; | ||
295 | |||
296 | wiphy = wdev->wiphy; | ||
297 | if (wiphy == NULL) | ||
298 | return NOTIFY_DONE; | ||
299 | |||
300 | hw = wiphy_priv(wiphy); | ||
301 | if (hw == NULL) | ||
302 | return NOTIFY_DONE; | ||
303 | |||
304 | wl_temp = hw->priv; | ||
305 | list_for_each_entry(wl, &wl_list, list) { | ||
306 | if (wl == wl_temp) | ||
307 | break; | ||
308 | } | ||
309 | if (wl != wl_temp) | ||
310 | return NOTIFY_DONE; | ||
311 | |||
312 | mutex_lock(&wl->mutex); | ||
313 | |||
314 | if (wl->state == WL1271_STATE_OFF) | ||
315 | goto out; | ||
316 | |||
317 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | ||
318 | goto out; | ||
319 | |||
320 | ret = wl1271_ps_elp_wakeup(wl, false); | ||
321 | if (ret < 0) | ||
322 | goto out; | ||
323 | |||
324 | if ((dev->operstate == IF_OPER_UP) && | ||
325 | !test_and_set_bit(WL1271_FLAG_STA_STATE_SENT, &wl->flags)) { | ||
326 | wl1271_cmd_set_sta_state(wl); | ||
327 | wl1271_info("Association completed."); | ||
328 | } | ||
329 | |||
330 | wl1271_ps_elp_sleep(wl); | ||
331 | |||
332 | out: | ||
333 | mutex_unlock(&wl->mutex); | ||
334 | |||
335 | return NOTIFY_OK; | ||
336 | } | ||
337 | |||
280 | static void wl1271_conf_init(struct wl1271 *wl) | 338 | static void wl1271_conf_init(struct wl1271 *wl) |
281 | { | 339 | { |
282 | 340 | ||
@@ -309,6 +367,10 @@ static int wl1271_plt_init(struct wl1271 *wl) | |||
309 | if (ret < 0) | 367 | if (ret < 0) |
310 | return ret; | 368 | return ret; |
311 | 369 | ||
370 | ret = wl1271_cmd_ext_radio_parms(wl); | ||
371 | if (ret < 0) | ||
372 | return ret; | ||
373 | |||
312 | ret = wl1271_init_templates_config(wl); | 374 | ret = wl1271_init_templates_config(wl); |
313 | if (ret < 0) | 375 | if (ret < 0) |
314 | return ret; | 376 | return ret; |
@@ -346,8 +408,16 @@ static int wl1271_plt_init(struct wl1271 *wl) | |||
346 | if (ret < 0) | 408 | if (ret < 0) |
347 | goto out_free_memmap; | 409 | goto out_free_memmap; |
348 | 410 | ||
349 | /* Default TID configuration */ | 411 | /* Default TID/AC configuration */ |
412 | BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count); | ||
350 | for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { | 413 | for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { |
414 | conf_ac = &wl->conf.tx.ac_conf[i]; | ||
415 | ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min, | ||
416 | conf_ac->cw_max, conf_ac->aifsn, | ||
417 | conf_ac->tx_op_limit); | ||
418 | if (ret < 0) | ||
419 | goto out_free_memmap; | ||
420 | |||
351 | conf_tid = &wl->conf.tx.tid_conf[i]; | 421 | conf_tid = &wl->conf.tx.tid_conf[i]; |
352 | ret = wl1271_acx_tid_cfg(wl, conf_tid->queue_id, | 422 | ret = wl1271_acx_tid_cfg(wl, conf_tid->queue_id, |
353 | conf_tid->channel_type, | 423 | conf_tid->channel_type, |
@@ -360,16 +430,6 @@ static int wl1271_plt_init(struct wl1271 *wl) | |||
360 | goto out_free_memmap; | 430 | goto out_free_memmap; |
361 | } | 431 | } |
362 | 432 | ||
363 | /* Default AC configuration */ | ||
364 | for (i = 0; i < wl->conf.tx.ac_conf_count; i++) { | ||
365 | conf_ac = &wl->conf.tx.ac_conf[i]; | ||
366 | ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min, | ||
367 | conf_ac->cw_max, conf_ac->aifsn, | ||
368 | conf_ac->tx_op_limit); | ||
369 | if (ret < 0) | ||
370 | goto out_free_memmap; | ||
371 | } | ||
372 | |||
373 | /* Enable data path */ | 433 | /* Enable data path */ |
374 | ret = wl1271_cmd_data_path(wl, 1); | 434 | ret = wl1271_cmd_data_path(wl, 1); |
375 | if (ret < 0) | 435 | if (ret < 0) |
@@ -562,20 +622,6 @@ static int wl1271_fetch_nvs(struct wl1271 *wl) | |||
562 | return ret; | 622 | return ret; |
563 | } | 623 | } |
564 | 624 | ||
565 | /* | ||
566 | * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band | ||
567 | * configurations) can be removed when those NVS files stop floating | ||
568 | * around. | ||
569 | */ | ||
570 | if (fw->size != sizeof(struct wl1271_nvs_file) && | ||
571 | (fw->size != WL1271_INI_LEGACY_NVS_FILE_SIZE || | ||
572 | wl1271_11a_enabled())) { | ||
573 | wl1271_error("nvs size is not as expected: %zu != %zu", | ||
574 | fw->size, sizeof(struct wl1271_nvs_file)); | ||
575 | ret = -EILSEQ; | ||
576 | goto out; | ||
577 | } | ||
578 | |||
579 | wl->nvs = kmemdup(fw->data, sizeof(struct wl1271_nvs_file), GFP_KERNEL); | 625 | wl->nvs = kmemdup(fw->data, sizeof(struct wl1271_nvs_file), GFP_KERNEL); |
580 | 626 | ||
581 | if (!wl->nvs) { | 627 | if (!wl->nvs) { |
@@ -584,12 +630,37 @@ static int wl1271_fetch_nvs(struct wl1271 *wl) | |||
584 | goto out; | 630 | goto out; |
585 | } | 631 | } |
586 | 632 | ||
633 | wl->nvs_len = fw->size; | ||
634 | |||
587 | out: | 635 | out: |
588 | release_firmware(fw); | 636 | release_firmware(fw); |
589 | 637 | ||
590 | return ret; | 638 | return ret; |
591 | } | 639 | } |
592 | 640 | ||
641 | static void wl1271_recovery_work(struct work_struct *work) | ||
642 | { | ||
643 | struct wl1271 *wl = | ||
644 | container_of(work, struct wl1271, recovery_work); | ||
645 | |||
646 | mutex_lock(&wl->mutex); | ||
647 | |||
648 | if (wl->state != WL1271_STATE_ON) | ||
649 | goto out; | ||
650 | |||
651 | wl1271_info("Hardware recovery in progress."); | ||
652 | |||
653 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | ||
654 | ieee80211_connection_loss(wl->vif); | ||
655 | |||
656 | /* reboot the chipset */ | ||
657 | __wl1271_op_remove_interface(wl); | ||
658 | ieee80211_restart_hw(wl->hw); | ||
659 | |||
660 | out: | ||
661 | mutex_unlock(&wl->mutex); | ||
662 | } | ||
663 | |||
593 | static void wl1271_fw_wakeup(struct wl1271 *wl) | 664 | static void wl1271_fw_wakeup(struct wl1271 *wl) |
594 | { | 665 | { |
595 | u32 elp_reg; | 666 | u32 elp_reg; |
@@ -610,8 +681,6 @@ static int wl1271_setup(struct wl1271 *wl) | |||
610 | return -ENOMEM; | 681 | return -ENOMEM; |
611 | } | 682 | } |
612 | 683 | ||
613 | INIT_WORK(&wl->irq_work, wl1271_irq_work); | ||
614 | INIT_WORK(&wl->tx_work, wl1271_tx_work); | ||
615 | return 0; | 684 | return 0; |
616 | } | 685 | } |
617 | 686 | ||
@@ -768,10 +837,12 @@ int wl1271_plt_stop(struct wl1271 *wl) | |||
768 | out: | 837 | out: |
769 | mutex_unlock(&wl->mutex); | 838 | mutex_unlock(&wl->mutex); |
770 | 839 | ||
840 | cancel_work_sync(&wl->irq_work); | ||
841 | cancel_work_sync(&wl->recovery_work); | ||
842 | |||
771 | return ret; | 843 | return ret; |
772 | } | 844 | } |
773 | 845 | ||
774 | |||
775 | static int wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 846 | static int wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
776 | { | 847 | { |
777 | struct wl1271 *wl = hw->priv; | 848 | struct wl1271 *wl = hw->priv; |
@@ -814,6 +885,10 @@ static int wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
814 | return NETDEV_TX_OK; | 885 | return NETDEV_TX_OK; |
815 | } | 886 | } |
816 | 887 | ||
888 | static struct notifier_block wl1271_dev_notifier = { | ||
889 | .notifier_call = wl1271_dev_notify, | ||
890 | }; | ||
891 | |||
817 | static int wl1271_op_start(struct ieee80211_hw *hw) | 892 | static int wl1271_op_start(struct ieee80211_hw *hw) |
818 | { | 893 | { |
819 | wl1271_debug(DEBUG_MAC80211, "mac80211 start"); | 894 | wl1271_debug(DEBUG_MAC80211, "mac80211 start"); |
@@ -930,13 +1005,10 @@ out: | |||
930 | return ret; | 1005 | return ret; |
931 | } | 1006 | } |
932 | 1007 | ||
933 | static void wl1271_op_remove_interface(struct ieee80211_hw *hw, | 1008 | static void __wl1271_op_remove_interface(struct wl1271 *wl) |
934 | struct ieee80211_vif *vif) | ||
935 | { | 1009 | { |
936 | struct wl1271 *wl = hw->priv; | ||
937 | int i; | 1010 | int i; |
938 | 1011 | ||
939 | mutex_lock(&wl->mutex); | ||
940 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); | 1012 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); |
941 | 1013 | ||
942 | wl1271_info("down"); | 1014 | wl1271_info("down"); |
@@ -950,10 +1022,10 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, | |||
950 | ieee80211_enable_dyn_ps(wl->vif); | 1022 | ieee80211_enable_dyn_ps(wl->vif); |
951 | 1023 | ||
952 | if (wl->scan.state != WL1271_SCAN_STATE_IDLE) { | 1024 | if (wl->scan.state != WL1271_SCAN_STATE_IDLE) { |
953 | ieee80211_scan_completed(wl->hw, true); | ||
954 | wl->scan.state = WL1271_SCAN_STATE_IDLE; | 1025 | wl->scan.state = WL1271_SCAN_STATE_IDLE; |
955 | kfree(wl->scan.scanned_ch); | 1026 | kfree(wl->scan.scanned_ch); |
956 | wl->scan.scanned_ch = NULL; | 1027 | wl->scan.scanned_ch = NULL; |
1028 | ieee80211_scan_completed(wl->hw, true); | ||
957 | } | 1029 | } |
958 | 1030 | ||
959 | wl->state = WL1271_STATE_OFF; | 1031 | wl->state = WL1271_STATE_OFF; |
@@ -962,9 +1034,11 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, | |||
962 | 1034 | ||
963 | mutex_unlock(&wl->mutex); | 1035 | mutex_unlock(&wl->mutex); |
964 | 1036 | ||
1037 | cancel_delayed_work_sync(&wl->scan_complete_work); | ||
965 | cancel_work_sync(&wl->irq_work); | 1038 | cancel_work_sync(&wl->irq_work); |
966 | cancel_work_sync(&wl->tx_work); | 1039 | cancel_work_sync(&wl->tx_work); |
967 | cancel_delayed_work_sync(&wl->pspoll_work); | 1040 | cancel_delayed_work_sync(&wl->pspoll_work); |
1041 | cancel_delayed_work_sync(&wl->elp_work); | ||
968 | 1042 | ||
969 | mutex_lock(&wl->mutex); | 1043 | mutex_lock(&wl->mutex); |
970 | 1044 | ||
@@ -1006,8 +1080,19 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, | |||
1006 | wl->tx_res_if = NULL; | 1080 | wl->tx_res_if = NULL; |
1007 | kfree(wl->target_mem_map); | 1081 | kfree(wl->target_mem_map); |
1008 | wl->target_mem_map = NULL; | 1082 | wl->target_mem_map = NULL; |
1083 | } | ||
1084 | |||
1085 | static void wl1271_op_remove_interface(struct ieee80211_hw *hw, | ||
1086 | struct ieee80211_vif *vif) | ||
1087 | { | ||
1088 | struct wl1271 *wl = hw->priv; | ||
1009 | 1089 | ||
1090 | mutex_lock(&wl->mutex); | ||
1091 | WARN_ON(wl->vif != vif); | ||
1092 | __wl1271_op_remove_interface(wl); | ||
1010 | mutex_unlock(&wl->mutex); | 1093 | mutex_unlock(&wl->mutex); |
1094 | |||
1095 | cancel_work_sync(&wl->recovery_work); | ||
1011 | } | 1096 | } |
1012 | 1097 | ||
1013 | static void wl1271_configure_filters(struct wl1271 *wl, unsigned int filters) | 1098 | static void wl1271_configure_filters(struct wl1271 *wl, unsigned int filters) |
@@ -1289,7 +1374,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1289 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { | 1374 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { |
1290 | wl1271_debug(DEBUG_PSM, "psm enabled"); | 1375 | wl1271_debug(DEBUG_PSM, "psm enabled"); |
1291 | ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, | 1376 | ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, |
1292 | true); | 1377 | wl->basic_rate, true); |
1293 | } | 1378 | } |
1294 | } else if (!(conf->flags & IEEE80211_CONF_PS) && | 1379 | } else if (!(conf->flags & IEEE80211_CONF_PS) && |
1295 | test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) { | 1380 | test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) { |
@@ -1299,7 +1384,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1299 | 1384 | ||
1300 | if (test_bit(WL1271_FLAG_PSM, &wl->flags)) | 1385 | if (test_bit(WL1271_FLAG_PSM, &wl->flags)) |
1301 | ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, | 1386 | ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, |
1302 | true); | 1387 | wl->basic_rate, true); |
1303 | } | 1388 | } |
1304 | 1389 | ||
1305 | if (conf->power_level != wl->power_level) { | 1390 | if (conf->power_level != wl->power_level) { |
@@ -1476,6 +1561,11 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
1476 | tx_seq_32 = WL1271_TX_SECURITY_HI32(wl->tx_security_seq); | 1561 | tx_seq_32 = WL1271_TX_SECURITY_HI32(wl->tx_security_seq); |
1477 | tx_seq_16 = WL1271_TX_SECURITY_LO16(wl->tx_security_seq); | 1562 | tx_seq_16 = WL1271_TX_SECURITY_LO16(wl->tx_security_seq); |
1478 | break; | 1563 | break; |
1564 | case WL1271_CIPHER_SUITE_GEM: | ||
1565 | key_type = KEY_GEM; | ||
1566 | tx_seq_32 = WL1271_TX_SECURITY_HI32(wl->tx_security_seq); | ||
1567 | tx_seq_16 = WL1271_TX_SECURITY_LO16(wl->tx_security_seq); | ||
1568 | break; | ||
1479 | default: | 1569 | default: |
1480 | wl1271_error("Unknown key algo 0x%x", key_conf->cipher); | 1570 | wl1271_error("Unknown key algo 0x%x", key_conf->cipher); |
1481 | 1571 | ||
@@ -1559,10 +1649,7 @@ static int wl1271_op_hw_scan(struct ieee80211_hw *hw, | |||
1559 | if (ret < 0) | 1649 | if (ret < 0) |
1560 | goto out; | 1650 | goto out; |
1561 | 1651 | ||
1562 | if (wl1271_11a_enabled()) | 1652 | ret = wl1271_scan(hw->priv, ssid, len, req); |
1563 | ret = wl1271_scan(hw->priv, ssid, len, req); | ||
1564 | else | ||
1565 | ret = wl1271_scan(hw->priv, ssid, len, req); | ||
1566 | 1653 | ||
1567 | wl1271_ps_elp_sleep(wl); | 1654 | wl1271_ps_elp_sleep(wl); |
1568 | 1655 | ||
@@ -1777,12 +1864,15 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1777 | if (test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags) && | 1864 | if (test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags) && |
1778 | !test_bit(WL1271_FLAG_PSM, &wl->flags)) { | 1865 | !test_bit(WL1271_FLAG_PSM, &wl->flags)) { |
1779 | mode = STATION_POWER_SAVE_MODE; | 1866 | mode = STATION_POWER_SAVE_MODE; |
1780 | ret = wl1271_ps_set_mode(wl, mode, true); | 1867 | ret = wl1271_ps_set_mode(wl, mode, |
1868 | wl->basic_rate, | ||
1869 | true); | ||
1781 | if (ret < 0) | 1870 | if (ret < 0) |
1782 | goto out_sleep; | 1871 | goto out_sleep; |
1783 | } | 1872 | } |
1784 | } else { | 1873 | } else { |
1785 | /* use defaults when not associated */ | 1874 | /* use defaults when not associated */ |
1875 | clear_bit(WL1271_FLAG_STA_STATE_SENT, &wl->flags); | ||
1786 | clear_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); | 1876 | clear_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); |
1787 | wl->aid = 0; | 1877 | wl->aid = 0; |
1788 | 1878 | ||
@@ -1994,21 +2084,24 @@ static struct ieee80211_rate wl1271_rates[] = { | |||
1994 | .hw_value_short = CONF_HW_BIT_RATE_54MBPS, }, | 2084 | .hw_value_short = CONF_HW_BIT_RATE_54MBPS, }, |
1995 | }; | 2085 | }; |
1996 | 2086 | ||
1997 | /* can't be const, mac80211 writes to this */ | 2087 | /* |
2088 | * Can't be const, mac80211 writes to this. The order of the channels here | ||
2089 | * is designed to improve scanning. | ||
2090 | */ | ||
1998 | static struct ieee80211_channel wl1271_channels[] = { | 2091 | static struct ieee80211_channel wl1271_channels[] = { |
1999 | { .hw_value = 1, .center_freq = 2412, .max_power = 25 }, | 2092 | { .hw_value = 1, .center_freq = 2412, .max_power = 25 }, |
2000 | { .hw_value = 2, .center_freq = 2417, .max_power = 25 }, | ||
2001 | { .hw_value = 3, .center_freq = 2422, .max_power = 25 }, | ||
2002 | { .hw_value = 4, .center_freq = 2427, .max_power = 25 }, | ||
2003 | { .hw_value = 5, .center_freq = 2432, .max_power = 25 }, | 2093 | { .hw_value = 5, .center_freq = 2432, .max_power = 25 }, |
2004 | { .hw_value = 6, .center_freq = 2437, .max_power = 25 }, | ||
2005 | { .hw_value = 7, .center_freq = 2442, .max_power = 25 }, | ||
2006 | { .hw_value = 8, .center_freq = 2447, .max_power = 25 }, | ||
2007 | { .hw_value = 9, .center_freq = 2452, .max_power = 25 }, | 2094 | { .hw_value = 9, .center_freq = 2452, .max_power = 25 }, |
2008 | { .hw_value = 10, .center_freq = 2457, .max_power = 25 }, | ||
2009 | { .hw_value = 11, .center_freq = 2462, .max_power = 25 }, | ||
2010 | { .hw_value = 12, .center_freq = 2467, .max_power = 25 }, | ||
2011 | { .hw_value = 13, .center_freq = 2472, .max_power = 25 }, | 2095 | { .hw_value = 13, .center_freq = 2472, .max_power = 25 }, |
2096 | { .hw_value = 4, .center_freq = 2427, .max_power = 25 }, | ||
2097 | { .hw_value = 8, .center_freq = 2447, .max_power = 25 }, | ||
2098 | { .hw_value = 12, .center_freq = 2467, .max_power = 25 }, | ||
2099 | { .hw_value = 3, .center_freq = 2422, .max_power = 25 }, | ||
2100 | { .hw_value = 7, .center_freq = 2442, .max_power = 25 }, | ||
2101 | { .hw_value = 11, .center_freq = 2462, .max_power = 25 }, | ||
2102 | { .hw_value = 2, .center_freq = 2417, .max_power = 25 }, | ||
2103 | { .hw_value = 6, .center_freq = 2437, .max_power = 25 }, | ||
2104 | { .hw_value = 10, .center_freq = 2457, .max_power = 25 }, | ||
2012 | }; | 2105 | }; |
2013 | 2106 | ||
2014 | /* mapping to indexes for wl1271_rates */ | 2107 | /* mapping to indexes for wl1271_rates */ |
@@ -2077,49 +2170,52 @@ static struct ieee80211_rate wl1271_rates_5ghz[] = { | |||
2077 | .hw_value_short = CONF_HW_BIT_RATE_54MBPS, }, | 2170 | .hw_value_short = CONF_HW_BIT_RATE_54MBPS, }, |
2078 | }; | 2171 | }; |
2079 | 2172 | ||
2080 | /* 5 GHz band channels for WL1273 */ | 2173 | /* |
2174 | * 5 GHz band channels for WL1273 - can't be const, mac80211 writes to this. | ||
2175 | * The order of the channels here is designed to improve scanning. | ||
2176 | */ | ||
2081 | static struct ieee80211_channel wl1271_channels_5ghz[] = { | 2177 | static struct ieee80211_channel wl1271_channels_5ghz[] = { |
2082 | { .hw_value = 183, .center_freq = 4915}, | 2178 | { .hw_value = 183, .center_freq = 4915}, |
2083 | { .hw_value = 184, .center_freq = 4920}, | ||
2084 | { .hw_value = 185, .center_freq = 4925}, | ||
2085 | { .hw_value = 187, .center_freq = 4935}, | ||
2086 | { .hw_value = 188, .center_freq = 4940}, | 2179 | { .hw_value = 188, .center_freq = 4940}, |
2087 | { .hw_value = 189, .center_freq = 4945}, | ||
2088 | { .hw_value = 192, .center_freq = 4960}, | ||
2089 | { .hw_value = 196, .center_freq = 4980}, | ||
2090 | { .hw_value = 7, .center_freq = 5035}, | ||
2091 | { .hw_value = 8, .center_freq = 5040}, | 2180 | { .hw_value = 8, .center_freq = 5040}, |
2092 | { .hw_value = 9, .center_freq = 5045}, | ||
2093 | { .hw_value = 11, .center_freq = 5055}, | ||
2094 | { .hw_value = 12, .center_freq = 5060}, | ||
2095 | { .hw_value = 16, .center_freq = 5080}, | ||
2096 | { .hw_value = 34, .center_freq = 5170}, | 2181 | { .hw_value = 34, .center_freq = 5170}, |
2097 | { .hw_value = 36, .center_freq = 5180}, | ||
2098 | { .hw_value = 38, .center_freq = 5190}, | ||
2099 | { .hw_value = 40, .center_freq = 5200}, | ||
2100 | { .hw_value = 42, .center_freq = 5210}, | ||
2101 | { .hw_value = 44, .center_freq = 5220}, | 2182 | { .hw_value = 44, .center_freq = 5220}, |
2102 | { .hw_value = 46, .center_freq = 5230}, | ||
2103 | { .hw_value = 48, .center_freq = 5240}, | ||
2104 | { .hw_value = 52, .center_freq = 5260}, | ||
2105 | { .hw_value = 56, .center_freq = 5280}, | ||
2106 | { .hw_value = 60, .center_freq = 5300}, | 2183 | { .hw_value = 60, .center_freq = 5300}, |
2107 | { .hw_value = 64, .center_freq = 5320}, | ||
2108 | { .hw_value = 100, .center_freq = 5500}, | ||
2109 | { .hw_value = 104, .center_freq = 5520}, | ||
2110 | { .hw_value = 108, .center_freq = 5540}, | ||
2111 | { .hw_value = 112, .center_freq = 5560}, | 2184 | { .hw_value = 112, .center_freq = 5560}, |
2112 | { .hw_value = 116, .center_freq = 5580}, | ||
2113 | { .hw_value = 120, .center_freq = 5600}, | ||
2114 | { .hw_value = 124, .center_freq = 5620}, | ||
2115 | { .hw_value = 128, .center_freq = 5640}, | ||
2116 | { .hw_value = 132, .center_freq = 5660}, | 2185 | { .hw_value = 132, .center_freq = 5660}, |
2186 | { .hw_value = 157, .center_freq = 5785}, | ||
2187 | { .hw_value = 184, .center_freq = 4920}, | ||
2188 | { .hw_value = 189, .center_freq = 4945}, | ||
2189 | { .hw_value = 9, .center_freq = 5045}, | ||
2190 | { .hw_value = 36, .center_freq = 5180}, | ||
2191 | { .hw_value = 46, .center_freq = 5230}, | ||
2192 | { .hw_value = 64, .center_freq = 5320}, | ||
2193 | { .hw_value = 116, .center_freq = 5580}, | ||
2117 | { .hw_value = 136, .center_freq = 5680}, | 2194 | { .hw_value = 136, .center_freq = 5680}, |
2195 | { .hw_value = 192, .center_freq = 4960}, | ||
2196 | { .hw_value = 11, .center_freq = 5055}, | ||
2197 | { .hw_value = 38, .center_freq = 5190}, | ||
2198 | { .hw_value = 48, .center_freq = 5240}, | ||
2199 | { .hw_value = 100, .center_freq = 5500}, | ||
2200 | { .hw_value = 120, .center_freq = 5600}, | ||
2118 | { .hw_value = 140, .center_freq = 5700}, | 2201 | { .hw_value = 140, .center_freq = 5700}, |
2202 | { .hw_value = 185, .center_freq = 4925}, | ||
2203 | { .hw_value = 196, .center_freq = 4980}, | ||
2204 | { .hw_value = 12, .center_freq = 5060}, | ||
2205 | { .hw_value = 40, .center_freq = 5200}, | ||
2206 | { .hw_value = 52, .center_freq = 5260}, | ||
2207 | { .hw_value = 104, .center_freq = 5520}, | ||
2208 | { .hw_value = 124, .center_freq = 5620}, | ||
2119 | { .hw_value = 149, .center_freq = 5745}, | 2209 | { .hw_value = 149, .center_freq = 5745}, |
2120 | { .hw_value = 153, .center_freq = 5765}, | ||
2121 | { .hw_value = 157, .center_freq = 5785}, | ||
2122 | { .hw_value = 161, .center_freq = 5805}, | 2210 | { .hw_value = 161, .center_freq = 5805}, |
2211 | { .hw_value = 187, .center_freq = 4935}, | ||
2212 | { .hw_value = 7, .center_freq = 5035}, | ||
2213 | { .hw_value = 16, .center_freq = 5080}, | ||
2214 | { .hw_value = 42, .center_freq = 5210}, | ||
2215 | { .hw_value = 56, .center_freq = 5280}, | ||
2216 | { .hw_value = 108, .center_freq = 5540}, | ||
2217 | { .hw_value = 128, .center_freq = 5640}, | ||
2218 | { .hw_value = 153, .center_freq = 5765}, | ||
2123 | { .hw_value = 165, .center_freq = 5825}, | 2219 | { .hw_value = 165, .center_freq = 5825}, |
2124 | }; | 2220 | }; |
2125 | 2221 | ||
@@ -2212,8 +2308,7 @@ static ssize_t wl1271_sysfs_show_bt_coex_state(struct device *dev, | |||
2212 | struct wl1271 *wl = dev_get_drvdata(dev); | 2308 | struct wl1271 *wl = dev_get_drvdata(dev); |
2213 | ssize_t len; | 2309 | ssize_t len; |
2214 | 2310 | ||
2215 | /* FIXME: what's the maximum length of buf? page size?*/ | 2311 | len = PAGE_SIZE; |
2216 | len = 500; | ||
2217 | 2312 | ||
2218 | mutex_lock(&wl->mutex); | 2313 | mutex_lock(&wl->mutex); |
2219 | len = snprintf(buf, len, "%d\n\n0 - off\n1 - on\n", | 2314 | len = snprintf(buf, len, "%d\n\n0 - off\n1 - on\n", |
@@ -2274,8 +2369,7 @@ static ssize_t wl1271_sysfs_show_hw_pg_ver(struct device *dev, | |||
2274 | struct wl1271 *wl = dev_get_drvdata(dev); | 2369 | struct wl1271 *wl = dev_get_drvdata(dev); |
2275 | ssize_t len; | 2370 | ssize_t len; |
2276 | 2371 | ||
2277 | /* FIXME: what's the maximum length of buf? page size?*/ | 2372 | len = PAGE_SIZE; |
2278 | len = 500; | ||
2279 | 2373 | ||
2280 | mutex_lock(&wl->mutex); | 2374 | mutex_lock(&wl->mutex); |
2281 | if (wl->hw_pg_ver >= 0) | 2375 | if (wl->hw_pg_ver >= 0) |
@@ -2307,6 +2401,8 @@ int wl1271_register_hw(struct wl1271 *wl) | |||
2307 | 2401 | ||
2308 | wl->mac80211_registered = true; | 2402 | wl->mac80211_registered = true; |
2309 | 2403 | ||
2404 | register_netdevice_notifier(&wl1271_dev_notifier); | ||
2405 | |||
2310 | wl1271_notice("loaded"); | 2406 | wl1271_notice("loaded"); |
2311 | 2407 | ||
2312 | return 0; | 2408 | return 0; |
@@ -2315,6 +2411,7 @@ EXPORT_SYMBOL_GPL(wl1271_register_hw); | |||
2315 | 2411 | ||
2316 | void wl1271_unregister_hw(struct wl1271 *wl) | 2412 | void wl1271_unregister_hw(struct wl1271 *wl) |
2317 | { | 2413 | { |
2414 | unregister_netdevice_notifier(&wl1271_dev_notifier); | ||
2318 | ieee80211_unregister_hw(wl->hw); | 2415 | ieee80211_unregister_hw(wl->hw); |
2319 | wl->mac80211_registered = false; | 2416 | wl->mac80211_registered = false; |
2320 | 2417 | ||
@@ -2323,6 +2420,14 @@ EXPORT_SYMBOL_GPL(wl1271_unregister_hw); | |||
2323 | 2420 | ||
2324 | int wl1271_init_ieee80211(struct wl1271 *wl) | 2421 | int wl1271_init_ieee80211(struct wl1271 *wl) |
2325 | { | 2422 | { |
2423 | static const u32 cipher_suites[] = { | ||
2424 | WLAN_CIPHER_SUITE_WEP40, | ||
2425 | WLAN_CIPHER_SUITE_WEP104, | ||
2426 | WLAN_CIPHER_SUITE_TKIP, | ||
2427 | WLAN_CIPHER_SUITE_CCMP, | ||
2428 | WL1271_CIPHER_SUITE_GEM, | ||
2429 | }; | ||
2430 | |||
2326 | /* The tx descriptor buffer and the TKIP space. */ | 2431 | /* The tx descriptor buffer and the TKIP space. */ |
2327 | wl->hw->extra_tx_headroom = WL1271_TKIP_IV_SPACE + | 2432 | wl->hw->extra_tx_headroom = WL1271_TKIP_IV_SPACE + |
2328 | sizeof(struct wl1271_tx_hw_descr); | 2433 | sizeof(struct wl1271_tx_hw_descr); |
@@ -2340,13 +2445,14 @@ int wl1271_init_ieee80211(struct wl1271 *wl) | |||
2340 | IEEE80211_HW_CONNECTION_MONITOR | | 2445 | IEEE80211_HW_CONNECTION_MONITOR | |
2341 | IEEE80211_HW_SUPPORTS_CQM_RSSI; | 2446 | IEEE80211_HW_SUPPORTS_CQM_RSSI; |
2342 | 2447 | ||
2448 | wl->hw->wiphy->cipher_suites = cipher_suites; | ||
2449 | wl->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); | ||
2450 | |||
2343 | wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | | 2451 | wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | |
2344 | BIT(NL80211_IFTYPE_ADHOC); | 2452 | BIT(NL80211_IFTYPE_ADHOC); |
2345 | wl->hw->wiphy->max_scan_ssids = 1; | 2453 | wl->hw->wiphy->max_scan_ssids = 1; |
2346 | wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1271_band_2ghz; | 2454 | wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1271_band_2ghz; |
2347 | 2455 | wl->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wl1271_band_5ghz; | |
2348 | if (wl1271_11a_enabled()) | ||
2349 | wl->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wl1271_band_5ghz; | ||
2350 | 2456 | ||
2351 | wl->hw->queues = 4; | 2457 | wl->hw->queues = 4; |
2352 | wl->hw->max_rates = 1; | 2458 | wl->hw->max_rates = 1; |
@@ -2365,6 +2471,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2365 | struct platform_device *plat_dev = NULL; | 2471 | struct platform_device *plat_dev = NULL; |
2366 | struct wl1271 *wl; | 2472 | struct wl1271 *wl; |
2367 | int i, ret; | 2473 | int i, ret; |
2474 | unsigned int order; | ||
2368 | 2475 | ||
2369 | hw = ieee80211_alloc_hw(sizeof(*wl), &wl1271_ops); | 2476 | hw = ieee80211_alloc_hw(sizeof(*wl), &wl1271_ops); |
2370 | if (!hw) { | 2477 | if (!hw) { |
@@ -2392,6 +2499,10 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2392 | 2499 | ||
2393 | INIT_DELAYED_WORK(&wl->elp_work, wl1271_elp_work); | 2500 | INIT_DELAYED_WORK(&wl->elp_work, wl1271_elp_work); |
2394 | INIT_DELAYED_WORK(&wl->pspoll_work, wl1271_pspoll_work); | 2501 | INIT_DELAYED_WORK(&wl->pspoll_work, wl1271_pspoll_work); |
2502 | INIT_WORK(&wl->irq_work, wl1271_irq_work); | ||
2503 | INIT_WORK(&wl->tx_work, wl1271_tx_work); | ||
2504 | INIT_WORK(&wl->recovery_work, wl1271_recovery_work); | ||
2505 | INIT_DELAYED_WORK(&wl->scan_complete_work, wl1271_scan_complete_work); | ||
2395 | wl->channel = WL1271_DEFAULT_CHANNEL; | 2506 | wl->channel = WL1271_DEFAULT_CHANNEL; |
2396 | wl->beacon_int = WL1271_DEFAULT_BEACON_INT; | 2507 | wl->beacon_int = WL1271_DEFAULT_BEACON_INT; |
2397 | wl->default_key = 0; | 2508 | wl->default_key = 0; |
@@ -2423,11 +2534,18 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2423 | 2534 | ||
2424 | wl1271_debugfs_init(wl); | 2535 | wl1271_debugfs_init(wl); |
2425 | 2536 | ||
2537 | order = get_order(WL1271_AGGR_BUFFER_SIZE); | ||
2538 | wl->aggr_buf = (u8 *)__get_free_pages(GFP_KERNEL, order); | ||
2539 | if (!wl->aggr_buf) { | ||
2540 | ret = -ENOMEM; | ||
2541 | goto err_hw; | ||
2542 | } | ||
2543 | |||
2426 | /* Register platform device */ | 2544 | /* Register platform device */ |
2427 | ret = platform_device_register(wl->plat_dev); | 2545 | ret = platform_device_register(wl->plat_dev); |
2428 | if (ret) { | 2546 | if (ret) { |
2429 | wl1271_error("couldn't register platform device"); | 2547 | wl1271_error("couldn't register platform device"); |
2430 | goto err_hw; | 2548 | goto err_aggr; |
2431 | } | 2549 | } |
2432 | dev_set_drvdata(&wl->plat_dev->dev, wl); | 2550 | dev_set_drvdata(&wl->plat_dev->dev, wl); |
2433 | 2551 | ||
@@ -2453,6 +2571,9 @@ err_bt_coex_state: | |||
2453 | err_platform: | 2571 | err_platform: |
2454 | platform_device_unregister(wl->plat_dev); | 2572 | platform_device_unregister(wl->plat_dev); |
2455 | 2573 | ||
2574 | err_aggr: | ||
2575 | free_pages((unsigned long)wl->aggr_buf, order); | ||
2576 | |||
2456 | err_hw: | 2577 | err_hw: |
2457 | wl1271_debugfs_exit(wl); | 2578 | wl1271_debugfs_exit(wl); |
2458 | kfree(plat_dev); | 2579 | kfree(plat_dev); |
@@ -2469,6 +2590,8 @@ EXPORT_SYMBOL_GPL(wl1271_alloc_hw); | |||
2469 | int wl1271_free_hw(struct wl1271 *wl) | 2590 | int wl1271_free_hw(struct wl1271 *wl) |
2470 | { | 2591 | { |
2471 | platform_device_unregister(wl->plat_dev); | 2592 | platform_device_unregister(wl->plat_dev); |
2593 | free_pages((unsigned long)wl->aggr_buf, | ||
2594 | get_order(WL1271_AGGR_BUFFER_SIZE)); | ||
2472 | kfree(wl->plat_dev); | 2595 | kfree(wl->plat_dev); |
2473 | 2596 | ||
2474 | wl1271_debugfs_exit(wl); | 2597 | wl1271_debugfs_exit(wl); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_ps.c b/drivers/net/wireless/wl12xx/wl1271_ps.c index a5e60e0403e5..e3c332e2f97c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_ps.c +++ b/drivers/net/wireless/wl12xx/wl1271_ps.c | |||
@@ -39,6 +39,9 @@ void wl1271_elp_work(struct work_struct *work) | |||
39 | 39 | ||
40 | mutex_lock(&wl->mutex); | 40 | mutex_lock(&wl->mutex); |
41 | 41 | ||
42 | if (unlikely(wl->state == WL1271_STATE_OFF)) | ||
43 | goto out; | ||
44 | |||
42 | if (test_bit(WL1271_FLAG_IN_ELP, &wl->flags) || | 45 | if (test_bit(WL1271_FLAG_IN_ELP, &wl->flags) || |
43 | (!test_bit(WL1271_FLAG_PSM, &wl->flags) && | 46 | (!test_bit(WL1271_FLAG_PSM, &wl->flags) && |
44 | !test_bit(WL1271_FLAG_IDLE, &wl->flags))) | 47 | !test_bit(WL1271_FLAG_IDLE, &wl->flags))) |
@@ -61,7 +64,7 @@ void wl1271_ps_elp_sleep(struct wl1271 *wl) | |||
61 | test_bit(WL1271_FLAG_IDLE, &wl->flags)) { | 64 | test_bit(WL1271_FLAG_IDLE, &wl->flags)) { |
62 | cancel_delayed_work(&wl->elp_work); | 65 | cancel_delayed_work(&wl->elp_work); |
63 | ieee80211_queue_delayed_work(wl->hw, &wl->elp_work, | 66 | ieee80211_queue_delayed_work(wl->hw, &wl->elp_work, |
64 | msecs_to_jiffies(ELP_ENTRY_DELAY)); | 67 | msecs_to_jiffies(ELP_ENTRY_DELAY)); |
65 | } | 68 | } |
66 | } | 69 | } |
67 | 70 | ||
@@ -96,6 +99,7 @@ int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake) | |||
96 | &compl, msecs_to_jiffies(WL1271_WAKEUP_TIMEOUT)); | 99 | &compl, msecs_to_jiffies(WL1271_WAKEUP_TIMEOUT)); |
97 | if (ret == 0) { | 100 | if (ret == 0) { |
98 | wl1271_error("ELP wakeup timeout!"); | 101 | wl1271_error("ELP wakeup timeout!"); |
102 | ieee80211_queue_work(wl->hw, &wl->recovery_work); | ||
99 | ret = -ETIMEDOUT; | 103 | ret = -ETIMEDOUT; |
100 | goto err; | 104 | goto err; |
101 | } else if (ret < 0) { | 105 | } else if (ret < 0) { |
@@ -121,7 +125,7 @@ out: | |||
121 | } | 125 | } |
122 | 126 | ||
123 | int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, | 127 | int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, |
124 | bool send) | 128 | u32 rates, bool send) |
125 | { | 129 | { |
126 | int ret; | 130 | int ret; |
127 | 131 | ||
@@ -129,7 +133,14 @@ int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, | |||
129 | case STATION_POWER_SAVE_MODE: | 133 | case STATION_POWER_SAVE_MODE: |
130 | wl1271_debug(DEBUG_PSM, "entering psm"); | 134 | wl1271_debug(DEBUG_PSM, "entering psm"); |
131 | 135 | ||
132 | ret = wl1271_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE, send); | 136 | ret = wl1271_acx_wake_up_conditions(wl); |
137 | if (ret < 0) { | ||
138 | wl1271_error("couldn't set wake up conditions"); | ||
139 | return ret; | ||
140 | } | ||
141 | |||
142 | ret = wl1271_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE, | ||
143 | rates, send); | ||
133 | if (ret < 0) | 144 | if (ret < 0) |
134 | return ret; | 145 | return ret; |
135 | 146 | ||
@@ -152,7 +163,8 @@ int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, | |||
152 | if (ret < 0) | 163 | if (ret < 0) |
153 | return ret; | 164 | return ret; |
154 | 165 | ||
155 | ret = wl1271_cmd_ps_mode(wl, STATION_ACTIVE_MODE, send); | 166 | ret = wl1271_cmd_ps_mode(wl, STATION_ACTIVE_MODE, |
167 | rates, send); | ||
156 | if (ret < 0) | 168 | if (ret < 0) |
157 | return ret; | 169 | return ret; |
158 | 170 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_ps.h b/drivers/net/wireless/wl12xx/wl1271_ps.h index 940276f517a4..6ba7b032736f 100644 --- a/drivers/net/wireless/wl12xx/wl1271_ps.h +++ b/drivers/net/wireless/wl12xx/wl1271_ps.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "wl1271_acx.h" | 28 | #include "wl1271_acx.h" |
29 | 29 | ||
30 | int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, | 30 | int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, |
31 | bool send); | 31 | u32 rates, bool send); |
32 | void wl1271_ps_elp_sleep(struct wl1271 *wl); | 32 | void wl1271_ps_elp_sleep(struct wl1271 *wl); |
33 | int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake); | 33 | int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake); |
34 | void wl1271_elp_work(struct work_struct *work); | 34 | void wl1271_elp_work(struct work_struct *work); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c index 94da5dd7723c..bea133b6e489 100644 --- a/drivers/net/wireless/wl12xx/wl1271_rx.c +++ b/drivers/net/wireless/wl12xx/wl1271_rx.c | |||
@@ -74,7 +74,7 @@ static void wl1271_rx_status(struct wl1271 *wl, | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | static void wl1271_rx_handle_data(struct wl1271 *wl, u32 length) | 77 | static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length) |
78 | { | 78 | { |
79 | struct wl1271_rx_descriptor *desc; | 79 | struct wl1271_rx_descriptor *desc; |
80 | struct sk_buff *skb; | 80 | struct sk_buff *skb; |
@@ -87,16 +87,16 @@ static void wl1271_rx_handle_data(struct wl1271 *wl, u32 length) | |||
87 | * workaround this by not retrieving them at all. | 87 | * workaround this by not retrieving them at all. |
88 | */ | 88 | */ |
89 | if (unlikely(wl->state == WL1271_STATE_PLT)) | 89 | if (unlikely(wl->state == WL1271_STATE_PLT)) |
90 | return; | 90 | return -EINVAL; |
91 | 91 | ||
92 | skb = __dev_alloc_skb(length, GFP_KERNEL); | 92 | skb = __dev_alloc_skb(length, GFP_KERNEL); |
93 | if (!skb) { | 93 | if (!skb) { |
94 | wl1271_error("Couldn't allocate RX frame"); | 94 | wl1271_error("Couldn't allocate RX frame"); |
95 | return; | 95 | return -ENOMEM; |
96 | } | 96 | } |
97 | 97 | ||
98 | buf = skb_put(skb, length); | 98 | buf = skb_put(skb, length); |
99 | wl1271_read(wl, WL1271_SLV_MEM_DATA, buf, length, true); | 99 | memcpy(buf, data, length); |
100 | 100 | ||
101 | /* the data read starts with the descriptor */ | 101 | /* the data read starts with the descriptor */ |
102 | desc = (struct wl1271_rx_descriptor *) buf; | 102 | desc = (struct wl1271_rx_descriptor *) buf; |
@@ -116,6 +116,8 @@ static void wl1271_rx_handle_data(struct wl1271 *wl, u32 length) | |||
116 | skb_trim(skb, skb->len - desc->pad_len); | 116 | skb_trim(skb, skb->len - desc->pad_len); |
117 | 117 | ||
118 | ieee80211_rx_ni(wl->hw, skb); | 118 | ieee80211_rx_ni(wl->hw, skb); |
119 | |||
120 | return 0; | ||
119 | } | 121 | } |
120 | 122 | ||
121 | void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status) | 123 | void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status) |
@@ -124,31 +126,60 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status) | |||
124 | u32 buf_size; | 126 | u32 buf_size; |
125 | u32 fw_rx_counter = status->fw_rx_counter & NUM_RX_PKT_DESC_MOD_MASK; | 127 | u32 fw_rx_counter = status->fw_rx_counter & NUM_RX_PKT_DESC_MOD_MASK; |
126 | u32 drv_rx_counter = wl->rx_counter & NUM_RX_PKT_DESC_MOD_MASK; | 128 | u32 drv_rx_counter = wl->rx_counter & NUM_RX_PKT_DESC_MOD_MASK; |
129 | u32 rx_counter; | ||
127 | u32 mem_block; | 130 | u32 mem_block; |
131 | u32 pkt_length; | ||
132 | u32 pkt_offset; | ||
128 | 133 | ||
129 | while (drv_rx_counter != fw_rx_counter) { | 134 | while (drv_rx_counter != fw_rx_counter) { |
130 | mem_block = wl1271_rx_get_mem_block(status, drv_rx_counter); | 135 | buf_size = 0; |
131 | buf_size = wl1271_rx_get_buf_size(status, drv_rx_counter); | 136 | rx_counter = drv_rx_counter; |
137 | while (rx_counter != fw_rx_counter) { | ||
138 | pkt_length = wl1271_rx_get_buf_size(status, rx_counter); | ||
139 | if (buf_size + pkt_length > WL1271_AGGR_BUFFER_SIZE) | ||
140 | break; | ||
141 | buf_size += pkt_length; | ||
142 | rx_counter++; | ||
143 | rx_counter &= NUM_RX_PKT_DESC_MOD_MASK; | ||
144 | } | ||
132 | 145 | ||
133 | if (buf_size == 0) { | 146 | if (buf_size == 0) { |
134 | wl1271_warning("received empty data"); | 147 | wl1271_warning("received empty data"); |
135 | break; | 148 | break; |
136 | } | 149 | } |
137 | 150 | ||
151 | /* | ||
152 | * Choose the block we want to read | ||
153 | * For aggregated packets, only the first memory block should | ||
154 | * be retrieved. The FW takes care of the rest. | ||
155 | */ | ||
156 | mem_block = wl1271_rx_get_mem_block(status, drv_rx_counter); | ||
138 | wl->rx_mem_pool_addr.addr = (mem_block << 8) + | 157 | wl->rx_mem_pool_addr.addr = (mem_block << 8) + |
139 | le32_to_cpu(wl_mem_map->packet_memory_pool_start); | 158 | le32_to_cpu(wl_mem_map->packet_memory_pool_start); |
140 | wl->rx_mem_pool_addr.addr_extra = | 159 | wl->rx_mem_pool_addr.addr_extra = |
141 | wl->rx_mem_pool_addr.addr + 4; | 160 | wl->rx_mem_pool_addr.addr + 4; |
142 | |||
143 | /* Choose the block we want to read */ | ||
144 | wl1271_write(wl, WL1271_SLV_REG_DATA, &wl->rx_mem_pool_addr, | 161 | wl1271_write(wl, WL1271_SLV_REG_DATA, &wl->rx_mem_pool_addr, |
145 | sizeof(wl->rx_mem_pool_addr), false); | 162 | sizeof(wl->rx_mem_pool_addr), false); |
146 | 163 | ||
147 | wl1271_rx_handle_data(wl, buf_size); | 164 | /* Read all available packets at once */ |
148 | 165 | wl1271_read(wl, WL1271_SLV_MEM_DATA, wl->aggr_buf, | |
149 | wl->rx_counter++; | 166 | buf_size, true); |
150 | drv_rx_counter = wl->rx_counter & NUM_RX_PKT_DESC_MOD_MASK; | 167 | |
168 | /* Split data into separate packets */ | ||
169 | pkt_offset = 0; | ||
170 | while (pkt_offset < buf_size) { | ||
171 | pkt_length = wl1271_rx_get_buf_size(status, | ||
172 | drv_rx_counter); | ||
173 | if (wl1271_rx_handle_data(wl, | ||
174 | wl->aggr_buf + pkt_offset, | ||
175 | pkt_length) < 0) | ||
176 | break; | ||
177 | wl->rx_counter++; | ||
178 | drv_rx_counter++; | ||
179 | drv_rx_counter &= NUM_RX_PKT_DESC_MOD_MASK; | ||
180 | pkt_offset += pkt_length; | ||
181 | } | ||
151 | } | 182 | } |
152 | 183 | wl1271_write32(wl, RX_DRIVER_COUNTER_ADDRESS, | |
153 | wl1271_write32(wl, RX_DRIVER_COUNTER_ADDRESS, wl->rx_counter); | 184 | cpu_to_le32(wl->rx_counter)); |
154 | } | 185 | } |
diff --git a/drivers/net/wireless/wl12xx/wl1271_scan.c b/drivers/net/wireless/wl12xx/wl1271_scan.c index 9c80ba9b6be0..5c76b79a96bf 100644 --- a/drivers/net/wireless/wl12xx/wl1271_scan.c +++ b/drivers/net/wireless/wl12xx/wl1271_scan.c | |||
@@ -28,11 +28,43 @@ | |||
28 | #include "wl1271_scan.h" | 28 | #include "wl1271_scan.h" |
29 | #include "wl1271_acx.h" | 29 | #include "wl1271_acx.h" |
30 | 30 | ||
31 | void wl1271_scan_complete_work(struct work_struct *work) | ||
32 | { | ||
33 | struct delayed_work *dwork; | ||
34 | struct wl1271 *wl; | ||
35 | |||
36 | dwork = container_of(work, struct delayed_work, work); | ||
37 | wl = container_of(dwork, struct wl1271, scan_complete_work); | ||
38 | |||
39 | wl1271_debug(DEBUG_SCAN, "Scanning complete"); | ||
40 | |||
41 | mutex_lock(&wl->mutex); | ||
42 | |||
43 | if (wl->scan.state == WL1271_SCAN_STATE_IDLE) { | ||
44 | mutex_unlock(&wl->mutex); | ||
45 | return; | ||
46 | } | ||
47 | |||
48 | wl->scan.state = WL1271_SCAN_STATE_IDLE; | ||
49 | kfree(wl->scan.scanned_ch); | ||
50 | wl->scan.scanned_ch = NULL; | ||
51 | mutex_unlock(&wl->mutex); | ||
52 | |||
53 | ieee80211_scan_completed(wl->hw, false); | ||
54 | |||
55 | if (wl->scan.failed) { | ||
56 | wl1271_info("Scan completed due to error."); | ||
57 | ieee80211_queue_work(wl->hw, &wl->recovery_work); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | |||
31 | static int wl1271_get_scan_channels(struct wl1271 *wl, | 62 | static int wl1271_get_scan_channels(struct wl1271 *wl, |
32 | struct cfg80211_scan_request *req, | 63 | struct cfg80211_scan_request *req, |
33 | struct basic_scan_channel_params *channels, | 64 | struct basic_scan_channel_params *channels, |
34 | enum ieee80211_band band, bool passive) | 65 | enum ieee80211_band band, bool passive) |
35 | { | 66 | { |
67 | struct conf_scan_settings *c = &wl->conf.scan; | ||
36 | int i, j; | 68 | int i, j; |
37 | u32 flags; | 69 | u32 flags; |
38 | 70 | ||
@@ -60,10 +92,17 @@ static int wl1271_get_scan_channels(struct wl1271 *wl, | |||
60 | wl1271_debug(DEBUG_SCAN, "beacon_found %d", | 92 | wl1271_debug(DEBUG_SCAN, "beacon_found %d", |
61 | req->channels[i]->beacon_found); | 93 | req->channels[i]->beacon_found); |
62 | 94 | ||
63 | channels[j].min_duration = | 95 | if (!passive) { |
64 | cpu_to_le32(WL1271_SCAN_CHAN_MIN_DURATION); | 96 | channels[j].min_duration = |
65 | channels[j].max_duration = | 97 | cpu_to_le32(c->min_dwell_time_active); |
66 | cpu_to_le32(WL1271_SCAN_CHAN_MAX_DURATION); | 98 | channels[j].max_duration = |
99 | cpu_to_le32(c->max_dwell_time_active); | ||
100 | } else { | ||
101 | channels[j].min_duration = | ||
102 | cpu_to_le32(c->min_dwell_time_passive); | ||
103 | channels[j].max_duration = | ||
104 | cpu_to_le32(c->max_dwell_time_passive); | ||
105 | } | ||
67 | channels[j].early_termination = 0; | 106 | channels[j].early_termination = 0; |
68 | channels[j].tx_power_att = req->channels[i]->max_power; | 107 | channels[j].tx_power_att = req->channels[i]->max_power; |
69 | channels[j].channel = req->channels[i]->hw_value; | 108 | channels[j].channel = req->channels[i]->hw_value; |
@@ -100,8 +139,11 @@ static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band, | |||
100 | 139 | ||
101 | /* We always use high priority scans */ | 140 | /* We always use high priority scans */ |
102 | scan_options = WL1271_SCAN_OPT_PRIORITY_HIGH; | 141 | scan_options = WL1271_SCAN_OPT_PRIORITY_HIGH; |
103 | if(passive) | 142 | |
143 | /* No SSIDs means that we have a forced passive scan */ | ||
144 | if (passive || wl->scan.req->n_ssids == 0) | ||
104 | scan_options |= WL1271_SCAN_OPT_PASSIVE; | 145 | scan_options |= WL1271_SCAN_OPT_PASSIVE; |
146 | |||
105 | cmd->params.scan_options = cpu_to_le16(scan_options); | 147 | cmd->params.scan_options = cpu_to_le16(scan_options); |
106 | 148 | ||
107 | cmd->params.n_ch = wl1271_get_scan_channels(wl, wl->scan.req, | 149 | cmd->params.n_ch = wl1271_get_scan_channels(wl, wl->scan.req, |
@@ -117,7 +159,7 @@ static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band, | |||
117 | cmd->params.rx_filter_options = | 159 | cmd->params.rx_filter_options = |
118 | cpu_to_le32(CFG_RX_PRSP_EN | CFG_RX_MGMT_EN | CFG_RX_BCN_EN); | 160 | cpu_to_le32(CFG_RX_PRSP_EN | CFG_RX_MGMT_EN | CFG_RX_BCN_EN); |
119 | 161 | ||
120 | cmd->params.n_probe_reqs = WL1271_SCAN_PROBE_REQS; | 162 | cmd->params.n_probe_reqs = wl->conf.scan.num_probe_reqs; |
121 | cmd->params.tx_rate = cpu_to_le32(basic_rate); | 163 | cmd->params.tx_rate = cpu_to_le32(basic_rate); |
122 | cmd->params.tid_trigger = 0; | 164 | cmd->params.tid_trigger = 0; |
123 | cmd->params.scan_tag = WL1271_SCAN_DEFAULT_TAG; | 165 | cmd->params.scan_tag = WL1271_SCAN_DEFAULT_TAG; |
@@ -165,7 +207,7 @@ out: | |||
165 | 207 | ||
166 | void wl1271_scan_stm(struct wl1271 *wl) | 208 | void wl1271_scan_stm(struct wl1271 *wl) |
167 | { | 209 | { |
168 | int ret; | 210 | int ret = 0; |
169 | 211 | ||
170 | switch (wl->scan.state) { | 212 | switch (wl->scan.state) { |
171 | case WL1271_SCAN_STATE_IDLE: | 213 | case WL1271_SCAN_STATE_IDLE: |
@@ -185,7 +227,7 @@ void wl1271_scan_stm(struct wl1271 *wl) | |||
185 | ret = wl1271_scan_send(wl, IEEE80211_BAND_2GHZ, true, | 227 | ret = wl1271_scan_send(wl, IEEE80211_BAND_2GHZ, true, |
186 | wl->conf.tx.basic_rate); | 228 | wl->conf.tx.basic_rate); |
187 | if (ret == WL1271_NOTHING_TO_SCAN) { | 229 | if (ret == WL1271_NOTHING_TO_SCAN) { |
188 | if (wl1271_11a_enabled()) | 230 | if (wl->enable_11a) |
189 | wl->scan.state = WL1271_SCAN_STATE_5GHZ_ACTIVE; | 231 | wl->scan.state = WL1271_SCAN_STATE_5GHZ_ACTIVE; |
190 | else | 232 | else |
191 | wl->scan.state = WL1271_SCAN_STATE_DONE; | 233 | wl->scan.state = WL1271_SCAN_STATE_DONE; |
@@ -215,18 +257,22 @@ void wl1271_scan_stm(struct wl1271 *wl) | |||
215 | break; | 257 | break; |
216 | 258 | ||
217 | case WL1271_SCAN_STATE_DONE: | 259 | case WL1271_SCAN_STATE_DONE: |
218 | ieee80211_scan_completed(wl->hw, false); | 260 | wl->scan.failed = false; |
219 | 261 | cancel_delayed_work(&wl->scan_complete_work); | |
220 | kfree(wl->scan.scanned_ch); | 262 | ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work, |
221 | wl->scan.scanned_ch = NULL; | 263 | msecs_to_jiffies(0)); |
222 | |||
223 | wl->scan.state = WL1271_SCAN_STATE_IDLE; | ||
224 | break; | 264 | break; |
225 | 265 | ||
226 | default: | 266 | default: |
227 | wl1271_error("invalid scan state"); | 267 | wl1271_error("invalid scan state"); |
228 | break; | 268 | break; |
229 | } | 269 | } |
270 | |||
271 | if (ret < 0) { | ||
272 | cancel_delayed_work(&wl->scan_complete_work); | ||
273 | ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work, | ||
274 | msecs_to_jiffies(0)); | ||
275 | } | ||
230 | } | 276 | } |
231 | 277 | ||
232 | int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, | 278 | int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, |
@@ -249,6 +295,11 @@ int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, | |||
249 | wl->scan.scanned_ch = kzalloc(req->n_channels * | 295 | wl->scan.scanned_ch = kzalloc(req->n_channels * |
250 | sizeof(*wl->scan.scanned_ch), | 296 | sizeof(*wl->scan.scanned_ch), |
251 | GFP_KERNEL); | 297 | GFP_KERNEL); |
298 | /* we assume failure so that timeout scenarios are handled correctly */ | ||
299 | wl->scan.failed = true; | ||
300 | ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work, | ||
301 | msecs_to_jiffies(WL1271_SCAN_TIMEOUT)); | ||
302 | |||
252 | wl1271_scan_stm(wl); | 303 | wl1271_scan_stm(wl); |
253 | 304 | ||
254 | return 0; | 305 | return 0; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_scan.h b/drivers/net/wireless/wl12xx/wl1271_scan.h index f1815700f5f9..6d57127b5e6b 100644 --- a/drivers/net/wireless/wl12xx/wl1271_scan.h +++ b/drivers/net/wireless/wl12xx/wl1271_scan.h | |||
@@ -32,6 +32,7 @@ int wl1271_scan_build_probe_req(struct wl1271 *wl, | |||
32 | const u8 *ssid, size_t ssid_len, | 32 | const u8 *ssid, size_t ssid_len, |
33 | const u8 *ie, size_t ie_len, u8 band); | 33 | const u8 *ie, size_t ie_len, u8 band); |
34 | void wl1271_scan_stm(struct wl1271 *wl); | 34 | void wl1271_scan_stm(struct wl1271 *wl); |
35 | void wl1271_scan_complete_work(struct work_struct *work); | ||
35 | 36 | ||
36 | #define WL1271_SCAN_MAX_CHANNELS 24 | 37 | #define WL1271_SCAN_MAX_CHANNELS 24 |
37 | #define WL1271_SCAN_DEFAULT_TAG 1 | 38 | #define WL1271_SCAN_DEFAULT_TAG 1 |
@@ -39,11 +40,10 @@ void wl1271_scan_stm(struct wl1271 *wl); | |||
39 | #define WL1271_SCAN_OPT_ACTIVE 0 | 40 | #define WL1271_SCAN_OPT_ACTIVE 0 |
40 | #define WL1271_SCAN_OPT_PASSIVE 1 | 41 | #define WL1271_SCAN_OPT_PASSIVE 1 |
41 | #define WL1271_SCAN_OPT_PRIORITY_HIGH 4 | 42 | #define WL1271_SCAN_OPT_PRIORITY_HIGH 4 |
42 | #define WL1271_SCAN_CHAN_MIN_DURATION 30000 /* TU */ | ||
43 | #define WL1271_SCAN_CHAN_MAX_DURATION 60000 /* TU */ | ||
44 | #define WL1271_SCAN_BAND_2_4_GHZ 0 | 43 | #define WL1271_SCAN_BAND_2_4_GHZ 0 |
45 | #define WL1271_SCAN_BAND_5_GHZ 1 | 44 | #define WL1271_SCAN_BAND_5_GHZ 1 |
46 | #define WL1271_SCAN_PROBE_REQS 3 | 45 | |
46 | #define WL1271_SCAN_TIMEOUT 10000 /* msec */ | ||
47 | 47 | ||
48 | enum { | 48 | enum { |
49 | WL1271_SCAN_STATE_IDLE, | 49 | WL1271_SCAN_STATE_IDLE, |
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c index f2f04663627c..4c250d7dc3fa 100644 --- a/drivers/net/wireless/wl12xx/wl1271_sdio.c +++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c | |||
@@ -274,9 +274,8 @@ static void __devexit wl1271_remove(struct sdio_func *func) | |||
274 | { | 274 | { |
275 | struct wl1271 *wl = sdio_get_drvdata(func); | 275 | struct wl1271 *wl = sdio_get_drvdata(func); |
276 | 276 | ||
277 | free_irq(wl->irq, wl); | ||
278 | |||
279 | wl1271_unregister_hw(wl); | 277 | wl1271_unregister_hw(wl); |
278 | free_irq(wl->irq, wl); | ||
280 | wl1271_free_hw(wl); | 279 | wl1271_free_hw(wl); |
281 | } | 280 | } |
282 | 281 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c index ced0a9e2c7e1..ef801680773f 100644 --- a/drivers/net/wireless/wl12xx/wl1271_spi.c +++ b/drivers/net/wireless/wl12xx/wl1271_spi.c | |||
@@ -63,6 +63,11 @@ | |||
63 | ((WL1271_BUSY_WORD_LEN - 4) / sizeof(u32)) | 63 | ((WL1271_BUSY_WORD_LEN - 4) / sizeof(u32)) |
64 | #define HW_ACCESS_WSPI_INIT_CMD_MASK 0 | 64 | #define HW_ACCESS_WSPI_INIT_CMD_MASK 0 |
65 | 65 | ||
66 | /* HW limitation: maximum possible chunk size is 4095 bytes */ | ||
67 | #define WSPI_MAX_CHUNK_SIZE 4092 | ||
68 | |||
69 | #define WSPI_MAX_NUM_OF_CHUNKS (WL1271_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) | ||
70 | |||
66 | static inline struct spi_device *wl_to_spi(struct wl1271 *wl) | 71 | static inline struct spi_device *wl_to_spi(struct wl1271 *wl) |
67 | { | 72 | { |
68 | return wl->if_priv; | 73 | return wl->if_priv; |
@@ -202,90 +207,117 @@ static int wl1271_spi_read_busy(struct wl1271 *wl) | |||
202 | static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf, | 207 | static void wl1271_spi_raw_read(struct wl1271 *wl, int addr, void *buf, |
203 | size_t len, bool fixed) | 208 | size_t len, bool fixed) |
204 | { | 209 | { |
205 | struct spi_transfer t[3]; | 210 | struct spi_transfer t[2]; |
206 | struct spi_message m; | 211 | struct spi_message m; |
207 | u32 *busy_buf; | 212 | u32 *busy_buf; |
208 | u32 *cmd; | 213 | u32 *cmd; |
214 | u32 chunk_len; | ||
209 | 215 | ||
210 | cmd = &wl->buffer_cmd; | 216 | while (len > 0) { |
211 | busy_buf = wl->buffer_busyword; | 217 | chunk_len = min((size_t)WSPI_MAX_CHUNK_SIZE, len); |
212 | 218 | ||
213 | *cmd = 0; | 219 | cmd = &wl->buffer_cmd; |
214 | *cmd |= WSPI_CMD_READ; | 220 | busy_buf = wl->buffer_busyword; |
215 | *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; | ||
216 | *cmd |= addr & WSPI_CMD_BYTE_ADDR; | ||
217 | 221 | ||
218 | if (fixed) | 222 | *cmd = 0; |
219 | *cmd |= WSPI_CMD_FIXED; | 223 | *cmd |= WSPI_CMD_READ; |
224 | *cmd |= (chunk_len << WSPI_CMD_BYTE_LENGTH_OFFSET) & | ||
225 | WSPI_CMD_BYTE_LENGTH; | ||
226 | *cmd |= addr & WSPI_CMD_BYTE_ADDR; | ||
220 | 227 | ||
221 | spi_message_init(&m); | 228 | if (fixed) |
222 | memset(t, 0, sizeof(t)); | 229 | *cmd |= WSPI_CMD_FIXED; |
223 | 230 | ||
224 | t[0].tx_buf = cmd; | 231 | spi_message_init(&m); |
225 | t[0].len = 4; | 232 | memset(t, 0, sizeof(t)); |
226 | t[0].cs_change = true; | ||
227 | spi_message_add_tail(&t[0], &m); | ||
228 | 233 | ||
229 | /* Busy and non busy words read */ | 234 | t[0].tx_buf = cmd; |
230 | t[1].rx_buf = busy_buf; | 235 | t[0].len = 4; |
231 | t[1].len = WL1271_BUSY_WORD_LEN; | 236 | t[0].cs_change = true; |
232 | t[1].cs_change = true; | 237 | spi_message_add_tail(&t[0], &m); |
233 | spi_message_add_tail(&t[1], &m); | ||
234 | 238 | ||
235 | spi_sync(wl_to_spi(wl), &m); | 239 | /* Busy and non busy words read */ |
240 | t[1].rx_buf = busy_buf; | ||
241 | t[1].len = WL1271_BUSY_WORD_LEN; | ||
242 | t[1].cs_change = true; | ||
243 | spi_message_add_tail(&t[1], &m); | ||
236 | 244 | ||
237 | if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) && | 245 | spi_sync(wl_to_spi(wl), &m); |
238 | wl1271_spi_read_busy(wl)) { | ||
239 | memset(buf, 0, len); | ||
240 | return; | ||
241 | } | ||
242 | 246 | ||
243 | spi_message_init(&m); | 247 | if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) && |
244 | memset(t, 0, sizeof(t)); | 248 | wl1271_spi_read_busy(wl)) { |
249 | memset(buf, 0, chunk_len); | ||
250 | return; | ||
251 | } | ||
245 | 252 | ||
246 | t[0].rx_buf = buf; | 253 | spi_message_init(&m); |
247 | t[0].len = len; | 254 | memset(t, 0, sizeof(t)); |
248 | t[0].cs_change = true; | ||
249 | spi_message_add_tail(&t[0], &m); | ||
250 | 255 | ||
251 | spi_sync(wl_to_spi(wl), &m); | 256 | t[0].rx_buf = buf; |
257 | t[0].len = chunk_len; | ||
258 | t[0].cs_change = true; | ||
259 | spi_message_add_tail(&t[0], &m); | ||
260 | |||
261 | spi_sync(wl_to_spi(wl), &m); | ||
262 | |||
263 | wl1271_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd)); | ||
264 | wl1271_dump(DEBUG_SPI, "spi_read buf <- ", buf, chunk_len); | ||
252 | 265 | ||
253 | wl1271_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd)); | 266 | if (!fixed) |
254 | wl1271_dump(DEBUG_SPI, "spi_read buf <- ", buf, len); | 267 | addr += chunk_len; |
268 | buf += chunk_len; | ||
269 | len -= chunk_len; | ||
270 | } | ||
255 | } | 271 | } |
256 | 272 | ||
257 | static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf, | 273 | static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf, |
258 | size_t len, bool fixed) | 274 | size_t len, bool fixed) |
259 | { | 275 | { |
260 | struct spi_transfer t[2]; | 276 | struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; |
261 | struct spi_message m; | 277 | struct spi_message m; |
278 | u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; | ||
262 | u32 *cmd; | 279 | u32 *cmd; |
280 | u32 chunk_len; | ||
281 | int i; | ||
263 | 282 | ||
264 | cmd = &wl->buffer_cmd; | 283 | WARN_ON(len > WL1271_AGGR_BUFFER_SIZE); |
265 | |||
266 | *cmd = 0; | ||
267 | *cmd |= WSPI_CMD_WRITE; | ||
268 | *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; | ||
269 | *cmd |= addr & WSPI_CMD_BYTE_ADDR; | ||
270 | |||
271 | if (fixed) | ||
272 | *cmd |= WSPI_CMD_FIXED; | ||
273 | 284 | ||
274 | spi_message_init(&m); | 285 | spi_message_init(&m); |
275 | memset(t, 0, sizeof(t)); | 286 | memset(t, 0, sizeof(t)); |
276 | 287 | ||
277 | t[0].tx_buf = cmd; | 288 | cmd = &commands[0]; |
278 | t[0].len = sizeof(*cmd); | 289 | i = 0; |
279 | spi_message_add_tail(&t[0], &m); | 290 | while (len > 0) { |
291 | chunk_len = min((size_t)WSPI_MAX_CHUNK_SIZE, len); | ||
280 | 292 | ||
281 | t[1].tx_buf = buf; | 293 | *cmd = 0; |
282 | t[1].len = len; | 294 | *cmd |= WSPI_CMD_WRITE; |
283 | spi_message_add_tail(&t[1], &m); | 295 | *cmd |= (chunk_len << WSPI_CMD_BYTE_LENGTH_OFFSET) & |
296 | WSPI_CMD_BYTE_LENGTH; | ||
297 | *cmd |= addr & WSPI_CMD_BYTE_ADDR; | ||
284 | 298 | ||
285 | spi_sync(wl_to_spi(wl), &m); | 299 | if (fixed) |
300 | *cmd |= WSPI_CMD_FIXED; | ||
286 | 301 | ||
287 | wl1271_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd)); | 302 | t[i].tx_buf = cmd; |
288 | wl1271_dump(DEBUG_SPI, "spi_write buf -> ", buf, len); | 303 | t[i].len = sizeof(*cmd); |
304 | spi_message_add_tail(&t[i++], &m); | ||
305 | |||
306 | t[i].tx_buf = buf; | ||
307 | t[i].len = chunk_len; | ||
308 | spi_message_add_tail(&t[i++], &m); | ||
309 | |||
310 | wl1271_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd)); | ||
311 | wl1271_dump(DEBUG_SPI, "spi_write buf -> ", buf, chunk_len); | ||
312 | |||
313 | if (!fixed) | ||
314 | addr += chunk_len; | ||
315 | buf += chunk_len; | ||
316 | len -= chunk_len; | ||
317 | cmd++; | ||
318 | } | ||
319 | |||
320 | spi_sync(wl_to_spi(wl), &m); | ||
289 | } | 321 | } |
290 | 322 | ||
291 | static irqreturn_t wl1271_irq(int irq, void *cookie) | 323 | static irqreturn_t wl1271_irq(int irq, void *cookie) |
@@ -416,9 +448,8 @@ static int __devexit wl1271_remove(struct spi_device *spi) | |||
416 | { | 448 | { |
417 | struct wl1271 *wl = dev_get_drvdata(&spi->dev); | 449 | struct wl1271 *wl = dev_get_drvdata(&spi->dev); |
418 | 450 | ||
419 | free_irq(wl->irq, wl); | ||
420 | |||
421 | wl1271_unregister_hw(wl); | 451 | wl1271_unregister_hw(wl); |
452 | free_irq(wl->irq, wl); | ||
422 | wl1271_free_hw(wl); | 453 | wl1271_free_hw(wl); |
423 | 454 | ||
424 | return 0; | 455 | return 0; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_testmode.c b/drivers/net/wireless/wl12xx/wl1271_testmode.c index 6e0952f79e9a..a3aa84386c88 100644 --- a/drivers/net/wireless/wl12xx/wl1271_testmode.c +++ b/drivers/net/wireless/wl12xx/wl1271_testmode.c | |||
@@ -199,19 +199,6 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[]) | |||
199 | buf = nla_data(tb[WL1271_TM_ATTR_DATA]); | 199 | buf = nla_data(tb[WL1271_TM_ATTR_DATA]); |
200 | len = nla_len(tb[WL1271_TM_ATTR_DATA]); | 200 | len = nla_len(tb[WL1271_TM_ATTR_DATA]); |
201 | 201 | ||
202 | /* | ||
203 | * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band | ||
204 | * configurations) can be removed when those NVS files stop floating | ||
205 | * around. | ||
206 | */ | ||
207 | if (len != sizeof(struct wl1271_nvs_file) && | ||
208 | (len != WL1271_INI_LEGACY_NVS_FILE_SIZE || | ||
209 | wl1271_11a_enabled())) { | ||
210 | wl1271_error("nvs size is not as expected: %zu != %zu", | ||
211 | len, sizeof(struct wl1271_nvs_file)); | ||
212 | return -EMSGSIZE; | ||
213 | } | ||
214 | |||
215 | mutex_lock(&wl->mutex); | 202 | mutex_lock(&wl->mutex); |
216 | 203 | ||
217 | kfree(wl->nvs); | 204 | kfree(wl->nvs); |
@@ -224,6 +211,7 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[]) | |||
224 | } | 211 | } |
225 | 212 | ||
226 | memcpy(wl->nvs, buf, len); | 213 | memcpy(wl->nvs, buf, len); |
214 | wl->nvs_len = len; | ||
227 | 215 | ||
228 | wl1271_debug(DEBUG_TESTMODE, "testmode pushed nvs"); | 216 | wl1271_debug(DEBUG_TESTMODE, "testmode pushed nvs"); |
229 | 217 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c index dc0b46c93c4b..e3dc13c4d01a 100644 --- a/drivers/net/wireless/wl12xx/wl1271_tx.c +++ b/drivers/net/wireless/wl12xx/wl1271_tx.c | |||
@@ -43,13 +43,17 @@ static int wl1271_tx_id(struct wl1271 *wl, struct sk_buff *skb) | |||
43 | return -EBUSY; | 43 | return -EBUSY; |
44 | } | 44 | } |
45 | 45 | ||
46 | static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra) | 46 | static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra, |
47 | u32 buf_offset) | ||
47 | { | 48 | { |
48 | struct wl1271_tx_hw_descr *desc; | 49 | struct wl1271_tx_hw_descr *desc; |
49 | u32 total_len = skb->len + sizeof(struct wl1271_tx_hw_descr) + extra; | 50 | u32 total_len = skb->len + sizeof(struct wl1271_tx_hw_descr) + extra; |
50 | u32 total_blocks; | 51 | u32 total_blocks; |
51 | int id, ret = -EBUSY; | 52 | int id, ret = -EBUSY; |
52 | 53 | ||
54 | if (buf_offset + total_len > WL1271_AGGR_BUFFER_SIZE) | ||
55 | return -EBUSY; | ||
56 | |||
53 | /* allocate free identifier for the packet */ | 57 | /* allocate free identifier for the packet */ |
54 | id = wl1271_tx_id(wl, skb); | 58 | id = wl1271_tx_id(wl, skb); |
55 | if (id < 0) | 59 | if (id < 0) |
@@ -82,7 +86,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra) | |||
82 | return ret; | 86 | return ret; |
83 | } | 87 | } |
84 | 88 | ||
85 | static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, | 89 | static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, |
86 | u32 extra, struct ieee80211_tx_info *control) | 90 | u32 extra, struct ieee80211_tx_info *control) |
87 | { | 91 | { |
88 | struct timespec ts; | 92 | struct timespec ts; |
@@ -110,9 +114,9 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, | |||
110 | /* configure the tx attributes */ | 114 | /* configure the tx attributes */ |
111 | tx_attr = wl->session_counter << TX_HW_ATTR_OFST_SESSION_COUNTER; | 115 | tx_attr = wl->session_counter << TX_HW_ATTR_OFST_SESSION_COUNTER; |
112 | 116 | ||
113 | /* queue */ | 117 | /* queue (we use same identifiers for tid's and ac's */ |
114 | ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); | 118 | ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); |
115 | desc->tid = wl1271_tx_ac_to_tid(ac); | 119 | desc->tid = ac; |
116 | 120 | ||
117 | desc->aid = TX_HW_DEFAULT_AID; | 121 | desc->aid = TX_HW_DEFAULT_AID; |
118 | desc->reserved = 0; | 122 | desc->reserved = 0; |
@@ -133,59 +137,17 @@ static int wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, | |||
133 | desc->tx_attr = cpu_to_le16(tx_attr); | 137 | desc->tx_attr = cpu_to_le16(tx_attr); |
134 | 138 | ||
135 | wl1271_debug(DEBUG_TX, "tx_fill_hdr: pad: %d", pad); | 139 | wl1271_debug(DEBUG_TX, "tx_fill_hdr: pad: %d", pad); |
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static int wl1271_tx_send_packet(struct wl1271 *wl, struct sk_buff *skb, | ||
140 | struct ieee80211_tx_info *control) | ||
141 | { | ||
142 | |||
143 | struct wl1271_tx_hw_descr *desc; | ||
144 | int len; | ||
145 | |||
146 | /* FIXME: This is a workaround for getting non-aligned packets. | ||
147 | This happens at least with EAPOL packets from the user space. | ||
148 | Our DMA requires packets to be aligned on a 4-byte boundary. | ||
149 | */ | ||
150 | if (unlikely((long)skb->data & 0x03)) { | ||
151 | int offset = (4 - (long)skb->data) & 0x03; | ||
152 | wl1271_debug(DEBUG_TX, "skb offset %d", offset); | ||
153 | |||
154 | /* check whether the current skb can be used */ | ||
155 | if (!skb_cloned(skb) && (skb_tailroom(skb) >= offset)) { | ||
156 | unsigned char *src = skb->data; | ||
157 | |||
158 | /* align the buffer on a 4-byte boundary */ | ||
159 | skb_reserve(skb, offset); | ||
160 | memmove(skb->data, src, skb->len); | ||
161 | } else { | ||
162 | wl1271_info("No handler, fixme!"); | ||
163 | return -EINVAL; | ||
164 | } | ||
165 | } | ||
166 | |||
167 | len = WL1271_TX_ALIGN(skb->len); | ||
168 | |||
169 | /* perform a fixed address block write with the packet */ | ||
170 | wl1271_write(wl, WL1271_SLV_MEM_DATA, skb->data, len, true); | ||
171 | |||
172 | /* write packet new counter into the write access register */ | ||
173 | wl->tx_packets_count++; | ||
174 | |||
175 | desc = (struct wl1271_tx_hw_descr *) skb->data; | ||
176 | wl1271_debug(DEBUG_TX, "tx id %u skb 0x%p payload %u (%u words)", | ||
177 | desc->id, skb, len, desc->length); | ||
178 | |||
179 | return 0; | ||
180 | } | 140 | } |
181 | 141 | ||
182 | /* caller must hold wl->mutex */ | 142 | /* caller must hold wl->mutex */ |
183 | static int wl1271_tx_frame(struct wl1271 *wl, struct sk_buff *skb) | 143 | static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct sk_buff *skb, |
144 | u32 buf_offset) | ||
184 | { | 145 | { |
185 | struct ieee80211_tx_info *info; | 146 | struct ieee80211_tx_info *info; |
186 | u32 extra = 0; | 147 | u32 extra = 0; |
187 | int ret = 0; | 148 | int ret = 0; |
188 | u8 idx; | 149 | u8 idx; |
150 | u32 total_len; | ||
189 | 151 | ||
190 | if (!skb) | 152 | if (!skb) |
191 | return -EINVAL; | 153 | return -EINVAL; |
@@ -208,19 +170,22 @@ static int wl1271_tx_frame(struct wl1271 *wl, struct sk_buff *skb) | |||
208 | } | 170 | } |
209 | } | 171 | } |
210 | 172 | ||
211 | ret = wl1271_tx_allocate(wl, skb, extra); | 173 | ret = wl1271_tx_allocate(wl, skb, extra, buf_offset); |
212 | if (ret < 0) | 174 | if (ret < 0) |
213 | return ret; | 175 | return ret; |
214 | 176 | ||
215 | ret = wl1271_tx_fill_hdr(wl, skb, extra, info); | 177 | wl1271_tx_fill_hdr(wl, skb, extra, info); |
216 | if (ret < 0) | ||
217 | return ret; | ||
218 | 178 | ||
219 | ret = wl1271_tx_send_packet(wl, skb, info); | 179 | /* |
220 | if (ret < 0) | 180 | * The length of each packet is stored in terms of words. Thus, we must |
221 | return ret; | 181 | * pad the skb data to make sure its length is aligned. |
182 | * The number of padding bytes is computed and set in wl1271_tx_fill_hdr | ||
183 | */ | ||
184 | total_len = WL1271_TX_ALIGN(skb->len); | ||
185 | memcpy(wl->aggr_buf + buf_offset, skb->data, skb->len); | ||
186 | memset(wl->aggr_buf + buf_offset + skb->len, 0, total_len - skb->len); | ||
222 | 187 | ||
223 | return ret; | 188 | return total_len; |
224 | } | 189 | } |
225 | 190 | ||
226 | u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set) | 191 | u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set) |
@@ -245,7 +210,7 @@ void wl1271_tx_work(struct work_struct *work) | |||
245 | struct sk_buff *skb; | 210 | struct sk_buff *skb; |
246 | bool woken_up = false; | 211 | bool woken_up = false; |
247 | u32 sta_rates = 0; | 212 | u32 sta_rates = 0; |
248 | u32 prev_tx_packets_count; | 213 | u32 buf_offset; |
249 | int ret; | 214 | int ret; |
250 | 215 | ||
251 | /* check if the rates supported by the AP have changed */ | 216 | /* check if the rates supported by the AP have changed */ |
@@ -262,14 +227,15 @@ void wl1271_tx_work(struct work_struct *work) | |||
262 | if (unlikely(wl->state == WL1271_STATE_OFF)) | 227 | if (unlikely(wl->state == WL1271_STATE_OFF)) |
263 | goto out; | 228 | goto out; |
264 | 229 | ||
265 | prev_tx_packets_count = wl->tx_packets_count; | ||
266 | |||
267 | /* if rates have changed, re-configure the rate policy */ | 230 | /* if rates have changed, re-configure the rate policy */ |
268 | if (unlikely(sta_rates)) { | 231 | if (unlikely(sta_rates)) { |
269 | wl->rate_set = wl1271_tx_enabled_rates_get(wl, sta_rates); | 232 | wl->rate_set = wl1271_tx_enabled_rates_get(wl, sta_rates); |
270 | wl1271_acx_rate_policies(wl); | 233 | wl1271_acx_rate_policies(wl); |
271 | } | 234 | } |
272 | 235 | ||
236 | /* Prepare the transfer buffer, by aggregating all | ||
237 | * available packets */ | ||
238 | buf_offset = 0; | ||
273 | while ((skb = skb_dequeue(&wl->tx_queue))) { | 239 | while ((skb = skb_dequeue(&wl->tx_queue))) { |
274 | if (!woken_up) { | 240 | if (!woken_up) { |
275 | ret = wl1271_ps_elp_wakeup(wl, false); | 241 | ret = wl1271_ps_elp_wakeup(wl, false); |
@@ -278,21 +244,30 @@ void wl1271_tx_work(struct work_struct *work) | |||
278 | woken_up = true; | 244 | woken_up = true; |
279 | } | 245 | } |
280 | 246 | ||
281 | ret = wl1271_tx_frame(wl, skb); | 247 | ret = wl1271_prepare_tx_frame(wl, skb, buf_offset); |
282 | if (ret == -EBUSY) { | 248 | if (ret == -EBUSY) { |
283 | /* firmware buffer is full, lets stop transmitting. */ | 249 | /* |
250 | * Either the firmware buffer is full, or the | ||
251 | * aggregation buffer is. | ||
252 | * Queue back last skb, and stop aggregating. | ||
253 | */ | ||
284 | skb_queue_head(&wl->tx_queue, skb); | 254 | skb_queue_head(&wl->tx_queue, skb); |
285 | goto out_ack; | 255 | goto out_ack; |
286 | } else if (ret < 0) { | 256 | } else if (ret < 0) { |
287 | dev_kfree_skb(skb); | 257 | dev_kfree_skb(skb); |
288 | goto out_ack; | 258 | goto out_ack; |
289 | } | 259 | } |
260 | buf_offset += ret; | ||
261 | wl->tx_packets_count++; | ||
290 | } | 262 | } |
291 | 263 | ||
292 | out_ack: | 264 | out_ack: |
293 | /* interrupt the firmware with the new packets */ | 265 | if (buf_offset) { |
294 | if (prev_tx_packets_count != wl->tx_packets_count) | 266 | wl1271_write(wl, WL1271_SLV_MEM_DATA, wl->aggr_buf, |
267 | buf_offset, true); | ||
268 | /* interrupt the firmware with the new packets */ | ||
295 | wl1271_write32(wl, WL1271_HOST_WR_ACCESS, wl->tx_packets_count); | 269 | wl1271_write32(wl, WL1271_HOST_WR_ACCESS, wl->tx_packets_count); |
270 | } | ||
296 | 271 | ||
297 | out: | 272 | out: |
298 | if (woken_up) | 273 | if (woken_up) |
@@ -422,8 +397,6 @@ void wl1271_tx_reset(struct wl1271 *wl) | |||
422 | struct sk_buff *skb; | 397 | struct sk_buff *skb; |
423 | 398 | ||
424 | /* TX failure */ | 399 | /* TX failure */ |
425 | /* control->flags = 0; FIXME */ | ||
426 | |||
427 | while ((skb = skb_dequeue(&wl->tx_queue))) { | 400 | while ((skb = skb_dequeue(&wl->tx_queue))) { |
428 | wl1271_debug(DEBUG_TX, "freeing skb 0x%p", skb); | 401 | wl1271_debug(DEBUG_TX, "freeing skb 0x%p", skb); |
429 | ieee80211_tx_status(wl->hw, skb); | 402 | ieee80211_tx_status(wl->hw, skb); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.h b/drivers/net/wireless/wl12xx/wl1271_tx.h index 48bf92621c03..d12a129ad11c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_tx.h +++ b/drivers/net/wireless/wl12xx/wl1271_tx.h | |||
@@ -139,23 +139,6 @@ static inline int wl1271_tx_get_queue(int queue) | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | /* wl1271 tx descriptor needs the tid and we need to convert it from ac */ | ||
143 | static inline int wl1271_tx_ac_to_tid(int ac) | ||
144 | { | ||
145 | switch (ac) { | ||
146 | case 0: | ||
147 | return 0; | ||
148 | case 1: | ||
149 | return 2; | ||
150 | case 2: | ||
151 | return 4; | ||
152 | case 3: | ||
153 | return 6; | ||
154 | default: | ||
155 | return 0; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | void wl1271_tx_work(struct work_struct *work); | 142 | void wl1271_tx_work(struct work_struct *work); |
160 | void wl1271_tx_complete(struct wl1271 *wl); | 143 | void wl1271_tx_complete(struct wl1271 *wl); |
161 | void wl1271_tx_reset(struct wl1271 *wl); | 144 | void wl1271_tx_reset(struct wl1271 *wl); |
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h index 95deae3968f4..4f902e1908aa 100644 --- a/include/linux/wl12xx.h +++ b/include/linux/wl12xx.h | |||
@@ -32,7 +32,20 @@ struct wl12xx_platform_data { | |||
32 | int board_ref_clock; | 32 | int board_ref_clock; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | #ifdef CONFIG_WL12XX_PLATFORM_DATA | ||
36 | |||
35 | int wl12xx_set_platform_data(const struct wl12xx_platform_data *data); | 37 | int wl12xx_set_platform_data(const struct wl12xx_platform_data *data); |
38 | |||
39 | #else | ||
40 | |||
41 | static inline | ||
42 | int wl12xx_set_platform_data(const struct wl12xx_platform_data *data) | ||
43 | { | ||
44 | return -ENOSYS; | ||
45 | } | ||
46 | |||
47 | #endif | ||
48 | |||
36 | const struct wl12xx_platform_data *wl12xx_get_platform_data(void); | 49 | const struct wl12xx_platform_data *wl12xx_get_platform_data(void); |
37 | 50 | ||
38 | #endif | 51 | #endif |