[PATCH] mac80211: Allow probe response frame rx to user space in AP mode

2016-03-06 Thread Vasanthakumar Thiagarajan
Especially during off-channel scan user space might be interested
in probe reponse frames along with beacon to build a list
of preferred channel and bssid which could be sent to the stations
around for better spectrum management. Do not drop probe response
frame in AP mode and advertise driver's capability to receive probe
response frame in AP mode to user space.

Signed-off-by: Vasanthakumar Thiagarajan 
---
 net/mac80211/main.c | 2 ++
 net/mac80211/rx.c   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 8190bf2..c8a97da 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -401,6 +401,7 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
.rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_RESP >> 4) |
BIT(IEEE80211_STYPE_DISASSOC >> 4) |
BIT(IEEE80211_STYPE_AUTH >> 4) |
BIT(IEEE80211_STYPE_DEAUTH >> 4) |
@@ -412,6 +413,7 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
.rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_RESP >> 4) |
BIT(IEEE80211_STYPE_DISASSOC >> 4) |
BIT(IEEE80211_STYPE_AUTH >> 4) |
BIT(IEEE80211_STYPE_DEAUTH >> 4) |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 9127957..9d8f8ea 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3464,6 +3464,8 @@ static bool ieee80211_accept_frame(struct 
ieee80211_rx_data *rx)
return false;
if (ieee80211_is_public_action(hdr, skb->len))
return true;
+   if (ieee80211_is_probe_resp(hdr->frame_control))
+   return true;
return ieee80211_is_beacon(hdr->frame_control);
}
 
-- 
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


Re: [PATCH v2 00/11] ath10k: implement push-pull tx model

2016-03-06 Thread Michal Kazior
On 6 March 2016 at 15:18, Valo, Kalle  wrote:
> Michal Kazior  writes:
>
>> This adds support for the new logic where host
>> tells firmware how many frames are queued for each
>> station/tid and then firmware asks host to submit
>> frames for given station/tid.
>>
>> The patch count is a bit high but I tried
>> splitting the patches as much as possible to keep
>> them short and easy to review. Hopefully it's not
>> going to be a huge headache.
>>
>> v2:
>>  - squashes some patches
>>  - reworked pending frame scheduling
>>
>>
>> Michal Kazior (11):
>>   ath10k: refactor tx code
>>   ath10k: unify txpath decision
>>   ath10k: refactor tx pending management
>>   ath10k: maintain peer_id for each sta and vif
>>   ath10k: add fast peer_map lookup
>>   ath10k: add new htt message generation/parsing logic
>>   ath10k: implement wake_tx_queue
>>   ath10k: implement updating shared htt txq state
>>   ath10k: store txq in skb_cb
>>   ath10k: keep track of queue depth per txq
>>   ath10k: implement push-pull tx
>
> I saw two conflicts, please double check my resolutions in the pending
> branch:
>
> Applying: ath10k: implement wake_tx_queue
> CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/htt_rx.c
[...]
> Applying: ath10k: implement push-pull tx
> CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/htt_rx.c

Looks good, thanks!


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 v2 07/11] ath10k: implement wake_tx_queue

2016-03-06 Thread Michal Kazior
On 6 March 2016 at 15:27, Valo, Kalle  wrote:
> Michal Kazior  writes:
>
>> This implements very basic support for software
>> queueing. It also contains some knobs that will be
>> patched later.
>>
>> Signed-off-by: Michal Kazior 
>
> Oddly this patch introduces a new warning:
>
> drivers/net/wireless/ath/ath10k/mac.c: In function ath10k_mac_op_tx:
> drivers/net/wireless/ath/ath10k/mac.c:3949:29: warning: is_mgmt may be used 
> uninitialized in this function [-Wuninitialized]
>
> But I think that's just a false warning, most likely because my gcc is
> ancient. Do you agree?

Yes, I agree. It must be the fact is_mgmt is set/used across two
is_htt condition branches.


> gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

gcc (Debian 4.9.2-10) 4.9.2 -- no warning for me.


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


[PATCH] mac80211: mesh: fix crash in mesh_path_timer

2016-03-06 Thread Bob Copeland
The mesh_path_reclaim() function, called from an rcu callback, cancels
the mesh_path_timer associated with a mesh path.  Unfortunately, this
call can happen much later, perhaps after the hash table itself is
destroyed.

Such a situation led to the following crash in mesh_path_send_to_gates()
when dereferencing the tbl pointer:

[   23.901661] BUG: unable to handle kernel NULL pointer dereference at 
0008
[   23.905516] IP: [] mesh_path_send_to_gates+0x2b/0x740
[   23.908757] PGD 99ca067 PUD 99c4067 PMD 0
[   23.910789] Oops:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
[   23.913485] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.5.0-rc6-wt+ #43
[   23.916675] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
Debian-1.8.2-1 04/01/2014
[   23.920471] task: 81685500 ti: 81678000 task.ti: 
81678000
[   23.922619] RIP: 0010:[]  [] 
mesh_path_send_to_gates+0x2b/0x740
[   23.925237] RSP: 0018:88000b403d30  EFLAGS: 00010286
[   23.926739] RAX:  RBX: 880009bc0d20 RCX: 0102
[   23.928796] RDX: 002e RSI: 0001 RDI: 880009bc0d20
[   23.930895] RBP: 88000b403e18 R08: 0001 R09: 0001
[   23.932917] R10:  R11: 0001 R12: 880009c20940
[   23.936370] R13: 880009bc0e70 R14: 880009c21c40 R15: 880009bc0d20
[   23.939823] FS:  () GS:88000b40() 
knlGS:
[   23.943688] CS:  0010 DS:  ES:  CR0: 8005003b
[   23.946429] CR2: 0008 CR3: 099c5000 CR4: 06b0
[   23.949861] Stack:
[   23.950840]  002e 880009c20940 88000b403da8 
8109e551
[   23.954467]  82711be2 002e  
8166a5f5
[   23.958141]  00685ce8 0246 880009bc0d20 
880009c20940
[   23.961801] Call Trace:
[   23.962987]  
[   23.963963]  [] ? vprintk_emit+0x351/0x5e0
[   23.966782]  [] ? vprintk_default+0x1f/0x30
[   23.969529]  [] ? printk+0x48/0x50
[   23.971956]  [] mesh_path_timer+0x133/0x160
[   23.974707]  [] ? mesh_nexthop_resolve+0x230/0x230
[   23.95]  [] call_timer_fn+0xce/0x330
[   23.980448]  [] ? call_timer_fn+0x5/0x330
[   23.983126]  [] ? mesh_nexthop_resolve+0x230/0x230
[   23.986091]  [] run_timer_softirq+0x22c/0x390

Instead of cancelling in the RCU callback, set a new flag to prevent the
timer from being rearmed, and then cancel the timer synchronously when
freeing the mesh path.  This leaves mesh_path_reclaim() doing nothing
but kfree, so switch to kfree_rcu().

Fixes: 3b302ada7f0a ("mac80211: mesh: move path tables into if_mesh")
Reported-by: Jouni Malinen 
Signed-off-by: Bob Copeland 
---
 net/mac80211/mesh.h |  3 +++
 net/mac80211/mesh_hwmp.c|  2 ++
 net/mac80211/mesh_pathtbl.c | 34 +++---
 3 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index cc6854db156e..e1415c952e9c 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -32,6 +32,8 @@
  * @MESH_PATH_RESOLVED: the mesh path can has been resolved
  * @MESH_PATH_REQ_QUEUED: there is an unsent path request for this destination
  * already queued up, waiting for the discovery process to start.
+ * @MESH_PATH_DELETED: the mesh path has been deleted and should no longer
+ * be used
  *
  * MESH_PATH_RESOLVED is used by the mesh path timer to
  * decide when to stop or cancel the mesh path discovery.
@@ -43,6 +45,7 @@ enum mesh_path_flags {
MESH_PATH_FIXED =   BIT(3),
MESH_PATH_RESOLVED =BIT(4),
MESH_PATH_REQ_QUEUED =  BIT(5),
+   MESH_PATH_DELETED = BIT(6),
 };
 
 /**
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index c6be0b4f4058..bdf4647c158c 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -1012,6 +1012,8 @@ void mesh_path_start_discovery(struct 
ieee80211_sub_if_data *sdata)
goto enddiscovery;
 
spin_lock_bh(>state_lock);
+   if (mpath->flags & MESH_PATH_DELETED)
+   goto enddiscovery;
mpath->flags &= ~MESH_PATH_REQ_QUEUED;
if (preq_node->flags & PREQ_Q_F_START) {
if (mpath->flags & MESH_PATH_RESOLVING) {
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 7455397f8c3b..2c2c81e1d7c9 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -18,6 +18,9 @@
 #include "ieee80211_i.h"
 #include "mesh.h"
 
+static void mesh_gate_del(struct mesh_table *tbl, struct mesh_path *mpath);
+static void mesh_path_free_rcu(struct mesh_table *tbl, struct mesh_path 
*mpath);
+
 static u32 mesh_table_hash(const void *addr, u32 len, u32 seed)
 {
/* Use last four bytes of hw addr as hash index */
@@ -40,18 +43,12 @@ static inline bool mpath_expired(struct mesh_path *mpath)
   !(mpath->flags & 

[PATCH v4 7/8] ath9k: fix BTCoex access invalid registers for SOC chips

2016-03-06 Thread miaoqing
From: Miaoqing Pan 

The registers of AR_GPIO_INPUT_MUX1 and AR_GPIO_PDPU were removed
from SOC chips, fix invalid accessing

Signed-off-by: Miaoqing Pan 
---
 drivers/net/wireless/ath/ath9k/btcoex.c | 27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c 
b/drivers/net/wireless/ath/ath9k/btcoex.c
index 95a810b..d46cd31 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.c
+++ b/drivers/net/wireless/ath/ath9k/btcoex.c
@@ -162,9 +162,10 @@ void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah)
AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB);
 
/* Set input mux for bt_active to gpio pin */
-   REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
- AR_GPIO_INPUT_MUX1_BT_ACTIVE,
- btcoex_hw->btactive_gpio);
+   if (!AR_SREV_SOC(ah))
+   REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
+ AR_GPIO_INPUT_MUX1_BT_ACTIVE,
+ btcoex_hw->btactive_gpio);
 
/* Configure the desired gpio port for input */
ath9k_hw_gpio_request_in(ah, btcoex_hw->btactive_gpio,
@@ -183,13 +184,14 @@ void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah)
 
/* Set input mux for bt_prority_async and
 *  bt_active_async to GPIO pins */
-   REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
-   AR_GPIO_INPUT_MUX1_BT_ACTIVE,
-   btcoex_hw->btactive_gpio);
-
-   REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
-   AR_GPIO_INPUT_MUX1_BT_PRIORITY,
-   btcoex_hw->btpriority_gpio);
+   if (!AR_SREV_SOC(ah)) {
+   REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
+ AR_GPIO_INPUT_MUX1_BT_ACTIVE,
+ btcoex_hw->btactive_gpio);
+   REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
+ AR_GPIO_INPUT_MUX1_BT_PRIORITY,
+ btcoex_hw->btpriority_gpio);
+   }
 
/* Configure the desired GPIO ports for input */
ath9k_hw_gpio_request_in(ah, btcoex_hw->btactive_gpio,
@@ -285,13 +287,13 @@ void ath9k_hw_btcoex_set_weight(struct ath_hw *ah,
 txprio_shift[i-1]);
}
}
+
/* Last WLAN weight has to be adjusted wrt tx priority */
if (concur_tx) {
btcoex_hw->wlan_weight[i-1] &= ~(0xff << txprio_shift[i-1]);
btcoex_hw->wlan_weight[i-1] |= (btcoex_hw->tx_prio[stomp_type]
  << txprio_shift[i-1]);
}
-
 }
 EXPORT_SYMBOL(ath9k_hw_btcoex_set_weight);
 
@@ -375,7 +377,8 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah)
break;
}
 
-   if (ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_MCI) {
+   if (ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_MCI &&
+   !AR_SREV_SOC(ah)) {
REG_RMW(ah, AR_GPIO_PDPU,
(0x2 << (btcoex_hw->btactive_gpio * 2)),
(0x3 << (btcoex_hw->btactive_gpio * 2)));
-- 
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


[PATCH v4 8/8] ath9k: fix BTCoex configuration for SOC chips

2016-03-06 Thread miaoqing
From: Miaoqing Pan 

Allow to set wl_active_time and wl_qc_time for SOC chips, also adjust
bt_time_extend and bt_first_slot_time.

Signed-off-by: Miaoqing Pan 
---
 drivers/net/wireless/ath/ath9k/btcoex.c | 31 ---
 drivers/net/wireless/ath/ath9k/btcoex.h |  1 +
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c 
b/drivers/net/wireless/ath/ath9k/btcoex.c
index d46cd31..618c9df 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.c
+++ b/drivers/net/wireless/ath/ath9k/btcoex.c
@@ -36,6 +36,8 @@ struct ath_btcoex_config {
u8 bt_priority_time;
u8 bt_first_slot_time;
bool bt_hold_rx_clear;
+   u8 wl_active_time;
+   u8 wl_qc_time;
 };
 
 static const u32 ar9003_wlan_weights[ATH_BTCOEX_STOMP_MAX]
@@ -67,25 +69,42 @@ void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum)
.bt_priority_time = 2,
.bt_first_slot_time = 5,
.bt_hold_rx_clear = true,
+   .wl_active_time = 0x20,
+   .wl_qc_time = 0x20,
};
bool rxclear_polarity = ath_bt_config.bt_rxclear_polarity;
+   u8 time_extend = ath_bt_config.bt_time_extend;
+   u8 first_slot_time = ath_bt_config.bt_first_slot_time;
 
if (AR_SREV_9300_20_OR_LATER(ah))
rxclear_polarity = !ath_bt_config.bt_rxclear_polarity;
 
+   if (AR_SREV_SOC(ah)) {
+   first_slot_time = 0x1d;
+   time_extend = 0xa;
+
+   btcoex_hw->bt_coex_mode3 =
+   SM(ath_bt_config.wl_active_time, AR_BT_WL_ACTIVE_TIME) |
+   SM(ath_bt_config.wl_qc_time, AR_BT_WL_QC_TIME);
+
+   btcoex_hw->bt_coex_mode2 =
+   AR_BT_PROTECT_BT_AFTER_WAKEUP |
+   AR_BT_PHY_ERR_BT_COLL_ENABLE;
+   }
+
btcoex_hw->bt_coex_mode =
(btcoex_hw->bt_coex_mode & AR_BT_QCU_THRESH) |
-   SM(ath_bt_config.bt_time_extend, AR_BT_TIME_EXTEND) |
+   SM(time_extend, AR_BT_TIME_EXTEND) |
SM(ath_bt_config.bt_txstate_extend, AR_BT_TXSTATE_EXTEND) |
SM(ath_bt_config.bt_txframe_extend, AR_BT_TX_FRAME_EXTEND) |
SM(ath_bt_config.bt_mode, AR_BT_MODE) |
SM(ath_bt_config.bt_quiet_collision, AR_BT_QUIET) |
SM(rxclear_polarity, AR_BT_RX_CLEAR_POLARITY) |
SM(ath_bt_config.bt_priority_time, AR_BT_PRIORITY_TIME) |
-   SM(ath_bt_config.bt_first_slot_time, AR_BT_FIRST_SLOT_TIME) |
+   SM(first_slot_time, AR_BT_FIRST_SLOT_TIME) |
SM(qnum, AR_BT_QCU_THRESH);
 
