aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1251_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1251_cmd.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_cmd.c62
1 files changed, 23 insertions, 39 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.c b/drivers/net/wireless/wl12xx/wl1251_cmd.c
index dc04d1fc2ee4..770f260726bd 100644
--- a/drivers/net/wireless/wl12xx/wl1251_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1251_cmd.c
@@ -2,11 +2,10 @@
2 2
3#include <linux/module.h> 3#include <linux/module.h>
4#include <linux/crc7.h> 4#include <linux/crc7.h>
5#include <linux/spi/spi.h>
6 5
7#include "wl1251.h" 6#include "wl1251.h"
8#include "reg.h" 7#include "wl1251_reg.h"
9#include "wl1251_spi.h" 8#include "wl1251_io.h"
10#include "wl1251_ps.h" 9#include "wl1251_ps.h"
11#include "wl1251_acx.h" 10#include "wl1251_acx.h"
12 11
@@ -31,14 +30,14 @@ int wl1251_cmd_send(struct wl1251 *wl, u16 id, void *buf, size_t len)
31 30
32 WARN_ON(len % 4 != 0); 31 WARN_ON(len % 4 != 0);
33 32
34 wl1251_spi_mem_write(wl, wl->cmd_box_addr, buf, len); 33 wl1251_mem_write(wl, wl->cmd_box_addr, buf, len);
35 34
36 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD); 35 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD);
37 36
38 timeout = jiffies + msecs_to_jiffies(WL1251_COMMAND_TIMEOUT); 37 timeout = jiffies + msecs_to_jiffies(WL1251_COMMAND_TIMEOUT);
39 38
40 intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); 39 intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
41 while (!(intr & wl->chip.intr_cmd_complete)) { 40 while (!(intr & WL1251_ACX_INTR_CMD_COMPLETE)) {
42 if (time_after(jiffies, timeout)) { 41 if (time_after(jiffies, timeout)) {
43 wl1251_error("command complete timeout"); 42 wl1251_error("command complete timeout");
44 ret = -ETIMEDOUT; 43 ret = -ETIMEDOUT;
@@ -51,7 +50,7 @@ int wl1251_cmd_send(struct wl1251 *wl, u16 id, void *buf, size_t len)
51 } 50 }
52 51
53 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK, 52 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK,
54 wl->chip.intr_cmd_complete); 53 WL1251_ACX_INTR_CMD_COMPLETE);
55 54
56out: 55out:
57 return ret; 56 return ret;
@@ -86,7 +85,7 @@ int wl1251_cmd_test(struct wl1251 *wl, void *buf, size_t buf_len, u8 answer)
86 * The answer would be a wl1251_command, where the 85 * The answer would be a wl1251_command, where the
87 * parameter array contains the actual answer. 86 * parameter array contains the actual answer.
88 */ 87 */
89 wl1251_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len); 88 wl1251_mem_read(wl, wl->cmd_box_addr, buf, buf_len);
90 89
91 cmd_answer = buf; 90 cmd_answer = buf;
92 91
@@ -125,7 +124,7 @@ int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void *buf, size_t len)
125 } 124 }
126 125
127 /* the interrogate command got in, we can read the answer */ 126 /* the interrogate command got in, we can read the answer */
128 wl1251_spi_mem_read(wl, wl->cmd_box_addr, buf, len); 127 wl1251_mem_read(wl, wl->cmd_box_addr, buf, len);
129 128
130 acx = buf; 129 acx = buf;
131 if (acx->cmd.status != CMD_STATUS_SUCCESS) 130 if (acx->cmd.status != CMD_STATUS_SUCCESS)
@@ -252,10 +251,9 @@ out:
252 return ret; 251 return ret;
253} 252}
254 253
255int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval, 254int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
256 u16 beacon_interval, u8 wait) 255 u16 beacon_interval, u8 dtim_interval)
257{ 256{
258 unsigned long timeout;
259 struct cmd_join *join; 257 struct cmd_join *join;
260 int ret, i; 258 int ret, i;
261 u8 *bssid; 259 u8 *bssid;
@@ -266,15 +264,9 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
266 goto out; 264 goto out;
267 } 265 }
268 266
269 /* FIXME: this should be in main.c */ 267 wl1251_debug(DEBUG_CMD, "cmd join%s ch %d %d/%d",
270 ret = wl1251_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE, 268 bss_type == BSS_TYPE_IBSS ? " ibss" : "",
271 DEFAULT_HW_GEN_MODULATION_TYPE, 269 channel, beacon_interval, dtim_interval);
272 wl->tx_mgmt_frm_rate,
273 wl->tx_mgmt_frm_mod);
274 if (ret < 0)
275 goto out;
276
277 wl1251_debug(DEBUG_CMD, "cmd join");
278 270
279 /* Reverse order BSSID */ 271 /* Reverse order BSSID */
280 bssid = (u8 *) &join->bssid_lsb; 272 bssid = (u8 *) &join->bssid_lsb;
@@ -284,13 +276,22 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
284 join->rx_config_options = wl->rx_config; 276 join->rx_config_options = wl->rx_config;
285 join->rx_filter_options = wl->rx_filter; 277 join->rx_filter_options = wl->rx_filter;
286 278
279 /*
280 * FIXME: disable temporarily all filters because after commit
281 * 9cef8737 "mac80211: fix managed mode BSSID handling" broke
282 * association. The filter logic needs to be implemented properly
283 * and once that is done, this hack can be removed.
284 */
285 join->rx_config_options = 0;
286 join->rx_filter_options = WL1251_DEFAULT_RX_FILTER;
287
287 join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS | 288 join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS |
288 RATE_MASK_5_5MBPS | RATE_MASK_11MBPS; 289 RATE_MASK_5_5MBPS | RATE_MASK_11MBPS;
289 290
290 join->beacon_interval = beacon_interval; 291 join->beacon_interval = beacon_interval;
291 join->dtim_interval = dtim_interval; 292 join->dtim_interval = dtim_interval;
292 join->bss_type = bss_type; 293 join->bss_type = bss_type;
293 join->channel = wl->channel; 294 join->channel = channel;
294 join->ctrl = JOIN_CMD_CTRL_TX_FLUSH; 295 join->ctrl = JOIN_CMD_CTRL_TX_FLUSH;
295 296
296 ret = wl1251_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join)); 297 ret = wl1251_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join));
@@ -299,15 +300,6 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
299 goto out; 300 goto out;
300 } 301 }
301 302
302 timeout = msecs_to_jiffies(JOIN_TIMEOUT);
303
304 /*
305 * ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to
306 * simplify locking we just sleep instead, for now
307 */
308 if (wait)
309 msleep(10);
310
311out: 303out:
312 kfree(join); 304 kfree(join);
313 return ret; 305 return ret;
@@ -318,14 +310,6 @@ int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode)
318 struct wl1251_cmd_ps_params *ps_params = NULL; 310 struct wl1251_cmd_ps_params *ps_params = NULL;
319 int ret = 0; 311 int ret = 0;
320 312
321 /* FIXME: this should be in ps.c */
322 ret = wl1251_acx_wake_up_conditions(wl, WAKE_UP_EVENT_DTIM_BITMAP,
323 wl->listen_int);
324 if (ret < 0) {
325 wl1251_error("couldn't set wake up conditions");
326 goto out;
327 }
328
329 wl1251_debug(DEBUG_CMD, "cmd set ps mode"); 313 wl1251_debug(DEBUG_CMD, "cmd set ps mode");
330 314
331 ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL); 315 ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL);
@@ -379,7 +363,7 @@ int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
379 } 363 }
380 364
381 /* the read command got in, we can now read the answer */ 365 /* the read command got in, we can now read the answer */
382 wl1251_spi_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd)); 366 wl1251_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd));
383 367
384 if (cmd->header.status != CMD_STATUS_SUCCESS) 368 if (cmd->header.status != CMD_STATUS_SUCCESS)
385 wl1251_error("error in read command result: %d", 369 wl1251_error("error in read command result: %d",