[PATCH 2/2] staging: wilc1000: remove unnecessary typecast in #define macro

2015-06-18 Thread Chaehyun Lim
Remove unnecessary typecast in #define macro.

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/host_interface.c | 78 +++
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 2cb2607..9469561 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -17,45 +17,45 @@ extern u8 g_wilc_initialized;
 /*/
 
 /* Message types of the Host IF Message Queue*/
-#define HOST_IF_MSG_SCAN((u16)0)
-#define HOST_IF_MSG_CONNECT ((u16)1)
-#define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO((u16)2)
-#define HOST_IF_MSG_KEY ((u16)3)
-#define HOST_IF_MSG_RCVD_NTWRK_INFO ((u16)4)
-#define HOST_IF_MSG_RCVD_SCAN_COMPLETE  ((u16)5)
-#define HOST_IF_MSG_CFG_PARAMS  ((u16)6)
-#define HOST_IF_MSG_SET_CHANNEL ((u16)7)
-#define HOST_IF_MSG_DISCONNECT  ((u16)8)
-#define HOST_IF_MSG_GET_RSSI((u16)9)
-#define HOST_IF_MSG_GET_CHNL((u16)10)
-#define HOST_IF_MSG_ADD_BEACON  ((u16)11)
-#define HOST_IF_MSG_DEL_BEACON  ((u16)12)
-#define HOST_IF_MSG_ADD_STATION ((u16)13)
-#define HOST_IF_MSG_DEL_STATION ((u16)14)
-#define HOST_IF_MSG_EDIT_STATION((u16)15)
-#define HOST_IF_MSG_SCAN_TIMER_FIRED((u16)16)
-#define HOST_IF_MSG_CONNECT_TIMER_FIRED ((u16)17)
-#define HOST_IF_MSG_POWER_MGMT  ((u16)18)
-#define HOST_IF_MSG_GET_INACTIVETIME((u16)19)
-#define HOST_IF_MSG_REMAIN_ON_CHAN  ((u16)20)
-#define HOST_IF_MSG_REGISTER_FRAME  ((u16)21)
-#define HOST_IF_MSG_LISTEN_TIMER_FIRED  ((u16)22)
-#define HOST_IF_MSG_GET_LINKSPEED   ((u16)23)
-#define HOST_IF_MSG_SET_WFIDRV_HANDLER  ((u16)24)
-#define HOST_IF_MSG_SET_MAC_ADDRESS ((u16)25)
-#define HOST_IF_MSG_GET_MAC_ADDRESS ((u16)26)
-#define HOST_IF_MSG_SET_OPERATION_MODE  ((u16)27)
-#define HOST_IF_MSG_SET_IPADDRESS   ((u16)28)
-#define HOST_IF_MSG_GET_IPADDRESS   ((u16)29)
-#define HOST_IF_MSG_FLUSH_CONNECT   ((u16)30)
-#define HOST_IF_MSG_GET_STATISTICS  ((u16)31)
-#define HOST_IF_MSG_SET_MULTICAST_FILTER((u16)32)
-#define HOST_IF_MSG_ADD_BA_SESSION  ((u16)33)
-#define HOST_IF_MSG_DEL_BA_SESSION  ((u16)34)
-#define HOST_IF_MSG_Q_IDLE  ((u16)35)
-#define HOST_IF_MSG_DEL_ALL_STA ((u16)36)
-#define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS  ((u16)34)
-#define HOST_IF_MSG_EXIT((u16)100)
+#define HOST_IF_MSG_SCAN0
+#define HOST_IF_MSG_CONNECT 1
+#define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO2
+#define HOST_IF_MSG_KEY 3
+#define HOST_IF_MSG_RCVD_NTWRK_INFO 4
+#define HOST_IF_MSG_RCVD_SCAN_COMPLETE  5
+#define HOST_IF_MSG_CFG_PARAMS  6
+#define HOST_IF_MSG_SET_CHANNEL 7
+#define HOST_IF_MSG_DISCONNECT  8
+#define HOST_IF_MSG_GET_RSSI9
+#define HOST_IF_MSG_GET_CHNL10
+#define HOST_IF_MSG_ADD_BEACON  11
+#define HOST_IF_MSG_DEL_BEACON  12
+#define HOST_IF_MSG_ADD_STATION 13
+#define HOST_IF_MSG_DEL_STATION 14
+#define HOST_IF_MSG_EDIT_STATION15
+#define HOST_IF_MSG_SCAN_TIMER_FIRED16
+#define HOST_IF_MSG_CONNECT_TIMER_FIRED 17
+#define HOST_IF_MSG_POWER_MGMT  18
+#define HOST_IF_MSG_GET_INACTIVETIME19
+#define HOST_IF_MSG_REMAIN_ON_CHAN  20
+#define HOST_IF_MSG_REGISTER_FRAME  21
+#define HOST_IF_MSG_LISTEN_TIMER_FIRED  22
+#define HOST_IF_MSG_GET_LINKSPEED   23
+#define HOST_IF_MSG_SET_WFIDRV_HANDLER  24
+#define HOST_IF_MSG_SET_MAC_ADDRESS 25
+#define HOST_IF_MSG_GET_MAC_ADDRESS 26
+#define HOST_IF_MSG_SET_OPERATION_MODE  27
+#define HOST_IF_MSG_SET_IPADDRESS   28
+#define HOST_IF_MSG_GET_IPADDRESS   29
+#define HOST_IF_MSG_FLUSH_CONNECT   30
+#define HOST_IF_MSG_GET_STATISTICS  31
+#define HOST_IF_MSG_SET_MULTICAST_FILTER32
+#define HOST_IF_MSG_ADD_BA_SESSION  33
+#define HOST_IF_MSG_DEL_BA_SESSION  34
+#define HOST_IF_MSG_Q_IDLE  35
+#define HOST_IF_MSG_DEL_ALL_STA 36
+#define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS  34
+#define HOST_IF_MSG_EXIT100
 
 #define HOST_IF_SCAN_TIMEOUT   

[PATCH v2] ath9k: spectral - simplify max_index calculation

2015-06-18 Thread Zefir Kurtisi
The max_index value provided in the spectral data set
has to be interpreted differently for HT20 and HT40.
In HT40, the value is given as unsigned index and
shall be taken as is, while in HT20 it is a signed
value around bin index 28 and needs to be converted
to an unsigned index.

This patch simplifies the previous correction and
prepares the related functions to be shared with
the DFS module.

Signed-off-by: Zefir Kurtisi zefir.kurt...@neratec.com
---

v2: fix conversion offset as reported by Nick Kossifidis

 drivers/net/wireless/ath/ath9k/common-spectral.c | 20 ++---
 drivers/net/wireless/ath/ath9k/common-spectral.h | 36 +++-
 2 files changed, 18 insertions(+), 38 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c 
b/drivers/net/wireless/ath/ath9k/common-spectral.c
index a876271..175193d 100644
--- a/drivers/net/wireless/ath/ath9k/common-spectral.c
+++ b/drivers/net/wireless/ath/ath9k/common-spectral.c
@@ -59,8 +59,8 @@ ath_cmn_max_idx_verify_ht20_fft(u8 *sample_end, int 
bytes_read)
 
sample = sample_end - SPECTRAL_HT20_SAMPLE_LEN + 1;
 
-   max_index = spectral_max_index(mag_info-all_bins,
-  SPECTRAL_HT20_NUM_BINS);
+   /* in ht20, this is a 6-bit signed number = shift it to 0 */
+   max_index = (spectral_max_index(mag_info-all_bins) ^ 0x20) - 4;
max_magnitude = spectral_max_magnitude(mag_info-all_bins);
 
max_exp = mag_info-max_exp  0xf;
@@ -100,12 +100,10 @@ ath_cmn_max_idx_verify_ht20_40_fft(u8 *sample_end, int 
bytes_read)
sample = sample_end - SPECTRAL_HT20_40_SAMPLE_LEN + 1;
 
lower_mag = spectral_max_magnitude(mag_info-lower_bins);
-   lower_max_index = spectral_max_index(mag_info-lower_bins,
-SPECTRAL_HT20_40_NUM_BINS);
+   lower_max_index = spectral_max_index(mag_info-lower_bins);
 
upper_mag = spectral_max_magnitude(mag_info-upper_bins);
-   upper_max_index = spectral_max_index(mag_info-upper_bins,
-SPECTRAL_HT20_40_NUM_BINS);
+   upper_max_index = spectral_max_index(mag_info-upper_bins);
 
max_exp = mag_info-max_exp  0xf;
 
@@ -169,8 +167,8 @@ ath_cmn_process_ht20_fft(struct ath_rx_status *rs,
magnitude = spectral_max_magnitude(mag_info-all_bins);
fft_sample_20.max_magnitude = __cpu_to_be16(magnitude);
 
-   max_index = spectral_max_index(mag_info-all_bins,
-   SPECTRAL_HT20_NUM_BINS);
+   /* in ht20, this is a 6-bit signed number = shift it to 0 */
+   max_index = (spectral_max_index(mag_info-all_bins) ^ 0x20) - 4;
fft_sample_20.max_index = max_index;
 
bitmap_w = spectral_bitmap_weight(mag_info-all_bins);
@@ -302,12 +300,10 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs,
upper_mag = spectral_max_magnitude(mag_info-upper_bins);
fft_sample_40.upper_max_magnitude = __cpu_to_be16(upper_mag);
 
-   lower_max_index = spectral_max_index(mag_info-lower_bins,
-   SPECTRAL_HT20_40_NUM_BINS);
+   lower_max_index = spectral_max_index(mag_info-lower_bins);
fft_sample_40.lower_max_index = lower_max_index;
 
-   upper_max_index = spectral_max_index(mag_info-upper_bins,
-   SPECTRAL_HT20_40_NUM_BINS);
+   upper_max_index = spectral_max_index(mag_info-upper_bins);
fft_sample_40.upper_max_index = upper_max_index;
 
lower_bitmap_w = spectral_bitmap_weight(mag_info-lower_bins);
diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.h 
b/drivers/net/wireless/ath/ath9k/common-spectral.h
index 998743b..7540835 100644
--- a/drivers/net/wireless/ath/ath9k/common-spectral.h
+++ b/drivers/net/wireless/ath/ath9k/common-spectral.h
@@ -116,33 +116,17 @@ static inline u16 spectral_max_magnitude(u8 *bins)
   (bins[2]  0x03)  10;
 }
 
-/* return the max magnitude from the all/upper/lower bins */
-static inline u8 spectral_max_index(u8 *bins, int num_bins)
+/* return the max index from the all/upper/lower bins
+ *
+ * in HT20: 6-bit signed number of range -28 to +27
+ * in HT40: 6-bit unsigned number of range 0 to +63
+ *  (upper sub-channel index 0 is DC)
+ *
+ * Correct interpretation of the value has to be done at caller
+ */
+static inline u8 spectral_max_index(u8 *bins)
 {
-   s8 m = (bins[2]  0xfc)  2;
-   u8 zero_idx = num_bins / 2;
-
-   /* It's a 5 bit signed int, remove its sign and use one's
-* complement interpretation to add the sign back to the 8
-* bit int
-*/
-   if (m  0x20) {
-   m = ~0x20;
-   m |= 0xe0;
-   }
-
-   /* Bring the zero point to the beginning
-* instead of the middle so that we can use
-* it for array lookup and that we don't deal
-* with negative values later
-*/
-   m += zero_idx;
-
-  

[PATCH] Staging: wilc1000: NULL check before some freeing functions is not needed

2015-06-18 Thread Abdul, Hussain (H.)
From: Abdul Hussain hab...@visteon.com

This patch removes check before freeing the memory 
since kfree(NULL) is safe

Signed-off-by: Abdul Hussain hab...@visteon.com
---
 drivers/staging/wilc1000/linux_wlan_spi.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 1eee1d5..236669c 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -214,8 +214,7 @@ int linux_spi_write(uint8_t *b, uint32_t len)
PRINT_ER(SPI transaction failed\n);
}
}
-   if (r_buffer)
-   kfree(r_buffer);
+   kfree(r_buffer);
} else {
PRINT_ER(can't write data with the following length: %d\n, 
len);
PRINT_ER(FAILED due to NULL buffer or ZERO length check the 
following length: %d\n, len);
@@ -377,8 +376,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
}
}
 
-   if (t_buffer)
-   kfree(t_buffer);
+   kfree(t_buffer);
} else {
PRINT_ER(can't read data with the following length: %ld\n, 
rlen);
ret = -1;
-- 
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] mac80211: protect u64 statistics properly on 32-bit

2015-06-18 Thread Johannes Berg
From: Johannes Berg johannes.b...@intel.com