-   btcoex_hw->bt_coex_mode2 =
+   btcoex_hw->bt_coex_mode2 |=
SM(ath_bt_config.bt_hold_rx_clear, AR_BT_HOLD_RX_CLEAR) |
SM(ATH_BTCOEX_BMISS_THRESH, AR_BT_BCN_MISS_THRESH) |
AR_BT_DISABLE_BT_ANT;
@@ -308,9 +327,15 @@ static void ath9k_hw_btcoex_enable_3wire(struct ath_hw *ah)
 * Program coex mode and weight registers to
 * enable coex 3-wire
 */
+   if (AR_SREV_SOC(ah))
+   REG_CLR_BIT(ah, AR_BT_COEX_MODE2, AR_BT_PHY_ERR_BT_COLL_ENABLE);
+
REG_WRITE(ah, AR_BT_COEX_MODE, btcoex->bt_coex_mode);
REG_WRITE(ah, AR_BT_COEX_MODE2, btcoex->bt_coex_mode2);
 
+   if (AR_SREV_SOC(ah))
+   REG_WRITE(ah, AR_BT_COEX_MODE3, btcoex->bt_coex_mode3);
+
if (AR_SREV_9300_20_OR_LATER(ah)) {
REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS0, btcoex->wlan_weight[0]);
REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS1, btcoex->wlan_weight[1]);
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.h 
b/drivers/net/wireless/ath/ath9k/btcoex.h
index 0f7c4e6..1bdfa84 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.h
+++ b/drivers/net/wireless/ath/ath9k/btcoex.h
@@ -115,6 +115,7 @@ struct ath_btcoex_hw {
u32 bt_coex_mode;   /* Register setting for AR_BT_COEX_MODE */
u32 bt_coex_weights;/* Register setting for AR_BT_COEX_WEIGHT */
u32 bt_coex_mode2;  /* Register setting for AR_BT_COEX_MODE2 */
+   u32 bt_coex_mode3;  /* Register setting for AR_BT_COEX_MODE3 */
u32 bt_weight[AR9300_NUM_BT_WEIGHTS];
u32 wlan_weight[AR9300_NUM_WLAN_WEIGHTS];
u8 tx_prio[ATH_BTCOEX_STOMP_MAX];
-- 
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


[PATCH v4 0/8] ath9k GPIO & BT-Coex bug fixes

2016-03-06 Thread miaoqing
From: Miaoqing Pan 

ath9k GPIO & BT-Coex bug fixes.

Notes:
v2: fix build warning
v3: move changelog to cover letter
v4: fix [5/8] comments

Miaoqing Pan (8):
  ath9k: define correct GPIO numbers and bits mask
  ath9k: make GPIO API to support both of WMAC and SOC
  ath9k: free GPIO resource for SOC GPIOs
  ath9k: cleanup led_pin initial
  ath9k: Allow platform override BTCoex pin
  ath9k: add bits definition of BTCoex MODE2/3 for SOC chips
  ath9k: fix BTCoex access invalid registers for SOC chips
  ath9k: fix BTCoex configuration for SOC chips

 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |   4 +-
 drivers/net/wireless/ath/ath9k/ar9003_mci.c|  39 ++--
 drivers/net/wireless/ath/ath9k/ath9k.h |   4 -
 drivers/net/wireless/ath/ath9k/btcoex.c| 138 +
 drivers/net/wireless/ath/ath9k/btcoex.h|   2 +
 drivers/net/wireless/ath/ath9k/gpio.c  |  69 ---
 drivers/net/wireless/ath/ath9k/htc_drv_gpio.c  |   8 +-
 drivers/net/wireless/ath/ath9k/hw.c| 267 -
 drivers/net/wireless/ath/ath9k/hw.h|  11 +-
 drivers/net/wireless/ath/ath9k/init.c  |   1 -
 drivers/net/wireless/ath/ath9k/main.c  |   9 +-
 drivers/net/wireless/ath/ath9k/reg.h   |  90 +++--
 include/linux/ath9k_platform.h |   4 +
 13 files changed, 436 insertions(+), 210 deletions(-)

-- 
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


[PATCH v4 2/8] ath9k: make GPIO API to support both of WMAC and SOC

2016-03-06 Thread miaoqing
From: Miaoqing Pan 

commit 61b559dea40e ("ath9k: add extra GPIO led support")
added ath9k to support access SOC's GPIOs, but implemented
in a separated API: ath9k_hw_request_gpio().

So this patch make the APIs more common, to support both
of WMAC and SOC GPIOs. The new APIs as below,

void ath9k_hw_gpio_request_in();
void ath9k_hw_gpio_request_out();
void ath9k_hw_gpio_free();

NOTE, the BSP of the SOC chips(AR9340, AR9531, AR9550, AR9561)
should set the corresponding MUX registers correctly.

Signed-off-by: Miaoqing Pan 
---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |   4 +-
 drivers/net/wireless/ath/ath9k/ar9003_mci.c|  39 +++--
 drivers/net/wireless/ath/ath9k/btcoex.c|  27 ++--
 drivers/net/wireless/ath/ath9k/gpio.c  |   6 +-
 drivers/net/wireless/ath/ath9k/htc_drv_gpio.c  |   6 +-
 drivers/net/wireless/ath/ath9k/hw.c| 196 +++--
 drivers/net/wireless/ath/ath9k/hw.h|  10 +-
 drivers/net/wireless/ath/ath9k/main.c  |   6 +-
 8 files changed, 174 insertions(+), 120 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c 
b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 8b4561e..e434869 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -3590,8 +3590,8 @@ static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, 
bool is2ghz)
else
gpio = AR9300_EXT_LNA_CTL_GPIO_AR9485;
 
-   ath9k_hw_cfg_output(ah, gpio,
-   AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED);
+   ath9k_hw_gpio_request_out(ah, gpio, NULL,
+ 
AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED);
}
 
value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz);
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.c 
b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
index af5ee41..0fe9c83 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mci.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
@@ -427,21 +427,34 @@ static void ar9003_mci_observation_set_up(struct ath_hw 
*ah)
struct ath9k_hw_mci *mci = >btcoex_hw.mci;
 
if (mci->config & ATH_MCI_CONFIG_MCI_OBS_MCI) {
-   ath9k_hw_cfg_output(ah, 3, AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_DATA);
-   ath9k_hw_cfg_output(ah, 2, AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_CLK);
-   ath9k_hw_cfg_output(ah, 1, AR_GPIO_OUTPUT_MUX_AS_MCI_BT_DATA);
-   ath9k_hw_cfg_output(ah, 0, AR_GPIO_OUTPUT_MUX_AS_MCI_BT_CLK);
+   ath9k_hw_gpio_request_out(ah, 3, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_DATA);
+   ath9k_hw_gpio_request_out(ah, 2, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_CLK);
+   ath9k_hw_gpio_request_out(ah, 1, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_MCI_BT_DATA);
+   ath9k_hw_gpio_request_out(ah, 0, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_MCI_BT_CLK);
} else if (mci->config & ATH_MCI_CONFIG_MCI_OBS_TXRX) {
-   ath9k_hw_cfg_output(ah, 3, AR_GPIO_OUTPUT_MUX_AS_WL_IN_TX);
-   ath9k_hw_cfg_output(ah, 2, AR_GPIO_OUTPUT_MUX_AS_WL_IN_RX);
-   ath9k_hw_cfg_output(ah, 1, AR_GPIO_OUTPUT_MUX_AS_BT_IN_TX);
-   ath9k_hw_cfg_output(ah, 0, AR_GPIO_OUTPUT_MUX_AS_BT_IN_RX);
-   ath9k_hw_cfg_output(ah, 5, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
+   ath9k_hw_gpio_request_out(ah, 3, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_WL_IN_TX);
+   ath9k_hw_gpio_request_out(ah, 2, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_WL_IN_RX);
+   ath9k_hw_gpio_request_out(ah, 1, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_BT_IN_TX);
+   ath9k_hw_gpio_request_out(ah, 0, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_BT_IN_RX);
+   ath9k_hw_gpio_request_out(ah, 5, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
} else if (mci->config & ATH_MCI_CONFIG_MCI_OBS_BT) {
-   ath9k_hw_cfg_output(ah, 3, AR_GPIO_OUTPUT_MUX_AS_BT_IN_TX);
-   ath9k_hw_cfg_output(ah, 2, AR_GPIO_OUTPUT_MUX_AS_BT_IN_RX);
-   ath9k_hw_cfg_output(ah, 1, AR_GPIO_OUTPUT_MUX_AS_MCI_BT_DATA);
-   ath9k_hw_cfg_output(ah, 0, AR_GPIO_OUTPUT_MUX_AS_MCI_BT_CLK);
+   ath9k_hw_gpio_request_out(ah, 3, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_BT_IN_TX);
+   ath9k_hw_gpio_request_out(ah, 2, NULL,
+ AR_GPIO_OUTPUT_MUX_AS_BT_IN_RX);
+   ath9k_hw_gpio_request_out(ah, 1, NULL,
+ 

[PATCH v4 3/8] ath9k: free GPIO resource for SOC GPIOs

2016-03-06 Thread miaoqing
From: Miaoqing Pan 

For SOC GPIOs, should call ath9k_hw_gpio_free() to release
the GPIO resource.

Signed-off-by: Miaoqing Pan 
---
 drivers/net/wireless/ath/ath9k/btcoex.c   | 10 ++
 drivers/net/wireless/ath/ath9k/btcoex.h   |  1 +
 drivers/net/wireless/ath/ath9k/gpio.c |  9 +
 drivers/net/wireless/ath/ath9k/htc_drv_gpio.c |  2 ++
 drivers/net/wireless/ath/ath9k/hw.c   |  1 +
 5 files changed, 23 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c 
b/drivers/net/wireless/ath/ath9k/btcoex.c
index 7719cb1..4737aa9 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.c
+++ b/drivers/net/wireless/ath/ath9k/btcoex.c
@@ -174,6 +174,16 @@ void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah)
 }
 EXPORT_SYMBOL(ath9k_hw_btcoex_init_3wire);
 
+void ath9k_hw_btcoex_deinit(struct ath_hw *ah)
+{
+   struct ath_btcoex_hw *btcoex_hw = >btcoex_hw;
+
+   ath9k_hw_gpio_free(ah, btcoex_hw->btactive_gpio);
+   ath9k_hw_gpio_free(ah, btcoex_hw->btpriority_gpio);
+   ath9k_hw_gpio_free(ah, btcoex_hw->wlanactive_gpio);
+}
+EXPORT_SYMBOL(ath9k_hw_btcoex_deinit);
+
 void ath9k_hw_btcoex_init_mci(struct ath_hw *ah)
 {
ah->btcoex_hw.mci.ready = false;
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.h 
b/drivers/net/wireless/ath/ath9k/btcoex.h
index cd2f0a2..0f7c4e6 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.h
+++ b/drivers/net/wireless/ath/ath9k/btcoex.h
@@ -123,6 +123,7 @@ struct ath_btcoex_hw {
 void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah);
 void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah);
 void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah);
+void ath9k_hw_btcoex_deinit(struct ath_hw *ah);
 void ath9k_hw_btcoex_init_mci(struct ath_hw *ah);
 void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum);
 void ath9k_hw_btcoex_set_weight(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c 
b/drivers/net/wireless/ath/ath9k/gpio.c
index b41dfb7..4964bb3 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -40,6 +40,8 @@ void ath_deinit_leds(struct ath_softc *sc)
 
ath_led_brightness(>led_cdev, LED_OFF);
led_classdev_unregister(>led_cdev);
+
+   ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
 }
 
 void ath_init_leds(struct ath_softc *sc)
@@ -404,6 +406,13 @@ void ath9k_deinit_btcoex(struct ath_softc *sc)
 
if (ath9k_hw_mci_is_enabled(ah))
ath_mci_cleanup(sc);
+   else {
+   enum ath_btcoex_scheme scheme = ath9k_hw_get_btcoex_scheme(ah);
+
+   if (scheme == ATH_BTCOEX_CFG_2WIRE ||
+   scheme == ATH_BTCOEX_CFG_3WIRE)
+   ath9k_hw_btcoex_deinit(sc->sc_ah);
+   }
 }
 
 int ath9k_init_btcoex(struct ath_softc *sc)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
index d9b640a..ecb848b 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
@@ -253,6 +253,8 @@ void ath9k_deinit_leds(struct ath9k_htc_priv *priv)
ath9k_led_brightness(>led_cdev, LED_OFF);
led_classdev_unregister(>led_cdev);
cancel_work_sync(>led_work);
+
+   ath9k_hw_gpio_free(priv->ah, priv->ah->led_pin);
 }
 
 
diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
index 4046949..1fd6155 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1575,6 +1575,7 @@ static void ath9k_hw_apply_gpio_override(struct ath_hw 
*ah)
ath9k_hw_gpio_request_out(ah, i, NULL,
  AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i)));
+   ath9k_hw_gpio_free(ah, i);
}
 }
 
-- 
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


[PATCH v4 4/8] ath9k: cleanup led_pin initial

2016-03-06 Thread miaoqing
From: Miaoqing Pan 

Make ath_init_leds() and ath_deinit_leds() pairs as the only
API to set leds, also removed direction configuration from
ath9k_start() and ath9k_stop(). So the initial is more clear
now.

Signed-off-by: Miaoqing Pan 
---
 drivers/net/wireless/ath/ath9k/ath9k.h |  4 ---
 drivers/net/wireless/ath/ath9k/gpio.c  | 62 --
 drivers/net/wireless/ath/ath9k/init.c  |  1 -
 drivers/net/wireless/ath/ath9k/main.c  |  9 ++---
 drivers/net/wireless/ath/ath9k/reg.h   |  2 --
 5 files changed, 31 insertions(+), 47 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 5294595..93b3793 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -813,7 +813,6 @@ static inline int ath9k_dump_btcoex(struct ath_softc *sc, 
u8 *buf, u32 size)
 #ifdef CONFIG_MAC80211_LEDS
 void ath_init_leds(struct ath_softc *sc);
 void ath_deinit_leds(struct ath_softc *sc);
-void ath_fill_led_pin(struct ath_softc *sc);
 #else
 static inline void ath_init_leds(struct ath_softc *sc)
 {
@@ -822,9 +821,6 @@ static inline void ath_init_leds(struct ath_softc *sc)
 static inline void ath_deinit_leds(struct ath_softc *sc)
 {
 }
-static inline void ath_fill_led_pin(struct ath_softc *sc)
-{
-}
 #endif
 
 //
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c 
b/drivers/net/wireless/ath/ath9k/gpio.c
index 4964bb3..490f74d 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -21,6 +21,33 @@
 //
 
 #ifdef CONFIG_MAC80211_LEDS
+
+void ath_fill_led_pin(struct ath_softc *sc)
+{
+   struct ath_hw *ah = sc->sc_ah;
+
+   /* Set default led pin if invalid */
+   if (ah->led_pin < 0) {
+   if (AR_SREV_9287(ah))
+   ah->led_pin = ATH_LED_PIN_9287;
+   else if (AR_SREV_9485(ah))
+   ah->led_pin = ATH_LED_PIN_9485;
+   else if (AR_SREV_9300(ah))
+   ah->led_pin = ATH_LED_PIN_9300;
+   else if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
+   ah->led_pin = ATH_LED_PIN_9462;
+   else
+   ah->led_pin = ATH_LED_PIN_DEF;
+   }
+
+   /* Configure gpio for output */
+   ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
+
+   /* LED off, active low */
+   ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1);
+}
+
 static void ath_led_brightness(struct led_classdev *led_cdev,
   enum led_brightness brightness)
 {
@@ -51,6 +78,8 @@ void ath_init_leds(struct ath_softc *sc)
if (AR_SREV_9100(sc->sc_ah))
return;
 
+   ath_fill_led_pin(sc);
+
if (!ath9k_led_blink)
sc->led_cdev.default_trigger =
ieee80211_get_radio_led_name(sc->hw);
@@ -66,39 +95,6 @@ void ath_init_leds(struct ath_softc *sc)
 
sc->led_registered = true;
 }
