wl1251: add channel to wl1251_cmd_join() parameters
[pandora-kernel.git] / drivers / net / wireless / wl12xx / wl1251_cmd.c
index dc04d1f..4e796db 100644 (file)
@@ -2,11 +2,10 @@
 
 #include <linux/module.h>
 #include <linux/crc7.h>
-#include <linux/spi/spi.h>
 
 #include "wl1251.h"
 #include "reg.h"
-#include "wl1251_spi.h"
+#include "wl1251_io.h"
 #include "wl1251_ps.h"
 #include "wl1251_acx.h"
 
@@ -31,14 +30,14 @@ int wl1251_cmd_send(struct wl1251 *wl, u16 id, void *buf, size_t len)
 
        WARN_ON(len % 4 != 0);
 
-       wl1251_spi_mem_write(wl, wl->cmd_box_addr, buf, len);
+       wl1251_mem_write(wl, wl->cmd_box_addr, buf, len);
 
        wl1251_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD);
 
        timeout = jiffies + msecs_to_jiffies(WL1251_COMMAND_TIMEOUT);
 
        intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
-       while (!(intr & wl->chip.intr_cmd_complete)) {
+       while (!(intr & WL1251_ACX_INTR_CMD_COMPLETE)) {
                if (time_after(jiffies, timeout)) {
                        wl1251_error("command complete timeout");
                        ret = -ETIMEDOUT;
@@ -51,7 +50,7 @@ int wl1251_cmd_send(struct wl1251 *wl, u16 id, void *buf, size_t len)
        }
 
        wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK,
-                          wl->chip.intr_cmd_complete);
+                          WL1251_ACX_INTR_CMD_COMPLETE);
 
 out:
        return ret;
@@ -86,7 +85,7 @@ int wl1251_cmd_test(struct wl1251 *wl, void *buf, size_t buf_len, u8 answer)
                 * The answer would be a wl1251_command, where the
                 * parameter array contains the actual answer.
                 */
-               wl1251_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len);
+               wl1251_mem_read(wl, wl->cmd_box_addr, buf, buf_len);
 
                cmd_answer = buf;
 
@@ -125,7 +124,7 @@ int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void *buf, size_t len)
        }
 
        /* the interrogate command got in, we can read the answer */
-       wl1251_spi_mem_read(wl, wl->cmd_box_addr, buf, len);
+       wl1251_mem_read(wl, wl->cmd_box_addr, buf, len);
 
        acx = buf;
        if (acx->cmd.status != CMD_STATUS_SUCCESS)
@@ -252,8 +251,8 @@ out:
        return ret;
 }
 
-int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
-                   u16 beacon_interval, u8 wait)
+int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
+                   u16 beacon_interval, u8 dtim_interval)
 {
        unsigned long timeout;
        struct cmd_join *join;
@@ -274,7 +273,9 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
        if (ret < 0)
                goto out;
 
-       wl1251_debug(DEBUG_CMD, "cmd join");
+       wl1251_debug(DEBUG_CMD, "cmd join%s ch %d %d/%d",
+                    bss_type == BSS_TYPE_IBSS ? " ibss" : "",
+                    channel, beacon_interval, dtim_interval);
 
        /* Reverse order BSSID */
        bssid = (u8 *) &join->bssid_lsb;
@@ -290,7 +291,7 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
        join->beacon_interval = beacon_interval;
        join->dtim_interval = dtim_interval;
        join->bss_type = bss_type;
-       join->channel = wl->channel;
+       join->channel = channel;
        join->ctrl = JOIN_CMD_CTRL_TX_FLUSH;
 
        ret = wl1251_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join));
@@ -305,8 +306,7 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
         * ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to
         * simplify locking we just sleep instead, for now
         */
-       if (wait)
-               msleep(10);
+       msleep(10);
 
 out:
        kfree(join);
@@ -379,7 +379,7 @@ int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
        }
 
        /* the read command got in, we can now read the answer */
-       wl1251_spi_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd));
+       wl1251_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd));
 
        if (cmd->header.status != CMD_STATUS_SUCCESS)
                wl1251_error("error in read command result: %d",