On 32-bit architectures, the various (new) 64-bit statistics
aren't protected against reading while they're being changed
(which isn't atomic unlike on 64-bit architectures.)

Signed-off-by: Johannes Berg johannes.b...@intel.com
---
 net/mac80211/rx.c   |  5 
 net/mac80211/sta_info.c | 68 +++--
 net/mac80211/sta_info.h | 17 +
 net/mac80211/status.c   |  2 ++
 net/mac80211/tx.c   | 14 +++---
 5 files changed, 90 insertions(+), 16 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 3a1462810c8e..eae50d095930 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1425,7 +1425,10 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
ieee80211_sta_rx_notify(rx-sdata, hdr);
 
sta-rx_fragments++;
+   u64_stats_update_begin(sta-rx_sync);
sta-rx_bytes += rx-skb-len;
+   u64_stats_update_end(sta-rx_sync);
+
if (!(status-flag  RX_FLAG_NO_SIGNAL_VAL)) {
sta-last_signal = status-signal;
ewma_add(sta-avg_signal, -status-signal);
@@ -2376,7 +2379,9 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
 * for non-QoS-data frames. Here we know it's a data
 * frame, so count MSDUs.
 */
+   u64_stats_update_begin(rx-sta-rx_sync);
rx-sta-rx_msdu[rx-seqno_idx]++;
+   u64_stats_update_end(rx-sta-rx_sync);
}
 
/*
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 9da7d2bc271a..494422729132 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -328,6 +328,10 @@ struct sta_info *sta_info_alloc(struct 
ieee80211_sub_if_data *sdata,
}
 #endif
 
+   u64_stats_init(sta-rx_sync);
+   u64_stats_init(sta-tx_sync);
+   u64_stats_init(sta-status_sync);
+
memcpy(sta-addr, addr, ETH_ALEN);
memcpy(sta-sta.addr, addr, ETH_ALEN);
sta-local = local;
@@ -1811,6 +1815,45 @@ u8 sta_info_tx_streams(struct sta_info *sta)
 IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1;
 }
 
+static u64 sta_get_tx_stat(struct sta_info *sta, u64 *value)
+{
+   u64 res;
+   unsigned int start;
+
+   do {
+   start = u64_stats_fetch_begin_irq(sta-tx_sync);
+   res = *value;
+   } while (u64_stats_fetch_retry_irq(sta-tx_sync, start));
+
+   return res;
+}
+
+static u64 sta_get_status_stat(struct sta_info *sta, u64 *value)
+{
+   u64 res;
+   unsigned int start;
+
+   do {
+   start = u64_stats_fetch_begin_irq(sta-status_sync);
+   res = *value;
+   } while (u64_stats_fetch_retry_irq(sta-status_sync, start));
+
+   return res;
+}
+
+static u64 sta_get_rx_stat(struct sta_info *sta, u64 *value)
+{
+   u64 res;
+   unsigned int start;
+
+   do {
+   start = u64_stats_fetch_begin_irq(sta-rx_sync);
+   res = *value;
+   } while (u64_stats_fetch_retry_irq(sta-rx_sync, start));
+
+   return res;
+}
+
 void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 {
struct ieee80211_sub_if_data *sdata = sta-sdata;
@@ -1849,20 +1892,23 @@ void sta_set_sinfo(struct sta_info *sta, struct 
station_info *sinfo)
   BIT(NL80211_STA_INFO_TX_BYTES {
sinfo-tx_bytes = 0;
for (ac = 0; ac  IEEE80211_NUM_ACS; ac++)
-   sinfo-tx_bytes += sta-tx_bytes[ac];
+   sinfo-tx_bytes +=
+   sta_get_tx_stat(sta, sta-tx_bytes[ac]);
sinfo-filled |= BIT(NL80211_STA_INFO_TX_BYTES64);
}
 
if (!(sinfo-filled  BIT(NL80211_STA_INFO_TX_PACKETS))) {
sinfo-tx_packets = 0;
-   for (ac = 0; ac  IEEE80211_NUM_ACS; ac++)
-   sinfo-tx_packets += sta-tx_packets[ac];
+   for (ac = 0; ac  IEEE80211_NUM_ACS; ac++) {
+   sinfo-tx_packets +=
+   sta_get_tx_stat(sta, sta-tx_packets[ac]);
+   }
sinfo-filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
}
 
if (!(sinfo-filled  (BIT(NL80211_STA_INFO_RX_BYTES64) |
   BIT(NL80211_STA_INFO_RX_BYTES {
-   sinfo-rx_bytes = sta-rx_bytes;
+   sinfo-rx_bytes = sta_get_rx_stat(sta, sta-rx_bytes);
sinfo-filled |= BIT(NL80211_STA_INFO_RX_BYTES64);
}
 
@@ -1934,12 +1980,14 @@ void sta_set_sinfo(struct sta_info *sta, struct 
station_info *sinfo)
 
if (!(tidstats-filled  BIT(NL80211_TID_STATS_RX_MSDU))) {
tidstats-filled |= BIT(NL80211_TID_STATS_RX_MSDU);
-   tidstats-rx_msdu = sta-rx_msdu[i];
+   tidstats-rx_msdu = sta_get_rx_stat(sta,
+ 

Re: [PATCH 4/5] staging: wilc1000: remove prohibited spaces.

2015-06-18 Thread Greg KH
On Thu, Jun 18, 2015 at 01:51:15PM +0900, 조성훈 wrote:
 Hi Greg,
 I want to make sure one thing before going further. I cloned the
 staging-testing and then made the first patch. There was no problem when I 
 sent
 the first path to you.
 Afterwards, I also pulled the repository to update my local tree before making
 the second patch. So, I thought I made this second patch based on top of the
 latest commits.
 
 I am confused why you said I need rebase. Do you mean I have to make my branch
 (for example, staging-wilc1000) from staging-testing and then rebase my 
 commits
 to staging-testing branch before making patch files with git format-patch?

You made the patches correctly, I just accepted patches that were sent
before yours to the tree, which then conflicted with your patches.
That's what happens with a fast-moving tree and a driver that lots of
people are all trying to clean up at the same time.

So rebase on staging-testing again and resend and you should be fine.

thanks,

greg k-h
--
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] ath9k: spectral - simplify max_index calculation

2015-06-18 Thread Zefir Kurtisi
After further discussion with Nick, we better leave spectral as is.

Please ignore / drop this one.


On 06/18/2015 01:17 PM, Zefir Kurtisi wrote:
 The max_index value provided in the spectral data set
 has to be interpreted differently for HT20 and HT40.
 In HT40, the value is given as unsigned index and
 shall be taken as is, while in HT20 it is a signed
 value around bin index 28 and needs to be converted
 to an unsigned index.
 
 This patch simplifies the previous correction and
 prepares the related functions to be shared with
 the DFS module.
 
 Signed-off-by: Zefir Kurtisi zefir.kurt...@neratec.com
 ---
 
 v2: fix conversion offset as reported by Nick Kossifidis
 
  drivers/net/wireless/ath/ath9k/common-spectral.c | 20 ++---
  drivers/net/wireless/ath/ath9k/common-spectral.h | 36 
 +++-
  2 files changed, 18 insertions(+), 38 deletions(-)
 
 diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c 
 b/drivers/net/wireless/ath/ath9k/common-spectral.c
 index a876271..175193d 100644
 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c
 +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c
 @@ -59,8 +59,8 @@ ath_cmn_max_idx_verify_ht20_fft(u8 *sample_end, int 
 bytes_read)
  
   sample = sample_end - SPECTRAL_HT20_SAMPLE_LEN + 1;
  
 - max_index = spectral_max_index(mag_info-all_bins,
 -SPECTRAL_HT20_NUM_BINS);
 + /* in ht20, this is a 6-bit signed number = shift it to 0 */
 + max_index = (spectral_max_index(mag_info-all_bins) ^ 0x20) - 4;
   max_magnitude = spectral_max_magnitude(mag_info-all_bins);
  
   max_exp = mag_info-max_exp  0xf;
 @@ -100,12 +100,10 @@ ath_cmn_max_idx_verify_ht20_40_fft(u8 *sample_end, int 
 bytes_read)
   sample = sample_end - SPECTRAL_HT20_40_SAMPLE_LEN + 1;
  
   lower_mag = spectral_max_magnitude(mag_info-lower_bins);
 - lower_max_index = spectral_max_index(mag_info-lower_bins,
 -  SPECTRAL_HT20_40_NUM_BINS);
 + lower_max_index = spectral_max_index(mag_info-lower_bins);
  
   upper_mag = spectral_max_magnitude(mag_info-upper_bins);
 - upper_max_index = spectral_max_index(mag_info-upper_bins,
 -  SPECTRAL_HT20_40_NUM_BINS);
 + upper_max_index = spectral_max_index(mag_info-upper_bins);
  
   max_exp = mag_info-max_exp  0xf;
  
 @@ -169,8 +167,8 @@ ath_cmn_process_ht20_fft(struct ath_rx_status *rs,
   magnitude = spectral_max_magnitude(mag_info-all_bins);
   fft_sample_20.max_magnitude = __cpu_to_be16(magnitude);
  
 - max_index = spectral_max_index(mag_info-all_bins,
 - SPECTRAL_HT20_NUM_BINS);
 + /* in ht20, this is a 6-bit signed number = shift it to 0 */
 + max_index = (spectral_max_index(mag_info-all_bins) ^ 0x20) - 4;
   fft_sample_20.max_index = max_index;
  
   bitmap_w = spectral_bitmap_weight(mag_info-all_bins);
 @@ -302,12 +300,10 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs,
   upper_mag = spectral_max_magnitude(mag_info-upper_bins);
   fft_sample_40.upper_max_magnitude = __cpu_to_be16(upper_mag);
  
 - lower_max_index = spectral_max_index(mag_info-lower_bins,
 - SPECTRAL_HT20_40_NUM_BINS);
 + lower_max_index = spectral_max_index(mag_info-lower_bins);
   fft_sample_40.lower_max_index = lower_max_index;
  
 - upper_max_index = spectral_max_index(mag_info-upper_bins,
 - SPECTRAL_HT20_40_NUM_BINS);
 + upper_max_index = spectral_max_index(mag_info-upper_bins);
   fft_sample_40.upper_max_index = upper_max_index;
  
   lower_bitmap_w = spectral_bitmap_weight(mag_info-lower_bins);
 diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.h 
 b/drivers/net/wireless/ath/ath9k/common-spectral.h
 index 998743b..7540835 100644
 --- a/drivers/net/wireless/ath/ath9k/common-spectral.h
 +++ b/drivers/net/wireless/ath/ath9k/common-spectral.h
 @@ -116,33 +116,17 @@ static inline u16 spectral_max_magnitude(u8 *bins)
  (bins[2]  0x03)  10;
  }
  
 -/* return the max magnitude from the all/upper/lower bins */
 -static inline u8 spectral_max_index(u8 *bins, int num_bins)
 +/* return the max index from the all/upper/lower bins
 + *
 + * in HT20: 6-bit signed number of range -28 to +27
 + * in HT40: 6-bit unsigned number of range 0 to +63
 + *  (upper sub-channel index 0 is DC)
 + *
 + * Correct interpretation of the value has to be done at caller
 + */
 +static inline u8 spectral_max_index(u8 *bins)
  {
 - s8 m = (bins[2]  0xfc)  2;
 - u8 zero_idx = num_bins / 2;
 -
 - /* It's a 5 bit signed int, remove its sign and use one's
 -  * complement interpretation to add the sign back to the 8
 -  * bit int
 -  */
 - if (m  0x20) {
 - m = ~0x20;
 - m |= 0xe0;
 - }
 -
 - /* Bring the zero point to the beginning
 -  * instead 

Re: [PATCH] ath9k: spectral - simplify max_index calculation

2015-06-18 Thread Nick Kossifidis
2015-06-18 12:36 GMT+02:00 Zefir Kurtisi zefir.kurt...@neratec.com:
 On 06/18/2015 10:43 AM, Nick Kossifidis wrote:
 max_index is a 6bit signed integer in both cases (sorry for the 5bit
 typo in the comments), so the current function handles it correctly
 for both HT20 and dynamic HT20/40 modes (I've tested it extensively).
 Also you don't handle the negative indices we get from the hardware
 (you just remove the sign). Have you tested this and if you did on
 which hardware did you do the test ?

 2015-06-16 11:21 GMT+02:00 Zefir Kurtisi zefir.kurt...@neratec.com:
 [...]
 +/* return the max magnitude from the all/upper/lower bins
 + *
 + * in HT20: 6-bit signed number of range -28 to +27
 + * in HT40: 6-bit unsigned number of range 0 to +63
 + *  (upper sub-channel index 0 is DC)
 + *
 + * Correct interpretation of the value has to be done at caller
 + */

 The comment above is taken from developer NDA documents and should be correct.
 With that, in HT40 mode the max_index value has to be taken as is, while in 
 HT20
 it needs to be shifted to the unsigned range.


I have NDA documents as well stating that the indices are from -64 to
63 (-64 to -1, 1 to 63 and 0 is DC), you can check out for yourself
that we get 128bins on dynamic HT20/40, see the header files too:

#define SPECTRAL_HT20_40_NUM_BINS   128

and/or the received packet length. Maybe you are talking about
static HT40 (I don't see anything about that on the documents I
have) or something else.

 I used the proposed method with the chirp detector for FFTs provided for long
 radar pulses on an AR9590 (patch posted the same day). Max bin index is used 
 there
 the same way as with spectral, but now I realize my mistake: for chirp 
 detection,
 the relative max_index is sufficient, while for spectral the absolute value 
 is needed.

 Toggling the MSB in HT20 shifts the signed values by 32 and leaves the index 
 with
 an offset of 4, therefore the correct operation should be:
 ht20_max_index_absolute = (ht20_max_index ^ 0x20) - 4


Have in mind that on earlier chips (I did the testing on an AR9820) we
get corrupted frames sometimes so we also need the sanity check I put
there or else we can end up reading data out of bounds which is pretty
dangerous so please leave the current implementation there as is.


-- 
GPG ID: 0xEE878588
As you read this post global entropy rises. Have Fun ;-)
Nick
--
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: creating ap interface

2015-06-18 Thread Dan Williams
On Wed, 2015-06-17 at 20:38 +0200, Arend van Spriel wrote:
 Hi Dan,
 
 When I create an AP interface using iw, it is followed by a change 
 interface back to managed mode. I added a WARN_ON to see where it came 
 from and it turns out to be the NetworkManager. However, I had disabled 
 wifi as you suggested on the mailing list once. What is your take on 
 this: bug or intentional?

Which method was that to disable wifi?  Also, what NM version are you
running?

Dan

 Regards,
 Arend
 
 [195312.837736] brcmfmac: brcmf_cfg80211_add_iface enter: wl5ap type 3
 [195312.844033] brcmfmac: brcmf_ap_add_vif Adding vif wl5ap
 [195312.849525] brcmfmac: brcmf_alloc_vif allocating virtual interface 
 (size=3136)
 [195312.856842] brcmfmac: brcmf_fil_bsscfg_data_set ifidx=0, bssidx=0, 
 name=bsscfg:ssid, len=40
 [195312.865276] brcmutil: data
 [195312.868070] : 02 00 00 00 05 00 00 00 73 73 69 64 32 00 00 
 00  ssid2...
 [195312.876187] 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
 00  
 [195312.884301] 0020: 00 00 00 00 00 00 00 00 
 
 [195312.891725] brcmfmac: brcmf_sdio_bus_txctl Enter
 [195312.896466] brcmfmac: brcmf_sdio_dpc Enter
 [195312.900663] brcmfmac: brcmf_sdio_kso_control Enter: on=1
 [195312.910548] brcmfmac: brcmf_sdio_isr Enter
 [195312.914877] brcmfmac: brcmf_sdio_tx_ctrlframe Enter
 [195312.919943] brcmfmac: brcmf_sdio_dpc Enter
 [195312.920022] brcmfmac: brcmf_sdio_bus_rxctl Enter
 [195312.928967] brcmfmac: brcmf_sdio_isr Enter
 [195312.933282] brcmfmac: brcmf_sdio_dpc Dongle reports CHIPACTIVE
 [195312.939220] brcmfmac: brcmf_sdio_readframes Enter
 [195312.944099] brcmfmac: brcmf_sdio_read_control Enter
 [195312.949234] brcmfmac: brcmf_sdio_bus_rxctl resumed on rxctl frame, 
 got 68 expected 68
 [195312.949310] brcmfmac: brcmf_fweh_event_worker event IF (54) ifidx 1 
 bsscfg 2 addr 00:90:4c:70:43:54
 [195312.949312] brcmfmac: brcmf_fweh_event_worker   version 2 flags 0 
 status 0 reason 0
 [195312.949314] brcmutil: event payload, len=5
 [195312.949316] : 01 01 00 02 01 
 .
 [195312.949318] brcmfmac: brcmf_fweh_handle_if_event action: 1 idx: 1 
 bsscfg: 2 flags: 0 role: 1
 [195312.949320] brcmfmac: brcmf_fweh_handle_if_event adding wl0.2 
 (00:90:4c:70:43:54)
 [195312.949322] brcmfmac: brcmf_add_if Enter, idx=2, ifidx=1
 [195312.949323] brcmfmac: brcmf_add_if allocate netdev interface
 [195312.949333] brcmfmac: brcmf_add_if   pid:135f, if:wl0.2 
 (00:90:4c:70:43:54) created ===
 [195312.949336] brcmfmac: brcmf_fws_macdesc_init enter: desc 
 8800bb798b00 ea=00:90:4c:70:43:54, ifidx=1
 [195312.949338] brcmfmac: brcmf_fws_add_interface added MACIF:1
 [195312.949341] brcmfmac: brcmf_notify_vif_event Enter: action 1 flags 0 
 ifidx 1 bsscfg 2
 [195312.949403] brcmfmac: brcmf_sdio_dpc Enter
 [195312.970325] brcmfmac: brcmf_sdio_kso_control Enter: on=0
 [195313.054361] brcmfmac: brcmf_net_attach Enter, idx=2 
 mac=00:90:4c:70:43:54
 [195313.061537] brcmfmac: brcmf_netdev_get_stats Enter, idx=2
 [195313.067170] brcmfmac: brcmf_net_attach wl5ap: Broadcom Dongle Host 
 Driver
 [195313.074637] brcmfmac: brcmf_netdev_get_stats Enter, idx=0
 [195313.080149] brcmfmac: brcmf_netdev_get_stats Enter, idx=0
 [195313.085653] brcmfmac: brcmf_netdev_get_stats Enter, idx=2
 [195313.091877] brcmfmac: brcmf_netdev_get_stats Enter, idx=0
 [195313.097400] brcmfmac: brcmf_netdev_get_stats Enter, idx=0
 [195313.102934] brcmfmac: brcmf_netdev_get_stats Enter, idx=2
 [195313.108825] brcmfmac: brcmf_netdev_get_stats Enter, idx=0
 [195313.114322] brcmfmac: brcmf_netdev_get_stats Enter, idx=0
 [195313.119835] brcmfmac: brcmf_netdev_get_stats Enter, idx=2
 [195313.125593] brcmfmac: brcmf_netdev_get_stats Enter, idx=0
 [195313.131117] brcmfmac: brcmf_netdev_get_stats Enter, idx=0
 [195313.136610] brcmfmac: brcmf_netdev_get_stats Enter, idx=2
 [195313.142185] brcmfmac: brcmf_cfg80211_change_iface Enter, idx=2, type=2
 [195313.148804] [ cut here ]
 [195313.153520] WARNING: CPU: 1 PID: 1398 at 
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c:864 
 brcmf_cfg80211_change_iface+0x2a9/0x2d0 [brcmfmac]()
 [195313.166897] Modules linked in: brcmfmac(O) brcmutil(O) sdhci_pci 
 sdhci cfg80211 nfsv3 nfs_acl nf_conntrack_ipv4 nf_defrag_ipv4 
 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 iptable_mangle 
 xt_tcpudp ip6table_filter ip6_tables iptable_filter ip_tables 
 ebtable_nat ebtables x_tables autofs4 nfs bridge stp llc lockd grace 
 sunrpc fscache dell_wmi sparse_keymap snd_hda_codec_hdmi 
 snd_hda_codec_idt snd_hda_codec_generic dell_laptop pl2303 usbserial 
 nouveau dcdbas snd_hda_intel snd_hda_controller i8k snd_hda_codec 
 snd_hwdep snd_hda_core snd_pcm snd_seq_midi snd_seq_midi_event 
 snd_rawmidi snd_seq snd_seq_device coretemp crc32c_intel snd_timer 
 mxm_wmi intel_agp microcode serio_raw ttm drm_kms_helper intel_gtt 
 lpc_ich snd drm i2c_algo_bit intel_ips agpgart soundcore mfd_core video 
 mmc_block e1000e ptp 

Re: [PATCH] ath9k: spectral - simplify max_index calculation

2015-06-18 Thread Nick Kossifidis
2015-06-18 16:13 GMT+02:00 Nick Kossifidis mickfl...@gmail.com:
 2015-06-18 12:36 GMT+02:00 Zefir Kurtisi zefir.kurt...@neratec.com:
 On 06/18/2015 10:43 AM, Nick Kossifidis wrote:
 max_index is a 6bit signed integer in both cases (sorry for the 5bit
 typo in the comments), so the current function handles it correctly
 for both HT20 and dynamic HT20/40 modes (I've tested it extensively).
 Also you don't handle the negative indices we get from the hardware
 (you just remove the sign). Have you tested this and if you did on
 which hardware did you do the test ?

 2015-06-16 11:21 GMT+02:00 Zefir Kurtisi zefir.kurt...@neratec.com:
 [...]
 +/* return the max magnitude from the all/upper/lower bins
 + *
 + * in HT20: 6-bit signed number of range -28 to +27
 + * in HT40: 6-bit unsigned number of range 0 to +63
 + *  (upper sub-channel index 0 is DC)
 + *
 + * Correct interpretation of the value has to be done at caller
 + */

 The comment above is taken from developer NDA documents and should be 
 correct.
 With that, in HT40 mode the max_index value has to be taken as is, while in 
 HT20
 it needs to be shifted to the unsigned range.


 I have NDA documents as well stating that the indices are from -64 to
 63 (-64 to -1, 1 to 63 and 0 is DC), you can check out for yourself
 that we get 128bins on dynamic HT20/40, see the header files too:

 #define SPECTRAL_HT20_40_NUM_BINS   128

 and/or the received packet length. Maybe you are talking about
 static HT40 (I don't see anything about that on the documents I
 have) or something else.


To clarify this a bit: It's 0 - 63 for lower bins and 0 - 64 (not 63)
for upper bins and since we want an array index of 0 - 128 we add the
index of 0 to the upper max_idx (on the caller). You are right that
the current comment there is wrong (it even mentions 5bit ints) so
feel free to fix that but the code works as expected and it's much
more readable than doing ^ 0x20 - 4 on the caller (plus it handles
both signed and unsigned cases so no problem there).

 I used the proposed method with the chirp detector for FFTs provided for long
 radar pulses on an AR9590 (patch posted the same day). Max bin index is used 
 there
 the same way as with spectral, but now I realize my mistake: for chirp 
 detection,
 the relative max_index is sufficient, while for spectral the absolute value 
 is needed.

 Toggling the MSB in HT20 shifts the signed values by 32 and leaves the index 
 with
 an offset of 4, therefore the correct operation should be:
 ht20_max_index_absolute = (ht20_max_index ^ 0x20) - 4


 Have in mind that on earlier chips (I did the testing on an AR9820) we
 get corrupted frames sometimes so we also need the sanity check I put
 there or else we can end up reading data out of bounds which is pretty
 dangerous so please leave the current implementation there as is.


A bit more infos here:

On AR9280 there are various issues (check out spectral.c to get an
idea) but I guess they got fixed on later chips so you probably won't
see shifted indices etc on AR9590. However both the spectral scan
and your work on chirp detection should work on earlier chips too.
Unfortunately I can't test AR9280's radar detection code because I
have a USB card (so it's ath9k_htc) and there is no DFS support there
yet, but I suggest you test it on an older card to verify that you
won't get any corruption. The good thing is that because you get only
one report (if I remember correctly) in case of radar detection (so
not software triggered spectral scan) you can easily fix that in your
case by checking the packet's length (check out spectral.c  for
ath_cmn_copy_fft_frame). Since the format is pretty much the same
(only the magnitude calculation is different), maybe we could handle
the two cases with common code instead (and fix any corruption there).


-- 
GPG ID: 0xEE878588
As you read this post global entropy rises. Have Fun ;-)
Nick
--
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


[no subject]

2015-06-18 Thread Alexander Schnaidt
unsubscribe linux-wireless alex.schna...@googlemail.com
--
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: move fail_avg into mesh struct

2015-06-18 Thread Johannes Berg
From: Johannes Berg johannes.b...@intel.com

This value is only used in mesh, so move it into the new mesh
sub-struct of the station info.

Signed-off-by: Johannes Berg johannes.b...@intel.com
---
 net/mac80211/mesh_hwmp.c | 9 +
 net/mac80211/sta_info.h  | 7 ---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index be635341c802..d80e0a4c16cf 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -308,8 +308,9 @@ void ieee80211s_update_metric(struct ieee80211_local *local,
failed = !(txinfo-flags  IEEE80211_TX_STAT_ACK);
 
/* moving average, scaled to 100 */
-   sta-fail_avg = ((80 * sta-fail_avg + 5) / 100 + 20 * failed);
-   if (sta-fail_avg  95)
+   sta-mesh-fail_avg =
+   ((80 * sta-mesh-fail_avg + 5) / 100 + 20 * failed);
+   if (sta-mesh-fail_avg  95)
mesh_plink_broken(sta);
 }
 
@@ -325,7 +326,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local 
*local,
u32 tx_time, estimated_retx;
u64 result;
 
-   if (sta-fail_avg = 100)
+   if (sta-mesh-fail_avg = 100)
return MAX_METRIC;
 
sta_set_rate_info_tx(sta, sta-last_tx_rate, rinfo);
@@ -333,7 +334,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local 
*local,
if (WARN_ON(!rate))
return MAX_METRIC;
 
-   err = (sta-fail_avg  ARITH_SHIFT) / 100;
+   err = (sta-mesh-fail_avg  ARITH_SHIFT) / 100;
 
/* bitrate is in units of 100 Kbps, while we need rate in units of
 * 1Mbps. This will be corrected on tx_time computation.
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 4f4f32f08a90..013fa5ac36e2 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -291,6 +291,7 @@ struct ieee80211_fast_tx {
  * @nonpeer_pm: STA power save mode towards non-peer neighbors
  * @processed_beacon: set to true after peer rates and capabilities are
  * processed
+ * @fail_avg: moving percentage of failed MSDUs
  */
 struct mesh_sta {
struct timer_list plink_timer;
@@ -313,6 +314,9 @@ struct mesh_sta {
enum nl80211_mesh_power_mode local_pm;
enum nl80211_mesh_power_mode peer_pm;
enum nl80211_mesh_power_mode nonpeer_pm;
+
+   /* moving percentage of failed MSDUs */
+   unsigned int fail_avg;
 };
 
 /**
@@ -370,7 +374,6 @@ struct mesh_sta {
  * @tx_filtered_count: number of frames the hardware filtered for this STA
  * @tx_retry_failed: number of frames that failed retry
  * @tx_retry_count: total number of retries for frames to this STA
- * @fail_avg: moving percentage of failed MSDUs
  * @tx_packets: number of RX/TX MSDUs
  * @tx_bytes: number of bytes transmitted to this STA
  * @tid_seq: per-TID sequence numbers for sending to this STA
@@ -474,8 +477,6 @@ struct sta_info {
/* Updated from TX status path only, no locking requirements */
unsigned long tx_filtered_count;
unsigned long tx_retry_failed, tx_retry_count;
-   /* moving percentage of failed MSDUs */
-   unsigned int fail_avg;
 
struct u64_stats_sync status_sync;
u64 tx_msdu_retries[IEEE80211_NUM_TIDS + 1];
-- 
2.1.4

--
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] ath9k: spectral - simplify max_index calculation

2015-06-18 Thread Nick Kossifidis
2015-06-18 17:34 GMT+02:00 Nick Kossifidis mickfl...@gmail.com:
 2015-06-18 16:13 GMT+02:00 Nick Kossifidis mickfl...@gmail.com:
 2015-06-18 12:36 GMT+02:00 Zefir Kurtisi zefir.kurt...@neratec.com:
 On 06/18/2015 10:43 AM, Nick Kossifidis wrote:
 max_index is a 6bit signed integer in both cases (sorry for the 5bit
 typo in the comments), so the current function handles it correctly
 for both HT20 and dynamic HT20/40 modes (I've tested it extensively).
 Also you don't handle the negative indices we get from the hardware
 (you just remove the sign). Have you tested this and if you did on
 which hardware did you do the test ?

 2015-06-16 11:21 GMT+02:00 Zefir Kurtisi zefir.kurt...@neratec.com:
 [...]
 +/* return the max magnitude from the all/upper/lower bins
 + *
 + * in HT20: 6-bit signed number of range -28 to +27
 + * in HT40: 6-bit unsigned number of range 0 to +63
 + *  (upper sub-channel index 0 is DC)
 + *
 + * Correct interpretation of the value has to be done at caller
 + */

 The comment above is taken from developer NDA documents and should be 
 correct.
 With that, in HT40 mode the max_index value has to be taken as is, while in 
 HT20
 it needs to be shifted to the unsigned range.


 I have NDA documents as well stating that the indices are from -64 to
 63 (-64 to -1, 1 to 63 and 0 is DC), you can check out for yourself
 that we get 128bins on dynamic HT20/40, see the header files too:

 #define SPECTRAL_HT20_40_NUM_BINS   128

 and/or the received packet length. Maybe you are talking about
 static HT40 (I don't see anything about that on the documents I
 have) or something else.


 To clarify this a bit: It's 0 - 63 for lower bins and 0 - 64 (not 63)
 for upper bins and since we want an array index of 0 - 128 we add the
 index of 0 to the upper max_idx (on the caller). You are right that
 the current comment there is wrong (it even mentions 5bit ints) so
 feel free to fix that but the code works as expected and it's much
 more readable than doing ^ 0x20 - 4 on the caller (plus it handles
 both signed and unsigned cases so no problem there).


Arghh, I need to sleep asap :P

0 - 64 for lower bins and 0 - 63 for upper bins...




-- 
GPG ID: 0xEE878588
As you read this post global entropy rises. Have Fun ;-)
Nick
--
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] ath9k: spectral - simplify max_index calculation