-
-void ath_fill_led_pin(struct ath_softc *sc)
-{
-   struct ath_hw *ah = sc->sc_ah;
-
-   if (AR_SREV_9100(ah))
-   return;
-
-   if (ah->led_pin >= 0) {
-   if (!((1 << ah->led_pin) & AR_GPIO_OE_OUT_MASK))
-   ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
- AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
-   return;
-   }
-
-   if (AR_SREV_9287(ah))
-   ah->led_pin = ATH_LED_PIN_9287;
-   else if (AR_SREV_9485(sc->sc_ah))
-   ah->led_pin = ATH_LED_PIN_9485;
-   else if (AR_SREV_9300(sc->sc_ah))
-   ah->led_pin = ATH_LED_PIN_9300;
-   else if (AR_SREV_9462(sc->sc_ah) || AR_SREV_9565(sc->sc_ah))
-   ah->led_pin = ATH_LED_PIN_9462;
-   else
-   ah->led_pin = ATH_LED_PIN_DEF;
-
-   /* Configure gpio 1 for output */
-   ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
- AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
-
-   /* LED off, active low */
-   ath9k_hw_set_gpio(ah, ah->led_pin, (ah->config.led_active_high) ? 0 : 
1);
-}
 #endif
 
 /***/
diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index 2e2b92b..95c12fd 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -660,7 +660,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
 
ath9k_cmn_init_crypto(sc->sc_ah);
ath9k_init_misc(sc);
-   ath_fill_led_pin(sc);
ath_chanctx_init(sc);
ath9k_offchannel_init(sc);
 
diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index 95d0a53..f469a7c 100644
--- 

[PATCH v4 6/8] ath9k: add bits definition of BTCoex MODE2/3 for SOC chips

2016-03-06 Thread miaoqing
From: Miaoqing Pan 

Add bits definition for AR_BT_COEX_MODE2 and AR_BT_COEX_MODE3, which
needed by SOC chips (AR9340, AR9531, AR9550, AR9561).

Signed-off-by: Miaoqing Pan 
---
 drivers/net/wireless/ath/ath9k/reg.h | 46 +---
 1 file changed, 37 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/reg.h 
b/drivers/net/wireless/ath/ath9k/reg.h
index f82a4ad..f8a96f6 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -1890,15 +1890,33 @@ enum {
 
 #define AR9300_BT_WGHT 0x
 
-#define AR_BT_COEX_MODE2   0x817c
-#define AR_BT_BCN_MISS_THRESH  0x00ff
-#define AR_BT_BCN_MISS_THRESH_S0
-#define AR_BT_BCN_MISS_CNT 0xff00
-#define AR_BT_BCN_MISS_CNT_S   8
-#define AR_BT_HOLD_RX_CLEAR0x0001
-#define AR_BT_HOLD_RX_CLEAR_S  16
-#define AR_BT_DISABLE_BT_ANT   0x0010
-#define AR_BT_DISABLE_BT_ANT_S 20
+#define AR_BT_COEX_MODE2   0x817c
+#define AR_BT_BCN_MISS_THRESH  0x00ff
+#define AR_BT_BCN_MISS_THRESH_S0
+#define AR_BT_BCN_MISS_CNT 0xff00
+#define AR_BT_BCN_MISS_CNT_S   8
+#define AR_BT_HOLD_RX_CLEAR0x0001
+#define AR_BT_HOLD_RX_CLEAR_S  16
+#define AR_BT_PROTECT_BT_AFTER_WAKEUP  0x0008
+#define AR_BT_PROTECT_BT_AFTER_WAKEUP_S 19
+#define AR_BT_DISABLE_BT_ANT   0x0010
+#define AR_BT_DISABLE_BT_ANT_S 20
+#define AR_BT_QUIET_2_WIRE 0x0020
+#define AR_BT_QUIET_2_WIRE_S   21
+#define AR_BT_WL_ACTIVE_MODE   0x00c0
+#define AR_BT_WL_ACTIVE_MODE_S 22
+#define AR_BT_WL_TXRX_SEPARATE 0x0100
+#define AR_BT_WL_TXRX_SEPARATE_S   24
+#define AR_BT_RS_DISCARD_EXTEND0x0200
+#define AR_BT_RS_DISCARD_EXTEND_S  25
+#define AR_BT_TSF_BT_ACTIVE_CTRL   0x0c00
+#define AR_BT_TSF_BT_ACTIVE_CTRL_S 26
+#define AR_BT_TSF_BT_PRIORITY_CTRL 0x3000
+#define AR_BT_TSF_BT_PRIORITY_CTRL_S   28
+#define AR_BT_INTERRUPT_ENABLE 0x4000
+#define AR_BT_INTERRUPT_ENABLE_S   30
+#define AR_BT_PHY_ERR_BT_COLL_ENABLE   0x8000
+#define AR_BT_PHY_ERR_BT_COLL_ENABLE_S 31
 
 #define AR_TXSIFS  0x81d0
 #define AR_TXSIFS_TIME 0x00FF
@@ -1907,6 +1925,16 @@ enum {
 #define AR_TXSIFS_ACK_SHIFT0x7000
 #define AR_TXSIFS_ACK_SHIFT_S  12
 
+#define AR_BT_COEX_MODE3   0x81d4
+#define AR_BT_WL_ACTIVE_TIME   0x00ff
+#define AR_BT_WL_ACTIVE_TIME_S 0
+#define AR_BT_WL_QC_TIME   0xff00
+#define AR_BT_WL_QC_TIME_S 8
+#define AR_BT_ALLOW_CONCURRENT_ACCESS  0x000f
+#define AR_BT_ALLOW_CONCURRENT_ACCESS_S16
+#define AR_BT_AGC_SATURATION_CNT_ENABLE0x0010
+#define AR_BT_AGC_SATURATION_CNT_ENABLE_S  20
+
 #define AR_TXOP_X  0x81ec
 #define AR_TXOP_X_VAL  0x00FF
 
-- 
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


[PATCH v4 1/8] ath9k: define correct GPIO numbers and bits mask

2016-03-06 Thread miaoqing
From: Miaoqing Pan 

Define correct GPIO numbers and MASK bits to indicate the WMAC
GPIO resource.

Allow SOC chips(AR9340, AR9531, AR9550, AR9561) to access all GPIOs
which rely on gpiolib framework. But restrict SOC AR9330 only to
access WMAC GPIO which has the same design with the old chips.

Signed-off-by: Miaoqing Pan 
---
 drivers/net/wireless/ath/ath9k/hw.c  | 70 
 drivers/net/wireless/ath/ath9k/hw.h  |  1 +
 drivers/net/wireless/ath/ath9k/reg.h | 42 --
 3 files changed, 96 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
index 257f46e..0e80b3f 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2375,6 +2375,61 @@ static bool ath9k_hw_dfs_tested(struct ath_hw *ah)
}
 }
 
+static void ath9k_gpio_cap_init(struct ath_hw *ah)
+{
+   struct ath9k_hw_capabilities *pCap = >caps;
+
+   if (AR_SREV_9271(ah)) {
+   pCap->num_gpio_pins = AR9271_NUM_GPIO;
+   pCap->gpio_mask = AR9271_GPIO_MASK;
+   } else if (AR_DEVID_7010(ah)) {
+   pCap->num_gpio_pins = AR7010_NUM_GPIO;
+   pCap->gpio_mask = AR7010_GPIO_MASK;
+   } else if (AR_SREV_9287(ah)) {
+   pCap->num_gpio_pins = AR9287_NUM_GPIO;
+   pCap->gpio_mask = AR9287_GPIO_MASK;
+   } else if (AR_SREV_9285(ah)) {
+   pCap->num_gpio_pins = AR9285_NUM_GPIO;
+   pCap->gpio_mask = AR9285_GPIO_MASK;
+   } else if (AR_SREV_9280(ah)) {
+   pCap->num_gpio_pins = AR9280_NUM_GPIO;
+   pCap->gpio_mask = AR9280_GPIO_MASK;
+   } else if (AR_SREV_9300(ah)) {
+   pCap->num_gpio_pins = AR9300_NUM_GPIO;
+   pCap->gpio_mask = AR9300_GPIO_MASK;
+   } else if (AR_SREV_9330(ah)) {
+   pCap->num_gpio_pins = AR9330_NUM_GPIO;
+   pCap->gpio_mask = AR9330_GPIO_MASK;
+   } else if (AR_SREV_9340(ah)) {
+   pCap->num_gpio_pins = AR9340_NUM_GPIO;
+   pCap->gpio_mask = AR9340_GPIO_MASK;
+   } else if (AR_SREV_9462(ah)) {
+   pCap->num_gpio_pins = AR9462_NUM_GPIO;
+   pCap->gpio_mask = AR9462_GPIO_MASK;
+   } else if (AR_SREV_9485(ah)) {
+   pCap->num_gpio_pins = AR9485_NUM_GPIO;
+   pCap->gpio_mask = AR9485_GPIO_MASK;
+   } else if (AR_SREV_9531(ah)) {
+   pCap->num_gpio_pins = AR9531_NUM_GPIO;
+   pCap->gpio_mask = AR9531_GPIO_MASK;
+   } else if (AR_SREV_9550(ah)) {
+   pCap->num_gpio_pins = AR9550_NUM_GPIO;
+   pCap->gpio_mask = AR9550_GPIO_MASK;
+   } else if (AR_SREV_9561(ah)) {
+   pCap->num_gpio_pins = AR9561_NUM_GPIO;
+   pCap->gpio_mask = AR9561_GPIO_MASK;
+   } else if (AR_SREV_9565(ah)) {
+   pCap->num_gpio_pins = AR9565_NUM_GPIO;
+   pCap->gpio_mask = AR9565_GPIO_MASK;
+   } else if (AR_SREV_9580(ah)) {
+   pCap->num_gpio_pins = AR9580_NUM_GPIO;
+   pCap->gpio_mask = AR9580_GPIO_MASK;
+   } else {
+   pCap->num_gpio_pins = AR_NUM_GPIO;
+   pCap->gpio_mask = AR_GPIO_MASK;
+   }
+}
+
 int ath9k_hw_fill_cap_info(struct ath_hw *ah)
 {
struct ath9k_hw_capabilities *pCap = >caps;
@@ -2468,20 +2523,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
else
pCap->hw_caps &= ~ATH9K_HW_CAP_HT;
 
-   if (AR_SREV_9271(ah))
-   pCap->num_gpio_pins = AR9271_NUM_GPIO;
-   else if (AR_DEVID_7010(ah))
-   pCap->num_gpio_pins = AR7010_NUM_GPIO;
-   else if (AR_SREV_9300_20_OR_LATER(ah))
-   pCap->num_gpio_pins = AR9300_NUM_GPIO;
-   else if (AR_SREV_9287_11_OR_LATER(ah))
-   pCap->num_gpio_pins = AR9287_NUM_GPIO;
-   else if (AR_SREV_9285_12_OR_LATER(ah))
-   pCap->num_gpio_pins = AR9285_NUM_GPIO;
-   else if (AR_SREV_9280_20_OR_LATER(ah))
-   pCap->num_gpio_pins = AR928X_NUM_GPIO;
-   else
-   pCap->num_gpio_pins = AR_NUM_GPIO;
+   ath9k_gpio_cap_init(ah);
 
if (AR_SREV_9160_10_OR_LATER(ah) || AR_SREV_9100(ah))
pCap->rts_aggr_limit = ATH_AMPDU_LIMIT_MAX;
diff --git a/drivers/net/wireless/ath/ath9k/hw.h 
b/drivers/net/wireless/ath/ath9k/hw.h
index 831a544..c0740d6 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -301,6 +301,7 @@ struct ath9k_hw_capabilities {
u8 max_txchains;
u8 max_rxchains;
u8 num_gpio_pins;
+   u32 gpio_mask;
u8 rx_hp_qdepth;
u8 rx_lp_qdepth;
u8 rx_status_len;
diff --git a/drivers/net/wireless/ath/ath9k/reg.h 
b/drivers/net/wireless/ath/ath9k/reg.h
index caba54d..8903f70 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ 

[PATCH v4 5/8] ath9k: Allow platform override BTCoex pin

2016-03-06 Thread miaoqing
From: Miaoqing Pan 

Add new platform data to allow override BTCoex default pin.

Signed-off-by: Miaoqing Pan 
---
 drivers/net/wireless/ath/ath9k/btcoex.c | 45 +
 include/linux/ath9k_platform.h  |  4 +++
 2 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c 
b/drivers/net/wireless/ath/ath9k/btcoex.c
index 4737aa9..95a810b 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.c
+++ b/drivers/net/wireless/ath/ath9k/btcoex.c
@@ -15,6 +15,8 @@
  */
 
 #include 
+#include 
+#include 
 #include "hw.h"
 
 enum ath_bt_mode {
@@ -90,6 +92,29 @@ void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum)
 }
 EXPORT_SYMBOL(ath9k_hw_init_btcoex_hw);
 
+static void ath9k_hw_btcoex_pin_init(struct ath_hw *ah, u8 wlanactive_gpio,
+u8 btactive_gpio, u8 btpriority_gpio)
+{
+   struct ath_btcoex_hw *btcoex_hw = >btcoex_hw;
+   struct ath9k_platform_data *pdata = ah->dev->platform_data;
+
+   if (btcoex_hw->scheme != ATH_BTCOEX_CFG_2WIRE &&
+   btcoex_hw->scheme != ATH_BTCOEX_CFG_3WIRE)
+   return;
+
+   /* bt priority GPIO will be ignored by 2 wire scheme */
+   if (pdata && (pdata->bt_active_pin || pdata->bt_priority_pin ||
+ pdata->wlan_active_pin)) {
+   btcoex_hw->btactive_gpio = pdata->bt_active_pin;
+   btcoex_hw->wlanactive_gpio = pdata->wlan_active_pin;
+   btcoex_hw->btpriority_gpio = pdata->bt_priority_pin;
+   } else {
+   btcoex_hw->btactive_gpio = btactive_gpio;
+   btcoex_hw->wlanactive_gpio = wlanactive_gpio;
+   btcoex_hw->btpriority_gpio = btpriority_gpio;
+   }
+}
+
 void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah)
 {
struct ath_common *common = ath9k_hw_common(ah);
@@ -107,19 +132,19 @@ void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah)
btcoex_hw->scheme = ATH_BTCOEX_CFG_MCI;
} else if (AR_SREV_9300_20_OR_LATER(ah)) {
btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
-   btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300;
-   btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300;
-   btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9300;
-   } else if (AR_SREV_9280_20_OR_LATER(ah)) {
-   btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9280;
-   btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9280;
 
-   if (AR_SREV_9285(ah)) {
+   ath9k_hw_btcoex_pin_init(ah, ATH_WLANACTIVE_GPIO_9300,
+ATH_BTACTIVE_GPIO_9300,
+ATH_BTPRIORITY_GPIO_9300);
+   } else if (AR_SREV_9280_20_OR_LATER(ah)) {
+   if (AR_SREV_9285(ah))
btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE;
-   btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9285;
-   } else {
+   else
btcoex_hw->scheme = ATH_BTCOEX_CFG_2WIRE;
-   }
+
+   ath9k_hw_btcoex_pin_init(ah, ATH_WLANACTIVE_GPIO_9280,
+ATH_BTACTIVE_GPIO_9280,
+ATH_BTPRIORITY_GPIO_9285);
}
 }
 EXPORT_SYMBOL(ath9k_hw_btcoex_init_scheme);
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index 33eb274..e66153d 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -31,6 +31,10 @@ struct ath9k_platform_data {
u32 gpio_mask;
u32 gpio_val;
 
+   u32 bt_active_pin;
+   u32 bt_priority_pin;
+   u32 wlan_active_pin;
+
bool endian_check;
bool is_clk_25mhz;
bool tx_gain_buffalo;
-- 
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


Re: [PATCH 2/2] iwlwifi: mvm: Fix paging memory leak

2016-03-06 Thread Grumbach, Emmanuel


On 03/06/2016 02:04 PM, Kalle Valo wrote:
> Luca Coelho  writes:
>
>> On Fri, 2016-03-04 at 18:07 +0200, Kalle Valo wrote:
>>> Emmanuel Grumbach  writes:
>>>
 From: Matti Gottlieb 

 If the opmode is stopped and started again we did not free
 the paging buffers. Fix that.
 In addition when freeing the firmware's paging download
 buffer, set the pointer to NULL.

 Signed-off-by: Matti Gottlieb 
 Signed-off-by: Emmanuel Grumbach 
>>>
>>> Nitpicking while writing the pull request for Dave:
>>>
>>> What does "opmode is stopped" mean? Important bug fixes should have a
>>> clear bug description from user's point of view. Using driver internal
>>> jargon is gibberish to most people.
>>
>> I agree that there could be a bit more high-level description here, but
>> I also think it's good to keep a bit more details about what is
>> happening internally, so that developers understand too. ;)
>
> Sure, feel free to write as much as you want and in such detail as you
> think is necessary :) Just having a clear summary without internal
> jargon helps people outside of iwlwifi.
>
> BTW, the other iwlwifi fix had a bit similar problem:
>
> https://git.kernel.org/cgit/linux/kernel/git/kvalo/wireless-drivers.git/commit/?id=fb896c44f88a75843a072cd6961b1615732f7811
>
> What does "non-sta" mean in this context? Is it the AP or what? Or
> something not part of the current BSS? I guess I might find a definition
> from the spec or from iwlwifi sources but I really should not be forced
> to do that.

