summaryrefslogtreecommitdiffstats
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.c133
1 files changed, 66 insertions, 67 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.c b/drivers/net/wireless/wl12xx/wl1251_cmd.c
index 92c7fb6853eb..dc04d1fc2ee4 100644
--- a/drivers/net/wireless/wl12xx/wl1251_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1251_cmd.c
@@ -5,7 +5,6 @@
#include <linux/spi/spi.h>
#include "wl1251.h"
-#include "wl12xx_80211.h"
#include "reg.h"
#include "wl1251_spi.h"
#include "wl1251_ps.h"
@@ -19,9 +18,9 @@
* @buf: buffer containing the command, must work with dma
* @len: length of the buffer
*/
-int wl12xx_cmd_send(struct wl12xx *wl, u16 id, void *buf, size_t len)
+int wl1251_cmd_send(struct wl1251 *wl, u16 id, void *buf, size_t len)
{
- struct wl12xx_cmd_header *cmd;
+ struct wl1251_cmd_header *cmd;
unsigned long timeout;
u32 intr;
int ret = 0;
@@ -32,26 +31,26 @@ int wl12xx_cmd_send(struct wl12xx *wl, u16 id, void *buf, size_t len)
WARN_ON(len % 4 != 0);
- wl12xx_spi_mem_write(wl, wl->cmd_box_addr, buf, len);
+ wl1251_spi_mem_write(wl, wl->cmd_box_addr, buf, len);
- wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD);
+ wl1251_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD);
- timeout = jiffies + msecs_to_jiffies(WL12XX_COMMAND_TIMEOUT);
+ timeout = jiffies + msecs_to_jiffies(WL1251_COMMAND_TIMEOUT);
- intr = wl12xx_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
+ intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
while (!(intr & wl->chip.intr_cmd_complete)) {
if (time_after(jiffies, timeout)) {
- wl12xx_error("command complete timeout");
+ wl1251_error("command complete timeout");
ret = -ETIMEDOUT;
goto out;
}
msleep(1);
- intr = wl12xx_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
+ intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
}
- wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_ACK,
+ wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK,
wl->chip.intr_cmd_complete);
out:
@@ -66,33 +65,33 @@ out:
* @len: length of the buffer
* @answer: is answer needed
*/
-int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer)
+int wl1251_cmd_test(struct wl1251 *wl, void *buf, size_t buf_len, u8 answer)
{
int ret;
- wl12xx_debug(DEBUG_CMD, "cmd test");
+ wl1251_debug(DEBUG_CMD, "cmd test");
- ret = wl12xx_cmd_send(wl, CMD_TEST, buf, buf_len);
+ ret = wl1251_cmd_send(wl, CMD_TEST, buf, buf_len);
if (ret < 0) {
- wl12xx_warning("TEST command failed");
+ wl1251_warning("TEST command failed");
return ret;
}
if (answer) {
- struct wl12xx_command *cmd_answer;
+ struct wl1251_command *cmd_answer;
/*
* The test command got in, we can read the answer.
- * The answer would be a wl12xx_command, where the
+ * The answer would be a wl1251_command, where the
* parameter array contains the actual answer.
*/
- wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len);
+ wl1251_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len);
cmd_answer = buf;
if (cmd_answer->header.status != CMD_STATUS_SUCCESS)
- wl12xx_error("TEST command answer error: %d",
+ wl1251_error("TEST command answer error: %d",
cmd_answer->header.status);
}
@@ -107,30 +106,30 @@ int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer)
* @buf: buffer for the response, including all headers, must work with dma
* @len: lenght of buf
*/
-int wl12xx_cmd_interrogate(struct wl12xx *wl, u16 id, void *buf, size_t len)
+int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void *buf, size_t len)
{
struct acx_header *acx = buf;
int ret;
- wl12xx_debug(DEBUG_CMD, "cmd interrogate");
+ wl1251_debug(DEBUG_CMD, "cmd interrogate");
acx->id = id;
/* payload length, does not include any headers */
acx->len = len - sizeof(*acx);
- ret = wl12xx_cmd_send(wl, CMD_INTERROGATE, acx, sizeof(*acx));
+ ret = wl1251_cmd_send(wl, CMD_INTERROGATE, acx, sizeof(*acx));
if (ret < 0) {
- wl12xx_error("INTERROGATE command failed");
+ wl1251_error("INTERROGATE command failed");
goto out;
}
/* the interrogate command got in, we can read the answer */
- wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, len);
+ wl1251_spi_mem_read(wl, wl->cmd_box_addr, buf, len);
acx = buf;
if (acx->cmd.status != CMD_STATUS_SUCCESS)
- wl12xx_error("INTERROGATE command error: %d",
+ wl1251_error("INTERROGATE command error: %d",
acx->cmd.status);
out:
@@ -145,34 +144,34 @@ out:
* @buf: buffer containing acx, including all headers, must work with dma
* @len: length of buf
*/
-int wl12xx_cmd_configure(struct wl12xx *wl, u16 id, void *buf, size_t len)
+int wl1251_cmd_configure(struct wl1251 *wl, u16 id, void *buf, size_t len)
{
struct acx_header *acx = buf;
int ret;
- wl12xx_debug(DEBUG_CMD, "cmd configure");
+ wl1251_debug(DEBUG_CMD, "cmd configure");
acx->id = id;
/* payload length, does not include any headers */
acx->len = len - sizeof(*acx);
- ret = wl12xx_cmd_send(wl, CMD_CONFIGURE, acx, len);
+ ret = wl1251_cmd_send(wl, CMD_CONFIGURE, acx, len);
if (ret < 0) {
- wl12xx_warning("CONFIGURE command NOK");
+ wl1251_warning("CONFIGURE command NOK");
return ret;
}
return 0;
}
-int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity,
+int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity,
void *bitmap, u16 bitmap_len, u8 bitmap_control)
{
- struct wl12xx_cmd_vbm_update *vbm;
+ struct wl1251_cmd_vbm_update *vbm;
int ret;
- wl12xx_debug(DEBUG_CMD, "cmd vbm");
+ wl1251_debug(DEBUG_CMD, "cmd vbm");
vbm = kzalloc(sizeof(*vbm), GFP_KERNEL);
if (!vbm) {
@@ -183,7 +182,7 @@ int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity,
/* Count and period will be filled by the target */
vbm->tim.bitmap_ctrl = bitmap_control;
if (bitmap_len > PARTIAL_VBM_MAX) {
- wl12xx_warning("cmd vbm len is %d B, truncating to %d",
+ wl1251_warning("cmd vbm len is %d B, truncating to %d",
bitmap_len, PARTIAL_VBM_MAX);
bitmap_len = PARTIAL_VBM_MAX;
}
@@ -193,9 +192,9 @@ int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity,
vbm->len = cpu_to_le16(bitmap_len + 5);
- ret = wl12xx_cmd_send(wl, CMD_VBM, vbm, sizeof(*vbm));
+ ret = wl1251_cmd_send(wl, CMD_VBM, vbm, sizeof(*vbm));
if (ret < 0) {
- wl12xx_error("VBM command failed");
+ wl1251_error("VBM command failed");
goto out;
}
@@ -204,13 +203,13 @@ out:
return 0;
}
-int wl12xx_cmd_data_path(struct wl12xx *wl, u8 channel, bool enable)
+int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable)
{
struct cmd_enabledisable_path *cmd;
int ret;
u16 cmd_rx, cmd_tx;
- wl12xx_debug(DEBUG_CMD, "cmd data path");
+ wl1251_debug(DEBUG_CMD, "cmd data path");
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd) {
@@ -228,24 +227,24 @@ int wl12xx_cmd_data_path(struct wl12xx *wl, u8 channel, bool enable)
cmd_tx = CMD_DISABLE_TX;
}
- ret = wl12xx_cmd_send(wl, cmd_rx, cmd, sizeof(*cmd));
+ ret = wl1251_cmd_send(wl, cmd_rx, cmd, sizeof(*cmd));
if (ret < 0) {
- wl12xx_error("rx %s cmd for channel %d failed",
+ wl1251_error("rx %s cmd for channel %d failed",
enable ? "start" : "stop", channel);
goto out;
}
- wl12xx_debug(DEBUG_BOOT, "rx %s cmd channel %d",
+ wl1251_debug(DEBUG_BOOT, "rx %s cmd channel %d",
enable ? "start" : "stop", channel);
- ret = wl12xx_cmd_send(wl, cmd_tx, cmd, sizeof(*cmd));
+ ret = wl1251_cmd_send(wl, cmd_tx, cmd, sizeof(*cmd));
if (ret < 0) {
- wl12xx_error("tx %s cmd for channel %d failed",
+ wl1251_error("tx %s cmd for channel %d failed",
enable ? "start" : "stop", channel);
return ret;
}
- wl12xx_debug(DEBUG_BOOT, "tx %s cmd channel %d",
+ wl1251_debug(DEBUG_BOOT, "tx %s cmd channel %d",
enable ? "start" : "stop", channel);
out:
@@ -253,7 +252,7 @@ out:
return ret;
}
-int wl1251_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval,
+int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 dtim_interval,
u16 beacon_interval, u8 wait)
{
unsigned long timeout;
@@ -268,14 +267,14 @@ int wl1251_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval,
}
/* FIXME: this should be in main.c */
- ret = wl12xx_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE,
+ ret = wl1251_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE,
DEFAULT_HW_GEN_MODULATION_TYPE,
wl->tx_mgmt_frm_rate,
wl->tx_mgmt_frm_mod);
if (ret < 0)
goto out;
- wl12xx_debug(DEBUG_CMD, "cmd join");
+ wl1251_debug(DEBUG_CMD, "cmd join");
/* Reverse order BSSID */
bssid = (u8 *) &join->bssid_lsb;
@@ -294,9 +293,9 @@ int wl1251_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval,
join->channel = wl->channel;
join->ctrl = JOIN_CMD_CTRL_TX_FLUSH;
- ret = wl12xx_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join));
+ ret = wl1251_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join));
if (ret < 0) {
- wl12xx_error("failed to initiate cmd join");
+ wl1251_error("failed to initiate cmd join");
goto out;
}
@@ -314,20 +313,20 @@ out:
return ret;
}
-int wl12xx_cmd_ps_mode(struct wl12xx *wl, u8 ps_mode)
+int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode)
{
- struct wl12xx_cmd_ps_params *ps_params = NULL;
+ struct wl1251_cmd_ps_params *ps_params = NULL;
int ret = 0;
/* FIXME: this should be in ps.c */
- ret = wl12xx_acx_wake_up_conditions(wl, WAKE_UP_EVENT_DTIM_BITMAP,
+ ret = wl1251_acx_wake_up_conditions(wl, WAKE_UP_EVENT_DTIM_BITMAP,
wl->listen_int);
if (ret < 0) {
- wl12xx_error("couldn't set wake up conditions");
+ wl1251_error("couldn't set wake up conditions");
goto out;
}
- wl12xx_debug(DEBUG_CMD, "cmd set ps mode");
+ wl1251_debug(DEBUG_CMD, "cmd set ps mode");
ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL);
if (!ps_params) {
@@ -341,10 +340,10 @@ int wl12xx_cmd_ps_mode(struct wl12xx *wl, u8 ps_mode)
ps_params->hang_over_period = 128;
ps_params->null_data_rate = 1; /* 1 Mbps */
- ret = wl12xx_cmd_send(wl, CMD_SET_PS_MODE, ps_params,
+ ret = wl1251_cmd_send(wl, CMD_SET_PS_MODE, ps_params,
sizeof(*ps_params));
if (ret < 0) {
- wl12xx_error("cmd set_ps_mode failed");
+ wl1251_error("cmd set_ps_mode failed");
goto out;
}
@@ -353,13 +352,13 @@ out:
return ret;
}
-int wl12xx_cmd_read_memory(struct wl12xx *wl, u32 addr, void *answer,
+int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
size_t len)
{
struct cmd_read_write_memory *cmd;
int ret = 0;
- wl12xx_debug(DEBUG_CMD, "cmd read memory");
+ wl1251_debug(DEBUG_CMD, "cmd read memory");
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd) {
@@ -373,17 +372,17 @@ int wl12xx_cmd_read_memory(struct wl12xx *wl, u32 addr, void *answer,
cmd->addr = addr;
cmd->size = len;
- ret = wl12xx_cmd_send(wl, CMD_READ_MEMORY, cmd, sizeof(*cmd));
+ ret = wl1251_cmd_send(wl, CMD_READ_MEMORY, cmd, sizeof(*cmd));
if (ret < 0) {
- wl12xx_error("read memory command failed: %d", ret);
+ wl1251_error("read memory command failed: %d", ret);
goto out;
}
/* the read command got in, we can now read the answer */
- wl12xx_spi_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd));
+ wl1251_spi_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd));
if (cmd->header.status != CMD_STATUS_SUCCESS)
- wl12xx_error("error in read command result: %d",
+ wl1251_error("error in read command result: %d",
cmd->header.status);
memcpy(answer, cmd->value, len);
@@ -393,17 +392,17 @@ out:
return ret;
}
-int wl12xx_cmd_template_set(struct wl12xx *wl, u16 cmd_id,
+int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id,
void *buf, size_t buf_len)
{
- struct wl12xx_cmd_packet_template *cmd;
+ struct wl1251_cmd_packet_template *cmd;
size_t cmd_len;
int ret = 0;
- wl12xx_debug(DEBUG_CMD, "cmd template %d", cmd_id);
+ wl1251_debug(DEBUG_CMD, "cmd template %d", cmd_id);
- WARN_ON(buf_len > WL12XX_MAX_TEMPLATE_SIZE);
- buf_len = min_t(size_t, buf_len, WL12XX_MAX_TEMPLATE_SIZE);
+ WARN_ON(buf_len > WL1251_MAX_TEMPLATE_SIZE);
+ buf_len = min_t(size_t, buf_len, WL1251_MAX_TEMPLATE_SIZE);
cmd_len = ALIGN(sizeof(*cmd) + buf_len, 4);
cmd = kzalloc(cmd_len, GFP_KERNEL);
@@ -417,9 +416,9 @@ int wl12xx_cmd_template_set(struct wl12xx *wl, u16 cmd_id,
if (buf)
memcpy(cmd->data, buf, buf_len);
- ret = wl12xx_cmd_send(wl, cmd_id, cmd, cmd_len);
+ ret = wl1251_cmd_send(wl, cmd_id, cmd, cmd_len);
if (ret < 0) {
- wl12xx_warning("cmd set_template failed: %d", ret);
+ wl1251_warning("cmd set_template failed: %d", ret);
goto out;
}
OpenPOWER on IntegriCloud