2015-06-18 Thread Nick Kossifidis
2015-06-18 17:11 GMT+02:00 Zefir Kurtisi zefir.kurt...@neratec.com:
 On 06/18/2015 04:13 PM, Nick Kossifidis wrote:
 [...]
 I have NDA documents as well stating that the indices are from -64 to
 63 (-64 to -1, 1 to 63 and 0 is DC), you can check out for yourself
 that we get 128bins on dynamic HT20/40, see the header files too:

 #define SPECTRAL_HT20_40_NUM_BINS   128

 Right, there are 128 in total, combined from 2 individual 64-bin sets. That's 
 why
 you need to swap upper and lower when operating in HT40MINUS, since chip 
 always
 puts primary channel to lower bin set.

 and/or the received packet length. Maybe you are talking about
 static HT40 (I don't see anything about that on the documents I
 have) or something else.

 Yes, maybe different documents. Mine says that interpretation of upper/lower 
 bin
 values (max_magnitude, bitmap_weight, max_index) is the same in static and 
 dynamic
 modes - only the bin values differ.

 I used the proposed method with the chirp detector for FFTs provided for 
 long
 radar pulses on an AR9590 (patch posted the same day). Max bin index is 
 used there
 the same way as with spectral, but now I realize my mistake: for chirp 
 detection,
 the relative max_index is sufficient, while for spectral the absolute value 
 is needed.

 Toggling the MSB in HT20 shifts the signed values by 32 and leaves the 
 index with
 an offset of 4, therefore the correct operation should be:
 ht20_max_index_absolute = (ht20_max_index ^ 0x20) - 4


 Have in mind that on earlier chips (I did the testing on an AR9820) we
 get corrupted frames sometimes so we also need the sanity check I put
 there or else we can end up reading data out of bounds which is pretty
 dangerous so please leave the current implementation there as is.


 The sanity checks / fixes are done before you look at the bin attributes and,
 which therefore is not relevant for interpreting them.