non-sta in that context means an skb sent without a valid ieee80211_sta 
buffer. Which basically means that it is a non-data frame or a multicast 
frame.

>
>> Do you think it would be acceptable to keep the commit log most as it
>> is, but start with something like "Some paging buffers were not freed
>> when the driver is restarted."? I don't mean to change this commit
>> itself, but just so that we know how to please you (and users) while
>> still keeping the details as part of the commit logs... ;)
>
> That sounds good to me. What I'm after is that someone like Dave or
> Linus can understand from the commit log what kind of bug this patch is
> fixing, without looking into source or checking mailing lists. This is
> especially more important in the later stages of the cycle.
>
>>> I investigated this myself and apparently "opmode" is stopped when the
>>> module is unloaded or the PCI device is removed. So just say that in the
>>> commit log and everyone understand much better.
>>
>> Our driver is divided roughly into two layers: the bus layer (called
>> transport) and the protocol layer (called opmode).  The name comes from
>> the difference between the two opmodes that we currently have.  One
>> supports only a single operating channel (dvm) and the other supports
>> multiple operating channels (mvm).
>>
>> Hope this clarifies a bit. :)
>
> It did, thanks.
>
--
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/2] wlcore/wl18xx: add radar_debug_mode handling

2016-03-06 Thread Eliad Peller
Add debugfs key (under CFG80211_CERTIFICATION_ONUS
configuration) to set/clear radar_debug_mode.
In this mode, the driver simply ignores radar
events (but prints them).

The fw is notified about this mode through
a special generic_cfg_feature command.

This mode is relevant only for ap mode. look for
it when initializing ap vif.

Signed-off-by: Eliad Peller 
---
 drivers/net/wireless/ti/wl18xx/debugfs.c | 66 
 drivers/net/wireless/ti/wl18xx/event.c   |  3 +-
 drivers/net/wireless/ti/wlcore/init.c|  5 +++
 drivers/net/wireless/ti/wlcore/wlcore.h  |  1 +
 4 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c 
b/drivers/net/wireless/ti/wl18xx/debugfs.c
index 4edfe28..86ccf84 100644
--- a/drivers/net/wireless/ti/wl18xx/debugfs.c
+++ b/drivers/net/wireless/ti/wl18xx/debugfs.c
@@ -345,6 +345,69 @@ static const struct file_operations dynamic_fw_traces_ops 
= {
.llseek = default_llseek,
 };
 
+#ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
+static ssize_t radar_debug_mode_write(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+   struct wl1271 *wl = file->private_data;
+   struct wl12xx_vif *wlvif;
+   unsigned long value;
+   int ret;
+
+   ret = kstrtoul_from_user(user_buf, count, 10, );
+   if (ret < 0) {
+   wl1271_warning("illegal radar_debug_mode value!");
+   return -EINVAL;
+   }
+
+   /* valid values: 0/1 */
+   if (!(value == 0 || value == 1)) {
+   wl1271_warning("value is not in valid!");
+   return -EINVAL;
+   }
+
+   mutex_lock(>mutex);
+
+   wl->radar_debug_mode = value;
+
+   if (unlikely(wl->state != WLCORE_STATE_ON))
+   goto out;
+
+   ret = wl1271_ps_elp_wakeup(wl);
+   if (ret < 0)
+   goto out;
+
+   wl12xx_for_each_wlvif_ap(wl, wlvif) {
+   wlcore_cmd_generic_cfg(wl, wlvif,
+  WLCORE_CFG_FEATURE_RADAR_DEBUG,
+  wl->radar_debug_mode, 0);
+   }
+
+   wl1271_ps_elp_sleep(wl);
+out:
+   mutex_unlock(>mutex);
+   return count;
+}
+
+static ssize_t radar_debug_mode_read(struct file *file,
+char __user *userbuf,
+size_t count, loff_t *ppos)
+{
+   struct wl1271 *wl = file->private_data;
+
+   return wl1271_format_buffer(userbuf, count, ppos,
+   "%d\n", wl->radar_debug_mode);
+}
+
+static const struct file_operations radar_debug_mode_ops = {
+   .write = radar_debug_mode_write,
+   .read = radar_debug_mode_read,
+   .open = simple_open,
+   .llseek = default_llseek,
+};
+#endif /* CFG80211_CERTIFICATION_ONUS */
+
 int wl18xx_debugfs_add_files(struct wl1271 *wl,
 struct dentry *rootdir)
 {
@@ -510,6 +573,9 @@ int wl18xx_debugfs_add_files(struct wl1271 *wl,
 
DEBUGFS_ADD(conf, moddir);
DEBUGFS_ADD(radar_detection, moddir);
+#ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
+   DEBUGFS_ADD(radar_debug_mode, moddir);
+#endif
DEBUGFS_ADD(dynamic_fw_traces, moddir);
 
return 0;
diff --git a/drivers/net/wireless/ti/wl18xx/event.c 
b/drivers/net/wireless/ti/wl18xx/event.c
index 719907a..ff6e46d 100644
--- a/drivers/net/wireless/ti/wl18xx/event.c
+++ b/drivers/net/wireless/ti/wl18xx/event.c
@@ -146,7 +146,8 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
mbox->radar_channel,
wl18xx_radar_type_decode(mbox->radar_type));
 
-   ieee80211_radar_detected(wl->hw);
+   if (!wl->radar_debug_mode)
+   ieee80211_radar_detected(wl->hw);
}
 
if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) {
diff --git a/drivers/net/wireless/ti/wlcore/init.c 
b/drivers/net/wireless/ti/wlcore/init.c
index e92f263..d0b7734 100644
--- a/drivers/net/wireless/ti/wlcore/init.c
+++ b/drivers/net/wireless/ti/wlcore/init.c
@@ -558,6 +558,11 @@ static int wl12xx_init_ap_role(struct wl1271 *wl, struct 
wl12xx_vif *wlvif)
if (ret < 0)
return ret;
 
+   if (wl->radar_debug_mode)
+   wlcore_cmd_generic_cfg(wl, wlvif,
+  WLCORE_CFG_FEATURE_RADAR_DEBUG,
+  wl->radar_debug_mode, 0);
+
return 0;
 }
 
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h 
b/drivers/net/wireless/ti/wlcore/wlcore.h
index dda01b1..72c31a8 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -463,6 +463,7 @@ struct wl1271 {
 
/* the current dfs region */
enum nl80211_dfs_regions dfs_region;
+   bool radar_debug_mode;
 
/* size of the private 

[PATCH v2 1/2] wlcore: don't WARN_ON in case of existing ROC

2016-03-06 Thread Eliad Peller
When working with AP + P2P, it's possible to get into
a state when the AP is in ROC (due to assiciating station)
while trying to ROC on the P2P interface.

Replace the WARN_ON with wl1271_error to avoid warnings
in this case.

Signed-off-by: Eliad Peller 
---
v2: fix kbuild warning (printf format)

 drivers/net/wireless/ti/wlcore/main.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c 
b/drivers/net/wireless/ti/wlcore/main.c
index d1109c4..5127243 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5493,7 +5493,7 @@ static int wlcore_op_remain_on_channel(struct 
ieee80211_hw *hw,
 {
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
struct wl1271 *wl = hw->priv;
-   int channel, ret = 0;
+   int channel, active_roc, ret = 0;
 
channel = ieee80211_frequency_to_channel(chan->center_freq);
 
@@ -5506,9 +5506,9 @@ static int wlcore_op_remain_on_channel(struct 
ieee80211_hw *hw,
goto out;
 
/* return EBUSY if we can't ROC right now */
-   if (WARN_ON(wl->roc_vif ||
-   find_first_bit(wl->roc_map,
-  WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES)) {
+   active_roc = find_first_bit(wl->roc_map, WL12XX_MAX_ROLES);
+   if (wl->roc_vif || active_roc < WL12XX_MAX_ROLES) {
+   wl1271_warning("active roc on role %d", active_roc);
ret = -EBUSY;
goto out;
}
-- 
2.6.3

--
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 1/2] wlcore: don't WARN_ON in case of existing ROC

2016-03-06 Thread kbuild test robot
Hi Eliad,

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v4.5-rc6 next-20160304]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Eliad-Peller/wlcore-don-t-WARN_ON-in-case-of-existing-ROC/20160307-011744
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git 
master
config: openrisc-allmodconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   drivers/net/wireless/ti/wlcore/main.c: In function 
'wlcore_op_remain_on_channel':
>> drivers/net/wireless/ti/wlcore/main.c:5513:3: warning: format '%d' expects 
>> type 'int', but argument 2 has type 'long unsigned int'

vim +5513 drivers/net/wireless/ti/wlcore/main.c

  5497  struct wl1271 *wl = hw->priv;
  5498  int channel, ret = 0;
  5499  
  5500  channel = ieee80211_frequency_to_channel(chan->center_freq);
  5501  
  5502  wl1271_debug(DEBUG_MAC80211, "mac80211 roc %d (%d)",
  5503   channel, wlvif->role_id);
  5504  
  5505  mutex_lock(>mutex);
  5506  
  5507  if (unlikely(wl->state != WLCORE_STATE_ON))
  5508  goto out;
  5509  
  5510  /* return EBUSY if we can't ROC right now */
  5511  if (wl->roc_vif ||
  5512  find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) < 
WL12XX_MAX_ROLES) {
> 5513  wl1271_warning("active roc on role %d",
  5514 find_first_bit(wl->roc_map, 
WL12XX_MAX_ROLES));
  5515  ret = -EBUSY;
  5516  goto out;
  5517  }
  5518  
  5519  ret = wl1271_ps_elp_wakeup(wl);
  5520  if (ret < 0)
  5521  goto out;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC

2016-03-06 Thread kbuild test robot
Hi Eliad,

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v4.5-rc6 next-20160304]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Eliad-Peller/wlcore-don-t-WARN_ON-in-case-of-existing-ROC/20160307-011744
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git 
master
config: i386-randconfig-x002-201610 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:6:0,
from include/linux/kernel.h:13,
from include/linux/list.h:8,
from include/linux/module.h:9,
from drivers/net/wireless/ti/wlcore/main.c:23:
   drivers/net/wireless/ti/wlcore/main.c: In function 
'wlcore_op_remain_on_channel':
>> include/linux/kern_levels.h:4:18: warning: format '%d' expects argument of 
>> type 'int', but argument 2 has type 'long unsigned int' [-Wformat=]
#define KERN_SOH "\001"  /* ASCII Start Of Header */
 ^
   include/linux/kern_levels.h:11:22: note: in expansion of macro 'KERN_SOH'
#define KERN_WARNING KERN_SOH "4" /* warning conditions */
 ^
>> include/linux/printk.h:254:9: note: in expansion of macro 'KERN_WARNING'
 printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^
>> include/linux/printk.h:255:17: note: in expansion of macro 'pr_warning'
#define pr_warn pr_warning
^
>> drivers/net/wireless/ti/wlcore/debug.h:68:2: note: in expansion of macro 
>> 'pr_warn'
 pr_warn(DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
 ^
>> drivers/net/wireless/ti/wlcore/main.c:5513:3: note: in expansion of macro 
>> 'wl1271_warning'
  wl1271_warning("active roc on role %d",
  ^

vim +/wl1271_warning +5513 drivers/net/wireless/ti/wlcore/main.c

  5497  struct wl1271 *wl = hw->priv;
  5498  int channel, ret = 0;
  5499  
  5500  channel = ieee80211_frequency_to_channel(chan->center_freq);
  5501  
  5502  wl1271_debug(DEBUG_MAC80211, "mac80211 roc %d (%d)",
  5503   channel, wlvif->role_id);
  5504  
  5505  mutex_lock(>mutex);
  5506  
  5507  if (unlikely(wl->state != WLCORE_STATE_ON))
  5508  goto out;
  5509  
  5510  /* return EBUSY if we can't ROC right now */
  5511  if (wl->roc_vif ||
  5512  find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) < 
WL12XX_MAX_ROLES) {
> 5513  wl1271_warning("active roc on role %d",
  5514 find_first_bit(wl->roc_map, 
WL12XX_MAX_ROLES));
  5515  ret = -EBUSY;
  5516  goto out;
  5517  }
  5518  
  5519  ret = wl1271_ps_elp_wakeup(wl);
  5520  if (ret < 0)
  5521  goto out;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC

2016-03-06 Thread kbuild test robot
Hi Eliad,

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v4.5-rc6 next-20160304]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Eliad-Peller/wlcore-don-t-WARN_ON-in-case-of-existing-ROC/20160307-011744
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git 
master
config: sparc64-allyesconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   drivers/net/wireless/ti/wlcore/main.c: In function 
'wlcore_op_remain_on_channel':
>> drivers/net/wireless/ti/wlcore/main.c:5513:3: warning: format '%d' expects 
>> argument of type 'int', but argument 2 has type 'long unsigned int' 
>> [-Wformat=]
  wl1271_warning("active roc on role %d",
  ^

vim +5513 drivers/net/wireless/ti/wlcore/main.c

  5497  struct wl1271 *wl = hw->priv;
  5498  int channel, ret = 0;
  5499  
  5500  channel = ieee80211_frequency_to_channel(chan->center_freq);
  5501  
  5502  wl1271_debug(DEBUG_MAC80211, "mac80211 roc %d (%d)",
  5503   channel, wlvif->role_id);
  5504  
  5505  mutex_lock(>mutex);
  5506  
  5507  if (unlikely(wl->state != WLCORE_STATE_ON))
  5508  goto out;
  5509  
  5510  /* return EBUSY if we can't ROC right now */
  5511  if (wl->roc_vif ||
  5512  find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) < 
WL12XX_MAX_ROLES) {
> 5513  wl1271_warning("active roc on role %d",
  5514 find_first_bit(wl->roc_map, 
WL12XX_MAX_ROLES));
  5515  ret = -EBUSY;
  5516  goto out;
  5517  }
  5518  
  5519  ret = wl1271_ps_elp_wakeup(wl);
  5520  if (ret < 0)
  5521  goto out;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH 2/2] wlcore/wl18xx: add radar_debug_mode handling

