[PATCH v2] wlcore: add basic device-tree support

2015-02-15 Thread Eliad Peller
When running with device-tree, we no longer have a board file
that can set up the platform data for wlcore.
Allow this data to be passed from DT.

For now, parse only the irq used. Other (optional) properties
can be added later on.

Signed-off-by: Ido Yariv i...@wizery.com
Signed-off-by: Eliad Peller el...@wizery.com
---
previous submission of this patch got lost somewhere.

this patch follows the expected way to pass SDIO function DT
information, as was recently added by this patchset:
http://www.spinics.net/lists/linux-mmc/msg27353.html

 .../devicetree/bindings/net/wireless/ti,wlcore.txt | 31 +++
 drivers/net/wireless/ti/wlcore/sdio.c  | 65 --
 2 files changed, 90 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt 
b/Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt
new file mode 100644
index 000..df9af48
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt
@@ -0,0 +1,31 @@
+TI Wilink (wlcore) SDIO devices
+
+This node provides properties for controlling the wilink wireless device. The
+node is expected to be specified as a child node to the SDIO controller that
+connects the device to the system.
+
+Required properties:
+
+ - compatible : Should be ti,wlcore.
+ - interrupt-parent : the phandle for the interrupt controller to which the
+   device interrupts are connected.
+ - interrupts : specifies attributes for the out-of-band interrupt.
+
+Example:
+
+mmc3 {
+   status = okay;
+   vmmc-supply = wlan_en_reg;
+   bus-width = 4;
+   cap-power-off-card;
+   keep-power-in-suspend;
+
+   #address-cells = 1;
+   #size-cells = 0;
+   wlcore: wlcore@0 {
+   compatible = ti,wlcore;
+   reg = 2;
+   interrupt-parent = gpio0;
+   interrupts = 19 IRQ_TYPE_NONE;
+   };
+};
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c 
b/drivers/net/wireless/ti/wlcore/sdio.c
index d3dd7bf..317796b 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -34,6 +34,8 @@
 #include linux/wl12xx.h
 #include linux/pm_runtime.h
 #include linux/printk.h
+#include linux/of.h
+#include linux/of_irq.h
 
 #include wlcore.h
 #include wl12xx_80211.h
@@ -214,6 +216,54 @@ static struct wl1271_if_operations sdio_ops = {
.set_block_size = wl1271_sdio_set_block_size,
 };
 