Only the lower boundary is checked (in case we are missing a byte -and
we assume it's the first sample-), if we get a corrupted max_idx
that's higher than 64 or 128 and we don't do the check on
spectral_max_index, we 'll have issues when accessing the samples
array to do the magnitude verification.




-- 
GPG ID: 0xEE878588
As you read this post global entropy rises. Have Fun ;-)
Nick
--
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


[ANN] Support for a new Intel Wireless device: 8260 / 4165

2015-06-18 Thread Grumbach, Emmanuel
Intel just released the firmware for the new Wireless devices: 8260 and
4165.

As mentioned in iwlwifi's wiki page [1], these devices are supported
starting from kernel 4.1. The firmware is available on that same wiki
page [2]. It is also available on Intel wireless's clone of
linux-firmware.git [3].
A pull request to mainline will be sent shortly.

[1] - 
https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi#supported_devices
[2] - https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi#firmware
[3] - https://git.kernel.org/cgit/linux/kernel/git/iwlwifi/linux-firmware.git
N�r��yb�X��ǧv�^�)޺{.n�+{��*ޕ�,�{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj��!�i

pull request: add -13.ucode firmware for Intel Wireless

2015-06-18 Thread Grumbach, Emmanuel
Hi,

This is a pull request for a new version of the firmware for Intel
wireless devices. Note that with this new firmware, we are now adding
support for 3 new devices: 3165, 8260 and 4165.

I had sent a pull request a while ago, this one replaces the older one.
Since then, we have added bug fixes and we are now able to release
iwlwifi-8000C.ucode which support 8260 and 4165.

Please pull.

The following changes since commit 3161bfa479d5e9ed4f46b57df9bcecbbc4f8eb3c:

  linux-firmware: Update firmware patch for Intel Bluetooth 7260 (B3/B4) 
(2015-05-13 11:12:48 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/linux-firmware.git 
for-kyle

for you to fetch changes up to c6c4150eaaffef76d8e3a3be13c822f0e2cd4dc6:

  iwlwifi: add new -13 firmware for iwlmvm devices (2015-06-18 20:06:17 +0300)


Emmanuel Grumbach (1):
  iwlwifi: add new -13 firmware for iwlmvm devices

 LICENCE.iwlwifi_firmware |   2 +-
 WHENCE   |  15 +++
 iwlwifi-3160-13.ucode| Bin 0 - 688616 bytes
 iwlwifi-7260-13.ucode| Bin 0 - 786920 bytes
 iwlwifi-7265-13.ucode| Bin 0 - 885224 bytes
 iwlwifi-7265D-13.ucode   | Bin 0 - 1008692 bytes
 iwlwifi-8000C-13.ucode   | Bin 0 - 1745176 bytes
 7 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 iwlwifi-3160-13.ucode
 create mode 100644 iwlwifi-7260-13.ucode
 create mode 100644 iwlwifi-7265-13.ucode
 create mode 100644 iwlwifi-7265D-13.ucode
 create mode 100644 iwlwifi-8000C-13.ucode

diff --git a/LICENCE.iwlwifi_firmware b/LICENCE.iwlwifi_firmware
index b168a60..2f19654 100644
--- a/LICENCE.iwlwifi_firmware
+++ b/LICENCE.iwlwifi_firmware
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2014, Intel Corporation.
+Copyright (c) 2006-2015, Intel Corporation.
 All rights reserved.
 
 Redistribution.  Redistribution and use in binary form, without
diff --git a/WHENCE b/WHENCE
index 312bc88..b8c6472 100644
--- a/WHENCE
+++ b/WHENCE
@@ -834,6 +834,9 @@ Version: 23.15.10.0
 File: iwlwifi-7260-12.ucode
 Version: 25.17.12.0
 
+File: iwlwifi-7260-13.ucode
+Version: 25.30.13.0
+
 File: iwlwifi-3160-7.ucode
 Version: 22.1.7.0
 
@@ -849,6 +852,9 @@ Version: 23.15.10.0
 File: iwlwifi-3160-12.ucode
 Version: 25.17.12.0
 
+File: iwlwifi-3160-13.ucode
+Version: 25.30.13.0
+
 File: iwlwifi-7265-8.ucode
 Version: 22.24.8.0
 
@@ -861,12 +867,21 @@ Version: 23.15.10.0
 File: iwlwifi-7265-12.ucode
 Version: 25.17.12.0
 
+File: iwlwifi-7265-13.ucode
+Version: 25.30.13.0
+
 File: iwlwifi-7265D-10.ucode
 Version: 23.15.10.0
 
 File: iwlwifi-7265D-12.ucode
 Version: 25.17.12.0
 
+File: iwlwifi-7265D-13.ucode
+Version: 25.30.13.0
+
+File: iwlwifi-8000C-13.ucode
+Version: 25.30.13.0
+
 Licence: Redistributable. See LICENCE.iwlwifi_firmware for details
 
 Also available from 
http://wireless.kernel.org/en/users/Drivers/iwlwifi#Firmware
diff --git a/iwlwifi-3160-13.ucode b/iwlwifi-3160-13.ucode
new file mode 100644
index 000..dd05ded
Binary files /dev/null and b/iwlwifi-3160-13.ucode differ
diff --git a/iwlwifi-7260-13.ucode b/iwlwifi-7260-13.ucode
new file mode 100644
index 000..06e3b7a
Binary files /dev/null and b/iwlwifi-7260-13.ucode differ
diff --git a/iwlwifi-7265-13.ucode b/iwlwifi-7265-13.ucode
new file mode 100644
index 000..d093495
Binary files /dev/null and b/iwlwifi-7265-13.ucode differ
diff --git a/iwlwifi-7265D-13.ucode b/iwlwifi-7265D-13.ucode
new file mode 100644
index 000..4bf6994
Binary files /dev/null and b/iwlwifi-7265D-13.ucode differ
diff --git a/iwlwifi-8000C-13.ucode b/iwlwifi-8000C-13.ucode
new file mode 100644
index 000..df97f12
Binary files /dev/null and b/iwlwifi-8000C-13.ucode differ



signature.asc
Description: This is a digitally signed message part


Re: brcmfmac: Failed to create interface p2p-dev-p2p0: -28 (No space left on device)

2015-06-18 Thread Jörg Krause
On Do, 2015-06-18 at 10:27 +0200, Arend van Spriel wrote:
 On 06/18/15 08:13, Jörg Krause wrote:
  Hi Arend,
  
  On Di, 2015-06-16 at 16:26 +0200, Arend van Spriel wrote:
   On 06/16/15 11:59, Jörg Krause wrote:
Hi Arend,

as I wrote in my previous mail (brcmfmac: 
brcmf_p2p_create_p2pdev:
timeout occurred) I get a p2p0 interface when loading the 
brcmfmac
module with p2pon=1 (Linux kernel 4.0.5, BCM43362).

Unfortunatly, if I try to use the p2p0 interface with
wpa_supplicant
2.4 I get an error:

  Failed to create interface p2p-dev-p2p0: -28 (No space 
left on
  device)
  nl80211: Failed to create a P2P Device interface p2p-dev
-p2p0
  P2P: Failed to enable P2P Device interface
   
   Using p2pon=1 is old-school p2p, ie. it creates a regular netdev 
   for
   doing p2p management stuff. Problem is that brcmfmac also 
   indicates
   p2p
   device support. We can remove p2pon parameter or not indicate p2p 
   dev
   
   support when p2pon=1.
  
  I used p2pon because the p2p0 interface is not created without it. 
  It
  fails with the error message brcmf_p2p_create_p2pdev: timeout
  occurred as written in my previous mails. I would prefer not to 
  use
  it, so maybe we can find a solution how to get it working without 
  it.
 
 43362 firmware may have issues with regular p2p dev support so let's 
 stick with p2pon for now.

Okay.

   
   Can you patch brcmfmac and give it a try. Need to start
   wpa_supplicant
   for two interface and if I recall correctly p2p0 must be 
   specified
   first.
  
  Can you give me a hint where to patch brcmfmac. Many thanks!
 
 Attached is patch against 4.0.5 kernel.

I applied the patch and if I load brcmfmac with p2pon=1 I get a kernel
warning and _no_ wlan0 and p2p0 interfaces:

[7.577223] [ cut here ]
[7.583144] WARNING: CPU: 0 PID: 4 at net/wireless/core.c:527
wiphy_register+0x3a4/0x67c()
[7.594652] Modules linked in: brcmfmac brcmutil
[7.601507] CPU: 0 PID: 4 Comm: kworker/0:0 Not tainted 4.0.5
-LINTECH #3
[7.610809] Hardware name: Freescale MXS (Device Tree)
[7.617411] Workqueue: events request_firmware_work_func
[7.625110] [c000dec8] (unwind_backtrace) from [c000c25c]
(show_stack+0x10/0x14)
[7.635541] [c000c25c] (show_stack) from [c001613c]
(warn_slowpath_common+0x78/0xb0)
[7.645171] [c001613c] (warn_slowpath_common) from
[c0016210] (warn_slowpath_null+0x1c/0x24)
[7.656635] [c0016210] (warn_slowpath_null) from [c03b6f20]
(wiphy_register+0x3a4/0x67c)
[7.57] [c03b6f20] (wiphy_register) from [bf00de20]
(brcmf_cfg80211_attach+0x86c/0x1124 [brcmfmac])
[7.679412] [bf00de20] (brcmf_cfg80211_attach [brcmfmac]) from
[bf018f3c] (brcmf_bus_start+0xac/0x29c [brcmfmac])
[7.690925] [bf018f3c] (brcmf_bus_start [brcmfmac]) from
[bf01dd00] (brcmf_sdio_firmware_callback+0x3d8/0x9e8 [brcmfmac])
[7.705622] [bf01dd00] (brcmf_sdio_firmware_callback
[brcmfmac]) from [bf0195fc]
(brcmf_fw_request_nvram_done+0x134/0x1d0 [brcmfmac])
[7.718916] [bf0195fc] (brcmf_fw_request_nvram_done
[brcmfmac]) from [c020ab88]
(request_firmware_work_func+0x30/0x50)
[7.733292] [c020ab88] (request_firmware_work_func) from
[c0029a98] (process_one_work+0x184/0x418)
[7.744112] [c0029a98] (process_one_work) from [c002a694]
(worker_thread+0x3c/0x464)
[7.754977] [c002a694] (worker_thread) from [c002e130]
(kthread+0xc0/0xdc)
[7.763730] [c002e130] (kthread) from [c0009730]
(ret_from_fork+0x14/0x24)
[7.773568] ---[ end trace 39ec555e61fc038e ]---
[7.779710] brcmfmac: brcmf_cfg80211_attach: Could not register
wiphy device (-22)
[7.790013] brcmfmac: brcmf_bus_start: failed: -12
[7.800278] brcmfmac: brcmf_sdio_firmware_callback: dongle is
not responding

Best regards
Jörg Krause
--
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 01/10] ath10k: Add a table to store hw specific values

2015-06-18 Thread Vasanthakumar Thiagarajan
This is to prepare ath10k to support newer chip set.
Values like CE_COUNT, MSI_ASSIGN_CE_MAX and
RTC_STATE_V_ON can be different for different
chips.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c |  2 ++
 drivers/net/wireless/ath/ath10k/core.h |  1 +
 drivers/net/wireless/ath/ath10k/hw.c   | 14 ++
 drivers/net/wireless/ath/ath10k/hw.h   | 18 +++---
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index f5db432..b17541b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1514,9 +1514,11 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
switch (hw_rev) {
case ATH10K_HW_QCA988X:
ar-regs = qca988x_regs;
+   ar-hw_values = qca988x_values;
break;
case ATH10K_HW_QCA6174:
ar-regs = qca6174_regs;
+   ar-hw_values = qca6174_values;
break;
default:
ath10k_err(ar, unsupported core hardware revision %d\n,
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index e9f9304..993cd36 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -560,6 +560,7 @@ struct ath10k {
struct completion target_suspend;
 
const struct ath10k_hw_regs *regs;
+   const struct ath10k_hw_values *hw_values;
struct ath10k_bmi bmi;
struct ath10k_wmi wmi;
struct ath10k_htc htc;
diff --git a/drivers/net/wireless/ath/ath10k/hw.c 
b/drivers/net/wireless/ath/ath10k/hw.c
index 5997f00..48bcd2c 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -58,6 +58,20 @@ const struct ath10k_hw_regs qca6174_regs = {
.scratch_3_address  = 0x0028,
 };
 
+const struct ath10k_hw_values qca988x_values = {
+   .rtc_state_val_on   = 3,
+   .ce_count   = 8,
+   .msi_assign_ce_max  = 7,
+   .num_target_ce_config_wlan  = 7,
+};
+
+const struct ath10k_hw_values qca6174_values = {
+   .rtc_state_val_on   = 3,
+   .ce_count   = 8,
+   .msi_assign_ce_max  = 7,
+   .num_target_ce_config_wlan  = 7,
+};
+
 void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev)
 {
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 85cca29..b218388 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -169,6 +169,16 @@ struct ath10k_hw_regs {
 extern const struct ath10k_hw_regs qca988x_regs;
 extern const struct ath10k_hw_regs qca6174_regs;
 
+struct ath10k_hw_values {
+   u32 rtc_state_val_on;
+   u8 ce_count;
+   u8 msi_assign_ce_max;
+   u8 num_target_ce_config_wlan;
+};
+
+extern const struct ath10k_hw_values qca988x_values;
+extern const struct ath10k_hw_values qca6174_values;
+
 void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev);
 
@@ -310,8 +320,10 @@ enum ath10k_hw_rate_cck {
 #define TARGET_TLV_NUM_MSDU_DESC   (1024 + 32)
 #define TARGET_TLV_NUM_WOW_PATTERNS22
 
+#define NUM_TARGET_CE_CONFIG_WLAN ar-hw_values-num_target_ce_config_wlan
+
 /* Number of Copy Engines supported */
-#define CE_COUNT 8
+#define CE_COUNT ar-hw_values-ce_count
 
 /*
  * Total number of PCIe MSI interrupts requested for all interrupt sources.
@@ -335,10 +347,10 @@ enum ath10k_hw_rate_cck {
 
 /* MSIs for Copy Engines */
 #define MSI_ASSIGN_CE_INITIAL  1
-#define MSI_ASSIGN_CE_MAX  7
+#define MSI_ASSIGN_CE_MAX  ar-hw_values-msi_assign_ce_max
 
 /* as of IP3.7.1 */
-#define RTC_STATE_V_ON 3
+#define RTC_STATE_V_ON ar-hw_values-rtc_state_val_on
 
 #define RTC_STATE_COLD_RESET_MASK  
ar-regs-rtc_state_cold_reset_mask
 #define RTC_STATE_V_LSB0
-- 
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 V2 02/10] ath10k: Add new reg_address/mask to hw register table

2015-06-18 Thread Vasanthakumar Thiagarajan
Add more register address and mask which can be different
for newer chip to hw_reg table.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/ce.h |  6 --
 drivers/net/wireless/ath/ath10k/hw.c | 22 ++
 drivers/net/wireless/ath/ath10k/hw.h | 17 -
 3 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.h 
b/drivers/net/wireless/ath/ath10k/ce.h
index 0eddb20..93939de 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -423,8 +423,10 @@ static inline u32 ath10k_ce_base_address(struct ath10k 
*ar, unsigned int ce_id)
 
 #define CE_RING_IDX_INCR(nentries_mask, idx) (((idx) + 1)  (nentries_mask))
 
-#define CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_LSB  8
-#define CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_MASK 0xff00
+#define CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_LSB \
+   ar-regs-ce_wrap_intr_sum_host_msi_lsb
+#define CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_MASK \
+   ar-regs-ce_wrap_intr_sum_host_msi_mask
 #define CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_GET(x) \
(((x)  CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_MASK)  \
CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_LSB)
diff --git a/drivers/net/wireless/ath/ath10k/hw.c 
b/drivers/net/wireless/ath/ath10k/hw.c
index 48bcd2c..cb09867 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -34,8 +34,15 @@ const struct ath10k_hw_regs qca988x_regs = {
.ce7_base_address   = 0x00059000,
.soc_reset_control_si0_rst_mask = 0x0001,
.soc_reset_control_ce_rst_mask  = 0x0004,
-   .soc_chip_id_address= 0x00ec,
-   .scratch_3_address  = 0x0030,
+   .soc_chip_id_address= 0x00ec,
+   .scratch_3_address  = 0x0030,
+   .fw_indicator_address   = 0x9030,
+   .pcie_local_base_address= 0x0008,
+   .ce_wrap_intr_sum_host_msi_lsb  = 0x0008,
+   .ce_wrap_intr_sum_host_msi_mask = 0xff00,
+   .pcie_intr_fw_mask  = 0x0400,
+   .pcie_intr_ce_mask_all  = 0x0007f800,
+   .pcie_intr_clr_address  = 0x0014,
 };
 
 const struct ath10k_hw_regs qca6174_regs = {
@@ -54,8 +61,15 @@ const struct ath10k_hw_regs qca6174_regs = {
.ce7_base_address   = 0x00036000,
.soc_reset_control_si0_rst_mask = 0x,
.soc_reset_control_ce_rst_mask  = 0x0001,
-   .soc_chip_id_address= 0x000f0,
-   .scratch_3_address  = 0x0028,
+   .soc_chip_id_address= 0x00f0,
+   .scratch_3_address  = 0x0028,
+   .fw_indicator_address   = 0x9028,
+   .pcie_local_base_address= 0x0008,
+   .ce_wrap_intr_sum_host_msi_lsb  = 0x0008,
+   .ce_wrap_intr_sum_host_msi_mask = 0xff00,
+   .pcie_intr_fw_mask  = 0x0400,
+   .pcie_intr_ce_mask_all  = 0x0007f800,
+   .pcie_intr_clr_address  = 0x0014,
 };
 
 const struct ath10k_hw_values qca988x_values = {
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index b218388..5d04317 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -164,6 +164,13 @@ struct ath10k_hw_regs {
u32 soc_reset_control_ce_rst_mask;
u32 soc_chip_id_address;
u32 scratch_3_address;
+   u32 fw_indicator_address;
+   u32 pcie_local_base_address;
+   u32 ce_wrap_intr_sum_host_msi_lsb;
+   u32 ce_wrap_intr_sum_host_msi_mask;
+   u32 pcie_intr_fw_mask;
+   u32 pcie_intr_ce_mask_all;
+   u32 pcie_intr_clr_address;
 };
 
 extern const struct ath10k_hw_regs qca988x_regs;
@@ -386,7 +393,7 @@ enum ath10k_hw_rate_cck {
 #define CE7_BASE_ADDRESS   ar-regs-ce7_base_address
 #define DBI_BASE_ADDRESS   0x0006
 #define WLAN_ANALOG_INTF_PCIE_BASE_ADDRESS 0x0006c000
-#define PCIE_LOCAL_BASE_ADDRESS0x0008
+#define PCIE_LOCAL_BASE_ADDRESS
ar-regs-pcie_local_base_address
 
 #define SOC_RESET_CONTROL_ADDRESS  0x
 #define SOC_RESET_CONTROL_OFFSET   0x
@@ -460,7 +467,7 @@ enum ath10k_hw_rate_cck {
 #define CORE_CTRL_ADDRESS  0x
 #define PCIE_INTR_ENABLE_ADDRESS   0x0008
 #define PCIE_INTR_CAUSE_ADDRESS0x000c
-#define PCIE_INTR_CLR_ADDRESS  0x0014
+#define PCIE_INTR_CLR_ADDRESS  ar-regs-pcie_intr_clr_address
 #define SCRATCH_3_ADDRESS  

[PATCH V2 06/10] ath10k: Add chip reset sequence for QCA99X0

2015-06-18 Thread Vasanthakumar Thiagarajan
QCA99X0 supports only cold reset. Also, made
ath10k_pci_irq_msi_fw_mask() and ath10k_pci_irq_msi_fw_unmask()
non-99X0 specific till we get proper register configuration
to mask/unmask irq/MSI.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/pci.c | 81 ++-
 1 file changed, 71 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index df7d74e..1b4634a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -82,7 +82,7 @@ static const struct ath10k_pci_supp_chip 
ath10k_pci_supp_chips[] = {
 
 static void ath10k_pci_buffer_cleanup(struct ath10k *ar);
 static int ath10k_pci_cold_reset(struct ath10k *ar);
-static int ath10k_pci_warm_reset(struct ath10k *ar);
+static int ath10k_pci_safe_chip_reset(struct ath10k *ar);
 static int ath10k_pci_wait_for_target_init(struct ath10k *ar);
 static int ath10k_pci_init_irq(struct ath10k *ar);
 static int ath10k_pci_deinit_irq(struct ath10k *ar);
@@ -91,6 +91,7 @@ static void ath10k_pci_free_irq(struct ath10k *ar);
 static int ath10k_pci_bmi_wait(struct ath10k_ce_pipe *tx_pipe,
   struct ath10k_ce_pipe *rx_pipe,
   struct bmi_xfer *xfer);
+static int ath10k_pci_qca99x0_chip_reset(struct ath10k *ar);
 
 static const struct ce_attr host_ce_config_wlan[] = {
/* CE0: host-target HTC control and raw streams */
@@ -1427,20 +1428,42 @@ static void ath10k_pci_irq_msi_fw_mask(struct ath10k 
*ar)
 {
u32 val;
 
-   val = ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS + CORE_CTRL_ADDRESS);
-   val = ~CORE_CTRL_PCIE_REG_31_MASK;
-
-   ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS + CORE_CTRL_ADDRESS, val);
+   switch (ar-hw_rev) {
+   case ATH10K_HW_QCA988X:
+   case ATH10K_HW_QCA6174:
+   val = ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
+   CORE_CTRL_ADDRESS);
+   val = ~CORE_CTRL_PCIE_REG_31_MASK;
+   ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS +
+  CORE_CTRL_ADDRESS, val);
+   break;
+   case ATH10K_HW_QCA99X0:
+   /* TODO: Find appropriate register configuration for QCA99X0
+*  to mask irq/MSI.
+*/
+break;
+   }
 }
 
 static void ath10k_pci_irq_msi_fw_unmask(struct ath10k *ar)
 {
u32 val;
 
-   val = ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS + CORE_CTRL_ADDRESS);
-   val |= CORE_CTRL_PCIE_REG_31_MASK;
-
-   ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS + CORE_CTRL_ADDRESS, val);
+   switch (ar-hw_rev) {
+   case ATH10K_HW_QCA988X:
+   case ATH10K_HW_QCA6174:
+   val = ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
+   CORE_CTRL_ADDRESS);
+   val |= CORE_CTRL_PCIE_REG_31_MASK;
+   ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS +
+  CORE_CTRL_ADDRESS, val);
+   break;
+   case ATH10K_HW_QCA99X0:
+   /* TODO: Find appropriate register configuration for QCA99X0
+*  to unmask irq/MSI.
+*/
+   break;
+   }
 }
 
 static void ath10k_pci_irq_disable(struct ath10k *ar)
@@ -1602,7 +1625,7 @@ static void ath10k_pci_hif_stop(struct ath10k *ar)
 * masked. To prevent the device from asserting the interrupt reset it
 * before proceeding with cleanup.
 */
-   ath10k_pci_warm_reset(ar);
+   ath10k_pci_safe_chip_reset(ar);
 
ath10k_pci_irq_disable(ar);
ath10k_pci_irq_sync(ar);
@@ -2114,6 +2137,18 @@ static int ath10k_pci_warm_reset(struct ath10k *ar)
return 0;
 }
 
+static int ath10k_pci_safe_chip_reset(struct ath10k *ar)
+{
+   if (QCA_REV_988X(ar) || QCA_REV_6174(ar)) {
+   return ath10k_pci_warm_reset(ar);
+   } else if (QCA_REV_99X0(ar)) {
+   ath10k_pci_irq_disable(ar);
+   return ath10k_pci_qca99x0_chip_reset(ar);
+   } else {
+   return -ENOTSUPP;
+   }
+}
+
 static int ath10k_pci_qca988x_chip_reset(struct ath10k *ar)
 {
int i, ret;
@@ -2220,12 +2255,38 @@ static int ath10k_pci_qca6174_chip_reset(struct ath10k 
*ar)
return 0;
 }
 
+static int ath10k_pci_qca99x0_chip_reset(struct ath10k *ar)
+{
+   int ret;
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, boot qca99x0 chip reset\n);
+
+   ret = ath10k_pci_cold_reset(ar);
+   if (ret) {
+   ath10k_warn(ar, failed to cold reset: %d\n, ret);
+   return ret;
+   }
+
+   ret = ath10k_pci_wait_for_target_init(ar);
+   if (ret) {
+   ath10k_warn(ar, failed to wait for target after cold reset: 
%d\n,
+   ret);
+   return ret;
+   }
+
+   

Re: [PATCH 00/10] Add QCA99X0 support

2015-06-18 Thread Vasanthakumar Thiagarajan
On Thu, Jun 18, 2015 at 09:20:51AM +0300, Kalle Valo wrote:
 Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com writes:
 
  This patch set adds changes for QCA99X0 chip in pci probe,
  Copy Engine init and firmware downloads. Since it is still
  work in progress the support for this chip is not yet
  advertised in pci device table.
 
  Vasanthakumar Thiagarajan (10):
ath10k: Add a table to store hw specific values
ath10k: Add new reg_address/mask to hw register table
ath10k: Add hw register/values for QCA99X0 chip
ath10k: Copy Engine related changes for QCA99X0
ath10k: Make target cpu address to CE address conversion chip specific
ath10k: Add chip reset sequence for QCA99X0
ath10k: Extend CE src desc flags for interrupt indication
ath10k: Fix BMI communication timeout for QCA99X0
ath10k: Add support for code swap
ath10k: Add BMI param value to execute otp to hw_param
 
 These patches don't apply and don't have proper sha1 ids. Please rebase.
 And remember always to use ath.git master branch as the baseline, don't
 apply any custom patches because that will break 3-way merge.
 
 Applying: ath10k: Add a table to store hw specific values
 Applying: ath10k: Add new reg_address/mask to hw register table
 Applying: ath10k: Add hw register/values for QCA99X0 chip
 fatal: sha1 information is lacking or useless 
 (drivers/net/wireless/ath/ath10k/core.c).
 Repository lacks necessary blobs to fall back on 3-way merge.
 Cannot fall back to three-way merge.
 Patch failed at 0003 ath10k: Add hw register/values for QCA99X0 chip

Sorry about this. Im sending the rebased patches on top of ath.git master tot

Vasanth
--
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 05/10] ath10k: Make target cpu address to CE address conversion chip specific

2015-06-18 Thread Vasanthakumar Thiagarajan
Make the helper converting target virtual address space to CE address
space a target type specific to support QCA99X0. Also make this as
function instead of macro.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/pci.c | 25 ++---
 drivers/net/wireless/ath/ath10k/pci.h | 12 
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index c2aecfe..df7d74e 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -755,6 +755,26 @@ static void ath10k_pci_rx_replenish_retry(unsigned long 
ptr)
ath10k_pci_rx_post(ar);
 }
 
+static u32 ath10k_pci_targ_cpu_to_ce_addr(struct ath10k *ar, u32 addr)
+{
+   u32 val = 0;
+
+   switch (ar-hw_rev) {
+   case ATH10K_HW_QCA988X:
+   case ATH10K_HW_QCA6174:
+   val = (ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
+ CORE_CTRL_ADDRESS) 
+  0x7fff)  21;
+   break;
+   case ATH10K_HW_QCA99X0:
+   val = ath10k_pci_read32(ar, PCIE_BAR_REG_ADDRESS);
+   break;
+   }
+
+   val |= 0x10 | (addr  0xf);
+   return val;
+}
+
 /*
  * Diagnostic read/write access is provided for startup/config/debug usage.
  * Caller must guarantee proper alignment, when applicable, and single user
@@ -817,8 +837,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 
address, void *data,
 * convert it from Target CPU virtual address space
 * to CE address space
 */