2016-03-06 Thread Eliad Peller
Add debugfs key (under CFG80211_CERTIFICATION_ONUS
configuration) to set/clear radar_debug_mode.
In this mode, the driver simply ignores radar
events (but prints them).

The fw is notified about this mode through
a special generic_cfg_feature command.

This mode is relevant only for ap mode. look for
it when initializing ap vif.

Signed-off-by: Eliad Peller 
---
 drivers/net/wireless/ti/wl18xx/debugfs.c | 66 
 drivers/net/wireless/ti/wl18xx/event.c   |  3 +-
 drivers/net/wireless/ti/wlcore/init.c|  5 +++
 drivers/net/wireless/ti/wlcore/wlcore.h  |  1 +
 4 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c 
b/drivers/net/wireless/ti/wl18xx/debugfs.c
index 4edfe28..86ccf84 100644
--- a/drivers/net/wireless/ti/wl18xx/debugfs.c
+++ b/drivers/net/wireless/ti/wl18xx/debugfs.c
@@ -345,6 +345,69 @@ static const struct file_operations dynamic_fw_traces_ops 
= {
.llseek = default_llseek,
 };
 
+#ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
+static ssize_t radar_debug_mode_write(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+   struct wl1271 *wl = file->private_data;
+   struct wl12xx_vif *wlvif;
+   unsigned long value;
+   int ret;
+
+   ret = kstrtoul_from_user(user_buf, count, 10, );
+   if (ret < 0) {
+   wl1271_warning("illegal radar_debug_mode value!");
+   return -EINVAL;
+   }
+
+   /* valid values: 0/1 */
+   if (!(value == 0 || value == 1)) {
+   wl1271_warning("value is not in valid!");
+   return -EINVAL;
+   }
+
+   mutex_lock(>mutex);
+
+   wl->radar_debug_mode = value;
+
+   if (unlikely(wl->state != WLCORE_STATE_ON))
+   goto out;
+
+   ret = wl1271_ps_elp_wakeup(wl);
+   if (ret < 0)
+   goto out;
+
+   wl12xx_for_each_wlvif_ap(wl, wlvif) {
+   wlcore_cmd_generic_cfg(wl, wlvif,
+  WLCORE_CFG_FEATURE_RADAR_DEBUG,
+  wl->radar_debug_mode, 0);
+   }
+
+   wl1271_ps_elp_sleep(wl);
+out:
+   mutex_unlock(>mutex);
+   return count;
+}
+
+static ssize_t radar_debug_mode_read(struct file *file,
+char __user *userbuf,
+size_t count, loff_t *ppos)
+{
+   struct wl1271 *wl = file->private_data;
+
+   return wl1271_format_buffer(userbuf, count, ppos,
+   "%d\n", wl->radar_debug_mode);
+}
+
+static const struct file_operations radar_debug_mode_ops = {
+   .write = radar_debug_mode_write,
+   .read = radar_debug_mode_read,
+   .open = simple_open,
+   .llseek = default_llseek,
+};
+#endif /* CFG80211_CERTIFICATION_ONUS */
+
 int wl18xx_debugfs_add_files(struct wl1271 *wl,
 struct dentry *rootdir)
 {
@@ -510,6 +573,9 @@ int wl18xx_debugfs_add_files(struct wl1271 *wl,
 
DEBUGFS_ADD(conf, moddir);
DEBUGFS_ADD(radar_detection, moddir);
+#ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
+   DEBUGFS_ADD(radar_debug_mode, moddir);
+#endif
DEBUGFS_ADD(dynamic_fw_traces, moddir);
 
return 0;
diff --git a/drivers/net/wireless/ti/wl18xx/event.c 
b/drivers/net/wireless/ti/wl18xx/event.c
index 719907a..ff6e46d 100644
--- a/drivers/net/wireless/ti/wl18xx/event.c
+++ b/drivers/net/wireless/ti/wl18xx/event.c
@@ -146,7 +146,8 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
mbox->radar_channel,
wl18xx_radar_type_decode(mbox->radar_type));
 
-   ieee80211_radar_detected(wl->hw);
+   if (!wl->radar_debug_mode)
+   ieee80211_radar_detected(wl->hw);
}
 
if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) {
diff --git a/drivers/net/wireless/ti/wlcore/init.c 
b/drivers/net/wireless/ti/wlcore/init.c
index e92f263..d0b7734 100644
--- a/drivers/net/wireless/ti/wlcore/init.c
+++ b/drivers/net/wireless/ti/wlcore/init.c
@@ -558,6 +558,11 @@ static int wl12xx_init_ap_role(struct wl1271 *wl, struct 
wl12xx_vif *wlvif)
if (ret < 0)
return ret;
 
+   if (wl->radar_debug_mode)
+   wlcore_cmd_generic_cfg(wl, wlvif,
+  WLCORE_CFG_FEATURE_RADAR_DEBUG,
+  wl->radar_debug_mode, 0);
+
return 0;
 }
 
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h 
b/drivers/net/wireless/ti/wlcore/wlcore.h
index dda01b1..72c31a8 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -463,6 +463,7 @@ struct wl1271 {
 
/* the current dfs region */
enum nl80211_dfs_regions dfs_region;
+   bool radar_debug_mode;
 
/* size of the private 

[PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC

2016-03-06 Thread Eliad Peller
When working with AP + P2P, it's possible to get into
a state when the AP is in ROC (due to assiciating station)
while trying to ROC on the P2P interface.

Replace the WARN_ON with wl1271_error to avoid warnings
in this case.

Signed-off-by: Eliad Peller 
---
 drivers/net/wireless/ti/wlcore/main.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c 
b/drivers/net/wireless/ti/wlcore/main.c
index d1109c4..cb2e8b6 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5506,9 +5506,10 @@ static int wlcore_op_remain_on_channel(struct 
ieee80211_hw *hw,
goto out;
 
/* return EBUSY if we can't ROC right now */
-   if (WARN_ON(wl->roc_vif ||
-   find_first_bit(wl->roc_map,
-  WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES)) {
+   if (wl->roc_vif ||
+   find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES) {
+   wl1271_warning("active roc on role %d",
+  find_first_bit(wl->roc_map, WL12XX_MAX_ROLES));
ret = -EBUSY;
goto out;
}
-- 
2.6.3

--
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 1/3] mac80211: TDLS: always downgrade invalid chandefs

2016-03-06 Thread Arik Nemtsov
On Sun, Mar 6, 2016 at 5:58 PM, Jouni Malinen  wrote:
>
> On Wed, Mar 02, 2016 at 11:28:31PM +0200, Emmanuel Grumbach wrote:
> > Even if the current chandef width is equal to the station's max-BW, it
> > doesn't mean it's a valid width for TDLS. Make sure to always check
> > regulatory constraints in these cases.
>
> I'm not sure this change is the trigger for this issue, but since I
> noticed this for the first time today and this commit went just in into
> wireless-testing.git, it sounds quite likely that this was indeed behind
> the busy loop I saw here:
>
> > diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
> > @@ -332,7 +332,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct 
> > ieee80211_sub_if_data *sdata,
> >   /* proceed to downgrade the chandef until usable or the same */
> > - while (uc.width > max_width &&
> > + while (uc.width > max_width ||
> >  !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, ,
> > sdata->wdev.iftype))
> >   ieee80211_chandef_downgrade();

Good catch :)
We actually just noticed this as well and have a suggested fix already
- basically the code was trying to *upgrade* a 80p80 channel to a 80
one.

I guess it will be out in a couple days after some internal testing.

Arik
--
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 1/3] mac80211: TDLS: always downgrade invalid chandefs

2016-03-06 Thread Jouni Malinen
On Wed, Mar 02, 2016 at 11:28:31PM +0200, Emmanuel Grumbach wrote:
> Even if the current chandef width is equal to the station's max-BW, it
> doesn't mean it's a valid width for TDLS. Make sure to always check
> regulatory constraints in these cases.

I'm not sure this change is the trigger for this issue, but since I
noticed this for the first time today and this commit went just in into
wireless-testing.git, it sounds quite likely that this was indeed behind
the busy loop I saw here:

> diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
> @@ -332,7 +332,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct 
> ieee80211_sub_if_data *sdata,
>   /* proceed to downgrade the chandef until usable or the same */
> - while (uc.width > max_width &&
> + while (uc.width > max_width ||
>  !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, ,
> sdata->wdev.iftype))
>   ieee80211_chandef_downgrade();

I'm not sure what caused the chandef in uc (sta->tdls_chandef) to be
invalid (actually, I do know now; see below), but when running the
ap_open_tdls_vht80plus80 test case, the VM got stuck in a busy loop
printing warnings about that chandef being invalid and with this while
loop being here, that never stopped.. Well, until couple of hours later
when I noticed this and stopped in manually.  That left 1.6 GB of kernel
log entries (and that would have been way more had printk not refused to
print so much, but even the "589 printk messages dropped" prints were
enough to make this huge)..

So if uc is invalid here, it looks like this loop can get into a state
where it never terminates. The iteration hits these warnings:

WARNING: CPU: 2 PID: 623 at net/wireless/chan.c:336 
cfg80211_chandef_dfs_required+0xf6/0x100()
WARNING: CPU: 2 PID: 623 at net/wireless/chan.c:608 
cfg80211_chandef_usable+0x188/0x190()
WARNING: CPU: 2 PID: 623 at net/mac80211/util.c:2860 
ieee80211_chandef_downgrade+0x138/0x170()

The last entry here seems to imply that c->width downgrade happened once
successfully since no other WARN_ON_ONCE() were printed within
ieee80211_chandef_downgrade().

This is followed by:

WARNING: CPU: 2 PID: 623 at net/wireless/chan.c:336 
cfg80211_chandef_dfs_required+0xf6/0x100()
WARNING: CPU: 2 PID: 623 at net/wireless/chan.c:608 
cfg80211_chandef_usable+0x188/0x190()
WARNING: CPU: 2 PID: 623 at net/wireless/chan.c:336 
cfg80211_chandef_dfs_required+0xf6/0x100()
WARNING: CPU: 2 PID: 623 at net/wireless/chan.c:608 
cfg80211_chandef_usable+0x188/0x190()
WARNING: CPU: 2 PID: 623 at net/wireless/chan.c:336 
cfg80211_chandef_dfs_required+0xf6/0x100()
WARNING: CPU: 2 PID: 623 at net/wireless/chan.c:608 
cfg80211_chandef_usable+0x188/0x190()
WARNING: CPU: 2 PID: 623 at net/mac80211/util.c:2848 
ieee80211_chandef_downgrade+0x39/0x170()

The last one here is hitting the WARN_ON_ONCE(1) in the default case, so
it looks like there were two more successful downgrades (total three
starting from 80+80) and then we are in a busy loop with every new
iteration hitting that default case warning at util.c:2848. This
continues indefinitely.

Regardless of what caused the chandef to be invalid, this while loop
would benefit of some added robustness to avoid the possibility of an
infinite loop where the channel width cannot be downgraded anymore.

The console log from that run is available here:
http://w1.fi/a/tdls-downgrade-warning-loop.txt


It looks like I can now reproduce this easily with
./vm-run.sh ap_open_tdls_vht80plus80

Reverting this one-liner patch removes that loop and all of the chandef
invalid warnings.

With this patch applied, ieee80211_tdls_chandef_vht_upgrade() shows
uc.width == 4, max_width == 4, and chandef valid at the beginning of the
function. Just before the while loop, uc.width == 3, max_width == 3,
chandef is now invalid. On loop iterations, uc.width is dropped to 2, 1,
and finally 0 where it remains while the loop continues running.

The chandef becomes invalid when going through the centers_80mhz loop
and setting uc.center_freq1 = 5210, uc.width = NL80211_CHAN_WIDTH_80.
The AP was configured with seg0_idx 42 + seg1_idx 155.
 
-- 
Jouni MalinenPGP id EFC895FA
--
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 v2 07/11] ath10k: implement wake_tx_queue

2016-03-06 Thread Valo, Kalle
Michal Kazior  writes:

> This implements very basic support for software
> queueing. It also contains some knobs that will be
> patched later.
>
> Signed-off-by: Michal Kazior 

Oddly this patch introduces a new warning:

drivers/net/wireless/ath/ath10k/mac.c: In function ath10k_mac_op_tx:
drivers/net/wireless/ath/ath10k/mac.c:3949:29: warning: is_mgmt may be used 
uninitialized in this function [-Wuninitialized]

But I think that's just a false warning, most likely because my gcc is
ancient. Do you agree?

gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

-- 
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 v2 00/11] ath10k: implement push-pull tx model

2016-03-06 Thread Valo, Kalle
Michal Kazior  writes:

> This adds support for the new logic where host
> tells firmware how many frames are queued for each
> station/tid and then firmware asks host to submit
> frames for given station/tid.
>
> The patch count is a bit high but I tried
> splitting the patches as much as possible to keep
> them short and easy to review. Hopefully it's not
> going to be a huge headache.
>
> v2:
>  - squashes some patches
>  - reworked pending frame scheduling
>
>
> Michal Kazior (11):
>   ath10k: refactor tx code
>   ath10k: unify txpath decision
>   ath10k: refactor tx pending management
>   ath10k: maintain peer_id for each sta and vif
>   ath10k: add fast peer_map lookup
>   ath10k: add new htt message generation/parsing logic
>   ath10k: implement wake_tx_queue
>   ath10k: implement updating shared htt txq state
>   ath10k: store txq in skb_cb
>   ath10k: keep track of queue depth per txq
>   ath10k: implement push-pull tx

I saw two conflicts, please double check my resolutions in the pending
branch:

Applying: ath10k: implement wake_tx_queue
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging drivers/net/wireless/ath/ath10k/htt_rx.c
CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/htt_rx.c
Auto-merging drivers/net/wireless/ath/ath10k/core.c
Failed to merge in the changes.
Patch failed at 0007 ath10k: implement wake_tx_queue

[...]

Applying: ath10k: implement push-pull tx
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging drivers/net/wireless/ath/ath10k/htt_rx.c
CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/htt_rx.c
Failed to merge in the changes.
Patch failed at 0011 ath10k: implement push-pull tx

-- 
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 06/13] staging: vt6655: mac.c replace VNSvOutPortB with iowrite8

