提交 57adc1fc 编写于 作者: J John W. Linville

Merge branch 'master' of...

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem

Conflicts:
	drivers/net/wireless/b43/dma.c
	drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
...@@ -101,6 +101,7 @@ static struct usb_device_id btusb_table[] = { ...@@ -101,6 +101,7 @@ static struct usb_device_id btusb_table[] = {
{ USB_DEVICE(0x0c10, 0x0000) }, { USB_DEVICE(0x0c10, 0x0000) },
/* Broadcom BCM20702A0 */ /* Broadcom BCM20702A0 */
{ USB_DEVICE(0x0a5c, 0x21e3) },
{ USB_DEVICE(0x413c, 0x8197) }, { USB_DEVICE(0x413c, 0x8197) },
{ } /* Terminating entry */ { } /* Terminating entry */
...@@ -508,15 +509,10 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags) ...@@ -508,15 +509,10 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags)
pipe = usb_rcvisocpipe(data->udev, data->isoc_rx_ep->bEndpointAddress); pipe = usb_rcvisocpipe(data->udev, data->isoc_rx_ep->bEndpointAddress);
urb->dev = data->udev; usb_fill_int_urb(urb, data->udev, pipe, buf, size, btusb_isoc_complete,
urb->pipe = pipe; hdev, data->isoc_rx_ep->bInterval);
urb->context = hdev;
urb->complete = btusb_isoc_complete;
urb->interval = data->isoc_rx_ep->bInterval;
urb->transfer_flags = URB_FREE_BUFFER | URB_ISO_ASAP; urb->transfer_flags = URB_FREE_BUFFER | URB_ISO_ASAP;
urb->transfer_buffer = buf;
urb->transfer_buffer_length = size;
__fill_isoc_descriptor(urb, size, __fill_isoc_descriptor(urb, size,
le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize)); le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize));
......
...@@ -11,3 +11,4 @@ ath-objs := main.o \ ...@@ -11,3 +11,4 @@ ath-objs := main.o \
key.o key.o
ath-$(CONFIG_ATH_DEBUG) += debug.o ath-$(CONFIG_ATH_DEBUG) += debug.o
ccflags-y += -D__CHECK_ENDIAN__
...@@ -255,7 +255,7 @@ enum ATH_DEBUG { ...@@ -255,7 +255,7 @@ enum ATH_DEBUG {
#define ath_dbg(common, dbg_mask, fmt, ...) \ #define ath_dbg(common, dbg_mask, fmt, ...) \
do { \ do { \
if ((common)->debug_mask & dbg_mask) \ if ((common)->debug_mask & ATH_DBG_##dbg_mask) \
_ath_printk(KERN_DEBUG, common, fmt, ##__VA_ARGS__); \ _ath_printk(KERN_DEBUG, common, fmt, ##__VA_ARGS__); \
} while (0) } while (0)
...@@ -265,10 +265,13 @@ do { \ ...@@ -265,10 +265,13 @@ do { \
#else #else
static inline __attribute__ ((format (printf, 3, 4))) static inline __attribute__ ((format (printf, 3, 4)))
void ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask, void _ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,
const char *fmt, ...) const char *fmt, ...)
{ {
} }
#define ath_dbg(common, dbg_mask, fmt, ...) \
_ath_dbg(common, ATH_DBG_##dbg_mask, fmt, ##__VA_ARGS__)
#define ATH_DBG_WARN(foo, arg...) do {} while (0) #define ATH_DBG_WARN(foo, arg...) do {} while (0)
#define ATH_DBG_WARN_ON_ONCE(foo) ({ \ #define ATH_DBG_WARN_ON_ONCE(foo) ({ \
int __ret_warn_once = !!(foo); \ int __ret_warn_once = !!(foo); \
......
config ATH6KL config ATH6KL
tristate "Atheros ath6kl support" tristate "Atheros mobile chipsets support"
config ATH6KL_SDIO
tristate "Atheros ath6kl SDIO support"
depends on ATH6KL
depends on MMC depends on MMC
depends on CFG80211 depends on CFG80211
---help--- ---help---
This module adds support for wireless adapters based on This module adds support for wireless adapters based on
Atheros AR6003 chipset running over SDIO. If you choose to Atheros AR6003 and AR6004 chipsets running over SDIO. If you
build it as a module, it will be called ath6kl. Pls note choose to build it as a module, it will be called ath6kl_sdio.
that AR6002 and AR6001 are not supported by this driver. Please note that AR6002 and AR6001 are not supported by this
driver.
config ATH6KL_USB
tristate "Atheros ath6kl USB support"
depends on ATH6KL
depends on USB
depends on CFG80211
depends on EXPERIMENTAL
---help---
This module adds support for wireless adapters based on
Atheros AR6004 chipset running over USB. This is still under
implementation and it isn't functional. If you choose to
build it as a module, it will be called ath6kl_usb.
config ATH6KL_DEBUG config ATH6KL_DEBUG
bool "Atheros ath6kl debugging" bool "Atheros ath6kl debugging"
......
...@@ -21,17 +21,30 @@ ...@@ -21,17 +21,30 @@
# Author(s): ="Atheros" # Author(s): ="Atheros"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
obj-$(CONFIG_ATH6KL) := ath6kl.o obj-$(CONFIG_ATH6KL_SDIO) := ath6kl_sdio.o
ath6kl-y += debug.o ath6kl_sdio-y += debug.o
ath6kl-y += hif.o ath6kl_sdio-y += hif.o
ath6kl-y += htc.o ath6kl_sdio-y += htc.o
ath6kl-y += bmi.o ath6kl_sdio-y += bmi.o
ath6kl-y += cfg80211.o ath6kl_sdio-y += cfg80211.o
ath6kl-y += init.o ath6kl_sdio-y += init.o
ath6kl-y += main.o ath6kl_sdio-y += main.o
ath6kl-y += txrx.o ath6kl_sdio-y += txrx.o
ath6kl-y += wmi.o ath6kl_sdio-y += wmi.o
ath6kl-y += sdio.o ath6kl_sdio-y += sdio.o
ath6kl-$(CONFIG_NL80211_TESTMODE) += testmode.o ath6kl_sdio-$(CONFIG_NL80211_TESTMODE) += testmode.o
obj-$(CONFIG_ATH6KL_USB) += ath6kl_usb.o
ath6kl_usb-y += debug.o
ath6kl_usb-y += hif.o
ath6kl_usb-y += htc.o
ath6kl_usb-y += bmi.o
ath6kl_usb-y += cfg80211.o
ath6kl_usb-y += init.o
ath6kl_usb-y += main.o
ath6kl_usb-y += txrx.o
ath6kl_usb-y += wmi.o
ath6kl_usb-y += usb.o
ath6kl_usb-$(CONFIG_NL80211_TESTMODE) += testmode.o
ccflags-y += -D__CHECK_ENDIAN__ ccflags-y += -D__CHECK_ENDIAN__
...@@ -19,165 +19,6 @@ ...@@ -19,165 +19,6 @@
#include "target.h" #include "target.h"
#include "debug.h" #include "debug.h"
static int ath6kl_get_bmi_cmd_credits(struct ath6kl *ar)
{
u32 addr;
unsigned long timeout;
int ret;
ar->bmi.cmd_credits = 0;
/* Read the counter register to get the command credits */
addr = COUNT_DEC_ADDRESS + (HTC_MAILBOX_NUM_MAX + ENDPOINT1) * 4;
timeout = jiffies + msecs_to_jiffies(BMI_COMMUNICATION_TIMEOUT);
while (time_before(jiffies, timeout) && !ar->bmi.cmd_credits) {
/*
* Hit the credit counter with a 4-byte access, the first byte
* read will hit the counter and cause a decrement, while the
* remaining 3 bytes has no effect. The rationale behind this
* is to make all HIF accesses 4-byte aligned.
*/
ret = hif_read_write_sync(ar, addr,
(u8 *)&ar->bmi.cmd_credits, 4,
HIF_RD_SYNC_BYTE_INC);
if (ret) {
ath6kl_err("Unable to decrement the command credit count register: %d\n",
ret);
return ret;
}
/* The counter is only 8 bits.
* Ignore anything in the upper 3 bytes
*/
ar->bmi.cmd_credits &= 0xFF;
}
if (!ar->bmi.cmd_credits) {
ath6kl_err("bmi communication timeout\n");
return -ETIMEDOUT;
}
return 0;
}
static int ath6kl_bmi_get_rx_lkahd(struct ath6kl *ar)
{
unsigned long timeout;
u32 rx_word = 0;
int ret = 0;
timeout = jiffies + msecs_to_jiffies(BMI_COMMUNICATION_TIMEOUT);
while (time_before(jiffies, timeout) && !rx_word) {
ret = hif_read_write_sync(ar, RX_LOOKAHEAD_VALID_ADDRESS,
(u8 *)&rx_word, sizeof(rx_word),
HIF_RD_SYNC_BYTE_INC);
if (ret) {
ath6kl_err("unable to read RX_LOOKAHEAD_VALID\n");
return ret;
}
/* all we really want is one bit */
rx_word &= (1 << ENDPOINT1);
}
if (!rx_word) {
ath6kl_err("bmi_recv_buf FIFO empty\n");
return -EINVAL;
}
return ret;
}
static int ath6kl_bmi_send_buf(struct ath6kl *ar, u8 *buf, u32 len)
{
int ret;
u32 addr;
ret = ath6kl_get_bmi_cmd_credits(ar);
if (ret)
return ret;
addr = ar->mbox_info.htc_addr;
ret = hif_read_write_sync(ar, addr, buf, len,
HIF_WR_SYNC_BYTE_INC);
if (ret)
ath6kl_err("unable to send the bmi data to the device\n");
return ret;
}
static int ath6kl_bmi_recv_buf(struct ath6kl *ar, u8 *buf, u32 len)
{
int ret;
u32 addr;
/*
* During normal bootup, small reads may be required.
* Rather than issue an HIF Read and then wait as the Target
* adds successive bytes to the FIFO, we wait here until
* we know that response data is available.
*
* This allows us to cleanly timeout on an unexpected
* Target failure rather than risk problems at the HIF level.
* In particular, this avoids SDIO timeouts and possibly garbage
* data on some host controllers. And on an interconnect
* such as Compact Flash (as well as some SDIO masters) which
* does not provide any indication on data timeout, it avoids
* a potential hang or garbage response.
*
* Synchronization is more difficult for reads larger than the
* size of the MBOX FIFO (128B), because the Target is unable
* to push the 129th byte of data until AFTER the Host posts an
* HIF Read and removes some FIFO data. So for large reads the
* Host proceeds to post an HIF Read BEFORE all the data is
* actually available to read. Fortunately, large BMI reads do
* not occur in practice -- they're supported for debug/development.
*
* So Host/Target BMI synchronization is divided into these cases:
* CASE 1: length < 4
* Should not happen
*
* CASE 2: 4 <= length <= 128
* Wait for first 4 bytes to be in FIFO
* If CONSERVATIVE_BMI_READ is enabled, also wait for
* a BMI command credit, which indicates that the ENTIRE
* response is available in the the FIFO
*
* CASE 3: length > 128
* Wait for the first 4 bytes to be in FIFO
*
* For most uses, a small timeout should be sufficient and we will
* usually see a response quickly; but there may be some unusual
* (debug) cases of BMI_EXECUTE where we want an larger timeout.
* For now, we use an unbounded busy loop while waiting for
* BMI_EXECUTE.
*
* If BMI_EXECUTE ever needs to support longer-latency execution,
* especially in production, this code needs to be enhanced to sleep
* and yield. Also note that BMI_COMMUNICATION_TIMEOUT is currently
* a function of Host processor speed.
*/
if (len >= 4) { /* NB: Currently, always true */
ret = ath6kl_bmi_get_rx_lkahd(ar);
if (ret)
return ret;
}
addr = ar->mbox_info.htc_addr;
ret = hif_read_write_sync(ar, addr, buf, len,
HIF_RD_SYNC_BYTE_INC);
if (ret) {
ath6kl_err("Unable to read the bmi data from the device: %d\n",
ret);
return ret;
}
return 0;
}
int ath6kl_bmi_done(struct ath6kl *ar) int ath6kl_bmi_done(struct ath6kl *ar)
{ {
int ret; int ret;
...@@ -190,7 +31,7 @@ int ath6kl_bmi_done(struct ath6kl *ar) ...@@ -190,7 +31,7 @@ int ath6kl_bmi_done(struct ath6kl *ar)
ar->bmi.done_sent = true; ar->bmi.done_sent = true;
ret = ath6kl_bmi_send_buf(ar, (u8 *)&cid, sizeof(cid)); ret = ath6kl_hif_bmi_write(ar, (u8 *)&cid, sizeof(cid));
if (ret) { if (ret) {
ath6kl_err("Unable to send bmi done: %d\n", ret); ath6kl_err("Unable to send bmi done: %d\n", ret);
return ret; return ret;
...@@ -210,14 +51,20 @@ int ath6kl_bmi_get_target_info(struct ath6kl *ar, ...@@ -210,14 +51,20 @@ int ath6kl_bmi_get_target_info(struct ath6kl *ar,
return -EACCES; return -EACCES;
} }
ret = ath6kl_bmi_send_buf(ar, (u8 *)&cid, sizeof(cid)); ret = ath6kl_hif_bmi_write(ar, (u8 *)&cid, sizeof(cid));
if (ret) { if (ret) {
ath6kl_err("Unable to send get target info: %d\n", ret); ath6kl_err("Unable to send get target info: %d\n", ret);
return ret; return ret;
} }
ret = ath6kl_bmi_recv_buf(ar, (u8 *)&targ_info->version, if (ar->hif_type == ATH6KL_HIF_TYPE_USB) {
sizeof(targ_info->version)); ret = ath6kl_hif_bmi_read(ar, (u8 *)targ_info,
sizeof(*targ_info));
} else {
ret = ath6kl_hif_bmi_read(ar, (u8 *)&targ_info->version,
sizeof(targ_info->version));
}
if (ret) { if (ret) {
ath6kl_err("Unable to recv target info: %d\n", ret); ath6kl_err("Unable to recv target info: %d\n", ret);
return ret; return ret;
...@@ -225,7 +72,7 @@ int ath6kl_bmi_get_target_info(struct ath6kl *ar, ...@@ -225,7 +72,7 @@ int ath6kl_bmi_get_target_info(struct ath6kl *ar,
if (le32_to_cpu(targ_info->version) == TARGET_VERSION_SENTINAL) { if (le32_to_cpu(targ_info->version) == TARGET_VERSION_SENTINAL) {
/* Determine how many bytes are in the Target's targ_info */ /* Determine how many bytes are in the Target's targ_info */
ret = ath6kl_bmi_recv_buf(ar, ret = ath6kl_hif_bmi_read(ar,
(u8 *)&targ_info->byte_count, (u8 *)&targ_info->byte_count,
sizeof(targ_info->byte_count)); sizeof(targ_info->byte_count));
if (ret) { if (ret) {
...@@ -244,7 +91,7 @@ int ath6kl_bmi_get_target_info(struct ath6kl *ar, ...@@ -244,7 +91,7 @@ int ath6kl_bmi_get_target_info(struct ath6kl *ar,
} }
/* Read the remainder of the targ_info */ /* Read the remainder of the targ_info */
ret = ath6kl_bmi_recv_buf(ar, ret = ath6kl_hif_bmi_read(ar,
((u8 *)targ_info) + ((u8 *)targ_info) +
sizeof(targ_info->byte_count), sizeof(targ_info->byte_count),
sizeof(*targ_info) - sizeof(*targ_info) -
...@@ -276,8 +123,8 @@ int ath6kl_bmi_read(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) ...@@ -276,8 +123,8 @@ int ath6kl_bmi_read(struct ath6kl *ar, u32 addr, u8 *buf, u32 len)
return -EACCES; return -EACCES;
} }
size = BMI_DATASZ_MAX + sizeof(cid) + sizeof(addr) + sizeof(len); size = ar->bmi.max_data_size + sizeof(cid) + sizeof(addr) + sizeof(len);
if (size > MAX_BMI_CMDBUF_SZ) { if (size > ar->bmi.max_cmd_size) {
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
...@@ -290,8 +137,8 @@ int ath6kl_bmi_read(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) ...@@ -290,8 +137,8 @@ int ath6kl_bmi_read(struct ath6kl *ar, u32 addr, u8 *buf, u32 len)
len_remain = len; len_remain = len;
while (len_remain) { while (len_remain) {
rx_len = (len_remain < BMI_DATASZ_MAX) ? rx_len = (len_remain < ar->bmi.max_data_size) ?
len_remain : BMI_DATASZ_MAX; len_remain : ar->bmi.max_data_size;
offset = 0; offset = 0;
memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid));
offset += sizeof(cid); offset += sizeof(cid);
...@@ -300,13 +147,13 @@ int ath6kl_bmi_read(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) ...@@ -300,13 +147,13 @@ int ath6kl_bmi_read(struct ath6kl *ar, u32 addr, u8 *buf, u32 len)
memcpy(&(ar->bmi.cmd_buf[offset]), &rx_len, sizeof(rx_len)); memcpy(&(ar->bmi.cmd_buf[offset]), &rx_len, sizeof(rx_len));
offset += sizeof(len); offset += sizeof(len);
ret = ath6kl_bmi_send_buf(ar, ar->bmi.cmd_buf, offset); ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset);
if (ret) { if (ret) {
ath6kl_err("Unable to write to the device: %d\n", ath6kl_err("Unable to write to the device: %d\n",
ret); ret);
return ret; return ret;
} }
ret = ath6kl_bmi_recv_buf(ar, ar->bmi.cmd_buf, rx_len); ret = ath6kl_hif_bmi_read(ar, ar->bmi.cmd_buf, rx_len);
if (ret) { if (ret) {
ath6kl_err("Unable to read from the device: %d\n", ath6kl_err("Unable to read from the device: %d\n",
ret); ret);
...@@ -326,7 +173,7 @@ int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) ...@@ -326,7 +173,7 @@ int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len)
u32 offset; u32 offset;
u32 len_remain, tx_len; u32 len_remain, tx_len;
const u32 header = sizeof(cid) + sizeof(addr) + sizeof(len); const u32 header = sizeof(cid) + sizeof(addr) + sizeof(len);
u8 aligned_buf[BMI_DATASZ_MAX]; u8 aligned_buf[400];
u8 *src; u8 *src;
if (ar->bmi.done_sent) { if (ar->bmi.done_sent) {
...@@ -334,12 +181,15 @@ int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) ...@@ -334,12 +181,15 @@ int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len)
return -EACCES; return -EACCES;
} }
if ((BMI_DATASZ_MAX + header) > MAX_BMI_CMDBUF_SZ) { if ((ar->bmi.max_data_size + header) > ar->bmi.max_cmd_size) {
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
memset(ar->bmi.cmd_buf, 0, BMI_DATASZ_MAX + header); if (WARN_ON(ar->bmi.max_data_size > sizeof(aligned_buf)))
return -E2BIG;
memset(ar->bmi.cmd_buf, 0, ar->bmi.max_data_size + header);
ath6kl_dbg(ATH6KL_DBG_BMI, ath6kl_dbg(ATH6KL_DBG_BMI,
"bmi write memory: addr: 0x%x, len: %d\n", addr, len); "bmi write memory: addr: 0x%x, len: %d\n", addr, len);
...@@ -348,7 +198,7 @@ int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) ...@@ -348,7 +198,7 @@ int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len)
while (len_remain) { while (len_remain) {
src = &buf[len - len_remain]; src = &buf[len - len_remain];
if (len_remain < (BMI_DATASZ_MAX - header)) { if (len_remain < (ar->bmi.max_data_size - header)) {
if (len_remain & 3) { if (len_remain & 3) {
/* align it with 4 bytes */ /* align it with 4 bytes */
len_remain = len_remain + len_remain = len_remain +
...@@ -358,7 +208,7 @@ int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) ...@@ -358,7 +208,7 @@ int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len)
} }
tx_len = len_remain; tx_len = len_remain;
} else { } else {
tx_len = (BMI_DATASZ_MAX - header); tx_len = (ar->bmi.max_data_size - header);
} }
offset = 0; offset = 0;
...@@ -371,7 +221,7 @@ int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) ...@@ -371,7 +221,7 @@ int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len)
memcpy(&(ar->bmi.cmd_buf[offset]), src, tx_len); memcpy(&(ar->bmi.cmd_buf[offset]), src, tx_len);
offset += tx_len; offset += tx_len;
ret = ath6kl_bmi_send_buf(ar, ar->bmi.cmd_buf, offset); ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset);
if (ret) { if (ret) {
ath6kl_err("Unable to write to the device: %d\n", ath6kl_err("Unable to write to the device: %d\n",
ret); ret);
...@@ -396,7 +246,7 @@ int ath6kl_bmi_execute(struct ath6kl *ar, u32 addr, u32 *param) ...@@ -396,7 +246,7 @@ int ath6kl_bmi_execute(struct ath6kl *ar, u32 addr, u32 *param)
} }
size = sizeof(cid) + sizeof(addr) + sizeof(param); size = sizeof(cid) + sizeof(addr) + sizeof(param);
if (size > MAX_BMI_CMDBUF_SZ) { if (size > ar->bmi.max_cmd_size) {
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
...@@ -413,13 +263,13 @@ int ath6kl_bmi_execute(struct ath6kl *ar, u32 addr, u32 *param) ...@@ -413,13 +263,13 @@ int ath6kl_bmi_execute(struct ath6kl *ar, u32 addr, u32 *param)
memcpy(&(ar->bmi.cmd_buf[offset]), param, sizeof(*param)); memcpy(&(ar->bmi.cmd_buf[offset]), param, sizeof(*param));
offset += sizeof(*param); offset += sizeof(*param);
ret = ath6kl_bmi_send_buf(ar, ar->bmi.cmd_buf, offset); ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset);
if (ret) { if (ret) {
ath6kl_err("Unable to write to the device: %d\n", ret); ath6kl_err("Unable to write to the device: %d\n", ret);
return ret; return ret;
} }
ret = ath6kl_bmi_recv_buf(ar, ar->bmi.cmd_buf, sizeof(*param)); ret = ath6kl_hif_bmi_read(ar, ar->bmi.cmd_buf, sizeof(*param));
if (ret) { if (ret) {
ath6kl_err("Unable to read from the device: %d\n", ret); ath6kl_err("Unable to read from the device: %d\n", ret);
return ret; return ret;
...@@ -443,7 +293,7 @@ int ath6kl_bmi_set_app_start(struct ath6kl *ar, u32 addr) ...@@ -443,7 +293,7 @@ int ath6kl_bmi_set_app_start(struct ath6kl *ar, u32 addr)
} }
size = sizeof(cid) + sizeof(addr); size = sizeof(cid) + sizeof(addr);
if (size > MAX_BMI_CMDBUF_SZ) { if (size > ar->bmi.max_cmd_size) {
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
...@@ -457,7 +307,7 @@ int ath6kl_bmi_set_app_start(struct ath6kl *ar, u32 addr) ...@@ -457,7 +307,7 @@ int ath6kl_bmi_set_app_start(struct ath6kl *ar, u32 addr)
memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr));
offset += sizeof(addr); offset += sizeof(addr);
ret = ath6kl_bmi_send_buf(ar, ar->bmi.cmd_buf, offset); ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset);
if (ret) { if (ret) {
ath6kl_err("Unable to write to the device: %d\n", ret); ath6kl_err("Unable to write to the device: %d\n", ret);
return ret; return ret;
...@@ -479,7 +329,7 @@ int ath6kl_bmi_reg_read(struct ath6kl *ar, u32 addr, u32 *param) ...@@ -479,7 +329,7 @@ int ath6kl_bmi_reg_read(struct ath6kl *ar, u32 addr, u32 *param)
} }
size = sizeof(cid) + sizeof(addr); size = sizeof(cid) + sizeof(addr);
if (size > MAX_BMI_CMDBUF_SZ) { if (size > ar->bmi.max_cmd_size) {
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
...@@ -493,13 +343,13 @@ int ath6kl_bmi_reg_read(struct ath6kl *ar, u32 addr, u32 *param) ...@@ -493,13 +343,13 @@ int ath6kl_bmi_reg_read(struct ath6kl *ar, u32 addr, u32 *param)
memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr));
offset += sizeof(addr); offset += sizeof(addr);
ret = ath6kl_bmi_send_buf(ar, ar->bmi.cmd_buf, offset); ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset);
if (ret) { if (ret) {
ath6kl_err("Unable to write to the device: %d\n", ret); ath6kl_err("Unable to write to the device: %d\n", ret);
return ret; return ret;
} }
ret = ath6kl_bmi_recv_buf(ar, ar->bmi.cmd_buf, sizeof(*param)); ret = ath6kl_hif_bmi_read(ar, ar->bmi.cmd_buf, sizeof(*param));
if (ret) { if (ret) {
ath6kl_err("Unable to read from the device: %d\n", ret); ath6kl_err("Unable to read from the device: %d\n", ret);
return ret; return ret;
...@@ -522,7 +372,7 @@ int ath6kl_bmi_reg_write(struct ath6kl *ar, u32 addr, u32 param) ...@@ -522,7 +372,7 @@ int ath6kl_bmi_reg_write(struct ath6kl *ar, u32 addr, u32 param)
} }
size = sizeof(cid) + sizeof(addr) + sizeof(param); size = sizeof(cid) + sizeof(addr) + sizeof(param);
if (size > MAX_BMI_CMDBUF_SZ) { if (size > ar->bmi.max_cmd_size) {
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
...@@ -540,7 +390,7 @@ int ath6kl_bmi_reg_write(struct ath6kl *ar, u32 addr, u32 param) ...@@ -540,7 +390,7 @@ int ath6kl_bmi_reg_write(struct ath6kl *ar, u32 addr, u32 param)
memcpy(&(ar->bmi.cmd_buf[offset]), &param, sizeof(param)); memcpy(&(ar->bmi.cmd_buf[offset]), &param, sizeof(param));
offset += sizeof(param); offset += sizeof(param);
ret = ath6kl_bmi_send_buf(ar, ar->bmi.cmd_buf, offset); ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset);
if (ret) { if (ret) {
ath6kl_err("Unable to write to the device: %d\n", ret); ath6kl_err("Unable to write to the device: %d\n", ret);
return ret; return ret;
...@@ -563,8 +413,8 @@ int ath6kl_bmi_lz_data(struct ath6kl *ar, u8 *buf, u32 len) ...@@ -563,8 +413,8 @@ int ath6kl_bmi_lz_data(struct ath6kl *ar, u8 *buf, u32 len)
return -EACCES; return -EACCES;
} }
size = BMI_DATASZ_MAX + header; size = ar->bmi.max_data_size + header;
if (size > MAX_BMI_CMDBUF_SZ) { if (size > ar->bmi.max_cmd_size) {
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
...@@ -575,8 +425,8 @@ int ath6kl_bmi_lz_data(struct ath6kl *ar, u8 *buf, u32 len) ...@@ -575,8 +425,8 @@ int ath6kl_bmi_lz_data(struct ath6kl *ar, u8 *buf, u32 len)
len_remain = len; len_remain = len;
while (len_remain) { while (len_remain) {
tx_len = (len_remain < (BMI_DATASZ_MAX - header)) ? tx_len = (len_remain < (ar->bmi.max_data_size - header)) ?
len_remain : (BMI_DATASZ_MAX - header); len_remain : (ar->bmi.max_data_size - header);
offset = 0; offset = 0;
memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid));
...@@ -587,7 +437,7 @@ int ath6kl_bmi_lz_data(struct ath6kl *ar, u8 *buf, u32 len) ...@@ -587,7 +437,7 @@ int ath6kl_bmi_lz_data(struct ath6kl *ar, u8 *buf, u32 len)
tx_len); tx_len);
offset += tx_len; offset += tx_len;
ret = ath6kl_bmi_send_buf(ar, ar->bmi.cmd_buf, offset); ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset);
if (ret) { if (ret) {
ath6kl_err("Unable to write to the device: %d\n", ath6kl_err("Unable to write to the device: %d\n",
ret); ret);
...@@ -613,7 +463,7 @@ int ath6kl_bmi_lz_stream_start(struct ath6kl *ar, u32 addr) ...@@ -613,7 +463,7 @@ int ath6kl_bmi_lz_stream_start(struct ath6kl *ar, u32 addr)
} }
size = sizeof(cid) + sizeof(addr); size = sizeof(cid) + sizeof(addr);
if (size > MAX_BMI_CMDBUF_SZ) { if (size > ar->bmi.max_cmd_size) {
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
...@@ -629,7 +479,7 @@ int ath6kl_bmi_lz_stream_start(struct ath6kl *ar, u32 addr) ...@@ -629,7 +479,7 @@ int ath6kl_bmi_lz_stream_start(struct ath6kl *ar, u32 addr)
memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr));
offset += sizeof(addr); offset += sizeof(addr);
ret = ath6kl_bmi_send_buf(ar, ar->bmi.cmd_buf, offset); ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset);
if (ret) { if (ret) {
ath6kl_err("Unable to start LZ stream to the device: %d\n", ath6kl_err("Unable to start LZ stream to the device: %d\n",
ret); ret);
...@@ -677,8 +527,13 @@ void ath6kl_bmi_reset(struct ath6kl *ar) ...@@ -677,8 +527,13 @@ void ath6kl_bmi_reset(struct ath6kl *ar)
int ath6kl_bmi_init(struct ath6kl *ar) int ath6kl_bmi_init(struct ath6kl *ar)
{ {
ar->bmi.cmd_buf = kzalloc(MAX_BMI_CMDBUF_SZ, GFP_ATOMIC); if (WARN_ON(ar->bmi.max_data_size == 0))
return -EINVAL;
/* cmd + addr + len + data_size */
ar->bmi.max_cmd_size = ar->bmi.max_data_size + (sizeof(u32) * 3);
ar->bmi.cmd_buf = kzalloc(ar->bmi.max_cmd_size, GFP_ATOMIC);
if (!ar->bmi.cmd_buf) if (!ar->bmi.cmd_buf)
return -ENOMEM; return -ENOMEM;
......
...@@ -44,12 +44,6 @@ ...@@ -44,12 +44,6 @@
* BMI handles all required Target-side cache flushing. * BMI handles all required Target-side cache flushing.
*/ */
#define MAX_BMI_CMDBUF_SZ (BMI_DATASZ_MAX + \
(sizeof(u32) * 3 /* cmd + addr + len */))
/* Maximum data size used for BMI transfers */
#define BMI_DATASZ_MAX 256
/* BMI Commands */ /* BMI Commands */
#define BMI_NO_COMMAND 0 #define BMI_NO_COMMAND 0
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
enum ath6kl_cfg_suspend_mode { enum ath6kl_cfg_suspend_mode {
ATH6KL_CFG_SUSPEND_DEEPSLEEP, ATH6KL_CFG_SUSPEND_DEEPSLEEP,
ATH6KL_CFG_SUSPEND_CUTPOWER, ATH6KL_CFG_SUSPEND_CUTPOWER,
ATH6KL_CFG_SUSPEND_WOW ATH6KL_CFG_SUSPEND_WOW,
ATH6KL_CFG_SUSPEND_SCHED_SCAN,
}; };
struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
...@@ -52,6 +53,7 @@ int ath6kl_cfg80211_suspend(struct ath6kl *ar, ...@@ -52,6 +53,7 @@ int ath6kl_cfg80211_suspend(struct ath6kl *ar,
int ath6kl_cfg80211_resume(struct ath6kl *ar); int ath6kl_cfg80211_resume(struct ath6kl *ar);
void ath6kl_cfg80211_stop(struct ath6kl *ar); void ath6kl_cfg80211_stop(struct ath6kl_vif *vif);
void ath6kl_cfg80211_stop_all(struct ath6kl *ar);
#endif /* ATH6KL_CFG80211_H */ #endif /* ATH6KL_CFG80211_H */
...@@ -71,6 +71,7 @@ enum crypto_type { ...@@ -71,6 +71,7 @@ enum crypto_type {
WEP_CRYPT = 0x02, WEP_CRYPT = 0x02,
TKIP_CRYPT = 0x04, TKIP_CRYPT = 0x04,
AES_CRYPT = 0x08, AES_CRYPT = 0x08,
WAPI_CRYPT = 0x10,
}; };
struct htc_endpoint_credit_dist; struct htc_endpoint_credit_dist;
......
...@@ -70,10 +70,20 @@ enum ath6kl_fw_ie_type { ...@@ -70,10 +70,20 @@ enum ath6kl_fw_ie_type {
ATH6KL_FW_IE_RESERVED_RAM_SIZE = 5, ATH6KL_FW_IE_RESERVED_RAM_SIZE = 5,
ATH6KL_FW_IE_CAPABILITIES = 6, ATH6KL_FW_IE_CAPABILITIES = 6,
ATH6KL_FW_IE_PATCH_ADDR = 7, ATH6KL_FW_IE_PATCH_ADDR = 7,
ATH6KL_FW_IE_BOARD_ADDR = 8,
ATH6KL_FW_IE_VIF_MAX = 9,
}; };
enum ath6kl_fw_capability { enum ath6kl_fw_capability {
ATH6KL_FW_CAPABILITY_HOST_P2P = 0, ATH6KL_FW_CAPABILITY_HOST_P2P = 0,
ATH6KL_FW_CAPABILITY_SCHED_SCAN = 1,
/*
* Firmware is capable of supporting P2P mgmt operations on a
* station interface. After group formation, the station
* interface will become a P2P client/GO interface as the case may be
*/
ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
/* this needs to be last */ /* this needs to be last */
ATH6KL_FW_CAPABILITY_MAX, ATH6KL_FW_CAPABILITY_MAX,
...@@ -88,37 +98,47 @@ struct ath6kl_fw_ie { ...@@ -88,37 +98,47 @@ struct ath6kl_fw_ie {
}; };
/* AR6003 1.0 definitions */ /* AR6003 1.0 definitions */
#define AR6003_REV1_VERSION 0x300002ba #define AR6003_HW_1_0_VERSION 0x300002ba
/* AR6003 2.0 definitions */ /* AR6003 2.0 definitions */
#define AR6003_REV2_VERSION 0x30000384 #define AR6003_HW_2_0_VERSION 0x30000384
#define AR6003_REV2_PATCH_DOWNLOAD_ADDRESS 0x57e910 #define AR6003_HW_2_0_PATCH_DOWNLOAD_ADDRESS 0x57e910
#define AR6003_REV2_OTP_FILE "ath6k/AR6003/hw2.0/otp.bin.z77" #define AR6003_HW_2_0_OTP_FILE "ath6k/AR6003/hw2.0/otp.bin.z77"
#define AR6003_REV2_FIRMWARE_FILE "ath6k/AR6003/hw2.0/athwlan.bin.z77" #define AR6003_HW_2_0_FIRMWARE_FILE "ath6k/AR6003/hw2.0/athwlan.bin.z77"
#define AR6003_REV2_TCMD_FIRMWARE_FILE "ath6k/AR6003/hw2.0/athtcmd_ram.bin" #define AR6003_HW_2_0_TCMD_FIRMWARE_FILE "ath6k/AR6003/hw2.0/athtcmd_ram.bin"
#define AR6003_REV2_PATCH_FILE "ath6k/AR6003/hw2.0/data.patch.bin" #define AR6003_HW_2_0_PATCH_FILE "ath6k/AR6003/hw2.0/data.patch.bin"
#define AR6003_REV2_FIRMWARE_2_FILE "ath6k/AR6003/hw2.0/fw-2.bin" #define AR6003_HW_2_0_FIRMWARE_2_FILE "ath6k/AR6003/hw2.0/fw-2.bin"
#define AR6003_REV2_BOARD_DATA_FILE "ath6k/AR6003/hw2.0/bdata.bin" #define AR6003_HW_2_0_BOARD_DATA_FILE "ath6k/AR6003/hw2.0/bdata.bin"
#define AR6003_REV2_DEFAULT_BOARD_DATA_FILE "ath6k/AR6003/hw2.0/bdata.SD31.bin" #define AR6003_HW_2_0_DEFAULT_BOARD_DATA_FILE \
"ath6k/AR6003/hw2.0/bdata.SD31.bin"
/* AR6003 3.0 definitions */ /* AR6003 3.0 definitions */
#define AR6003_REV3_VERSION 0x30000582 #define AR6003_HW_2_1_1_VERSION 0x30000582
#define AR6003_REV3_OTP_FILE "ath6k/AR6003/hw2.1.1/otp.bin" #define AR6003_HW_2_1_1_OTP_FILE "ath6k/AR6003/hw2.1.1/otp.bin"
#define AR6003_REV3_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/athwlan.bin" #define AR6003_HW_2_1_1_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/athwlan.bin"
#define AR6003_REV3_TCMD_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/athtcmd_ram.bin" #define AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE \
#define AR6003_REV3_PATCH_FILE "ath6k/AR6003/hw2.1.1/data.patch.bin" "ath6k/AR6003/hw2.1.1/athtcmd_ram.bin"
#define AR6003_REV3_FIRMWARE_2_FILE "ath6k/AR6003/hw2.1.1/fw-2.bin" #define AR6003_HW_2_1_1_PATCH_FILE "ath6k/AR6003/hw2.1.1/data.patch.bin"
#define AR6003_REV3_BOARD_DATA_FILE "ath6k/AR6003/hw2.1.1/bdata.bin" #define AR6003_HW_2_1_1_FIRMWARE_2_FILE "ath6k/AR6003/hw2.1.1/fw-2.bin"
#define AR6003_REV3_DEFAULT_BOARD_DATA_FILE \ #define AR6003_HW_2_1_1_BOARD_DATA_FILE "ath6k/AR6003/hw2.1.1/bdata.bin"
"ath6k/AR6003/hw2.1.1/bdata.SD31.bin" #define AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE \
"ath6k/AR6003/hw2.1.1/bdata.SD31.bin"
/* AR6004 1.0 definitions */ /* AR6004 1.0 definitions */
#define AR6004_REV1_VERSION 0x30000623 #define AR6004_HW_1_0_VERSION 0x30000623
#define AR6004_REV1_FIRMWARE_FILE "ath6k/AR6004/hw6.1/fw.ram.bin" #define AR6004_HW_1_0_FIRMWARE_2_FILE "ath6k/AR6004/hw1.0/fw-2.bin"
#define AR6004_REV1_FIRMWARE_2_FILE "ath6k/AR6004/hw6.1/fw-2.bin" #define AR6004_HW_1_0_FIRMWARE_FILE "ath6k/AR6004/hw1.0/fw.ram.bin"
#define AR6004_REV1_BOARD_DATA_FILE "ath6k/AR6004/hw6.1/bdata.bin" #define AR6004_HW_1_0_BOARD_DATA_FILE "ath6k/AR6004/hw1.0/bdata.bin"
#define AR6004_REV1_DEFAULT_BOARD_DATA_FILE "ath6k/AR6004/hw6.1/bdata.DB132.bin" #define AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE \
#define AR6004_REV1_EPPING_FIRMWARE_FILE "ath6k/AR6004/hw6.1/endpointping.bin" "ath6k/AR6004/hw1.0/bdata.DB132.bin"
/* AR6004 1.1 definitions */
#define AR6004_HW_1_1_VERSION 0x30000001
#define AR6004_HW_1_1_FIRMWARE_2_FILE "ath6k/AR6004/hw1.1/fw-2.bin"
#define AR6004_HW_1_1_FIRMWARE_FILE "ath6k/AR6004/hw1.1/fw.ram.bin"
#define AR6004_HW_1_1_BOARD_DATA_FILE "ath6k/AR6004/hw1.1/bdata.bin"
#define AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE \
"ath6k/AR6004/hw1.1/bdata.DB132.bin"
/* Per STA data, used in AP mode */ /* Per STA data, used in AP mode */
#define STA_PS_AWAKE BIT(0) #define STA_PS_AWAKE BIT(0)
...@@ -272,6 +292,8 @@ struct ath6kl_bmi { ...@@ -272,6 +292,8 @@ struct ath6kl_bmi {
u32 cmd_credits; u32 cmd_credits;
bool done_sent; bool done_sent;
u8 *cmd_buf; u8 *cmd_buf;
u32 max_data_size;
u32 max_cmd_size;
}; };
struct target_stats { struct target_stats {
...@@ -381,7 +403,16 @@ struct ath6kl_req_key { ...@@ -381,7 +403,16 @@ struct ath6kl_req_key {
u8 key_len; u8 key_len;
}; };
#define MAX_NUM_VIF 1 enum ath6kl_hif_type {
ATH6KL_HIF_TYPE_SDIO,
ATH6KL_HIF_TYPE_USB,
};
/*
* Driver's maximum limit, note that some firmwares support only one vif
* and the runtime (current) limit must be checked from ar->vif_max.
*/
#define ATH6KL_VIF_MAX 3
/* vif flags info */ /* vif flags info */
enum ath6kl_vif_state { enum ath6kl_vif_state {
...@@ -424,7 +455,10 @@ struct ath6kl_vif { ...@@ -424,7 +455,10 @@ struct ath6kl_vif {
struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1]; struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1];
struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1]; struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1];
struct aggr_info *aggr_cntxt; struct aggr_info *aggr_cntxt;
struct timer_list disconnect_timer; struct timer_list disconnect_timer;
struct timer_list sched_scan_timer;
struct cfg80211_scan_request *scan_req; struct cfg80211_scan_request *scan_req;
enum sme_state sme_state; enum sme_state sme_state;
int reconnect_flag; int reconnect_flag;
...@@ -442,6 +476,8 @@ struct ath6kl_vif { ...@@ -442,6 +476,8 @@ struct ath6kl_vif {
#define WOW_LIST_ID 0 #define WOW_LIST_ID 0
#define WOW_HOST_REQ_DELAY 500 /* ms */ #define WOW_HOST_REQ_DELAY 500 /* ms */
#define ATH6KL_SCHED_SCAN_RESULT_DELAY 5000 /* ms */
/* Flag info */ /* Flag info */
enum ath6kl_dev_state { enum ath6kl_dev_state {
WMI_ENABLED, WMI_ENABLED,
...@@ -460,6 +496,7 @@ enum ath6kl_state { ...@@ -460,6 +496,7 @@ enum ath6kl_state {
ATH6KL_STATE_DEEPSLEEP, ATH6KL_STATE_DEEPSLEEP,
ATH6KL_STATE_CUTPOWER, ATH6KL_STATE_CUTPOWER,
ATH6KL_STATE_WOW, ATH6KL_STATE_WOW,
ATH6KL_STATE_SCHED_SCAN,
}; };
struct ath6kl { struct ath6kl {
...@@ -474,11 +511,13 @@ struct ath6kl { ...@@ -474,11 +511,13 @@ struct ath6kl {
int tx_pending[ENDPOINT_MAX]; int tx_pending[ENDPOINT_MAX];
int total_tx_data_pend; int total_tx_data_pend;
struct htc_target *htc_target; struct htc_target *htc_target;
enum ath6kl_hif_type hif_type;
void *hif_priv; void *hif_priv;
struct list_head vif_list; struct list_head vif_list;
/* Lock to avoid race in vif_list entries among add/del/traverse */ /* Lock to avoid race in vif_list entries among add/del/traverse */
spinlock_t list_lock; spinlock_t list_lock;
u8 num_vif; u8 num_vif;
unsigned int vif_max;
u8 max_norm_iface; u8 max_norm_iface;
u8 avail_idx_map; u8 avail_idx_map;
spinlock_t lock; spinlock_t lock;
...@@ -517,7 +556,6 @@ struct ath6kl { ...@@ -517,7 +556,6 @@ struct ath6kl {
struct list_head amsdu_rx_buffer_queue; struct list_head amsdu_rx_buffer_queue;
u8 rx_meta_ver; u8 rx_meta_ver;
enum wlan_low_pwr_state wlan_pwr_state; enum wlan_low_pwr_state wlan_pwr_state;
struct wmi_scan_params_cmd sc_params;
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
#define AR_MCAST_FILTER_MAC_ADDR_SIZE 4 #define AR_MCAST_FILTER_MAC_ADDR_SIZE 4
struct { struct {
...@@ -525,12 +563,25 @@ struct ath6kl { ...@@ -525,12 +563,25 @@ struct ath6kl {
size_t rx_report_len; size_t rx_report_len;
} tm; } tm;
struct { struct ath6kl_hw {
u32 id;
const char *name;
u32 dataset_patch_addr; u32 dataset_patch_addr;
u32 app_load_addr; u32 app_load_addr;
u32 app_start_override_addr; u32 app_start_override_addr;
u32 board_ext_data_addr; u32 board_ext_data_addr;
u32 reserved_ram_size; u32 reserved_ram_size;
u32 board_addr;
u32 refclk_hz;
u32 uarttx_pin;
const char *fw_otp;
const char *fw;
const char *fw_tcmd;
const char *fw_patch;
const char *fw_api2;
const char *fw_board;
const char *fw_default_board;
} hw; } hw;
u16 conf_flags; u16 conf_flags;
...@@ -583,7 +634,7 @@ struct ath6kl { ...@@ -583,7 +634,7 @@ struct ath6kl {
#endif /* CONFIG_ATH6KL_DEBUG */ #endif /* CONFIG_ATH6KL_DEBUG */
}; };
static inline void *ath6kl_priv(struct net_device *dev) static inline struct ath6kl *ath6kl_priv(struct net_device *dev)
{ {
return ((struct ath6kl_vif *) netdev_priv(dev))->ar; return ((struct ath6kl_vif *) netdev_priv(dev))->ar;
} }
......
...@@ -1551,10 +1551,10 @@ static ssize_t ath6kl_listen_int_read(struct file *file, ...@@ -1551,10 +1551,10 @@ static ssize_t ath6kl_listen_int_read(struct file *file,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct ath6kl *ar = file->private_data; struct ath6kl *ar = file->private_data;
char buf[16]; char buf[32];
int len; int len;
len = snprintf(buf, sizeof(buf), "%u %u\n", ar->listen_intvl_t, len = scnprintf(buf, sizeof(buf), "%u %u\n", ar->listen_intvl_t,
ar->listen_intvl_b); ar->listen_intvl_b);
return simple_read_from_buffer(user_buf, count, ppos, buf, len); return simple_read_from_buffer(user_buf, count, ppos, buf, len);
......
...@@ -41,6 +41,7 @@ enum ATH6K_DEBUG_MASK { ...@@ -41,6 +41,7 @@ enum ATH6K_DEBUG_MASK {
ATH6KL_DBG_BOOT = BIT(18), /* driver init and fw boot */ ATH6KL_DBG_BOOT = BIT(18), /* driver init and fw boot */
ATH6KL_DBG_WMI_DUMP = BIT(19), ATH6KL_DBG_WMI_DUMP = BIT(19),
ATH6KL_DBG_SUSPEND = BIT(20), ATH6KL_DBG_SUSPEND = BIT(20),
ATH6KL_DBG_USB = BIT(21),
ATH6KL_DBG_ANY = 0xffffffff /* enable all logs */ ATH6KL_DBG_ANY = 0xffffffff /* enable all logs */
}; };
......
...@@ -91,6 +91,36 @@ static inline int ath6kl_hif_suspend(struct ath6kl *ar, ...@@ -91,6 +91,36 @@ static inline int ath6kl_hif_suspend(struct ath6kl *ar,
return ar->hif_ops->suspend(ar, wow); return ar->hif_ops->suspend(ar, wow);
} }
/*
* Read from the ATH6KL through its diagnostic window. No cooperation from
* the Target is required for this.
*/
static inline int ath6kl_hif_diag_read32(struct ath6kl *ar, u32 address,
u32 *value)
{
return ar->hif_ops->diag_read32(ar, address, value);
}
/*
* Write to the ATH6KL through its diagnostic window. No cooperation from
* the Target is required for this.
*/
static inline int ath6kl_hif_diag_write32(struct ath6kl *ar, u32 address,
__le32 value)
{
return ar->hif_ops->diag_write32(ar, address, value);
}
static inline int ath6kl_hif_bmi_read(struct ath6kl *ar, u8 *buf, u32 len)
{
return ar->hif_ops->bmi_read(ar, buf, len);
}
static inline int ath6kl_hif_bmi_write(struct ath6kl *ar, u8 *buf, u32 len)
{
return ar->hif_ops->bmi_write(ar, buf, len);
}
static inline int ath6kl_hif_resume(struct ath6kl *ar) static inline int ath6kl_hif_resume(struct ath6kl *ar)
{ {
ath6kl_dbg(ATH6KL_DBG_HIF, "hif resume\n"); ath6kl_dbg(ATH6KL_DBG_HIF, "hif resume\n");
......
...@@ -689,6 +689,11 @@ int ath6kl_hif_setup(struct ath6kl_device *dev) ...@@ -689,6 +689,11 @@ int ath6kl_hif_setup(struct ath6kl_device *dev)
ath6kl_dbg(ATH6KL_DBG_HIF, "hif block size %d mbox addr 0x%x\n", ath6kl_dbg(ATH6KL_DBG_HIF, "hif block size %d mbox addr 0x%x\n",
dev->htc_cnxt->block_sz, dev->ar->mbox_info.htc_addr); dev->htc_cnxt->block_sz, dev->ar->mbox_info.htc_addr);
/* usb doesn't support enabling interrupts */
/* FIXME: remove check once USB support is implemented */
if (dev->ar->hif_type == ATH6KL_HIF_TYPE_USB)
return 0;
status = ath6kl_hif_disable_intrs(dev); status = ath6kl_hif_disable_intrs(dev);
fail_setup: fail_setup:
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#define MAX_SCATTER_REQ_TRANSFER_SIZE (32 * 1024) #define MAX_SCATTER_REQ_TRANSFER_SIZE (32 * 1024)
#define MANUFACTURER_ID_AR6003_BASE 0x300 #define MANUFACTURER_ID_AR6003_BASE 0x300
#define MANUFACTURER_ID_AR6004_BASE 0x400
/* SDIO manufacturer ID and Codes */ /* SDIO manufacturer ID and Codes */
#define MANUFACTURER_ID_ATH6KL_BASE_MASK 0xFF00 #define MANUFACTURER_ID_ATH6KL_BASE_MASK 0xFF00
#define MANUFACTURER_CODE 0x271 /* Atheros */ #define MANUFACTURER_CODE 0x271 /* Atheros */
...@@ -244,6 +245,10 @@ struct ath6kl_hif_ops { ...@@ -244,6 +245,10 @@ struct ath6kl_hif_ops {
void (*cleanup_scatter)(struct ath6kl *ar); void (*cleanup_scatter)(struct ath6kl *ar);
int (*suspend)(struct ath6kl *ar, struct cfg80211_wowlan *wow); int (*suspend)(struct ath6kl *ar, struct cfg80211_wowlan *wow);
int (*resume)(struct ath6kl *ar); int (*resume)(struct ath6kl *ar);
int (*diag_read32)(struct ath6kl *ar, u32 address, u32 *value);
int (*diag_write32)(struct ath6kl *ar, u32 address, __le32 value);
int (*bmi_read)(struct ath6kl *ar, u8 *buf, u32 len);
int (*bmi_write)(struct ath6kl *ar, u8 *buf, u32 len);
int (*power_on)(struct ath6kl *ar); int (*power_on)(struct ath6kl *ar);
int (*power_off)(struct ath6kl *ar); int (*power_off)(struct ath6kl *ar);
void (*stop)(struct ath6kl *ar); void (*stop)(struct ath6kl *ar);
......
...@@ -2543,6 +2543,12 @@ int ath6kl_htc_wait_target(struct htc_target *target) ...@@ -2543,6 +2543,12 @@ int ath6kl_htc_wait_target(struct htc_target *target)
struct htc_service_connect_resp resp; struct htc_service_connect_resp resp;
int status; int status;
/* FIXME: remove once USB support is implemented */
if (target->dev->ar->hif_type == ATH6KL_HIF_TYPE_USB) {
ath6kl_err("HTC doesn't support USB yet. Patience!\n");
return -EOPNOTSUPP;
}
/* we should be getting 1 control message that the target is ready */ /* we should be getting 1 control message that the target is ready */
packet = htc_wait_for_ctrl_msg(target); packet = htc_wait_for_ctrl_msg(target);
...@@ -2772,7 +2778,9 @@ void ath6kl_htc_cleanup(struct htc_target *target) ...@@ -2772,7 +2778,9 @@ void ath6kl_htc_cleanup(struct htc_target *target)
{ {
struct htc_packet *packet, *tmp_packet; struct htc_packet *packet, *tmp_packet;
ath6kl_hif_cleanup_scatter(target->dev->ar); /* FIXME: remove check once USB support is implemented */
if (target->dev->ar->hif_type != ATH6KL_HIF_TYPE_USB)
ath6kl_hif_cleanup_scatter(target->dev->ar);
list_for_each_entry_safe(packet, tmp_packet, list_for_each_entry_safe(packet, tmp_packet,
&target->free_ctrl_txbuf, list) { &target->free_ctrl_txbuf, list) {
......
...@@ -33,6 +33,80 @@ module_param(debug_mask, uint, 0644); ...@@ -33,6 +33,80 @@ module_param(debug_mask, uint, 0644);
module_param(testmode, uint, 0644); module_param(testmode, uint, 0644);
module_param(suspend_cutpower, bool, 0444); module_param(suspend_cutpower, bool, 0444);
static const struct ath6kl_hw hw_list[] = {
{
.id = AR6003_HW_2_0_VERSION,
.name = "ar6003 hw 2.0",
.dataset_patch_addr = 0x57e884,
.app_load_addr = 0x543180,
.board_ext_data_addr = 0x57e500,
.reserved_ram_size = 6912,
.refclk_hz = 26000000,
.uarttx_pin = 8,
/* hw2.0 needs override address hardcoded */
.app_start_override_addr = 0x944C00,
.fw_otp = AR6003_HW_2_0_OTP_FILE,
.fw = AR6003_HW_2_0_FIRMWARE_FILE,
.fw_tcmd = AR6003_HW_2_0_TCMD_FIRMWARE_FILE,
.fw_patch = AR6003_HW_2_0_PATCH_FILE,
.fw_api2 = AR6003_HW_2_0_FIRMWARE_2_FILE,
.fw_board = AR6003_HW_2_0_BOARD_DATA_FILE,
.fw_default_board = AR6003_HW_2_0_DEFAULT_BOARD_DATA_FILE,
},
{
.id = AR6003_HW_2_1_1_VERSION,
.name = "ar6003 hw 2.1.1",
.dataset_patch_addr = 0x57ff74,
.app_load_addr = 0x1234,
.board_ext_data_addr = 0x542330,
.reserved_ram_size = 512,
.refclk_hz = 26000000,
.uarttx_pin = 8,
.fw_otp = AR6003_HW_2_1_1_OTP_FILE,
.fw = AR6003_HW_2_1_1_FIRMWARE_FILE,
.fw_tcmd = AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE,
.fw_patch = AR6003_HW_2_1_1_PATCH_FILE,
.fw_api2 = AR6003_HW_2_1_1_FIRMWARE_2_FILE,
.fw_board = AR6003_HW_2_1_1_BOARD_DATA_FILE,
.fw_default_board = AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE,
},
{
.id = AR6004_HW_1_0_VERSION,
.name = "ar6004 hw 1.0",
.dataset_patch_addr = 0x57e884,
.app_load_addr = 0x1234,
.board_ext_data_addr = 0x437000,
.reserved_ram_size = 19456,
.board_addr = 0x433900,
.refclk_hz = 26000000,
.uarttx_pin = 11,
.fw = AR6004_HW_1_0_FIRMWARE_FILE,
.fw_api2 = AR6004_HW_1_0_FIRMWARE_2_FILE,
.fw_board = AR6004_HW_1_0_BOARD_DATA_FILE,
.fw_default_board = AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE,
},
{
.id = AR6004_HW_1_1_VERSION,
.name = "ar6004 hw 1.1",
.dataset_patch_addr = 0x57e884,
.app_load_addr = 0x1234,
.board_ext_data_addr = 0x437000,
.reserved_ram_size = 11264,
.board_addr = 0x43d400,
.refclk_hz = 40000000,
.uarttx_pin = 11,
.fw = AR6004_HW_1_1_FIRMWARE_FILE,
.fw_api2 = AR6004_HW_1_1_FIRMWARE_2_FILE,
.fw_board = AR6004_HW_1_1_BOARD_DATA_FILE,
.fw_default_board = AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE,
},
};
/* /*
* Include definitions here that can be used to tune the WLAN module * Include definitions here that can be used to tune the WLAN module
* behavior. Different customers can tune the behavior as per their needs, * behavior. Different customers can tune the behavior as per their needs,
...@@ -58,7 +132,6 @@ module_param(suspend_cutpower, bool, 0444); ...@@ -58,7 +132,6 @@ module_param(suspend_cutpower, bool, 0444);
*/ */
#define WLAN_CONFIG_DISCONNECT_TIMEOUT 10 #define WLAN_CONFIG_DISCONNECT_TIMEOUT 10
#define CONFIG_AR600x_DEBUG_UART_TX_PIN 8
#define ATH6KL_DATA_OFFSET 64 #define ATH6KL_DATA_OFFSET 64
struct sk_buff *ath6kl_buf_alloc(int size) struct sk_buff *ath6kl_buf_alloc(int size)
...@@ -348,11 +421,7 @@ static int ath6kl_target_config_wlan_params(struct ath6kl *ar, int idx) ...@@ -348,11 +421,7 @@ static int ath6kl_target_config_wlan_params(struct ath6kl *ar, int idx)
status = -EIO; status = -EIO;
} }
/* if (ar->p2p && (ar->vif_max == 1 || idx)) {
* FIXME: Make sure p2p configurations are not applied to
* non-p2p capable interfaces when multivif support is enabled.
*/
if (ar->p2p) {
ret = ath6kl_wmi_info_req_cmd(ar->wmi, idx, ret = ath6kl_wmi_info_req_cmd(ar->wmi, idx,
P2P_FLAG_CAPABILITIES_REQ | P2P_FLAG_CAPABILITIES_REQ |
P2P_FLAG_MACADDR_REQ | P2P_FLAG_MACADDR_REQ |
...@@ -365,11 +434,7 @@ static int ath6kl_target_config_wlan_params(struct ath6kl *ar, int idx) ...@@ -365,11 +434,7 @@ static int ath6kl_target_config_wlan_params(struct ath6kl *ar, int idx)
} }
} }
/* if (ar->p2p && (ar->vif_max == 1 || idx)) {
* FIXME: Make sure p2p configurations are not applied to
* non-p2p capable interfaces when multivif support is enabled.
*/
if (ar->p2p) {
/* Enable Probe Request reporting for P2P */ /* Enable Probe Request reporting for P2P */
ret = ath6kl_wmi_probe_report_req_cmd(ar->wmi, idx, true); ret = ath6kl_wmi_probe_report_req_cmd(ar->wmi, idx, true);
if (ret) { if (ret) {
...@@ -385,7 +450,7 @@ int ath6kl_configure_target(struct ath6kl *ar) ...@@ -385,7 +450,7 @@ int ath6kl_configure_target(struct ath6kl *ar)
{ {
u32 param, ram_reserved_size; u32 param, ram_reserved_size;
u8 fw_iftype, fw_mode = 0, fw_submode = 0; u8 fw_iftype, fw_mode = 0, fw_submode = 0;
int i; int i, status;
/* /*
* Note: Even though the firmware interface type is * Note: Even though the firmware interface type is
...@@ -397,7 +462,7 @@ int ath6kl_configure_target(struct ath6kl *ar) ...@@ -397,7 +462,7 @@ int ath6kl_configure_target(struct ath6kl *ar)
*/ */
fw_iftype = HI_OPTION_FW_MODE_BSS_STA; fw_iftype = HI_OPTION_FW_MODE_BSS_STA;
for (i = 0; i < MAX_NUM_VIF; i++) for (i = 0; i < ar->vif_max; i++)
fw_mode |= fw_iftype << (i * HI_OPTION_FW_MODE_BITS); fw_mode |= fw_iftype << (i * HI_OPTION_FW_MODE_BITS);
/* /*
...@@ -411,15 +476,11 @@ int ath6kl_configure_target(struct ath6kl *ar) ...@@ -411,15 +476,11 @@ int ath6kl_configure_target(struct ath6kl *ar)
fw_submode |= HI_OPTION_FW_SUBMODE_NONE << fw_submode |= HI_OPTION_FW_SUBMODE_NONE <<
(i * HI_OPTION_FW_SUBMODE_BITS); (i * HI_OPTION_FW_SUBMODE_BITS);
for (i = ar->max_norm_iface; i < MAX_NUM_VIF; i++) for (i = ar->max_norm_iface; i < ar->vif_max; i++)
fw_submode |= HI_OPTION_FW_SUBMODE_P2PDEV << fw_submode |= HI_OPTION_FW_SUBMODE_P2PDEV <<
(i * HI_OPTION_FW_SUBMODE_BITS); (i * HI_OPTION_FW_SUBMODE_BITS);
/* if (ar->p2p && ar->vif_max == 1)
* FIXME: This needs to be removed once the multivif
* support is enabled.
*/
if (ar->p2p)
fw_submode = HI_OPTION_FW_SUBMODE_P2PDEV; fw_submode = HI_OPTION_FW_SUBMODE_P2PDEV;
param = HTC_PROTOCOL_VERSION; param = HTC_PROTOCOL_VERSION;
...@@ -442,7 +503,7 @@ int ath6kl_configure_target(struct ath6kl *ar) ...@@ -442,7 +503,7 @@ int ath6kl_configure_target(struct ath6kl *ar)
return -EIO; return -EIO;
} }
param |= (MAX_NUM_VIF << HI_OPTION_NUM_DEV_SHIFT); param |= (ar->vif_max << HI_OPTION_NUM_DEV_SHIFT);
param |= fw_mode << HI_OPTION_FW_MODE_SHIFT; param |= fw_mode << HI_OPTION_FW_MODE_SHIFT;
param |= fw_submode << HI_OPTION_FW_SUBMODE_SHIFT; param |= fw_submode << HI_OPTION_FW_SUBMODE_SHIFT;
...@@ -491,6 +552,24 @@ int ath6kl_configure_target(struct ath6kl *ar) ...@@ -491,6 +552,24 @@ int ath6kl_configure_target(struct ath6kl *ar)
/* use default number of control buffers */ /* use default number of control buffers */
return -EIO; return -EIO;
/* Configure GPIO AR600x UART */
param = ar->hw.uarttx_pin;
status = ath6kl_bmi_write(ar,
ath6kl_get_hi_item_addr(ar,
HI_ITEM(hi_dbg_uart_txpin)),
(u8 *)&param, 4);
if (status)
return status;
/* Configure target refclk_hz */
param = ar->hw.refclk_hz;
status = ath6kl_bmi_write(ar,
ath6kl_get_hi_item_addr(ar,
HI_ITEM(hi_refclk_hz)),
(u8 *)&param, 4);
if (status)
return status;
return 0; return 0;
} }
...@@ -550,11 +629,11 @@ static int ath6kl_get_fw(struct ath6kl *ar, const char *filename, ...@@ -550,11 +629,11 @@ static int ath6kl_get_fw(struct ath6kl *ar, const char *filename,
static const char *get_target_ver_dir(const struct ath6kl *ar) static const char *get_target_ver_dir(const struct ath6kl *ar)
{ {
switch (ar->version.target_ver) { switch (ar->version.target_ver) {
case AR6003_REV1_VERSION: case AR6003_HW_1_0_VERSION:
return "ath6k/AR6003/hw1.0"; return "ath6k/AR6003/hw1.0";
case AR6003_REV2_VERSION: case AR6003_HW_2_0_VERSION:
return "ath6k/AR6003/hw2.0"; return "ath6k/AR6003/hw2.0";
case AR6003_REV3_VERSION: case AR6003_HW_2_1_1_VERSION:
return "ath6k/AR6003/hw2.1.1"; return "ath6k/AR6003/hw2.1.1";
} }
ath6kl_warn("%s: unsupported target version 0x%x.\n", __func__, ath6kl_warn("%s: unsupported target version 0x%x.\n", __func__,
...@@ -612,17 +691,10 @@ static int ath6kl_fetch_board_file(struct ath6kl *ar) ...@@ -612,17 +691,10 @@ static int ath6kl_fetch_board_file(struct ath6kl *ar)
if (ar->fw_board != NULL) if (ar->fw_board != NULL)
return 0; return 0;
switch (ar->version.target_ver) { if (WARN_ON(ar->hw.fw_board == NULL))
case AR6003_REV2_VERSION: return -EINVAL;
filename = AR6003_REV2_BOARD_DATA_FILE;
break; filename = ar->hw.fw_board;
case AR6004_REV1_VERSION:
filename = AR6004_REV1_BOARD_DATA_FILE;
break;
default:
filename = AR6003_REV3_BOARD_DATA_FILE;
break;
}
ret = ath6kl_get_fw(ar, filename, &ar->fw_board, ret = ath6kl_get_fw(ar, filename, &ar->fw_board,
&ar->fw_board_len); &ar->fw_board_len);
...@@ -640,17 +712,7 @@ static int ath6kl_fetch_board_file(struct ath6kl *ar) ...@@ -640,17 +712,7 @@ static int ath6kl_fetch_board_file(struct ath6kl *ar)
ath6kl_warn("Failed to get board file %s (%d), trying to find default board file.\n", ath6kl_warn("Failed to get board file %s (%d), trying to find default board file.\n",
filename, ret); filename, ret);
switch (ar->version.target_ver) { filename = ar->hw.fw_default_board;
case AR6003_REV2_VERSION:
filename = AR6003_REV2_DEFAULT_BOARD_DATA_FILE;
break;
case AR6004_REV1_VERSION:
filename = AR6004_REV1_DEFAULT_BOARD_DATA_FILE;
break;
default:
filename = AR6003_REV3_DEFAULT_BOARD_DATA_FILE;
break;
}
ret = ath6kl_get_fw(ar, filename, &ar->fw_board, ret = ath6kl_get_fw(ar, filename, &ar->fw_board,
&ar->fw_board_len); &ar->fw_board_len);
...@@ -674,19 +736,14 @@ static int ath6kl_fetch_otp_file(struct ath6kl *ar) ...@@ -674,19 +736,14 @@ static int ath6kl_fetch_otp_file(struct ath6kl *ar)
if (ar->fw_otp != NULL) if (ar->fw_otp != NULL)
return 0; return 0;
switch (ar->version.target_ver) { if (ar->hw.fw_otp == NULL) {
case AR6003_REV2_VERSION: ath6kl_dbg(ATH6KL_DBG_BOOT,
filename = AR6003_REV2_OTP_FILE; "no OTP file configured for this hw\n");
break;
case AR6004_REV1_VERSION:
ath6kl_dbg(ATH6KL_DBG_TRC, "AR6004 doesn't need OTP file\n");
return 0; return 0;
break;
default:
filename = AR6003_REV3_OTP_FILE;
break;
} }
filename = ar->hw.fw_otp;
ret = ath6kl_get_fw(ar, filename, &ar->fw_otp, ret = ath6kl_get_fw(ar, filename, &ar->fw_otp,
&ar->fw_otp_len); &ar->fw_otp_len);
if (ret) { if (ret) {
...@@ -707,38 +764,22 @@ static int ath6kl_fetch_fw_file(struct ath6kl *ar) ...@@ -707,38 +764,22 @@ static int ath6kl_fetch_fw_file(struct ath6kl *ar)
return 0; return 0;
if (testmode) { if (testmode) {
switch (ar->version.target_ver) { if (ar->hw.fw_tcmd == NULL) {
case AR6003_REV2_VERSION: ath6kl_warn("testmode not supported\n");
filename = AR6003_REV2_TCMD_FIRMWARE_FILE;
break;
case AR6003_REV3_VERSION:
filename = AR6003_REV3_TCMD_FIRMWARE_FILE;
break;
case AR6004_REV1_VERSION:
ath6kl_warn("testmode not supported with ar6004\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
default:
ath6kl_warn("unknown target version: 0x%x\n",
ar->version.target_ver);
return -EINVAL;
} }
filename = ar->hw.fw_tcmd;
set_bit(TESTMODE, &ar->flag); set_bit(TESTMODE, &ar->flag);
goto get_fw; goto get_fw;
} }
switch (ar->version.target_ver) { if (WARN_ON(ar->hw.fw == NULL))
case AR6003_REV2_VERSION: return -EINVAL;
filename = AR6003_REV2_FIRMWARE_FILE;
break; filename = ar->hw.fw;
case AR6004_REV1_VERSION:
filename = AR6004_REV1_FIRMWARE_FILE;
break;
default:
filename = AR6003_REV3_FIRMWARE_FILE;
break;
}
get_fw: get_fw:
ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len); ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len);
...@@ -756,27 +797,20 @@ static int ath6kl_fetch_patch_file(struct ath6kl *ar) ...@@ -756,27 +797,20 @@ static int ath6kl_fetch_patch_file(struct ath6kl *ar)
const char *filename; const char *filename;
int ret; int ret;
switch (ar->version.target_ver) { if (ar->fw_patch != NULL)
case AR6003_REV2_VERSION:
filename = AR6003_REV2_PATCH_FILE;
break;
case AR6004_REV1_VERSION:
/* FIXME: implement for AR6004 */
return 0; return 0;
break;
default:
filename = AR6003_REV3_PATCH_FILE;
break;
}
if (ar->fw_patch == NULL) { if (ar->hw.fw_patch == NULL)
ret = ath6kl_get_fw(ar, filename, &ar->fw_patch, return 0;
&ar->fw_patch_len);
if (ret) { filename = ar->hw.fw_patch;
ath6kl_err("Failed to get patch file %s: %d\n",
filename, ret); ret = ath6kl_get_fw(ar, filename, &ar->fw_patch,
return ret; &ar->fw_patch_len);
} if (ret) {
ath6kl_err("Failed to get patch file %s: %d\n",
filename, ret);
return ret;
} }
return 0; return 0;
...@@ -811,19 +845,10 @@ static int ath6kl_fetch_fw_api2(struct ath6kl *ar) ...@@ -811,19 +845,10 @@ static int ath6kl_fetch_fw_api2(struct ath6kl *ar)
int ret, ie_id, i, index, bit; int ret, ie_id, i, index, bit;
__le32 *val; __le32 *val;
switch (ar->version.target_ver) { if (ar->hw.fw_api2 == NULL)
case AR6003_REV2_VERSION:
filename = AR6003_REV2_FIRMWARE_2_FILE;
break;
case AR6003_REV3_VERSION:
filename = AR6003_REV3_FIRMWARE_2_FILE;
break;
case AR6004_REV1_VERSION:
filename = AR6004_REV1_FIRMWARE_2_FILE;
break;
default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
}
filename = ar->hw.fw_api2;
ret = request_firmware(&fw, filename, ar->dev); ret = request_firmware(&fw, filename, ar->dev);
if (ret) if (ret)
...@@ -913,12 +938,15 @@ static int ath6kl_fetch_fw_api2(struct ath6kl *ar) ...@@ -913,12 +938,15 @@ static int ath6kl_fetch_fw_api2(struct ath6kl *ar)
ar->hw.reserved_ram_size); ar->hw.reserved_ram_size);
break; break;
case ATH6KL_FW_IE_CAPABILITIES: case ATH6KL_FW_IE_CAPABILITIES:
if (ie_len < DIV_ROUND_UP(ATH6KL_FW_CAPABILITY_MAX, 8))
break;
ath6kl_dbg(ATH6KL_DBG_BOOT, ath6kl_dbg(ATH6KL_DBG_BOOT,
"found firmware capabilities ie (%zd B)\n", "found firmware capabilities ie (%zd B)\n",
ie_len); ie_len);
for (i = 0; i < ATH6KL_FW_CAPABILITY_MAX; i++) { for (i = 0; i < ATH6KL_FW_CAPABILITY_MAX; i++) {
index = ALIGN(i, 8) / 8; index = i / 8;
bit = i % 8; bit = i % 8;
if (data[index] & (1 << bit)) if (data[index] & (1 << bit))
...@@ -937,9 +965,34 @@ static int ath6kl_fetch_fw_api2(struct ath6kl *ar) ...@@ -937,9 +965,34 @@ static int ath6kl_fetch_fw_api2(struct ath6kl *ar)
ar->hw.dataset_patch_addr = le32_to_cpup(val); ar->hw.dataset_patch_addr = le32_to_cpup(val);
ath6kl_dbg(ATH6KL_DBG_BOOT, ath6kl_dbg(ATH6KL_DBG_BOOT,
"found patch address ie 0x%d\n", "found patch address ie 0x%x\n",
ar->hw.dataset_patch_addr); ar->hw.dataset_patch_addr);
break; break;
case ATH6KL_FW_IE_BOARD_ADDR:
if (ie_len != sizeof(*val))
break;
val = (__le32 *) data;
ar->hw.board_addr = le32_to_cpup(val);
ath6kl_dbg(ATH6KL_DBG_BOOT,
"found board address ie 0x%x\n",
ar->hw.board_addr);
break;
case ATH6KL_FW_IE_VIF_MAX:
if (ie_len != sizeof(*val))
break;
val = (__le32 *) data;
ar->vif_max = min_t(unsigned int, le32_to_cpup(val),
ATH6KL_VIF_MAX);
if (ar->vif_max > 1 && !ar->p2p)
ar->max_norm_iface = 2;
ath6kl_dbg(ATH6KL_DBG_BOOT,
"found vif max ie %d\n", ar->vif_max);
break;
default: default:
ath6kl_dbg(ATH6KL_DBG_BOOT, "Unknown fw ie: %u\n", ath6kl_dbg(ATH6KL_DBG_BOOT, "Unknown fw ie: %u\n",
le32_to_cpup(&hdr->id)); le32_to_cpup(&hdr->id));
...@@ -994,8 +1047,8 @@ static int ath6kl_upload_board_file(struct ath6kl *ar) ...@@ -994,8 +1047,8 @@ static int ath6kl_upload_board_file(struct ath6kl *ar)
* For AR6004, host determine Target RAM address for * For AR6004, host determine Target RAM address for
* writing board data. * writing board data.
*/ */
if (ar->target_type == TARGET_TYPE_AR6004) { if (ar->hw.board_addr != 0) {
board_address = AR6004_REV1_BOARD_DATA_ADDRESS; board_address = ar->hw.board_addr;
ath6kl_bmi_write(ar, ath6kl_bmi_write(ar,
ath6kl_get_hi_item_addr(ar, ath6kl_get_hi_item_addr(ar,
HI_ITEM(hi_board_data)), HI_ITEM(hi_board_data)),
...@@ -1013,7 +1066,8 @@ static int ath6kl_upload_board_file(struct ath6kl *ar) ...@@ -1013,7 +1066,8 @@ static int ath6kl_upload_board_file(struct ath6kl *ar)
HI_ITEM(hi_board_ext_data)), HI_ITEM(hi_board_ext_data)),
(u8 *) &board_ext_address, 4); (u8 *) &board_ext_address, 4);
if (board_ext_address == 0) { if (ar->target_type == TARGET_TYPE_AR6003 &&
board_ext_address == 0) {
ath6kl_err("Failed to get board file target address.\n"); ath6kl_err("Failed to get board file target address.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1033,8 +1087,8 @@ static int ath6kl_upload_board_file(struct ath6kl *ar) ...@@ -1033,8 +1087,8 @@ static int ath6kl_upload_board_file(struct ath6kl *ar)
break; break;
} }
if (ar->fw_board_len == (board_data_size + if (board_ext_address &&
board_ext_data_size)) { ar->fw_board_len == (board_data_size + board_ext_data_size)) {
/* write extended board data */ /* write extended board data */
ath6kl_dbg(ATH6KL_DBG_BOOT, ath6kl_dbg(ATH6KL_DBG_BOOT,
...@@ -1092,8 +1146,8 @@ static int ath6kl_upload_otp(struct ath6kl *ar) ...@@ -1092,8 +1146,8 @@ static int ath6kl_upload_otp(struct ath6kl *ar)
bool from_hw = false; bool from_hw = false;
int ret; int ret;
if (WARN_ON(ar->fw_otp == NULL)) if (ar->fw_otp == NULL)
return -ENOENT; return 0;
address = ar->hw.app_load_addr; address = ar->hw.app_load_addr;
...@@ -1142,7 +1196,7 @@ static int ath6kl_upload_firmware(struct ath6kl *ar) ...@@ -1142,7 +1196,7 @@ static int ath6kl_upload_firmware(struct ath6kl *ar)
int ret; int ret;
if (WARN_ON(ar->fw == NULL)) if (WARN_ON(ar->fw == NULL))
return -ENOENT; return 0;
address = ar->hw.app_load_addr; address = ar->hw.app_load_addr;
...@@ -1172,8 +1226,8 @@ static int ath6kl_upload_patch(struct ath6kl *ar) ...@@ -1172,8 +1226,8 @@ static int ath6kl_upload_patch(struct ath6kl *ar)
u32 address, param; u32 address, param;
int ret; int ret;
if (WARN_ON(ar->fw_patch == NULL)) if (ar->fw_patch == NULL)
return -ENOENT; return 0;
address = ar->hw.dataset_patch_addr; address = ar->hw.dataset_patch_addr;
...@@ -1258,7 +1312,7 @@ static int ath6kl_init_upload(struct ath6kl *ar) ...@@ -1258,7 +1312,7 @@ static int ath6kl_init_upload(struct ath6kl *ar)
return status; return status;
/* WAR to avoid SDIO CRC err */ /* WAR to avoid SDIO CRC err */
if (ar->version.target_ver == AR6003_REV2_VERSION) { if (ar->version.target_ver == AR6003_HW_2_0_VERSION) {
ath6kl_err("temporary war to avoid sdio crc error\n"); ath6kl_err("temporary war to avoid sdio crc error\n");
param = 0x20; param = 0x20;
...@@ -1315,47 +1369,29 @@ static int ath6kl_init_upload(struct ath6kl *ar) ...@@ -1315,47 +1369,29 @@ static int ath6kl_init_upload(struct ath6kl *ar)
if (status) if (status)
return status; return status;
/* Configure GPIO AR6003 UART */
param = CONFIG_AR600x_DEBUG_UART_TX_PIN;
status = ath6kl_bmi_write(ar,
ath6kl_get_hi_item_addr(ar,
HI_ITEM(hi_dbg_uart_txpin)),
(u8 *)&param, 4);
return status; return status;
} }
static int ath6kl_init_hw_params(struct ath6kl *ar) static int ath6kl_init_hw_params(struct ath6kl *ar)
{ {
switch (ar->version.target_ver) { const struct ath6kl_hw *hw;
case AR6003_REV2_VERSION: int i;
ar->hw.dataset_patch_addr = AR6003_REV2_DATASET_PATCH_ADDRESS;
ar->hw.app_load_addr = AR6003_REV2_APP_LOAD_ADDRESS;
ar->hw.board_ext_data_addr = AR6003_REV2_BOARD_EXT_DATA_ADDRESS;
ar->hw.reserved_ram_size = AR6003_REV2_RAM_RESERVE_SIZE;
/* hw2.0 needs override address hardcoded */ for (i = 0; i < ARRAY_SIZE(hw_list); i++) {
ar->hw.app_start_override_addr = 0x944C00; hw = &hw_list[i];
break; if (hw->id == ar->version.target_ver)
case AR6003_REV3_VERSION: break;
ar->hw.dataset_patch_addr = AR6003_REV3_DATASET_PATCH_ADDRESS; }
ar->hw.app_load_addr = 0x1234;
ar->hw.board_ext_data_addr = AR6003_REV3_BOARD_EXT_DATA_ADDRESS; if (i == ARRAY_SIZE(hw_list)) {
ar->hw.reserved_ram_size = AR6003_REV3_RAM_RESERVE_SIZE;
break;
case AR6004_REV1_VERSION:
ar->hw.dataset_patch_addr = AR6003_REV2_DATASET_PATCH_ADDRESS;
ar->hw.app_load_addr = AR6003_REV3_APP_LOAD_ADDRESS;
ar->hw.board_ext_data_addr = AR6004_REV1_BOARD_EXT_DATA_ADDRESS;
ar->hw.reserved_ram_size = AR6004_REV1_RAM_RESERVE_SIZE;
break;
default:
ath6kl_err("Unsupported hardware version: 0x%x\n", ath6kl_err("Unsupported hardware version: 0x%x\n",
ar->version.target_ver); ar->version.target_ver);
return -EINVAL; return -EINVAL;
} }
ar->hw = *hw;
ath6kl_dbg(ATH6KL_DBG_BOOT, ath6kl_dbg(ATH6KL_DBG_BOOT,
"target_ver 0x%x target_type 0x%x dataset_patch 0x%x app_load_addr 0x%x\n", "target_ver 0x%x target_type 0x%x dataset_patch 0x%x app_load_addr 0x%x\n",
ar->version.target_ver, ar->target_type, ar->version.target_ver, ar->target_type,
...@@ -1364,10 +1400,25 @@ static int ath6kl_init_hw_params(struct ath6kl *ar) ...@@ -1364,10 +1400,25 @@ static int ath6kl_init_hw_params(struct ath6kl *ar)
"app_start_override_addr 0x%x board_ext_data_addr 0x%x reserved_ram_size 0x%x", "app_start_override_addr 0x%x board_ext_data_addr 0x%x reserved_ram_size 0x%x",
ar->hw.app_start_override_addr, ar->hw.board_ext_data_addr, ar->hw.app_start_override_addr, ar->hw.board_ext_data_addr,
ar->hw.reserved_ram_size); ar->hw.reserved_ram_size);
ath6kl_dbg(ATH6KL_DBG_BOOT,
"refclk_hz %d uarttx_pin %d",
ar->hw.refclk_hz, ar->hw.uarttx_pin);
return 0; return 0;
} }
static const char *ath6kl_init_get_hif_name(enum ath6kl_hif_type type)
{
switch (type) {
case ATH6KL_HIF_TYPE_SDIO:
return "sdio";
case ATH6KL_HIF_TYPE_USB:
return "usb";
}
return NULL;
}
int ath6kl_init_hw_start(struct ath6kl *ar) int ath6kl_init_hw_start(struct ath6kl *ar)
{ {
long timeleft; long timeleft;
...@@ -1428,6 +1479,15 @@ int ath6kl_init_hw_start(struct ath6kl *ar) ...@@ -1428,6 +1479,15 @@ int ath6kl_init_hw_start(struct ath6kl *ar)
ath6kl_dbg(ATH6KL_DBG_BOOT, "firmware booted\n"); ath6kl_dbg(ATH6KL_DBG_BOOT, "firmware booted\n");
if (test_and_clear_bit(FIRST_BOOT, &ar->flag)) {
ath6kl_info("%s %s fw %s%s\n",
ar->hw.name,
ath6kl_init_get_hif_name(ar->hif_type),
ar->wiphy->fw_version,
test_bit(TESTMODE, &ar->flag) ? " testmode" : "");
}
if (ar->version.abi_ver != ATH6KL_ABI_VERSION) { if (ar->version.abi_ver != ATH6KL_ABI_VERSION) {
ath6kl_err("abi version mismatch: host(0x%x), target(0x%x)\n", ath6kl_err("abi version mismatch: host(0x%x), target(0x%x)\n",
ATH6KL_ABI_VERSION, ar->version.abi_ver); ATH6KL_ABI_VERSION, ar->version.abi_ver);
...@@ -1448,7 +1508,7 @@ int ath6kl_init_hw_start(struct ath6kl *ar) ...@@ -1448,7 +1508,7 @@ int ath6kl_init_hw_start(struct ath6kl *ar)
if ((ath6kl_set_host_app_area(ar)) != 0) if ((ath6kl_set_host_app_area(ar)) != 0)
ath6kl_err("unable to set the host app area\n"); ath6kl_err("unable to set the host app area\n");
for (i = 0; i < MAX_NUM_VIF; i++) { for (i = 0; i < ar->vif_max; i++) {
ret = ath6kl_target_config_wlan_params(ar, i); ret = ath6kl_target_config_wlan_params(ar, i);
if (ret) if (ret)
goto err_htc_stop; goto err_htc_stop;
...@@ -1558,7 +1618,7 @@ int ath6kl_core_init(struct ath6kl *ar) ...@@ -1558,7 +1618,7 @@ int ath6kl_core_init(struct ath6kl *ar)
goto err_node_cleanup; goto err_node_cleanup;
} }
for (i = 0; i < MAX_NUM_VIF; i++) for (i = 0; i < ar->vif_max; i++)
ar->avail_idx_map |= BIT(i); ar->avail_idx_map |= BIT(i);
rtnl_lock(); rtnl_lock();
...@@ -1603,7 +1663,17 @@ int ath6kl_core_init(struct ath6kl *ar) ...@@ -1603,7 +1663,17 @@ int ath6kl_core_init(struct ath6kl *ar)
ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM | ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM |
WIPHY_FLAG_HAVE_AP_SME | WIPHY_FLAG_HAVE_AP_SME |
WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
if (test_bit(ATH6KL_FW_CAPABILITY_SCHED_SCAN, ar->fw_capabilities))
ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
ar->wiphy->probe_resp_offload =
NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS |
NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 |
NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P |
NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U;
set_bit(FIRST_BOOT, &ar->flag); set_bit(FIRST_BOOT, &ar->flag);
......
...@@ -175,64 +175,6 @@ void ath6kl_free_cookie(struct ath6kl *ar, struct ath6kl_cookie *cookie) ...@@ -175,64 +175,6 @@ void ath6kl_free_cookie(struct ath6kl *ar, struct ath6kl_cookie *cookie)
ar->cookie_count++; ar->cookie_count++;
} }
/* set the window address register (using 4-byte register access ). */
static int ath6kl_set_addrwin_reg(struct ath6kl *ar, u32 reg_addr, u32 addr)
{
int status;
s32 i;
__le32 addr_val;
/*
* Write bytes 1,2,3 of the register to set the upper address bytes,
* the LSB is written last to initiate the access cycle
*/
for (i = 1; i <= 3; i++) {
/*
* Fill the buffer with the address byte value we want to
* hit 4 times. No need to worry about endianness as the
* same byte is copied to all four bytes of addr_val at
* any time.
*/
memset((u8 *)&addr_val, ((u8 *)&addr)[i], 4);
/*
* Hit each byte of the register address with a 4-byte
* write operation to the same address, this is a harmless
* operation.
*/
status = hif_read_write_sync(ar, reg_addr + i, (u8 *)&addr_val,
4, HIF_WR_SYNC_BYTE_FIX);
if (status)
break;
}
if (status) {
ath6kl_err("failed to write initial bytes of 0x%x to window reg: 0x%X\n",
addr, reg_addr);
return status;
}
/*
* Write the address register again, this time write the whole
* 4-byte value. The effect here is that the LSB write causes the
* cycle to start, the extra 3 byte write to bytes 1,2,3 has no
* effect since we are writing the same values again
*/
addr_val = cpu_to_le32(addr);
status = hif_read_write_sync(ar, reg_addr,
(u8 *)&(addr_val),
4, HIF_WR_SYNC_BYTE_INC);
if (status) {
ath6kl_err("failed to write 0x%x to window reg: 0x%X\n",
addr, reg_addr);
return status;
}
return 0;
}
/* /*
* Read from the hardware through its diagnostic window. No cooperation * Read from the hardware through its diagnostic window. No cooperation
* from the firmware is required for this. * from the firmware is required for this.
...@@ -241,14 +183,7 @@ int ath6kl_diag_read32(struct ath6kl *ar, u32 address, u32 *value) ...@@ -241,14 +183,7 @@ int ath6kl_diag_read32(struct ath6kl *ar, u32 address, u32 *value)
{ {
int ret; int ret;
/* set window register to start read cycle */ ret = ath6kl_hif_diag_read32(ar, address, value);
ret = ath6kl_set_addrwin_reg(ar, WINDOW_READ_ADDR_ADDRESS, address);
if (ret)
return ret;
/* read the data */
ret = hif_read_write_sync(ar, WINDOW_DATA_ADDRESS, (u8 *) value,
sizeof(*value), HIF_RD_SYNC_BYTE_INC);
if (ret) { if (ret) {
ath6kl_warn("failed to read32 through diagnose window: %d\n", ath6kl_warn("failed to read32 through diagnose window: %d\n",
ret); ret);
...@@ -266,18 +201,15 @@ int ath6kl_diag_write32(struct ath6kl *ar, u32 address, __le32 value) ...@@ -266,18 +201,15 @@ int ath6kl_diag_write32(struct ath6kl *ar, u32 address, __le32 value)
{ {
int ret; int ret;
/* set write data */ ret = ath6kl_hif_diag_write32(ar, address, value);
ret = hif_read_write_sync(ar, WINDOW_DATA_ADDRESS, (u8 *) &value,
sizeof(value), HIF_WR_SYNC_BYTE_INC);
if (ret) { if (ret) {
ath6kl_err("failed to write 0x%x during diagnose window to 0x%d\n", ath6kl_err("failed to write 0x%x during diagnose window to 0x%d\n",
address, value); address, value);
return ret; return ret;
} }
/* set window register, which starts the write cycle */ return 0;
return ath6kl_set_addrwin_reg(ar, WINDOW_WRITE_ADDR_ADDRESS,
address);
} }
int ath6kl_diag_read(struct ath6kl *ar, u32 address, void *data, u32 length) int ath6kl_diag_read(struct ath6kl *ar, u32 address, void *data, u32 length)
...@@ -465,7 +397,9 @@ void ath6kl_connect_ap_mode_bss(struct ath6kl_vif *vif, u16 channel) ...@@ -465,7 +397,9 @@ void ath6kl_connect_ap_mode_bss(struct ath6kl_vif *vif, u16 channel)
case NONE_AUTH: case NONE_AUTH:
if (vif->prwise_crypto == WEP_CRYPT) if (vif->prwise_crypto == WEP_CRYPT)
ath6kl_install_static_wep_keys(vif); ath6kl_install_static_wep_keys(vif);
break; if (!ik->valid || ik->key_type != WAPI_CRYPT)
break;
/* for WAPI, we need to set the delayed group key, continue: */
case WPA_PSK_AUTH: case WPA_PSK_AUTH:
case WPA2_PSK_AUTH: case WPA2_PSK_AUTH:
case (WPA_PSK_AUTH | WPA2_PSK_AUTH): case (WPA_PSK_AUTH | WPA2_PSK_AUTH):
...@@ -534,6 +468,18 @@ void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr, ...@@ -534,6 +468,18 @@ void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr,
wpa_ie = pos; /* WPS IE */ wpa_ie = pos; /* WPS IE */
break; /* overrides WPA/RSN IE */ break; /* overrides WPA/RSN IE */
} }
} else if (pos[0] == 0x44 && wpa_ie == NULL) {
/*
* Note: WAPI Parameter Set IE re-uses Element ID that
* was officially allocated for BSS AC Access Delay. As
* such, we need to be a bit more careful on when
* parsing the frame. However, BSS AC Access Delay
* element is not supposed to be included in
* (Re)Association Request frames, so this should not
* cause problems.
*/
wpa_ie = pos; /* WAPI IE */
break;
} }
pos += 2 + pos[1]; pos += 2 + pos[1];
} }
...@@ -581,20 +527,6 @@ void ath6kl_disconnect(struct ath6kl_vif *vif) ...@@ -581,20 +527,6 @@ void ath6kl_disconnect(struct ath6kl_vif *vif)
/* WMI Event handlers */ /* WMI Event handlers */
static const char *get_hw_id_string(u32 id)
{
switch (id) {
case AR6003_REV1_VERSION:
return "1.0";
case AR6003_REV2_VERSION:
return "2.0";
case AR6003_REV3_VERSION:
return "2.1.1";
default:
return "unknown";
}
}
void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver) void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver)
{ {
struct ath6kl *ar = devt; struct ath6kl *ar = devt;
...@@ -617,13 +549,6 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver) ...@@ -617,13 +549,6 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver)
/* indicate to the waiting thread that the ready event was received */ /* indicate to the waiting thread that the ready event was received */
set_bit(WMI_READY, &ar->flag); set_bit(WMI_READY, &ar->flag);
wake_up(&ar->event_wq); wake_up(&ar->event_wq);
if (test_and_clear_bit(FIRST_BOOT, &ar->flag)) {
ath6kl_info("hw %s fw %s%s\n",
get_hw_id_string(ar->wiphy->hw_version),
ar->wiphy->fw_version,
test_bit(TESTMODE, &ar->flag) ? " testmode" : "");
}
} }
void ath6kl_scan_complete_evt(struct ath6kl_vif *vif, int status) void ath6kl_scan_complete_evt(struct ath6kl_vif *vif, int status)
...@@ -1077,21 +1002,11 @@ static int ath6kl_open(struct net_device *dev) ...@@ -1077,21 +1002,11 @@ static int ath6kl_open(struct net_device *dev)
static int ath6kl_close(struct net_device *dev) static int ath6kl_close(struct net_device *dev)
{ {
struct ath6kl *ar = ath6kl_priv(dev);
struct ath6kl_vif *vif = netdev_priv(dev); struct ath6kl_vif *vif = netdev_priv(dev);
netif_stop_queue(dev); netif_stop_queue(dev);
ath6kl_disconnect(vif); ath6kl_cfg80211_stop(vif);
if (test_bit(WMI_READY, &ar->flag)) {
if (ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, 0xFFFF,
0, 0, 0, 0, 0, 0, 0, 0, 0))
return -EIO;
}
ath6kl_cfg80211_scan_complete_event(vif, true);
clear_bit(WLAN_ENABLED, &vif->flags); clear_bit(WLAN_ENABLED, &vif->flags);
......
...@@ -40,8 +40,12 @@ struct ath6kl_sdio { ...@@ -40,8 +40,12 @@ struct ath6kl_sdio {
struct bus_request bus_req[BUS_REQUEST_MAX_NUM]; struct bus_request bus_req[BUS_REQUEST_MAX_NUM];
struct ath6kl *ar; struct ath6kl *ar;
u8 *dma_buffer; u8 *dma_buffer;
/* protects access to dma_buffer */
struct mutex dma_buffer_mutex;
/* scatter request list head */ /* scatter request list head */
struct list_head scat_req; struct list_head scat_req;
...@@ -396,6 +400,7 @@ static int ath6kl_sdio_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf, ...@@ -396,6 +400,7 @@ static int ath6kl_sdio_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf,
if (buf_needs_bounce(buf)) { if (buf_needs_bounce(buf)) {
if (!ar_sdio->dma_buffer) if (!ar_sdio->dma_buffer)
return -ENOMEM; return -ENOMEM;
mutex_lock(&ar_sdio->dma_buffer_mutex);
tbuf = ar_sdio->dma_buffer; tbuf = ar_sdio->dma_buffer;
memcpy(tbuf, buf, len); memcpy(tbuf, buf, len);
bounced = true; bounced = true;
...@@ -406,6 +411,9 @@ static int ath6kl_sdio_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf, ...@@ -406,6 +411,9 @@ static int ath6kl_sdio_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf,
if ((request & HIF_READ) && bounced) if ((request & HIF_READ) && bounced)
memcpy(buf, tbuf, len); memcpy(buf, tbuf, len);
if (bounced)
mutex_unlock(&ar_sdio->dma_buffer_mutex);
return ret; return ret;
} }
...@@ -799,7 +807,28 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow) ...@@ -799,7 +807,28 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow)
return ret; return ret;
} }
if ((flags & MMC_PM_WAKE_SDIO_IRQ) && wow) { if (!(flags & MMC_PM_WAKE_SDIO_IRQ))
goto deepsleep;
/* sdio irq wakes up host */
if (ar->state == ATH6KL_STATE_SCHED_SCAN) {
ret = ath6kl_cfg80211_suspend(ar,
ATH6KL_CFG_SUSPEND_SCHED_SCAN,
NULL);
if (ret) {
ath6kl_warn("Schedule scan suspend failed: %d", ret);
return ret;
}
ret = sdio_set_host_pm_flags(func, MMC_PM_WAKE_SDIO_IRQ);
if (ret)
ath6kl_warn("set sdio wake irq flag failed: %d\n", ret);
return ret;
}
if (wow) {
/* /*
* The host sdio controller is capable of keep power and * The host sdio controller is capable of keep power and
* sdio irq wake up at this point. It's fine to continue * sdio irq wake up at this point. It's fine to continue
...@@ -816,6 +845,7 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow) ...@@ -816,6 +845,7 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow)
return ret; return ret;
} }
deepsleep:
return ath6kl_cfg80211_suspend(ar, ATH6KL_CFG_SUSPEND_DEEPSLEEP, NULL); return ath6kl_cfg80211_suspend(ar, ATH6KL_CFG_SUSPEND_DEEPSLEEP, NULL);
} }
...@@ -839,6 +869,8 @@ static int ath6kl_sdio_resume(struct ath6kl *ar) ...@@ -839,6 +869,8 @@ static int ath6kl_sdio_resume(struct ath6kl *ar)
case ATH6KL_STATE_WOW: case ATH6KL_STATE_WOW:
break; break;
case ATH6KL_STATE_SCHED_SCAN:
break;
} }
ath6kl_cfg80211_resume(ar); ath6kl_cfg80211_resume(ar);
...@@ -846,6 +878,264 @@ static int ath6kl_sdio_resume(struct ath6kl *ar) ...@@ -846,6 +878,264 @@ static int ath6kl_sdio_resume(struct ath6kl *ar)
return 0; return 0;
} }
/* set the window address register (using 4-byte register access ). */
static int ath6kl_set_addrwin_reg(struct ath6kl *ar, u32 reg_addr, u32 addr)
{
int status;
u8 addr_val[4];
s32 i;
/*
* Write bytes 1,2,3 of the register to set the upper address bytes,
* the LSB is written last to initiate the access cycle
*/
for (i = 1; i <= 3; i++) {
/*
* Fill the buffer with the address byte value we want to
* hit 4 times.
*/
memset(addr_val, ((u8 *)&addr)[i], 4);
/*
* Hit each byte of the register address with a 4-byte
* write operation to the same address, this is a harmless
* operation.
*/
status = ath6kl_sdio_read_write_sync(ar, reg_addr + i, addr_val,
4, HIF_WR_SYNC_BYTE_FIX);
if (status)
break;
}
if (status) {
ath6kl_err("%s: failed to write initial bytes of 0x%x "
"to window reg: 0x%X\n", __func__,
addr, reg_addr);
return status;
}
/*
* Write the address register again, this time write the whole
* 4-byte value. The effect here is that the LSB write causes the
* cycle to start, the extra 3 byte write to bytes 1,2,3 has no
* effect since we are writing the same values again
*/
status = ath6kl_sdio_read_write_sync(ar, reg_addr, (u8 *)(&addr),
4, HIF_WR_SYNC_BYTE_INC);
if (status) {
ath6kl_err("%s: failed to write 0x%x to window reg: 0x%X\n",
__func__, addr, reg_addr);
return status;
}
return 0;
}
static int ath6kl_sdio_diag_read32(struct ath6kl *ar, u32 address, u32 *data)
{
int status;
/* set window register to start read cycle */
status = ath6kl_set_addrwin_reg(ar, WINDOW_READ_ADDR_ADDRESS,
address);
if (status)
return status;
/* read the data */
status = ath6kl_sdio_read_write_sync(ar, WINDOW_DATA_ADDRESS,
(u8 *)data, sizeof(u32), HIF_RD_SYNC_BYTE_INC);
if (status) {
ath6kl_err("%s: failed to read from window data addr\n",
__func__);
return status;
}
return status;
}
static int ath6kl_sdio_diag_write32(struct ath6kl *ar, u32 address,
__le32 data)
{
int status;
u32 val = (__force u32) data;
/* set write data */
status = ath6kl_sdio_read_write_sync(ar, WINDOW_DATA_ADDRESS,
(u8 *) &val, sizeof(u32), HIF_WR_SYNC_BYTE_INC);
if (status) {
ath6kl_err("%s: failed to write 0x%x to window data addr\n",
__func__, data);
return status;
}
/* set window register, which starts the write cycle */
return ath6kl_set_addrwin_reg(ar, WINDOW_WRITE_ADDR_ADDRESS,
address);
}
static int ath6kl_sdio_bmi_credits(struct ath6kl *ar)
{
u32 addr;
unsigned long timeout;
int ret;
ar->bmi.cmd_credits = 0;
/* Read the counter register to get the command credits */
addr = COUNT_DEC_ADDRESS + (HTC_MAILBOX_NUM_MAX + ENDPOINT1) * 4;
timeout = jiffies + msecs_to_jiffies(BMI_COMMUNICATION_TIMEOUT);
while (time_before(jiffies, timeout) && !ar->bmi.cmd_credits) {
/*
* Hit the credit counter with a 4-byte access, the first byte
* read will hit the counter and cause a decrement, while the
* remaining 3 bytes has no effect. The rationale behind this
* is to make all HIF accesses 4-byte aligned.
*/
ret = ath6kl_sdio_read_write_sync(ar, addr,
(u8 *)&ar->bmi.cmd_credits, 4,
HIF_RD_SYNC_BYTE_INC);
if (ret) {
ath6kl_err("Unable to decrement the command credit "
"count register: %d\n", ret);
return ret;
}
/* The counter is only 8 bits.
* Ignore anything in the upper 3 bytes
*/
ar->bmi.cmd_credits &= 0xFF;
}
if (!ar->bmi.cmd_credits) {
ath6kl_err("bmi communication timeout\n");
return -ETIMEDOUT;
}
return 0;
}
static int ath6kl_bmi_get_rx_lkahd(struct ath6kl *ar)
{
unsigned long timeout;
u32 rx_word = 0;
int ret = 0;
timeout = jiffies + msecs_to_jiffies(BMI_COMMUNICATION_TIMEOUT);
while ((time_before(jiffies, timeout)) && !rx_word) {
ret = ath6kl_sdio_read_write_sync(ar,
RX_LOOKAHEAD_VALID_ADDRESS,
(u8 *)&rx_word, sizeof(rx_word),
HIF_RD_SYNC_BYTE_INC);
if (ret) {
ath6kl_err("unable to read RX_LOOKAHEAD_VALID\n");
return ret;
}
/* all we really want is one bit */
rx_word &= (1 << ENDPOINT1);
}
if (!rx_word) {
ath6kl_err("bmi_recv_buf FIFO empty\n");
return -EINVAL;
}
return ret;
}
static int ath6kl_sdio_bmi_write(struct ath6kl *ar, u8 *buf, u32 len)
{
int ret;
u32 addr;
ret = ath6kl_sdio_bmi_credits(ar);
if (ret)
return ret;
addr = ar->mbox_info.htc_addr;
ret = ath6kl_sdio_read_write_sync(ar, addr, buf, len,
HIF_WR_SYNC_BYTE_INC);
if (ret)
ath6kl_err("unable to send the bmi data to the device\n");
return ret;
}
static int ath6kl_sdio_bmi_read(struct ath6kl *ar, u8 *buf, u32 len)
{
int ret;
u32 addr;
/*
* During normal bootup, small reads may be required.
* Rather than issue an HIF Read and then wait as the Target
* adds successive bytes to the FIFO, we wait here until
* we know that response data is available.
*
* This allows us to cleanly timeout on an unexpected
* Target failure rather than risk problems at the HIF level.
* In particular, this avoids SDIO timeouts and possibly garbage
* data on some host controllers. And on an interconnect
* such as Compact Flash (as well as some SDIO masters) which
* does not provide any indication on data timeout, it avoids
* a potential hang or garbage response.
*
* Synchronization is more difficult for reads larger than the
* size of the MBOX FIFO (128B), because the Target is unable
* to push the 129th byte of data until AFTER the Host posts an
* HIF Read and removes some FIFO data. So for large reads the
* Host proceeds to post an HIF Read BEFORE all the data is
* actually available to read. Fortunately, large BMI reads do
* not occur in practice -- they're supported for debug/development.
*
* So Host/Target BMI synchronization is divided into these cases:
* CASE 1: length < 4
* Should not happen
*
* CASE 2: 4 <= length <= 128
* Wait for first 4 bytes to be in FIFO
* If CONSERVATIVE_BMI_READ is enabled, also wait for
* a BMI command credit, which indicates that the ENTIRE
* response is available in the the FIFO
*
* CASE 3: length > 128
* Wait for the first 4 bytes to be in FIFO
*
* For most uses, a small timeout should be sufficient and we will
* usually see a response quickly; but there may be some unusual
* (debug) cases of BMI_EXECUTE where we want an larger timeout.
* For now, we use an unbounded busy loop while waiting for
* BMI_EXECUTE.
*
* If BMI_EXECUTE ever needs to support longer-latency execution,
* especially in production, this code needs to be enhanced to sleep
* and yield. Also note that BMI_COMMUNICATION_TIMEOUT is currently
* a function of Host processor speed.
*/
if (len >= 4) { /* NB: Currently, always true */
ret = ath6kl_bmi_get_rx_lkahd(ar);
if (ret)
return ret;
}
addr = ar->mbox_info.htc_addr;
ret = ath6kl_sdio_read_write_sync(ar, addr, buf, len,
HIF_RD_SYNC_BYTE_INC);
if (ret) {
ath6kl_err("Unable to read the bmi data from the device: %d\n",
ret);
return ret;
}
return 0;
}
static void ath6kl_sdio_stop(struct ath6kl *ar) static void ath6kl_sdio_stop(struct ath6kl *ar)
{ {
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
...@@ -890,6 +1180,10 @@ static const struct ath6kl_hif_ops ath6kl_sdio_ops = { ...@@ -890,6 +1180,10 @@ static const struct ath6kl_hif_ops ath6kl_sdio_ops = {
.cleanup_scatter = ath6kl_sdio_cleanup_scatter, .cleanup_scatter = ath6kl_sdio_cleanup_scatter,
.suspend = ath6kl_sdio_suspend, .suspend = ath6kl_sdio_suspend,
.resume = ath6kl_sdio_resume, .resume = ath6kl_sdio_resume,
.diag_read32 = ath6kl_sdio_diag_read32,
.diag_write32 = ath6kl_sdio_diag_write32,
.bmi_read = ath6kl_sdio_bmi_read,
.bmi_write = ath6kl_sdio_bmi_write,
.power_on = ath6kl_sdio_power_on, .power_on = ath6kl_sdio_power_on,
.power_off = ath6kl_sdio_power_off, .power_off = ath6kl_sdio_power_off,
.stop = ath6kl_sdio_stop, .stop = ath6kl_sdio_stop,
...@@ -958,6 +1252,7 @@ static int ath6kl_sdio_probe(struct sdio_func *func, ...@@ -958,6 +1252,7 @@ static int ath6kl_sdio_probe(struct sdio_func *func,
spin_lock_init(&ar_sdio->lock); spin_lock_init(&ar_sdio->lock);
spin_lock_init(&ar_sdio->scat_lock); spin_lock_init(&ar_sdio->scat_lock);
spin_lock_init(&ar_sdio->wr_async_lock); spin_lock_init(&ar_sdio->wr_async_lock);
mutex_init(&ar_sdio->dma_buffer_mutex);
INIT_LIST_HEAD(&ar_sdio->scat_req); INIT_LIST_HEAD(&ar_sdio->scat_req);
INIT_LIST_HEAD(&ar_sdio->bus_req_freeq); INIT_LIST_HEAD(&ar_sdio->bus_req_freeq);
...@@ -976,8 +1271,10 @@ static int ath6kl_sdio_probe(struct sdio_func *func, ...@@ -976,8 +1271,10 @@ static int ath6kl_sdio_probe(struct sdio_func *func,
} }
ar_sdio->ar = ar; ar_sdio->ar = ar;
ar->hif_type = ATH6KL_HIF_TYPE_SDIO;
ar->hif_priv = ar_sdio; ar->hif_priv = ar_sdio;
ar->hif_ops = &ath6kl_sdio_ops; ar->hif_ops = &ath6kl_sdio_ops;
ar->bmi.max_data_size = 256;
ath6kl_sdio_set_mbox_info(ar); ath6kl_sdio_set_mbox_info(ar);
...@@ -1027,13 +1324,15 @@ static void ath6kl_sdio_remove(struct sdio_func *func) ...@@ -1027,13 +1324,15 @@ static void ath6kl_sdio_remove(struct sdio_func *func)
static const struct sdio_device_id ath6kl_sdio_devices[] = { static const struct sdio_device_id ath6kl_sdio_devices[] = {
{SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x0))}, {SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x0))},
{SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x1))}, {SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x1))},
{SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6004_BASE | 0x0))},
{SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6004_BASE | 0x1))},
{}, {},
}; };
MODULE_DEVICE_TABLE(sdio, ath6kl_sdio_devices); MODULE_DEVICE_TABLE(sdio, ath6kl_sdio_devices);
static struct sdio_driver ath6kl_sdio_driver = { static struct sdio_driver ath6kl_sdio_driver = {
.name = "ath6kl", .name = "ath6kl_sdio",
.id_table = ath6kl_sdio_devices, .id_table = ath6kl_sdio_devices,
.probe = ath6kl_sdio_probe, .probe = ath6kl_sdio_probe,
.remove = ath6kl_sdio_remove, .remove = ath6kl_sdio_remove,
...@@ -1063,13 +1362,19 @@ MODULE_AUTHOR("Atheros Communications, Inc."); ...@@ -1063,13 +1362,19 @@ MODULE_AUTHOR("Atheros Communications, Inc.");
MODULE_DESCRIPTION("Driver support for Atheros AR600x SDIO devices"); MODULE_DESCRIPTION("Driver support for Atheros AR600x SDIO devices");
MODULE_LICENSE("Dual BSD/GPL"); MODULE_LICENSE("Dual BSD/GPL");
MODULE_FIRMWARE(AR6003_REV2_OTP_FILE); MODULE_FIRMWARE(AR6003_HW_2_0_OTP_FILE);
MODULE_FIRMWARE(AR6003_REV2_FIRMWARE_FILE); MODULE_FIRMWARE(AR6003_HW_2_0_FIRMWARE_FILE);
MODULE_FIRMWARE(AR6003_REV2_PATCH_FILE); MODULE_FIRMWARE(AR6003_HW_2_0_PATCH_FILE);
MODULE_FIRMWARE(AR6003_REV2_BOARD_DATA_FILE); MODULE_FIRMWARE(AR6003_HW_2_0_BOARD_DATA_FILE);
MODULE_FIRMWARE(AR6003_REV2_DEFAULT_BOARD_DATA_FILE); MODULE_FIRMWARE(AR6003_HW_2_0_DEFAULT_BOARD_DATA_FILE);
MODULE_FIRMWARE(AR6003_REV3_OTP_FILE); MODULE_FIRMWARE(AR6003_HW_2_1_1_OTP_FILE);
MODULE_FIRMWARE(AR6003_REV3_FIRMWARE_FILE); MODULE_FIRMWARE(AR6003_HW_2_1_1_FIRMWARE_FILE);
MODULE_FIRMWARE(AR6003_REV3_PATCH_FILE); MODULE_FIRMWARE(AR6003_HW_2_1_1_PATCH_FILE);
MODULE_FIRMWARE(AR6003_REV3_BOARD_DATA_FILE); MODULE_FIRMWARE(AR6003_HW_2_1_1_BOARD_DATA_FILE);
MODULE_FIRMWARE(AR6003_REV3_DEFAULT_BOARD_DATA_FILE); MODULE_FIRMWARE(AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE);
MODULE_FIRMWARE(AR6004_HW_1_0_FIRMWARE_FILE);
MODULE_FIRMWARE(AR6004_HW_1_0_BOARD_DATA_FILE);
MODULE_FIRMWARE(AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE);
MODULE_FIRMWARE(AR6004_HW_1_1_FIRMWARE_FILE);
MODULE_FIRMWARE(AR6004_HW_1_1_BOARD_DATA_FILE);
MODULE_FIRMWARE(AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE);
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#define AR6003_BOARD_DATA_SZ 1024 #define AR6003_BOARD_DATA_SZ 1024
#define AR6003_BOARD_EXT_DATA_SZ 768 #define AR6003_BOARD_EXT_DATA_SZ 768
#define AR6004_BOARD_DATA_SZ 7168 #define AR6004_BOARD_DATA_SZ 6144
#define AR6004_BOARD_EXT_DATA_SZ 0 #define AR6004_BOARD_EXT_DATA_SZ 0
#define RESET_CONTROL_ADDRESS 0x00000000 #define RESET_CONTROL_ADDRESS 0x00000000
...@@ -334,20 +334,6 @@ struct host_interest { ...@@ -334,20 +334,6 @@ struct host_interest {
(((target_type) == TARGET_TYPE_AR6003) ? AR6003_VTOP(vaddr) : \ (((target_type) == TARGET_TYPE_AR6003) ? AR6003_VTOP(vaddr) : \
(((target_type) == TARGET_TYPE_AR6004) ? AR6004_VTOP(vaddr) : 0)) (((target_type) == TARGET_TYPE_AR6004) ? AR6004_VTOP(vaddr) : 0))
#define AR6003_REV2_APP_LOAD_ADDRESS 0x543180
#define AR6003_REV2_BOARD_EXT_DATA_ADDRESS 0x57E500
#define AR6003_REV2_DATASET_PATCH_ADDRESS 0x57e884
#define AR6003_REV2_RAM_RESERVE_SIZE 6912
#define AR6003_REV3_APP_LOAD_ADDRESS 0x545000
#define AR6003_REV3_BOARD_EXT_DATA_ADDRESS 0x542330
#define AR6003_REV3_DATASET_PATCH_ADDRESS 0x57FF74
#define AR6003_REV3_RAM_RESERVE_SIZE 512
#define AR6004_REV1_BOARD_DATA_ADDRESS 0x435400
#define AR6004_REV1_BOARD_EXT_DATA_ADDRESS 0x437000
#define AR6004_REV1_RAM_RESERVE_SIZE 11264
#define ATH6KL_FWLOG_PAYLOAD_SIZE 1500 #define ATH6KL_FWLOG_PAYLOAD_SIZE 1500
struct ath6kl_dbglog_buf { struct ath6kl_dbglog_buf {
......
...@@ -453,11 +453,11 @@ enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target, ...@@ -453,11 +453,11 @@ enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target,
set_bit(WMI_CTRL_EP_FULL, &ar->flag); set_bit(WMI_CTRL_EP_FULL, &ar->flag);
spin_unlock_bh(&ar->lock); spin_unlock_bh(&ar->lock);
ath6kl_err("wmi ctrl ep is full\n"); ath6kl_err("wmi ctrl ep is full\n");
goto stop_adhoc_netq; return action;
} }
if (packet->info.tx.tag == ATH6KL_CONTROL_PKT_TAG) if (packet->info.tx.tag == ATH6KL_CONTROL_PKT_TAG)
goto stop_adhoc_netq; return action;
/* /*
* The last MAX_HI_COOKIE_NUM "batch" of cookies are reserved for * The last MAX_HI_COOKIE_NUM "batch" of cookies are reserved for
...@@ -465,20 +465,18 @@ enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target, ...@@ -465,20 +465,18 @@ enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target,
*/ */
if (ar->ac_stream_pri_map[ar->ep2ac_map[endpoint]] < if (ar->ac_stream_pri_map[ar->ep2ac_map[endpoint]] <
ar->hiac_stream_active_pri && ar->hiac_stream_active_pri &&
ar->cookie_count <= MAX_HI_COOKIE_NUM) { ar->cookie_count <= MAX_HI_COOKIE_NUM)
/* /*
* Give preference to the highest priority stream by * Give preference to the highest priority stream by
* dropping the packets which overflowed. * dropping the packets which overflowed.
*/ */
action = HTC_SEND_FULL_DROP; action = HTC_SEND_FULL_DROP;
goto stop_adhoc_netq;
}
stop_adhoc_netq:
/* FIXME: Locking */ /* FIXME: Locking */
spin_lock_bh(&ar->list_lock); spin_lock_bh(&ar->list_lock);
list_for_each_entry(vif, &ar->vif_list, list) { list_for_each_entry(vif, &ar->vif_list, list) {
if (vif->nw_type == ADHOC_NETWORK) { if (vif->nw_type == ADHOC_NETWORK ||
action != HTC_SEND_FULL_DROP) {
spin_unlock_bh(&ar->list_lock); spin_unlock_bh(&ar->list_lock);
spin_lock_bh(&vif->if_lock); spin_lock_bh(&vif->if_lock);
...@@ -543,7 +541,7 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue) ...@@ -543,7 +541,7 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue)
int status; int status;
enum htc_endpoint_id eid; enum htc_endpoint_id eid;
bool wake_event = false; bool wake_event = false;
bool flushing[MAX_NUM_VIF] = {false}; bool flushing[ATH6KL_VIF_MAX] = {false};
u8 if_idx; u8 if_idx;
struct ath6kl_vif *vif; struct ath6kl_vif *vif;
...@@ -571,8 +569,6 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue) ...@@ -571,8 +569,6 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue)
if (!skb || !skb->data) if (!skb || !skb->data)
goto fatal; goto fatal;
packet->buf = skb->data;
__skb_queue_tail(&skb_queue, skb); __skb_queue_tail(&skb_queue, skb);
if (!status && (packet->act_len != skb->len)) if (!status && (packet->act_len != skb->len))
...@@ -593,10 +589,10 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue) ...@@ -593,10 +589,10 @@ void ath6kl_tx_complete(void *context, struct list_head *packet_queue)
if (eid == ar->ctrl_ep) { if (eid == ar->ctrl_ep) {
if_idx = wmi_cmd_hdr_get_if_idx( if_idx = wmi_cmd_hdr_get_if_idx(
(struct wmi_cmd_hdr *) skb->data); (struct wmi_cmd_hdr *) packet->buf);
} else { } else {
if_idx = wmi_data_hdr_get_if_idx( if_idx = wmi_data_hdr_get_if_idx(
(struct wmi_data_hdr *) skb->data); (struct wmi_data_hdr *) packet->buf);
} }
vif = ath6kl_get_vif_by_index(ar, if_idx); vif = ath6kl_get_vif_by_index(ar, if_idx);
......
/*
* Copyright (c) 2007-2011 Atheros Communications Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <linux/module.h>
#include <linux/usb.h>
#include "debug.h"
#include "core.h"
/* usb device object */
struct ath6kl_usb {
struct usb_device *udev;
struct usb_interface *interface;
u8 *diag_cmd_buffer;
u8 *diag_resp_buffer;
struct ath6kl *ar;
};
/* diagnostic command defnitions */
#define ATH6KL_USB_CONTROL_REQ_SEND_BMI_CMD 1
#define ATH6KL_USB_CONTROL_REQ_RECV_BMI_RESP 2
#define ATH6KL_USB_CONTROL_REQ_DIAG_CMD 3
#define ATH6KL_USB_CONTROL_REQ_DIAG_RESP 4
#define ATH6KL_USB_CTRL_DIAG_CC_READ 0
#define ATH6KL_USB_CTRL_DIAG_CC_WRITE 1
struct ath6kl_usb_ctrl_diag_cmd_write {
__le32 cmd;
__le32 address;
__le32 value;
__le32 _pad[1];
} __packed;
struct ath6kl_usb_ctrl_diag_cmd_read {
__le32 cmd;
__le32 address;
} __packed;
struct ath6kl_usb_ctrl_diag_resp_read {
__le32 value;
} __packed;
#define ATH6KL_USB_MAX_DIAG_CMD (sizeof(struct ath6kl_usb_ctrl_diag_cmd_write))
#define ATH6KL_USB_MAX_DIAG_RESP (sizeof(struct ath6kl_usb_ctrl_diag_resp_read))
static void ath6kl_usb_destroy(struct ath6kl_usb *ar_usb)
{
usb_set_intfdata(ar_usb->interface, NULL);
kfree(ar_usb->diag_cmd_buffer);
kfree(ar_usb->diag_resp_buffer);
kfree(ar_usb);
}
static struct ath6kl_usb *ath6kl_usb_create(struct usb_interface *interface)
{
struct ath6kl_usb *ar_usb = NULL;
struct usb_device *dev = interface_to_usbdev(interface);
int status = 0;
ar_usb = kzalloc(sizeof(struct ath6kl_usb), GFP_KERNEL);
if (ar_usb == NULL)
goto fail_ath6kl_usb_create;
memset(ar_usb, 0, sizeof(struct ath6kl_usb));
usb_set_intfdata(interface, ar_usb);
ar_usb->udev = dev;
ar_usb->interface = interface;
ar_usb->diag_cmd_buffer = kzalloc(ATH6KL_USB_MAX_DIAG_CMD, GFP_KERNEL);
if (ar_usb->diag_cmd_buffer == NULL) {
status = -ENOMEM;
goto fail_ath6kl_usb_create;
}
ar_usb->diag_resp_buffer = kzalloc(ATH6KL_USB_MAX_DIAG_RESP,
GFP_KERNEL);
if (ar_usb->diag_resp_buffer == NULL) {
status = -ENOMEM;
goto fail_ath6kl_usb_create;
}
fail_ath6kl_usb_create:
if (status != 0) {
ath6kl_usb_destroy(ar_usb);
ar_usb = NULL;
}
return ar_usb;
}
static void ath6kl_usb_device_detached(struct usb_interface *interface)
{
struct ath6kl_usb *ar_usb;
ar_usb = usb_get_intfdata(interface);
if (ar_usb == NULL)
return;
ath6kl_stop_txrx(ar_usb->ar);
ath6kl_core_cleanup(ar_usb->ar);
ath6kl_usb_destroy(ar_usb);
}
static int ath6kl_usb_submit_ctrl_out(struct ath6kl_usb *ar_usb,
u8 req, u16 value, u16 index, void *data,
u32 size)
{
u8 *buf = NULL;
int ret;
if (size > 0) {
buf = kmalloc(size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
memcpy(buf, data, size);
}
/* note: if successful returns number of bytes transfered */
ret = usb_control_msg(ar_usb->udev,
usb_sndctrlpipe(ar_usb->udev, 0),
req,
USB_DIR_OUT | USB_TYPE_VENDOR |
USB_RECIP_DEVICE, value, index, buf,
size, 1000);
if (ret < 0) {
ath6kl_dbg(ATH6KL_DBG_USB, "%s failed,result = %d\n",
__func__, ret);
}
kfree(buf);
return 0;
}
static int ath6kl_usb_submit_ctrl_in(struct ath6kl_usb *ar_usb,
u8 req, u16 value, u16 index, void *data,
u32 size)
{
u8 *buf = NULL;
int ret;
if (size > 0) {
buf = kmalloc(size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
}
/* note: if successful returns number of bytes transfered */
ret = usb_control_msg(ar_usb->udev,
usb_rcvctrlpipe(ar_usb->udev, 0),
req,
USB_DIR_IN | USB_TYPE_VENDOR |
USB_RECIP_DEVICE, value, index, buf,
size, 2 * HZ);
if (ret < 0) {
ath6kl_dbg(ATH6KL_DBG_USB, "%s failed,result = %d\n",
__func__, ret);
}
memcpy((u8 *) data, buf, size);
kfree(buf);
return 0;
}
static int ath6kl_usb_ctrl_msg_exchange(struct ath6kl_usb *ar_usb,
u8 req_val, u8 *req_buf, u32 req_len,
u8 resp_val, u8 *resp_buf, u32 *resp_len)
{
int ret;
/* send command */
ret = ath6kl_usb_submit_ctrl_out(ar_usb, req_val, 0, 0,
req_buf, req_len);
if (ret != 0)
return ret;
if (resp_buf == NULL) {
/* no expected response */
return ret;
}
/* get response */
ret = ath6kl_usb_submit_ctrl_in(ar_usb, resp_val, 0, 0,
resp_buf, *resp_len);
return ret;
}
static int ath6kl_usb_diag_read32(struct ath6kl *ar, u32 address, u32 *data)
{
struct ath6kl_usb *ar_usb = ar->hif_priv;
struct ath6kl_usb_ctrl_diag_resp_read *resp;
struct ath6kl_usb_ctrl_diag_cmd_read *cmd;
u32 resp_len;
int ret;
cmd = (struct ath6kl_usb_ctrl_diag_cmd_read *) ar_usb->diag_cmd_buffer;
memset(cmd, 0, sizeof(*cmd));
cmd->cmd = ATH6KL_USB_CTRL_DIAG_CC_READ;
cmd->address = cpu_to_le32(address);
resp_len = sizeof(*resp);
ret = ath6kl_usb_ctrl_msg_exchange(ar_usb,
ATH6KL_USB_CONTROL_REQ_DIAG_CMD,
(u8 *) cmd,
sizeof(struct ath6kl_usb_ctrl_diag_cmd_write),
ATH6KL_USB_CONTROL_REQ_DIAG_RESP,
ar_usb->diag_resp_buffer, &resp_len);
if (ret)
return ret;
resp = (struct ath6kl_usb_ctrl_diag_resp_read *)
ar_usb->diag_resp_buffer;
*data = le32_to_cpu(resp->value);
return ret;
}
static int ath6kl_usb_diag_write32(struct ath6kl *ar, u32 address, __le32 data)
{
struct ath6kl_usb *ar_usb = ar->hif_priv;
struct ath6kl_usb_ctrl_diag_cmd_write *cmd;
cmd = (struct ath6kl_usb_ctrl_diag_cmd_write *) ar_usb->diag_cmd_buffer;
memset(cmd, 0, sizeof(struct ath6kl_usb_ctrl_diag_cmd_write));
cmd->cmd = cpu_to_le32(ATH6KL_USB_CTRL_DIAG_CC_WRITE);
cmd->address = cpu_to_le32(address);
cmd->value = data;
return ath6kl_usb_ctrl_msg_exchange(ar_usb,
ATH6KL_USB_CONTROL_REQ_DIAG_CMD,
(u8 *) cmd,
sizeof(*cmd),
0, NULL, NULL);
}
static int ath6kl_usb_bmi_read(struct ath6kl *ar, u8 *buf, u32 len)
{
struct ath6kl_usb *ar_usb = ar->hif_priv;
int ret;
/* get response */
ret = ath6kl_usb_submit_ctrl_in(ar_usb,
ATH6KL_USB_CONTROL_REQ_RECV_BMI_RESP,
0, 0, buf, len);
if (ret != 0) {
ath6kl_err("Unable to read the bmi data from the device: %d\n",
ret);
return ret;
}
return 0;
}
static int ath6kl_usb_bmi_write(struct ath6kl *ar, u8 *buf, u32 len)
{
struct ath6kl_usb *ar_usb = ar->hif_priv;
int ret;
/* send command */
ret = ath6kl_usb_submit_ctrl_out(ar_usb,
ATH6KL_USB_CONTROL_REQ_SEND_BMI_CMD,
0, 0, buf, len);
if (ret != 0) {
ath6kl_err("unable to send the bmi data to the device: %d\n",
ret);
return ret;
}
return 0;
}
static int ath6kl_usb_power_on(struct ath6kl *ar)
{
return 0;
}
static int ath6kl_usb_power_off(struct ath6kl *ar)
{
return 0;
}
static const struct ath6kl_hif_ops ath6kl_usb_ops = {
.diag_read32 = ath6kl_usb_diag_read32,
.diag_write32 = ath6kl_usb_diag_write32,
.bmi_read = ath6kl_usb_bmi_read,
.bmi_write = ath6kl_usb_bmi_write,
.power_on = ath6kl_usb_power_on,
.power_off = ath6kl_usb_power_off,
};
/* ath6kl usb driver registered functions */
static int ath6kl_usb_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
struct usb_device *dev = interface_to_usbdev(interface);
struct ath6kl *ar;
struct ath6kl_usb *ar_usb = NULL;
int vendor_id, product_id;
int ret = 0;
usb_get_dev(dev);
vendor_id = le16_to_cpu(dev->descriptor.idVendor);
product_id = le16_to_cpu(dev->descriptor.idProduct);
ath6kl_dbg(ATH6KL_DBG_USB, "vendor_id = %04x\n", vendor_id);
ath6kl_dbg(ATH6KL_DBG_USB, "product_id = %04x\n", product_id);
if (interface->cur_altsetting)
ath6kl_dbg(ATH6KL_DBG_USB, "USB Interface %d\n",
interface->cur_altsetting->desc.bInterfaceNumber);
if (dev->speed == USB_SPEED_HIGH)
ath6kl_dbg(ATH6KL_DBG_USB, "USB 2.0 Host\n");
else
ath6kl_dbg(ATH6KL_DBG_USB, "USB 1.1 Host\n");
ar_usb = ath6kl_usb_create(interface);
if (ar_usb == NULL) {
ret = -ENOMEM;
goto err_usb_put;
}
ar = ath6kl_core_alloc(&ar_usb->udev->dev);
if (ar == NULL) {
ath6kl_err("Failed to alloc ath6kl core\n");
ret = -ENOMEM;
goto err_usb_destroy;
}
ar->hif_priv = ar_usb;
ar->hif_type = ATH6KL_HIF_TYPE_USB;
ar->hif_ops = &ath6kl_usb_ops;
ar->mbox_info.block_size = 16;
ar->bmi.max_data_size = 252;
ar_usb->ar = ar;
ret = ath6kl_core_init(ar);
if (ret) {
ath6kl_err("Failed to init ath6kl core: %d\n", ret);
goto err_core_free;
}
return ret;
err_core_free:
ath6kl_core_free(ar);
err_usb_destroy:
ath6kl_usb_destroy(ar_usb);
err_usb_put:
usb_put_dev(dev);
return ret;
}
static void ath6kl_usb_remove(struct usb_interface *interface)
{
usb_put_dev(interface_to_usbdev(interface));
ath6kl_usb_device_detached(interface);
}
/* table of devices that work with this driver */
static struct usb_device_id ath6kl_usb_ids[] = {
{USB_DEVICE(0x0cf3, 0x9374)},
{ /* Terminating entry */ },
};
MODULE_DEVICE_TABLE(usb, ath6kl_usb_ids);
static struct usb_driver ath6kl_usb_driver = {
.name = "ath6kl_usb",
.probe = ath6kl_usb_probe,
.disconnect = ath6kl_usb_remove,
.id_table = ath6kl_usb_ids,
};
static int ath6kl_usb_init(void)
{
usb_register(&ath6kl_usb_driver);
return 0;
}
static void ath6kl_usb_exit(void)
{
usb_deregister(&ath6kl_usb_driver);
}
module_init(ath6kl_usb_init);
module_exit(ath6kl_usb_exit);
MODULE_AUTHOR("Atheros Communications, Inc.");
MODULE_DESCRIPTION("Driver support for Atheros AR600x USB devices");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_FIRMWARE(AR6004_HW_1_0_FIRMWARE_FILE);
MODULE_FIRMWARE(AR6004_HW_1_0_BOARD_DATA_FILE);
MODULE_FIRMWARE(AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE);
MODULE_FIRMWARE(AR6004_HW_1_1_FIRMWARE_FILE);
MODULE_FIRMWARE(AR6004_HW_1_1_BOARD_DATA_FILE);
MODULE_FIRMWARE(AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE);
...@@ -85,7 +85,7 @@ struct ath6kl_vif *ath6kl_get_vif_by_index(struct ath6kl *ar, u8 if_idx) ...@@ -85,7 +85,7 @@ struct ath6kl_vif *ath6kl_get_vif_by_index(struct ath6kl *ar, u8 if_idx)
{ {
struct ath6kl_vif *vif, *found = NULL; struct ath6kl_vif *vif, *found = NULL;
if (WARN_ON(if_idx > (MAX_NUM_VIF - 1))) if (WARN_ON(if_idx > (ar->vif_max - 1)))
return NULL; return NULL;
/* FIXME: Locking */ /* FIXME: Locking */
...@@ -187,7 +187,7 @@ int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb, ...@@ -187,7 +187,7 @@ int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb,
struct wmi_data_hdr *data_hdr; struct wmi_data_hdr *data_hdr;
int ret; int ret;
if (WARN_ON(skb == NULL || (if_idx > MAX_NUM_VIF - 1))) if (WARN_ON(skb == NULL || (if_idx > wmi->parent_dev->vif_max - 1)))
return -EINVAL; return -EINVAL;
if (tx_meta_info) { if (tx_meta_info) {
...@@ -977,6 +977,13 @@ static int ath6kl_wmi_tkip_micerr_event_rx(struct wmi *wmi, u8 *datap, int len, ...@@ -977,6 +977,13 @@ static int ath6kl_wmi_tkip_micerr_event_rx(struct wmi *wmi, u8 *datap, int len,
return 0; return 0;
} }
void ath6kl_wmi_sscan_timer(unsigned long ptr)
{
struct ath6kl_vif *vif = (struct ath6kl_vif *) ptr;
cfg80211_sched_scan_results(vif->ar->wiphy);
}
static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len, static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len,
struct ath6kl_vif *vif) struct ath6kl_vif *vif)
{ {
...@@ -1066,6 +1073,21 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len, ...@@ -1066,6 +1073,21 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len,
return -ENOMEM; return -ENOMEM;
cfg80211_put_bss(bss); cfg80211_put_bss(bss);
/*
* Firmware doesn't return any event when scheduled scan has
* finished, so we need to use a timer to find out when there are
* no more results.
*
* The timer is started from the first bss info received, otherwise
* the timer would not ever fire if the scan interval is short
* enough.
*/
if (ar->state == ATH6KL_STATE_SCHED_SCAN &&
!timer_pending(&vif->sched_scan_timer)) {
mod_timer(&vif->sched_scan_timer, jiffies +
msecs_to_jiffies(ATH6KL_SCHED_SCAN_RESULT_DELAY));
}
return 0; return 0;
} }
...@@ -1620,7 +1642,7 @@ int ath6kl_wmi_cmd_send(struct wmi *wmi, u8 if_idx, struct sk_buff *skb, ...@@ -1620,7 +1642,7 @@ int ath6kl_wmi_cmd_send(struct wmi *wmi, u8 if_idx, struct sk_buff *skb,
int ret; int ret;
u16 info1; u16 info1;
if (WARN_ON(skb == NULL || (if_idx > (MAX_NUM_VIF - 1)))) if (WARN_ON(skb == NULL || (if_idx > (wmi->parent_dev->vif_max - 1))))
return -EINVAL; return -EINVAL;
ath6kl_dbg(ATH6KL_DBG_WMI, "wmi tx id %d len %d flag %d\n", ath6kl_dbg(ATH6KL_DBG_WMI, "wmi tx id %d len %d flag %d\n",
...@@ -1682,7 +1704,8 @@ int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx, ...@@ -1682,7 +1704,8 @@ int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx,
u8 pairwise_crypto_len, u8 pairwise_crypto_len,
enum crypto_type group_crypto, enum crypto_type group_crypto,
u8 group_crypto_len, int ssid_len, u8 *ssid, u8 group_crypto_len, int ssid_len, u8 *ssid,
u8 *bssid, u16 channel, u32 ctrl_flags) u8 *bssid, u16 channel, u32 ctrl_flags,
u8 nw_subtype)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct wmi_connect_cmd *cc; struct wmi_connect_cmd *cc;
...@@ -1722,6 +1745,7 @@ int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx, ...@@ -1722,6 +1745,7 @@ int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx,
cc->grp_crypto_len = group_crypto_len; cc->grp_crypto_len = group_crypto_len;
cc->ch = cpu_to_le16(channel); cc->ch = cpu_to_le16(channel);
cc->ctrl_flags = cpu_to_le32(ctrl_flags); cc->ctrl_flags = cpu_to_le32(ctrl_flags);
cc->nw_subtype = nw_subtype;
if (bssid != NULL) if (bssid != NULL)
memcpy(cc->bssid, bssid, ETH_ALEN); memcpy(cc->bssid, bssid, ETH_ALEN);
...@@ -1774,6 +1798,72 @@ int ath6kl_wmi_disconnect_cmd(struct wmi *wmi, u8 if_idx) ...@@ -1774,6 +1798,72 @@ int ath6kl_wmi_disconnect_cmd(struct wmi *wmi, u8 if_idx)
return ret; return ret;
} }
int ath6kl_wmi_beginscan_cmd(struct wmi *wmi, u8 if_idx,
enum wmi_scan_type scan_type,
u32 force_fgscan, u32 is_legacy,
u32 home_dwell_time, u32 force_scan_interval,
s8 num_chan, u16 *ch_list, u32 no_cck, u32 *rates)
{
struct sk_buff *skb;
struct wmi_begin_scan_cmd *sc;
s8 size;
int i, band, ret;
struct ath6kl *ar = wmi->parent_dev;
int num_rates;
size = sizeof(struct wmi_begin_scan_cmd);
if ((scan_type != WMI_LONG_SCAN) && (scan_type != WMI_SHORT_SCAN))
return -EINVAL;
if (num_chan > WMI_MAX_CHANNELS)
return -EINVAL;
if (num_chan)
size += sizeof(u16) * (num_chan - 1);
skb = ath6kl_wmi_get_new_buf(size);
if (!skb)
return -ENOMEM;
sc = (struct wmi_begin_scan_cmd *) skb->data;
sc->scan_type = scan_type;
sc->force_fg_scan = cpu_to_le32(force_fgscan);
sc->is_legacy = cpu_to_le32(is_legacy);
sc->home_dwell_time = cpu_to_le32(home_dwell_time);
sc->force_scan_intvl = cpu_to_le32(force_scan_interval);
sc->no_cck = cpu_to_le32(no_cck);
sc->num_ch = num_chan;
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
struct ieee80211_supported_band *sband =
ar->wiphy->bands[band];
u32 ratemask = rates[band];
u8 *supp_rates = sc->supp_rates[band].rates;
num_rates = 0;
for (i = 0; i < sband->n_bitrates; i++) {
if ((BIT(i) & ratemask) == 0)
continue; /* skip rate */
supp_rates[num_rates++] =
(u8) (sband->bitrates[i].bitrate / 5);
}
sc->supp_rates[band].nrates = num_rates;
}
for (i = 0; i < num_chan; i++)
sc->ch_list[i] = cpu_to_le16(ch_list[i]);
ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_BEGIN_SCAN_CMDID,
NO_SYNC_WMIFLAG);
return ret;
}
/* ath6kl_wmi_start_scan_cmd is to be deprecated. Use
* ath6kl_wmi_begin_scan_cmd instead. The new function supports P2P
* mgmt operations using station interface.
*/
int ath6kl_wmi_startscan_cmd(struct wmi *wmi, u8 if_idx, int ath6kl_wmi_startscan_cmd(struct wmi *wmi, u8 if_idx,
enum wmi_scan_type scan_type, enum wmi_scan_type scan_type,
u32 force_fgscan, u32 is_legacy, u32 force_fgscan, u32 is_legacy,
...@@ -2940,7 +3030,10 @@ int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type, ...@@ -2940,7 +3030,10 @@ int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type,
p = (struct wmi_set_appie_cmd *) skb->data; p = (struct wmi_set_appie_cmd *) skb->data;
p->mgmt_frm_type = mgmt_frm_type; p->mgmt_frm_type = mgmt_frm_type;
p->ie_len = ie_len; p->ie_len = ie_len;
memcpy(p->ie_info, ie, ie_len);
if (ie != NULL && ie_len > 0)
memcpy(p->ie_info, ie, ie_len);
return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_APPIE_CMDID, return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_APPIE_CMDID,
NO_SYNC_WMIFLAG); NO_SYNC_WMIFLAG);
} }
...@@ -2981,6 +3074,10 @@ int ath6kl_wmi_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx, u32 freq, u32 dur) ...@@ -2981,6 +3074,10 @@ int ath6kl_wmi_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx, u32 freq, u32 dur)
NO_SYNC_WMIFLAG); NO_SYNC_WMIFLAG);
} }
/* ath6kl_wmi_send_action_cmd is to be deprecated. Use
* ath6kl_wmi_send_mgmt_cmd instead. The new function supports P2P
* mgmt operations using station interface.
*/
int ath6kl_wmi_send_action_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq, int ath6kl_wmi_send_action_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq,
u32 wait, const u8 *data, u16 data_len) u32 wait, const u8 *data, u16 data_len)
{ {
...@@ -3018,14 +3115,57 @@ int ath6kl_wmi_send_action_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq, ...@@ -3018,14 +3115,57 @@ int ath6kl_wmi_send_action_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq,
NO_SYNC_WMIFLAG); NO_SYNC_WMIFLAG);
} }
int ath6kl_wmi_send_mgmt_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq,
u32 wait, const u8 *data, u16 data_len,
u32 no_cck)
{
struct sk_buff *skb;
struct wmi_send_mgmt_cmd *p;
u8 *buf;
if (wait)
return -EINVAL; /* Offload for wait not supported */
buf = kmalloc(data_len, GFP_KERNEL);
if (!buf)
return -ENOMEM;
skb = ath6kl_wmi_get_new_buf(sizeof(*p) + data_len);
if (!skb) {
kfree(buf);
return -ENOMEM;
}
kfree(wmi->last_mgmt_tx_frame);
memcpy(buf, data, data_len);
wmi->last_mgmt_tx_frame = buf;
wmi->last_mgmt_tx_frame_len = data_len;
ath6kl_dbg(ATH6KL_DBG_WMI, "send_action_cmd: id=%u freq=%u wait=%u "
"len=%u\n", id, freq, wait, data_len);
p = (struct wmi_send_mgmt_cmd *) skb->data;
p->id = cpu_to_le32(id);
p->freq = cpu_to_le32(freq);
p->wait = cpu_to_le32(wait);
p->no_cck = cpu_to_le32(no_cck);
p->len = cpu_to_le16(data_len);
memcpy(p->data, data, data_len);
return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SEND_MGMT_CMDID,
NO_SYNC_WMIFLAG);
}
int ath6kl_wmi_send_probe_response_cmd(struct wmi *wmi, u8 if_idx, u32 freq, int ath6kl_wmi_send_probe_response_cmd(struct wmi *wmi, u8 if_idx, u32 freq,
const u8 *dst, const u8 *data, const u8 *dst, const u8 *data,
u16 data_len) u16 data_len)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct wmi_p2p_probe_response_cmd *p; struct wmi_p2p_probe_response_cmd *p;
size_t cmd_len = sizeof(*p) + data_len;
skb = ath6kl_wmi_get_new_buf(sizeof(*p) + data_len); if (data_len == 0)
cmd_len++; /* work around target minimum length requirement */
skb = ath6kl_wmi_get_new_buf(cmd_len);
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
......
...@@ -329,6 +329,10 @@ enum wmi_cmd_id { ...@@ -329,6 +329,10 @@ enum wmi_cmd_id {
WMI_SYNCHRONIZE_CMDID, WMI_SYNCHRONIZE_CMDID,
WMI_CREATE_PSTREAM_CMDID, WMI_CREATE_PSTREAM_CMDID,
WMI_DELETE_PSTREAM_CMDID, WMI_DELETE_PSTREAM_CMDID,
/* WMI_START_SCAN_CMDID is to be deprecated. Use
* WMI_BEGIN_SCAN_CMDID instead. The new cmd supports P2P mgmt
* operations using station interface.
*/
WMI_START_SCAN_CMDID, WMI_START_SCAN_CMDID,
WMI_SET_SCAN_PARAMS_CMDID, WMI_SET_SCAN_PARAMS_CMDID,
WMI_SET_BSS_FILTER_CMDID, WMI_SET_BSS_FILTER_CMDID,
...@@ -542,12 +546,61 @@ enum wmi_cmd_id { ...@@ -542,12 +546,61 @@ enum wmi_cmd_id {
WMI_GTK_OFFLOAD_OP_CMDID, WMI_GTK_OFFLOAD_OP_CMDID,
WMI_REMAIN_ON_CHNL_CMDID, WMI_REMAIN_ON_CHNL_CMDID,
WMI_CANCEL_REMAIN_ON_CHNL_CMDID, WMI_CANCEL_REMAIN_ON_CHNL_CMDID,
/* WMI_SEND_ACTION_CMDID is to be deprecated. Use
* WMI_SEND_MGMT_CMDID instead. The new cmd supports P2P mgmt
* operations using station interface.
*/
WMI_SEND_ACTION_CMDID, WMI_SEND_ACTION_CMDID,
WMI_PROBE_REQ_REPORT_CMDID, WMI_PROBE_REQ_REPORT_CMDID,
WMI_DISABLE_11B_RATES_CMDID, WMI_DISABLE_11B_RATES_CMDID,
WMI_SEND_PROBE_RESPONSE_CMDID, WMI_SEND_PROBE_RESPONSE_CMDID,
WMI_GET_P2P_INFO_CMDID, WMI_GET_P2P_INFO_CMDID,
WMI_AP_JOIN_BSS_CMDID, WMI_AP_JOIN_BSS_CMDID,
WMI_SMPS_ENABLE_CMDID,
WMI_SMPS_CONFIG_CMDID,
WMI_SET_RATECTRL_PARM_CMDID,
/* LPL specific commands*/
WMI_LPL_FORCE_ENABLE_CMDID,
WMI_LPL_SET_POLICY_CMDID,
WMI_LPL_GET_POLICY_CMDID,
WMI_LPL_GET_HWSTATE_CMDID,
WMI_LPL_SET_PARAMS_CMDID,
WMI_LPL_GET_PARAMS_CMDID,
WMI_SET_BUNDLE_PARAM_CMDID,
/*GreenTx specific commands*/
WMI_GREENTX_PARAMS_CMDID,
WMI_RTT_MEASREQ_CMDID,
WMI_RTT_CAPREQ_CMDID,
WMI_RTT_STATUSREQ_CMDID,
/* WPS Commands */
WMI_WPS_START_CMDID,
WMI_GET_WPS_STATUS_CMDID,
/* More P2P commands */
WMI_SET_NOA_CMDID,
WMI_GET_NOA_CMDID,
WMI_SET_OPPPS_CMDID,
WMI_GET_OPPPS_CMDID,
WMI_ADD_PORT_CMDID,
WMI_DEL_PORT_CMDID,
/* 802.11w cmd */
WMI_SET_RSN_CAP_CMDID,
WMI_GET_RSN_CAP_CMDID,
WMI_SET_IGTK_CMDID,
WMI_RX_FILTER_COALESCE_FILTER_OP_CMDID,
WMI_RX_FILTER_SET_FRAME_TEST_LIST_CMDID,
WMI_SEND_MGMT_CMDID,
WMI_BEGIN_SCAN_CMDID,
}; };
enum wmi_mgmt_frame_type { enum wmi_mgmt_frame_type {
...@@ -567,6 +620,14 @@ enum network_type { ...@@ -567,6 +620,14 @@ enum network_type {
AP_NETWORK = 0x10, AP_NETWORK = 0x10,
}; };
enum network_subtype {
SUBTYPE_NONE,
SUBTYPE_BT,
SUBTYPE_P2PDEV,
SUBTYPE_P2PCLIENT,
SUBTYPE_P2PGO,
};
enum dot11_auth_mode { enum dot11_auth_mode {
OPEN_AUTH = 0x01, OPEN_AUTH = 0x01,
SHARED_AUTH = 0x02, SHARED_AUTH = 0x02,
...@@ -639,6 +700,7 @@ struct wmi_connect_cmd { ...@@ -639,6 +700,7 @@ struct wmi_connect_cmd {
__le16 ch; __le16 ch;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
__le32 ctrl_flags; __le32 ctrl_flags;
u8 nw_subtype;
} __packed; } __packed;
/* WMI_RECONNECT_CMDID */ /* WMI_RECONNECT_CMDID */
...@@ -726,7 +788,12 @@ enum wmi_scan_type { ...@@ -726,7 +788,12 @@ enum wmi_scan_type {
WMI_SHORT_SCAN = 1, WMI_SHORT_SCAN = 1,
}; };
struct wmi_start_scan_cmd { struct wmi_supp_rates {
u8 nrates;
u8 rates[ATH6KL_RATE_MAXSIZE];
};
struct wmi_begin_scan_cmd {
__le32 force_fg_scan; __le32 force_fg_scan;
/* for legacy cisco AP compatibility */ /* for legacy cisco AP compatibility */
...@@ -738,9 +805,15 @@ struct wmi_start_scan_cmd { ...@@ -738,9 +805,15 @@ struct wmi_start_scan_cmd {
/* time interval between scans (msec) */ /* time interval between scans (msec) */
__le32 force_scan_intvl; __le32 force_scan_intvl;
/* no CCK rates */
__le32 no_cck;
/* enum wmi_scan_type */ /* enum wmi_scan_type */
u8 scan_type; u8 scan_type;
/* Supported rates to advertise in the probe request frames */
struct wmi_supp_rates supp_rates[IEEE80211_NUM_BANDS];
/* how many channels follow */ /* how many channels follow */
u8 num_ch; u8 num_ch;
...@@ -748,8 +821,31 @@ struct wmi_start_scan_cmd { ...@@ -748,8 +821,31 @@ struct wmi_start_scan_cmd {
__le16 ch_list[1]; __le16 ch_list[1];
} __packed; } __packed;
/* WMI_SET_SCAN_PARAMS_CMDID */ /* wmi_start_scan_cmd is to be deprecated. Use
#define WMI_SHORTSCANRATIO_DEFAULT 3 * wmi_begin_scan_cmd instead. The new structure supports P2P mgmt
* operations using station interface.
*/
struct wmi_start_scan_cmd {
__le32 force_fg_scan;
/* for legacy cisco AP compatibility */
__le32 is_legacy;
/* max duration in the home channel(msec) */
__le32 home_dwell_time;
/* time interval between scans (msec) */
__le32 force_scan_intvl;
/* enum wmi_scan_type */
u8 scan_type;
/* how many channels follow */
u8 num_ch;
/* channels in Mhz */
__le16 ch_list[1];
} __packed;
/* /*
* Warning: scan control flag value of 0xFF is used to disable * Warning: scan control flag value of 0xFF is used to disable
...@@ -783,13 +879,6 @@ enum wmi_scan_ctrl_flags_bits { ...@@ -783,13 +879,6 @@ enum wmi_scan_ctrl_flags_bits {
ENABLE_SCAN_ABORT_EVENT = 0x40 ENABLE_SCAN_ABORT_EVENT = 0x40
}; };
#define DEFAULT_SCAN_CTRL_FLAGS \
(CONNECT_SCAN_CTRL_FLAGS | \
SCAN_CONNECTED_CTRL_FLAGS | \
ACTIVE_SCAN_CTRL_FLAGS | \
ROAM_SCAN_CTRL_FLAGS | \
ENABLE_AUTO_CTRL_FLAGS)
struct wmi_scan_params_cmd { struct wmi_scan_params_cmd {
/* sec */ /* sec */
__le16 fg_start_period; __le16 fg_start_period;
...@@ -1818,7 +1907,7 @@ struct wmi_set_ip_cmd { ...@@ -1818,7 +1907,7 @@ struct wmi_set_ip_cmd {
} __packed; } __packed;
enum ath6kl_wow_filters { enum ath6kl_wow_filters {
WOW_FILTER_SSID = BIT(0), WOW_FILTER_SSID = BIT(1),
WOW_FILTER_OPTION_MAGIC_PACKET = BIT(2), WOW_FILTER_OPTION_MAGIC_PACKET = BIT(2),
WOW_FILTER_OPTION_EAP_REQ = BIT(3), WOW_FILTER_OPTION_EAP_REQ = BIT(3),
WOW_FILTER_OPTION_PATTERNS = BIT(4), WOW_FILTER_OPTION_PATTERNS = BIT(4),
...@@ -1963,7 +2052,7 @@ struct wmi_tx_complete_event { ...@@ -1963,7 +2052,7 @@ struct wmi_tx_complete_event {
* !!! Warning !!! * !!! Warning !!!
* -Changing the following values needs compilation of both driver and firmware * -Changing the following values needs compilation of both driver and firmware
*/ */
#define AP_MAX_NUM_STA 8 #define AP_MAX_NUM_STA 10
/* Spl. AID used to set DTIM flag in the beacons */ /* Spl. AID used to set DTIM flag in the beacons */
#define MCAST_AID 0xFF #define MCAST_AID 0xFF
...@@ -2046,6 +2135,10 @@ struct wmi_remain_on_chnl_cmd { ...@@ -2046,6 +2135,10 @@ struct wmi_remain_on_chnl_cmd {
__le32 duration; __le32 duration;
} __packed; } __packed;
/* wmi_send_action_cmd is to be deprecated. Use
* wmi_send_mgmt_cmd instead. The new structure supports P2P mgmt
* operations using station interface.
*/
struct wmi_send_action_cmd { struct wmi_send_action_cmd {
__le32 id; __le32 id;
__le32 freq; __le32 freq;
...@@ -2054,6 +2147,15 @@ struct wmi_send_action_cmd { ...@@ -2054,6 +2147,15 @@ struct wmi_send_action_cmd {
u8 data[0]; u8 data[0];
} __packed; } __packed;
struct wmi_send_mgmt_cmd {
__le32 id;
__le32 freq;
__le32 wait;
__le32 no_cck;
__le16 len;
u8 data[0];
} __packed;
struct wmi_tx_status_event { struct wmi_tx_status_event {
__le32 id; __le32 id;
u8 ack_status; u8 ack_status;
...@@ -2242,7 +2344,8 @@ int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx, ...@@ -2242,7 +2344,8 @@ int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx,
u8 pairwise_crypto_len, u8 pairwise_crypto_len,
enum crypto_type group_crypto, enum crypto_type group_crypto,
u8 group_crypto_len, int ssid_len, u8 *ssid, u8 group_crypto_len, int ssid_len, u8 *ssid,
u8 *bssid, u16 channel, u32 ctrl_flags); u8 *bssid, u16 channel, u32 ctrl_flags,
u8 nw_subtype);
int ath6kl_wmi_reconnect_cmd(struct wmi *wmi, u8 if_idx, u8 *bssid, int ath6kl_wmi_reconnect_cmd(struct wmi *wmi, u8 if_idx, u8 *bssid,
u16 channel); u16 channel);
...@@ -2252,6 +2355,14 @@ int ath6kl_wmi_startscan_cmd(struct wmi *wmi, u8 if_idx, ...@@ -2252,6 +2355,14 @@ int ath6kl_wmi_startscan_cmd(struct wmi *wmi, u8 if_idx,
u32 force_fgscan, u32 is_legacy, u32 force_fgscan, u32 is_legacy,
u32 home_dwell_time, u32 force_scan_interval, u32 home_dwell_time, u32 force_scan_interval,
s8 num_chan, u16 *ch_list); s8 num_chan, u16 *ch_list);
int ath6kl_wmi_beginscan_cmd(struct wmi *wmi, u8 if_idx,
enum wmi_scan_type scan_type,
u32 force_fgscan, u32 is_legacy,
u32 home_dwell_time, u32 force_scan_interval,
s8 num_chan, u16 *ch_list, u32 no_cck,
u32 *rates);
int ath6kl_wmi_scanparams_cmd(struct wmi *wmi, u8 if_idx, u16 fg_start_sec, int ath6kl_wmi_scanparams_cmd(struct wmi *wmi, u8 if_idx, u16 fg_start_sec,
u16 fg_end_sec, u16 bg_sec, u16 fg_end_sec, u16 bg_sec,
u16 minact_chdw_msec, u16 maxact_chdw_msec, u16 minact_chdw_msec, u16 maxact_chdw_msec,
...@@ -2346,6 +2457,10 @@ int ath6kl_wmi_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx, u32 freq, ...@@ -2346,6 +2457,10 @@ int ath6kl_wmi_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx, u32 freq,
int ath6kl_wmi_send_action_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq, int ath6kl_wmi_send_action_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq,
u32 wait, const u8 *data, u16 data_len); u32 wait, const u8 *data, u16 data_len);
int ath6kl_wmi_send_mgmt_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq,
u32 wait, const u8 *data, u16 data_len,
u32 no_cck);
int ath6kl_wmi_send_probe_response_cmd(struct wmi *wmi, u8 if_idx, u32 freq, int ath6kl_wmi_send_probe_response_cmd(struct wmi *wmi, u8 if_idx, u32 freq,
const u8 *dst, const u8 *data, const u8 *dst, const u8 *data,
u16 data_len); u16 data_len);
...@@ -2359,6 +2474,8 @@ int ath6kl_wmi_cancel_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx); ...@@ -2359,6 +2474,8 @@ int ath6kl_wmi_cancel_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx);
int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type, int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type,
const u8 *ie, u8 ie_len); const u8 *ie, u8 ie_len);
void ath6kl_wmi_sscan_timer(unsigned long ptr);
struct ath6kl_vif *ath6kl_get_vif_by_index(struct ath6kl *ar, u8 if_idx); struct ath6kl_vif *ath6kl_get_vif_by_index(struct ath6kl *ar, u8 if_idx);
void *ath6kl_wmi_init(struct ath6kl *devt); void *ath6kl_wmi_init(struct ath6kl *devt);
void ath6kl_wmi_shutdown(struct wmi *wmi); void ath6kl_wmi_shutdown(struct wmi *wmi);
......
...@@ -81,6 +81,14 @@ config ATH9K_RATE_CONTROL ...@@ -81,6 +81,14 @@ config ATH9K_RATE_CONTROL
Say Y, if you want to use the ath9k specific rate control Say Y, if you want to use the ath9k specific rate control
module instead of minstrel_ht. module instead of minstrel_ht.
config ATH9K_BTCOEX_SUPPORT
bool "Atheros ath9k bluetooth coexistence support"
depends on ATH9K
default y
---help---
Say Y, if you want to use the ath9k radios together with
Bluetooth modules in the same system.
config ATH9K_HTC config ATH9K_HTC
tristate "Atheros HTC based wireless cards support" tristate "Atheros HTC based wireless cards support"
depends on USB && MAC80211 depends on USB && MAC80211
......
...@@ -136,8 +136,8 @@ static void ath9k_ani_restart(struct ath_hw *ah) ...@@ -136,8 +136,8 @@ static void ath9k_ani_restart(struct ath_hw *ah)
cck_base = AR_PHY_COUNTMAX - ah->config.cck_trig_high; cck_base = AR_PHY_COUNTMAX - ah->config.cck_trig_high;
} }
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI, "Writing ofdmbase=%u cckbase=%u\n",
"Writing ofdmbase=%u cckbase=%u\n", ofdm_base, cck_base); ofdm_base, cck_base);
ENABLE_REGWRITE_BUFFER(ah); ENABLE_REGWRITE_BUFFER(ah);
...@@ -268,8 +268,7 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel) ...@@ -268,8 +268,7 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel)
aniState->noiseFloor = BEACON_RSSI(ah); aniState->noiseFloor = BEACON_RSSI(ah);
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI, "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
"**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
aniState->ofdmNoiseImmunityLevel, aniState->ofdmNoiseImmunityLevel,
immunityLevel, aniState->noiseFloor, immunityLevel, aniState->noiseFloor,
aniState->rssiThrLow, aniState->rssiThrHigh); aniState->rssiThrLow, aniState->rssiThrHigh);
...@@ -336,8 +335,7 @@ static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel) ...@@ -336,8 +335,7 @@ static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel)
const struct ani_cck_level_entry *entry_cck; const struct ani_cck_level_entry *entry_cck;
aniState->noiseFloor = BEACON_RSSI(ah); aniState->noiseFloor = BEACON_RSSI(ah);
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI, "**** ccklevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
"**** ccklevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
aniState->cckNoiseImmunityLevel, immunityLevel, aniState->cckNoiseImmunityLevel, immunityLevel,
aniState->noiseFloor, aniState->rssiThrLow, aniState->noiseFloor, aniState->rssiThrLow,
aniState->rssiThrHigh); aniState->rssiThrHigh);
...@@ -481,8 +479,7 @@ static void ath9k_ani_reset_old(struct ath_hw *ah, bool is_scanning) ...@@ -481,8 +479,7 @@ static void ath9k_ani_reset_old(struct ath_hw *ah, bool is_scanning)
if (ah->opmode != NL80211_IFTYPE_STATION if (ah->opmode != NL80211_IFTYPE_STATION
&& ah->opmode != NL80211_IFTYPE_ADHOC) { && ah->opmode != NL80211_IFTYPE_ADHOC) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI, "Reset ANI state opmode %u\n", ah->opmode);
"Reset ANI state opmode %u\n", ah->opmode);
ah->stats.ast_ani_reset++; ah->stats.ast_ani_reset++;
if (ah->opmode == NL80211_IFTYPE_AP) { if (ah->opmode == NL80211_IFTYPE_AP) {
...@@ -582,7 +579,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) ...@@ -582,7 +579,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
ATH9K_ANI_OFDM_DEF_LEVEL || ATH9K_ANI_OFDM_DEF_LEVEL ||
aniState->cckNoiseImmunityLevel != aniState->cckNoiseImmunityLevel !=
ATH9K_ANI_CCK_DEF_LEVEL) { ATH9K_ANI_CCK_DEF_LEVEL) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"Restore defaults: opmode %u chan %d Mhz/0x%x is_scanning=%d ofdm:%d cck:%d\n", "Restore defaults: opmode %u chan %d Mhz/0x%x is_scanning=%d ofdm:%d cck:%d\n",
ah->opmode, ah->opmode,
chan->channel, chan->channel,
...@@ -599,7 +596,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) ...@@ -599,7 +596,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
/* /*
* restore historical levels for this channel * restore historical levels for this channel
*/ */
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"Restore history: opmode %u chan %d Mhz/0x%x is_scanning=%d ofdm:%d cck:%d\n", "Restore history: opmode %u chan %d Mhz/0x%x is_scanning=%d ofdm:%d cck:%d\n",
ah->opmode, ah->opmode,
chan->channel, chan->channel,
...@@ -662,7 +659,7 @@ static bool ath9k_hw_ani_read_counters(struct ath_hw *ah) ...@@ -662,7 +659,7 @@ static bool ath9k_hw_ani_read_counters(struct ath_hw *ah)
if (!use_new_ani(ah) && (phyCnt1 < ofdm_base || phyCnt2 < cck_base)) { if (!use_new_ani(ah) && (phyCnt1 < ofdm_base || phyCnt2 < cck_base)) {
if (phyCnt1 < ofdm_base) { if (phyCnt1 < ofdm_base) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"phyCnt1 0x%x, resetting counter value to 0x%x\n", "phyCnt1 0x%x, resetting counter value to 0x%x\n",
phyCnt1, ofdm_base); phyCnt1, ofdm_base);
REG_WRITE(ah, AR_PHY_ERR_1, ofdm_base); REG_WRITE(ah, AR_PHY_ERR_1, ofdm_base);
...@@ -670,7 +667,7 @@ static bool ath9k_hw_ani_read_counters(struct ath_hw *ah) ...@@ -670,7 +667,7 @@ static bool ath9k_hw_ani_read_counters(struct ath_hw *ah)
AR_PHY_ERR_OFDM_TIMING); AR_PHY_ERR_OFDM_TIMING);
} }
if (phyCnt2 < cck_base) { if (phyCnt2 < cck_base) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"phyCnt2 0x%x, resetting counter value to 0x%x\n", "phyCnt2 0x%x, resetting counter value to 0x%x\n",
phyCnt2, cck_base); phyCnt2, cck_base);
REG_WRITE(ah, AR_PHY_ERR_2, cck_base); REG_WRITE(ah, AR_PHY_ERR_2, cck_base);
...@@ -713,7 +710,7 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -713,7 +710,7 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
cckPhyErrRate = aniState->cckPhyErrCount * 1000 / cckPhyErrRate = aniState->cckPhyErrCount * 1000 /
aniState->listenTime; aniState->listenTime;
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"listenTime=%d OFDM:%d errs=%d/s CCK:%d errs=%d/s ofdm_turn=%d\n", "listenTime=%d OFDM:%d errs=%d/s CCK:%d errs=%d/s ofdm_turn=%d\n",
aniState->listenTime, aniState->listenTime,
aniState->ofdmNoiseImmunityLevel, aniState->ofdmNoiseImmunityLevel,
...@@ -748,7 +745,7 @@ void ath9k_enable_mib_counters(struct ath_hw *ah) ...@@ -748,7 +745,7 @@ void ath9k_enable_mib_counters(struct ath_hw *ah)
{ {
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
ath_dbg(common, ATH_DBG_ANI, "Enable MIB counters\n"); ath_dbg(common, ANI, "Enable MIB counters\n");
ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
...@@ -770,7 +767,7 @@ void ath9k_hw_disable_mib_counters(struct ath_hw *ah) ...@@ -770,7 +767,7 @@ void ath9k_hw_disable_mib_counters(struct ath_hw *ah)
{ {
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
ath_dbg(common, ATH_DBG_ANI, "Disable MIB counters\n"); ath_dbg(common, ANI, "Disable MIB counters\n");
REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC); REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC);
ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
...@@ -845,7 +842,7 @@ void ath9k_hw_ani_init(struct ath_hw *ah) ...@@ -845,7 +842,7 @@ void ath9k_hw_ani_init(struct ath_hw *ah)
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
int i; int i;
ath_dbg(common, ATH_DBG_ANI, "Initialize ANI\n"); ath_dbg(common, ANI, "Initialize ANI\n");
if (use_new_ani(ah)) { if (use_new_ani(ah)) {
ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_NEW; ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_NEW;
......
...@@ -158,7 +158,7 @@ static void ar5008_hw_force_bias(struct ath_hw *ah, u16 synth_freq) ...@@ -158,7 +158,7 @@ static void ar5008_hw_force_bias(struct ath_hw *ah, u16 synth_freq)
/* pre-reverse this field */ /* pre-reverse this field */
tmp_reg = ath9k_hw_reverse_bits(new_bias, 3); tmp_reg = ath9k_hw_reverse_bits(new_bias, 3);
ath_dbg(common, ATH_DBG_CONFIG, "Force rf_pwd_icsyndiv to %1d on %4d\n", ath_dbg(common, CONFIG, "Force rf_pwd_icsyndiv to %1d on %4d\n",
new_bias, synth_freq); new_bias, synth_freq);
/* swizzle rf_pwd_icsyndiv */ /* swizzle rf_pwd_icsyndiv */
...@@ -1053,8 +1053,7 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah, ...@@ -1053,8 +1053,7 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
u32 level = param; u32 level = param;
if (level >= ARRAY_SIZE(ah->totalSizeDesired)) { if (level >= ARRAY_SIZE(ah->totalSizeDesired)) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI, "level out of range (%u > %zu)\n",
"level out of range (%u > %zu)\n",
level, ARRAY_SIZE(ah->totalSizeDesired)); level, ARRAY_SIZE(ah->totalSizeDesired));
return false; return false;
} }
...@@ -1157,8 +1156,7 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah, ...@@ -1157,8 +1156,7 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
u32 level = param; u32 level = param;
if (level >= ARRAY_SIZE(firstep)) { if (level >= ARRAY_SIZE(firstep)) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI, "level out of range (%u > %zu)\n",
"level out of range (%u > %zu)\n",
level, ARRAY_SIZE(firstep)); level, ARRAY_SIZE(firstep));
return false; return false;
} }
...@@ -1177,8 +1175,7 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah, ...@@ -1177,8 +1175,7 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
u32 level = param; u32 level = param;
if (level >= ARRAY_SIZE(cycpwrThr1)) { if (level >= ARRAY_SIZE(cycpwrThr1)) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI, "level out of range (%u > %zu)\n",
"level out of range (%u > %zu)\n",
level, ARRAY_SIZE(cycpwrThr1)); level, ARRAY_SIZE(cycpwrThr1));
return false; return false;
} }
...@@ -1195,23 +1192,22 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah, ...@@ -1195,23 +1192,22 @@ static bool ar5008_hw_ani_control_old(struct ath_hw *ah,
case ATH9K_ANI_PRESENT: case ATH9K_ANI_PRESENT:
break; break;
default: default:
ath_dbg(common, ATH_DBG_ANI, "invalid cmd %u\n", cmd); ath_dbg(common, ANI, "invalid cmd %u\n", cmd);
return false; return false;
} }
ath_dbg(common, ATH_DBG_ANI, "ANI parameters:\n"); ath_dbg(common, ANI, "ANI parameters:\n");
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetectOff=%d\n", "noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetectOff=%d\n",
aniState->noiseImmunityLevel, aniState->noiseImmunityLevel,
aniState->spurImmunityLevel, aniState->spurImmunityLevel,
!aniState->ofdmWeakSigDetectOff); !aniState->ofdmWeakSigDetectOff);
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"cckWeakSigThreshold=%d, firstepLevel=%d, listenTime=%d\n", "cckWeakSigThreshold=%d, firstepLevel=%d, listenTime=%d\n",
aniState->cckWeakSigThreshold, aniState->cckWeakSigThreshold,
aniState->firstepLevel, aniState->firstepLevel,
aniState->listenTime); aniState->listenTime);
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI, "ofdmPhyErrCount=%d, cckPhyErrCount=%d\n\n",
"ofdmPhyErrCount=%d, cckPhyErrCount=%d\n\n",
aniState->ofdmPhyErrCount, aniState->ofdmPhyErrCount,
aniState->cckPhyErrCount); aniState->cckPhyErrCount);
...@@ -1295,7 +1291,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1295,7 +1291,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
if (!on != aniState->ofdmWeakSigDetectOff) { if (!on != aniState->ofdmWeakSigDetectOff) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"** ch %d: ofdm weak signal: %s=>%s\n", "** ch %d: ofdm weak signal: %s=>%s\n",
chan->channel, chan->channel,
!aniState->ofdmWeakSigDetectOff ? !aniState->ofdmWeakSigDetectOff ?
...@@ -1313,7 +1309,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1313,7 +1309,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
u32 level = param; u32 level = param;
if (level >= ARRAY_SIZE(firstep_table)) { if (level >= ARRAY_SIZE(firstep_table)) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"ATH9K_ANI_FIRSTEP_LEVEL: level out of range (%u > %zu)\n", "ATH9K_ANI_FIRSTEP_LEVEL: level out of range (%u > %zu)\n",
level, ARRAY_SIZE(firstep_table)); level, ARRAY_SIZE(firstep_table));
return false; return false;
...@@ -1350,7 +1346,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1350,7 +1346,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
AR_PHY_FIND_SIG_FIRSTEP_LOW, value2); AR_PHY_FIND_SIG_FIRSTEP_LOW, value2);
if (level != aniState->firstepLevel) { if (level != aniState->firstepLevel) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"** ch %d: level %d=>%d[def:%d] firstep[level]=%d ini=%d\n", "** ch %d: level %d=>%d[def:%d] firstep[level]=%d ini=%d\n",
chan->channel, chan->channel,
aniState->firstepLevel, aniState->firstepLevel,
...@@ -1358,7 +1354,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1358,7 +1354,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
ATH9K_ANI_FIRSTEP_LVL_NEW, ATH9K_ANI_FIRSTEP_LVL_NEW,
value, value,
aniState->iniDef.firstep); aniState->iniDef.firstep);
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"** ch %d: level %d=>%d[def:%d] firstep_low[level]=%d ini=%d\n", "** ch %d: level %d=>%d[def:%d] firstep_low[level]=%d ini=%d\n",
chan->channel, chan->channel,
aniState->firstepLevel, aniState->firstepLevel,
...@@ -1378,7 +1374,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1378,7 +1374,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
u32 level = param; u32 level = param;
if (level >= ARRAY_SIZE(cycpwrThr1_table)) { if (level >= ARRAY_SIZE(cycpwrThr1_table)) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%u > %zu)\n", "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%u > %zu)\n",
level, ARRAY_SIZE(cycpwrThr1_table)); level, ARRAY_SIZE(cycpwrThr1_table));
return false; return false;
...@@ -1414,7 +1410,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1414,7 +1410,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
AR_PHY_EXT_TIMING5_CYCPWR_THR1, value2); AR_PHY_EXT_TIMING5_CYCPWR_THR1, value2);
if (level != aniState->spurImmunityLevel) { if (level != aniState->spurImmunityLevel) {
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"** ch %d: level %d=>%d[def:%d] cycpwrThr1[level]=%d ini=%d\n", "** ch %d: level %d=>%d[def:%d] cycpwrThr1[level]=%d ini=%d\n",
chan->channel, chan->channel,
aniState->spurImmunityLevel, aniState->spurImmunityLevel,
...@@ -1422,7 +1418,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1422,7 +1418,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, ATH9K_ANI_SPUR_IMMUNE_LVL_NEW,
value, value,
aniState->iniDef.cycpwrThr1); aniState->iniDef.cycpwrThr1);
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"** ch %d: level %d=>%d[def:%d] cycpwrThr1Ext[level]=%d ini=%d\n", "** ch %d: level %d=>%d[def:%d] cycpwrThr1Ext[level]=%d ini=%d\n",
chan->channel, chan->channel,
aniState->spurImmunityLevel, aniState->spurImmunityLevel,
...@@ -1448,11 +1444,11 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, ...@@ -1448,11 +1444,11 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah,
case ATH9K_ANI_PRESENT: case ATH9K_ANI_PRESENT:
break; break;
default: default:
ath_dbg(common, ATH_DBG_ANI, "invalid cmd %u\n", cmd); ath_dbg(common, ANI, "invalid cmd %u\n", cmd);
return false; return false;
} }
ath_dbg(common, ATH_DBG_ANI, ath_dbg(common, ANI,
"ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n",
aniState->spurImmunityLevel, aniState->spurImmunityLevel,
!aniState->ofdmWeakSigDetectOff ? "on" : "off", !aniState->ofdmWeakSigDetectOff ? "on" : "off",
...@@ -1506,7 +1502,7 @@ static void ar5008_hw_ani_cache_ini_regs(struct ath_hw *ah) ...@@ -1506,7 +1502,7 @@ static void ar5008_hw_ani_cache_ini_regs(struct ath_hw *ah)
iniDef = &aniState->iniDef; iniDef = &aniState->iniDef;
ath_dbg(common, ATH_DBG_ANI, "ver %d.%d opmode %u chan %d Mhz/0x%x\n", ath_dbg(common, ANI, "ver %d.%d opmode %u chan %d Mhz/0x%x\n",
ah->hw_version.macVersion, ah->hw_version.macVersion,
ah->hw_version.macRev, ah->hw_version.macRev,
ah->opmode, ah->opmode,
......
...@@ -61,18 +61,16 @@ static void ar9002_hw_setup_calibration(struct ath_hw *ah, ...@@ -61,18 +61,16 @@ static void ar9002_hw_setup_calibration(struct ath_hw *ah,
switch (currCal->calData->calType) { switch (currCal->calData->calType) {
case IQ_MISMATCH_CAL: case IQ_MISMATCH_CAL:
REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ); REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"starting IQ Mismatch Calibration\n"); "starting IQ Mismatch Calibration\n");
break; break;
case ADC_GAIN_CAL: case ADC_GAIN_CAL:
REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_GAIN); REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_GAIN);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "starting ADC Gain Calibration\n");
"starting ADC Gain Calibration\n");
break; break;
case ADC_DC_CAL: case ADC_DC_CAL:
REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_PER); REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_PER);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "starting ADC DC Calibration\n");
"starting ADC DC Calibration\n");
break; break;
} }
...@@ -129,7 +127,7 @@ static void ar9002_hw_iqcal_collect(struct ath_hw *ah) ...@@ -129,7 +127,7 @@ static void ar9002_hw_iqcal_collect(struct ath_hw *ah)
REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); REG_READ(ah, AR_PHY_CAL_MEAS_1(i));
ah->totalIqCorrMeas[i] += ah->totalIqCorrMeas[i] +=
(int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i));
ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, ath_dbg(ath9k_hw_common(ah), CALIBRATE,
"%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n",
ah->cal_samples, i, ah->totalPowerMeasI[i], ah->cal_samples, i, ah->totalPowerMeasI[i],
ah->totalPowerMeasQ[i], ah->totalPowerMeasQ[i],
...@@ -151,7 +149,7 @@ static void ar9002_hw_adc_gaincal_collect(struct ath_hw *ah) ...@@ -151,7 +149,7 @@ static void ar9002_hw_adc_gaincal_collect(struct ath_hw *ah)
ah->totalAdcQEvenPhase[i] += ah->totalAdcQEvenPhase[i] +=
REG_READ(ah, AR_PHY_CAL_MEAS_3(i)); REG_READ(ah, AR_PHY_CAL_MEAS_3(i));
ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, ath_dbg(ath9k_hw_common(ah), CALIBRATE,
"%d: Chn %d oddi=0x%08x; eveni=0x%08x; oddq=0x%08x; evenq=0x%08x;\n", "%d: Chn %d oddi=0x%08x; eveni=0x%08x; oddq=0x%08x; evenq=0x%08x;\n",
ah->cal_samples, i, ah->cal_samples, i,
ah->totalAdcIOddPhase[i], ah->totalAdcIOddPhase[i],
...@@ -175,7 +173,7 @@ static void ar9002_hw_adc_dccal_collect(struct ath_hw *ah) ...@@ -175,7 +173,7 @@ static void ar9002_hw_adc_dccal_collect(struct ath_hw *ah)
ah->totalAdcDcOffsetQEvenPhase[i] += ah->totalAdcDcOffsetQEvenPhase[i] +=
(int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_3(i)); (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_3(i));
ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, ath_dbg(ath9k_hw_common(ah), CALIBRATE,
"%d: Chn %d oddi=0x%08x; eveni=0x%08x; oddq=0x%08x; evenq=0x%08x;\n", "%d: Chn %d oddi=0x%08x; eveni=0x%08x; oddq=0x%08x; evenq=0x%08x;\n",
ah->cal_samples, i, ah->cal_samples, i,
ah->totalAdcDcOffsetIOddPhase[i], ah->totalAdcDcOffsetIOddPhase[i],
...@@ -198,11 +196,11 @@ static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) ...@@ -198,11 +196,11 @@ static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
powerMeasQ = ah->totalPowerMeasQ[i]; powerMeasQ = ah->totalPowerMeasQ[i];
iqCorrMeas = ah->totalIqCorrMeas[i]; iqCorrMeas = ah->totalIqCorrMeas[i];
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Starting IQ Cal and Correction for Chain %d\n", "Starting IQ Cal and Correction for Chain %d\n",
i); i);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Original: Chn %d iq_corr_meas = 0x%08x\n", "Original: Chn %d iq_corr_meas = 0x%08x\n",
i, ah->totalIqCorrMeas[i]); i, ah->totalIqCorrMeas[i]);
...@@ -213,12 +211,11 @@ static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) ...@@ -213,12 +211,11 @@ static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
iqCorrNeg = 1; iqCorrNeg = 1;
} }
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_i = 0x%08x\n",
"Chn %d pwr_meas_i = 0x%08x\n", i, powerMeasI); i, powerMeasI);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_q = 0x%08x\n",
"Chn %d pwr_meas_q = 0x%08x\n", i, powerMeasQ); i, powerMeasQ);
ath_dbg(common, ATH_DBG_CALIBRATE, "iqCorrNeg is 0x%08x\n", ath_dbg(common, CALIBRATE, "iqCorrNeg is 0x%08x\n", iqCorrNeg);
iqCorrNeg);
iCoffDenom = (powerMeasI / 2 + powerMeasQ / 2) / 128; iCoffDenom = (powerMeasI / 2 + powerMeasQ / 2) / 128;
qCoffDenom = powerMeasQ / 64; qCoffDenom = powerMeasQ / 64;
...@@ -227,13 +224,13 @@ static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) ...@@ -227,13 +224,13 @@ static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
(qCoffDenom != 0)) { (qCoffDenom != 0)) {
iCoff = iqCorrMeas / iCoffDenom; iCoff = iqCorrMeas / iCoffDenom;
qCoff = powerMeasI / qCoffDenom - 64; qCoff = powerMeasI / qCoffDenom - 64;
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d iCoff = 0x%08x\n",
"Chn %d iCoff = 0x%08x\n", i, iCoff); i, iCoff);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d qCoff = 0x%08x\n",
"Chn %d qCoff = 0x%08x\n", i, qCoff); i, qCoff);
iCoff = iCoff & 0x3f; iCoff = iCoff & 0x3f;
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"New: Chn %d iCoff = 0x%08x\n", i, iCoff); "New: Chn %d iCoff = 0x%08x\n", i, iCoff);
if (iqCorrNeg == 0x0) if (iqCorrNeg == 0x0)
iCoff = 0x40 - iCoff; iCoff = 0x40 - iCoff;
...@@ -243,7 +240,7 @@ static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) ...@@ -243,7 +240,7 @@ static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
else if (qCoff <= -16) else if (qCoff <= -16)
qCoff = -16; qCoff = -16;
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Chn %d : iCoff = 0x%x qCoff = 0x%x\n", "Chn %d : iCoff = 0x%x qCoff = 0x%x\n",
i, iCoff, qCoff); i, iCoff, qCoff);
...@@ -253,7 +250,7 @@ static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) ...@@ -253,7 +250,7 @@ static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(i), REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(i),
AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF, AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF,
qCoff); qCoff);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"IQ Cal and Correction done for Chain %d\n", "IQ Cal and Correction done for Chain %d\n",
i); i);
} }
...@@ -275,21 +272,17 @@ static void ar9002_hw_adc_gaincal_calibrate(struct ath_hw *ah, u8 numChains) ...@@ -275,21 +272,17 @@ static void ar9002_hw_adc_gaincal_calibrate(struct ath_hw *ah, u8 numChains)
qOddMeasOffset = ah->totalAdcQOddPhase[i]; qOddMeasOffset = ah->totalAdcQOddPhase[i];
qEvenMeasOffset = ah->totalAdcQEvenPhase[i]; qEvenMeasOffset = ah->totalAdcQEvenPhase[i];
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Starting ADC Gain Cal for Chain %d\n", i); "Starting ADC Gain Cal for Chain %d\n", i);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_odd_i = 0x%08x\n",
"Chn %d pwr_meas_odd_i = 0x%08x\n", i, i, iOddMeasOffset);
iOddMeasOffset); ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_even_i = 0x%08x\n",
ath_dbg(common, ATH_DBG_CALIBRATE, i, iEvenMeasOffset);
"Chn %d pwr_meas_even_i = 0x%08x\n", i, ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_odd_q = 0x%08x\n",
iEvenMeasOffset); i, qOddMeasOffset);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_even_q = 0x%08x\n",
"Chn %d pwr_meas_odd_q = 0x%08x\n", i, i, qEvenMeasOffset);
qOddMeasOffset);
ath_dbg(common, ATH_DBG_CALIBRATE,
"Chn %d pwr_meas_even_q = 0x%08x\n", i,
qEvenMeasOffset);
if (iOddMeasOffset != 0 && qEvenMeasOffset != 0) { if (iOddMeasOffset != 0 && qEvenMeasOffset != 0) {
iGainMismatch = iGainMismatch =
...@@ -299,19 +292,19 @@ static void ar9002_hw_adc_gaincal_calibrate(struct ath_hw *ah, u8 numChains) ...@@ -299,19 +292,19 @@ static void ar9002_hw_adc_gaincal_calibrate(struct ath_hw *ah, u8 numChains)
((qOddMeasOffset * 32) / ((qOddMeasOffset * 32) /
qEvenMeasOffset) & 0x3f; qEvenMeasOffset) & 0x3f;
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Chn %d gain_mismatch_i = 0x%08x\n", i, "Chn %d gain_mismatch_i = 0x%08x\n",
iGainMismatch); i, iGainMismatch);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Chn %d gain_mismatch_q = 0x%08x\n", i, "Chn %d gain_mismatch_q = 0x%08x\n",
qGainMismatch); i, qGainMismatch);
val = REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i)); val = REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i));
val &= 0xfffff000; val &= 0xfffff000;
val |= (qGainMismatch) | (iGainMismatch << 6); val |= (qGainMismatch) | (iGainMismatch << 6);
REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val); REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"ADC Gain Cal done for Chain %d\n", i); "ADC Gain Cal done for Chain %d\n", i);
} }
} }
...@@ -337,40 +330,36 @@ static void ar9002_hw_adc_dccal_calibrate(struct ath_hw *ah, u8 numChains) ...@@ -337,40 +330,36 @@ static void ar9002_hw_adc_dccal_calibrate(struct ath_hw *ah, u8 numChains)
qOddMeasOffset = ah->totalAdcDcOffsetQOddPhase[i]; qOddMeasOffset = ah->totalAdcDcOffsetQOddPhase[i];
qEvenMeasOffset = ah->totalAdcDcOffsetQEvenPhase[i]; qEvenMeasOffset = ah->totalAdcDcOffsetQEvenPhase[i];
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Starting ADC DC Offset Cal for Chain %d\n", i); "Starting ADC DC Offset Cal for Chain %d\n", i);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_odd_i = %d\n",
"Chn %d pwr_meas_odd_i = %d\n", i, i, iOddMeasOffset);
iOddMeasOffset); ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_even_i = %d\n",
ath_dbg(common, ATH_DBG_CALIBRATE, i, iEvenMeasOffset);
"Chn %d pwr_meas_even_i = %d\n", i, ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_odd_q = %d\n",
iEvenMeasOffset); i, qOddMeasOffset);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_even_q = %d\n",
"Chn %d pwr_meas_odd_q = %d\n", i, i, qEvenMeasOffset);
qOddMeasOffset);
ath_dbg(common, ATH_DBG_CALIBRATE,
"Chn %d pwr_meas_even_q = %d\n", i,
qEvenMeasOffset);
iDcMismatch = (((iEvenMeasOffset - iOddMeasOffset) * 2) / iDcMismatch = (((iEvenMeasOffset - iOddMeasOffset) * 2) /
numSamples) & 0x1ff; numSamples) & 0x1ff;
qDcMismatch = (((qOddMeasOffset - qEvenMeasOffset) * 2) / qDcMismatch = (((qOddMeasOffset - qEvenMeasOffset) * 2) /
numSamples) & 0x1ff; numSamples) & 0x1ff;
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Chn %d dc_offset_mismatch_i = 0x%08x\n", i, "Chn %d dc_offset_mismatch_i = 0x%08x\n",
iDcMismatch); i, iDcMismatch);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Chn %d dc_offset_mismatch_q = 0x%08x\n", i, "Chn %d dc_offset_mismatch_q = 0x%08x\n",
qDcMismatch); i, qDcMismatch);
val = REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i)); val = REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i));
val &= 0xc0000fff; val &= 0xc0000fff;
val |= (qDcMismatch << 12) | (iDcMismatch << 21); val |= (qDcMismatch << 12) | (iDcMismatch << 21);
REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val); REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"ADC DC Offset Cal done for Chain %d\n", i); "ADC DC Offset Cal done for Chain %d\n", i);
} }
...@@ -560,7 +549,7 @@ static inline void ar9285_hw_pa_cal(struct ath_hw *ah, bool is_reset) ...@@ -560,7 +549,7 @@ static inline void ar9285_hw_pa_cal(struct ath_hw *ah, bool is_reset)
{ 0x7838, 0 }, { 0x7838, 0 },
}; };
ath_dbg(common, ATH_DBG_CALIBRATE, "Running PA Calibration\n"); ath_dbg(common, CALIBRATE, "Running PA Calibration\n");
/* PA CAL is not needed for high power solution */ /* PA CAL is not needed for high power solution */
if (ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE) == if (ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE) ==
...@@ -741,7 +730,7 @@ static bool ar9285_hw_cl_cal(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -741,7 +730,7 @@ static bool ar9285_hw_cl_cal(struct ath_hw *ah, struct ath9k_channel *chan)
REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL); REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL);
if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL,
AR_PHY_AGC_CONTROL_CAL, 0, AH_WAIT_TIMEOUT)) { AR_PHY_AGC_CONTROL_CAL, 0, AH_WAIT_TIMEOUT)) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"offset calibration failed to complete in 1ms; noisy environment?\n"); "offset calibration failed to complete in 1ms; noisy environment?\n");
return false; return false;
} }
...@@ -755,7 +744,7 @@ static bool ar9285_hw_cl_cal(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -755,7 +744,7 @@ static bool ar9285_hw_cl_cal(struct ath_hw *ah, struct ath9k_channel *chan)
REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL); REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL);
if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL, if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL,
0, AH_WAIT_TIMEOUT)) { 0, AH_WAIT_TIMEOUT)) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"offset calibration failed to complete in 1ms; noisy environment?\n"); "offset calibration failed to complete in 1ms; noisy environment?\n");
return false; return false;
} }
...@@ -851,7 +840,7 @@ static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -851,7 +840,7 @@ static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL,
AR_PHY_AGC_CONTROL_CAL, AR_PHY_AGC_CONTROL_CAL,
0, AH_WAIT_TIMEOUT)) { 0, AH_WAIT_TIMEOUT)) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"offset calibration failed to complete in 1ms; noisy environment?\n"); "offset calibration failed to complete in 1ms; noisy environment?\n");
return false; return false;
} }
...@@ -886,22 +875,21 @@ static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -886,22 +875,21 @@ static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
if (ar9002_hw_is_cal_supported(ah, chan, ADC_GAIN_CAL)) { if (ar9002_hw_is_cal_supported(ah, chan, ADC_GAIN_CAL)) {
INIT_CAL(&ah->adcgain_caldata); INIT_CAL(&ah->adcgain_caldata);
INSERT_CAL(ah, &ah->adcgain_caldata); INSERT_CAL(ah, &ah->adcgain_caldata);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"enabling ADC Gain Calibration.\n"); "enabling ADC Gain Calibration\n");
} }
if (ar9002_hw_is_cal_supported(ah, chan, ADC_DC_CAL)) { if (ar9002_hw_is_cal_supported(ah, chan, ADC_DC_CAL)) {
INIT_CAL(&ah->adcdc_caldata); INIT_CAL(&ah->adcdc_caldata);
INSERT_CAL(ah, &ah->adcdc_caldata); INSERT_CAL(ah, &ah->adcdc_caldata);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"enabling ADC DC Calibration.\n"); "enabling ADC DC Calibration\n");
} }
if (ar9002_hw_is_cal_supported(ah, chan, IQ_MISMATCH_CAL)) { if (ar9002_hw_is_cal_supported(ah, chan, IQ_MISMATCH_CAL)) {
INIT_CAL(&ah->iq_caldata); INIT_CAL(&ah->iq_caldata);
INSERT_CAL(ah, &ah->iq_caldata); INSERT_CAL(ah, &ah->iq_caldata);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
"enabling IQ Calibration.\n");
} }
ah->cal_list_curr = ah->cal_list; ah->cal_list_curr = ah->cal_list;
......
...@@ -107,7 +107,7 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) ...@@ -107,7 +107,7 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
} }
if (isr & AR_ISR_RXORN) { if (isr & AR_ISR_RXORN) {
ath_dbg(common, ATH_DBG_INTERRUPT, ath_dbg(common, INTERRUPT,
"receive FIFO overrun interrupt\n"); "receive FIFO overrun interrupt\n");
} }
...@@ -143,24 +143,24 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) ...@@ -143,24 +143,24 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
if (fatal_int) { if (fatal_int) {
if (sync_cause & AR_INTR_SYNC_HOST1_FATAL) { if (sync_cause & AR_INTR_SYNC_HOST1_FATAL) {
ath_dbg(common, ATH_DBG_ANY, ath_dbg(common, ANY,
"received PCI FATAL interrupt\n"); "received PCI FATAL interrupt\n");
} }
if (sync_cause & AR_INTR_SYNC_HOST1_PERR) { if (sync_cause & AR_INTR_SYNC_HOST1_PERR) {
ath_dbg(common, ATH_DBG_ANY, ath_dbg(common, ANY,
"received PCI PERR interrupt\n"); "received PCI PERR interrupt\n");
} }
*masked |= ATH9K_INT_FATAL; *masked |= ATH9K_INT_FATAL;
} }
if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT) { if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT) {
ath_dbg(common, ATH_DBG_INTERRUPT, ath_dbg(common, INTERRUPT,
"AR_INTR_SYNC_RADM_CPL_TIMEOUT\n"); "AR_INTR_SYNC_RADM_CPL_TIMEOUT\n");
REG_WRITE(ah, AR_RC, AR_RC_HOSTIF); REG_WRITE(ah, AR_RC, AR_RC_HOSTIF);
REG_WRITE(ah, AR_RC, 0); REG_WRITE(ah, AR_RC, 0);
*masked |= ATH9K_INT_FATAL; *masked |= ATH9K_INT_FATAL;
} }
if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) { if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) {
ath_dbg(common, ATH_DBG_INTERRUPT, ath_dbg(common, INTERRUPT,
"AR_INTR_SYNC_LOCAL_TIMEOUT\n"); "AR_INTR_SYNC_LOCAL_TIMEOUT\n");
} }
......
...@@ -52,7 +52,7 @@ static void ar9003_hw_setup_calibration(struct ath_hw *ah, ...@@ -52,7 +52,7 @@ static void ar9003_hw_setup_calibration(struct ath_hw *ah,
currCal->calData->calCountMax); currCal->calData->calCountMax);
REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ); REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"starting IQ Mismatch Calibration\n"); "starting IQ Mismatch Calibration\n");
/* Kick-off cal */ /* Kick-off cal */
...@@ -64,7 +64,7 @@ static void ar9003_hw_setup_calibration(struct ath_hw *ah, ...@@ -64,7 +64,7 @@ static void ar9003_hw_setup_calibration(struct ath_hw *ah,
REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_THERM, REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_THERM,
AR_PHY_65NM_CH0_THERM_START, 1); AR_PHY_65NM_CH0_THERM_START, 1);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"starting Temperature Compensation Calibration\n"); "starting Temperature Compensation Calibration\n");
break; break;
} }
...@@ -194,7 +194,7 @@ static void ar9003_hw_iqcal_collect(struct ath_hw *ah) ...@@ -194,7 +194,7 @@ static void ar9003_hw_iqcal_collect(struct ath_hw *ah)
REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); REG_READ(ah, AR_PHY_CAL_MEAS_1(i));
ah->totalIqCorrMeas[i] += ah->totalIqCorrMeas[i] +=
(int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i));
ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, ath_dbg(ath9k_hw_common(ah), CALIBRATE,
"%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n",
ah->cal_samples, i, ah->totalPowerMeasI[i], ah->cal_samples, i, ah->totalPowerMeasI[i],
ah->totalPowerMeasQ[i], ah->totalPowerMeasQ[i],
...@@ -221,11 +221,10 @@ static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) ...@@ -221,11 +221,10 @@ static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
powerMeasQ = ah->totalPowerMeasQ[i]; powerMeasQ = ah->totalPowerMeasQ[i];
iqCorrMeas = ah->totalIqCorrMeas[i]; iqCorrMeas = ah->totalIqCorrMeas[i];
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Starting IQ Cal and Correction for Chain %d\n", "Starting IQ Cal and Correction for Chain %d\n", i);
i);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Original: Chn %d iq_corr_meas = 0x%08x\n", "Original: Chn %d iq_corr_meas = 0x%08x\n",
i, ah->totalIqCorrMeas[i]); i, ah->totalIqCorrMeas[i]);
...@@ -236,12 +235,11 @@ static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) ...@@ -236,12 +235,11 @@ static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
iqCorrNeg = 1; iqCorrNeg = 1;
} }
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_i = 0x%08x\n",
"Chn %d pwr_meas_i = 0x%08x\n", i, powerMeasI); i, powerMeasI);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_q = 0x%08x\n",
"Chn %d pwr_meas_q = 0x%08x\n", i, powerMeasQ); i, powerMeasQ);
ath_dbg(common, ATH_DBG_CALIBRATE, "iqCorrNeg is 0x%08x\n", ath_dbg(common, CALIBRATE, "iqCorrNeg is 0x%08x\n", iqCorrNeg);
iqCorrNeg);
iCoffDenom = (powerMeasI / 2 + powerMeasQ / 2) / 256; iCoffDenom = (powerMeasI / 2 + powerMeasQ / 2) / 256;
qCoffDenom = powerMeasQ / 64; qCoffDenom = powerMeasQ / 64;
...@@ -249,10 +247,10 @@ static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) ...@@ -249,10 +247,10 @@ static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
if ((iCoffDenom != 0) && (qCoffDenom != 0)) { if ((iCoffDenom != 0) && (qCoffDenom != 0)) {
iCoff = iqCorrMeas / iCoffDenom; iCoff = iqCorrMeas / iCoffDenom;
qCoff = powerMeasI / qCoffDenom - 64; qCoff = powerMeasI / qCoffDenom - 64;
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d iCoff = 0x%08x\n",
"Chn %d iCoff = 0x%08x\n", i, iCoff); i, iCoff);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Chn %d qCoff = 0x%08x\n",
"Chn %d qCoff = 0x%08x\n", i, qCoff); i, qCoff);
/* Force bounds on iCoff */ /* Force bounds on iCoff */
if (iCoff >= 63) if (iCoff >= 63)
...@@ -273,10 +271,10 @@ static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) ...@@ -273,10 +271,10 @@ static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
iCoff = iCoff & 0x7f; iCoff = iCoff & 0x7f;
qCoff = qCoff & 0x7f; qCoff = qCoff & 0x7f;
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Chn %d : iCoff = 0x%x qCoff = 0x%x\n", "Chn %d : iCoff = 0x%x qCoff = 0x%x\n",
i, iCoff, qCoff); i, iCoff, qCoff);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Register offset (0x%04x) before update = 0x%x\n", "Register offset (0x%04x) before update = 0x%x\n",
offset_array[i], offset_array[i],
REG_READ(ah, offset_array[i])); REG_READ(ah, offset_array[i]));
...@@ -287,25 +285,25 @@ static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) ...@@ -287,25 +285,25 @@ static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
REG_RMW_FIELD(ah, offset_array[i], REG_RMW_FIELD(ah, offset_array[i],
AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF, AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF,
qCoff); qCoff);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Register offset (0x%04x) QI COFF (bitfields 0x%08x) after update = 0x%x\n", "Register offset (0x%04x) QI COFF (bitfields 0x%08x) after update = 0x%x\n",
offset_array[i], offset_array[i],
AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF, AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF,
REG_READ(ah, offset_array[i])); REG_READ(ah, offset_array[i]));
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Register offset (0x%04x) QQ COFF (bitfields 0x%08x) after update = 0x%x\n", "Register offset (0x%04x) QQ COFF (bitfields 0x%08x) after update = 0x%x\n",
offset_array[i], offset_array[i],
AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF, AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF,
REG_READ(ah, offset_array[i])); REG_READ(ah, offset_array[i]));
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"IQ Cal and Correction done for Chain %d\n", i); "IQ Cal and Correction done for Chain %d\n", i);
} }
} }
REG_SET_BIT(ah, AR_PHY_RX_IQCAL_CORR_B0, REG_SET_BIT(ah, AR_PHY_RX_IQCAL_CORR_B0,
AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE); AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"IQ Cal and Correction (offset 0x%04x) enabled (bit position 0x%08x). New Value 0x%08x\n", "IQ Cal and Correction (offset 0x%04x) enabled (bit position 0x%08x). New Value 0x%08x\n",
(unsigned) (AR_PHY_RX_IQCAL_CORR_B0), (unsigned) (AR_PHY_RX_IQCAL_CORR_B0),
AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE, AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE,
...@@ -349,7 +347,7 @@ static bool ar9003_hw_solve_iq_cal(struct ath_hw *ah, ...@@ -349,7 +347,7 @@ static bool ar9003_hw_solve_iq_cal(struct ath_hw *ah,
f2 = (f1 * f1 + f3 * f3) / result_shift; f2 = (f1 * f1 + f3 * f3) / result_shift;
if (!f2) { if (!f2) {
ath_dbg(common, ATH_DBG_CALIBRATE, "Divide by 0\n"); ath_dbg(common, CALIBRATE, "Divide by 0\n");
return false; return false;
} }
...@@ -470,7 +468,7 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, ...@@ -470,7 +468,7 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
if ((i2_p_q2_a0_d0 == 0) || (i2_p_q2_a0_d1 == 0) || if ((i2_p_q2_a0_d0 == 0) || (i2_p_q2_a0_d1 == 0) ||
(i2_p_q2_a1_d0 == 0) || (i2_p_q2_a1_d1 == 0)) { (i2_p_q2_a1_d0 == 0) || (i2_p_q2_a1_d1 == 0)) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Divide by 0:\n" "Divide by 0:\n"
"a0_d0=%d\n" "a0_d0=%d\n"
"a0_d1=%d\n" "a0_d1=%d\n"
...@@ -510,8 +508,7 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, ...@@ -510,8 +508,7 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
mag2 = ar9003_hw_find_mag_approx(ah, cos_2phi_2, sin_2phi_2); mag2 = ar9003_hw_find_mag_approx(ah, cos_2phi_2, sin_2phi_2);
if ((mag1 == 0) || (mag2 == 0)) { if ((mag1 == 0) || (mag2 == 0)) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Divide by 0: mag1=%d, mag2=%d\n",
"Divide by 0: mag1=%d, mag2=%d\n",
mag1, mag2); mag1, mag2);
return false; return false;
} }
...@@ -529,8 +526,8 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, ...@@ -529,8 +526,8 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
mag_a0_d0, phs_a0_d0, mag_a0_d0, phs_a0_d0,
mag_a1_d0, mag_a1_d0,
phs_a1_d0, solved_eq)) { phs_a1_d0, solved_eq)) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Call to ar9003_hw_solve_iq_cal() failed.\n"); "Call to ar9003_hw_solve_iq_cal() failed\n");
return false; return false;
} }
...@@ -539,12 +536,12 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, ...@@ -539,12 +536,12 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
mag_rx = solved_eq[2]; mag_rx = solved_eq[2];
phs_rx = solved_eq[3]; phs_rx = solved_eq[3];
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"chain %d: mag mismatch=%d phase mismatch=%d\n", "chain %d: mag mismatch=%d phase mismatch=%d\n",
chain_idx, mag_tx/res_scale, phs_tx/res_scale); chain_idx, mag_tx/res_scale, phs_tx/res_scale);
if (res_scale == mag_tx) { if (res_scale == mag_tx) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Divide by 0: mag_tx=%d, res_scale=%d\n", "Divide by 0: mag_tx=%d, res_scale=%d\n",
mag_tx, res_scale); mag_tx, res_scale);
return false; return false;
...@@ -557,8 +554,7 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, ...@@ -557,8 +554,7 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
q_q_coff = (mag_corr_tx * 128 / res_scale); q_q_coff = (mag_corr_tx * 128 / res_scale);
q_i_coff = (phs_corr_tx * 256 / res_scale); q_i_coff = (phs_corr_tx * 256 / res_scale);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "tx chain %d: mag corr=%d phase corr=%d\n",
"tx chain %d: mag corr=%d phase corr=%d\n",
chain_idx, q_q_coff, q_i_coff); chain_idx, q_q_coff, q_i_coff);
if (q_i_coff < -63) if (q_i_coff < -63)
...@@ -572,12 +568,11 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, ...@@ -572,12 +568,11 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
iqc_coeff[0] = (q_q_coff * 128) + q_i_coff; iqc_coeff[0] = (q_q_coff * 128) + q_i_coff;
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "tx chain %d: iq corr coeff=%x\n",
"tx chain %d: iq corr coeff=%x\n",
chain_idx, iqc_coeff[0]); chain_idx, iqc_coeff[0]);
if (-mag_rx == res_scale) { if (-mag_rx == res_scale) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Divide by 0: mag_rx=%d, res_scale=%d\n", "Divide by 0: mag_rx=%d, res_scale=%d\n",
mag_rx, res_scale); mag_rx, res_scale);
return false; return false;
...@@ -590,8 +585,7 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, ...@@ -590,8 +585,7 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
q_q_coff = (mag_corr_rx * 128 / res_scale); q_q_coff = (mag_corr_rx * 128 / res_scale);
q_i_coff = (phs_corr_rx * 256 / res_scale); q_i_coff = (phs_corr_rx * 256 / res_scale);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "rx chain %d: mag corr=%d phase corr=%d\n",
"rx chain %d: mag corr=%d phase corr=%d\n",
chain_idx, q_q_coff, q_i_coff); chain_idx, q_q_coff, q_i_coff);
if (q_i_coff < -63) if (q_i_coff < -63)
...@@ -605,8 +599,7 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, ...@@ -605,8 +599,7 @@ static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah,
iqc_coeff[1] = (q_q_coff * 128) + q_i_coff; iqc_coeff[1] = (q_q_coff * 128) + q_i_coff;
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "rx chain %d: iq corr coeff=%x\n",
"rx chain %d: iq corr coeff=%x\n",
chain_idx, iqc_coeff[1]); chain_idx, iqc_coeff[1]);
return true; return true;
...@@ -753,8 +746,7 @@ static bool ar9003_hw_tx_iq_cal_run(struct ath_hw *ah) ...@@ -753,8 +746,7 @@ static bool ar9003_hw_tx_iq_cal_run(struct ath_hw *ah)
if (!ath9k_hw_wait(ah, AR_PHY_TX_IQCAL_START, if (!ath9k_hw_wait(ah, AR_PHY_TX_IQCAL_START,
AR_PHY_TX_IQCAL_START_DO_CAL, 0, AR_PHY_TX_IQCAL_START_DO_CAL, 0,
AH_WAIT_TIMEOUT)) { AH_WAIT_TIMEOUT)) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "Tx IQ Cal is not completed\n");
"Tx IQ Cal is not completed.\n");
return false; return false;
} }
return true; return true;
...@@ -792,13 +784,13 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah, bool is_reusable) ...@@ -792,13 +784,13 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah, bool is_reusable)
nmeasurement = MAX_MEASUREMENT; nmeasurement = MAX_MEASUREMENT;
for (im = 0; im < nmeasurement; im++) { for (im = 0; im < nmeasurement; im++) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Doing Tx IQ Cal for chain %d.\n", i); "Doing Tx IQ Cal for chain %d\n", i);
if (REG_READ(ah, txiqcal_status[i]) & if (REG_READ(ah, txiqcal_status[i]) &
AR_PHY_TX_IQCAL_STATUS_FAILED) { AR_PHY_TX_IQCAL_STATUS_FAILED) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Tx IQ Cal failed for chain %d.\n", i); "Tx IQ Cal failed for chain %d\n", i);
goto tx_iqcal_fail; goto tx_iqcal_fail;
} }
...@@ -824,18 +816,16 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah, bool is_reusable) ...@@ -824,18 +816,16 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah, bool is_reusable)
iq_res[idx + 1] = 0xffff & REG_READ(ah, iq_res[idx + 1] = 0xffff & REG_READ(ah,
chan_info_tab[i] + offset); chan_info_tab[i] + offset);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"IQ_RES[%d]=0x%x " "IQ_RES[%d]=0x%x IQ_RES[%d]=0x%x\n",
"IQ_RES[%d]=0x%x\n",
idx, iq_res[idx], idx + 1, idx, iq_res[idx], idx + 1,
iq_res[idx + 1]); iq_res[idx + 1]);
} }
if (!ar9003_hw_calc_iq_corr(ah, i, iq_res, if (!ar9003_hw_calc_iq_corr(ah, i, iq_res,
coeff.iqc_coeff)) { coeff.iqc_coeff)) {
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"Failed in calculation of \ "Failed in calculation of IQ correction\n");
IQ correction.\n");
goto tx_iqcal_fail; goto tx_iqcal_fail;
} }
...@@ -855,7 +845,7 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah, bool is_reusable) ...@@ -855,7 +845,7 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah, bool is_reusable)
return; return;
tx_iqcal_fail: tx_iqcal_fail:
ath_dbg(common, ATH_DBG_CALIBRATE, "Tx IQ Cal failed\n"); ath_dbg(common, CALIBRATE, "Tx IQ Cal failed\n");
return; return;
} }
...@@ -953,7 +943,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, ...@@ -953,7 +943,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
if (!ar9003_hw_rtt_restore(ah, chan)) if (!ar9003_hw_rtt_restore(ah, chan))
run_rtt_cal = true; run_rtt_cal = true;
ath_dbg(common, ATH_DBG_CALIBRATE, "RTT restore %s\n", ath_dbg(common, CALIBRATE, "RTT restore %s\n",
run_rtt_cal ? "failed" : "succeed"); run_rtt_cal ? "failed" : "succeed");
} }
run_agc_cal = run_rtt_cal; run_agc_cal = run_rtt_cal;
...@@ -1016,20 +1006,20 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, ...@@ -1016,20 +1006,20 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
u32 pld[4] = {0, 0, 0, 0}; u32 pld[4] = {0, 0, 0, 0};
/* send CAL_REQ only when BT is AWAKE. */ /* send CAL_REQ only when BT is AWAKE. */
ath_dbg(common, ATH_DBG_MCI, "MCI send WLAN_CAL_REQ 0x%x\n", ath_dbg(common, MCI, "MCI send WLAN_CAL_REQ 0x%x\n",
mci_hw->wlan_cal_seq); mci_hw->wlan_cal_seq);
MCI_GPM_SET_CAL_TYPE(pld, MCI_GPM_WLAN_CAL_REQ); MCI_GPM_SET_CAL_TYPE(pld, MCI_GPM_WLAN_CAL_REQ);
pld[MCI_GPM_WLAN_CAL_W_SEQUENCE] = mci_hw->wlan_cal_seq++; pld[MCI_GPM_WLAN_CAL_W_SEQUENCE] = mci_hw->wlan_cal_seq++;
ar9003_mci_send_message(ah, MCI_GPM, 0, pld, 16, true, false); ar9003_mci_send_message(ah, MCI_GPM, 0, pld, 16, true, false);
/* Wait BT_CAL_GRANT for 50ms */ /* Wait BT_CAL_GRANT for 50ms */
ath_dbg(common, ATH_DBG_MCI, "MCI wait for BT_CAL_GRANT"); ath_dbg(common, MCI, "MCI wait for BT_CAL_GRANT\n");
if (ar9003_mci_wait_for_gpm(ah, MCI_GPM_BT_CAL_GRANT, 0, 50000)) if (ar9003_mci_wait_for_gpm(ah, MCI_GPM_BT_CAL_GRANT, 0, 50000))
ath_dbg(common, ATH_DBG_MCI, "MCI got BT_CAL_GRANT"); ath_dbg(common, MCI, "MCI got BT_CAL_GRANT\n");
else { else {
is_reusable = false; is_reusable = false;
ath_dbg(common, ATH_DBG_MCI, "\nMCI BT is not responding"); ath_dbg(common, MCI, "\nMCI BT is not responding\n");
} }
} }
...@@ -1058,7 +1048,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, ...@@ -1058,7 +1048,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
u32 pld[4] = {0, 0, 0, 0}; u32 pld[4] = {0, 0, 0, 0};
ath_dbg(common, ATH_DBG_MCI, "MCI Send WLAN_CAL_DONE 0x%x\n", ath_dbg(common, MCI, "MCI Send WLAN_CAL_DONE 0x%x\n",
mci_hw->wlan_cal_done); mci_hw->wlan_cal_done);
MCI_GPM_SET_CAL_TYPE(pld, MCI_GPM_WLAN_CAL_DONE); MCI_GPM_SET_CAL_TYPE(pld, MCI_GPM_WLAN_CAL_DONE);
pld[MCI_GPM_WLAN_CAL_W_SEQUENCE] = mci_hw->wlan_cal_done++; pld[MCI_GPM_WLAN_CAL_W_SEQUENCE] = mci_hw->wlan_cal_done++;
...@@ -1074,9 +1064,8 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, ...@@ -1074,9 +1064,8 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
if (run_rtt_cal) if (run_rtt_cal)
ar9003_hw_rtt_disable(ah); ar9003_hw_rtt_disable(ah);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"offset calibration failed to complete in 1ms;" "offset calibration failed to complete in 1ms; noisy environment?\n");
"noisy environment?\n");
return false; return false;
} }
...@@ -1135,15 +1124,14 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, ...@@ -1135,15 +1124,14 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
if (ah->supp_cals & IQ_MISMATCH_CAL) { if (ah->supp_cals & IQ_MISMATCH_CAL) {
INIT_CAL(&ah->iq_caldata); INIT_CAL(&ah->iq_caldata);
INSERT_CAL(ah, &ah->iq_caldata); INSERT_CAL(ah, &ah->iq_caldata);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
"enabling IQ Calibration.\n");
} }
if (ah->supp_cals & TEMP_COMP_CAL) { if (ah->supp_cals & TEMP_COMP_CAL) {
INIT_CAL(&ah->tempCompCalData); INIT_CAL(&ah->tempCompCalData);
INSERT_CAL(ah, &ah->tempCompCalData); INSERT_CAL(ah, &ah->tempCompCalData);
ath_dbg(common, ATH_DBG_CALIBRATE, ath_dbg(common, CALIBRATE,
"enabling Temperature Compensation Calibration.\n"); "enabling Temperature Compensation Calibration\n");
} }
/* Initialize current pointer to first element in list */ /* Initialize current pointer to first element in list */
......
...@@ -3043,8 +3043,7 @@ static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer, ...@@ -3043,8 +3043,7 @@ static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer,
int i; int i;
if ((address < 0) || ((address + count) / 2 > AR9300_EEPROM_SIZE - 1)) { if ((address < 0) || ((address + count) / 2 > AR9300_EEPROM_SIZE - 1)) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "eeprom address not in range\n");
"eeprom address not in range\n");
return false; return false;
} }
...@@ -3075,8 +3074,8 @@ static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer, ...@@ -3075,8 +3074,8 @@ static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer,
return true; return true;
error: error:
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "unable to read eeprom region at offset %d\n",
"unable to read eeprom region at offset %d\n", address); address);
return false; return false;
} }
...@@ -3160,13 +3159,13 @@ static bool ar9300_uncompress_block(struct ath_hw *ah, ...@@ -3160,13 +3159,13 @@ static bool ar9300_uncompress_block(struct ath_hw *ah,
length &= 0xff; length &= 0xff;
if (length > 0 && spot >= 0 && spot+length <= mdataSize) { if (length > 0 && spot >= 0 && spot+length <= mdataSize) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"Restore at %d: spot=%d offset=%d length=%d\n", "Restore at %d: spot=%d offset=%d length=%d\n",
it, spot, offset, length); it, spot, offset, length);
memcpy(&mptr[spot], &block[it+2], length); memcpy(&mptr[spot], &block[it+2], length);
spot += length; spot += length;
} else if (length > 0) { } else if (length > 0) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"Bad restore at %d: spot=%d offset=%d length=%d\n", "Bad restore at %d: spot=%d offset=%d length=%d\n",
it, spot, offset, length); it, spot, offset, length);
return false; return false;
...@@ -3188,13 +3187,13 @@ static int ar9300_compress_decision(struct ath_hw *ah, ...@@ -3188,13 +3187,13 @@ static int ar9300_compress_decision(struct ath_hw *ah,
switch (code) { switch (code) {
case _CompressNone: case _CompressNone:
if (length != mdata_size) { if (length != mdata_size) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"EEPROM structure size mismatch memory=%d eeprom=%d\n", "EEPROM structure size mismatch memory=%d eeprom=%d\n",
mdata_size, length); mdata_size, length);
return -1; return -1;
} }
memcpy(mptr, (u8 *) (word + COMP_HDR_LEN), length); memcpy(mptr, (u8 *) (word + COMP_HDR_LEN), length);
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"restored eeprom %d: uncompressed, length %d\n", "restored eeprom %d: uncompressed, length %d\n",
it, length); it, length);
break; break;
...@@ -3203,22 +3202,21 @@ static int ar9300_compress_decision(struct ath_hw *ah, ...@@ -3203,22 +3202,21 @@ static int ar9300_compress_decision(struct ath_hw *ah,
} else { } else {
eep = ar9003_eeprom_struct_find_by_id(reference); eep = ar9003_eeprom_struct_find_by_id(reference);
if (eep == NULL) { if (eep == NULL) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"can't find reference eeprom struct %d\n", "can't find reference eeprom struct %d\n",
reference); reference);
return -1; return -1;
} }
memcpy(mptr, eep, mdata_size); memcpy(mptr, eep, mdata_size);
} }
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"restore eeprom %d: block, reference %d, length %d\n", "restore eeprom %d: block, reference %d, length %d\n",
it, reference, length); it, reference, length);
ar9300_uncompress_block(ah, mptr, mdata_size, ar9300_uncompress_block(ah, mptr, mdata_size,
(u8 *) (word + COMP_HDR_LEN), length); (u8 *) (word + COMP_HDR_LEN), length);
break; break;
default: default:
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "unknown compression code %d\n", code);
"unknown compression code %d\n", code);
return -1; return -1;
} }
return 0; return 0;
...@@ -3294,34 +3292,32 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah, ...@@ -3294,34 +3292,32 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
cptr = AR9300_BASE_ADDR_512; cptr = AR9300_BASE_ADDR_512;
else else
cptr = AR9300_BASE_ADDR; cptr = AR9300_BASE_ADDR;
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "Trying EEPROM access at Address 0x%04x\n",
"Trying EEPROM access at Address 0x%04x\n", cptr); cptr);
if (ar9300_check_eeprom_header(ah, read, cptr)) if (ar9300_check_eeprom_header(ah, read, cptr))
goto found; goto found;
cptr = AR9300_BASE_ADDR_512; cptr = AR9300_BASE_ADDR_512;
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "Trying EEPROM access at Address 0x%04x\n",
"Trying EEPROM access at Address 0x%04x\n", cptr); cptr);
if (ar9300_check_eeprom_header(ah, read, cptr)) if (ar9300_check_eeprom_header(ah, read, cptr))
goto found; goto found;
read = ar9300_read_otp; read = ar9300_read_otp;
cptr = AR9300_BASE_ADDR; cptr = AR9300_BASE_ADDR;
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "Trying OTP access at Address 0x%04x\n", cptr);
"Trying OTP access at Address 0x%04x\n", cptr);
if (ar9300_check_eeprom_header(ah, read, cptr)) if (ar9300_check_eeprom_header(ah, read, cptr))
goto found; goto found;
cptr = AR9300_BASE_ADDR_512; cptr = AR9300_BASE_ADDR_512;
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "Trying OTP access at Address 0x%04x\n", cptr);
"Trying OTP access at Address 0x%04x\n", cptr);
if (ar9300_check_eeprom_header(ah, read, cptr)) if (ar9300_check_eeprom_header(ah, read, cptr))
goto found; goto found;
goto fail; goto fail;
found: found:
ath_dbg(common, ATH_DBG_EEPROM, "Found valid EEPROM data\n"); ath_dbg(common, EEPROM, "Found valid EEPROM data\n");
for (it = 0; it < MSTATE; it++) { for (it = 0; it < MSTATE; it++) {
if (!read(ah, cptr, word, COMP_HDR_LEN)) if (!read(ah, cptr, word, COMP_HDR_LEN))
...@@ -3332,13 +3328,12 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah, ...@@ -3332,13 +3328,12 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
ar9300_comp_hdr_unpack(word, &code, &reference, ar9300_comp_hdr_unpack(word, &code, &reference,
&length, &major, &minor); &length, &major, &minor);
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n", "Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n",
cptr, code, reference, length, major, minor); cptr, code, reference, length, major, minor);
if ((!AR_SREV_9485(ah) && length >= 1024) || if ((!AR_SREV_9485(ah) && length >= 1024) ||
(AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485)) { (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485)) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "Skipping bad header\n");
"Skipping bad header\n");
cptr -= COMP_HDR_LEN; cptr -= COMP_HDR_LEN;
continue; continue;
} }
...@@ -3347,13 +3342,13 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah, ...@@ -3347,13 +3342,13 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
read(ah, cptr, word, COMP_HDR_LEN + osize + COMP_CKSUM_LEN); read(ah, cptr, word, COMP_HDR_LEN + osize + COMP_CKSUM_LEN);
checksum = ar9300_comp_cksum(&word[COMP_HDR_LEN], length); checksum = ar9300_comp_cksum(&word[COMP_HDR_LEN], length);
mchecksum = get_unaligned_le16(&word[COMP_HDR_LEN + osize]); mchecksum = get_unaligned_le16(&word[COMP_HDR_LEN + osize]);
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "checksum %x %x\n",
"checksum %x %x\n", checksum, mchecksum); checksum, mchecksum);
if (checksum == mchecksum) { if (checksum == mchecksum) {
ar9300_compress_decision(ah, it, code, reference, mptr, ar9300_compress_decision(ah, it, code, reference, mptr,
word, length, mdata_size); word, length, mdata_size);
} else { } else {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"skipping block with bad checksum\n"); "skipping block with bad checksum\n");
} }
cptr -= (COMP_HDR_LEN + osize + COMP_CKSUM_LEN); cptr -= (COMP_HDR_LEN + osize + COMP_CKSUM_LEN);
...@@ -4424,8 +4419,8 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq, ...@@ -4424,8 +4419,8 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq,
is2GHz) + ht40PowerIncForPdadc; is2GHz) + ht40PowerIncForPdadc;
for (i = 0; i < ar9300RateSize; i++) { for (i = 0; i < ar9300RateSize; i++) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "TPC[%02d] 0x%08x\n",
"TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]); i, targetPowerValT2[i]);
} }
} }
...@@ -4444,7 +4439,7 @@ static int ar9003_hw_cal_pier_get(struct ath_hw *ah, ...@@ -4444,7 +4439,7 @@ static int ar9003_hw_cal_pier_get(struct ath_hw *ah,
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
if (ichain >= AR9300_MAX_CHAINS) { if (ichain >= AR9300_MAX_CHAINS) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"Invalid chain index, must be less than %d\n", "Invalid chain index, must be less than %d\n",
AR9300_MAX_CHAINS); AR9300_MAX_CHAINS);
return -1; return -1;
...@@ -4452,7 +4447,7 @@ static int ar9003_hw_cal_pier_get(struct ath_hw *ah, ...@@ -4452,7 +4447,7 @@ static int ar9003_hw_cal_pier_get(struct ath_hw *ah,
if (mode) { /* 5GHz */ if (mode) { /* 5GHz */
if (ipier >= AR9300_NUM_5G_CAL_PIERS) { if (ipier >= AR9300_NUM_5G_CAL_PIERS) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"Invalid 5GHz cal pier index, must be less than %d\n", "Invalid 5GHz cal pier index, must be less than %d\n",
AR9300_NUM_5G_CAL_PIERS); AR9300_NUM_5G_CAL_PIERS);
return -1; return -1;
...@@ -4462,7 +4457,7 @@ static int ar9003_hw_cal_pier_get(struct ath_hw *ah, ...@@ -4462,7 +4457,7 @@ static int ar9003_hw_cal_pier_get(struct ath_hw *ah,
is2GHz = 0; is2GHz = 0;
} else { } else {
if (ipier >= AR9300_NUM_2G_CAL_PIERS) { if (ipier >= AR9300_NUM_2G_CAL_PIERS) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"Invalid 2GHz cal pier index, must be less than %d\n", "Invalid 2GHz cal pier index, must be less than %d\n",
AR9300_NUM_2G_CAL_PIERS); AR9300_NUM_2G_CAL_PIERS);
return -1; return -1;
...@@ -4624,8 +4619,7 @@ static int ar9003_hw_calibration_apply(struct ath_hw *ah, int frequency) ...@@ -4624,8 +4619,7 @@ static int ar9003_hw_calibration_apply(struct ath_hw *ah, int frequency)
/* interpolate */ /* interpolate */
for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) { for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "ch=%d f=%d low=%d %d h=%d %d\n",
"ch=%d f=%d low=%d %d h=%d %d\n",
ichain, frequency, lfrequency[ichain], ichain, frequency, lfrequency[ichain],
lcorrection[ichain], hfrequency[ichain], lcorrection[ichain], hfrequency[ichain],
hcorrection[ichain]); hcorrection[ichain]);
...@@ -4680,7 +4674,7 @@ static int ar9003_hw_calibration_apply(struct ath_hw *ah, int frequency) ...@@ -4680,7 +4674,7 @@ static int ar9003_hw_calibration_apply(struct ath_hw *ah, int frequency)
ar9003_hw_power_control_override(ah, frequency, correction, voltage, ar9003_hw_power_control_override(ah, frequency, correction, voltage,
temperature); temperature);
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"for frequency=%d, calibration correction = %d %d %d\n", "for frequency=%d, calibration correction = %d %d %d\n",
frequency, correction[0], correction[1], correction[2]); frequency, correction[0], correction[1], correction[2]);
...@@ -4866,7 +4860,7 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah, ...@@ -4866,7 +4860,7 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah,
else else
freq = centers.ctl_center; freq = centers.ctl_center;
ath_dbg(common, ATH_DBG_REGULATORY, ath_dbg(common, REGULATORY,
"LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, EXT_ADDITIVE %d\n", "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, EXT_ADDITIVE %d\n",
ctlMode, numCtlModes, isHt40CtlMode, ctlMode, numCtlModes, isHt40CtlMode,
(pCtlMode[ctlMode] & EXT_ADDITIVE)); (pCtlMode[ctlMode] & EXT_ADDITIVE));
...@@ -4882,7 +4876,7 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah, ...@@ -4882,7 +4876,7 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah,
twiceMaxEdgePower = MAX_RATE_POWER; twiceMaxEdgePower = MAX_RATE_POWER;
for (i = 0; (i < ctlNum) && ctlIndex[i]; i++) { for (i = 0; (i < ctlNum) && ctlIndex[i]; i++) {
ath_dbg(common, ATH_DBG_REGULATORY, ath_dbg(common, REGULATORY,
"LOOP-Ctlidx %d: cfgCtl 0x%2.2x pCtlMode 0x%2.2x ctlIndex 0x%2.2x chan %d\n", "LOOP-Ctlidx %d: cfgCtl 0x%2.2x pCtlMode 0x%2.2x ctlIndex 0x%2.2x chan %d\n",
i, cfgCtl, pCtlMode[ctlMode], ctlIndex[i], i, cfgCtl, pCtlMode[ctlMode], ctlIndex[i],
chan->channel); chan->channel);
...@@ -4924,7 +4918,7 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah, ...@@ -4924,7 +4918,7 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah,
minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower); minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower);
ath_dbg(common, ATH_DBG_REGULATORY, ath_dbg(common, REGULATORY,
"SEL-Min ctlMode %d pCtlMode %d 2xMaxEdge %d sP %d minCtlPwr %d\n", "SEL-Min ctlMode %d pCtlMode %d 2xMaxEdge %d sP %d minCtlPwr %d\n",
ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower, ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower,
scaledPower, minCtlPower); scaledPower, minCtlPower);
...@@ -5048,7 +5042,7 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah, ...@@ -5048,7 +5042,7 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
target_power_val_t2_eep[i]) > target_power_val_t2_eep[i]) >
paprd_scale_factor)) { paprd_scale_factor)) {
ah->paprd_ratemask &= ~(1 << i); ah->paprd_ratemask &= ~(1 << i);
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM,
"paprd disabled for mcs %d\n", i); "paprd disabled for mcs %d\n", i);
} }
} }
...@@ -5066,8 +5060,8 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah, ...@@ -5066,8 +5060,8 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
return; return;
for (i = 0; i < ar9300RateSize; i++) { for (i = 0; i < ar9300RateSize; i++) {
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "TPC[%02d] 0x%08x\n",
"TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]); i, targetPowerValT2[i]);
} }
ah->txpower_limit = regulatory->max_power_level; ah->txpower_limit = regulatory->max_power_level;
......
...@@ -305,10 +305,8 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) ...@@ -305,10 +305,8 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
raw_intr = REG_READ(ah, AR_MCI_INTERRUPT_RAW); raw_intr = REG_READ(ah, AR_MCI_INTERRUPT_RAW);
if ((raw_intr == 0xdeadbeef) || (rx_msg_intr == 0xdeadbeef)) if ((raw_intr == 0xdeadbeef) || (rx_msg_intr == 0xdeadbeef))
ath_dbg(common, ATH_DBG_MCI, ath_dbg(common, MCI,
"MCI gets 0xdeadbeef during MCI int processing" "MCI gets 0xdeadbeef during MCI int processing new raw_intr=0x%08x, new rx_msg_raw=0x%08x, raw_intr=0x%08x, rx_msg_raw=0x%08x\n",
"new raw_intr=0x%08x, new rx_msg_raw=0x%08x, "
"raw_intr=0x%08x, rx_msg_raw=0x%08x\n",
raw_intr, rx_msg_intr, mci->raw_intr, raw_intr, rx_msg_intr, mci->raw_intr,
mci->rx_msg_intr); mci->rx_msg_intr);
else { else {
...@@ -322,7 +320,7 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) ...@@ -322,7 +320,7 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, rx_msg_intr); REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, rx_msg_intr);
REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, raw_intr); REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, raw_intr);
ath_dbg(common, ATH_DBG_MCI, "AR_INTR_SYNC_MCI\n"); ath_dbg(common, MCI, "AR_INTR_SYNC_MCI\n");
} }
} }
...@@ -335,7 +333,7 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) ...@@ -335,7 +333,7 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
} }
if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT)
ath_dbg(common, ATH_DBG_INTERRUPT, ath_dbg(common, INTERRUPT,
"AR_INTR_SYNC_LOCAL_TIMEOUT\n"); "AR_INTR_SYNC_LOCAL_TIMEOUT\n");
REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause); REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause);
...@@ -366,7 +364,7 @@ static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds, ...@@ -366,7 +364,7 @@ static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
if ((MS(ads->ds_info, AR_DescId) != ATHEROS_VENDOR_ID) || if ((MS(ads->ds_info, AR_DescId) != ATHEROS_VENDOR_ID) ||
(MS(ads->ds_info, AR_TxRxDesc) != 1)) { (MS(ads->ds_info, AR_TxRxDesc) != 1)) {
ath_dbg(ath9k_hw_common(ah), ATH_DBG_XMIT, ath_dbg(ath9k_hw_common(ah), XMIT,
"Tx Descriptor error %x\n", ads->ds_info); "Tx Descriptor error %x\n", ads->ds_info);
memset(ads, 0, sizeof(*ads)); memset(ads, 0, sizeof(*ads));
return -EIO; return -EIO;
...@@ -574,7 +572,7 @@ void ath9k_hw_reset_txstatus_ring(struct ath_hw *ah) ...@@ -574,7 +572,7 @@ void ath9k_hw_reset_txstatus_ring(struct ath_hw *ah)
memset((void *) ah->ts_ring, 0, memset((void *) ah->ts_ring, 0,
ah->ts_size * sizeof(struct ar9003_txs)); ah->ts_size * sizeof(struct ar9003_txs));
ath_dbg(ath9k_hw_common(ah), ATH_DBG_XMIT, ath_dbg(ath9k_hw_common(ah), XMIT,
"TS Start 0x%x End 0x%x Virt %p, Size %d\n", "TS Start 0x%x End 0x%x Virt %p, Size %d\n",
ah->ts_paddr_start, ah->ts_paddr_end, ah->ts_paddr_start, ah->ts_paddr_end,
ah->ts_ring, ah->ts_size); ah->ts_ring, ah->ts_size);
......
...@@ -196,6 +196,7 @@ struct ath_txq { ...@@ -196,6 +196,7 @@ struct ath_txq {
u8 txq_headidx; u8 txq_headidx;
u8 txq_tailidx; u8 txq_tailidx;
int pending_frames; int pending_frames;
struct sk_buff_head complete_q;
}; };
struct ath_atx_ac { struct ath_atx_ac {
......
...@@ -305,8 +305,7 @@ void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah) ...@@ -305,8 +305,7 @@ void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah)
regulatory->max_power_level += INCREASE_MAXPOW_BY_THREE_CHAIN; regulatory->max_power_level += INCREASE_MAXPOW_BY_THREE_CHAIN;
break; break;
default: default:
ath_dbg(common, ATH_DBG_EEPROM, ath_dbg(common, EEPROM, "Invalid chainmask configuration\n");
"Invalid chainmask configuration\n");
break; break;
} }
} }
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册