-   address = TARG_CPU_SPACE_TO_CE_SPACE(ar, ar_pci-mem,
-address);
+   address = ath10k_pci_targ_cpu_to_ce_addr(ar, address);
 
ret = ath10k_ce_send_nolock(ce_diag, NULL, (u32)address, 
nbytes, 0,
0);
@@ -976,7 +995,7 @@ static int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 
address,
 * to
 *CE address space
 */
-   address = TARG_CPU_SPACE_TO_CE_SPACE(ar, ar_pci-mem, address);
+   address = ath10k_pci_targ_cpu_to_ce_addr(ar, address);
 
remaining_bytes = orig_nbytes;
ce_data = ce_data_base;
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index eea0a01..8d364fb 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -237,18 +237,6 @@ static inline struct ath10k_pci *ath10k_pci_priv(struct 
ath10k *ar)
 #define CDC_WAR_MAGIC_STR   0xceef
 #define CDC_WAR_DATA_CE 4
 
-/*
- * TODO: Should be a function call specific to each Target-type.
- * This convoluted macro converts from Target CPU Virtual Address Space to CE
- * Address Space. As part of this process, we conservatively fetch the current
- * PCIE_BAR. MOST of the time, this should match the upper bits of PCI space
- * for this device; but that's not guaranteed.
- */
-#define TARG_CPU_SPACE_TO_CE_SPACE(ar, pci_addr, addr) \
-   (((ath10k_pci_read32(ar, (SOC_CORE_BASE_ADDRESS |   \
- CORE_CTRL_ADDRESS))  0x7ff)  21) | \
-0x10 | ((addr)  0xf))
-
 /* Wait up to this many Ms for a Diagnostic Access CE operation to complete */
 #define DIAG_ACCESS_CE_TIMEOUT_MS 10
 
