Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 194125
b: refs/heads/master
c: 99d84c1
h: refs/heads/master
i:
  194123: f6877b5
v: v3
  • Loading branch information
Luciano Coelho authored and John W. Linville committed Mar 31, 2010
1 parent 0901eb3 commit ecbf554
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9560134ff929a037f0c967ae47089586f4b34390
refs/heads/master: 99d84c1de8fdf5f9b09f07fdbc628857a040bf8b
3 changes: 2 additions & 1 deletion trunk/drivers/net/wireless/wl12xx/wl1271_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
/* unmask required mbox events */
wl->event_mask = BSS_LOSE_EVENT_ID |
SCAN_COMPLETE_EVENT_ID |
PS_REPORT_EVENT_ID;
PS_REPORT_EVENT_ID |
JOIN_EVENT_COMPLETE_ID;

ret = wl1271_event_unmask(wl);
if (ret < 0) {
Expand Down
38 changes: 33 additions & 5 deletions trunk/drivers/net/wireless/wl12xx/wl1271_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "wl1271_acx.h"
#include "wl12xx_80211.h"
#include "wl1271_cmd.h"
#include "wl1271_event.h"

/*
* send command to firmware
Expand Down Expand Up @@ -248,6 +249,35 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl)
return ret;
}

/*
* Poll the mailbox event field until any of the bits in the mask is set or a
* timeout occurs (WL1271_EVENT_TIMEOUT in msecs)
*/
static int wl1271_cmd_wait_for_event(struct wl1271 *wl, u32 mask)
{
u32 events_vector, event;
unsigned long timeout;

timeout = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT);

do {
if (time_after(jiffies, timeout))
return -ETIMEDOUT;

msleep(1);

/* read from both event fields */
wl1271_read(wl, wl->mbox_ptr[0], &events_vector,
sizeof(events_vector), false);
event = events_vector & mask;
wl1271_read(wl, wl->mbox_ptr[1], &events_vector,
sizeof(events_vector), false);
event |= events_vector & mask;
} while (!event);

return 0;
}

int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type)
{
static bool do_cal = true;
Expand Down Expand Up @@ -318,11 +348,9 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type)
goto out_free;
}

/*
* ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to
* simplify locking we just sleep instead, for now
*/
msleep(10);
ret = wl1271_cmd_wait_for_event(wl, JOIN_EVENT_COMPLETE_ID);
if (ret < 0)
wl1271_error("cmd join event completion error");

out_free:
kfree(join);
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/wl12xx/wl1271_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ enum cmd_templ {
/* unit ms */
#define WL1271_COMMAND_TIMEOUT 2000
#define WL1271_CMD_TEMPL_MAX_SIZE 252
#define WL1271_EVENT_TIMEOUT 100

struct wl1271_cmd_header {
__le16 id;
Expand Down

0 comments on commit ecbf554

Please sign in to comment.