2016-03-06 Thread Malcolm Priestley
removing macro from functions

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index 43e5f66..a1be5a7 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -142,7 +142,7 @@ void MACvSetShortRetryLimit(struct vnt_private *priv, 
unsigned char byRetryLimit
 {
void __iomem *io_base = priv->PortOffset;
/* set SRT */
-   VNSvOutPortB(io_base + MAC_REG_SRT, byRetryLimit);
+   iowrite8(byRetryLimit, io_base + MAC_REG_SRT);
 }
 
 
@@ -164,7 +164,7 @@ void MACvSetLongRetryLimit(struct vnt_private *priv, 
unsigned char byRetryLimit)
 {
void __iomem *io_base = priv->PortOffset;
/* set LRT */
-   VNSvOutPortB(io_base + MAC_REG_LRT, byRetryLimit);
+   iowrite8(byRetryLimit, io_base + MAC_REG_LRT);
 }
 
 /*
@@ -191,7 +191,7 @@ void MACvSetLoopbackMode(struct vnt_private *priv, unsigned 
char byLoopbackMode)
VNSvInPortB(io_base + MAC_REG_TEST, );
byOrgValue = byOrgValue & 0x3F;
byOrgValue = byOrgValue | byLoopbackMode;
-   VNSvOutPortB(io_base + MAC_REG_TEST, byOrgValue);
+   iowrite8(byOrgValue, io_base + MAC_REG_TEST);
 }
 
 /*
@@ -256,7 +256,7 @@ void MACvRestoreContext(struct vnt_private *priv, unsigned 
char *cxt_buf)
memcpy_toio(io_base + MAC_REG_LRT, cxt_buf + MAC_REG_LRT,
MAC_REG_PAGE1SEL - MAC_REG_LRT);
 
-   VNSvOutPortB(io_base + MAC_REG_CFG, *(cxt_buf + MAC_REG_CFG));
+   iowrite8(*(cxt_buf + MAC_REG_CFG), io_base + MAC_REG_CFG);
 
/* restore PS Config. */
memcpy_toio(io_base + MAC_REG_PSCFG, cxt_buf + MAC_REG_PSCFG,
@@ -294,7 +294,7 @@ bool MACbSoftwareReset(struct vnt_private *priv)
unsigned short ww;
 
/* turn on HOSTCR_SOFTRST, just write 0x01 to reset */
-   VNSvOutPortB(io_base + MAC_REG_HOSTCR, 0x01);
+   iowrite8(0x01, io_base + MAC_REG_HOSTCR);
 
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
if (!(ioread8(io_base + MAC_REG_HOSTCR) & HOSTCR_SOFTRST))
@@ -529,16 +529,16 @@ void MACvInitialize(struct vnt_private *priv)
/* clear sticky bits */
MACvClearStckDS(io_base);
/* disable force PME-enable */
-   VNSvOutPortB(io_base + MAC_REG_PMC1, PME_OVR);
+   iowrite8(PME_OVR, io_base + MAC_REG_PMC1);
/* only 3253 A */
 
/* do reset */
MACbSoftwareReset(priv);
 
/* reset TSF counter */
-   VNSvOutPortB(io_base + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
+   iowrite8(TFTCTL_TSFCNTRST, io_base + MAC_REG_TFTCTL);
/* enable TSF counter */
-   VNSvOutPortB(io_base + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
+   iowrite8(TFTCTL_TSFCNTREN, io_base + MAC_REG_TFTCTL);
 }
 
 /*
@@ -563,7 +563,7 @@ void MACvSetCurrRx0DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
 
VNSvInPortB(io_base + MAC_REG_RXDMACTL0, );
if (byOrgDMACtl & DMACTL_RUN)
-   VNSvOutPortB(io_base + MAC_REG_RXDMACTL0+2, DMACTL_RUN);
+   iowrite8(DMACTL_RUN, io_base + MAC_REG_RXDMACTL0 + 2);
 
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
if (!(ioread8(io_base + MAC_REG_RXDMACTL0) & DMACTL_RUN))
@@ -572,7 +572,7 @@ void MACvSetCurrRx0DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
 
iowrite32(dwCurrDescAddr, io_base + MAC_REG_RXDMAPTR0);
if (byOrgDMACtl & DMACTL_RUN)
-   VNSvOutPortB(io_base + MAC_REG_RXDMACTL0, DMACTL_RUN);
+   iowrite8(DMACTL_RUN, io_base + MAC_REG_RXDMACTL0);
 }
 
 /*
@@ -597,7 +597,7 @@ void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
 
VNSvInPortB(io_base + MAC_REG_RXDMACTL1, );
if (byOrgDMACtl & DMACTL_RUN)
-   VNSvOutPortB(io_base + MAC_REG_RXDMACTL1+2, DMACTL_RUN);
+   iowrite8(DMACTL_RUN, io_base + MAC_REG_RXDMACTL1 + 2);
 
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
if (!(ioread8(io_base + MAC_REG_RXDMACTL1) & DMACTL_RUN))
@@ -606,7 +606,7 @@ void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
 
iowrite32(dwCurrDescAddr, io_base + MAC_REG_RXDMAPTR1);
if (byOrgDMACtl & DMACTL_RUN)
-   VNSvOutPortB(io_base + MAC_REG_RXDMACTL1, DMACTL_RUN);
+   iowrite8(DMACTL_RUN, io_base + MAC_REG_RXDMACTL1);
 
 }
 
@@ -633,7 +633,7 @@ void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv,
 
VNSvInPortB(io_base + MAC_REG_TXDMACTL0, );
if (byOrgDMACtl & DMACTL_RUN)
-   VNSvOutPortB(io_base + MAC_REG_TXDMACTL0+2, DMACTL_RUN);
+   iowrite8(DMACTL_RUN, io_base + MAC_REG_TXDMACTL0 + 2);
 
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
if (!(ioread8(io_base + MAC_REG_TXDMACTL0) & DMACTL_RUN))
@@ -642,7 +642,7 @@ void MACvSetCurrTx0DescAddrEx(struct 

[PATCH 12/13] staging: vt6655: mac.c replace wOffset with offset.

2016-03-06 Thread Malcolm Priestley
Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 42 +-
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index 87bec1c..e762c33 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -747,14 +747,14 @@ void MACvOneShotTimer1MicroSec(struct vnt_private *priv, 
unsigned int uDelayTime
iowrite8((TMCTL_TMD | TMCTL_TE), io_base + MAC_REG_TMCTL1);
 }
 
-void MACvSetMISCFifo(struct vnt_private *priv, unsigned short wOffset,
+void MACvSetMISCFifo(struct vnt_private *priv, unsigned short offset,
 u32 dwData)
 {
void __iomem *io_base = priv->PortOffset;
 
-   if (wOffset > 273)
+   if (offset > 273)
return;
-   iowrite16(wOffset, io_base + MAC_REG_MISCFFNDEX);
+   iowrite16(offset, io_base + MAC_REG_MISCFFNDEX);
iowrite32(dwData, io_base + MAC_REG_MISCFFDATA);
iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
 }
@@ -803,7 +803,7 @@ void MACvSetKeyEntry(struct vnt_private *priv, unsigned 
short wKeyCtl,
 unsigned char byLocalID)
 {
void __iomem *io_base = priv->PortOffset;
-   unsigned short wOffset;
+   unsigned short offset;
u32 dwData;
int ii;
 
@@ -811,20 +811,20 @@ void MACvSetKeyEntry(struct vnt_private *priv, unsigned 
short wKeyCtl,
return;
 
pr_debug("MACvSetKeyEntry\n");
-   wOffset = MISCFIFO_KEYETRY0;
-   wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
+   offset = MISCFIFO_KEYETRY0;
+   offset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
 
dwData = 0;
dwData |= wKeyCtl;
dwData <<= 16;
dwData |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5));
-   pr_debug("1. wOffset: %d, Data: %X, KeyCtl:%X\n",
-wOffset, dwData, wKeyCtl);
+   pr_debug("1. offset: %d, Data: %X, KeyCtl:%X\n",
+offset, dwData, wKeyCtl);
 
-   iowrite16(wOffset, io_base + MAC_REG_MISCFFNDEX);
+   iowrite16(offset, io_base + MAC_REG_MISCFFNDEX);
iowrite32(dwData, io_base + MAC_REG_MISCFFDATA);
iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
-   wOffset++;
+   offset++;
 
dwData = 0;
dwData |= *(pbyAddr+3);
@@ -834,19 +834,19 @@ void MACvSetKeyEntry(struct vnt_private *priv, unsigned 
short wKeyCtl,
dwData |= *(pbyAddr+1);
dwData <<= 8;
dwData |= *(pbyAddr+0);
-   pr_debug("2. wOffset: %d, Data: %X\n", wOffset, dwData);
+   pr_debug("2. offset: %d, Data: %X\n", offset, dwData);
 
-   iowrite16(wOffset, io_base + MAC_REG_MISCFFNDEX);
+   iowrite16(offset, io_base + MAC_REG_MISCFFNDEX);
iowrite32(dwData, io_base + MAC_REG_MISCFFDATA);
iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
-   wOffset++;
+   offset++;
 
-   wOffset += (uKeyIdx * 4);
+   offset += (uKeyIdx * 4);
for (ii = 0; ii < 4; ii++) {
/* always push 128 bits */
-   pr_debug("3.(%d) wOffset: %d, Data: %X\n",
-ii, wOffset+ii, *pdwKey);
-   iowrite16(wOffset + ii, io_base + MAC_REG_MISCFFNDEX);
+   pr_debug("3.(%d) offset: %d, Data: %X\n",
+ii, offset + ii, *pdwKey);
+   iowrite16(offset + ii, io_base + MAC_REG_MISCFFNDEX);
iowrite32(*pdwKey++, io_base + MAC_REG_MISCFFDATA);
iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
}
@@ -869,12 +869,12 @@ void MACvSetKeyEntry(struct vnt_private *priv, unsigned 
short wKeyCtl,
 void MACvDisableKeyEntry(struct vnt_private *priv, unsigned int uEntryIdx)
 {
void __iomem *io_base = priv->PortOffset;
-   unsigned short wOffset;
+   unsigned short offset;
 
-   wOffset = MISCFIFO_KEYETRY0;
-   wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
+   offset = MISCFIFO_KEYETRY0;
+   offset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
 
-   iowrite16(wOffset, io_base + MAC_REG_MISCFFNDEX);
+   iowrite16(offset, io_base + MAC_REG_MISCFFNDEX);
iowrite32(0, io_base + MAC_REG_MISCFFDATA);
iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
 }
-- 
2.7.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 10/13] staging: vt6655: mac Replace dwCurrDescAddr with curr_desc_addr.

2016-03-06 Thread Malcolm Priestley
Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 30 +++---
 drivers/staging/vt6655/mac.h | 14 +++---
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index a1be62d..d44026b 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -545,14 +545,14 @@ void MACvInitialize(struct vnt_private *priv)
  * Parameters:
  *  In:
  *  io_base- Base Address for MAC
- *  dwCurrDescAddr  - Descriptor Address
+ *  curr_desc_addr  - Descriptor Address
  *  Out:
  *  none
  *
  * Return Value: none
  *
  */
-void MACvSetCurrRx0DescAddr(struct vnt_private *priv, u32 dwCurrDescAddr)
+void MACvSetCurrRx0DescAddr(struct vnt_private *priv, u32 curr_desc_addr)
 {
void __iomem *io_base = priv->PortOffset;
unsigned short ww;
@@ -567,7 +567,7 @@ void MACvSetCurrRx0DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
break;
}
 
-   iowrite32(dwCurrDescAddr, io_base + MAC_REG_RXDMAPTR0);
+   iowrite32(curr_desc_addr, io_base + MAC_REG_RXDMAPTR0);
if (byOrgDMACtl & DMACTL_RUN)
iowrite8(DMACTL_RUN, io_base + MAC_REG_RXDMACTL0);
 }
@@ -579,14 +579,14 @@ void MACvSetCurrRx0DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
  * Parameters:
  *  In:
  *  io_base- Base Address for MAC
- *  dwCurrDescAddr  - Descriptor Address
+ *  curr_desc_addr  - Descriptor Address
  *  Out:
  *  none
  *
  * Return Value: none
  *
  */
-void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 dwCurrDescAddr)
+void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 curr_desc_addr)
 {
void __iomem *io_base = priv->PortOffset;
unsigned short ww;
@@ -601,7 +601,7 @@ void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
break;
}
 
-   iowrite32(dwCurrDescAddr, io_base + MAC_REG_RXDMAPTR1);
+   iowrite32(curr_desc_addr, io_base + MAC_REG_RXDMAPTR1);
if (byOrgDMACtl & DMACTL_RUN)
iowrite8(DMACTL_RUN, io_base + MAC_REG_RXDMACTL1);
 
@@ -614,7 +614,7 @@ void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
  * Parameters:
  *  In:
  *  io_base- Base Address for MAC
- *  dwCurrDescAddr  - Descriptor Address
+ *  curr_desc_addr  - Descriptor Address
  *  Out:
  *  none
  *
@@ -622,7 +622,7 @@ void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
  *
  */
 void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv,
- u32 dwCurrDescAddr)
+ u32 curr_desc_addr)
 {
void __iomem *io_base = priv->PortOffset;
unsigned short ww;
@@ -637,7 +637,7 @@ void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv,
break;
}
 
-   iowrite32(dwCurrDescAddr, io_base + MAC_REG_TXDMAPTR0);
+   iowrite32(curr_desc_addr, io_base + MAC_REG_TXDMAPTR0);
if (byOrgDMACtl & DMACTL_RUN)
iowrite8(DMACTL_RUN, io_base + MAC_REG_TXDMACTL0);
 }
@@ -649,7 +649,7 @@ void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv,
  * Parameters:
  *  In:
  *  io_base- Base Address for MAC
- *  dwCurrDescAddr  - Descriptor Address
+ *  curr_desc_addr  - Descriptor Address
  *  Out:
  *  none
  *
@@ -658,7 +658,7 @@ void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv,
  */
 /* TxDMA1 = AC0DMA */
 void MACvSetCurrAC0DescAddrEx(struct vnt_private *priv,
- u32 dwCurrDescAddr)
+ u32 curr_desc_addr)
 {
void __iomem *io_base = priv->PortOffset;
unsigned short ww;
@@ -674,18 +674,18 @@ void MACvSetCurrAC0DescAddrEx(struct vnt_private *priv,
}
if (ww == W_MAX_TIMEOUT)
pr_debug(" DBG_PORT80(0x26)\n");
-   iowrite32(dwCurrDescAddr, io_base + MAC_REG_AC0DMAPTR);
+   iowrite32(curr_desc_addr, io_base + MAC_REG_AC0DMAPTR);
if (byOrgDMACtl & DMACTL_RUN)
iowrite8(DMACTL_RUN, io_base + MAC_REG_AC0DMACTL);
 }
 
 void MACvSetCurrTXDescAddr(int iTxType, struct vnt_private *priv,
-  u32 dwCurrDescAddr)
+  u32 curr_desc_addr)
 {
if (iTxType == TYPE_AC0DMA)
-   MACvSetCurrAC0DescAddrEx(priv, dwCurrDescAddr);
+   MACvSetCurrAC0DescAddrEx(priv, curr_desc_addr);
else if (iTxType == TYPE_TXDMA0)
-   MACvSetCurrTx0DescAddrEx(priv, dwCurrDescAddr);
+   MACvSetCurrTx0DescAddrEx(priv, curr_desc_addr);
 }
 
 /*
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 3eef928..030f529 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -916,19 +916,19 @@ bool MACbSafeStop(struct vnt_private 

[PATCH 08/13] staging: vt6655: MACvSetLoopbackMode replace byOrgValue with ioread8

2016-03-06 Thread Malcolm Priestley
Removing VNSvInPortB and nesting inside iowrite8.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index 6499709..ece2bf0 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -184,14 +184,11 @@ void MACvSetLongRetryLimit(struct vnt_private *priv, 
unsigned char byRetryLimit)
 void MACvSetLoopbackMode(struct vnt_private *priv, unsigned char 
byLoopbackMode)
 {
void __iomem *io_base = priv->PortOffset;
-   unsigned char byOrgValue;
 
byLoopbackMode <<= 6;
/* set TCR */
-   VNSvInPortB(io_base + MAC_REG_TEST, );
-   byOrgValue = byOrgValue & 0x3F;
-   byOrgValue = byOrgValue | byLoopbackMode;
-   iowrite8(byOrgValue, io_base + MAC_REG_TEST);
+   iowrite8((ioread8(io_base + MAC_REG_TEST) & 0x3f) | byLoopbackMode,
+io_base + MAC_REG_TEST);
 }
 
 /*
-- 
2.7.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 02/13] staging: vt6655: MACvRestoreContext replace for loops with memcpy_toio.

2016-03-06 Thread Malcolm Priestley
Removing the need for variable ii.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index 9c4dabd..02e3e42 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -240,29 +240,27 @@ void MACvSaveContext(struct vnt_private *priv, unsigned 
char *cxt_buf)
 void MACvRestoreContext(struct vnt_private *priv, unsigned char *cxt_buf)
 {
void __iomem *io_base = priv->PortOffset;
-   int ii;
 
MACvSelectPage1(io_base);
/* restore page1 */
-   for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++)
-   VNSvOutPortB((io_base + ii),
-*(cxt_buf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii));
+   memcpy_toio(io_base, cxt_buf + MAC_MAX_CONTEXT_SIZE_PAGE0,
+   MAC_MAX_CONTEXT_SIZE_PAGE1);
 