-- 
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 V2 03/10] ath10k: Add hw register/values for QCA99X0 chip

2015-06-18 Thread Vasanthakumar Thiagarajan
This is to prepare the driver for QCA99X0 chip support.
This commit adds hw_params, hw register table and hw_values
table for QCA99X0 chip. Please note this is only a partial patch adding
support for QCA99X0, so the device id is not yet added to pci device
table.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c  | 18 
 drivers/net/wireless/ath/ath10k/hw.c| 44 +
 drivers/net/wireless/ath/ath10k/hw.h| 18 
 drivers/net/wireless/ath/ath10k/pci.c   |  5 
 drivers/net/wireless/ath/ath10k/targaddrs.h |  3 ++
 5 files changed, 88 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index b17541b..f239e96 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -101,6 +101,20 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.board_ext_size = QCA6174_BOARD_EXT_DATA_SZ,
},
},
+   {
+   .id = QCA99X0_HW_2_0_DEV_VERSION,
+   .name = qca99x0 hw2.0,
+   .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
+   .uart_pin = 7,
+   .fw = {
+   .dir = QCA99X0_HW_2_0_FW_DIR,
+   .fw = QCA99X0_HW_2_0_FW_FILE,
+   .otp = QCA99X0_HW_2_0_OTP_FILE,
+   .board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
+   .board_size = QCA99X0_BOARD_DATA_SZ,
+   .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
+   },
+   },
 };
 
 static const char *const ath10k_core_fw_feature_str[] = {
@@ -1520,6 +1534,10 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
ar-regs = qca6174_regs;
ar-hw_values = qca6174_values;
break;
+   case ATH10K_HW_QCA99X0:
+   ar-regs = qca99x0_regs;
+   ar-hw_values = qca99x0_values;
+   break;
default:
ath10k_err(ar, unsupported core hardware revision %d\n,
   hw_rev);
diff --git a/drivers/net/wireless/ath/ath10k/hw.c 
b/drivers/net/wireless/ath/ath10k/hw.c
index cb09867..e5fe33d9 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -72,6 +72,43 @@ const struct ath10k_hw_regs qca6174_regs = {
.pcie_intr_clr_address  = 0x0014,
 };
 
+const struct ath10k_hw_regs qca99x0_regs = {
+   .rtc_state_cold_reset_mask  = 0x0400,
+   .rtc_soc_base_address   = 0x0008,
+   .rtc_wmac_base_address  = 0x,
+   .soc_core_base_address  = 0x00082000,
+   .ce_wrapper_base_address= 0x0004d000,
+   .ce0_base_address   = 0x0004a000,
+   .ce1_base_address   = 0x0004a400,
+   .ce2_base_address   = 0x0004a800,
+   .ce3_base_address   = 0x0004ac00,
+   .ce4_base_address   = 0x0004b000,
+   .ce5_base_address   = 0x0004b400,
+   .ce6_base_address   = 0x0004b800,
+   .ce7_base_address   = 0x0004bc00,
+   /* Note: qca99x0 supports upto 12 Copy Engines. Other than address of
+* CE0 and CE1 no other copy engine is directly referred in the code.
+* It is not really neccessary to assign address for newly supported
+* CEs in this address table.
+*  Copy Engine Address
+*  CE8 0x0004c000
+*  CE9 0x0004c400
+*  CE100x0004c800
+*  CE110x0004cc00
+*/
+   .soc_reset_control_si0_rst_mask = 0x0001,
+   .soc_reset_control_ce_rst_mask  = 0x0100,
+   .soc_chip_id_address= 0x00ec,
+   .scratch_3_address  = 0x00040050,
+   .fw_indicator_address   = 0x00040050,
+   .pcie_local_base_address= 0x,
+   .ce_wrap_intr_sum_host_msi_lsb  = 0x000c,
+   .ce_wrap_intr_sum_host_msi_mask = 0x00fff000,
+   .pcie_intr_fw_mask  = 0x0010,
+   .pcie_intr_ce_mask_all  = 0x000fff00,
+   .pcie_intr_clr_address  = 0x0010,
+};
+
 const struct ath10k_hw_values qca988x_values = {
.rtc_state_val_on   = 3,
.ce_count   = 8,
@@ -86,6 +123,13 @@ const struct ath10k_hw_values qca6174_values = {
.num_target_ce_config_wlan  = 7,
 };
 
+const struct ath10k_hw_values qca99x0_values = {
+   .rtc_state_val_on   

[PATCH V2 04/10] ath10k: Copy Engine related changes for QCA99X0

2015-06-18 Thread Vasanthakumar Thiagarajan
QCA99X0 supports upto 12 Copy engines. Host and target
CE configuration table is updated to support new copy engine
pipes. This also fixes the assumption of diagnostic CE by making
CE_7 as the one instead of CE_COUNT - 1.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/ce.h  |  2 +-
 drivers/net/wireless/ath/ath10k/hw.h  |  3 ++
 drivers/net/wireless/ath/ath10k/pci.c | 69 ++-
 3 files changed, 71 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.h 
b/drivers/net/wireless/ath/ath10k/ce.h
index 93939de..bb4b8f3 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -21,7 +21,7 @@
 #include hif.h
 
 /* Maximum number of Copy Engine's supported */
-#define CE_COUNT_MAX 8
+#define CE_COUNT_MAX 12
 #define CE_HTT_H2T_MSG_SRC_NENTRIES 4096
 
 /* Descriptor rings must be aligned to this boundary */
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 76caeab..5819659 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -343,6 +343,9 @@ enum ath10k_hw_rate_cck {
 #define TARGET_TLV_NUM_MSDU_DESC   (1024 + 32)
 #define TARGET_TLV_NUM_WOW_PATTERNS22
 
+/* Diagnostic Window */
+#define CE_DIAG_PIPE   7
+
 #define NUM_TARGET_CE_CONFIG_WLAN ar-hw_values-num_target_ce_config_wlan
 
 /* Number of Copy Engines supported */
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 0007e70..c2aecfe 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -156,6 +156,38 @@ static const struct ce_attr host_ce_config_wlan[] = {
.src_sz_max = DIAG_TRANSFER_LIMIT,
.dest_nentries = 2,
},
+
+   /* CE8: target-host pktlog */
+   {
+   .flags = CE_ATTR_FLAGS,
+   .src_nentries = 0,
+   .src_sz_max = 2048,
+   .dest_nentries = 128,
+   },
+
+   /* CE9 target autonomous qcache memcpy */
+   {
+   .flags = CE_ATTR_FLAGS,
+   .src_nentries = 0,
+   .src_sz_max = 0,
+   .dest_nentries = 0,
+   },
+
+   /* CE10: target autonomous hif memcpy */
+   {
+   .flags = CE_ATTR_FLAGS,
+   .src_nentries = 0,
+   .src_sz_max = 0,
+   .dest_nentries = 0,
+   },
+
+   /* CE11: target autonomous hif memcpy */
+   {
+   .flags = CE_ATTR_FLAGS,
+   .src_nentries = 0,
+   .src_sz_max = 0,
+   .dest_nentries = 0,
+   },
 };
 
 /* Target firmware's Copy Engine configuration. */
@@ -233,6 +265,38 @@ static const struct ce_pipe_config target_ce_config_wlan[] 
= {
},
 
/* CE7 used only by Host */
+   {
+   .pipenum = __cpu_to_le32(7),
+   .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
+   .nentries = __cpu_to_le32(0),
+   .nbytes_max = __cpu_to_le32(0),
+   .flags = __cpu_to_le32(0),
+   .reserved = __cpu_to_le32(0),
+   },
+
+   /* CE8 target-host packtlog */
+   {
+   .pipenum = __cpu_to_le32(8),
+   .pipedir = __cpu_to_le32(PIPEDIR_IN),
+   .nentries = __cpu_to_le32(64),
+   .nbytes_max = __cpu_to_le32(2048),
+   .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
+   .reserved = __cpu_to_le32(0),
+   },
+
+   /* CE9 target autonomous qcache memcpy */
+   {
+   .pipenum = __cpu_to_le32(9),
+   .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
+   .nentries = __cpu_to_le32(32),
+   .nbytes_max = __cpu_to_le32(2048),
+   .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
+   .reserved = __cpu_to_le32(0),
+   },
+
+   /* It not necessary to send target wlan configuration for CE10  CE11
+* as these CEs are not actively used in target.
+*/
 };
 
 /*
@@ -1771,7 +1835,8 @@ static int ath10k_pci_init_config(struct ath10k *ar)
 
ret = ath10k_pci_diag_write_mem(ar, pipe_cfg_targ_addr,
target_ce_config_wlan,
-   sizeof(target_ce_config_wlan));
+   sizeof(struct ce_pipe_config) *
+   NUM_TARGET_CE_CONFIG_WLAN);
 
if (ret != 0) {
ath10k_err(ar, Failed to write pipe cfg: %d\n, ret);
@@ -1885,7 +1950,7 @@ static int ath10k_pci_alloc_pipes(struct ath10k *ar)
}
 
/* Last CE is Diagnostic Window */
-   if (i == CE_COUNT - 1) {
+   if (i == CE_DIAG_PIPE) {
ar_pci-ce_diag = pipe-ce_hdl;
continue;
   

[PATCH V2 07/10] ath10k: Extend CE src desc flags for interrupt indication

2015-06-18 Thread Vasanthakumar Thiagarajan
QCA99X0 uses two new copy engine src desc flags for interrupt
indication. Bit_2 is to mark if host interrupt is disabled after
processing the current desc and bit_3 is to mark if target interrupt
is diabled after the processing of current descriptor.
CE_DESC_FLAGS_META_DATA_MASK and CE_DESC_FLAGS_META_DATA_LSB are based
on the target type.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/ce.c | 1 +
 drivers/net/wireless/ath/ath10k/ce.h | 9 +++--
 drivers/net/wireless/ath/ath10k/hw.c | 6 ++
 drivers/net/wireless/ath/ath10k/hw.h | 2 ++
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index e508c65..cf28fbe 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -452,6 +452,7 @@ int ath10k_ce_completed_recv_next_nolock(struct 
ath10k_ce_pipe *ce_state,
 {
struct ath10k_ce_ring *dest_ring = ce_state-dest_ring;
unsigned int nentries_mask = dest_ring-nentries_mask;
+   struct ath10k *ar = ce_state-ar;
unsigned int sw_index = dest_ring-sw_index;
 
struct ce_desc *base = dest_ring-base_addr_owner_space;
diff --git a/drivers/net/wireless/ath/ath10k/ce.h 
b/drivers/net/wireless/ath/ath10k/ce.h
index bb4b8f3..5c903e15 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -38,8 +38,13 @@ struct ath10k_ce_pipe;
 
 #define CE_DESC_FLAGS_GATHER (1  0)
 #define CE_DESC_FLAGS_BYTE_SWAP  (1  1)
-#define CE_DESC_FLAGS_META_DATA_MASK 0xFFFC
-#define CE_DESC_FLAGS_META_DATA_LSB  2
+
+/* Following desc flags are used in QCA99X0 */
+#define CE_DESC_FLAGS_HOST_INT_DIS (1  2)
+#define CE_DESC_FLAGS_TGT_INT_DIS  (1  3)
+
+#define CE_DESC_FLAGS_META_DATA_MASK ar-hw_values-ce_desc_meta_data_mask
+#define CE_DESC_FLAGS_META_DATA_LSB  ar-hw_values-ce_desc_meta_data_lsb
 
 struct ce_desc {
__le32 addr;
diff --git a/drivers/net/wireless/ath/ath10k/hw.c 
b/drivers/net/wireless/ath/ath10k/hw.c
index e5fe33d9..1414e1f 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -114,6 +114,8 @@ const struct ath10k_hw_values qca988x_values = {
.ce_count   = 8,
.msi_assign_ce_max  = 7,
.num_target_ce_config_wlan  = 7,
+   .ce_desc_meta_data_mask = 0xFFFC,
+   .ce_desc_meta_data_lsb  = 2,
 };
 
 const struct ath10k_hw_values qca6174_values = {
@@ -121,6 +123,8 @@ const struct ath10k_hw_values qca6174_values = {
.ce_count   = 8,
.msi_assign_ce_max  = 7,
.num_target_ce_config_wlan  = 7,
+   .ce_desc_meta_data_mask = 0xFFFC,
+   .ce_desc_meta_data_lsb  = 2,
 };
 
 const struct ath10k_hw_values qca99x0_values = {
@@ -128,6 +132,8 @@ const struct ath10k_hw_values qca99x0_values = {
.ce_count   = 12,
.msi_assign_ce_max  = 12,
.num_target_ce_config_wlan  = 10,
+   .ce_desc_meta_data_mask = 0xFFF0,
+   .ce_desc_meta_data_lsb  = 4,
 };
 
 void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 5819659..35cd8ca 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -195,6 +195,8 @@ struct ath10k_hw_values {
u8 ce_count;
u8 msi_assign_ce_max;
u8 num_target_ce_config_wlan;
+   u16 ce_desc_meta_data_mask;
+   u8 ce_desc_meta_data_lsb;
 };
 
 extern const struct ath10k_hw_values qca988x_values;
-- 
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 V2 09/10] ath10k: Add support for code swap

2015-06-18 Thread Vasanthakumar Thiagarajan
Code swap is a mechanism to use host memory to store
some fw binary code segment. Ath10k host driver allocates
and loads the code swap binary into the host memory and
configures the target with the host allocated memory
information at the address taken from code swap binary.
This patch adds code swap support for firmware binary.
Code swap binary for firmware bin is available in
ATH10K_FW_IE_FW_CODE_SWAP_IMAGE.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/Makefile |   3 +-
 drivers/net/wireless/ath/ath10k/core.c   |  24 
 drivers/net/wireless/ath/ath10k/core.h   |   7 ++
 drivers/net/wireless/ath/ath10k/hw.h |   3 +
 drivers/net/wireless/ath/ath10k/swap.c   | 208 +++
 drivers/net/wireless/ath/ath10k/swap.h   |  72 +++
 6 files changed, 316 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/swap.c
 create mode 100644 drivers/net/wireless/ath/ath10k/swap.h

diff --git a/drivers/net/wireless/ath/ath10k/Makefile 
b/drivers/net/wireless/ath/ath10k/Makefile
index 9729e69..c04fb00 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -11,7 +11,8 @@ ath10k_core-y += mac.o \
 wmi-tlv.o \
 bmi.o \
 hw.o \
-p2p.o
+p2p.o \
+swap.o
 
 ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o
 ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index f239e96..c5f5d16 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -470,6 +470,13 @@ static int ath10k_download_fw(struct ath10k *ar, enum 
ath10k_firmware_mode mode)
data = ar-firmware_data;
data_len = ar-firmware_len;
mode_name = normal;
+   ret = ath10k_swap_code_seg_configure(ar,
+   ATH10K_SWAP_CODE_SEG_BIN_TYPE_FW);
+   if (ret) {
+   ath10k_err(ar, failed to configure fw code swap: %d\n,
+  ret);
+   return ret;
+   }
break;
case ATH10K_FIRMWARE_MODE_UTF:
data = ar-testmode.utf-data;
@@ -509,6 +516,8 @@ static void ath10k_core_free_firmware_files(struct ath10k 
*ar)
if (!IS_ERR(ar-cal_file))
release_firmware(ar-cal_file);
 
+   ath10k_swap_code_seg_release(ar);
+
ar-board = NULL;
ar-board_data = NULL;
ar-board_len = 0;
@@ -522,6 +531,7 @@ static void ath10k_core_free_firmware_files(struct ath10k 
*ar)
ar-firmware_len = 0;
 
ar-cal_file = NULL;
+
 }
 
 static int ath10k_fetch_cal_file(struct ath10k *ar)
@@ -795,6 +805,13 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k 
*ar, const char *name)
ath10k_dbg(ar, ATH10K_DBG_BOOT, found fw ie htt op 
version %d\n,
   ar-htt.op_version);
break;
+   case ATH10K_FW_IE_FW_CODE_SWAP_IMAGE:
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  found fw code swap image ie (%zd B)\n,
+  ie_len);
+   ar-swap.firmware_codeswap_data = data;
+   ar-swap.firmware_codeswap_len = ie_len;
+   break;
default:
ath10k_warn(ar, Unknown FW IE: %u\n,
le32_to_cpu(hdr-id));
@@ -1388,6 +1405,13 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
goto err_free_firmware_files;
}
 
+   ret = ath10k_swap_code_seg_init(ar);
+   if (ret) {
+   ath10k_err(ar, failed to initialize code swap segment: %d\n,
+  ret);
+   goto err_free_firmware_files;
+   }
+
mutex_lock(ar-conf_mutex);
 
ret = ath10k_core_start(ar, ATH10K_FIRMWARE_MODE_NORMAL);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 993cd36..b9145f5 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -36,6 +36,7 @@
 #include spectral.h
 #include thermal.h
 #include wow.h
+#include swap.h
 
 #define MS(_v, _f) (((_v)  _f##_MASK)  _f##_LSB)
 #define SM(_v, _f) (((_v)  _f##_LSB)  _f##_MASK)
@@ -603,6 +604,12 @@ struct ath10k {
 
const struct firmware *cal_file;
 
+   struct {
+   const void *firmware_codeswap_data;
+   size_t firmware_codeswap_len;
+   struct ath10k_swap_code_seg_info *firmware_swap_code_seg_info;
+   } swap;
+
char spec_board_id[100];
bool spec_board_loaded;
 
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 

[PATCH V2 08/10] ath10k: Fix BMI communication timeout for QCA99X0

2015-06-18 Thread Vasanthakumar Thiagarajan
There is more than 1 sec delay in getting response from target
through BMI in QCA99X0. Increase the BMI communication timeout
to 2*HZ to fix BMI failures.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/bmi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.h 
b/drivers/net/wireless/ath/ath10k/bmi.h
index 31a9906..df7c761 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -178,7 +178,7 @@ struct bmi_target_info {
 };
 
 /* in msec */
-#define BMI_COMMUNICATION_TIMEOUT_HZ (1*HZ)
+#define BMI_COMMUNICATION_TIMEOUT_HZ (2 * HZ)
 
 #define BMI_CE_NUM_TO_TARG 0
 #define BMI_CE_NUM_TO_HOST 1
-- 
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 V2 10/10] ath10k: Add BMI param value to execute otp to hw_param

2015-06-18 Thread Vasanthakumar Thiagarajan
BMI parameter value to execute downloaded otp binary
is different for QCA99X0. Have a member in hw_params
to hold hw specific BMI param.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c | 8 +++-
 drivers/net/wireless/ath/ath10k/core.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index c5f5d16..80f38b5 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -49,6 +49,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.has_shifted_cc_wraparound = true,
+   .otp_exe_param = 0,
.fw = {
.dir = QCA988X_HW_2_0_FW_DIR,
.fw = QCA988X_HW_2_0_FW_FILE,
@@ -63,6 +64,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.name = qca6174 hw2.1,
.patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR,
.uart_pin = 6,
+   .otp_exe_param = 0,
.fw = {
.dir = QCA6174_HW_2_1_FW_DIR,
.fw = QCA6174_HW_2_1_FW_FILE,
@@ -77,6 +79,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.name = qca6174 hw3.0,
.patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR,
.uart_pin = 6,
+   .otp_exe_param = 0,
.fw = {
.dir = QCA6174_HW_3_0_FW_DIR,
.fw = QCA6174_HW_3_0_FW_FILE,
@@ -91,6 +94,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.name = qca6174 hw3.2,
.patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR,
.uart_pin = 6,
+   .otp_exe_param = 0,
.fw = {
/* uses same binaries as hw3.0 */
.dir = QCA6174_HW_3_0_FW_DIR,
@@ -106,6 +110,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.name = qca99x0 hw2.0,
.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
+   .otp_exe_param = 0x0700,
.fw = {
.dir = QCA99X0_HW_2_0_FW_DIR,
.fw = QCA99X0_HW_2_0_FW_FILE,
@@ -413,6 +418,7 @@ out:
 static int ath10k_download_and_run_otp(struct ath10k *ar)
 {
u32 result, address = ar-hw_params.patch_load_addr;
+   u32 bmi_otp_exe_param = ar-hw_params.otp_exe_param;
int ret;
 
ret = ath10k_download_board_data(ar, ar-board_data, ar-board_len);
@@ -438,7 +444,7 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
return ret;
}
 
-   ret = ath10k_bmi_execute(ar, address, 0, result);
+   ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, result);
if (ret) {
ath10k_err(ar, could not execute otp (%d)\n, ret);
return ret;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index b9145f5..afd21d5 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -572,6 +572,7 @@ struct ath10k {
const char *name;
u32 patch_load_addr;
int uart_pin;
+   u32 otp_exe_param;
 
/* This is true if given HW chip has a quirky Cycle Counter
 * wraparound which resets to 0x7fff instead of 0. All
-- 
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: brcmfmac: Failed to create interface p2p-dev-p2p0: -28 (No space left on device)

2015-06-18 Thread Jörg Krause
Hi Arend,

On Di, 2015-06-16 at 16:26 +0200, Arend van Spriel wrote:
 On 06/16/15 11:59, Jörg Krause wrote:
  Hi Arend,
  
  as I wrote in my previous mail (brcmfmac: brcmf_p2p_create_p2pdev:
  timeout occurred) I get a p2p0 interface when loading the brcmfmac
  module with p2pon=1 (Linux kernel 4.0.5, BCM43362).
  
  Unfortunatly, if I try to use the p2p0 interface with 
  wpa_supplicant
  2.4 I get an error:
  
   Failed to create interface p2p-dev-p2p0: -28 (No space left on
   device)
   nl80211: Failed to create a P2P Device interface p2p-dev-p2p0
   P2P: Failed to enable P2P Device interface
 
 Using p2pon=1 is old-school p2p, ie. it creates a regular netdev for 
 doing p2p management stuff. Problem is that brcmfmac also indicates 
 p2p 
 device support. We can remove p2pon parameter or not indicate p2p dev 
 
 support when p2pon=1.

I used p2pon because the p2p0 interface is not created without it. It
fails with the error message brcmf_p2p_create_p2pdev: timeout
occurred as written in my previous mails. I would prefer not to use
it, so maybe we can find a solution how to get it working without it.

 
 Can you patch brcmfmac and give it a try. Need to start 
 wpa_supplicant 
 for two interface and if I recall correctly p2p0 must be specified 
 first.

Can you give me a hint where to patch brcmfmac. Many thanks!

Best regards
Jörg Krause
--
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] ath9k: spectral - simplify max_index calculation

2015-06-18 Thread Nick Kossifidis
max_index is a 6bit signed integer in both cases (sorry for the 5bit
typo in the comments), so the current function handles it correctly
for both HT20 and dynamic HT20/40 modes (I've tested it extensively).
Also you don't handle the negative indices we get from the hardware
(you just remove the sign). Have you tested this and if you did on
which hardware did you do the test ?

2015-06-16 11:21 GMT+02:00 Zefir Kurtisi zefir.kurt...@neratec.com:
 The max_index value provided in the spectral data set
 has to be interpreted differently for HT20 and HT40.

 The spectral module initially supported HT20 only
 and the spectral_max_index() function handled the
 conversion from signed to unsigned.

 In HT40, the max_index is an unsigned value and does
 not need to be fixed. When HT40 support was added,
 the function was exteded to handle the conversion
 for HT20 based on the provided num_bins parameter.

 This is misleading and complex. Instead this patch
 shifts the correction of the value to the caller,
 which in effect reduces it to a singel bit-operation
 for HT20 data.

 Signed-off-by: Zefir Kurtisi zefir.kurt...@neratec.com
 ---
  drivers/net/wireless/ath/ath9k/common-spectral.c | 20 ++---
  drivers/net/wireless/ath/ath9k/common-spectral.h | 36 
 +++-
  2 files changed, 18 insertions(+), 38 deletions(-)

 diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c 
 b/drivers/net/wireless/ath/ath9k/common-spectral.c
 index a876271..e4bae40 100644
 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c
 +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c
 @@ -59,8 +59,8 @@ ath_cmn_max_idx_verify_ht20_fft(u8 *sample_end, int 
 bytes_read)

 sample = sample_end - SPECTRAL_HT20_SAMPLE_LEN + 1;

 -   max_index = spectral_max_index(mag_info-all_bins,
 -  SPECTRAL_HT20_NUM_BINS);
 +   /* in ht20, this is a 6-bit signed number = shift it to 0 */
 +   max_index = spectral_max_index(mag_info-all_bins) ^ 0x20;
 max_magnitude = spectral_max_magnitude(mag_info-all_bins);

 max_exp = mag_info-max_exp  0xf;
 @@ -100,12 +100,10 @@ ath_cmn_max_idx_verify_ht20_40_fft(u8 *sample_end, int 
 bytes_read)
 sample = sample_end - SPECTRAL_HT20_40_SAMPLE_LEN + 1;

 lower_mag = spectral_max_magnitude(mag_info-lower_bins);
 -   lower_max_index = spectral_max_index(mag_info-lower_bins,
 -SPECTRAL_HT20_40_NUM_BINS);
 +   lower_max_index = spectral_max_index(mag_info-lower_bins);

 upper_mag = spectral_max_magnitude(mag_info-upper_bins);
 -   upper_max_index = spectral_max_index(mag_info-upper_bins,
 -SPECTRAL_HT20_40_NUM_BINS);
 +   upper_max_index = spectral_max_index(mag_info-upper_bins);

 max_exp = mag_info-max_exp  0xf;

 @@ -169,8 +167,8 @@ ath_cmn_process_ht20_fft(struct ath_rx_status *rs,
 magnitude = spectral_max_magnitude(mag_info-all_bins);
 fft_sample_20.max_magnitude = __cpu_to_be16(magnitude);

 -   max_index = spectral_max_index(mag_info-all_bins,
 -   SPECTRAL_HT20_NUM_BINS);
 +   /* in ht20, this is a 6-bit signed number = shift it to 0 */
 +   max_index = spectral_max_index(mag_info-all_bins) ^ 0x20;
 fft_sample_20.max_index = max_index;

 bitmap_w = spectral_bitmap_weight(mag_info-all_bins);
 @@ -302,12 +300,10 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs,
 upper_mag = spectral_max_magnitude(mag_info-upper_bins);
 fft_sample_40.upper_max_magnitude = __cpu_to_be16(upper_mag);

 -   lower_max_index = spectral_max_index(mag_info-lower_bins,
 -   SPECTRAL_HT20_40_NUM_BINS);
 +   lower_max_index = spectral_max_index(mag_info-lower_bins);
 fft_sample_40.lower_max_index = lower_max_index;

 -   upper_max_index = spectral_max_index(mag_info-upper_bins,
 -   SPECTRAL_HT20_40_NUM_BINS);
 +   upper_max_index = spectral_max_index(mag_info-upper_bins);
 fft_sample_40.upper_max_index = upper_max_index;

 lower_bitmap_w = spectral_bitmap_weight(mag_info-lower_bins);
 diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.h 
 b/drivers/net/wireless/ath/ath9k/common-spectral.h
 index 998743b..4cc5a6c 100644
 --- a/drivers/net/wireless/ath/ath9k/common-spectral.h
 +++ b/drivers/net/wireless/ath/ath9k/common-spectral.h
 @@ -116,33 +116,17 @@ static inline u16 spectral_max_magnitude(u8 *bins)
(bins[2]  0x03)  10;
  }

 -/* return the max magnitude from the all/upper/lower bins */
 -static inline u8 spectral_max_index(u8 *bins, int num_bins)
 +/* return the max magnitude from the all/upper/lower bins
 + *
 + * in HT20: 6-bit signed number of range -28 to +27
 + * in HT40: 6-bit unsigned number of range 0 to +63
 + *  (upper sub-channel index 0 is DC)
 + *
 + * 

Re: brcmfmac: Failed to create interface p2p-dev-p2p0: -28 (No space left on device)

2015-06-18 Thread Arend van Spriel

On 06/18/15 08:13, Jörg Krause wrote:

Hi Arend,

On Di, 2015-06-16 at 16:26 +0200, Arend van Spriel wrote:

On 06/16/15 11:59, Jörg Krause wrote:

Hi Arend,

as I wrote in my previous mail (brcmfmac: brcmf_p2p_create_p2pdev:
timeout occurred) I get a p2p0 interface when loading the brcmfmac
module with p2pon=1 (Linux kernel 4.0.5, BCM43362).

Unfortunatly, if I try to use the p2p0 interface with
wpa_supplicant
2.4 I get an error:

  Failed to create interface p2p-dev-p2p0: -28 (No space left on
  device)
  nl80211: Failed to create a P2P Device interface p2p-dev-p2p0
  P2P: Failed to enable P2P Device interface


Using p2pon=1 is old-school p2p, ie. it creates a regular netdev for
doing p2p management stuff. Problem is that brcmfmac also indicates
p2p
device support. We can remove p2pon parameter or not indicate p2p dev

support when p2pon=1.


I used p2pon because the p2p0 interface is not created without it. It
fails with the error message brcmf_p2p_create_p2pdev: timeout
occurred as written in my previous mails. I would prefer not to use
it, so maybe we can find a solution how to get it working without it.


43362 firmware may have issues with regular p2p dev support so let's 
stick with p2pon for now.


Can you patch brcmfmac and give it a try. Need to start
wpa_supplicant
for two interface and if I recall correctly p2p0 must be specified
first.


Can you give me a hint where to patch brcmfmac. Many thanks!


Attached is patch against 4.0.5 kernel.

Regards,
Arend
From 99bbbaa540fe9543156018b7f8596b46f60a723c Mon Sep 17 00:00:00 2001
From: Arend van Spriel ar...@broadcom.com
Date: Thu, 18 Jun 2015 10:23:50 +0200
Subject: [PATCH] brcmfmac: disable p2pdev support when using p2pon=1

Avoid wpa_supplicant from creating a p2pdev interface when we
already have a p2p0 interface, ie. loaded the driver with p2pon=1.

Signed-off-by: Arend van Spriel ar...@broadcom.com
---
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
index b59b8c6..10eaabf 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
@@ -5789,8 +5789,11 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct 
brcmf_if *ifp)
 BIT(NL80211_IFTYPE_ADHOC) |
 BIT(NL80211_IFTYPE_AP) |
 BIT(NL80211_IFTYPE_P2P_CLIENT) |
-BIT(NL80211_IFTYPE_P2P_GO) |
-BIT(NL80211_IFTYPE_P2P_DEVICE);
+BIT(NL80211_IFTYPE_P2P_GO);
+   /* only annouce p2pdev when p2pon is zero */
+   if (!ifp-drvr-iflist[1])
+   wiphy-interface_modes |= BIT(NL80211_IFTYPE_P2P_DEVICE);
+
/* need VSDB firmware feature for concurrent channels */
ifc_combo = brcmf_iface_combos[0];
if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
-- 
1.9.1



Re: [PATCH 00/10] Add QCA99X0 support

2015-06-18 Thread Kalle Valo
Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com writes:

 This patch set adds changes for QCA99X0 chip in pci probe,
 Copy Engine init and firmware downloads. Since it is still
 work in progress the support for this chip is not yet
 advertised in pci device table.

 Vasanthakumar Thiagarajan (10):
   ath10k: Add a table to store hw specific values
   ath10k: Add new reg_address/mask to hw register table
   ath10k: Add hw register/values for QCA99X0 chip
   ath10k: Copy Engine related changes for QCA99X0
   ath10k: Make target cpu address to CE address conversion chip specific
   ath10k: Add chip reset sequence for QCA99X0
   ath10k: Extend CE src desc flags for interrupt indication
   ath10k: Fix BMI communication timeout for QCA99X0
   ath10k: Add support for code swap
   ath10k: Add BMI param value to execute otp to hw_param

These patches don't apply and don't have proper sha1 ids. Please rebase.
And remember always to use ath.git master branch as the baseline, don't
apply any custom patches because that will break 3-way merge.

Applying: ath10k: Add a table to store hw specific values
Applying: ath10k: Add new reg_address/mask to hw register table
Applying: ath10k: Add hw register/values for QCA99X0 chip
fatal: sha1 information is lacking or useless 
(drivers/net/wireless/ath/ath10k/core.c).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0003 ath10k: Add hw register/values for QCA99X0 chip

-- 
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] ath9k: spectral - simplify max_index calculation

2015-06-18 Thread Zefir Kurtisi
On 06/18/2015 10:43 AM, Nick Kossifidis wrote:
 max_index is a 6bit signed integer in both cases (sorry for the 5bit
 typo in the comments), so the current function handles it correctly
 for both HT20 and dynamic HT20/40 modes (I've tested it extensively).
 Also you don't handle the negative indices we get from the hardware
 (you just remove the sign). Have you tested this and if you did on
 which hardware did you do the test ?
 
 2015-06-16 11:21 GMT+02:00 Zefir Kurtisi zefir.kurt...@neratec.com:
 [...]
 +/* return the max magnitude from the all/upper/lower bins
 + *
 + * in HT20: 6-bit signed number of range -28 to +27
 + * in HT40: 6-bit unsigned number of range 0 to +63
 + *  (upper sub-channel index 0 is DC)
 + *
 + * Correct interpretation of the value has to be done at caller
 + */

The comment above is taken from developer NDA documents and should be correct.
With that, in HT40 mode the max_index value has to be taken as is, while in HT20
it needs to be shifted to the unsigned range.

I used the proposed method with the chirp detector for FFTs provided for long
radar pulses on an AR9590 (patch posted the same day). Max bin index is used 
there
the same way as with spectral, but now I realize my mistake: for chirp 
detection,
the relative max_index is sufficient, while for spectral the absolute value is 
needed.

Toggling the MSB in HT20 shifts the signed values by 32 and leaves the index 
with
an offset of 4, therefore the correct operation should be:
ht20_max_index_absolute = (ht20_max_index ^ 0x20) - 4

The following code snipped proves the correctness of the operation:

#include stdio.h
#include string.h
#include stdlib.h

const char *char_to_bin(char x)
{
int z;
static char b[7];
b[0] = '\0';
for (z = 32; z  0; z = 1)
strcat(b, ((x  z) == z) ? 1 : 0);
return b;
}
int main (void)
{
char s;
for (s = -28; s  28; s++)
printf(%3d: %s\n, s, char_to_bin((s ^ 0x20) - 4));
return 0;
}

I'll provide a v2 patch for you to test. My intention with this is not to fix
something that is already working, but to share the related functions between
spectral and chirp detector.


Thanks,
Zefir

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