+#ifdef CONFIG_OF
+static struct wl12xx_platform_data *wlcore_probe_of(struct device *dev)
+{
+   struct device_node *np = dev-of_node;
+   struct wl12xx_platform_data *pdata;
+
+   if (!np || !of_device_is_compatible(np, ti,wlcore)) {
+   dev_err(dev, No platform data set\n);
+   return NULL;
+   }
+
+   pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+   if (!pdata)
+   return NULL;
+
+   pdata-irq = irq_of_parse_and_map(np, 0);
+   if (!pdata-irq) {
+   dev_err(dev, No irq in platform data\n);
+   kfree(pdata);
+   return NULL;
+   }
+
+   return pdata;
+}
+#else
+static struct wl12xx_platform_data *wlcore_probe_of(struct device *dev)
+{
+   return NULL;
+}
+#endif
+
+static struct wl12xx_platform_data *
+wlcore_get_platform_data(struct device *dev)
+{
+   struct wl12xx_platform_data *pdata;
+
+   pdata = wl12xx_get_platform_data();
+   if (!IS_ERR(pdata))
+   return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL);
+
+   return wlcore_probe_of(dev);
+}
+
+static void wlcore_del_platform_data(struct wl12xx_platform_data *pdata)
+{
+   kfree(pdata);
+}
+
 static int wl1271_probe(struct sdio_func *func,
  const struct sdio_device_id *id)
 {
@@ -245,12 +295,9 @@ static int wl1271_probe(struct sdio_func *func,
/* Use block mode for transferring over one block size of data */
func-card-quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
 
-   pdev_data.pdata = wl12xx_get_platform_data();
-   if (IS_ERR(pdev_data.pdata)) {
-   ret = PTR_ERR(pdev_data.pdata);
-   dev_err(glue-dev, missing wlan platform data: %d\n, ret);
+   pdev_data.pdata = wlcore_get_platform_data(func-dev);
+   if (!pdev_data.pdata)
goto out_free_glue;
-   }
 
/* if sdio can keep power while host is suspended, enable wow */
mmcflags = sdio_get_host_pm_caps(func);
@@ -279,7 +326,7 @@ static int wl1271_probe(struct sdio_func *func,
if (!glue-core) {
dev_err(glue-dev, can't allocate platform_device);
ret = -ENOMEM;
-   goto out_free_glue;
+   goto out_free_pdata;
}
 
glue-core-dev.parent = func-dev;
@@ -313,6 +360,9 @@ static int wl1271_probe(struct sdio_func *func,
 out_dev_put:
platform_device_put(glue-core);
 
+out_free_pdata:

Re: [PATCH v3] brcmfmac: avoid duplicated suspend/resume operation

2015-02-15 Thread Arend van Spriel

On 02/15/15 04:27, Pat Erley wrote:

On 02/14/2015 08:40 PM, Fu, Zhonghui wrote:


Any comments to this patch? Can it be accepted?


I assume that patches are queued up until after the merge window that we 
are currently in.



Thanks,
Zhonghui

On 2015/2/12 11:26, Fu, Zhonghui wrote:

From a05d35ab334c20970c236fb971dae88810078c88 Mon Sep 17 00:00:00 2001
From: Fu Zhonghui zhonghui...@linux.intel.com
Date: Thu, 12 Feb 2015 10:49:35 +0800
Subject: [PATCH v3] brcmfmac: avoid duplicated suspend/resume operation

WiFi chip has 2 SDIO functions, and PM core will trigger
twice suspend/resume operations for one WiFi chip to do
the same things. This patch avoid this case.

Acked-by: Arend van Spriel ar...@broadcom.com
Signed-off-by: Fu Zhonghui zhonghui...@linux.intel.com
---
Changes in v3:
- Rebase to wireless-drivers-next/master branch

drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 13 -
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 7944224..b8832a7 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -1117,9 +1117,13 @@ static int brcmf_ops_sdio_suspend(struct
device *dev)
struct brcmf_bus *bus_if;
struct brcmf_sdio_dev *sdiodev;
mmc_pm_flag_t sdio_flags;
+ struct sdio_func *func = dev_to_sdio_func(dev);

brcmf_dbg(SDIO, Enter\n);

+ if (func-num == 2)
+ return 0;
+


Should it be = 2 instead of == 2 so that if, in the future, a 3+
SDIO function chip comes out, it's already handled? Not that that
should hold up the patch or anything, just a curiosity.


The driver only claims functions 1 and 2 during the probe so that assure 
it works for SDIO devices that have more than two functions.


Regards,
Arend


bus_if = dev_get_drvdata(dev);
sdiodev = bus_if-bus_priv.sdio;

@@ -1148,9 +1152,16 @@ static int brcmf_ops_sdio_suspend(struct
device *dev)
static int brcmf_ops_sdio_resume(struct device *dev)
{
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
- struct brcmf_sdio_dev *sdiodev = bus_if-bus_priv.sdio;
+ struct brcmf_sdio_dev *sdiodev;
+ struct sdio_func *func = dev_to_sdio_func(dev);

brcmf_dbg(SDIO, Enter\n);
+
+ if (func-num == 2)
+ return 0;
+
+ sdiodev = bus_if-bus_priv.sdio;
+
if (sdiodev-pdata  sdiodev-pdata-oob_irq_supported)
disable_irq_wake(sdiodev-pdata-oob_irq_nr);
brcmf_sdio_wd_timer(sdiodev-bus, BRCMF_WD_POLL_MS);
-- 1.9.1



--
To unsubscribe from this list: send the line unsubscribe
linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html





--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/9] wil6210: rename 'secure_pcp' to 'privacy'

2015-02-15 Thread Vladimir Kondratiev
Make this field to track privacy attribute for all interface types

Signed-off-by: Vladimir Kondratiev qca_vkond...@qca.qualcomm.com
---
 drivers/net/wireless/ath/wil6210/cfg80211.c | 2 +-
 drivers/net/wireless/ath/wil6210/debugfs.c  | 2 +-
 drivers/net/wireless/ath/wil6210/wil6210.h  | 2 +-
 drivers/net/wireless/ath/wil6210/wmi.c  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c 
b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 2d5ea21..38bd294 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -769,7 +769,7 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy,
wmi_set_ie(wil, WMI_FRAME_ASSOC_RESP, bcon-assocresp_ies_len,
   bcon-assocresp_ies);
 
-   wil-secure_pcp = info-privacy;
+   wil-privacy = info-privacy;
 
netif_carrier_on(ndev);
 
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index fd59751..fbe27a3 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -1400,7 +1400,7 @@ static void wil6210_debugfs_init_isr(struct wil6210_priv 
*wil,
 
 /* fields in struct wil6210_priv */
 static const struct dbg_off dbg_wil_off[] = {
-   WIL_FIELD(secure_pcp,   S_IRUGO | S_IWUSR,  doff_u32),
+   WIL_FIELD(privacy,  S_IRUGO,doff_u32),
WIL_FIELD(status[0],S_IRUGO | S_IWUSR,  doff_ulong),
WIL_FIELD(fw_version,   S_IRUGO,doff_u32),
WIL_FIELD(hw_version,   S_IRUGO,doff_x32),
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index 4afb8e4..b6e65c3 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -540,7 +540,7 @@ struct wil6210_priv {
wait_queue_head_t wq; /* for all wait_event() use */
/* profile */
u32 monitor_flags;
-   u32 secure_pcp; /* create secure PCP? */
+   u32 privacy; /* secure connection? */
int sinfo_gen;
/* interrupt moderation */
u32 tx_max_burst_duration;
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c 
b/drivers/net/wireless/ath/wil6210/wmi.c
index e60186c..0213135 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -874,7 +874,7 @@ int wmi_pcp_start(struct wil6210_priv *wil, int bi, u8 
wmi_nettype, u8 chan)
struct wmi_pcp_started_event evt;
} __packed reply;
 
-   if (!wil-secure_pcp)
+   if (!wil-privacy)
cmd.disable_sec = 1;
 
if ((cmd.pcp_max_assoc_sta  WIL6210_MAX_CID) ||
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/9] wil6210: Align Rx buffers on 4*n+2

2015-02-15 Thread Vladimir Kondratiev
For the normal (non-sniffer) mode of operation, align Rx buffer
on 4*n+2, so IP header (after 14 bytes of Ethernet header)
will start dword aligned. This accelerated IP stack a little bit.

Signed-off-by: Vladimir Kondratiev qca_vkond...@qca.qualcomm.com
---
 drivers/net/wireless/ath/wil6210/txrx.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wil6210/txrx.c 
b/drivers/net/wireless/ath/wil6210/txrx.c
index 7f2f560..e1587b3 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -468,8 +468,11 @@ static int wil_rx_refill(struct wil6210_priv *wil, int 
count)
struct vring *v = wil-vring_rx;
u32 next_tail;
int rc = 0;
+   /* 2 bytes headroom in normal operation mode to achieve dword
+* alignment for the IP header
+*/
int headroom = ndev-type == ARPHRD_IEEE80211_RADIOTAP ?
-   WIL6210_RTAP_SIZE : 0;
+   WIL6210_RTAP_SIZE : 2;
 
for (; next_tail = wil_vring_next_tail(v),
(next_tail != v-swhead)  (count--  0);
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/9] wil6210: Change of threshold for tx vring idleness measurement

2015-02-15 Thread Vladimir Kondratiev
From: Vladimir Shulman qca_shulm...@qca.qualcomm.com

Change threshold to be variable debugfs entry from hard-coded 0.
Default threshold value is 16 descriptors because HW is capable
of fetching up to 16 descriptors at once.

Signed-off-by: Vladimir Shulman qca_shulm...@qca.qualcomm.com
Signed-off-by: Vladimir Kondratiev qca_vkond...@qca.qualcomm.com
---
 drivers/net/wireless/ath/wil6210/debugfs.c |  3 ++
 drivers/net/wireless/ath/wil6210/txrx.c| 52 --
 drivers/net/wireless/ath/wil6210/wil6210.h |  1 +
 3 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index 3ed16e7..eb6de8c 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -29,6 +29,7 @@
 static u32 mem_addr;
 static u32 dbg_txdesc_index;
 static u32 dbg_vring_index; /* 24+ for Rx, 0..23 for Tx */
+u32 vring_idle_trsh = 16; /* HW fetches up to 16 descriptors at once */
 
 enum dbg_off_type {
doff_u32 = 0,
@@ -1412,6 +1413,8 @@ static const struct dbg_off dbg_statics[] = {
{desc_index,  S_IRUGO | S_IWUSR, (ulong)dbg_txdesc_index, doff_u32},
{vring_index, S_IRUGO | S_IWUSR, (ulong)dbg_vring_index, doff_u32},
{mem_addr,S_IRUGO | S_IWUSR, (ulong)mem_addr, doff_u32},
+   {vring_idle_trsh, S_IRUGO | S_IWUSR, (ulong)vring_idle_trsh,
+doff_u32},
{},
 };
 
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c 
b/drivers/net/wireless/ath/wil6210/txrx.c
index 7e119d0..7f2f560 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -53,34 +53,38 @@ static inline int wil_vring_is_full(struct vring *vring)
return wil_vring_next_tail(vring) == vring-swhead;
 }
 
-/*
- * Available space in Tx Vring
- */
-static inline int wil_vring_avail_tx(struct vring *vring)
+/* Used space in Tx Vring */
+static inline int wil_vring_used_tx(struct vring *vring)
 {
u32 swhead = vring-swhead;
u32 swtail = vring-swtail;
-   int used = (vring-size + swhead - swtail) % vring-size;
+   return (vring-size + swhead - swtail) % vring-size;
+}
 
-   return vring-size - used - 1;
+/* Available space in Tx Vring */
+static inline int wil_vring_avail_tx(struct vring *vring)
+{
+   return vring-size - wil_vring_used_tx(vring) - 1;
 }
 
-/**
- * wil_vring_wmark_low - low watermark for available descriptor space
- */
+/* wil_vring_wmark_low - low watermark for available descriptor space */
 static inline int wil_vring_wmark_low(struct vring *vring)
 {
return vring-size/8;
 }
 
-/**
- * wil_vring_wmark_high - high watermark for available descriptor space
- */
+/* wil_vring_wmark_high - high watermark for available descriptor space */
 static inline int wil_vring_wmark_high(struct vring *vring)
 {
return vring-size/4;
 }
 
+/* wil_val_in_range - check if value in [min,max) */
+static inline bool wil_val_in_range(int val, int min, int max)
+{
+   return val = min  val  max;
+}
+
 static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring)
 {
struct device *dev = wil_to_dev(wil);
@@ -98,8 +102,7 @@ static int wil_vring_alloc(struct wil6210_priv *wil, struct 
vring *vring)
vring-va = NULL;
return -ENOMEM;
}
-   /*
-* vring-va should be aligned on its size rounded up to power of 2
+   /* vring-va should be aligned on its size rounded up to power of 2
 * This is granted by the dma_alloc_coherent
 */
vring-va = dma_alloc_coherent(dev, sz, vring-pa, GFP_KERNEL);
@@ -921,6 +924,7 @@ static int __wil_tx_vring(struct wil6210_priv *wil, struct 
vring *vring,
struct vring_tx_data *txdata = wil-vring_tx_data[vring_index];
uint i = swhead;
dma_addr_t pa;
+   int used;
 
wil_dbg_txrx(wil, %s()\n, __func__);
 
@@ -996,8 +1000,14 @@ static int __wil_tx_vring(struct wil6210_priv *wil, 
struct vring *vring,
 */
vring-ctx[i].skb = skb_get(skb);
 
-   if (wil_vring_is_empty(vring)) /* performance monitoring */
+   /* performance monitoring */
+   used = wil_vring_used_tx(vring);
+   if (wil_val_in_range(vring_idle_trsh,
+used, used + nr_frags + 1)) {
txdata-idle += get_cycles() - txdata-last_idle;
+   wil_dbg_txrx(wil,  Ring[%2d] not idle %d - %d\n,
+vring_index, used, used + nr_frags + 1);
+   }
 
/* advance swhead */
wil_vring_advance_head(vring, nr_frags + 1);
@@ -1141,6 +1151,8 @@ int wil_tx_complete(struct wil6210_priv *wil, int ringid)
int cid = wil-vring2cid_tid[ringid][0];
struct wil_net_stats *stats = wil-sta[cid].stats;
volatile struct vring_tx_desc *_d;
+   int used_before_complete;
+   int used_new;
 
if (unlikely(!vring-va)) {

[PATCH 4/9] wil6210: branch prediction hints

2015-02-15 Thread Vladimir Kondratiev
Mark expected branches using likely()/unlikely().
Do it on high performance route - data path and interrupts

Signed-off-by: Vladimir Kondratiev qca_vkond...@qca.qualcomm.com
---
 drivers/net/wireless/ath/wil6210/interrupt.c | 25 -
 drivers/net/wireless/ath/wil6210/txrx.c  | 40 ++--
 2 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c 
b/drivers/net/wireless/ath/wil6210/interrupt.c
index d5a651b..28ffc18 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -226,7 +226,7 @@ static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
trace_wil6210_irq_rx(isr);
wil_dbg_irq(wil, ISR RX 0x%08x\n, isr);
 
-   if (!isr) {
+   if (unlikely(!isr)) {
wil_err(wil, spurious IRQ: RX\n);
return IRQ_NONE;
}
@@ -239,17 +239,18 @@ static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
 * action is always the same - should empty the accumulated
 * packets from the RX ring.
 */
-   if (isr  (BIT_DMA_EP_RX_ICR_RX_DONE | BIT_DMA_EP_RX_ICR_RX_HTRSH)) {
+   if (likely(isr  (BIT_DMA_EP_RX_ICR_RX_DONE |
+ BIT_DMA_EP_RX_ICR_RX_HTRSH))) {
wil_dbg_irq(wil, RX done\n);
 
-   if (isr  BIT_DMA_EP_RX_ICR_RX_HTRSH)
+   if (unlikely(isr  BIT_DMA_EP_RX_ICR_RX_HTRSH))
wil_err_ratelimited(wil,
Received \Rx buffer is in risk of 
overflow\ interrupt\n);
 
isr = ~(BIT_DMA_EP_RX_ICR_RX_DONE |
 BIT_DMA_EP_RX_ICR_RX_HTRSH);
-   if (test_bit(wil_status_reset_done, wil-status)) {
-   if (test_bit(wil_status_napi_en, wil-status)) {
+   if (likely(test_bit(wil_status_reset_done, wil-status))) {
+   if (likely(test_bit(wil_status_napi_en, wil-status))) {
wil_dbg_txrx(wil, NAPI(Rx) schedule\n);
need_unmask = false;
napi_schedule(wil-napi_rx);
@@ -262,7 +263,7 @@ static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
}
}
 
-   if (isr)
+   if (unlikely(isr))
wil_err(wil, un-handled RX ISR bits 0x%08x\n, isr);
 
/* Rx IRQ will be enabled when NAPI processing finished */
@@ -286,19 +287,19 @@ static irqreturn_t wil6210_irq_tx(int irq, void *cookie)
trace_wil6210_irq_tx(isr);
wil_dbg_irq(wil, ISR TX 0x%08x\n, isr);
 
-   if (!isr) {
+   if (unlikely(!isr)) {
wil_err(wil, spurious IRQ: TX\n);
return IRQ_NONE;
}
 
wil6210_mask_irq_tx(wil);
 
-   if (isr  BIT_DMA_EP_TX_ICR_TX_DONE) {
+   if (likely(isr  BIT_DMA_EP_TX_ICR_TX_DONE)) {
wil_dbg_irq(wil, TX done\n);
isr = ~BIT_DMA_EP_TX_ICR_TX_DONE;
/* clear also all VRING interrupts */
isr = ~(BIT(25) - 1UL);
-   if (test_bit(wil_status_reset_done, wil-status)) {
+   if (likely(test_bit(wil_status_reset_done, wil-status))) {
wil_dbg_txrx(wil, NAPI(Tx) schedule\n);
need_unmask = false;
napi_schedule(wil-napi_tx);
@@ -307,7 +308,7 @@ static irqreturn_t wil6210_irq_tx(int irq, void *cookie)
}
}
 
-   if (isr)
+   if (unlikely(isr))
wil_err(wil, un-handled TX ISR bits 0x%08x\n, isr);
 
/* Tx IRQ will be enabled when NAPI processing finished */
@@ -496,11 +497,11 @@ static irqreturn_t wil6210_hardirq(int irq, void *cookie)
/**
 * pseudo_cause is Clear-On-Read, no need to ACK
 */
-   if ((pseudo_cause == 0) || ((pseudo_cause  0xff) == 0xff))
+   if (unlikely((pseudo_cause == 0) || ((pseudo_cause  0xff) == 0xff)))
return IRQ_NONE;
 
/* FIXME: IRQ mask debug */
-   if (wil6210_debug_irq_mask(wil, pseudo_cause))
+   if (unlikely(wil6210_debug_irq_mask(wil, pseudo_cause)))
return IRQ_NONE;
 
trace_wil6210_irq_pseudo(pseudo_cause);
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c 
b/drivers/net/wireless/ath/wil6210/txrx.c
index 779d836..7e119d0 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -370,11 +370,11 @@ static struct sk_buff *wil_vring_reap_rx(struct 
wil6210_priv *wil,
 
BUILD_BUG_ON(sizeof(struct vring_rx_desc)  sizeof(skb-cb));
 
-   if (wil_vring_is_empty(vring))
+   if (unlikely(wil_vring_is_empty(vring)))
return NULL;
 
_d = vring-va[vring-swhead].rx;
-   if (!(_d-dma.status  RX_DMA_STATUS_DU)) {
+   if (unlikely(!(_d-dma.status  RX_DMA_STATUS_DU))) {
/* it is not error, we just 

[PATCH 3/9] wil6210: enable fix for HW bug in 802.11-803.3 transform

2015-02-15 Thread Vladimir Kondratiev
In the old hardware, bug existed that caused DA and SA for every
Rx packet to be swapped in the AP mode.
New hardware has fix for this bug. Enable this fix in the
hardware.

Signed-off-by: Vladimir Kondratiev qca_vkond...@qca.qualcomm.com
---
 drivers/net/wireless/ath/wil6210/main.c|  4 
 drivers/net/wireless/ath/wil6210/txrx.c| 31 --
 drivers/net/wireless/ath/wil6210/wil6210.h |  7 +++
 3 files changed, 11 insertions(+), 31 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 95755a5..db74e81 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -579,6 +579,10 @@ static int wil_target_reset(struct wil6210_priv *wil)
 
C(RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_RST_PWGD);
 
+   /* enable fix for HW bug related to the SA/DA swap in AP Rx */
+   S(RGF_DMA_OFUL_NID_0, BIT_DMA_OFUL_NID_0_RX_EXT_TR_EN |
+ BIT_DMA_OFUL_NID_0_RX_EXT_A3_SRC);
+
wil_dbg_misc(wil, Reset completed in %d ms\n, delay * RST_DELAY);
return 0;
 }
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c 
b/drivers/net/wireless/ath/wil6210/txrx.c
index 8439f65..779d836 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -346,27 +346,6 @@ static void wil_rx_add_radiotap_header(struct wil6210_priv 
*wil,
}
 }
 
-/*
- * Fast swap in place between 2 registers
- */
-static void wil_swap_u16(u16 *a, u16 *b)
-{
-   *a ^= *b;
-   *b ^= *a;
-   *a ^= *b;
-}
-
-static void wil_swap_ethaddr(void *data)
-{
-   struct ethhdr *eth = data;
-   u16 *s = (u16 *)eth-h_source;
-   u16 *d = (u16 *)eth-h_dest;
-
-   wil_swap_u16(s++, d++);
-   wil_swap_u16(s++, d++);
-   wil_swap_u16(s, d);
-}
-
 /**
  * reap 1 frame from @swhead
  *
@@ -386,7 +365,6 @@ static struct sk_buff *wil_vring_reap_rx(struct 
wil6210_priv *wil,
unsigned int sz = mtu_max + ETH_HLEN;
u16 dmalen;
u8 ftype;
-   u8 ds_bits;
int cid;
struct wil_net_stats *stats;
 
@@ -474,15 +452,6 @@ static struct sk_buff *wil_vring_reap_rx(struct 
wil6210_priv *wil,
 */
}
 
-   ds_bits = wil_rxdesc_ds_bits(d);
-   if (ds_bits == 1) {
-   /*
-* HW bug - in ToDS mode, i.e. Rx on AP side,
-* addresses get swapped
-*/
-   wil_swap_ethaddr(skb-data);
-   }
-
return skb;
 }
 
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h 
b/drivers/net/wireless/ath/wil6210/wil6210.h
index 97422e7..85f0011 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -181,6 +181,13 @@ struct RGF_BL {
#define BIT_DMA_ITR_CNT_CRL_CLR BIT(3)
#define BIT_DMA_ITR_CNT_CRL_REACH_TRSH  BIT(4)
 
+/* Offload control (Sparrow B0+) */
+#define RGF_DMA_OFUL_NID_0 (0x881cd4)
+   #define BIT_DMA_OFUL_NID_0_RX_EXT_TR_EN BIT(0)
+   #define BIT_DMA_OFUL_NID_0_TX_EXT_TR_EN BIT(1)
+   #define BIT_DMA_OFUL_NID_0_RX_EXT_A3_SRCBIT(2)
+   #define BIT_DMA_OFUL_NID_0_TX_EXT_A3_SRCBIT(3)
+
 /* New (sparrow v2+) interrupt moderation control */
 #define RGF_DMA_ITR_TX_DESQ_NO_MOD (0x881d40)
 #define RGF_DMA_ITR_TX_CNT_TRSH(0x881d34)
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/9] wil6210: Fix division by zero in wil_vring_debugfs_show

2015-02-15 Thread Vladimir Kondratiev
From: Boris Sorochkin bor...@codeaurora.org

On some platforms get_cycles() implemented to allways return 0.
On such platforms Division by zero bug was triggered.

Signed-off-by: Boris Sorochkin bor...@codeaurora.org
Signed-off-by: Vladimir Kondratiev qca_vkond...@qca.qualcomm.com
---
 drivers/net/wireless/ath/wil6210/debugfs.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index eb6de8c..fd59751 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -103,23 +103,30 @@ static int wil_vring_debugfs_show(struct seq_file *s, 
void *data)
   % vring-size;
int avail = vring-size - used - 1;
char name[10];
+   char sidle[10];
/* performance monitoring */
cycles_t now = get_cycles();
uint64_t idle = txdata-idle * 100;
uint64_t total = now - txdata-begin;
 
-   do_div(idle, total);
+   if (total != 0) {
+   do_div(idle, total);
+   snprintf(sidle, sizeof(sidle), %3d%%,
+(int)idle);
+   } else {
+   snprintf(sidle, sizeof(sidle), N/A);
+   }
txdata-begin = now;
txdata-idle = 0ULL;
 
snprintf(name, sizeof(name), tx_%2d, i);
 
seq_printf(s,
-  \n%pM CID %d TID %d BACK([%d] %d TU A%s) 
[%3d|%3d] idle %3d%%\n,
-  wil-sta[cid].addr, cid, tid,
-  txdata-agg_wsize, txdata-agg_timeout,
-  txdata-agg_amsdu ? + : -,
-  used, avail, (int)idle);
+   \n%pM CID %d TID %d BACK([%d] %d TU A%s) 
[%3d|%3d] idle %s\n,
+   wil-sta[cid].addr, cid, tid,
+   txdata-agg_wsize, txdata-agg_timeout,
+   txdata-agg_amsdu ? + : -,
+   used, avail, sidle);
 
wil_print_vring(s, wil, name, vring, '_', 'H');
}
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: station kickout

2015-02-15 Thread Kalle Valo
(Adding linux-wireless)

Ben Greear gree...@candelatech.com writes:

 In AP mode, it seems that 3.17-ish kernels (at least) always set station 
 kickout
 to hard-coded value of 50.

 Is this something that should be configurable?  Maybe a module parameter
 if nothing else?

Or should we add this to nl80211/cfg80211/mac80211? I would guess other
drivers also have similar functionality.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] ath10k: implement fw stats for wmi-tlv

2015-02-15 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 There are some slight differences in fw stats
 (sic) in wmi-tlv.

 Firmware has changed the querying scheme and no
 longer requires the ping-pong to get all stats.
 The patchset doesn't change this behaviour so with
 wmi-tlv it's possible to see the following
 warnings when reading fw stats:

  ath10k_pci :00:06.0: received unsolicited stats update event

 The logic in ath10k still produces correct results
 so this is harmless.

 I wonder how to deal with this in a sane way. An
 `if (op_ver == WMI_TLV)` is a little bad but
 having a new ar-fw_feature flag just for a debug
 facility like this is a bit silly. Or we can just
 drop the warning and leave a comment. Ideas?

I think we could just drop the warning and leave a comment. That
shouldn't break anything, right?

 Michal Kazior (4):
   ath10k: add vdev stats processing
   ath10k: change request stats command prototype
   ath10k: add more wmi fw stat defines
   ath10k: implement fw stats for wmi-tlv

Thanks, applied to ath.git.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/9] wil6210: boot loader

2015-02-15 Thread Vladimir Kondratiev
Introduce boot loader. Instead of the operational firmware,
very small boot loader is burned to the on-board flash. Boot loader
initializes hardware upon reset, and prepares for low power mode.
Boot loader reports MAC address and detects radio chip connected.

Driver loads firmware only when bringing up interface. All information
required to set up network interface, most important is MAC address,
reported by the boot loader

The firmware composed of 2 files:
- wil6210.fw - firmware itself (compiled code + data)
- wil6210.board - board file (various board and radio dependent
  calibrations and parameters)

Signed-off-by: Vladimir Kondratiev qca_vkond...@qca.qualcomm.com
---
 drivers/net/wireless/ath/wil6210/debugfs.c  |   2 +-
 drivers/net/wireless/ath/wil6210/fw.c   |   3 +-
 drivers/net/wireless/ath/wil6210/fw_inc.c   |   4 +-
 drivers/net/wireless/ath/wil6210/main.c | 104 ++--
 drivers/net/wireless/ath/wil6210/pcie_bus.c |   2 +-
 drivers/net/wireless/ath/wil6210/wil6210.h  |  16 -
 drivers/net/wireless/ath/wil6210/wmi.c  |   7 +-
 7 files changed, 88 insertions(+), 50 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c 
b/drivers/net/wireless/ath/wil6210/debugfs.c
index 45c3558e..3ed16e7 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -549,7 +549,7 @@ static ssize_t wil_write_file_reset(struct file *file, 
const char __user *buf,
dev_close(ndev);
ndev-flags = ~IFF_UP;
rtnl_unlock();
-   wil_reset(wil);
+   wil_reset(wil, true);
 
return len;
 }
diff --git a/drivers/net/wireless/ath/wil6210/fw.c 
b/drivers/net/wireless/ath/wil6210/fw.c
index 93c5cc1..4428345 100644
--- a/drivers/net/wireless/ath/wil6210/fw.c
+++ b/drivers/net/wireless/ath/wil6210/fw.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Qualcomm Atheros, Inc.
+ * Copyright (c) 2014-2015 Qualcomm Atheros, 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
@@ -20,6 +20,7 @@
 #include fw.h
 
 MODULE_FIRMWARE(WIL_FW_NAME);
+MODULE_FIRMWARE(WIL_FW2_NAME);
 
 /* target operations */
 /* register read */
diff --git a/drivers/net/wireless/ath/wil6210/fw_inc.c 
b/drivers/net/wireless/ath/wil6210/fw_inc.c
index d4acf93..157f5ef 100644
--- a/drivers/net/wireless/ath/wil6210/fw_inc.c
+++ b/drivers/net/wireless/ath/wil6210/fw_inc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Qualcomm Atheros, Inc.
+ * Copyright (c) 2014-2015 Qualcomm Atheros, 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
@@ -451,8 +451,6 @@ static int wil_fw_load(struct wil6210_priv *wil, const void 
*data, size_t size)
}
return -EINVAL;
}
-   /* Mark FW as loaded from host */
-   S(RGF_USER_USAGE_6, 1);
 
return rc;
 }
diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index b04e0af..acbbd27 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -29,10 +29,6 @@ bool no_fw_recovery;
 module_param(no_fw_recovery, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(no_fw_recovery,  disable automatic FW error recovery);
 
-static bool no_fw_load = true;
-module_param(no_fw_load, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(no_fw_load,  do not download FW, use one in on-card flash.);
-
 /* if not set via modparam, will be set to default value of 1/8 of
  * rx ring size during init flow
  */
@@ -532,6 +528,8 @@ static int wil_target_reset(struct wil6210_priv *wil)
 
wil_halt_cpu(wil);
 
+   /* clear all boot loader ready bits */
+   W(RGF_USER_BL + offsetof(struct RGF_BL, ready), 0);
/* Clear Fw Download notification */
C(RGF_USER_USAGE_6, BIT(0));
 
@@ -583,16 +581,16 @@ static int wil_target_reset(struct wil6210_priv *wil)
/* TODO: check order here!!! Erez code is different */
W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0);
 
-   /* wait until device ready. typical time is 200..250 msec */
+   /* wait until device ready. typical time is 20..80 msec */
do {
msleep(RST_DELAY);
-   x = R(RGF_USER_HW_MACHINE_STATE);
+   x = R(RGF_USER_BL + offsetof(struct RGF_BL, ready));
if (delay++  RST_COUNT) {
-   wil_err(wil, Reset not completed, hw_state 0x%08x\n,
+   wil_err(wil, Reset not completed, bl.ready 0x%08x\n,
x);
return -ETIME;
}
-   } while (x != HW_MACHINE_BOOT_DONE);
+   } while (!(x  BIT_BL_READY));
 
if (!is_reset_v2)
W(RGF_PCIE_LOS_COUNTER_CTL, BIT(8));
@@ -603,11 +601,6 @@ static int wil_target_reset(struct wil6210_priv *wil)
  

[PATCH 2/9] wil6210: remove support for old hardware

2015-02-15 Thread Vladimir Kondratiev
Hardware older than Sparrow B0 obsolete.
There is no WiFi product that uses this hardware.
Recent firmware does not support it either.

Remove driver support.

Signed-off-by: Vladimir Kondratiev qca_vkond...@qca.qualcomm.com
---
 drivers/net/wireless/ath/wil6210/ethtool.c   | 34 +++-
 drivers/net/wireless/ath/wil6210/interrupt.c | 45 +
 drivers/net/wireless/ath/wil6210/main.c  | 58 ++--
 drivers/net/wireless/ath/wil6210/pcie_bus.c  | 20 --
 drivers/net/wireless/ath/wil6210/wil6210.h   |  8 
 5 files changed, 42 insertions(+), 123 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/ethtool.c 
b/drivers/net/wireless/ath/wil6210/ethtool.c
index 4c44a82..0ea695f 100644
--- a/drivers/net/wireless/ath/wil6210/ethtool.c
+++ b/drivers/net/wireless/ath/wil6210/ethtool.c
@@ -50,27 +50,19 @@ static int wil_ethtoolops_get_coalesce(struct net_device 
*ndev,
 
wil_dbg_misc(wil, %s()\n, __func__);
 
-   if (test_bit(hw_capability_advanced_itr_moderation,
-wil-hw_capabilities)) {
-   tx_itr_en = ioread32(wil-csr +
-HOSTADDR(RGF_DMA_ITR_TX_CNT_CTL));
-   if (tx_itr_en  BIT_DMA_ITR_TX_CNT_CTL_EN)
-   tx_itr_val =
-   ioread32(wil-csr +
-HOSTADDR(RGF_DMA_ITR_TX_CNT_TRSH));
-
-   rx_itr_en = ioread32(wil-csr +
-HOSTADDR(RGF_DMA_ITR_RX_CNT_CTL));
-   if (rx_itr_en  BIT_DMA_ITR_RX_CNT_CTL_EN)
-   rx_itr_val =
-   ioread32(wil-csr +
-HOSTADDR(RGF_DMA_ITR_RX_CNT_TRSH));
-   } else {
-   rx_itr_en = ioread32(wil-csr + HOSTADDR(RGF_DMA_ITR_CNT_CRL));
-   if (rx_itr_en  BIT_DMA_ITR_CNT_CRL_EN)
-   rx_itr_val = ioread32(wil-csr +
- HOSTADDR(RGF_DMA_ITR_CNT_TRSH));
-   }
+   tx_itr_en = ioread32(wil-csr +
+HOSTADDR(RGF_DMA_ITR_TX_CNT_CTL));
+   if (tx_itr_en  BIT_DMA_ITR_TX_CNT_CTL_EN)
+   tx_itr_val =
+   ioread32(wil-csr +
+HOSTADDR(RGF_DMA_ITR_TX_CNT_TRSH));
+
+   rx_itr_en = ioread32(wil-csr +
+HOSTADDR(RGF_DMA_ITR_RX_CNT_CTL));
+   if (rx_itr_en  BIT_DMA_ITR_RX_CNT_CTL_EN)
+   rx_itr_val =
+   ioread32(wil-csr +
+HOSTADDR(RGF_DMA_ITR_RX_CNT_TRSH));
 
cp-tx_coalesce_usecs = tx_itr_val;
cp-rx_coalesce_usecs = rx_itr_val;
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c 
b/drivers/net/wireless/ath/wil6210/interrupt.c
index a6f9230..d5a651b 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -166,9 +166,16 @@ void wil_unmask_irq(struct wil6210_priv *wil)
 /* target write operation */
 #define W(a, v) do { iowrite32(v, wil-csr + HOSTADDR(a)); wmb(); } while (0)
 
-static
-void wil_configure_interrupt_moderation_new(struct wil6210_priv *wil)
+void wil_configure_interrupt_moderation(struct wil6210_priv *wil)
 {
+   wil_dbg_irq(wil, %s()\n, __func__);
+
+   /* disable interrupt moderation for monitor
+* to get better timestamp precision
+*/
+   if (wil-wdev-iftype == NL80211_IFTYPE_MONITOR)
+   return;
+
/* Disable and clear tx counter before (re)configuration */
W(RGF_DMA_ITR_TX_CNT_CTL, BIT_DMA_ITR_TX_CNT_CTL_CLR);
W(RGF_DMA_ITR_TX_CNT_TRSH, wil-tx_max_burst_duration);
@@ -206,42 +213,8 @@ void wil_configure_interrupt_moderation_new(struct 
wil6210_priv *wil)
  BIT_DMA_ITR_RX_IDL_CNT_CTL_EXT_TIC_SEL);
 }
 
-static
-void wil_configure_interrupt_moderation_lgc(struct wil6210_priv *wil)
-{
-   /* disable, use usec resolution */
-   W(RGF_DMA_ITR_CNT_CRL, BIT_DMA_ITR_CNT_CRL_CLR);
-
-   wil_info(wil, set ITR_TRSH = %d usec\n, wil-rx_max_burst_duration);
-   W(RGF_DMA_ITR_CNT_TRSH, wil-rx_max_burst_duration);
-   /* start it */
-   W(RGF_DMA_ITR_CNT_CRL,
- BIT_DMA_ITR_CNT_CRL_EN | BIT_DMA_ITR_CNT_CRL_EXT_TICK);
-}
-
 #undef W
 
-void wil_configure_interrupt_moderation(struct wil6210_priv *wil)
-{
-   wil_dbg_irq(wil, %s()\n, __func__);
-
-   /* disable interrupt moderation for monitor
-* to get better timestamp precision
-*/
-   if (wil-wdev-iftype == NL80211_IFTYPE_MONITOR)
-   return;
-
-   if (test_bit(hw_capability_advanced_itr_moderation,
-wil-hw_capabilities))
-   wil_configure_interrupt_moderation_new(wil);
-   else {
-   /* Advanced interrupt moderation is not available before
-* Sparrow v2. Will use legacy interrupt 

Re: [PATCH v3] brcmfmac: avoid duplicated suspend/resume operation

2015-02-15 Thread Kalle Valo
Arend van Spriel ar...@broadcom.com writes:

 On 02/15/15 04:27, Pat Erley wrote:
 On 02/14/2015 08:40 PM, Fu, Zhonghui wrote:

 Any comments to this patch? Can it be accepted?

 I assume that patches are queued up until after the merge window that
 we are currently in.

That's right. In the future I will most likely apply patches also during
the merge window, but as I'm still a greenhorn I'll be on the safe and
wait for the merge window to end.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: defer AP self-peer removal wait

2015-02-15 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 Some firmware revisions don't notify host about
 self-bss-peer removal until after associated vdev
 is deleted. This has been observed with qca6174
 WLAN.RM.2.0-00073 firmware.

 This patch fixes AP teardown slowdowns and
 prevents delays and warnings:

  ath10k_pci :00:05.0: failed to remove peer for AP vdev 0: -110
  ath10k_pci :00:05.0: removing stale peer xx:xx:xx:xx:xx:xx from vdev_id 0
  ath10k_pci :00:05.0: peer-unmap-event: unknown peer id 24
  ath10k_pci :00:05.0: peer-unmap-event: unknown peer id 8

 Signed-off-by: Michal Kazior michal.kaz...@tieto.com

Thanks, applied to ath.git.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


BCM4313 lowering TX power

2015-02-15 Thread Nikita N.
Hi Dear backports Devs for driver brcmsmac,
Coming to the point, I want to lower the TX power of my BCM4313, under
the official values set by the regdom, to any special value I need.
So I'm trying to build such a personal patch, only for me, based on
latest backports v3.19 and latest Ubuntu.
Useless to say, iwconfig wlan txpower doesn't work, the resulting TX
power doesn't change.
I know it doesn't work because I can measure the RSSI coming out from
the BCM4313, using another device: it doesn't change, whatever value I
set.

So, I gave a look at the code for the brcmsmac module, and I think I
found the location where the TX power is *finally* set: inside
wlc_lcnphy_txpower_recalc_target (phy_lcn.c), call to
wlc_lcnphy_set_target_tx_pwr.
AFAIU, in that function a table of tx_power_offsets (calculated by
another function) is written in the device EPROM registry, and the TX
power is set to the relative minimum.

Now, my question: is that the right way to change effectively the TX
power?
I need to ask You a confirmation about that, if that is correct, before
I start building my patch.
I don't want to frustrate my time developing in the wrong code, or
damage the device, or other issues... :)

Thank you for your attention, and looking forward your feedback.

-- 
http://www.fastmail.com - mmm... Fastmail...

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: add TxBF support

2015-02-15 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 If firmware advertises support for TxBF then the
 driver has to instruct the firmware accordingly
 during runtime. Without this patch connecting to
 an AP with beamformer support would yield abysmal
 Rx performance.

 This has been tested with wmi-tlv and qca6174
 while acting as a STA beamformee only.

 Signed-off-by: Michal Kazior michal.kaz...@tieto.com

Thanks, applied to ath.git.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v4 1/2] cfg80211: Add API to change the indoor regulatory setting

2015-02-15 Thread Peer, Ilan
Hi Luis,

 
  This differs from the country setting that would potentially require
  user space interaction and might invoke more complex flows. The flow
  in this case is immediate, and does not require the somewhat complex
  handling of country settings (it even complicates the flow
  unnecessarily, with the REG_REQ_USER_HINT_HANDLED etc.).
 
 There's two things you should address then:
 
   0) Try to mitigate the issue with the old userspace API if possible.
  This will enable old userspace to continue to work with the
  old API but also mitigate the issue you have described for which
  you are providing a new optimized solution for but that requires
  a new API.
 

Not sure I have a good solution for this. The problem here is that with the 
current API, the indoor setting will stick as long as a station interface is 
connected, although the indoor setting might no longer be true. For example 
when a station interface is connected to P2P GO (or a soft AP) and both devices 
are moving out of the indoor environment. The motivation for this patch was to 
move the full control of this setting to user space.

Any suggestion are welcomed.

   1) With the new API have userspace be able to send to the kernel that
  userspace will do socket monitoring and because of this and the
  reasons you mentioned it will have more control over the environment
  boolean.
 

Ok. Will add such an API.

2. Track the socket on which the indoor hint is issued, and reset
   indoor setting if the socket was released. The motivation here is to
   force a user space process that sets the indoor setting to constantly
   monitor this setting, and be responsible to correctly toggling it,
   so indoor operation will not be enabled uncontrolled.
  
   That seems to imply a new requirement for something that used to
   work, what having an option to set this requirement?
 
  (Sadly) I would not consider the previous implementation as working as
  it would leave the regulatory core in a state that it considers to be
  indoor although it is no longer true.
 
 Let's review the current implementation for indoor thing.
 
 We assume we're not indoor unless userspace sends a
 regulatory_hint_indoor_user(), this is with the user reg hint type set to
 NL80211_USER_REG_HINT_INDOOR.
 For country IEs we never trust the country IE data since it may contain bogus
 data, but we also end up ignoring the environment aspect too.
 
 If we disconnect we should be reseting the indoor setting to false.
 I just checked and restore_regulatory_settings() does set reg_is_indoor =
 false so if we are keeping the indoor setting I am missing something here, and
 it does indeed rather an issue that should be fixed. Where is the indoor
 setting being upkept?
 

This is generally true, but is not fully compatible with moving APs/P2P GOs, 
where you can be indoor, connect to an AP/P2P GO, and then move out of the 
indoor environment, while connected. Point is the being connected does not 
guarantee that the indoor setting is kept. 

3. Do not reset the indoor setting when restoring the regulatory
   settings as it has nothing to do with CRDA or interface
   disconnection.
  
   I disagree, if we disconnect we want the more restrictive setting
   and if we put the indoor setting out of general regulatory requests
   then we do want to reset this no?
  
 
  I do not think so. This setting is in the responsibility of the user
  space daemon, so it should be the one controlling it.
 
 Right now the API requires sending the userspace regulatory hint and the
 kenrel should indeed reset to non-indoor upon disconnect, the later is an
 issue which should be fixed and what you introduce seems rather complex for
 something that should be fixed within the existing API.
 

The kernel does not have enough information to deduce indoor environment or not 
(as pointed above), only user space has the full information in this case, and 
should be responsible for controlling the setting.

  A disconnection of the
  station interface does not imply that we are no longer operating in an
  indoor environment.
 
 I am confused you seem to be disagreeing with your above statement that
 says otherwise where you said that we leave the indoor setting in place if we
 disconnect. Can you clarify what you mean?
 

What I meant is that a disconnection of the station interface does not imply 
that we are no longer operating in an indoor environment. For example, in an 
enterprise environment, disconnections/reconnection would happen all the time 
due to roaming etc., but in all this cases that device indoor setting would 
continue to be true. 

 Do you mean that you don't wish to fix it so that upon disconnect we never
 get an indoor setting and instead prefer this to be a matter of socket
 monitoring?
 

What I mean is that I want to make it the responsibility of the user space and 
not be depended on kernel wifi flows.

  This also related 

Re: [PATCH] ath10k: fix AP/IBSS CSA with template based fw

2015-02-15 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 qca6174 with wmi-tlv firmware uses offloaded
 beaconing scheme (i.e. templates). This requires a
 little different approach when implementing CSA.

 Add missing code to update CS count and report CSA
 completion to mac80211. Without it channel switch
 was never finished.

 To avoid races during interface teardown data_lock
 has been used to protect is_up and is_started so
 they can be compared against before scheduling
 count down work.

 Signed-off-by: Michal Kazior michal.kaz...@tieto.com
 ---

 @Kalle: I'm deferring the chanctx patchset v4
 until this gets applied. I'd like to avoid posting
 patches without a valid parent id and leaving you
 with some weird conflicts and implicit depndencies
 in the code to deal with.

Ok.

I actually had strange conflicts already with this patch (in mac.c). As
I'm travelling, please check my resolution from the pending branch very
carefully. I might have done something stupid.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/7] rtlwifi: Remove unused defines from cam.h

2015-02-15 Thread Priit Laes
---
 drivers/net/wireless/rtlwifi/cam.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/cam.h 
b/drivers/net/wireless/rtlwifi/cam.h
index 3550808..e2e647d 100644
--- a/drivers/net/wireless/rtlwifi/cam.h
+++ b/drivers/net/wireless/rtlwifi/cam.h
@@ -28,13 +28,11 @@
 
 #define CAM_CONTENT_COUNT  8
 
-#define CFG_DEFAULT_KEYBIT(5)
 #define CFG_VALID  BIT(15)
 
 #define PAIRWISE_KEYIDX0
 #define CAM_PAIRWISE_KEY_POSITION  4
 
-#defineCAM_CONFIG_USEDK1
 #defineCAM_CONFIG_NO_USEDK 0
 
 void rtl_cam_reset_all_entry(struct ieee80211_hw *hw);
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/7] rtlwifi: Unused #define removal

2015-02-15 Thread Priit Laes
Hi all,

This is v2 of the rtlwifi unused #define cleanup patchset.

Changes since v1:

  - Rebase patches against wireless-driver-next tree.


Priit Laes (7):
  rtlwifi: Remove unused defines from rtl8192cu driver
  rtlwifi: Remove unused defines from driver-specific def.h
  rtlwifi: Remove unused RF6052_MAX_REG define
  rtlwifi: Remove unused defines from cam.h
  rtlwifi: Remove unused defines from base.h
  rtlwifi: Remove unused defines from efuse.h
  rtlwifi: Remove unused RTL_SUPPORTED_CTRL_FILTER define

 drivers/net/wireless/rtlwifi/base.h  |  6 
 drivers/net/wireless/rtlwifi/cam.h   |  2 --
 drivers/net/wireless/rtlwifi/core.h  |  2 --
 drivers/net/wireless/rtlwifi/efuse.h |  6 
 drivers/net/wireless/rtlwifi/rtl8188ee/def.h | 41 
 drivers/net/wireless/rtlwifi/rtl8188ee/rf.h  |  1 -
 drivers/net/wireless/rtlwifi/rtl8192ce/def.h | 41 
 drivers/net/wireless/rtlwifi/rtl8192ce/rf.h  |  1 -
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.h  |  2 --
 drivers/net/wireless/rtlwifi/rtl8192cu/rf.h  |  1 -
 drivers/net/wireless/rtlwifi/rtl8192de/def.h | 39 --
 drivers/net/wireless/rtlwifi/rtl8192ee/rf.h  |  1 -
 drivers/net/wireless/rtlwifi/rtl8192se/def.h |  1 -
 drivers/net/wireless/rtlwifi/rtl8723ae/def.h | 41 
 drivers/net/wireless/rtlwifi/rtl8723ae/rf.h  |  1 -
 drivers/net/wireless/rtlwifi/rtl8723be/rf.h  |  1 -
 drivers/net/wireless/rtlwifi/rtl8821ae/def.h | 41 
 drivers/net/wireless/rtlwifi/rtl8821ae/rf.h  |  1 -
 18 files changed, 229 deletions(-)

-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/7] rtlwifi: Remove unused defines from driver-specific def.h

2015-02-15 Thread Priit Laes
HAL_RETRY_LIMIT_*
RESET_DELAY_8185
RT_IBSS_INT_MASKS
RT_AC_INT_MASKS
NUM_OF_*
BT_*,
MAX_{LINES,BYTES}_*,
*_THREE_WIRE
*_QUEUE related
---
 drivers/net/wireless/rtlwifi/rtl8188ee/def.h | 41 
 drivers/net/wireless/rtlwifi/rtl8192ce/def.h | 41 
 drivers/net/wireless/rtlwifi/rtl8192de/def.h | 38 --
 drivers/net/wireless/rtlwifi/rtl8192se/def.h |  1 -
 drivers/net/wireless/rtlwifi/rtl8723ae/def.h | 41 
 drivers/net/wireless/rtlwifi/rtl8821ae/def.h | 41 
 6 files changed, 203 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/def.h 
b/drivers/net/wireless/rtlwifi/rtl8188ee/def.h
index d9ea9d0..0532b98 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/def.h
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/def.h
@@ -26,53 +26,12 @@
 #ifndef __RTL92C_DEF_H__
 #define __RTL92C_DEF_H__
 
-#define HAL_RETRY_LIMIT_INFRA  48
-#define HAL_RETRY_LIMIT_AP_ADHOC   7
-
-#define RESET_DELAY_8185   20
-
-#define RT_IBSS_INT_MASKS  (IMR_BCNINT | IMR_TBDOK | IMR_TBDER)
-#define RT_AC_INT_MASKS(IMR_VIDOK | IMR_VODOK | 
IMR_BEDOK|IMR_BKDOK)
-
-#define NUM_OF_FIRMWARE_QUEUE  10
-#define NUM_OF_PAGES_IN_FW 0x100
-#define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x07
-#define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x07
-#define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x07
-#define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x07
-#define NUM_OF_PAGE_IN_FW_QUEUE_HCCA   0x0
-#define NUM_OF_PAGE_IN_FW_QUEUE_CMD0x0
-#define NUM_OF_PAGE_IN_FW_QUEUE_MGNT   0x02
-#define NUM_OF_PAGE_IN_FW_QUEUE_HIGH   0x02
-#define NUM_OF_PAGE_IN_FW_QUEUE_BCN0x2
-#define NUM_OF_PAGE_IN_FW_QUEUE_PUB0xA1
-
-#define NUM_OF_PAGE_IN_FW_QUEUE_BK_DTM 0x026
-#define NUM_OF_PAGE_IN_FW_QUEUE_BE_DTM 0x048
-#define NUM_OF_PAGE_IN_FW_QUEUE_VI_DTM 0x048
-#define NUM_OF_PAGE_IN_FW_QUEUE_VO_DTM 0x026
-#define NUM_OF_PAGE_IN_FW_QUEUE_PUB_DTM0x00
-
-#define MAX_LINES_HWCONFIG_TXT 1000
-#define MAX_BYTES_LINE_HWCONFIG_TXT256
-
-#define SW_THREE_WIRE  0
-#define HW_THREE_WIRE  2
-
-#define BT_DEMO_BOARD  0
-#define BT_QA_BOARD1
-#define BT_FPGA2
-
 #define HAL_PRIME_CHNL_OFFSET_DONT_CARE0
 #define HAL_PRIME_CHNL_OFFSET_LOWER1
 #define HAL_PRIME_CHNL_OFFSET_UPPER2
 
-#define MAX_H2C_QUEUE_NUM  10
-
 #define RX_MPDU_QUEUE  0
 #define RX_CMD_QUEUE   1
-#define RX_MAX_QUEUE   2
-#define AC2QUEUEID(_AC)(_AC)
 
 #defineC2H_RX_CMD_HDR_LEN  8
 #defineGET_C2H_CMD_CMD_LEN(__prxhdr)   \
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h 
b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
index 9b660df..690a7a1 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
@@ -30,59 +30,18 @@
 #ifndef __RTL92C_DEF_H__
 #define __RTL92C_DEF_H__
 
-#define HAL_RETRY_LIMIT_INFRA  48
-#define HAL_RETRY_LIMIT_AP_ADHOC   7
-
 #definePHY_RSSI_SLID_WIN_MAX   100
 #definePHY_LINKQUALITY_SLID_WIN_MAX20
 #definePHY_BEACON_RSSI_SLID_WIN_MAX10
 
-#define RESET_DELAY_8185   20
-
-#define RT_IBSS_INT_MASKS  (IMR_BCNINT | IMR_TBDOK | IMR_TBDER)
-#define RT_AC_INT_MASKS(IMR_VIDOK | IMR_VODOK | 
IMR_BEDOK|IMR_BKDOK)
-
-#define NUM_OF_FIRMWARE_QUEUE  10
-#define NUM_OF_PAGES_IN_FW 0x100
-#define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x07
-#define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x07
-#define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x07
-#define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x07
-#define NUM_OF_PAGE_IN_FW_QUEUE_HCCA   0x0
-#define NUM_OF_PAGE_IN_FW_QUEUE_CMD0x0
-#define NUM_OF_PAGE_IN_FW_QUEUE_MGNT   0x02
-#define NUM_OF_PAGE_IN_FW_QUEUE_HIGH   0x02
-#define NUM_OF_PAGE_IN_FW_QUEUE_BCN0x2
-#define NUM_OF_PAGE_IN_FW_QUEUE_PUB0xA1
-
-#define NUM_OF_PAGE_IN_FW_QUEUE_BK_DTM

[PATCH v2 1/7] rtlwifi: Remove unused defines from rtl8192cu driver

2015-02-15 Thread Priit Laes
---
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h 
b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
index c1e33b0..6758808 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
@@ -32,8 +32,6 @@
 
 #define H2C_RA_MASK6
 
-#define LLT_POLLING_LLT_THRESHOLD  20
-#define LLT_POLLING_READY_TIMEOUT_COUNT100
 #define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER255
 
 #define RX_PAGE_SIZE_REG_VALUE PBP_128
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/7] rtlwifi: Remove unused RF6052_MAX_REG define

2015-02-15 Thread Priit Laes
---
 drivers/net/wireless/rtlwifi/rtl8188ee/rf.h  | 1 -
 drivers/net/wireless/rtlwifi/rtl8192ce/rf.h  | 1 -
 drivers/net/wireless/rtlwifi/rtl8192cu/rf.h  | 1 -
 drivers/net/wireless/rtlwifi/rtl8192de/def.h | 1 -
 drivers/net/wireless/rtlwifi/rtl8192ee/rf.h  | 1 -
 drivers/net/wireless/rtlwifi/rtl8723ae/rf.h  | 1 -
 drivers/net/wireless/rtlwifi/rtl8723be/rf.h  | 1 -
 drivers/net/wireless/rtlwifi/rtl8821ae/rf.h  | 1 -
 8 files changed, 8 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/rf.h 
b/drivers/net/wireless/rtlwifi/rtl8188ee/rf.h
index 5c1472d..0eca030 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/rf.h
@@ -27,7 +27,6 @@
 #define __RTL92C_RF_H__
 
 #define RF6052_MAX_TX_PWR  0x3F
-#define RF6052_MAX_REG 0x3F
 
 void rtl88e_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw,
 u8 bandwidth);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h 
b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
index d8fe68b..ebd72ca 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
@@ -31,7 +31,6 @@
 #define __RTL92C_RF_H__
 
 #define RF6052_MAX_TX_PWR  0x3F
-#define RF6052_MAX_REG 0x3F
 #define RF6052_MAX_PATH2
 
 void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h 
b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
index 11b439d..6f987de 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
@@ -31,7 +31,6 @@
 #define __RTL92CU_RF_H__
 
 #define RF6052_MAX_TX_PWR  0x3F
-#define RF6052_MAX_REG 0x3F
 #define RF6052_MAX_PATH2
 
 void rtl92cu_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/def.h 
b/drivers/net/wireless/rtlwifi/rtl8192de/def.h
index 4ca1fe1..0a443ed 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/def.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/def.h
@@ -35,7 +35,6 @@
 #defineMAX_MSS_DENSITY_1T  0x0A
 
 #define RF6052_MAX_TX_PWR  0x3F
-#define RF6052_MAX_REG 0x3F
 #define RF6052_MAX_PATH2
 
 #definePHY_RSSI_SLID_WIN_MAX   100
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/rf.h 
b/drivers/net/wireless/rtlwifi/rtl8192ee/rf.h
index 8bdeed3..039c013 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ee/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ee/rf.h
@@ -27,7 +27,6 @@
 #define __RTL92E_RF_H__
 
 #define RF6052_MAX_TX_PWR  0x3F
-#define RF6052_MAX_REG 0x3F
 
 void rtl92ee_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw,
  u8 bandwidth);
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h 
b/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h
index f3f45b1..7b44ebc 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h
@@ -27,7 +27,6 @@
 #define __RTL8723E_RF_H__
 
 #define RF6052_MAX_TX_PWR  0x3F
-#define RF6052_MAX_REG 0x3F
 
 void rtl8723e_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw,
   u8 bandwidth);
diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/rf.h 
b/drivers/net/wireless/rtlwifi/rtl8723be/rf.h
index a6fea10..f423e15 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723be/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8723be/rf.h
@@ -27,7 +27,6 @@
 #define __RTL8723BE_RF_H__
 
 #define RF6052_MAX_TX_PWR  0x3F
-#define RF6052_MAX_REG 0x3F
 
 void rtl8723be_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw,
u8 bandwidth);
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/rf.h 
b/drivers/net/wireless/rtlwifi/rtl8821ae/rf.h
index d9582ee..efd22bd 100644
--- a/drivers/net/wireless/rtlwifi/rtl8821ae/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8821ae/rf.h
@@ -27,7 +27,6 @@
 #define __RTL8821AE_RF_H__
 
 #define RF6052_MAX_TX_PWR  0x3F
-#define RF6052_MAX_REG 0x3F
 
 void rtl8821ae_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw,
u8 bandwidth);
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 6/7] rtlwifi: Remove unused defines from efuse.h

2015-02-15 Thread Priit Laes
---
 drivers/net/wireless/rtlwifi/efuse.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/efuse.h 
b/drivers/net/wireless/rtlwifi/efuse.h
index fdab824..be02e78 100644
--- a/drivers/net/wireless/rtlwifi/efuse.h
+++ b/drivers/net/wireless/rtlwifi/efuse.h
@@ -40,12 +40,6 @@
 #define PG_STATE_WORD_30x10
 #define PG_STATE_DATA  0x20
 
-#define PG_SWBYTE_H0x01
-#define PG_SWBYTE_L0x02
-
-#define _POWERON_DELAY_
-#define _PRE_EXECUTE_READ_CMD_
-
 #define EFUSE_REPEAT_THRESHOLD_3
 #define EFUSE_ERROE_HANDLE 1
 
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 5/7] rtlwifi: Remove unused defines from base.h

2015-02-15 Thread Priit Laes
---
 drivers/net/wireless/rtlwifi/base.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/base.h 
b/drivers/net/wireless/rtlwifi/base.h
index c6cb49c..dee4ac2 100644
--- a/drivers/net/wireless/rtlwifi/base.h
+++ b/drivers/net/wireless/rtlwifi/base.h
@@ -45,9 +45,6 @@ enum ap_peer {
 #define RTL_TX_DESC_SIZE   32
 #define RTL_TX_HEADER_SIZE (RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE)
 
-#define HT_AMSDU_SIZE_4K   3839
-#define HT_AMSDU_SIZE_8K   7935
-
 #define MAX_BIT_RATE_40MHZ_MCS15   300 /* Mbps */
 #define MAX_BIT_RATE_40MHZ_MCS7150 /* Mbps */
 
@@ -61,9 +58,6 @@ enum ap_peer {
 #define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS9   390 /* Mbps */
 #define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS7   293 /* Mbps */
 
-#define RTL_RATE_COUNT_LEGACY  12
-#define RTL_CHANNEL_COUNT  14
-
 #define FRAME_OFFSET_FRAME_CONTROL 0
 #define FRAME_OFFSET_DURATION  2
 #define FRAME_OFFSET_ADDRESS1  4
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 7/7] rtlwifi: Remove unused RTL_SUPPORTED_CTRL_FILTER define

2015-02-15 Thread Priit Laes
---
 drivers/net/wireless/rtlwifi/core.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/core.h 
b/drivers/net/wireless/rtlwifi/core.h
index 7b64e34..82733c6 100644
--- a/drivers/net/wireless/rtlwifi/core.h
+++ b/drivers/net/wireless/rtlwifi/core.h
@@ -33,8 +33,6 @@
FIF_FCSFAIL | \
FIF_BCN_PRBRESP_PROMISC)
 
-#define RTL_SUPPORTED_CTRL_FILTER  0xFF
-
 #define DM_DIG_THRESH_HIGH 40
 #define DM_DIG_THRESH_LOW  35
 #define DM_FALSEALARM_THRESH_LOW   400
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: fix AP/IBSS CSA with template based fw

2015-02-15 Thread Michal Kazior
On 15 February 2015 at 16:51, Kalle Valo kv...@qca.qualcomm.com wrote:
 Michal Kazior michal.kaz...@tieto.com writes:

 qca6174 with wmi-tlv firmware uses offloaded
 beaconing scheme (i.e. templates). This requires a
 little different approach when implementing CSA.

 Add missing code to update CS count and report CSA
 completion to mac80211. Without it channel switch
 was never finished.

 To avoid races during interface teardown data_lock
 has been used to protect is_up and is_started so
 they can be compared against before scheduling
 count down work.

 Signed-off-by: Michal Kazior michal.kaz...@tieto.com
 ---

 @Kalle: I'm deferring the chanctx patchset v4
 until this gets applied. I'd like to avoid posting
 patches without a valid parent id and leaving you
 with some weird conflicts and implicit depndencies
 in the code to deal with.

 Ok.

 I actually had strange conflicts already with this patch (in mac.c). As
 I'm travelling, please check my resolution from the pending branch very
 carefully. I might have done something stupid.

There's a mistake. Only `arvif-is_up` should be protected by
`ar-data_lock` in ath10k_bss_assoc():

@@ -1852,7 +1901,9 @@ static void ath10k_bss_assoc(struct ieee80211_hw *hw,
return;
}

+   spin_lock_bh(arvif-ar-data_lock);
arvif-is_up = true;
+   spin_unlock_bh(arvif-ar-data_lock);

/* Workaround: Some firmware revisions (tested with qca6174
   (...)
 }


Michał
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] brcmfmac: avoid duplicated suspend/resume operation

2015-02-15 Thread Fu, Zhonghui

On 2015/2/15 22:54, Kalle Valo wrote:
 Arend van Spriel ar...@broadcom.com writes:

 On 02/15/15 04:27, Pat Erley wrote:
 On 02/14/2015 08:40 PM, Fu, Zhonghui wrote:
 Any comments to this patch? Can it be accepted?
 I assume that patches are queued up until after the merge window that
 we are currently in.
 That's right. In the future I will most likely apply patches also during
 the merge window, but as I'm still a greenhorn I'll be on the safe and
 wait for the merge window to end.
I am very glad to see this.
Could you please tell which release candidate this patch will be likely merged 
into now?


Thanks,
Zhonghui

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] ath10k: implement fw stats for wmi-tlv

2015-02-15 Thread Michal Kazior
On 15 February 2015 at 16:15, Kalle Valo kv...@qca.qualcomm.com wrote:
 Michal Kazior michal.kaz...@tieto.com writes:

 There are some slight differences in fw stats
 (sic) in wmi-tlv.

 Firmware has changed the querying scheme and no
 longer requires the ping-pong to get all stats.
 The patchset doesn't change this behaviour so with
 wmi-tlv it's possible to see the following
 warnings when reading fw stats:

  ath10k_pci :00:06.0: received unsolicited stats update event

 The logic in ath10k still produces correct results
 so this is harmless.

 I wonder how to deal with this in a sane way. An
 `if (op_ver == WMI_TLV)` is a little bad but
 having a new ar-fw_feature flag just for a debug
 facility like this is a bit silly. Or we can just
 drop the warning and leave a comment. Ideas?

 I think we could just drop the warning and leave a comment. That
 shouldn't break anything, right?

We end up performing a few extra wmi exchanges but this is harmless.
Having an extra condition to handle this cleanly with wmi-tlv/qca6174
seems a bit of an overkill.

The warning was just an explicit way of specifying what we expected of
the fw stats exchange logic. The assertion is no longer valid so it
can go away.


Michał
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


PROBLEM: rtlwifi drops most IPv6 packets

2015-02-15 Thread Alan Fisher

Hello!

I have a machine with a Realtek RTL8188 wireless card. This card is 
handled by the rtl8192 driver. The driver in kernel 3.16.0-4 causes most 
sent ARP packets to be dropped. ARP packets appear to get through with 
the driver in kernel 3.19, but IPv6 packets suffer instead. I have 
reproduced this when connected to multiple access points.


I think I have traced this issue to some code in the rtlwifi driver that 
does special handling on special packets. The function 
rtl_is_special_data() in base.c determines whether a packet is 
considered special. In the 3.16 kernel, this includes ARP packets, 
wireless encryption packets, and DHCP/BOOTP packets. IPv6 appears to 
have been added to this list as of kernel 3.19.


It seems the idea is that certain important packets should be 
transmitted at the lowest possible 802.11 rate. The 
rtl_is_special_data() function is used to determine which packets to 
handle this way. Not treating any packets as special, by adding a 
return false; at the beginning of rtl_is_special_data(), seems to fix 
the problems with lost packets with both kernels.


I would guess that some good reason exists for this special handling, 
but I can't determine what it is. I couldn't find anything similar in 
iwlwifi. Either way, it seems like a bug to send all IPv6 traffic at the 
lowest possible rate, successful or not.


-Alan
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/9] ath9k patches

2015-02-15 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

ath9k patches for -next.

Sujith Manoharan (9):
  ath9k: Move MCI registers to reg_mci.h
  ath9k: Remove useless check in MCI reset
  ath9k: Add new MCI configuration parameters
  ath9k: Handle 2-ANT AR9565 in MCI reset
  ath9k: Fix MCI TX control
  ath9k: Setup MCI statistics properly
  ath9k: Prepare MCI interface correctly
  ath9k: Fix GPM initialization
  ath9k: Mute BT properly

 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 158 ++
 drivers/net/wireless/ath/ath9k/ar9003_mci.h |  24 ++-
 drivers/net/wireless/ath/ath9k/hw.h |   1 +
 drivers/net/wireless/ath/ath9k/mci.c|   5 +-
 drivers/net/wireless/ath/ath9k/reg.h| 275 
 drivers/net/wireless/ath/ath9k/reg_mci.h| 310 
 6 files changed, 449 insertions(+), 324 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/reg_mci.h

-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/9] ath9k: Setup MCI statistics properly

2015-02-15 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

Use a subroutine to enable MCI debug statistics
if it is present in the global configuration.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 23 ---
 drivers/net/wireless/ath/ath9k/reg_mci.h|  5 +
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.c 
b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
index aca9015..de65ce1 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mci.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
@@ -821,6 +821,25 @@ static void ar9003_mci_osla_setup(struct ath_hw *ah, bool 
enable)
  AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN, 1);
 }
 
+static void ar9003_mci_stat_setup(struct ath_hw *ah)
+{
+   struct ath9k_hw_mci *mci = ah-btcoex_hw.mci;
+
+   if (!AR_SREV_9565(ah))
+   return;
+
+   if (mci-config  ATH_MCI_CONFIG_MCI_STAT_DBG) {
+   REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL,
+ AR_MCI_DBG_CNT_CTRL_ENABLE, 1);
+   REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL,
+ AR_MCI_DBG_CNT_CTRL_BT_LINKID,
+ MCI_STAT_ALL_BT_LINKID);
+   } else {
+   REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL,
+ AR_MCI_DBG_CNT_CTRL_ENABLE, 0);
+   }
+}
+
 static void ar9003_mci_set_btcoex_ctrl_9565_1ANT(struct ath_hw *ah)
 {
u32 regval;
@@ -984,10 +1003,8 @@ int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool 
is_2g,
 
mci-ready = true;
ar9003_mci_prep_interface(ah);
+   ar9003_mci_stat_setup(ah);
 
-   if (AR_SREV_9565(ah))
-   REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL,
- AR_MCI_DBG_CNT_CTRL_ENABLE, 0);
if (en_int)
ar9003_mci_enable_interrupt(ah);
 
diff --git a/drivers/net/wireless/ath/ath9k/reg_mci.h 
b/drivers/net/wireless/ath/ath9k/reg_mci.h
index 8d1572d..3bd7c21 100644
--- a/drivers/net/wireless/ath/ath9k/reg_mci.h
+++ b/drivers/net/wireless/ath/ath9k/reg_mci.h
@@ -265,9 +265,14 @@
 #define AR_MCI_MISC 0x1a74
 #define AR_MCI_MISC_HW_FIX_EN   0x0001
 #define AR_MCI_MISC_HW_FIX_EN_S 0
+
 #define AR_MCI_DBG_CNT_CTRL 0x1a78
 #define AR_MCI_DBG_CNT_CTRL_ENABLE  0x0001
 #define AR_MCI_DBG_CNT_CTRL_ENABLE_S0
+#define AR_MCI_DBG_CNT_CTRL_BT_LINKID   0x07f8
+#define AR_MCI_DBG_CNT_CTRL_BT_LINKID_S 3
+
+#define MCI_STAT_ALL_BT_LINKID  0x
 
 #define AR_MCI_INTERRUPT_DEFAULT (AR_MCI_INTERRUPT_SW_MSG_DONE | \
  AR_MCI_INTERRUPT_RX_INVALID_HDR  | \
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/9] ath9k: Handle 2-ANT AR9565 in MCI reset

2015-02-15 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

The value programmed in the BTCOEX control register
is different for each chip. This patch adds support
for 2-ANT, 1-ANT solutions based on AR9565.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 78 +++--
 drivers/net/wireless/ath/ath9k/ar9003_mci.h |  7 +++
 2 files changed, 69 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.c 
b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
index 4aed985..1a48528 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mci.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
@@ -821,6 +821,61 @@ static void ar9003_mci_osla_setup(struct ath_hw *ah, bool 
enable)
  AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN, 1);
 }
 
+static void ar9003_mci_set_btcoex_ctrl_9565_1ANT(struct ath_hw *ah)
+{
+   u32 regval;
+
+   regval = SM(1, AR_BTCOEX_CTRL_AR9462_MODE) |
+SM(1, AR_BTCOEX_CTRL_WBTIMER_EN) |
+SM(1, AR_BTCOEX_CTRL_PA_SHARED) |
+SM(1, AR_BTCOEX_CTRL_LNA_SHARED) |
+SM(1, AR_BTCOEX_CTRL_NUM_ANTENNAS) |
+SM(1, AR_BTCOEX_CTRL_RX_CHAIN_MASK) |
+SM(0, AR_BTCOEX_CTRL_1_CHAIN_ACK) |
+SM(0, AR_BTCOEX_CTRL_1_CHAIN_BCN) |
+SM(0, AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
+
+   REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2,
+ AR_BTCOEX_CTRL2_TX_CHAIN_MASK, 0x1);
+   REG_WRITE(ah, AR_BTCOEX_CTRL, regval);
+}
+
+static void ar9003_mci_set_btcoex_ctrl_9565_2ANT(struct ath_hw *ah)
+{
+   u32 regval;
+
+   regval = SM(1, AR_BTCOEX_CTRL_AR9462_MODE) |
+SM(1, AR_BTCOEX_CTRL_WBTIMER_EN) |
+SM(0, AR_BTCOEX_CTRL_PA_SHARED) |
+SM(0, AR_BTCOEX_CTRL_LNA_SHARED) |
+SM(2, AR_BTCOEX_CTRL_NUM_ANTENNAS) |
+SM(1, AR_BTCOEX_CTRL_RX_CHAIN_MASK) |
+SM(0, AR_BTCOEX_CTRL_1_CHAIN_ACK) |
+SM(0, AR_BTCOEX_CTRL_1_CHAIN_BCN) |
+SM(0, AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
+
+   REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2,
+ AR_BTCOEX_CTRL2_TX_CHAIN_MASK, 0x0);
+   REG_WRITE(ah, AR_BTCOEX_CTRL, regval);
+}
+
+static void ar9003_mci_set_btcoex_ctrl_9462(struct ath_hw *ah)
+{
+   u32 regval;
+
+regval = SM(1, AR_BTCOEX_CTRL_AR9462_MODE) |
+SM(1, AR_BTCOEX_CTRL_WBTIMER_EN) |
+SM(1, AR_BTCOEX_CTRL_PA_SHARED) |
+SM(1, AR_BTCOEX_CTRL_LNA_SHARED) |
+SM(2, AR_BTCOEX_CTRL_NUM_ANTENNAS) |
+SM(3, AR_BTCOEX_CTRL_RX_CHAIN_MASK) |
+SM(0, AR_BTCOEX_CTRL_1_CHAIN_ACK) |
+SM(0, AR_BTCOEX_CTRL_1_CHAIN_BCN) |
+SM(0, AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
+
+   REG_WRITE(ah, AR_BTCOEX_CTRL, regval);
+}
+
 int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g,
 bool is_full_sleep)
 {
@@ -845,26 +900,17 @@ int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool 
is_2g,
* To avoid MCI state machine be affected by incoming remote MCI msgs,
* MCI mode will be enabled later, right before reset the MCI TX and RX.
*/
-
-   regval = SM(1, AR_BTCOEX_CTRL_AR9462_MODE) |
-SM(1, AR_BTCOEX_CTRL_WBTIMER_EN) |
-SM(1, AR_BTCOEX_CTRL_PA_SHARED) |
-SM(1, AR_BTCOEX_CTRL_LNA_SHARED) |
-SM(0, AR_BTCOEX_CTRL_1_CHAIN_ACK) |
-SM(0, AR_BTCOEX_CTRL_1_CHAIN_BCN) |
-SM(0, AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN);
if (AR_SREV_9565(ah)) {
-   regval |= SM(1, AR_BTCOEX_CTRL_NUM_ANTENNAS) |
- SM(1, AR_BTCOEX_CTRL_RX_CHAIN_MASK);
-   REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2,
- AR_BTCOEX_CTRL2_TX_CHAIN_MASK, 0x1);
+   u8 ant = MS(mci-config, ATH_MCI_CONFIG_ANT_ARCH);
+
+   if (ant == ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_SHARED)
+   ar9003_mci_set_btcoex_ctrl_9565_1ANT(ah);
+   else
+   ar9003_mci_set_btcoex_ctrl_9565_2ANT(ah);
} else {
-   regval |= SM(2, AR_BTCOEX_CTRL_NUM_ANTENNAS) |
- SM(3, AR_BTCOEX_CTRL_RX_CHAIN_MASK);
+   ar9003_mci_set_btcoex_ctrl_9462(ah);
}
 
-   REG_WRITE(ah, AR_BTCOEX_CTRL, regval);
-
if (is_2g  !(mci-config  ATH_MCI_CONFIG_DISABLE_OSLA))
ar9003_mci_osla_setup(ah, true);
else
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.h 
b/drivers/net/wireless/ath/ath9k/ar9003_mci.h
index e8b1914..6f305ab 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mci.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.h
@@ -109,8 +109,15 @@ enum mci_gpm_coex_bt_update_flags_op {
 #define ATH_MCI_CONFIG_MCI_OBS_MASK (ATH_MCI_CONFIG_MCI_OBS_MCI  | 

[PATCH 1/9] ath9k: Move MCI registers to reg_mci.h

2015-02-15 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/hw.h  |   1 +
 drivers/net/wireless/ath/ath9k/reg.h | 275 
 drivers/net/wireless/ath/ath9k/reg_mci.h | 300 +++
 3 files changed, 301 insertions(+), 275 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/reg_mci.h

diff --git a/drivers/net/wireless/ath/ath9k/hw.h 
b/drivers/net/wireless/ath/ath9k/hw.h
index e82e570..29a25d9 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -27,6 +27,7 @@
 #include eeprom.h
 #include calib.h
 #include reg.h
+#include reg_mci.h
 #include phy.h
 #include btcoex.h
 #include dynack.h
diff --git a/drivers/net/wireless/ath/ath9k/reg.h 
b/drivers/net/wireless/ath/ath9k/reg.h
index 9587ec6..1234399 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -2044,279 +2044,4 @@ enum {
 #define AR_PHY_AGC_CONTROL_YCOK_MAX0x03c0
 #define AR_PHY_AGC_CONTROL_YCOK_MAX_S  6
 
-/* MCI Registers */
-
-#define AR_MCI_COMMAND00x1800
-#define AR_MCI_COMMAND0_HEADER 0xFF
-#define AR_MCI_COMMAND0_HEADER_S   0
-#define AR_MCI_COMMAND0_LEN0x1f00
-#define AR_MCI_COMMAND0_LEN_S  8
-#define AR_MCI_COMMAND0_DISABLE_TIMESTAMP  0x2000
-#define AR_MCI_COMMAND0_DISABLE_TIMESTAMP_S13
-
-#define AR_MCI_COMMAND10x1804
-
-#define AR_MCI_COMMAND20x1808
-#define AR_MCI_COMMAND2_RESET_TX   0x01
-#define AR_MCI_COMMAND2_RESET_TX_S 0
-#define AR_MCI_COMMAND2_RESET_RX   0x02
-#define AR_MCI_COMMAND2_RESET_RX_S 1
-#define AR_MCI_COMMAND2_RESET_RX_NUM_CYCLES 0x3FC
-#define AR_MCI_COMMAND2_RESET_RX_NUM_CYCLES_S   2
-#define AR_MCI_COMMAND2_RESET_REQ_WAKEUP0x400
-#define AR_MCI_COMMAND2_RESET_REQ_WAKEUP_S  10
-
-#define AR_MCI_RX_CTRL 0x180c
-
-#define AR_MCI_TX_CTRL 0x1810
-/* 0 = no division, 1 = divide by 2, 2 = divide by 4, 3 = divide by 8 */
-#define AR_MCI_TX_CTRL_CLK_DIV 0x03
-#define AR_MCI_TX_CTRL_CLK_DIV_S   0
-#define AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE  0x04
-#define AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE_S2
-#define AR_MCI_TX_CTRL_GAIN_UPDATE_FREQ0xF8
-#define AR_MCI_TX_CTRL_GAIN_UPDATE_FREQ_S  3
-#define AR_MCI_TX_CTRL_GAIN_UPDATE_NUM 0xF00
-#define AR_MCI_TX_CTRL_GAIN_UPDATE_NUM_S   24
-
-#define AR_MCI_MSG_ATTRIBUTES_TABLE0x1814
-#define AR_MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM   0x
-#define AR_MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM_S 0
-#define AR_MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR0x
-#define AR_MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR_S  16
-
-#define AR_MCI_SCHD_TABLE_00x1818
-#define AR_MCI_SCHD_TABLE_10x181c
-#define AR_MCI_GPM_0   0x1820
-#define AR_MCI_GPM_1   0x1824
-#define AR_MCI_GPM_WRITE_PTR   0x
-#define AR_MCI_GPM_WRITE_PTR_S 16
-#define AR_MCI_GPM_BUF_LEN 0x
-#define AR_MCI_GPM_BUF_LEN_S   0
-
-#define AR_MCI_INTERRUPT_RAW   0x1828
-#define AR_MCI_INTERRUPT_EN0x182c
-#define AR_MCI_INTERRUPT_SW_MSG_DONE   0x0001
-#define AR_MCI_INTERRUPT_SW_MSG_DONE_S 0
-#define AR_MCI_INTERRUPT_CPU_INT_MSG   0x0002
-#define AR_MCI_INTERRUPT_CPU_INT_MSG_S 1
-#define AR_MCI_INTERRUPT_RX_CKSUM_FAIL 0x0004
-#define AR_MCI_INTERRUPT_RX_CKSUM_FAIL_S   2
-#define AR_MCI_INTERRUPT_RX_INVALID_HDR0x0008
-#define AR_MCI_INTERRUPT_RX_INVALID_HDR_S  3
-#define AR_MCI_INTERRUPT_RX_HW_MSG_FAIL0x0010
-#define AR_MCI_INTERRUPT_RX_HW_MSG_FAIL_S  4
-#define AR_MCI_INTERRUPT_RX_SW_MSG_FAIL0x0020
-#define AR_MCI_INTERRUPT_RX_SW_MSG_FAIL_S  5
-#define AR_MCI_INTERRUPT_TX_HW_MSG_FAIL0x0080
-#define AR_MCI_INTERRUPT_TX_HW_MSG_FAIL_S  7
-#define AR_MCI_INTERRUPT_TX_SW_MSG_FAIL0x0100
-#define AR_MCI_INTERRUPT_TX_SW_MSG_FAIL_S  8
-#define AR_MCI_INTERRUPT_RX_MSG0x0200
-#define AR_MCI_INTERRUPT_RX_MSG_S  9
-#define AR_MCI_INTERRUPT_REMOTE_SLEEP_UPDATE   0x0400
-#define AR_MCI_INTERRUPT_REMOTE_SLEEP_UPDATE_S 10
-#define AR_MCI_INTERRUPT_BT_PRI  

[PATCH 5/9] ath9k: Fix MCI TX control

2015-02-15 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

This patch makes sure that the antenna configuration
is used properly when setting AR_MCI_TX_CTRL.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 8 ++--
 drivers/net/wireless/ath/ath9k/ar9003_mci.h | 4 
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.c 
b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
index 1a48528..aca9015 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mci.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
@@ -973,8 +973,12 @@ int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool 
is_2g,
  (SM(0xe801, AR_MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR) |
   SM(0x, AR_MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM)));
 
-   REG_CLR_BIT(ah, AR_MCI_TX_CTRL,
-   AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE);
+   if (MCI_ANT_ARCH_PA_LNA_SHARED(mci))
+   REG_CLR_BIT(ah, AR_MCI_TX_CTRL,
+   AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE);
+   else
+   REG_SET_BIT(ah, AR_MCI_TX_CTRL,
+   AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE);
 
ar9003_mci_observation_set_up(ah);
 
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.h 
b/drivers/net/wireless/ath/ath9k/ar9003_mci.h
index 6f305ab..174ebea 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mci.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.h
@@ -118,6 +118,10 @@ enum mci_gpm_coex_bt_update_flags_op {
 #define ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_SHARED 0x03
 #define ATH_MCI_ANT_ARCH_3_ANT   0x04
 
+#define MCI_ANT_ARCH_PA_LNA_SHARED(mci)
\
+   ((MS(mci-config, ATH_MCI_CONFIG_ANT_ARCH) == 
ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_SHARED) || \
+(MS(mci-config, ATH_MCI_CONFIG_ANT_ARCH) == 
ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_SHARED))
+
 enum mci_message_header {  /* length of payload */
MCI_LNA_CTRL = 0x10,/* len = 0 */
MCI_CONT_NACK= 0x20,/* len = 0 */
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/9] ath9k: Mute BT properly

2015-02-15 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

Set The BT/WLAN priority weights correctly and make sure
that MCI_LNA_TAKE is sent only for cards that share
PA/LNA.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 13 ++---
 drivers/net/wireless/ath/ath9k/reg_mci.h|  5 +
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.c 
b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
index 133b867..bd169fa 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mci.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
@@ -771,8 +771,14 @@ exit:
 
 static void ar9003_mci_mute_bt(struct ath_hw *ah)
 {
+   struct ath9k_hw_mci *mci = ah-btcoex_hw.mci;
+
/* disable all MCI messages */
REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE, 0x);
+   REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS0, 0x);
+   REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS1, 0x);
+   REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS2, 0x);
+   REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS3, 0x);
REG_SET_BIT(ah, AR_MCI_TX_CTRL, AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE);
 
/* wait pending HW messages to flush out */
@@ -783,9 +789,10 @@ static void ar9003_mci_mute_bt(struct ath_hw *ah)
 * 1. reset not after resuming from full sleep
 * 2. before reset MCI RX, to quiet BT and avoid MCI RX misalignment
 */
-   ar9003_mci_send_lna_take(ah, true);
-
-   udelay(5);
+   if (MCI_ANT_ARCH_PA_LNA_SHARED(mci)) {
+   ar9003_mci_send_lna_take(ah, true);
+   udelay(5);
+   }
 
ar9003_mci_send_sys_sleeping(ah, true);
 }
diff --git a/drivers/net/wireless/ath/ath9k/reg_mci.h 
b/drivers/net/wireless/ath/ath9k/reg_mci.h
index 3bd7c21..6251310 100644
--- a/drivers/net/wireless/ath/ath9k/reg_mci.h
+++ b/drivers/net/wireless/ath/ath9k/reg_mci.h
@@ -212,6 +212,11 @@
 #define AR_BTCOEX_CTRL_SPDT_POLARITY0x8000
 #define AR_BTCOEX_CTRL_SPDT_POLARITY_S  31
 
+#define AR_BTCOEX_WL_WEIGHTS0   0x18b0
+#define AR_BTCOEX_WL_WEIGHTS1   0x18b4
+#define AR_BTCOEX_WL_WEIGHTS2   0x18b8
+#define AR_BTCOEX_WL_WEIGHTS3   0x18bc
+
 #define AR_BTCOEX_MAX_TXPWR(_x) (0x18c0 + ((_x)  2))
 #define AR_BTCOEX_WL_LNA0x1940
 #define AR_BTCOEX_RFGAIN_CTRL   0x1944
-- 
2.3.0

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/9] ath9k: Fix GPM initialization

2015-02-15 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

Handle MCI_STATE_INIT_GPM_OFFSET separately and do not
overload ar9003_mci_get_next_gpm_offset() with a special
case.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ar9003_mci.c | 27 +--
 drivers/net/wireless/ath/ath9k/ar9003_mci.h |  2 +-
 drivers/net/wireless/ath/ath9k/mci.c|  5 ++---
 3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.c 
b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
index 505dfe3..133b867 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mci.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
@@ -593,7 +593,7 @@ static u32 ar9003_mci_wait_for_gpm(struct ath_hw *ah, u8 
gpm_type,
if (!time_out)
break;
 
-   offset = ar9003_mci_get_next_gpm_offset(ah, false, more_data);
+   offset = ar9003_mci_get_next_gpm_offset(ah, more_data);
 
if (offset == MCI_GPM_INVALID)
continue;
@@ -657,7 +657,7 @@ static u32 ar9003_mci_wait_for_gpm(struct ath_hw *ah, u8 
gpm_type,
time_out = 0;
 
while (more_data == MCI_GPM_MORE) {
-   offset = ar9003_mci_get_next_gpm_offset(ah, false, more_data);
+   offset = ar9003_mci_get_next_gpm_offset(ah, more_data);
if (offset == MCI_GPM_INVALID)
break;
 
@@ -986,7 +986,8 @@ int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool 
is_2g,
regval = ~SM(1, AR_MCI_COMMAND2_RESET_RX);
REG_WRITE(ah, AR_MCI_COMMAND2, regval);
 
-   ar9003_mci_get_next_gpm_offset(ah, true, NULL);
+   /* Init GPM offset after MCI Reset Rx */
+   ar9003_mci_state(ah, MCI_STATE_INIT_GPM_OFFSET);
 
REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE,
  (SM(0xe801, AR_MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR) |
@@ -1280,6 +1281,14 @@ u32 ar9003_mci_state(struct ath_hw *ah, u32 state_type)
}
value = AR_BTCOEX_CTRL_MCI_MODE_EN;
break;
+   case MCI_STATE_INIT_GPM_OFFSET:
+   value = MS(REG_READ(ah, AR_MCI_GPM_1), AR_MCI_GPM_WRITE_PTR);
+
+   if (value  mci-gpm_len)
+   mci-gpm_idx = value;
+   else
+   mci-gpm_idx = 0;
+   break;
case MCI_STATE_LAST_SCHD_MSG_OFFSET:
value = MS(REG_READ(ah, AR_MCI_RX_STATUS),
AR_MCI_RX_LAST_SCHD_MSG_INDEX);
@@ -1426,21 +1435,11 @@ void ar9003_mci_check_gpm_offset(struct ath_hw *ah)
mci-gpm_idx = 0;
 }
 
-u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, bool first, u32 *more)
+u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, u32 *more)
 {
struct ath9k_hw_mci *mci = ah-btcoex_hw.mci;
u32 offset, more_gpm = 0, gpm_ptr;
 
-   if (first) {
-   gpm_ptr = MS(REG_READ(ah, AR_MCI_GPM_1), AR_MCI_GPM_WRITE_PTR);
-
-   if (gpm_ptr = mci-gpm_len)
-   gpm_ptr = 0;
-
-   mci-gpm_idx = gpm_ptr;
-   return gpm_ptr;
-   }
-
/*
 * This could be useful to avoid new GPM message interrupt which
 * may lead to spurious interrupt after power sleep, or multiple
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.h 
b/drivers/net/wireless/ath/ath9k/ar9003_mci.h
index 174ebea..e288611 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mci.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.h
@@ -312,7 +312,7 @@ int ar9003_mci_setup(struct ath_hw *ah, u32 gpm_addr, void 
*gpm_buf,
 void ar9003_mci_cleanup(struct ath_hw *ah);
 void ar9003_mci_get_interrupt(struct ath_hw *ah, u32 *raw_intr,
  u32 *rx_msg_intr);
-u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, bool first, u32 *more);
+u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, u32 *more);
 void ar9003_mci_set_bt_version(struct ath_hw *ah, u8 major, u8 minor);
 void ar9003_mci_send_wlan_channels(struct ath_hw *ah);
 /*
diff --git a/drivers/net/wireless/ath/ath9k/mci.c 
b/drivers/net/wireless/ath/ath9k/mci.c
index 3f7a11e..66596b9 100644
--- a/drivers/net/wireless/ath/ath9k/mci.c
+++ b/drivers/net/wireless/ath/ath9k/mci.c
@@ -495,7 +495,7 @@ void ath_mci_intr(struct ath_softc *sc)
ar9003_mci_get_interrupt(sc-sc_ah, mci_int, mci_int_rxmsg);
 
if (ar9003_mci_state(ah, MCI_STATE_ENABLE) == 0) {
-   ar9003_mci_get_next_gpm_offset(ah, true, NULL);
+   ar9003_mci_state(ah, MCI_STATE_INIT_GPM_OFFSET);
return;
}
 
@@ -559,8 +559,7 @@ void ath_mci_intr(struct ath_softc *sc)
return;
 
pgpm = mci-gpm_buf.bf_addr;
-   offset = ar9003_mci_get_next_gpm_offset(ah, false,
-   more_data);
+