MACvSelectPage0(io_base);
 
/* restore RCR,TCR,IMR... */
-   for (ii = MAC_REG_RCR; ii < MAC_REG_ISR; ii++)
-   VNSvOutPortB(io_base + ii, *(cxt_buf + ii));
+   memcpy_toio(io_base + MAC_REG_RCR, cxt_buf + MAC_REG_RCR,
+   MAC_REG_ISR - MAC_REG_RCR);
 
/* restore MAC Config. */
-   for (ii = MAC_REG_LRT; ii < MAC_REG_PAGE1SEL; ii++)
-   VNSvOutPortB(io_base + ii, *(cxt_buf + ii));
+   memcpy_toio(io_base + MAC_REG_LRT, cxt_buf + MAC_REG_LRT,
+   MAC_REG_PAGE1SEL - MAC_REG_LRT);
 
VNSvOutPortB(io_base + MAC_REG_CFG, *(cxt_buf + MAC_REG_CFG));
 
/* restore PS Config. */
-   for (ii = MAC_REG_PSCFG; ii < MAC_REG_BBREGCTL; ii++)
-   VNSvOutPortB(io_base + ii, *(cxt_buf + ii));
+   memcpy_toio(io_base + MAC_REG_PSCFG, cxt_buf + MAC_REG_PSCFG,
+   MAC_REG_BBREGCTL - MAC_REG_PSCFG);
 
/* restore CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR */
VNSvOutPortD(io_base + MAC_REG_TXDMAPTR0,
-- 
2.7.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 05/13] staging: vt6655: mac.c replace VNSvOutPortW with iowrite16

2016-03-06 Thread Malcolm Priestley
removig macro from functions.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index a9ddb95..43e5f66 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -757,9 +757,9 @@ void MACvSetMISCFifo(struct vnt_private *priv, unsigned 
short wOffset,
 
if (wOffset > 273)
return;
-   VNSvOutPortW(io_base + MAC_REG_MISCFFNDEX, wOffset);
+   iowrite16(wOffset, io_base + MAC_REG_MISCFFNDEX);
iowrite32(dwData, io_base + MAC_REG_MISCFFDATA);
-   VNSvOutPortW(io_base + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+   iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
 }
 
 bool MACbPSWakeup(struct vnt_private *priv)
@@ -826,9 +826,9 @@ void MACvSetKeyEntry(struct vnt_private *priv, unsigned 
short wKeyCtl,
pr_debug("1. wOffset: %d, Data: %X, KeyCtl:%X\n",
 wOffset, dwData, wKeyCtl);
 
-   VNSvOutPortW(io_base + MAC_REG_MISCFFNDEX, wOffset);
+   iowrite16(wOffset, io_base + MAC_REG_MISCFFNDEX);
iowrite32(dwData, io_base + MAC_REG_MISCFFDATA);
-   VNSvOutPortW(io_base + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+   iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
wOffset++;
 
dwData = 0;
@@ -841,9 +841,9 @@ void MACvSetKeyEntry(struct vnt_private *priv, unsigned 
short wKeyCtl,
dwData |= *(pbyAddr+0);
pr_debug("2. wOffset: %d, Data: %X\n", wOffset, dwData);
 
-   VNSvOutPortW(io_base + MAC_REG_MISCFFNDEX, wOffset);
+   iowrite16(wOffset, io_base + MAC_REG_MISCFFNDEX);
iowrite32(dwData, io_base + MAC_REG_MISCFFDATA);
-   VNSvOutPortW(io_base + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+   iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
wOffset++;
 
wOffset += (uKeyIdx * 4);
@@ -851,9 +851,9 @@ void MACvSetKeyEntry(struct vnt_private *priv, unsigned 
short wKeyCtl,
/* always push 128 bits */
pr_debug("3.(%d) wOffset: %d, Data: %X\n",
 ii, wOffset+ii, *pdwKey);
-   VNSvOutPortW(io_base + MAC_REG_MISCFFNDEX, wOffset+ii);
+   iowrite16(wOffset + ii, io_base + MAC_REG_MISCFFNDEX);
iowrite32(*pdwKey++, io_base + MAC_REG_MISCFFDATA);
-   VNSvOutPortW(io_base + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+   iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
}
 }
 
@@ -879,7 +879,7 @@ void MACvDisableKeyEntry(struct vnt_private *priv, unsigned 
int uEntryIdx)
wOffset = MISCFIFO_KEYETRY0;
wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
 
-   VNSvOutPortW(io_base + MAC_REG_MISCFFNDEX, wOffset);
+   iowrite16(wOffset, io_base + MAC_REG_MISCFFNDEX);
iowrite32(0, io_base + MAC_REG_MISCFFDATA);
-   VNSvOutPortW(io_base + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+   iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
 }
-- 
2.7.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 04/13] staging: vt6655: mac.c replace VNSvOutPortD with iowrite32.

2016-03-06 Thread Malcolm Priestley
Removing the macro from functions.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 52 +---
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index c2723c1..a9ddb95 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -263,18 +263,16 @@ void MACvRestoreContext(struct vnt_private *priv, 
unsigned char *cxt_buf)
MAC_REG_BBREGCTL - MAC_REG_PSCFG);
 
/* restore CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR */
-   VNSvOutPortD(io_base + MAC_REG_TXDMAPTR0,
-*(u32 *)(cxt_buf + MAC_REG_TXDMAPTR0));
-   VNSvOutPortD(io_base + MAC_REG_AC0DMAPTR,
-*(u32 *)(cxt_buf + MAC_REG_AC0DMAPTR));
-   VNSvOutPortD(io_base + MAC_REG_BCNDMAPTR,
-*(u32 *)(cxt_buf + MAC_REG_BCNDMAPTR));
-
-   VNSvOutPortD(io_base + MAC_REG_RXDMAPTR0,
-*(u32 *)(cxt_buf + MAC_REG_RXDMAPTR0));
-
-   VNSvOutPortD(io_base + MAC_REG_RXDMAPTR1,
-*(u32 *)(cxt_buf + MAC_REG_RXDMAPTR1));
+   iowrite32(*(u32 *)(cxt_buf + MAC_REG_TXDMAPTR0),
+ io_base + MAC_REG_TXDMAPTR0);
+   iowrite32(*(u32 *)(cxt_buf + MAC_REG_AC0DMAPTR),
+ io_base + MAC_REG_AC0DMAPTR);
+   iowrite32(*(u32 *)(cxt_buf + MAC_REG_BCNDMAPTR),
+ io_base + MAC_REG_BCNDMAPTR);
+   iowrite32(*(u32 *)(cxt_buf + MAC_REG_RXDMAPTR0),
+ io_base + MAC_REG_RXDMAPTR0);
+   iowrite32(*(u32 *)(cxt_buf + MAC_REG_RXDMAPTR1),
+ io_base + MAC_REG_RXDMAPTR1);
 }
 
 /*
@@ -360,8 +358,8 @@ bool MACbSafeRxOff(struct vnt_private *priv)
/* turn off wow temp for turn off Rx safely */
 
/* Clear RX DMA0,1 */
-   VNSvOutPortD(io_base + MAC_REG_RXDMACTL0, DMACTL_CLRRUN);
-   VNSvOutPortD(io_base + MAC_REG_RXDMACTL1, DMACTL_CLRRUN);
+   iowrite32(DMACTL_CLRRUN, io_base + MAC_REG_RXDMACTL0);
+   iowrite32(DMACTL_CLRRUN, io_base + MAC_REG_RXDMACTL1);
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
if (!(ioread32(io_base + MAC_REG_RXDMACTL0) & DMACTL_RUN))
break;
@@ -413,9 +411,9 @@ bool MACbSafeTxOff(struct vnt_private *priv)
 
/* Clear TX DMA */
/* Tx0 */
-   VNSvOutPortD(io_base + MAC_REG_TXDMACTL0, DMACTL_CLRRUN);
+   iowrite32(DMACTL_CLRRUN, io_base + MAC_REG_TXDMACTL0);
/* AC0 */
-   VNSvOutPortD(io_base + MAC_REG_AC0DMACTL, DMACTL_CLRRUN);
+   iowrite32(DMACTL_CLRRUN, io_base + MAC_REG_AC0DMACTL);
 
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
if (!(ioread32(io_base + MAC_REG_TXDMACTL0) & DMACTL_RUN))
@@ -572,7 +570,7 @@ void MACvSetCurrRx0DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
break;
}
 
-   VNSvOutPortD(io_base + MAC_REG_RXDMAPTR0, dwCurrDescAddr);
+   iowrite32(dwCurrDescAddr, io_base + MAC_REG_RXDMAPTR0);
if (byOrgDMACtl & DMACTL_RUN)
VNSvOutPortB(io_base + MAC_REG_RXDMACTL0, DMACTL_RUN);
 }
@@ -606,7 +604,7 @@ void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
break;
}
 
-   VNSvOutPortD(io_base + MAC_REG_RXDMAPTR1, dwCurrDescAddr);
+   iowrite32(dwCurrDescAddr, io_base + MAC_REG_RXDMAPTR1);
if (byOrgDMACtl & DMACTL_RUN)
VNSvOutPortB(io_base + MAC_REG_RXDMACTL1, DMACTL_RUN);
 
@@ -642,7 +640,7 @@ void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv,
break;
}
 
-   VNSvOutPortD(io_base + MAC_REG_TXDMAPTR0, dwCurrDescAddr);
+   iowrite32(dwCurrDescAddr, io_base + MAC_REG_TXDMAPTR0);
if (byOrgDMACtl & DMACTL_RUN)
VNSvOutPortB(io_base + MAC_REG_TXDMACTL0, DMACTL_RUN);
 }
@@ -679,7 +677,7 @@ void MACvSetCurrAC0DescAddrEx(struct vnt_private *priv,
}
if (ww == W_MAX_TIMEOUT)
pr_debug(" DBG_PORT80(0x26)\n");
-   VNSvOutPortD(io_base + MAC_REG_AC0DMAPTR, dwCurrDescAddr);
+   iowrite32(dwCurrDescAddr, io_base + MAC_REG_AC0DMAPTR);
if (byOrgDMACtl & DMACTL_RUN)
VNSvOutPortB(io_base + MAC_REG_AC0DMACTL, DMACTL_RUN);
 }
@@ -714,7 +712,7 @@ void MACvTimer0MicroSDelay(struct vnt_private *priv, 
unsigned int uDelay)
unsigned int uu, ii;
 
VNSvOutPortB(io_base + MAC_REG_TMCTL0, 0);
-   VNSvOutPortD(io_base + MAC_REG_TMDATA0, uDelay);
+   iowrite32(uDelay, io_base + MAC_REG_TMDATA0);
VNSvOutPortB(io_base + MAC_REG_TMCTL0, (TMCTL_TMD | TMCTL_TE));
for (ii = 0; ii < 66; ii++) {  /* assume max PCI clock is 66Mhz */
for (uu = 0; uu < uDelay; uu++) {
@@ -748,7 +746,7 @@ void MACvOneShotTimer1MicroSec(struct vnt_private *priv, 
unsigned int uDelayTime
void __iomem *io_base = priv->PortOffset;
 
VNSvOutPortB(io_base + 

[PATCH 13/13] staging: vt6655: mac.c replace dwData with data.

2016-03-06 Thread Malcolm Priestley
Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index e762c33..45196c6 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -748,14 +748,14 @@ void MACvOneShotTimer1MicroSec(struct vnt_private *priv, 
unsigned int uDelayTime
 }
 
 void MACvSetMISCFifo(struct vnt_private *priv, unsigned short offset,
-u32 dwData)
+u32 data)
 {
void __iomem *io_base = priv->PortOffset;
 
if (offset > 273)
return;
iowrite16(offset, io_base + MAC_REG_MISCFFNDEX);
-   iowrite32(dwData, io_base + MAC_REG_MISCFFDATA);
+   iowrite32(data, io_base + MAC_REG_MISCFFDATA);
iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
 }
 
@@ -804,7 +804,7 @@ void MACvSetKeyEntry(struct vnt_private *priv, unsigned 
short wKeyCtl,
 {
void __iomem *io_base = priv->PortOffset;
unsigned short offset;
-   u32 dwData;
+   u32 data;
int ii;
 
if (byLocalID <= 1)
@@ -814,30 +814,30 @@ void MACvSetKeyEntry(struct vnt_private *priv, unsigned 
short wKeyCtl,
offset = MISCFIFO_KEYETRY0;
offset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
 
-   dwData = 0;
-   dwData |= wKeyCtl;
-   dwData <<= 16;
-   dwData |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5));
+   data = 0;
+   data |= wKeyCtl;
+   data <<= 16;
+   data |= MAKEWORD(*(pbyAddr + 4), *(pbyAddr + 5));
pr_debug("1. offset: %d, Data: %X, KeyCtl:%X\n",
-offset, dwData, wKeyCtl);
+offset, data, wKeyCtl);
 
iowrite16(offset, io_base + MAC_REG_MISCFFNDEX);
-   iowrite32(dwData, io_base + MAC_REG_MISCFFDATA);
+   iowrite32(data, io_base + MAC_REG_MISCFFDATA);
iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
offset++;
 
-   dwData = 0;
-   dwData |= *(pbyAddr+3);
-   dwData <<= 8;
-   dwData |= *(pbyAddr+2);
-   dwData <<= 8;
-   dwData |= *(pbyAddr+1);
-   dwData <<= 8;
-   dwData |= *(pbyAddr+0);
-   pr_debug("2. offset: %d, Data: %X\n", offset, dwData);
+   data = 0;
+   data |= *(pbyAddr + 3);
+   data <<= 8;
+   data |= *(pbyAddr + 2);
+   data <<= 8;
+   data |= *(pbyAddr + 1);
+   data <<= 8;
+   data |= *pbyAddr;
+   pr_debug("2. offset: %d, Data: %X\n", offset, data);
 
iowrite16(offset, io_base + MAC_REG_MISCFFNDEX);
-   iowrite32(dwData, io_base + MAC_REG_MISCFFDATA);
+   iowrite32(data, io_base + MAC_REG_MISCFFDATA);
iowrite16(MISCFFCTL_WRITE, io_base + MAC_REG_MISCFFCTL);
offset++;
 
-- 
2.7.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 07/13] staging: vt6655: MACbPSWakeup replace VNSvInPortB byOrgValue with ioread8

2016-03-06 Thread Malcolm Priestley
removing byOrgValue variable.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index a1be5a7..6499709 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -765,7 +765,6 @@ void MACvSetMISCFifo(struct vnt_private *priv, unsigned 
short wOffset,
 bool MACbPSWakeup(struct vnt_private *priv)
 {
void __iomem *io_base = priv->PortOffset;
-   unsigned char byOrgValue;
unsigned int ww;
/* Read PSCTL */
if (MACbIsRegBitsOff(priv, MAC_REG_PSCTL, PSCTL_PS))
@@ -776,8 +775,7 @@ bool MACbPSWakeup(struct vnt_private *priv)
 
/* Check if SyncFlushOK */
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
-   VNSvInPortB(io_base + MAC_REG_PSCTL, );
-   if (byOrgValue & PSCTL_WAKEDONE)
+   if (ioread8(io_base + MAC_REG_PSCTL) & PSCTL_WAKEDONE)
break;
}
if (ww == W_MAX_TIMEOUT) {
-- 
2.7.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 09/13] staging: vt6655: mac.c replace VNSvInPortB with ioread8

2016-03-06 Thread Malcolm Priestley
Removing the macro from functions.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index ece2bf0..a1be62d 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -558,7 +558,7 @@ void MACvSetCurrRx0DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
unsigned short ww;
unsigned char byOrgDMACtl;
 
-   VNSvInPortB(io_base + MAC_REG_RXDMACTL0, );
+   byOrgDMACtl = ioread8(io_base + MAC_REG_RXDMACTL0);
if (byOrgDMACtl & DMACTL_RUN)
iowrite8(DMACTL_RUN, io_base + MAC_REG_RXDMACTL0 + 2);
 
@@ -592,7 +592,7 @@ void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 
dwCurrDescAddr)
unsigned short ww;
unsigned char byOrgDMACtl;
 
-   VNSvInPortB(io_base + MAC_REG_RXDMACTL1, );
+   byOrgDMACtl = ioread8(io_base + MAC_REG_RXDMACTL1);
if (byOrgDMACtl & DMACTL_RUN)
iowrite8(DMACTL_RUN, io_base + MAC_REG_RXDMACTL1 + 2);
 
@@ -628,7 +628,7 @@ void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv,
unsigned short ww;
unsigned char byOrgDMACtl;
 
-   VNSvInPortB(io_base + MAC_REG_TXDMACTL0, );
+   byOrgDMACtl = ioread8(io_base + MAC_REG_TXDMACTL0);
if (byOrgDMACtl & DMACTL_RUN)
iowrite8(DMACTL_RUN, io_base + MAC_REG_TXDMACTL0 + 2);
 
@@ -664,7 +664,7 @@ void MACvSetCurrAC0DescAddrEx(struct vnt_private *priv,
unsigned short ww;
unsigned char byOrgDMACtl;
 
-   VNSvInPortB(io_base + MAC_REG_AC0DMACTL, );
+   byOrgDMACtl = ioread8(io_base + MAC_REG_AC0DMACTL);
if (byOrgDMACtl & DMACTL_RUN)
iowrite8(DMACTL_RUN, io_base + MAC_REG_AC0DMACTL + 2);
 
@@ -713,7 +713,7 @@ void MACvTimer0MicroSDelay(struct vnt_private *priv, 
unsigned int uDelay)
iowrite8((TMCTL_TMD | TMCTL_TE), io_base + MAC_REG_TMCTL0);
for (ii = 0; ii < 66; ii++) {  /* assume max PCI clock is 66Mhz */
for (uu = 0; uu < uDelay; uu++) {
-   VNSvInPortB(io_base + MAC_REG_TMCTL0, );
+   byValue = ioread8(io_base + MAC_REG_TMCTL0);
if ((byValue == 0) ||
(byValue & TMCTL_TSUSP)) {
iowrite8(0, io_base + MAC_REG_TMCTL0);
-- 
2.7.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 01/13] staging: vt6655: mac.c rename pbyCxtBuf to cxt_buf

2016-03-06 Thread Malcolm Priestley
Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley 
---
Following on from patch
MACvSaveContext use memcpy_fromio to read context.

 drivers/staging/vt6655/mac.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index 66ae991..9c4dabd 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -202,22 +202,22 @@ void MACvSetLoopbackMode(struct vnt_private *priv, 
unsigned char byLoopbackMode)
  *  In:
  *  io_base- Base Address for MAC
  *  Out:
- *  pbyCxtBuf   - Context buffer
+ *  cxt_buf   - Context buffer
  *
  * Return Value: none
  *
  */
-void MACvSaveContext(struct vnt_private *priv, unsigned char *pbyCxtBuf)
+void MACvSaveContext(struct vnt_private *priv, unsigned char *cxt_buf)
 {
void __iomem *io_base = priv->PortOffset;
 
/* read page0 register */
-   memcpy_fromio(pbyCxtBuf, io_base, MAC_MAX_CONTEXT_SIZE_PAGE0);
+   memcpy_fromio(cxt_buf, io_base, MAC_MAX_CONTEXT_SIZE_PAGE0);
 
MACvSelectPage1(io_base);
 
/* read page1 register */
-   memcpy_fromio(pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0, io_base,
+   memcpy_fromio(cxt_buf + MAC_MAX_CONTEXT_SIZE_PAGE0, io_base,
  MAC_MAX_CONTEXT_SIZE_PAGE1);
 
MACvSelectPage0(io_base);
@@ -230,14 +230,14 @@ void MACvSaveContext(struct vnt_private *priv, unsigned 
char *pbyCxtBuf)
  * Parameters:
  *  In:
  *  io_base- Base Address for MAC
- *  pbyCxtBuf   - Context buffer
+ *  cxt_buf   - Context buffer
  *  Out:
  *  none
  *
  * Return Value: none
  *
  */
-void MACvRestoreContext(struct vnt_private *priv, unsigned char *pbyCxtBuf)
+void MACvRestoreContext(struct vnt_private *priv, unsigned char *cxt_buf)
 {
void __iomem *io_base = priv->PortOffset;
int ii;
@@ -246,37 +246,37 @@ void MACvRestoreContext(struct vnt_private *priv, 
unsigned char *pbyCxtBuf)
/* restore page1 */
for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++)
VNSvOutPortB((io_base + ii),
-*(pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii));
+*(cxt_buf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii));
 
MACvSelectPage0(io_base);
 
/* restore RCR,TCR,IMR... */
for (ii = MAC_REG_RCR; ii < MAC_REG_ISR; ii++)
-   VNSvOutPortB(io_base + ii, *(pbyCxtBuf + ii));
+   VNSvOutPortB(io_base + ii, *(cxt_buf + ii));
 
/* restore MAC Config. */
for (ii = MAC_REG_LRT; ii < MAC_REG_PAGE1SEL; ii++)
-   VNSvOutPortB(io_base + ii, *(pbyCxtBuf + ii));
+   VNSvOutPortB(io_base + ii, *(cxt_buf + ii));
 
-   VNSvOutPortB(io_base + MAC_REG_CFG, *(pbyCxtBuf + MAC_REG_CFG));
+   VNSvOutPortB(io_base + MAC_REG_CFG, *(cxt_buf + MAC_REG_CFG));
 
/* restore PS Config. */
for (ii = MAC_REG_PSCFG; ii < MAC_REG_BBREGCTL; ii++)
-   VNSvOutPortB(io_base + ii, *(pbyCxtBuf + ii));
+   VNSvOutPortB(io_base + ii, *(cxt_buf + ii));
 
/* restore CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR */
VNSvOutPortD(io_base + MAC_REG_TXDMAPTR0,
-*(unsigned long *)(pbyCxtBuf + MAC_REG_TXDMAPTR0));
+*(unsigned long *)(cxt_buf + MAC_REG_TXDMAPTR0));
VNSvOutPortD(io_base + MAC_REG_AC0DMAPTR,
-*(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR));
+*(unsigned long *)(cxt_buf + MAC_REG_AC0DMAPTR));
VNSvOutPortD(io_base + MAC_REG_BCNDMAPTR,
-*(unsigned long *)(pbyCxtBuf + MAC_REG_BCNDMAPTR));
+*(unsigned long *)(cxt_buf + MAC_REG_BCNDMAPTR));
 
VNSvOutPortD(io_base + MAC_REG_RXDMAPTR0,
-*(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR0));
+*(unsigned long *)(cxt_buf + MAC_REG_RXDMAPTR0));
 
VNSvOutPortD(io_base + MAC_REG_RXDMAPTR1,
-*(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR1));
+*(unsigned long *)(cxt_buf + MAC_REG_RXDMAPTR1));
 }
 
 /*
-- 
2.7.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 03/13] staging: vt6655: mac.c/h resize all unsigned long to u32

2016-03-06 Thread Malcolm Priestley
All addressing is limited to 32 bits match this to all
functions and port out functions.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 22 +++---
 drivers/staging/vt6655/mac.h | 16 
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index 02e3e42..c2723c1 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -264,17 +264,17 @@ void MACvRestoreContext(struct vnt_private *priv, 
unsigned char *cxt_buf)
 
/* restore CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR */
VNSvOutPortD(io_base + MAC_REG_TXDMAPTR0,
-*(unsigned long *)(cxt_buf + MAC_REG_TXDMAPTR0));
+*(u32 *)(cxt_buf + MAC_REG_TXDMAPTR0));
VNSvOutPortD(io_base + MAC_REG_AC0DMAPTR,
-*(unsigned long *)(cxt_buf + MAC_REG_AC0DMAPTR));
+*(u32 *)(cxt_buf + MAC_REG_AC0DMAPTR));
VNSvOutPortD(io_base + MAC_REG_BCNDMAPTR,
-*(unsigned long *)(cxt_buf + MAC_REG_BCNDMAPTR));
+*(u32 *)(cxt_buf + MAC_REG_BCNDMAPTR));
 
VNSvOutPortD(io_base + MAC_REG_RXDMAPTR0,
-*(unsigned long *)(cxt_buf + MAC_REG_RXDMAPTR0));
+*(u32 *)(cxt_buf + MAC_REG_RXDMAPTR0));
 
VNSvOutPortD(io_base + MAC_REG_RXDMAPTR1,
-*(unsigned long *)(cxt_buf + MAC_REG_RXDMAPTR1));
+*(u32 *)(cxt_buf + MAC_REG_RXDMAPTR1));
 }
 
 /*
@@ -557,7 +557,7 @@ void MACvInitialize(struct vnt_private *priv)
  * Return Value: none
  *
  */
-void MACvSetCurrRx0DescAddr(struct vnt_private *priv, unsigned long 
dwCurrDescAddr)
+void MACvSetCurrRx0DescAddr(struct vnt_private *priv, u32 dwCurrDescAddr)
 {
void __iomem *io_base = priv->PortOffset;
unsigned short ww;
@@ -591,7 +591,7 @@ void MACvSetCurrRx0DescAddr(struct vnt_private *priv, 
unsigned long dwCurrDescAd
  * Return Value: none
  *
  */
-void MACvSetCurrRx1DescAddr(struct vnt_private *priv, unsigned long 
dwCurrDescAddr)
+void MACvSetCurrRx1DescAddr(struct vnt_private *priv, u32 dwCurrDescAddr)
 {
void __iomem *io_base = priv->PortOffset;
unsigned short ww;
@@ -627,7 +627,7 @@ void MACvSetCurrRx1DescAddr(struct vnt_private *priv, 
unsigned long dwCurrDescAd
  *
  */
 void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv,
- unsigned long dwCurrDescAddr)
+ u32 dwCurrDescAddr)
 {
void __iomem *io_base = priv->PortOffset;
unsigned short ww;
@@ -663,7 +663,7 @@ void MACvSetCurrTx0DescAddrEx(struct vnt_private *priv,
  */
 /* TxDMA1 = AC0DMA */
 void MACvSetCurrAC0DescAddrEx(struct vnt_private *priv,
- unsigned long dwCurrDescAddr)
+ u32 dwCurrDescAddr)
 {
void __iomem *io_base = priv->PortOffset;
unsigned short ww;
@@ -685,7 +685,7 @@ void MACvSetCurrAC0DescAddrEx(struct vnt_private *priv,
 }
 
 void MACvSetCurrTXDescAddr(int iTxType, struct vnt_private *priv,
-  unsigned long dwCurrDescAddr)
+  u32 dwCurrDescAddr)
 {
if (iTxType == TYPE_AC0DMA)
MACvSetCurrAC0DescAddrEx(priv, dwCurrDescAddr);
@@ -753,7 +753,7 @@ void MACvOneShotTimer1MicroSec(struct vnt_private *priv, 
unsigned int uDelayTime
 }
 
 void MACvSetMISCFifo(struct vnt_private *priv, unsigned short wOffset,
-unsigned long dwData)
+u32 dwData)
 {
void __iomem *io_base = priv->PortOffset;
 
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 192f466..3eef928 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -916,24 +916,24 @@ bool MACbSafeStop(struct vnt_private *);
 bool MACbShutdown(struct vnt_private *);
 void MACvInitialize(struct vnt_private *);
 void MACvSetCurrRx0DescAddr(struct vnt_private *,
-   unsigned long dwCurrDescAddr);
+   u32 dwCurrDescAddr);
 void MACvSetCurrRx1DescAddr(struct vnt_private *,
-   unsigned long dwCurrDescAddr);
+   u32 dwCurrDescAddr);
 void MACvSetCurrTXDescAddr(int iTxType, struct vnt_private *,
-  unsigned long dwCurrDescAddr);
+  u32 dwCurrDescAddr);
 void MACvSetCurrTx0DescAddrEx(struct vnt_private *,
- unsigned long dwCurrDescAddr);
+ u32 dwCurrDescAddr);
 void MACvSetCurrAC0DescAddrEx(struct vnt_private *,
- unsigned long dwCurrDescAddr);
+ u32 dwCurrDescAddr);
 void MACvSetCurrSyncDescAddrEx(struct vnt_private *,
-  unsigned long dwCurrDescAddr);
+  u32 dwCurrDescAddr);
 void MACvSetCurrATIMDescAddrEx(struct 

Re: [PATCH] iw: add libnl-tiny support, reimplemented

2016-03-06 Thread Kalle Valo
Dima Krasner  writes:

> This allows small static builds, especially when using musl libc.
>
> Signed-off-by: Dima Krasner 

When sending a new version of the patch the standard practise is to add
v2 to the subject, like this:

Subject: [PATCH v2] iw: add libnl-tiny support

-- 
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 2/2] iwlwifi: mvm: Fix paging memory leak

2016-03-06 Thread Kalle Valo
Luca Coelho  writes:

> On Fri, 2016-03-04 at 18:07 +0200, Kalle Valo wrote:
>> Emmanuel Grumbach  writes:
>> 
>> > From: Matti Gottlieb 
>> > 
>> > If the opmode is stopped and started again we did not free
>> > the paging buffers. Fix that.
>> > In addition when freeing the firmware's paging download
>> > buffer, set the pointer to NULL.
>> > 
>> > Signed-off-by: Matti Gottlieb 
>> > Signed-off-by: Emmanuel Grumbach 
>> 
>> Nitpicking while writing the pull request for Dave:
>> 
>> What does "opmode is stopped" mean? Important bug fixes should have a
>> clear bug description from user's point of view. Using driver internal
>> jargon is gibberish to most people.
>
> I agree that there could be a bit more high-level description here, but
> I also think it's good to keep a bit more details about what is
> happening internally, so that developers understand too. ;)

Sure, feel free to write as much as you want and in such detail as you
think is necessary :) Just having a clear summary without internal
jargon helps people outside of iwlwifi.

BTW, the other iwlwifi fix had a bit similar problem:

https://git.kernel.org/cgit/linux/kernel/git/kvalo/wireless-drivers.git/commit/?id=fb896c44f88a75843a072cd6961b1615732f7811

What does "non-sta" mean in this context? Is it the AP or what? Or
something not part of the current BSS? I guess I might find a definition
from the spec or from iwlwifi sources but I really should not be forced
to do that.

> Do you think it would be acceptable to keep the commit log most as it
> is, but start with something like "Some paging buffers were not freed
> when the driver is restarted."? I don't mean to change this commit
> itself, but just so that we know how to please you (and users) while
> still keeping the details as part of the commit logs... ;)

That sounds good to me. What I'm after is that someone like Dave or
Linus can understand from the commit log what kind of bug this patch is
fixing, without looking into source or checking mailing lists. This is
especially more important in the later stages of the cycle.

>> I investigated this myself and apparently "opmode" is stopped when the
>> module is unloaded or the PCI device is removed. So just say that in the
>> commit log and everyone understand much better.
>
> Our driver is divided roughly into two layers: the bus layer (called
> transport) and the protocol layer (called opmode).  The name comes from
> the difference between the two opmodes that we currently have.  One
> supports only a single operating channel (dvm) and the other supports
> multiple operating channels (mvm).
>
> Hope this clarifies a bit. :)

It did, thanks.

-- 
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