[PATCH 2/3] ath10k: move cal data len to hw_params

2016-03-10 Thread Raja Mani
ath10k_download_cal_dt() compares obtained cal data content length
against QCA988X_CAL_DATA_LEN (2116 bytes). It was written by keeping
qca988x in mind. In fact, cal data length is more chip specific.
To make ath10k_download_cal_dt() more generic and reusable for other
chipsets (like qca4019), cal data length is moved to hw_params.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c  | 11 ++-
 drivers/net/wireless/ath/ath10k/core.h  |  1 +
 drivers/net/wireless/ath/ath10k/debug.c |  7 ---
 drivers/net/wireless/ath/ath10k/hw.h|  2 --
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 4ec4d72..2a901c6 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -60,6 +60,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_AFTER,
+   .cal_data_len = 2116,
.fw = {
.dir = QCA988X_HW_2_0_FW_DIR,
.fw = QCA988X_HW_2_0_FW_FILE,
@@ -78,6 +79,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.otp_exe_param = 0,
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
+   .cal_data_len = 8124,
.fw = {
.dir = QCA6174_HW_2_1_FW_DIR,
.fw = QCA6174_HW_2_1_FW_FILE,
@@ -97,6 +99,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_AFTER,
+   .cal_data_len = 8124,
.fw = {
.dir = QCA6174_HW_2_1_FW_DIR,
.fw = QCA6174_HW_2_1_FW_FILE,
@@ -116,6 +119,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_AFTER,
+   .cal_data_len = 8124,
.fw = {
.dir = QCA6174_HW_3_0_FW_DIR,
.fw = QCA6174_HW_3_0_FW_FILE,
@@ -135,6 +139,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_AFTER,
+   .cal_data_len = 8124,
.fw = {
/* uses same binaries as hw3.0 */
.dir = QCA6174_HW_3_0_FW_DIR,
@@ -159,6 +164,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_chain_mask = 0xf,
.rx_chain_mask = 0xf,
.max_spatial_stream = 4,
+   .cal_data_len = 12064,
.fw = {
.dir = QCA99X0_HW_2_0_FW_DIR,
.fw = QCA99X0_HW_2_0_FW_FILE,
@@ -177,6 +183,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.otp_exe_param = 0,
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
+   .cal_data_len = 8124,
.fw = {
.dir = QCA9377_HW_1_0_FW_DIR,
.fw = QCA9377_HW_1_0_FW_FILE,
@@ -195,6 +202,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.otp_exe_param = 0,
.channel_counters_freq_hz = 88000,
.max_probe_resp_desc_thres = 0,
+   .cal_data_len = 8124,
.fw = {
.dir = QCA9377_HW_1_0_FW_DIR,
.fw = QCA9377_HW_1_0_FW_FILE,
@@ -218,6 +226,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.tx_chain_mask = 0x3,
.rx_chain_mask = 0x3,
.max_spatial_stream = 2,
+   .cal_data_len = 12064,
.fw = {
.dir = QCA4019_HW_1_0_FW_DIR,
.fw = QCA4019_HW_1_0_FW_FILE,
@@ -503,7 +512,7 @@ static int ath10k_download_cal_dt(struct ath10k *ar, const 
char *dt_name)
return -ENOENT;
}
 
-   if (data_len != QCA988X_CAL_DATA_LEN) {
+   if (data_len != ar->hw_params.cal_data_len) {
ath10k_warn(ar, "invalid calibration data length in DT: %d\n",
data_len);
ret = -EMSGSIZE;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 23ba03f..322a9eb 100644
--- a/drivers/net/

[PATCH 1/3] ath10k: pass cal data location as an argument to ath10k_download_cal_{file|dt}

2016-03-10 Thread Raja Mani
Both ath10k_download_cal_file() and ath10k_download_cal_dt() uses
hard coded file pointer (ar->cal_file) and device tree entry
(qcom,ath10k-calibration-data) respectively to get calibration
data content.

There is a need to use those two functions in qca4019 calibration
download sequence with different file pointer and device tree entry name.
Modify those two functions to take cal data location as an argument.
So that it can serve the purpose for other file pointer and device
tree entry.

This is just preparation before adding actual qca4019 calibration
download sequence. No functional changes.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 2389c07..4ec4d72 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -462,18 +462,18 @@ exit:
return ret;
 }
 
-static int ath10k_download_cal_file(struct ath10k *ar)
+static int ath10k_download_cal_file(struct ath10k *ar,
+   const struct firmware *file)
 {
int ret;
 
-   if (!ar->cal_file)
+   if (!file)
return -ENOENT;
 
-   if (IS_ERR(ar->cal_file))
-   return PTR_ERR(ar->cal_file);
+   if (IS_ERR(file))
+   return PTR_ERR(file);
 
-   ret = ath10k_download_board_data(ar, ar->cal_file->data,
-ar->cal_file->size);
+   ret = ath10k_download_board_data(ar, file->data, file->size);
if (ret) {
ath10k_err(ar, "failed to download cal_file data: %d\n", ret);
return ret;
@@ -484,7 +484,7 @@ static int ath10k_download_cal_file(struct ath10k *ar)
return 0;
 }
 
-static int ath10k_download_cal_dt(struct ath10k *ar)
+static int ath10k_download_cal_dt(struct ath10k *ar, const char *dt_name)
 {
struct device_node *node;
int data_len;
@@ -498,8 +498,7 @@ static int ath10k_download_cal_dt(struct ath10k *ar)
 */
return -ENOENT;
 
-   if (!of_get_property(node, "qcom,ath10k-calibration-data",
-_len)) {
+   if (!of_get_property(node, dt_name, _len)) {
/* The calibration data node is optional */
return -ENOENT;
}
@@ -517,8 +516,7 @@ static int ath10k_download_cal_dt(struct ath10k *ar)
goto out;
}
 
-   ret = of_property_read_u8_array(node, "qcom,ath10k-calibration-data",
-   data, data_len);
+   ret = of_property_read_u8_array(node, dt_name, data, data_len);
if (ret) {
ath10k_warn(ar, "failed to read calibration data from DT: %d\n",
ret);
@@ -1258,7 +1256,7 @@ static int ath10k_download_cal_data(struct ath10k *ar)
 {
int ret;
 
-   ret = ath10k_download_cal_file(ar);
+   ret = ath10k_download_cal_file(ar, ar->cal_file);
if (ret == 0) {
ar->cal_mode = ATH10K_CAL_MODE_FILE;
goto done;
@@ -1268,7 +1266,7 @@ static int ath10k_download_cal_data(struct ath10k *ar)
   "boot did not find a calibration file, try DT next: %d\n",
   ret);
 
-   ret = ath10k_download_cal_dt(ar);
+   ret = ath10k_download_cal_dt(ar, "qcom,ath10k-calibration-data");
if (ret == 0) {
ar->cal_mode = ATH10K_CAL_MODE_DT;
goto done;
-- 
1.8.1.2

--
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 3/3] ath10k: incorporate qca4019 cal data download sequence

2016-03-10 Thread Raja Mani
qca4019 calibration data is stored in the host memory and it's mandatory
to download it even before reading board id and chip id from the target.
Also, there is a need to execute otp (download and run) twice, one after
cal data download and another one after board data download.

Existing cal data file name 'cal--.bin' and device tree entry
'qcom,ath10k-calibration-data' used in ath10k has assumption that it
carries other data (like board data) also along with the calibration data.
But, qca4019 cal data contains pure calibration data (doesn't include
any other info). So, using existing same cal file name and DT entry
in qca4019 case would alter the purpose of it. To avoid this, new cal
file name 'pre-cal--.bin' and new device tree entry name
'qcom,ath10k-pre-calibration-data are introduced.

Overall qca4019's firmware download sequence would look like,

   1) Download cal data (either from a file or device tree entry)
  at the address specified by target in the host interest area
  member "hi_board_data".

   2) Download otp and run with 0x10 (PARAM_GET_EEPROM_BOARD_ID)
  as a argument.

  At this point, otp will take back up of downloaded cal data
  content in another location in the target and return valid
  board id and chip id to the host.

   3) Download board data at the address specified by target
  in host interest area member "hi_board_data".

   4) Download otp and run with 0x1 (PARAM_FLASH_SECTION_ALL) as
  a argument.

  Now otp will apply cal data content from it's backup on top
  of board data download in step 3 and prepare final data base.

   5) Download code swap and athwlan binary content.

Above sequences are implemented (step 1 to step 4) in the name of
pre calibration configuration.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c | 85 +-
 drivers/net/wireless/ath/ath10k/core.h | 11 -
 2 files changed, 94 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 2a901c6..3d05929 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -729,6 +729,14 @@ static int ath10k_fetch_cal_file(struct ath10k *ar)
 {
char filename[100];
 
+   /* pre-cal--.bin */
+   scnprintf(filename, sizeof(filename), "pre-cal-%s-%s.bin",
+ ath10k_bus_str(ar->hif.bus), dev_name(ar->dev));
+
+   ar->pre_cal_file = ath10k_fetch_fw_file(ar, ATH10K_FW_DIR, filename);
+   if (!IS_ERR(ar->pre_cal_file))
+   goto success;
+
/* cal--.bin */
scnprintf(filename, sizeof(filename), "cal-%s-%s.bin",
  ath10k_bus_str(ar->hif.bus), dev_name(ar->dev));
@@ -737,7 +745,7 @@ static int ath10k_fetch_cal_file(struct ath10k *ar)
if (IS_ERR(ar->cal_file))
/* calibration file is optional, don't print any warnings */
return PTR_ERR(ar->cal_file);
-
+success:
ath10k_dbg(ar, ATH10K_DBG_BOOT, "found calibration file %s/%s\n",
   ATH10K_FW_DIR, filename);
 
@@ -1261,10 +1269,76 @@ success:
return 0;
 }
 
+static int ath10k_core_pre_cal_download(struct ath10k *ar)
+{
+   int ret;
+
+   ret = ath10k_download_cal_file(ar, ar->pre_cal_file);
+   if (ret == 0) {
+   ar->cal_mode = ATH10K_PRE_CAL_MODE_FILE;
+   goto success;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  "boot did not find a pre calibration file, try DT next: 
%d\n",
+  ret);
+
+   ret = ath10k_download_cal_dt(ar, "qcom,ath10k-pre-calibration-data");
+   if (ret) {
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  "unable to load pre cal data from DT: %d\n", ret);
+   return ret;
+   }
+   ar->cal_mode = ATH10K_PRE_CAL_MODE_DT;
+
+success:
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot using calibration mode %s\n",
+  ath10k_cal_mode_str(ar->cal_mode));
+
+   return 0;
+}
+
+static int ath10k_core_pre_cal_config(struct ath10k *ar)
+{
+   int ret;
+
+   ret = ath10k_core_pre_cal_download(ar);
+   if (ret) {
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  "failed to load pre cal data: %d\n", ret);
+   return ret;
+   }
+
+   ret = ath10k_core_get_board_id_from_otp(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to get board id: %d\n", ret);
+   return ret;
+   }
+
+   ret = ath10k_download_and_run_otp(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to run otp: %d\n", ret);
+   return ret;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+

[PATCH] dt: bindings: add new dt entry for pre calibration in qcom,ath10k.txt

2016-03-10 Thread Raja Mani
There two things done in this patch,

1) Existing device tree entry 'qcom,ath10k-calibration-data' carries
   not only calibration data, it carries board specific data too.
   So, make appropriate update in doc.

2) ipq4019 wifi needs new devie tree entry to carry calibration
   data alone (called pre cal data, it doesn't include any other info).
   Using 'qcom,ath10k-calibration-data' for ipq4019 would alter
   the purpose of it. Hence, add new device tree entry called
   'qcom,ath10k-pre-calibration-data' to carry only pre calibration data.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---

Below patches covers the corresponding changes in the ath10k driver.
It's posted separately to ath10k and linux-wireless mailing list.

  1) ath10k: pass cal data location as an argument to 
ath10k_download_cal_{file|dt}
  2) ath10k: move cal data len to hw_params
  3) ath10k: incorporate qca4019 cal data download sequence

 .../bindings/net/wireless/qcom,ath10k.txt  | 23 +++---
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 96aae6b..74d7f0a 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -5,12 +5,18 @@ Required properties:
* "qcom,ath10k"
* "qcom,ipq4019-wifi"
 
-PCI based devices uses compatible string "qcom,ath10k" and takes only
-calibration data via "qcom,ath10k-calibration-data". Rest of the properties
-are not applicable for PCI based devices.
+PCI based devices uses compatible string "qcom,ath10k" and takes calibration
+data along with board specific data via "qcom,ath10k-calibration-data".
+Rest of the properties are not applicable for PCI based devices.
 
 AHB based devices (i.e. ipq4019) uses compatible string "qcom,ipq4019-wifi"
-and also uses most of the properties defined in this doc.
+and also uses most of the properties defined in this doc (except
+"qcom,ath10k-calibration-data"). It uses "qcom,ath10k-pre-calibration-data"
+to carry pre calibration data.
+
+In general, entry "qcom,ath10k-pre-calibration-data" and
+"qcom,ath10k-calibration-data" conflict with each other and only one
+can be provided per device.
 
 Optional properties:
 - reg: Address and length of the register set for the device.
@@ -35,8 +41,11 @@ Optional properties:
 - qcom,msi_addr: MSI interrupt address.
 - qcom,msi_base: Base value to add before writing MSI data into
MSI address register.
-- qcom,ath10k-calibration-data : calibration data as an array, the
-length can vary between hw versions
+- qcom,ath10k-calibration-data : calibration data + board specific data
+as an array, the length can vary between
+hw versions.
+- qcom,ath10k-pre-calibration-data : pre calibration data as an array,
+the length can vary between hw versions.
 
 Example (to supply the calibration data alone):
 
@@ -105,5 +114,5 @@ wifi0: wifi@a00 {
  "legacy";
qcom,msi_addr = <0x0b006040>;
qcom,msi_base = <0x40>;
-   qcom,ath10k-calibration-data = [ 01 02 03 ... ];
+   qcom,ath10k-pre-calibration-data = [ 01 02 03 ... ];
 };
-- 
1.8.1.2

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


[PATCH 0/3] ath10k: add calibration data download support for qca4019

2016-03-10 Thread Raja Mani
The necessary update in dt binding doc
(Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt) is done
in below patch and it's posted separately,
  
  "dt: bindings: add new dt entry for pre calibration in qcom,ath10k.txt"

Raja Mani (3):
  ath10k: pass cal data location as an argument to
ath10k_download_cal_{file|dt}
  ath10k: move cal data len to hw_params
  ath10k: incorporate qca4019 cal data download sequence

 drivers/net/wireless/ath/ath10k/core.c  | 120 
 drivers/net/wireless/ath/ath10k/core.h  |  12 +++-
 drivers/net/wireless/ath/ath10k/debug.c |   7 +-
 drivers/net/wireless/ath/ath10k/hw.h|   2 -
 4 files changed, 120 insertions(+), 21 deletions(-)

-- 
1.8.1.2

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


[PATCH 1/2] ath10k: add qca4019 hw params

2016-01-29 Thread Raja Mani
From: Raja Mani <rm...@codeaurora.org>

Add a new entry in hw_params_list for qca4019 with list of
it's own details.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c  | 20 
 drivers/net/wireless/ath/ath10k/hw.h|  8 
 drivers/net/wireless/ath/ath10k/targaddrs.h |  3 +++
 3 files changed, 31 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 5c684e0..ac29813 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -201,6 +201,26 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.board_ext_size = QCA9377_BOARD_EXT_DATA_SZ,
},
},
+   {
+   .id = QCA4019_HW_1_0_DEV_VERSION,
+   .dev_id = 0,
+   .name = "qca4019 hw1.0",
+   .patch_load_addr = QCA4019_HW_1_0_PATCH_LOAD_ADDR,
+   .uart_pin = 7,
+   .otp_exe_param = 0x001,
+   .continuous_frag_desc = true,
+   .channel_counters_freq_hz = 125000,
+   .max_probe_resp_desc_thres = 24,
+   .hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
+   .fw = {
+   .dir = QCA4019_HW_1_0_FW_DIR,
+   .fw = QCA4019_HW_1_0_FW_FILE,
+   .otp = QCA4019_HW_1_0_OTP_FILE,
+   .board = QCA4019_HW_1_0_BOARD_DATA_FILE,
+   .board_size = QCA4019_BOARD_DATA_SZ,
+   .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
+   },
+   },
 };
 
 static const char *const ath10k_core_fw_feature_str[] = {
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 4217bdb..291ca1f 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -106,6 +106,14 @@ enum qca9377_chip_id_rev {
 #define QCA9377_HW_1_0_BOARD_DATA_FILE "board.bin"
 #define QCA9377_HW_1_0_PATCH_LOAD_ADDR 0x1234
 
+/* QCA4019 1.0 definitions */
+#define QCA4019_HW_1_0_DEV_VERSION 0x0100
+#define QCA4019_HW_1_0_FW_DIR  ATH10K_FW_DIR "/QCA4019/hw1.0"
+#define QCA4019_HW_1_0_FW_FILE "firmware.bin"
+#define QCA4019_HW_1_0_OTP_FILE"otp.bin"
+#define QCA4019_HW_1_0_BOARD_DATA_FILE "board.bin"
+#define QCA4019_HW_1_0_PATCH_LOAD_ADDR  0x1234
+
 #define ATH10K_FW_API2_FILE"firmware-2.bin"
 #define ATH10K_FW_API3_FILE"firmware-3.bin"
 
diff --git a/drivers/net/wireless/ath/ath10k/targaddrs.h 
b/drivers/net/wireless/ath/ath10k/targaddrs.h
index 05a421b..361f143 100644
--- a/drivers/net/wireless/ath/ath10k/targaddrs.h
+++ b/drivers/net/wireless/ath/ath10k/targaddrs.h
@@ -456,4 +456,7 @@ Fw Mode/SubMode Mask
 #define QCA99X0_BOARD_DATA_SZ12288
 #define QCA99X0_BOARD_EXT_DATA_SZ 0
 
+#define QCA4019_BOARD_DATA_SZ12064
+#define QCA4019_BOARD_EXT_DATA_SZ 0
+
 #endif /* __TARGADDRS_H__ */
-- 
1.8.1.2

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


[PATCH 0/2] add hw param and wmi changes for qca4019

2016-01-29 Thread Raja Mani
This patch series includes hw param and wmi changes needed for qca4019.

Raja Mani (2):
  ath10k: add qca4019 hw params
  ath10k: populate qca4019 fw specific wmi init params

 drivers/net/wireless/ath/ath10k/core.c  | 34 +++--
 drivers/net/wireless/ath/ath10k/core.h  |  6 +
 drivers/net/wireless/ath/ath10k/hw.h| 14 +++-
 drivers/net/wireless/ath/ath10k/targaddrs.h |  3 +++
 drivers/net/wireless/ath/ath10k/wmi.c   | 12 +-
 drivers/net/wireless/ath/ath10k/wmi.h   |  1 -
 6 files changed, 55 insertions(+), 15 deletions(-)

-- 
1.8.1.2

--
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 2/2] ath10k: populate qca4019 fw specific wmi init params

2016-01-29 Thread Raja Mani
Some of the parameter like tx/rx chain mask, number of htt tx desc,
qcache active peer count, etc goes via wmi init cmd to qca4019 firmware
are different.

To make use of 10.4 gen_init function for qca4019, change wmi service
ready handler and 10.4 wmi init functions to adapt qca4019 specific
init values.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c | 14 --
 drivers/net/wireless/ath/ath10k/core.h |  6 ++
 drivers/net/wireless/ath/ath10k/hw.h   |  6 --
 drivers/net/wireless/ath/ath10k/wmi.c  | 12 ++--
 drivers/net/wireless/ath/ath10k/wmi.h  |  1 -
 5 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index ac29813..565cbab 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -156,6 +156,11 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.channel_counters_freq_hz = 15,
.max_probe_resp_desc_thres = 24,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
+   .num_msdu_desc = 1424,
+   .qcache_active_peers = 50,
+   .tx_chain_mask = 0xf,
+   .rx_chain_mask = 0xf,
+   .max_spatial_stream = 4,
.fw = {
.dir = QCA99X0_HW_2_0_FW_DIR,
.fw = QCA99X0_HW_2_0_FW_FILE,
@@ -212,6 +217,11 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.channel_counters_freq_hz = 125000,
.max_probe_resp_desc_thres = 24,
.hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
+   .num_msdu_desc = 2500,
+   .qcache_active_peers = 35,
+   .tx_chain_mask = 0x3,
+   .rx_chain_mask = 0x3,
+   .max_spatial_stream = 2,
.fw = {
.dir = QCA4019_HW_1_0_FW_DIR,
.fw = QCA4019_HW_1_0_FW_FILE,
@@ -1522,9 +1532,9 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar->num_active_peers = TARGET_10_4_ACTIVE_PEERS;
ar->max_num_vdevs = TARGET_10_4_NUM_VDEVS;
ar->num_tids = TARGET_10_4_TGT_NUM_TIDS;
-   ar->htt.max_num_pending_tx = TARGET_10_4_NUM_MSDU_DESC;
+   ar->htt.max_num_pending_tx = ar->hw_params.num_msdu_desc;
ar->fw_stats_req_mask = WMI_STAT_PEER;
-   ar->max_spatial_stream = WMI_10_4_MAX_SPATIAL_STREAM;
+   ar->max_spatial_stream = ar->hw_params.max_spatial_stream;
break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 2e1a7da..dad608c 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -669,6 +669,12 @@ struct ath10k {
/* The padding bytes's location is different on various chips */
enum ath10k_hw_4addr_pad hw_4addr_pad;
 
+   u32 num_msdu_desc;
+   u32 qcache_active_peers;
+   u32 tx_chain_mask;
+   u32 rx_chain_mask;
+   u32 max_spatial_stream;
+
struct ath10k_hw_params_fw {
const char *dir;
const char *fw;
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 291ca1f..2dece8d 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -426,16 +426,11 @@ enum ath10k_hw_4addr_pad {
 #define TARGET_10_4_ACTIVE_PEERS   0
 
 #define TARGET_10_4_NUM_QCACHE_PEERS_MAX   512
-#define TARGET_10_4_QCACHE_ACTIVE_PEERS50
 #define TARGET_10_4_NUM_OFFLOAD_PEERS  0
 #define TARGET_10_4_NUM_OFFLOAD_REORDER_BUFFS  0
 #define TARGET_10_4_NUM_PEER_KEYS  2
 #define TARGET_10_4_TGT_NUM_TIDS   ((TARGET_10_4_NUM_PEERS) * 2)
 #define TARGET_10_4_AST_SKID_LIMIT 32
-#define TARGET_10_4_TX_CHAIN_MASK  (BIT(0) | BIT(1) | \
-BIT(2) | BIT(3))
-#define TARGET_10_4_RX_CHAIN_MASK  (BIT(0) | BIT(1) | \
-BIT(2) | BIT(3))
 
 /* 100 ms for video, best-effort, and background */
 #define TARGET_10_4_RX_TIMEOUT_LO_PRI  100
@@ -461,7 +456,6 @@ enum ath10k_hw_4addr_pad {
 #define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
 #define TARGET_10_4_VOW_CONFIG 0
 #define TARGET_10_4_GTK_OFFLOAD_MAX_VDEV   3
-#define TARGET_10_4_NUM_MSDU_DESC  (1024 + 400)
 #define TARGET_10_4_11AC_TX_MAX_FRAGS  2
 #define TARGET_10_4_MAX_PEER_EXT_STATS 16
 #define TARGET_10_4_SMA

[PATCH 04/12] ath10k: add basic skeleton to support ahb

2016-01-27 Thread Raja Mani
qca4019 uses ahb instead of pci where it slightly differs in device
enumeration, clock control, reset control, etc. Good thing is that
ahb also uses copy engine for the data transaction. So, the most of
the stuff implemented in pci.c/ce.c are reusable in ahb case too.

Device enumeration in ahb case comes through platform driver/device
model. All resource details like irq, memory map, clocks, etc for
qca4019 can be fetched from of_node of platform device.

Simply flow would look like,

 device tree => platform device (kernel) => platform driver (ath10k)

Device tree entry will have all qca4019 resource details and the same
info will be passed to kernel. Kernel will prepare new platform device
for that entry and expose DT info to of_node in platform device.
Later, ath10k would register platform driver with unique compatible name
and then kernels binds to corresponding compatible entry & calls ath10k
ahb probe functions. From there onwards, ath10k will take control of it
and move forward.

New bool flag CONFIG_ATH10K_AHB is added in Kconfig to conditionally
enable ahb support in ath10k. On enabling this flag, ath10k_pci.ko
will have ahb support. This patch adds only basic skeleton and few
macros to support ahb in the context of qca4019.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/Kconfig  |  6 +++
 drivers/net/wireless/ath/ath10k/Makefile |  2 +
 drivers/net/wireless/ath/ath10k/ahb.c| 67 
 drivers/net/wireless/ath/ath10k/ahb.h| 41 +++
 drivers/net/wireless/ath/ath10k/core.h   |  3 ++
 drivers/net/wireless/ath/ath10k/debug.h  |  1 +
 drivers/net/wireless/ath/ath10k/hw.h |  2 +
 drivers/net/wireless/ath/ath10k/pci.c|  8 
 drivers/net/wireless/ath/ath10k/pci.h|  1 +
 9 files changed, 131 insertions(+)
 create mode 100644 drivers/net/wireless/ath/ath10k/ahb.c
 create mode 100644 drivers/net/wireless/ath/ath10k/ahb.h

diff --git a/drivers/net/wireless/ath/ath10k/Kconfig 
b/drivers/net/wireless/ath/ath10k/Kconfig
index 03aa35f..d7f207a 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -15,6 +15,12 @@ config ATH10K_PCI
---help---
  This module adds support for PCIE bus
 
+config ATH10K_AHB
+   bool "Atheros ath10k AHB support"
+   depends on ATH10K_PCI && OF
+   ---help---
+ This module adds support for AHB bus
+
 config ATH10K_DEBUG
bool "Atheros ath10k debugging"
depends on ATH10K
diff --git a/drivers/net/wireless/ath/ath10k/Makefile 
b/drivers/net/wireless/ath/ath10k/Makefile
index c04fb00..930fadd 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -25,5 +25,7 @@ obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o
 ath10k_pci-y += pci.o \
ce.o
 
+ath10k_pci-$(CONFIG_ATH10K_AHB) += ahb.o
+
 # for tracing framework to find trace.h
 CFLAGS_trace.o := -I$(src)
diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
new file mode 100644
index 000..129f4f4
--- /dev/null
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016 Qualcomm Atheros, Inc. All rights reserved.
+ * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include 
+#include "core.h"
+#include "debug.h"
+#include "ahb.h"
+
+static const struct of_device_id ath10k_ahb_of_match[] = {
+   /* TODO: enable this entry once everything in place.
+* { .compatible = "qcom,ipq4019-wifi",
+*   .data = (void *)ATH10K_HW_QCA4019 },
+*/
+   { }
+};
+
+MODULE_DEVICE_TABLE(of, ath10k_ahb_of_match);
+
+static int ath10k_ahb_probe(struct platform_device *pdev)
+{
+   return 0;
+}
+
+static int ath10k_ahb_remove(struct platform_device *pdev)
+{
+   return 0;
+}
+
+static struct platform_driver ath10k_ahb_driver = {
+   .driver = {
+   .name   = "ath10k_ahb",
+   .of_match_table = ath10k_ahb_of_match,
+   },
+   .probe  = ath10k_ahb_probe,
+   .remove = ath10k_ahb_remove,
+};
+
+int ath1

[PATCH 02/12] ath10k: make ath10k_pci_read32/write32() ops more generic

2016-01-27 Thread Raja Mani
ath10k_pci_read32/write32() does work more specific to
PCI by ensuring pci wake/sleep for every read and write.
There is a plan to use most of stuff available in pci.c
(irq stuff, copy engine, etc) for AHB case. Such kind
of pci wake/sleep for every read/write is not required
in AHB case (qca4019). All those reusable areas in pci.c
and ce.c calls ath10k_pci_read32/write32() for low level
read and write.

In fact, ath10k_pci_read32/write32() should do what it does
today for PCI case. But for AHB, it has to do differently.
To make ath10k_pci_read32/write32() more generic, new function
pointers are added in ar_pci for the function which does
operation more close to the bus. Later, corresponding bus
specific read and write function will be mapped to that.

ath10k_pci_read32/write32() are changed to call directly
those function pointers without worrying which bus underlying
to it. Also, the function to get number of bank is changed
in the same way.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 34 +++---
 drivers/net/wireless/ath/ath10k/pci.h |  8 
 2 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 956e548..c5f6604 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -619,7 +619,7 @@ static void ath10k_pci_sleep_sync(struct ath10k *ar)
spin_unlock_irqrestore(_pci->ps_lock, flags);
 }
 
-void ath10k_pci_write32(struct ath10k *ar, u32 offset, u32 value)
+static void ath10k_bus_pci_write32(struct ath10k *ar, u32 offset, u32 value)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int ret;
@@ -641,7 +641,7 @@ void ath10k_pci_write32(struct ath10k *ar, u32 offset, u32 
value)
ath10k_pci_sleep(ar);
 }
 
-u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)
+static u32 ath10k_bus_pci_read32(struct ath10k *ar, u32 offset)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
u32 val;
@@ -666,6 +666,20 @@ u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)
return val;
 }
 
+inline void ath10k_pci_write32(struct ath10k *ar, u32 offset, u32 value)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+
+   ar_pci->bus_ops->write32(ar, offset, value);
+}
+
+inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+
+   return ar_pci->bus_ops->read32(ar, offset);
+}
+
 u32 ath10k_pci_soc_read32(struct ath10k *ar, u32 addr)
 {
return ath10k_pci_read32(ar, RTC_SOC_BASE_ADDRESS + addr);
@@ -1906,6 +1920,13 @@ static int ath10k_pci_get_num_banks(struct ath10k *ar)
return 1;
 }
 
+static int ath10k_bus_get_num_banks(struct ath10k *ar)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+
+   return ar_pci->bus_ops->get_num_banks(ar);
+}
+
 int ath10k_pci_init_config(struct ath10k *ar)
 {
u32 interconnect_targ_addr;
@@ -2017,7 +2038,7 @@ int ath10k_pci_init_config(struct ath10k *ar)
/* first bank is switched to IRAM */
ealloc_value |= ((HI_EARLY_ALLOC_MAGIC << HI_EARLY_ALLOC_MAGIC_SHIFT) &
 HI_EARLY_ALLOC_MAGIC_MASK);
-   ealloc_value |= ((ath10k_pci_get_num_banks(ar) <<
+   ealloc_value |= ((ath10k_bus_get_num_banks(ar) <<
  HI_EARLY_ALLOC_IRAM_BANKS_SHIFT) &
 HI_EARLY_ALLOC_IRAM_BANKS_MASK);
 
@@ -2988,6 +3009,12 @@ static bool ath10k_pci_chip_is_supported(u32 dev_id, u32 
chip_id)
return false;
 }
 
+static const struct ath10k_bus_ops ath10k_pci_bus_ops = {
+   .read32 = ath10k_bus_pci_read32,
+   .write32= ath10k_bus_pci_write32,
+   .get_num_banks  = ath10k_pci_get_num_banks,
+};
+
 static int ath10k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *pci_dev)
 {
@@ -3038,6 +3065,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
ar_pci->ar = ar;
ar->dev_id = pci_dev->device;
ar_pci->pci_ps = pci_ps;
+   ar_pci->bus_ops = _pci_bus_ops;
 
ar->id.vendor = pdev->vendor;
ar->id.device = pdev->device;
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index ae76131..41f3fac 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -157,6 +157,12 @@ struct ath10k_pci_supp_chip {
u32 rev_id;
 };
 
+struct ath10k_bus_ops {
+   u32 (*read32)(struct ath10k *ar, u32 offset);
+   void (*write32)(struct ath10k *ar, u32 offset, u32 value);
+   int (*get_num_banks)(struct ath10k *ar);
+};
+
 struct ath10k_pci {
struct pci_dev *pdev;
struct device *dev;
@@ -225,6 +231,8 @@ struct ath10k_pci {
 * on MMIO read/write.
 */
  

[PATCH 03/12] ath10k: pull reusable code from pci probe and remove for ahb

2016-01-27 Thread Raja Mani
Some of the code present in ath10k_pci_{probe|remove} are reusable
in ahb case too. To avoid code duplication, move reusable code to
new functions. Later, those new functions can be called from ahb
module's probe and exit functions.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 64 +++
 drivers/net/wireless/ath/ath10k/pci.h |  2 ++
 2 files changed, 44 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index c5f6604..6ef878c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -3009,6 +3009,37 @@ static bool ath10k_pci_chip_is_supported(u32 dev_id, u32 
chip_id)
return false;
 }
 
+int ath10k_pci_setup_resource(struct ath10k *ar)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+   int ret;
+
+   spin_lock_init(_pci->ce_lock);
+   spin_lock_init(_pci->ps_lock);
+
+   setup_timer(_pci->rx_post_retry, ath10k_pci_rx_replenish_retry,
+   (unsigned long)ar);
+
+   if (QCA_REV_6174(ar))
+   ath10k_pci_override_ce_config(ar);
+
+   ret = ath10k_pci_alloc_pipes(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to allocate copy engine pipes: %d\n",
+  ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+void ath10k_pci_release_resource(struct ath10k *ar)
+{
+   ath10k_pci_kill_tasklet(ar);
+   ath10k_pci_ce_deinit(ar);
+   ath10k_pci_free_pipes(ar);
+}
+
 static const struct ath10k_bus_ops ath10k_pci_bus_ops = {
.read32 = ath10k_bus_pci_read32,
.write32= ath10k_bus_pci_write32,
@@ -3072,34 +3103,25 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
ar->id.subsystem_vendor = pdev->subsystem_vendor;
ar->id.subsystem_device = pdev->subsystem_device;
 
-   spin_lock_init(_pci->ce_lock);
-   spin_lock_init(_pci->ps_lock);
-
-   setup_timer(_pci->rx_post_retry, ath10k_pci_rx_replenish_retry,
-   (unsigned long)ar);
setup_timer(_pci->ps_timer, ath10k_pci_ps_timer,
(unsigned long)ar);
 
-   ret = ath10k_pci_claim(ar);
+   ret = ath10k_pci_setup_resource(ar);
if (ret) {
-   ath10k_err(ar, "failed to claim device: %d\n", ret);
+   ath10k_err(ar, "failed to setup resource: %d\n", ret);
goto err_core_destroy;
}
 
-   if (QCA_REV_6174(ar))
-   ath10k_pci_override_ce_config(ar);
-
-   ret = ath10k_pci_alloc_pipes(ar);
+   ret = ath10k_pci_claim(ar);
if (ret) {
-   ath10k_err(ar, "failed to allocate copy engine pipes: %d\n",
-  ret);
-   goto err_sleep;
+   ath10k_err(ar, "failed to claim device: %d\n", ret);
+   goto err_free_pipes;
}
 
ret = ath10k_pci_force_wake(ar);
if (ret) {
ath10k_warn(ar, "failed to wake up device : %d\n", ret);
-   goto err_free_pipes;
+   goto err_sleep;
}
 
ath10k_pci_ce_deinit(ar);
@@ -3108,7 +3130,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
ret = ath10k_pci_init_irq(ar);
if (ret) {
ath10k_err(ar, "failed to init irqs: %d\n", ret);
-   goto err_free_pipes;
+   goto err_sleep;
}
 
ath10k_info(ar, "pci irq %s interrupts %d irq_mode %d reset_mode %d\n",
@@ -3154,13 +3176,13 @@ err_free_irq:
 err_deinit_irq:
ath10k_pci_deinit_irq(ar);
 
-err_free_pipes:
-   ath10k_pci_free_pipes(ar);
-
 err_sleep:
ath10k_pci_sleep_sync(ar);
ath10k_pci_release(ar);
 
+err_free_pipes:
+   ath10k_pci_free_pipes(ar);
+
 err_core_destroy:
ath10k_core_destroy(ar);
 
@@ -3184,10 +3206,8 @@ static void ath10k_pci_remove(struct pci_dev *pdev)
 
ath10k_core_unregister(ar);
ath10k_pci_free_irq(ar);
-   ath10k_pci_kill_tasklet(ar);
ath10k_pci_deinit_irq(ar);
-   ath10k_pci_ce_deinit(ar);
-   ath10k_pci_free_pipes(ar);
+   ath10k_pci_release_resource(ar);
ath10k_pci_sleep_sync(ar);
ath10k_pci_release(ar);
ath10k_core_destroy(ar);
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index 41f3fac..fcfdbca 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -292,6 +292,8 @@ void ath10k_pci_enable_legacy_irq(struct ath10k *ar);
 bool ath10k_pci_irq_pending(struct ath10k *ar);
 void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar);
 int ath10k_pci_wait_for_target_init(struct ath10k *ar);
+int ath10k_pci_setup_resource(struct ath10k *ar);
+void ath10k_pci_release_reso

[PATCH 07/12] ath10k: add clock ctrl related functions in ahb

2016-01-27 Thread Raja Mani
pre qca4019 chipsets has/uses internal clock generator for
the operation. But, qca4019 uses external clocks supplied from
outside of target (ie, outside of wifi core). Three different clocks
(cmd clock, ref clock, rtc clock) comes into picture in qca4019.
All those clocks needs to configured with help of global clock
controller (gcc) to make qca4019 functioning.

Add functions for clock init/deinit, clock enable/disable in ahb.
This is just a preparation, functions added in this patch will be
used in later patches.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 123 ++
 drivers/net/wireless/ath/ath10k/ahb.h |   4 ++
 2 files changed, 127 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index eab4b47..11185c0 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -15,6 +15,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include 
+#include 
 #include "core.h"
 #include "debug.h"
 #include "pci.h"
@@ -84,6 +85,128 @@ static int ath10k_ahb_get_num_banks(struct ath10k *ar)
return 1;
 }
 
+static int ath10k_ahb_clock_init(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   struct device *dev;
+   int ret;
+
+   dev = _ahb->pdev->dev;
+
+   ar_ahb->cmd_clk = clk_get(dev, "wifi_wcss_cmd");
+   if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
+   ath10k_err(ar, "failed to get cmd clk: %ld\n",
+  PTR_ERR(ar_ahb->cmd_clk));
+   ret = ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
+   goto out;
+   }
+
+   ar_ahb->ref_clk = clk_get(dev, "wifi_wcss_ref");
+   if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) {
+   ath10k_err(ar, "failed to get ref clk: %ld\n",
+  PTR_ERR(ar_ahb->ref_clk));
+   ret = ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV;
+   goto err_cmd_clk_put;
+   }
+
+   ar_ahb->rtc_clk = clk_get(dev, "wifi_wcss_rtc");
+   if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
+   ath10k_err(ar, "failed to get rtc clk: %ld\n",
+  PTR_ERR(ar_ahb->rtc_clk));
+   ret = ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV;
+   goto err_ref_clk_put;
+   }
+
+   return 0;
+
+err_ref_clk_put:
+   clk_put(ar_ahb->ref_clk);
+
+err_cmd_clk_put:
+   clk_put(ar_ahb->cmd_clk);
+
+out:
+   return ret;
+}
+
+static void ath10k_ahb_clock_deinit(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->cmd_clk))
+   clk_put(ar_ahb->cmd_clk);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->ref_clk))
+   clk_put(ar_ahb->ref_clk);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->rtc_clk))
+   clk_put(ar_ahb->rtc_clk);
+
+   ar_ahb->cmd_clk = NULL;
+   ar_ahb->ref_clk = NULL;
+   ar_ahb->rtc_clk = NULL;
+}
+
+static int ath10k_ahb_clock_enable(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   struct device *dev;
+   int ret;
+
+   dev = _ahb->pdev->dev;
+
+   if (IS_ERR_OR_NULL(ar_ahb->cmd_clk) ||
+   IS_ERR_OR_NULL(ar_ahb->ref_clk) ||
+   IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
+   ath10k_err(ar, "clock(s) is/are not initialized\n");
+   ret = -EIO;
+   goto out;
+   }
+
+   ret = clk_prepare_enable(ar_ahb->cmd_clk);
+   if (ret) {
+   ath10k_err(ar, "failed to enable cmd clk: %d\n", ret);
+   goto out;
+   }
+
+   ret = clk_prepare_enable(ar_ahb->ref_clk);
+   if (ret) {
+   ath10k_err(ar, "failed to enable ref clk: %d\n", ret);
+   goto err_cmd_clk_disable;
+   }
+
+   ret = clk_prepare_enable(ar_ahb->rtc_clk);
+   if (ret) {
+   ath10k_err(ar, "failed to enable rtc clk: %d\n", ret);
+   goto err_ref_clk_disable;
+   }
+
+   return 0;
+
+err_ref_clk_disable:
+   clk_disable_unprepare(ar_ahb->ref_clk);
+
+err_cmd_clk_disable:
+   clk_disable_unprepare(ar_ahb->cmd_clk);
+
+out:
+   return ret;
+}
+
+static void ath10k_ahb_clock_disable(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->cmd_clk))
+   clk_disable_unprepare(ar_ahb->cmd_clk);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->ref_clk))
+   clk_disable_unprepare(ar_ahb->ref_clk);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->rtc_clk))
+   clk_disable_unprepa

[PATCH 01/12] ath10k: make some of ath10k_pci_* func reusable

2016-01-27 Thread Raja Mani
Some of static functions present in pci.c file are reusable
in ahb (qca4019) case. Remove static word for those reusable
functions and have those function prototype declaration in
pci.h file. So that, pci.h header file can be included in
ahb module and reused. There is no functionality changes done
in this patch.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 63 +--
 drivers/net/wireless/ath/ath10k/pci.h | 32 ++
 2 files changed, 63 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index ee925c6..956e548 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -94,7 +94,6 @@ 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_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);
 static int ath10k_pci_request_irq(struct ath10k *ar);
@@ -687,7 +686,7 @@ void ath10k_pci_reg_write32(struct ath10k *ar, u32 addr, 
u32 val)
ath10k_pci_write32(ar, PCIE_LOCAL_BASE_ADDRESS + addr, val);
 }
 
-static bool ath10k_pci_irq_pending(struct ath10k *ar)
+bool ath10k_pci_irq_pending(struct ath10k *ar)
 {
u32 cause;
 
@@ -700,7 +699,7 @@ static bool ath10k_pci_irq_pending(struct ath10k *ar)
return false;
 }
 
-static void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar)
+void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar)
 {
/* IMPORTANT: INTR_CLR register has to be set after
 * INTR_ENABLE is set to 0, otherwise interrupt can not be
@@ -716,7 +715,7 @@ static void ath10k_pci_disable_and_clear_legacy_irq(struct 
ath10k *ar)
PCIE_INTR_ENABLE_ADDRESS);
 }
 
-static void ath10k_pci_enable_legacy_irq(struct ath10k *ar)
+void ath10k_pci_enable_legacy_irq(struct ath10k *ar)
 {
ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS +
   PCIE_INTR_ENABLE_ADDRESS,
@@ -809,7 +808,7 @@ static void ath10k_pci_rx_post_pipe(struct ath10k_pci_pipe 
*pipe)
}
 }
 
-static void ath10k_pci_rx_post(struct ath10k *ar)
+void ath10k_pci_rx_post(struct ath10k *ar)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int i;
@@ -818,7 +817,7 @@ static void ath10k_pci_rx_post(struct ath10k *ar)
ath10k_pci_rx_post_pipe(_pci->pipe_info[i]);
 }
 
-static void ath10k_pci_rx_replenish_retry(unsigned long ptr)
+void ath10k_pci_rx_replenish_retry(unsigned long ptr)
 {
struct ath10k *ar = (void *)ptr;
 
@@ -1007,8 +1006,8 @@ static int __ath10k_pci_diag_read_hi(struct ath10k *ar, 
void *dest,
 #define ath10k_pci_diag_read_hi(ar, dest, src, len)\
__ath10k_pci_diag_read_hi(ar, dest, HI_ITEM(src), len)
 
-static int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
-const void *data, int nbytes)
+int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
+ const void *data, int nbytes)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int ret = 0;
@@ -1263,8 +1262,8 @@ static void ath10k_pci_htt_rx_cb(struct ath10k_ce_pipe 
*ce_state)
ath10k_pci_process_rx_cb(ce_state, ath10k_pci_htt_rx_deliver);
 }
 
-static int ath10k_pci_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
-   struct ath10k_hif_sg_item *items, int n_items)
+int ath10k_pci_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
+struct ath10k_hif_sg_item *items, int n_items)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct ath10k_pci_pipe *pci_pipe = _pci->pipe_info[pipe_id];
@@ -1332,13 +1331,13 @@ err:
return err;
 }
 
-static int ath10k_pci_hif_diag_read(struct ath10k *ar, u32 address, void *buf,
-   size_t buf_len)
+int ath10k_pci_hif_diag_read(struct ath10k *ar, u32 address, void *buf,
+size_t buf_len)
 {
return ath10k_pci_diag_read_mem(ar, address, buf, buf_len);
 }
 
-static u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe)
+u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 
@@ -1406,8 +1405,8 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
queue_work(ar->workqueue, >restart_work);
 }
 
-static void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
-  int force)
+void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
+   int force)
 {

[PATCH 05/12] ath10k: include qca4019 register map table

2016-01-27 Thread Raja Mani
New register table is added for qca4019 to tell about it's
register mapping details.

Nothing much other than this.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.c |  4 
 drivers/net/wireless/ath/ath10k/hw.c   | 39 ++
 drivers/net/wireless/ath/ath10k/hw.h   |  2 ++
 3 files changed, 45 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index b41eb3f..5c684e0 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1979,6 +1979,10 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
ar->regs = _regs;
ar->hw_values = _values;
break;
+   case ATH10K_HW_QCA4019:
+   ar->regs = _regs;
+   ar->hw_values = _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 7b84d08..f544d48 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -109,6 +109,38 @@ const struct ath10k_hw_regs qca99x0_regs = {
.pcie_intr_clr_address  = 0x0010,
 };
 
+const struct ath10k_hw_regs qca4019_regs = {
+   .rtc_soc_base_address   = 0x0008,
+   .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,
+   /* qca4019 supports upto 12 copy engines. Since base address
+* of ce8 to ce11 are not directly referred in the code,
+* no need have them in separate members in this 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,
+   .fw_indicator_address   = 0x0004f00c,
+   .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,
@@ -136,6 +168,13 @@ const struct ath10k_hw_values qca99x0_values = {
.ce_desc_meta_data_lsb  = 4,
 };
 
+const struct ath10k_hw_values qca4019_values = {
+   .ce_count   = 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,
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 f885015..f57a37b 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -233,6 +233,7 @@ struct ath10k_hw_regs {
 extern const struct ath10k_hw_regs qca988x_regs;
 extern const struct ath10k_hw_regs qca6174_regs;
 extern const struct ath10k_hw_regs qca99x0_regs;
+extern const struct ath10k_hw_regs qca4019_regs;
 
 struct ath10k_hw_values {
u32 rtc_state_val_on;
@@ -246,6 +247,7 @@ struct ath10k_hw_values {
 extern const struct ath10k_hw_values qca988x_values;
 extern const struct ath10k_hw_values qca6174_values;
 extern const struct ath10k_hw_values qca99x0_values;
+extern const struct ath10k_hw_values qca4019_values;
 
 void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev);
-- 
1.8.1.2

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


[PATCH 06/12] ath10k: add helper functions in ahb.c for reg rd/wr

2016-01-27 Thread Raja Mani
qca4019 deals with below register memory region to control the clock,
reset, etc.

- Memory to control wifi core
- gcc (outside of wifi)
- tcsr (outside of wifi)

Add new helper functions to perform read/write in above registers
spaces. Actual ioremap for above registers are done in later patch.
Struct ath10k_ahb is introduced to maintain ahb specific info and
memory this struct will be allocated in the continuation of struct
ath10k_pci (again, memory ath10k_ahb is allocated in the later patch).

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 55 +++
 drivers/net/wireless/ath/ath10k/ahb.h |  7 +
 drivers/net/wireless/ath/ath10k/pci.h |  6 
 3 files changed, 68 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index 129f4f4..eab4b47 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -17,6 +17,7 @@
 #include 
 #include "core.h"
 #include "debug.h"
+#include "pci.h"
 #include "ahb.h"
 
 static const struct of_device_id ath10k_ahb_of_match[] = {
@@ -29,6 +30,60 @@ static const struct of_device_id ath10k_ahb_of_match[] = {
 
 MODULE_DEVICE_TABLE(of, ath10k_ahb_of_match);
 
+static inline struct ath10k_ahb *ath10k_ahb_priv(struct ath10k *ar)
+{
+   return &((struct ath10k_pci *)ar->drv_priv)->ahb[0];
+}
+
+static void ath10k_ahb_write32(struct ath10k *ar, u32 offset, u32 value)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   iowrite32(value, ar_ahb->mem + offset);
+}
+
+static u32 ath10k_ahb_read32(struct ath10k *ar, u32 offset)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   return ioread32(ar_ahb->mem + offset);
+}
+
+static u32 ath10k_ahb_gcc_read32(struct ath10k *ar, u32 offset)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   return ioread32(ar_ahb->gcc_mem + offset);
+}
+
+static void ath10k_ahb_tcsr_write32(struct ath10k *ar, u32 offset, u32 value)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   iowrite32(value, ar_ahb->tcsr_mem + offset);
+}
+
+static u32 ath10k_ahb_tcsr_read32(struct ath10k *ar, u32 offset)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   return ioread32(ar_ahb->tcsr_mem + offset);
+}
+
+static u32 ath10k_ahb_soc_read32(struct ath10k *ar, u32 addr)
+{
+   return ath10k_ahb_read32(ar, RTC_SOC_BASE_ADDRESS + addr);
+}
+
+static int ath10k_ahb_get_num_banks(struct ath10k *ar)
+{
+   if (ar->hw_rev == ATH10K_HW_QCA4019)
+   return 1;
+
+   ath10k_warn(ar, "unknown number of banks, assuming 1\n");
+   return 1;
+}
+
 static int ath10k_ahb_probe(struct platform_device *pdev)
 {
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/ahb.h 
b/drivers/net/wireless/ath/ath10k/ahb.h
index d1afe93..77d15af 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.h
+++ b/drivers/net/wireless/ath/ath10k/ahb.h
@@ -20,6 +20,13 @@
 
 #include 
 
+struct ath10k_ahb {
+   struct platform_device *pdev;
+   void __iomem *mem;
+   void __iomem *gcc_mem;
+   void __iomem *tcsr_mem;
+};
+
 #ifdef CONFIG_ATH10K_AHB
 
 int ath10k_ahb_init(void);
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index c2d4a79..249c73a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -234,6 +234,12 @@ struct ath10k_pci {
bool pci_ps;
 
const struct ath10k_bus_ops *bus_ops;
+
+   /* Keep this entry in the last, memory for struct ath10k_ahb is
+* allocated (ahb support enabled case) in the continuation of
+* this struct.
+*/
+   struct ath10k_ahb ahb[0];
 };
 
 static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar)
-- 
1.8.1.2

--
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 00/12] add ahb (qca4019) support

2016-01-27 Thread Raja Mani
This patch series attempts to add ahb support (qca4019) in ath10k.
All ahb related ops are grouped and kept in new file called ahb.c/ahb.h 
and will get compiled/linked to ath10k_pci.ko based on kernel config flag
CONFIG_ATH10K_AHB flag. Most of function in pci.c file are reusable and
called as it's without changing function name (ath10k_pci_*) in ahb.c.

Still, some more work needs to be done in ath10k driver to make ahb
functional (qca4019). Hence, i disabled device probing in ahb module
for the time being. I'll post follow patch soon to enable it along
with missing patches.

The patch to update device tree bindings document with list of DT node
attributes referred in this patch series is already committed in ath.git,

  https://patchwork.kernel.org/patch/801/

Raja Mani (12):
  ath10k: make some of ath10k_pci_* func reusable
  ath10k: make ath10k_pci_read32/write32() ops more generic
  ath10k: pull reusable code from pci probe and remove for ahb
  ath10k: add basic skeleton to support ahb
  ath10k: include qca4019 register map table
  ath10k: add helper functions in ahb.c for reg rd/wr
  ath10k: add clock ctrl related functions in ahb
  ath10k: add reset ctrl related functions in ahb
  ath10k: add chip and bus halt logic in ahb
  ath10k: include irq related functions in ahb
  ath10k: add resource init and deinit in ahb
  ath10k: expose hif ops for ahb

 drivers/net/wireless/ath/ath10k/Kconfig  |   6 +
 drivers/net/wireless/ath/ath10k/Makefile |   2 +
 drivers/net/wireless/ath/ath10k/ahb.c| 933 +++
 drivers/net/wireless/ath/ath10k/ahb.h|  87 +++
 drivers/net/wireless/ath/ath10k/core.c   |   4 +
 drivers/net/wireless/ath/ath10k/core.h   |   3 +
 drivers/net/wireless/ath/ath10k/debug.h  |   1 +
 drivers/net/wireless/ath/ath10k/hw.c |  39 ++
 drivers/net/wireless/ath/ath10k/hw.h |   5 +
 drivers/net/wireless/ath/ath10k/pci.c| 169 --
 drivers/net/wireless/ath/ath10k/pci.h|  49 ++
 11 files changed, 1241 insertions(+), 57 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/ahb.c
 create mode 100644 drivers/net/wireless/ath/ath10k/ahb.h

-- 
1.8.1.2

--
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 08/12] ath10k: add reset ctrl related functions in ahb

2016-01-27 Thread Raja Mani
To perform reset on qca4019 wifi, multiple reset lines needs
to be toggled in a sequence with help of reset controller support
in the kernel. This patch adds functions to reset control init/deinit
and release reset.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/Kconfig |   2 +-
 drivers/net/wireless/ath/ath10k/ahb.c   | 138 
 drivers/net/wireless/ath/ath10k/ahb.h   |   6 ++
 3 files changed, 145 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/Kconfig 
b/drivers/net/wireless/ath/ath10k/Kconfig
index d7f207a..db1ca62 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -17,7 +17,7 @@ config ATH10K_PCI
 
 config ATH10K_AHB
bool "Atheros ath10k AHB support"
-   depends on ATH10K_PCI && OF
+   depends on ATH10K_PCI && OF && RESET_CONTROLLER
---help---
  This module adds support for AHB bus
 
diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index 11185c0..d1f1972 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -16,6 +16,7 @@
  */
 #include 
 #include 
+#include 
 #include "core.h"
 #include "debug.h"
 #include "pci.h"
@@ -207,6 +208,143 @@ static void ath10k_ahb_clock_disable(struct ath10k *ar)
clk_disable_unprepare(ar_ahb->rtc_clk);
 }
 
+static int ath10k_ahb_rst_ctrl_init(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   struct device *dev;
+   int ret;
+
+   dev = _ahb->pdev->dev;
+
+   ar_ahb->core_cold_rst = reset_control_get(dev, "wifi_core_cold");
+   if (IS_ERR_OR_NULL(ar_ahb->core_cold_rst)) {
+   ath10k_err(ar, "failed to get core cold rst ctrl: %ld\n",
+  PTR_ERR(ar_ahb->core_cold_rst));
+   ret = ar_ahb->core_cold_rst ?
+   PTR_ERR(ar_ahb->core_cold_rst) : -ENODEV;
+   goto out;
+   }
+
+   ar_ahb->radio_cold_rst = reset_control_get(dev, "wifi_radio_cold");
+   if (IS_ERR_OR_NULL(ar_ahb->radio_cold_rst)) {
+   ath10k_err(ar, "failed to get radio cold rst ctrl: %ld\n",
+  PTR_ERR(ar_ahb->radio_cold_rst));
+   ret = ar_ahb->radio_cold_rst ?
+   PTR_ERR(ar_ahb->radio_cold_rst) : -ENODEV;
+   goto err_core_cold_rst_put;
+   }
+
+   ar_ahb->radio_warm_rst = reset_control_get(dev, "wifi_radio_warm");
+   if (IS_ERR_OR_NULL(ar_ahb->radio_warm_rst)) {
+   ath10k_err(ar, "failed to get radio warm rst ctrl: %ld\n",
+  PTR_ERR(ar_ahb->radio_warm_rst));
+   ret = ar_ahb->radio_warm_rst ?
+   PTR_ERR(ar_ahb->radio_warm_rst) : -ENODEV;
+   goto err_radio_cold_rst_put;
+   }
+
+   ar_ahb->radio_srif_rst = reset_control_get(dev, "wifi_radio_srif");
+   if (IS_ERR_OR_NULL(ar_ahb->radio_srif_rst)) {
+   ath10k_err(ar, "failed to get radio srif rst ctrl: %ld\n",
+  PTR_ERR(ar_ahb->radio_srif_rst));
+   ret = ar_ahb->radio_srif_rst ?
+   PTR_ERR(ar_ahb->radio_srif_rst) : -ENODEV;
+   goto err_radio_warm_rst_put;
+   }
+
+   ar_ahb->cpu_init_rst = reset_control_get(dev, "wifi_cpu_init");
+   if (IS_ERR_OR_NULL(ar_ahb->cpu_init_rst)) {
+   ath10k_err(ar, "failed to get cpu init rst ctrl: %ld\n",
+  PTR_ERR(ar_ahb->cpu_init_rst));
+   ret = ar_ahb->cpu_init_rst ?
+   PTR_ERR(ar_ahb->cpu_init_rst) : -ENODEV;
+   goto err_radio_srif_rst_put;
+   }
+
+   return 0;
+
+err_radio_srif_rst_put:
+   reset_control_put(ar_ahb->radio_srif_rst);
+
+err_radio_warm_rst_put:
+   reset_control_put(ar_ahb->radio_warm_rst);
+
+err_radio_cold_rst_put:
+   reset_control_put(ar_ahb->radio_cold_rst);
+
+err_core_cold_rst_put:
+   reset_control_put(ar_ahb->core_cold_rst);
+
+out:
+   return ret;
+}
+
+static void ath10k_ahb_rst_ctrl_deinit(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->core_cold_rst))
+   reset_control_put(ar_ahb->core_cold_rst);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->radio_cold_rst))
+   reset_control_put(ar_ahb->radio_cold_rst);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->radio_warm_rst))
+   reset_control_put(ar_ahb->radio_warm_rst);
+
+   if (!IS_ERR_OR_NULL(ar_ahb->radio_srif_rst))
+   reset_control_put(ar_ahb->radio_sr

[PATCH 10/12] ath10k: include irq related functions in ahb

2016-01-27 Thread Raja Mani
Add irq related functions to register,handle,release,disable interrupt.

qca4019 supports msi interrupt, but it has the problem. Until the issue
gets sorted out, only legacy interrupt model is enabled and used.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 44 +++
 drivers/net/wireless/ath/ath10k/ahb.h |  2 ++
 2 files changed, 46 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index 2305078..29d0b6c 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -458,6 +458,50 @@ static void ath10k_ahb_halt_chip(struct ath10k *ar)
ath10k_dbg(ar, ATH10K_DBG_AHB, "core %d reset done\n", core_id);
 }
 
+static irqreturn_t ath10k_ahb_interrupt_handler(int irq, void *arg)
+{
+   struct ath10k *ar = arg;
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+
+   if (!ath10k_pci_irq_pending(ar))
+   return IRQ_NONE;
+
+   ath10k_pci_disable_and_clear_legacy_irq(ar);
+   tasklet_schedule(_pci->intr_tq);
+
+   return IRQ_HANDLED;
+}
+
+static int ath10k_ahb_request_irq_legacy(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   int ret;
+
+   ret = request_irq(ar_ahb->irq,
+ ath10k_ahb_interrupt_handler,
+ IRQF_SHARED, "ath10k_ahb", ar);
+   if (ret) {
+   ath10k_warn(ar, "failed to request legacy irq %d: %d\n",
+   ar_ahb->irq, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+static void ath10k_ahb_release_irq_legacy(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   free_irq(ar_ahb->irq, ar);
+}
+
+static void ath10k_ahb_irq_disable(struct ath10k *ar)
+{
+   ath10k_ce_disable_interrupts(ar);
+   ath10k_pci_disable_and_clear_legacy_irq(ar);
+}
+
 static int ath10k_ahb_probe(struct platform_device *pdev)
 {
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/ahb.h 
b/drivers/net/wireless/ath/ath10k/ahb.h
index 4761eeb..97c40e4 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.h
+++ b/drivers/net/wireless/ath/ath10k/ahb.h
@@ -26,6 +26,8 @@ struct ath10k_ahb {
void __iomem *gcc_mem;
void __iomem *tcsr_mem;
 
+   int irq;
+
struct clk *cmd_clk;
struct clk *ref_clk;
struct clk *rtc_clk;
-- 
1.8.1.2

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


[PATCH 09/12] ath10k: add chip and bus halt logic in ahb

2016-01-27 Thread Raja Mani
Add function to perform chip halt sequence and function to halt axi
bus in ahb module. Mainly used in the scenario like driver unload.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 113 ++
 drivers/net/wireless/ath/ath10k/ahb.h |  15 +
 2 files changed, 128 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index d1f1972..2305078 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -345,6 +345,119 @@ static int ath10k_ahb_release_reset(struct ath10k *ar)
return 0;
 }
 
+static void ath10k_ahb_halt_axi_bus(struct ath10k *ar, u32 haltreq_reg,
+   u32 haltack_reg)
+{
+   unsigned long timeout;
+   u32 val;
+
+   /* Issue halt axi bus request */
+   val = ath10k_ahb_tcsr_read32(ar, haltreq_reg);
+   val |= AHB_AXI_BUS_HALT_REQ;
+   ath10k_ahb_tcsr_write32(ar, haltreq_reg, val);
+
+   /* Wait for axi bus halted ack */
+   timeout = jiffies + msecs_to_jiffies(ATH10K_AHB_AXI_BUS_HALT_TIMEOUT);
+   do {
+   val = ath10k_ahb_tcsr_read32(ar, haltack_reg);
+   if (val & AHB_AXI_BUS_HALT_ACK)
+   break;
+
+   mdelay(1);
+   } while (time_before(jiffies, timeout));
+
+   if (!(val & AHB_AXI_BUS_HALT_ACK)) {
+   ath10k_err(ar, "failed to halt axi bus: %d\n", val);
+   return;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_AHB, "axi bus halted\n");
+}
+
+static void ath10k_ahb_halt_chip(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   u32 core_id, glb_cfg_reg, haltreq_reg, haltack_reg;
+   u32 val;
+   int ret;
+
+   if (IS_ERR_OR_NULL(ar_ahb->core_cold_rst) ||
+   IS_ERR_OR_NULL(ar_ahb->radio_cold_rst) ||
+   IS_ERR_OR_NULL(ar_ahb->radio_warm_rst) ||
+   IS_ERR_OR_NULL(ar_ahb->radio_srif_rst) ||
+   IS_ERR_OR_NULL(ar_ahb->cpu_init_rst)) {
+   ath10k_err(ar, "rst ctrl(s) is/are not initialized\n");
+   return;
+   }
+
+   core_id = ath10k_ahb_read32(ar, ATH10K_AHB_WLAN_CORE_ID_REG);
+
+   switch (core_id) {
+   case 0:
+   glb_cfg_reg = ATH10K_AHB_TCSR_WIFI0_GLB_CFG;
+   haltreq_reg = ATH10K_AHB_TCSR_WCSS0_HALTREQ;
+   haltack_reg = ATH10K_AHB_TCSR_WCSS0_HALTACK;
+   break;
+   case 1:
+   glb_cfg_reg = ATH10K_AHB_TCSR_WIFI1_GLB_CFG;
+   haltreq_reg = ATH10K_AHB_TCSR_WCSS1_HALTREQ;
+   haltack_reg = ATH10K_AHB_TCSR_WCSS1_HALTACK;
+   break;
+   default:
+   ath10k_err(ar, "invalid core id %d found, skipping reset 
sequence\n",
+  core_id);
+   return;
+   }
+
+   ath10k_ahb_halt_axi_bus(ar, haltreq_reg, haltack_reg);
+
+   val = ath10k_ahb_tcsr_read32(ar, glb_cfg_reg);
+   val |= TCSR_WIFIX_GLB_CFG_DISABLE_CORE_CLK;
+   ath10k_ahb_tcsr_write32(ar, glb_cfg_reg, val);
+
+   ret = reset_control_assert(ar_ahb->core_cold_rst);
+   if (ret)
+   ath10k_err(ar, "failed to assert core cold rst: %d\n", ret);
+   msleep(1);
+
+   ret = reset_control_assert(ar_ahb->radio_cold_rst);
+   if (ret)
+   ath10k_err(ar, "failed to assert radio cold rst: %d\n", ret);
+   msleep(1);
+
+   ret = reset_control_assert(ar_ahb->radio_warm_rst);
+   if (ret)
+   ath10k_err(ar, "failed to assert radio warm rst: %d\n", ret);
+   msleep(1);
+
+   ret = reset_control_assert(ar_ahb->radio_srif_rst);
+   if (ret)
+   ath10k_err(ar, "failed to assert radio srif rst: %d\n", ret);
+   msleep(1);
+
+   ret = reset_control_assert(ar_ahb->cpu_init_rst);
+   if (ret)
+   ath10k_err(ar, "failed to assert cpu init rst: %d\n", ret);
+   msleep(10);
+
+   /* Clear halt req and core clock disable req before
+* deasserting wifi core reset.
+*/
+   val = ath10k_ahb_tcsr_read32(ar, haltreq_reg);
+   val &= ~AHB_AXI_BUS_HALT_REQ;
+   ath10k_ahb_tcsr_write32(ar, haltreq_reg, val);
+
+   val = ath10k_ahb_tcsr_read32(ar, glb_cfg_reg);
+   val &= ~TCSR_WIFIX_GLB_CFG_DISABLE_CORE_CLK;
+   ath10k_ahb_tcsr_write32(ar, glb_cfg_reg, val);
+
+   ret = reset_control_deassert(ar_ahb->core_cold_rst);
+   if (ret)
+   ath10k_err(ar, "failed to deassert core cold rst: %d\n", ret);
+
+   ath10k_dbg(ar, ATH10K_DBG_AHB, "core %d reset done\n", core_id);
+}
+
 static int ath10k_ahb_probe(struct platform_device *pdev)
 {
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/ahb.h 
b/drivers/net/wire

[PATCH 11/12] ath10k: add resource init and deinit in ahb

2016-01-27 Thread Raja Mani
Add function to gather resources required for qca4019 to operate
(memory, irq, dma setting, clock init , rest control init) and
function release those resources when it's not needed.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 122 ++
 drivers/net/wireless/ath/ath10k/ahb.h |   7 ++
 2 files changed, 129 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index 29d0b6c..d83a864 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -15,6 +15,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include 
+#include 
+#include 
 #include 
 #include 
 #include "core.h"
@@ -502,6 +504,126 @@ static void ath10k_ahb_irq_disable(struct ath10k *ar)
ath10k_pci_disable_and_clear_legacy_irq(ar);
 }
 
+static int ath10k_ahb_resource_init(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   struct platform_device *pdev;
+   struct device *dev;
+   struct resource *res;
+   int ret;
+
+   pdev = ar_ahb->pdev;
+   dev = >dev;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   if (!res) {
+   ath10k_err(ar, "failed to get memory resource\n");
+   ret = -ENXIO;
+   goto out;
+   }
+
+   ar_ahb->mem = devm_ioremap_resource(>dev, res);
+   if (IS_ERR(ar_ahb->mem)) {
+   ath10k_err(ar, "mem ioremap error\n");
+   ret = PTR_ERR(ar_ahb->mem);
+   goto out;
+   }
+
+   ar_ahb->mem_len = resource_size(res);
+
+   ar_ahb->gcc_mem = ioremap_nocache(ATH10K_GCC_REG_BASE,
+ ATH10K_GCC_REG_SIZE);
+   if (!ar_ahb->gcc_mem) {
+   ath10k_err(ar, "gcc mem ioremap error\n");
+   ret = -ENOMEM;
+   goto err_mem_unmap;
+   }
+
+   ar_ahb->tcsr_mem = ioremap_nocache(ATH10K_TCSR_REG_BASE,
+  ATH10K_TCSR_REG_SIZE);
+   if (!ar_ahb->tcsr_mem) {
+   ath10k_err(ar, "tcsr mem ioremap error\n");
+   ret = -ENOMEM;
+   goto err_gcc_mem_unmap;
+   }
+
+   ret = dma_set_mask(>dev, DMA_BIT_MASK(32));
+   if (ret) {
+   ath10k_err(ar, "failed to set 32-bit dma mask: %d\n", ret);
+   goto err_tcsr_mem_unmap;
+   }
+
+   ret = dma_set_coherent_mask(>dev, DMA_BIT_MASK(32));
+   if (ret) {
+   ath10k_err(ar, "failed to set 32-bit consistent dma: %d\n",
+  ret);
+   goto err_tcsr_mem_unmap;
+   }
+
+   ret = ath10k_ahb_clock_init(ar);
+   if (ret)
+   goto err_tcsr_mem_unmap;
+
+   ret = ath10k_ahb_rst_ctrl_init(ar);
+   if (ret)
+   goto err_clock_deinit;
+
+   ar_ahb->irq = platform_get_irq_byname(pdev, "legacy");
+   if (ar_ahb->irq < 0) {
+   ath10k_err(ar, "failed to get irq number: %d\n", ar_ahb->irq);
+   goto err_clock_deinit;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "irq: %d\n", ar_ahb->irq);
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "mem: 0x%p mem_len: %lu gcc mem: 0x%p 
tcsr_mem: 0x%p\n",
+  ar_ahb->mem, ar_ahb->mem_len,
+  ar_ahb->gcc_mem, ar_ahb->tcsr_mem);
+   return 0;
+
+err_clock_deinit:
+   ath10k_ahb_clock_deinit(ar);
+
+err_tcsr_mem_unmap:
+   iounmap(ar_ahb->tcsr_mem);
+
+err_gcc_mem_unmap:
+   ar_ahb->tcsr_mem = NULL;
+   iounmap(ar_ahb->gcc_mem);
+
+err_mem_unmap:
+   ar_ahb->gcc_mem = NULL;
+   devm_iounmap(>dev, ar_ahb->mem);
+
+out:
+   ar_ahb->mem = NULL;
+   return ret;
+}
+
+static void ath10k_ahb_resource_deinit(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+   struct device *dev;
+
+   dev = _ahb->pdev->dev;
+
+   if (ar_ahb->mem)
+   devm_iounmap(dev, ar_ahb->mem);
+
+   if (ar_ahb->gcc_mem)
+   iounmap(ar_ahb->gcc_mem);
+
+   if (ar_ahb->tcsr_mem)
+   iounmap(ar_ahb->tcsr_mem);
+
+   ar_ahb->mem = NULL;
+   ar_ahb->gcc_mem = NULL;
+   ar_ahb->tcsr_mem = NULL;
+
+   ath10k_ahb_clock_deinit(ar);
+   ath10k_ahb_rst_ctrl_deinit(ar);
+}
+
 static int ath10k_ahb_probe(struct platform_device *pdev)
 {
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/ahb.h 
b/drivers/net/wireless/ath/ath10k/ahb.h
index 97c40e4..5bd01b4 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.h
+++ b/drivers/net/wireless/ath/ath10k/ahb.h
@@ -23,6 +23,7 @@
 struct ath10k_ahb {
struct platfor

[PATCH 12/12] ath10k: expose hif ops for ahb

2016-01-27 Thread Raja Mani
Like how pci.c exposes hif ops for the bus specific operation,
expose similar hif ops table for ahb with all required functions
linked to it. Many ath10k_pci_* functions are reused here in hif ops
table. If something is not sharable, new functions are added for ahb
and linked to hif ops table.

Finally, make ath10k_ahb_probe/remove() to perform what is expected
out of it.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 271 ++
 drivers/net/wireless/ath/ath10k/ahb.h |   5 +
 drivers/net/wireless/ath/ath10k/hw.h  |   1 +
 3 files changed, 277 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index d83a864..bd62bc1 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -624,13 +624,284 @@ static void ath10k_ahb_resource_deinit(struct ath10k *ar)
ath10k_ahb_rst_ctrl_deinit(ar);
 }
 
+static int ath10k_ahb_prepare_device(struct ath10k *ar)
+{
+   u32 val;
+   int ret;
+
+   ret = ath10k_ahb_clock_enable(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to enable clocks\n");
+   return ret;
+   }
+
+   /* Clock for the target is supplied from outside of target (ie,
+* external clock module controlled by the host). Target needs
+* to know what frequency target cpu is configured which is needed
+* for target internal use. Read target cpu frequency info from
+* gcc register and write into target's scratch register where
+* target expects this information.
+*/
+   val = ath10k_ahb_gcc_read32(ar, ATH10K_AHB_GCC_FEPLL_PLL_DIV);
+   ath10k_ahb_write32(ar, ATH10K_AHB_WIFI_SCRATCH_5_REG, val);
+
+   ret = ath10k_ahb_release_reset(ar);
+   if (ret)
+   goto err_clk_disable;
+
+   ath10k_ahb_irq_disable(ar);
+
+   ath10k_ahb_write32(ar, FW_INDICATOR_ADDRESS, FW_IND_HOST_READY);
+
+   ret = ath10k_pci_wait_for_target_init(ar);
+   if (ret)
+   goto err_halt_chip;
+
+   return 0;
+
+err_halt_chip:
+   ath10k_ahb_halt_chip(ar);
+
+err_clk_disable:
+   ath10k_ahb_clock_disable(ar);
+
+   return ret;
+}
+
+static int ath10k_ahb_chip_reset(struct ath10k *ar)
+{
+   int ret;
+
+   ath10k_ahb_halt_chip(ar);
+   ath10k_ahb_clock_disable(ar);
+
+   ret = ath10k_ahb_prepare_device(ar);
+   if (ret)
+   return ret;
+
+   return 0;
+}
+
+static int ath10k_ahb_wake_target_cpu(struct ath10k *ar)
+{
+   u32 addr, val;
+
+   addr = SOC_CORE_BASE_ADDRESS | CORE_CTRL_ADDRESS;
+   val = ath10k_ahb_read32(ar, addr);
+   val |= ATH10K_AHB_CORE_CTRL_CPU_INTR_MASK;
+   ath10k_ahb_write32(ar, addr, val);
+
+   return 0;
+}
+
+static int ath10k_ahb_hif_start(struct ath10k *ar)
+{
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot ahb hif start\n");
+
+   ath10k_ce_enable_interrupts(ar);
+   ath10k_pci_enable_legacy_irq(ar);
+
+   ath10k_pci_rx_post(ar);
+
+   return 0;
+}
+
+static void ath10k_ahb_hif_stop(struct ath10k *ar)
+{
+   struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar);
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot ahb hif stop\n");
+
+   ath10k_ahb_irq_disable(ar);
+   synchronize_irq(ar_ahb->irq);
+
+   ath10k_pci_flush(ar);
+}
+
+static int ath10k_ahb_hif_power_up(struct ath10k *ar)
+{
+   int ret;
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot ahb hif power up\n");
+
+   ret = ath10k_ahb_chip_reset(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to reset chip: %d\n", ret);
+   goto out;
+   }
+
+   ret = ath10k_pci_init_pipes(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to initialize CE: %d\n", ret);
+   goto out;
+   }
+
+   ret = ath10k_pci_init_config(ar);
+   if (ret) {
+   ath10k_err(ar, "failed to setup init config: %d\n", ret);
+   goto err_ce_deinit;
+   }
+
+   ret = ath10k_ahb_wake_target_cpu(ar);
+   if (ret) {
+   ath10k_err(ar, "could not wake up target CPU: %d\n", ret);
+   goto err_ce_deinit;
+   }
+
+   return 0;
+
+err_ce_deinit:
+   ath10k_pci_ce_deinit(ar);
+out:
+   return ret;
+}
+
+static const struct ath10k_hif_ops ath10k_ahb_hif_ops = {
+   .tx_sg  = ath10k_pci_hif_tx_sg,
+   .diag_read  = ath10k_pci_hif_diag_read,
+   .diag_write = ath10k_pci_diag_write_mem,
+   .exchange_bmi_msg   = ath10k_pci_hif_exchange_bmi_msg,
+   .start  = ath10k_ahb_hif_start,
+   .stop   = ath10k_ahb_hif_stop,
+   .map_service_to_pipe= ath10k_pci_hif_map_service_to_pipe,
+   .get_default_pipe   = ath10k_pci_hif_get_default_pipe,
+   .se

Re: [PATCH] dt: bindings: add bindings for ipq4019 wifi block

2015-12-30 Thread Raja Mani


On Wednesday 30 December 2015 10:05 PM, Rob Herring wrote:

On Wed, Dec 23, 2015 at 11:05:15AM +0530, Raja Mani wrote:

Add device tree binding documentation details for wifi block present
in Qualcomm IPQ4019 SoC into qcom,ath10k.txt.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
  .../bindings/net/wireless/qcom,ath10k.txt  | 87 --
  1 file changed, 82 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index edefc26..ffd0742 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -1,17 +1,42 @@
  * Qualcomm Atheros ath10k wireless devices

-For ath10k devices the calibration data can be provided through Device
-Tree. The node is a child node of the PCI controller.


So it is now not a PCI device?


Right now, ath10k wireless driver has support for PCI devices. There is
a plan to extend ath10k driver to support wifi devices which are 
connected over AHB as well (enumeration will happen via device tree node).


Qualcomm IPQ4019 SoC has two inbuilt wifi block which are connected over 
AHB bus (not connected over PCI bus) and also has one external PCI

slot where we can connect standalone wifi PCI devices.

In future, ath10k would support both PCI and AHB. For PCI based
devices, only calibration data is supplied via device tree. For AHB
based devices (ie, ipq4019), all wifi properties are supplied
via device tree (including irq, reg addr, cal data,etc).




-
  Required properties:
--compatible : Should be "qcom,ath10k"
+- compatible: Should be one of the following:
+   * "qcom,ath10k"
+   * "qcom,ipq4019-wifi"


One is a standalone PCI device and one is embedded block in an SOC?


Yes, it's possible to have this combination (one in SoC + one in
standalone PCI device in the same platform).


These should be more separated as all these new properties would only
apply in the latter case.


Sorry, i didn't get this point. I mentioned it under optional
properties. Whichever properties applies to particular wifi, only
those parameters are needed. For example, for PCI based devices,
only calibration data is needed, for AHB based devices most the
properties are needed.

Is it fine if add below text some thing like this ?

"only "qcom,ath10k-calibration-data" is applicable for PCI based
devices, rest of the members are applicable only for AHB based
devices"

Correct me if i am wrong.





  Optional properties:
+- reg: Address and length of the register set for the device.
+- core-id: Core number associated to the device.


This needs a better explanation.


Sure, Let me add below text in next version.

"core-id is numeric number associated to the wifi block.
 For example, 0 means first block, 1 means second wifi block,etc."




+- resets: Must contain an entry for each entry in reset-names.
+  See ../reset/reseti.txt for details.
+- reset-names: Must include the list of following reset names,
+  "wifi_cpu_init"
+  "wifi_radio_srif"
+  "wifi_radio_warm"
+  "wifi_radio_cold"
+  "wifi_core_warm"
+  "wifi_core_cold"
+- clocks: List of clock specifiers, must contain an entry for each required
+  entry in clock-names.
+- clock-names: Should contain the clock names "wifi_wcss_cmd", "wifi_wcss_ref",
+   "wifi_wcss_rtc".
+- interrupts: List of interrupt lines. Must contain an entry
+ for each entry in the interrupt-names property.
+- interrupt-names: Must include the entries for MSI interrupt
+  names ("msi0" to "msi15") and legacy interrupt
+  name ("legacy"),
+- qca,msi_addr: MSI interrupt address.
+- qca,msi_base: Base value to add before writing MSI data into
+   MSI address register.


Why don't the standard MSI properties work?


Standard msi controller mapping is not needed. Basically, msi property 
defined above just goes to the firmware runs in wifi block. Meaning, 
Driver will read it and push it to firmware. That's all.





  - qcom,ath10k-calibration-data : calibration data as an array, the
 length can vary between hw versions
+- status: Either "disabled" or "ok".
+


No need to document status here.


Sure, will remove it in next version.



Rob



Thanks for the review.

--
Raja
--
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] dt: bindings: add bindings for ipq4019 wifi block

2015-12-22 Thread Raja Mani
Add device tree binding documentation details for wifi block present
in Qualcomm IPQ4019 SoC into qcom,ath10k.txt.

Signed-off-by: Raja Mani <rm...@qti.qualcomm.com>
---
 .../bindings/net/wireless/qcom,ath10k.txt  | 87 --
 1 file changed, 82 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index edefc26..ffd0742 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -1,17 +1,42 @@
 * Qualcomm Atheros ath10k wireless devices
 
-For ath10k devices the calibration data can be provided through Device
-Tree. The node is a child node of the PCI controller.
-
 Required properties:
--compatible : Should be "qcom,ath10k"
+- compatible: Should be one of the following:
+   * "qcom,ath10k"
+   * "qcom,ipq4019-wifi"
 
 Optional properties:
+- reg: Address and length of the register set for the device.
+- core-id: Core number associated to the device.
+- resets: Must contain an entry for each entry in reset-names.
+  See ../reset/reseti.txt for details.
+- reset-names: Must include the list of following reset names,
+  "wifi_cpu_init"
+  "wifi_radio_srif"
+  "wifi_radio_warm"
+  "wifi_radio_cold"
+  "wifi_core_warm"
+  "wifi_core_cold"
+- clocks: List of clock specifiers, must contain an entry for each required
+  entry in clock-names.
+- clock-names: Should contain the clock names "wifi_wcss_cmd", "wifi_wcss_ref",
+   "wifi_wcss_rtc".
+- interrupts: List of interrupt lines. Must contain an entry
+ for each entry in the interrupt-names property.
+- interrupt-names: Must include the entries for MSI interrupt
+  names ("msi0" to "msi15") and legacy interrupt
+  name ("legacy"),
+- qca,msi_addr: MSI interrupt address.
+- qca,msi_base: Base value to add before writing MSI data into
+   MSI address register.
 - qcom,ath10k-calibration-data : calibration data as an array, the
 length can vary between hw versions
+- status: Either "disabled" or "ok".
+
 
+Example (to supply the calibration data alone):
 
-Example:
+In this example, the node is defined as child node of the PCI controller.
 
 pci {
pcie@0 {
@@ -28,3 +53,55 @@ pci {
};
};
 };
+
+Example (to supply ipq4019 SoC wifi block details):
+
+wifi0: wifi@a00 {
+   compatible = "qcom,ipq4019-wifi";
+   reg = <0xa00 0x20>;
+   core-id = <0x0>;
+   resets = < WIFI0_CPU_INIT_RESET>,
+< WIFI0_RADIO_SRIF_RESET>,
+< WIFI0_RADIO_WARM_RESET>,
+< WIFI0_RADIO_COLD_RESET>,
+< WIFI0_CORE_WARM_RESET>,
+< WIFI0_CORE_COLD_RESET>;
+   reset-names = "wifi_cpu_init",
+ "wifi_radio_srif",
+ "wifi_radio_warm",
+ "wifi_radio_cold",
+ "wifi_core_warm",
+ "wifi_core_cold";
+   clocks = < GCC_WCSS2G_CLK>,
+< GCC_WCSS2G_REF_CLK>,
+< GCC_WCSS2G_RTC_CLK>;
+   clock-names = "wifi_wcss_cmd",
+ "wifi_wcss_ref",
+ "wifi_wcss_rtc";
+   interrupts = <0 0x20 0x1>,
+<0 0x21 0x1>,
+<0 0x22 0x1>,
+<0 0x23 0x1>,
+<0 0x24 0x1>,
+<0 0x25 0x1>,
+<0 0x26 0x1>,
+<0 0x27 0x1>,
+<0 0x28 0x1>,
+<0 0x29 0x1>,
+<0 0x2a 0x1>,
+<0 0x2b 0x1>,
+<0 0x2c 0x1>,
+<0 0x2d 0x1>,
+<0 0x2e 0x1>,
+<0 0x2f 0x1>,
+<0 0xa8 0x0>;
+   interrupt-names = "msi0",  "msi1",  "msi2",  "msi3",
+ "msi4",  "msi5",  "msi6",  "msi7",
+ "msi8",  "msi9",  "msi10", "msi11",
+ "msi12", "msi13", "msi14", "msi15",
+ "legacy";
+   status = "ok";
+   qca,msi_addr = <0x0b006040>;
+   qca,msi_base = <0x40>;
+   qcom,ath10k-calibration-data = [ 01 02 03 ... ];
+};
-- 
1.8.1.2

--
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] ath10k: Fix compilation warnings in wmi phyerr pull function

2015-08-21 Thread Raja Mani
Below compilation warnings are observed in gcc version 4.8.2.
Even though it's not seen in bit older gcc versions (for ex, 4.7.3),
It's good to fix it by changing format specifier from %d to
%zd in wmi pull phyerr functions.

wmi.c: In function 'ath10k_wmi_op_pull_phyerr_ev':
wmi.c:3567:8: warning: format '%d' expects argument of type 'int',
  but argument 4 has type 'long unsigned int' [-Wformat=]
  left_len, sizeof(*phyerr));
^
wmi.c: In function 'ath10k_wmi_10_4_op_pull_phyerr_ev':
wmi.c:3612:8: warning: format '%d' expects argument of type 'int',
  but argument 4 has type 'long unsigned int' [-Wformat=]
  left_len, sizeof(*phyerr));
^
Fixes: 991adf71a6cd (ath10k: refactor phyerr event handlers)
Fixes: 2b0a2e0d7c2f (ath10k: handle 10.4 firmware phyerr event)

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 42c0aba..fe150e8 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3563,7 +3563,7 @@ int ath10k_wmi_op_pull_phyerr_ev(struct ath10k *ar,
int i;
 
if (left_len  sizeof(*phyerr)) {
-   ath10k_warn(ar, wrong phyerr event head len %d (need: =%d)\n,
+   ath10k_warn(ar, wrong phyerr event head len %d (need: 
=%zd)\n,
left_len, sizeof(*phyerr));
return -EINVAL;
}
@@ -3608,7 +3608,7 @@ static int ath10k_wmi_10_4_op_pull_phyerr_ev(struct 
ath10k *ar,
int i;
 
if (left_len  sizeof(*phyerr)) {
-   ath10k_warn(ar, wrong phyerr event head len %d (need: =%d)\n,
+   ath10k_warn(ar, wrong phyerr event head len %d (need: 
=%zd)\n,
left_len, sizeof(*phyerr));
return -EINVAL;
}
-- 
1.8.1.2

--
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] ath10k: Add spectral scan support for 10.4 fw

2015-08-19 Thread Raja Mani
To enable/configure spectral scan parameters in 10.4 firmware, existing
wmi spectral related functions can be reused. Link those functions in
10.4 wmi ops table.

In addition, adjust bin size (only when size is 68 bytes) before reporting
bin samples to user space. The background for this adjustment is that
qca99x0 reports bin size as 68 bytes (64 bytes + 4 bytes) in report
mode 2. First 64 bytes carries in-band tones (-32 to +31) and last 4 byte
carries band edge detection data (+32) mainly used in radar detection
purpose. Additional last 4 bytes are stripped to make bin size valid one.

This bin size adjustment will happen only for qca99x0, all other chipsets
will report proper bin sizes (64/128) without extra 4 bytes being added
at the end. The changes are validated in qca99x0 using 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/spectral.c | 9 +
 drivers/net/wireless/ath/ath10k/wmi.c  | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/spectral.c 
b/drivers/net/wireless/ath/ath10k/spectral.c
index e4219b1..4671cfb 100644
--- a/drivers/net/wireless/ath/ath10k/spectral.c
+++ b/drivers/net/wireless/ath/ath10k/spectral.c
@@ -73,6 +73,15 @@ int ath10k_spectral_process_fft(struct ath10k *ar,
if (bin_len  64 || bin_len  SPECTRAL_ATH10K_MAX_NUM_BINS)
return -EINVAL;
 
+   /* qca99x0 reports bin size as 68 bytes (64 bytes + 4 bytes) in
+* report mode 2. First 64 bytes carries inband tones (-32 to +31)
+* and last 4 byte carries band edge detection data (+32) mainly
+* used in radar detection purpose. Strip last 4 byte to make bin
+* size is valid one.
+*/
+   if (bin_len == 68)
+   bin_len -= 4;
+
reg0 = __le32_to_cpu(fftr-reg0);
reg1 = __le32_to_cpu(fftr-reg1);
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 42c0aba..5d19c87 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -6581,6 +6581,8 @@ static const struct wmi_ops wmi_10_4_ops = {
.gen_vdev_down = ath10k_wmi_op_gen_vdev_down,
.gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param,
.gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key,
+   .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf,
+   .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable,
.gen_peer_create = ath10k_wmi_op_gen_peer_create,
.gen_peer_delete = ath10k_wmi_op_gen_peer_delete,
.gen_peer_flush = ath10k_wmi_op_gen_peer_flush,
-- 
1.8.1.2

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


[PATCH v2 2/2] ath10k: handle 10.4 firmware phyerr event

2015-08-13 Thread Raja Mani
Header format of 10.4 firmware phyerr event is not alligned
with pre 10.4 firmware. Introduce new wmi handlers to parse
10.4 firmware specific phyerror event header.

With changes covered in this patch, radar detection works on
qca9x0 hw 2.0 which uses 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---

v2 changes:

 - Fixed below sparse warnings,
 wmi.c:3620:33: warning: restricted __le32 degrades to integer
 wmi.c:3622:38: warning: restricted __le32 degrades to integer
 wmi.c:3594:5: warning: symbol 'ath10k_wmi_10_4_op_pull_phyerr_ev' was not 
declared. Should it be static?

 drivers/net/wireless/ath/ath10k/wmi.c | 64 +++
 drivers/net/wireless/ath/ath10k/wmi.h | 20 +++
 2 files changed, 84 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 37dfa34..aad16eb 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3527,6 +3527,26 @@ static int ath10k_wmi_op_pull_phyerr_ev_hdr(struct 
ath10k *ar,
return 0;
 }
 
+static int ath10k_wmi_10_4_op_pull_phyerr_ev_hdr(struct ath10k *ar,
+struct sk_buff *skb,
+struct wmi_phyerr_hdr_arg *arg)
+{
+   struct wmi_10_4_phyerr_event *ev = (void *)skb-data;
+
+   if (skb-len  sizeof(*ev))
+   return -EPROTO;
+
+   /* 10.4 firmware always reports only one phyerr */
+   arg-num_phyerrs = 1;
+
+   arg-tsf_l32 = __le32_to_cpu(ev-tsf_l32);
+   arg-tsf_u32 = __le32_to_cpu(ev-tsf_u32);
+   arg-buf_len = skb-len;
+   arg-phyerrs = skb-data;
+
+   return 0;
+}
+
 int ath10k_wmi_op_pull_phyerr_ev(struct ath10k *ar,
 const void *phyerr_buf,
 int left_len,
@@ -3571,6 +3591,45 @@ int ath10k_wmi_op_pull_phyerr_ev(struct ath10k *ar,
return 0;
 }
 
+static int ath10k_wmi_10_4_op_pull_phyerr_ev(struct ath10k *ar,
+const void *phyerr_buf,
+int left_len,
+struct wmi_phyerr_ev_arg *arg)
+{
+   const struct wmi_10_4_phyerr_event *phyerr = phyerr_buf;
+   u32 phy_err_mask;
+   int i;
+
+   if (left_len  sizeof(*phyerr)) {
+   ath10k_warn(ar, wrong phyerr event head len %d (need: =%d)\n,
+   left_len, sizeof(*phyerr));
+   return -EINVAL;
+   }
+
+   arg-tsf_timestamp = __le32_to_cpu(phyerr-tsf_timestamp);
+   arg-freq1 = __le16_to_cpu(phyerr-freq1);
+   arg-freq2 = __le16_to_cpu(phyerr-freq2);
+   arg-rssi_combined = phyerr-rssi_combined;
+   arg-chan_width_mhz = phyerr-chan_width_mhz;
+   arg-buf_len = __le32_to_cpu(phyerr-buf_len);
+   arg-buf = phyerr-buf;
+   arg-hdr_len = sizeof(*phyerr);
+
+   for (i = 0; i  4; i++)
+   arg-nf_chains[i] = __le16_to_cpu(phyerr-nf_chains[i]);
+
+   phy_err_mask = __le32_to_cpu(phyerr-phy_err_mask[0]);
+
+   if (phy_err_mask  PHY_ERROR_10_4_SPECTRAL_SCAN_MASK)
+   arg-phy_err_code = PHY_ERROR_SPECTRAL_SCAN;
+   else if (phy_err_mask  PHY_ERROR_10_4_RADAR_MASK)
+   arg-phy_err_code = PHY_ERROR_RADAR;
+   else
+   arg-phy_err_code = PHY_ERROR_UNKNOWN;
+
+   return 0;
+}
+
 void ath10k_wmi_event_phyerr(struct ath10k *ar, struct sk_buff *skb)
 {
struct wmi_phyerr_hdr_arg hdr_arg = {};
@@ -4528,6 +4587,9 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
case WMI_10_4_CHAN_INFO_EVENTID:
ath10k_wmi_event_chan_info(ar, skb);
break;
+   case WMI_10_4_PHYERR_EVENTID:
+   ath10k_wmi_event_phyerr(ar, skb);
+   break;
case WMI_10_4_READY_EVENTID:
ath10k_wmi_event_ready(ar, skb);
break;
@@ -6491,6 +6553,8 @@ static const struct wmi_ops wmi_10_4_ops = {
.pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev,
.pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev,
.pull_swba = ath10k_wmi_10_4_op_pull_swba_ev,
+   .pull_phyerr_hdr = ath10k_wmi_10_4_op_pull_phyerr_ev_hdr,
+   .pull_phyerr = ath10k_wmi_10_4_op_pull_phyerr_ev,
.pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev,
.pull_rdy = ath10k_wmi_op_pull_rdy_ev,
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 0ed3cfe..c5d10db 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2977,6 +2977,9 @@ struct wmi_10_4_mgmt_rx_event {
 #define PHY_ERROR_GEN_FALSE_RADAR_EXT  0x24
 #define PHY_ERROR_GEN_RADAR0x05
 
+#define PHY_ERROR_10_4_RADAR_MASK   0x4
+#define PHY_ERROR_10_4_SPECTRAL_SCAN_MASK   0x400
+
 enum

[PATCH 2/2] ath10k: handle 10.4 firmware phyerr event

2015-08-12 Thread Raja Mani
Header format of 10.4 firmware phyerr event is not alligned
with pre 10.4 firmware. Introduce new wmi handlers to parse
10.4 firmware specific phyerror event header.

With changes covered in this patch, radar detection works on
qca99x0 hw 2.0 which uses 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi.c | 61 +++
 drivers/net/wireless/ath/ath10k/wmi.h | 20 
 2 files changed, 81 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 37dfa34..153fd17 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3527,6 +3527,26 @@ static int ath10k_wmi_op_pull_phyerr_ev_hdr(struct 
ath10k *ar,
return 0;
 }
 
+static int ath10k_wmi_10_4_op_pull_phyerr_ev_hdr(struct ath10k *ar,
+struct sk_buff *skb,
+struct wmi_phyerr_hdr_arg *arg)
+{
+   struct wmi_10_4_phyerr_event *ev = (void *)skb-data;
+
+   if (skb-len  sizeof(*ev))
+   return -EPROTO;
+
+   /* 10.4 firmware always reports only one phyerr */
+   arg-num_phyerrs = 1;
+
+   arg-tsf_l32 = __le32_to_cpu(ev-tsf_l32);
+   arg-tsf_u32 = __le32_to_cpu(ev-tsf_u32);
+   arg-buf_len = skb-len;
+   arg-phyerrs = skb-data;
+
+   return 0;
+}
+
 int ath10k_wmi_op_pull_phyerr_ev(struct ath10k *ar,
 const void *phyerr_buf,
 int left_len,
@@ -3571,6 +3591,42 @@ int ath10k_wmi_op_pull_phyerr_ev(struct ath10k *ar,
return 0;
 }
 
+int ath10k_wmi_10_4_op_pull_phyerr_ev(struct ath10k *ar,
+ const void *phyerr_buf,
+ int left_len,
+ struct wmi_phyerr_ev_arg *arg)
+{
+   const struct wmi_10_4_phyerr_event *phyerr = phyerr_buf;
+   int i;
+
+   if (left_len  sizeof(*phyerr)) {
+   ath10k_warn(ar, wrong phyerr event head len %d (need: =%d)\n,
+   left_len, sizeof(*phyerr));
+   return -EINVAL;
+   }
+
+   arg-tsf_timestamp = __le32_to_cpu(phyerr-tsf_timestamp);
+   arg-freq1 = __le16_to_cpu(phyerr-freq1);
+   arg-freq2 = __le16_to_cpu(phyerr-freq2);
+   arg-rssi_combined = phyerr-rssi_combined;
+   arg-chan_width_mhz = phyerr-chan_width_mhz;
+   arg-buf_len = __le32_to_cpu(phyerr-buf_len);
+   arg-buf = phyerr-buf;
+   arg-hdr_len = sizeof(*phyerr);
+
+   for (i = 0; i  4; i++)
+   arg-nf_chains[i] = __le16_to_cpu(phyerr-nf_chains[i]);
+
+   if (phyerr-phy_err_mask[0]  PHY_ERROR_10_4_SPECTRAL_SCAN_MASK)
+   arg-phy_err_code = PHY_ERROR_SPECTRAL_SCAN;
+   else if (phyerr-phy_err_mask[0]  PHY_ERROR_10_4_RADAR_MASK)
+   arg-phy_err_code = PHY_ERROR_RADAR;
+   else
+   arg-phy_err_code = PHY_ERROR_UNKNOWN;
+
+   return 0;
+}
+
 void ath10k_wmi_event_phyerr(struct ath10k *ar, struct sk_buff *skb)
 {
struct wmi_phyerr_hdr_arg hdr_arg = {};
@@ -4528,6 +4584,9 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
case WMI_10_4_CHAN_INFO_EVENTID:
ath10k_wmi_event_chan_info(ar, skb);
break;
+   case WMI_10_4_PHYERR_EVENTID:
+   ath10k_wmi_event_phyerr(ar, skb);
+   break;
case WMI_10_4_READY_EVENTID:
ath10k_wmi_event_ready(ar, skb);
break;
@@ -6491,6 +6550,8 @@ static const struct wmi_ops wmi_10_4_ops = {
.pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev,
.pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev,
.pull_swba = ath10k_wmi_10_4_op_pull_swba_ev,
+   .pull_phyerr_hdr = ath10k_wmi_10_4_op_pull_phyerr_ev_hdr,
+   .pull_phyerr = ath10k_wmi_10_4_op_pull_phyerr_ev,
.pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev,
.pull_rdy = ath10k_wmi_op_pull_rdy_ev,
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 0ed3cfe..c5d10db 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2977,6 +2977,9 @@ struct wmi_10_4_mgmt_rx_event {
 #define PHY_ERROR_GEN_FALSE_RADAR_EXT  0x24
 #define PHY_ERROR_GEN_RADAR0x05
 
+#define PHY_ERROR_10_4_RADAR_MASK   0x4
+#define PHY_ERROR_10_4_SPECTRAL_SCAN_MASK   0x400
+
 enum phy_err_type {
PHY_ERROR_UNKNOWN,
PHY_ERROR_SPECTRAL_SCAN,
@@ -3005,6 +3008,23 @@ struct wmi_phyerr_event {
struct wmi_phyerr phyerrs[0];
 } __packed;
 
+struct wmi_10_4_phyerr_event {
+   __le32 tsf_l32;
+   __le32 tsf_u32;
+   __le16 freq1;
+   __le16 freq2;
+   u8 rssi_combined;
+   u8 chan_width_mhz;
+   u8 phy_err_code;
+   u8 rsvd0

[PATCH 1/2] ath10k: refactor phyerr event handlers

2015-08-12 Thread Raja Mani
Existing phyerr event handlers directly uses phyerr header format
(ie, struct wmi_phyerr and struct wmi_phyerr_event) in the code
exactly on how firmware packs it. This is the problem in 10.4 fw
specific phyerr event handling where it uses different phyerror
header format. Before adding 10.4 specific handler, little bit of
refactor is done in existing phyerr handlers.

Two new abstracted structures (struct wmi_phyerr_ev_hdr_arg and
struct wmi_phyerr_ev_arg) are introduced to remove dependency of using
firmware specific header format in the code. So that firmware specific
phyerror handlers can populate values to abstracted structures and
the following code can use abstracted struct for further operation.

.pull_phyerr_hdr is added newly to pull common phyerr header info
like tsf, buf_len, number of phyerr packed. Existing .pull_phyerr
handler is changed and called to parse every sub phyerrs in the event.

Validated these refactoring on qca988x hw2.0 using fw 10.2.4 version.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/spectral.c |   9 +--
 drivers/net/wireless/ath/ath10k/spectral.h |   4 +-
 drivers/net/wireless/ath/ath10k/wmi-ops.h  |  22 --
 drivers/net/wireless/ath/ath10k/wmi-tlv.c  |  17 ++--
 drivers/net/wireless/ath/ath10k/wmi.c  | 121 -
 drivers/net/wireless/ath/ath10k/wmi.h  |  43 +++---
 6 files changed, 149 insertions(+), 67 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/spectral.c 
b/drivers/net/wireless/ath/ath10k/spectral.c
index 8dcd424..e4219b1 100644
--- a/drivers/net/wireless/ath/ath10k/spectral.c
+++ b/drivers/net/wireless/ath/ath10k/spectral.c
@@ -57,7 +57,7 @@ static uint8_t get_max_exp(s8 max_index, u16 max_magnitude, 
size_t bin_len,
 }
 
 int ath10k_spectral_process_fft(struct ath10k *ar,
-   const struct wmi_phyerr *phyerr,
+   struct wmi_phyerr_ev_arg *phyerr,
const struct phyerr_fft_report *fftr,
size_t bin_len, u64 tsf)
 {
@@ -118,15 +118,14 @@ int ath10k_spectral_process_fft(struct ath10k *ar,
fft_sample-total_gain_db = __cpu_to_be16(total_gain_db);
fft_sample-base_pwr_db = __cpu_to_be16(base_pwr_db);
 
-   freq1 = __le16_to_cpu(phyerr-freq1);
-   freq2 = __le16_to_cpu(phyerr-freq2);
+   freq1 = phyerr-freq1;
+   freq2 = phyerr-freq2;
fft_sample-freq1 = __cpu_to_be16(freq1);
fft_sample-freq2 = __cpu_to_be16(freq2);
 
chain_idx = MS(reg0, SEARCH_FFT_REPORT_REG0_FFT_CHN_IDX);
 
-   fft_sample-noise = __cpu_to_be16(
-   __le16_to_cpu(phyerr-nf_chains[chain_idx]));
+   fft_sample-noise = __cpu_to_be16(phyerr-nf_chains[chain_idx]);
 
bins = (u8 *)fftr;
bins += sizeof(*fftr);
diff --git a/drivers/net/wireless/ath/ath10k/spectral.h 
b/drivers/net/wireless/ath/ath10k/spectral.h
index 042f5b3..89b0ad7 100644
--- a/drivers/net/wireless/ath/ath10k/spectral.h
+++ b/drivers/net/wireless/ath/ath10k/spectral.h
@@ -47,7 +47,7 @@ enum ath10k_spectral_mode {
 #ifdef CONFIG_ATH10K_DEBUGFS
 
 int ath10k_spectral_process_fft(struct ath10k *ar,
-   const struct wmi_phyerr *phyerr,
+   struct wmi_phyerr_ev_arg *phyerr,
const struct phyerr_fft_report *fftr,
size_t bin_len, u64 tsf);
 int ath10k_spectral_start(struct ath10k *ar);
@@ -59,7 +59,7 @@ void ath10k_spectral_destroy(struct ath10k *ar);
 
 static inline int
 ath10k_spectral_process_fft(struct ath10k *ar,
-   const struct wmi_phyerr *phyerr,
+   struct wmi_phyerr_ev_arg *phyerr,
const struct phyerr_fft_report *fftr,
size_t bin_len, u64 tsf)
 {
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 47fe2e7..01629c9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -37,8 +37,10 @@ struct wmi_ops {
  struct wmi_peer_kick_ev_arg *arg);
int (*pull_swba)(struct ath10k *ar, struct sk_buff *skb,
 struct wmi_swba_ev_arg *arg);
-   int (*pull_phyerr)(struct ath10k *ar, struct sk_buff *skb,
-  struct wmi_phyerr_ev_arg *arg);
+   int (*pull_phyerr_hdr)(struct ath10k *ar, struct sk_buff *skb,
+  struct wmi_phyerr_hdr_arg *arg);
+   int (*pull_phyerr)(struct ath10k *ar, const void *phyerr_buf,
+  int left_len, struct wmi_phyerr_ev_arg *arg);
int (*pull_svc_rdy)(struct ath10k *ar, struct sk_buff *skb,
struct wmi_svc_rdy_ev_arg *arg);
int (*pull_rdy)(struct ath10k *ar, struct sk_buff *skb,
@@ -260,13 +262,23 @@ ath10k_wmi_pull_swba

[PATCH] ath10k: Extend struct htt_mgmt_tx_dec for qca99x0

2015-07-20 Thread Raja Mani
HTT_H2T_MSG_TYPE_MGMT_TX msg in 10.4 firmware carries additional
4 byte in htt_mgmt_tx_desc where it tells to firmware that at what
rate mgmt frame has to go out in the air. It's an optional parameter,
setting this field to zero will force firmware to choose auto rate
and send the frame out.

Those 4 byte info is missed out in the current code and 10.4 firmware
ended up reading some junk in those 4 byte and sometime malfunctioning.

Fix it by adding 4 byte in struct htt_mgmt_tx_desc. Non 10.4 firmware
will not process those four byte. So, adding 4 byte at the end of
struct htt_mgmt_tx_desc will not create any impact on other chipset.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/htt.h| 6 ++
 drivers/net/wireless/ath/ath10k/htt_tx.c | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index 8bdf1e7..d4b6415 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -260,6 +260,9 @@ struct htt_aggr_conf {
 } __packed;
 
 #define HTT_MGMT_FRM_HDR_DOWNLOAD_LEN 32
+struct htt_mgmt_tx_desc_qca99x0 {
+   __le32 rate;
+} __packed;
 
 struct htt_mgmt_tx_desc {
u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)];
@@ -268,6 +271,9 @@ struct htt_mgmt_tx_desc {
__le32 len;
__le32 vdev_id;
u8 hdr[HTT_MGMT_FRM_HDR_DOWNLOAD_LEN];
+   union {
+   struct htt_mgmt_tx_desc_qca99x0 qca99x0;
+   } __packed;
 } __packed;
 
 enum htt_mgmt_tx_status {
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 148d5b6..73b0c42 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -448,6 +448,8 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct 
sk_buff *msdu)
 
skb_put(txdesc, len);
cmd = (struct htt_cmd *)txdesc-data;
+   memset(cmd, 0, len);
+
cmd-hdr.msg_type = HTT_H2T_MSG_TYPE_MGMT_TX;
cmd-mgmt_tx.msdu_paddr = __cpu_to_le32(ATH10K_SKB_CB(msdu)-paddr);
cmd-mgmt_tx.len= __cpu_to_le32(msdu-len);
-- 
1.8.1.2

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


[PATCH 1/2] ath10k: Fix memory alloc failure in qca99x0 during wmi svc rdy event

2015-07-20 Thread Raja Mani
Host memory required for firmware is allocated while handling
wmi service ready event. Right now, wmi service ready is handled
in tasklet context and it calls dma_alloc_coherent() with atomic
flag (GFP_ATOMIC) to allocate memory in host needed for firmware.
The problem is, dma_alloc_coherent() with GFP_ATOMIC fails in
the platform (at least in AP platform) where it has less atomic
pool memory ( 2mb). QCA99X0 requires around 2 MB of host memory
for one card, having additional QCA99X0 card in the same platform
will require similarly amount of memory. So, it's not guaranteed that
all the platform will have enough atomic memory pool.

Fix this issue, by handling wmi service ready event in workqueue
context and calling dma_alloc_coherent() with GFP_KERNEL. mac80211 work
queue will not be ready at the time of handling wmi service ready.
So, it can't be used to handle wmi service ready. Also, register work
gets scheduled during insmod in existing ath10k_wq and waits for
wmi service ready to completed. Both workqueue can't be used for
this purpose. New auxiliary workqueue is added to handle wmi service
ready.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c| 11 +-
 drivers/net/wireless/ath/ath10k/core.h|  5 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  2 +-
 drivers/net/wireless/ath/ath10k/wmi.c | 34 +--
 4 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index f79fa6c..b037c34 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1606,6 +1606,10 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
if (!ar-workqueue)
goto err_free_mac;
 
+   ar-workqueue_aux = create_singlethread_workqueue(ath10k_aux_wq);
+   if (!ar-workqueue_aux)
+   goto err_free_wq;
+
mutex_init(ar-conf_mutex);
spin_lock_init(ar-data_lock);
 
@@ -1626,10 +1630,12 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
 
ret = ath10k_debug_create(ar);
if (ret)
-   goto err_free_wq;
+   goto err_free_aux_wq;
 
return ar;
 
+err_free_aux_wq:
+   destroy_workqueue(ar-workqueue_aux);
 err_free_wq:
destroy_workqueue(ar-workqueue);
 
@@ -1645,6 +1651,9 @@ void ath10k_core_destroy(struct ath10k *ar)
flush_workqueue(ar-workqueue);
destroy_workqueue(ar-workqueue);
 
+   flush_workqueue(ar-workqueue_aux);
+   destroy_workqueue(ar-workqueue_aux);
+
ath10k_debug_destroy(ar);
ath10k_mac_destroy(ar);
 }
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 78e0705..08b0972 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -673,6 +673,8 @@ struct ath10k {
struct completion vdev_setup_done;
 
struct workqueue_struct *workqueue;
+   /* Auxiliary workqueue */
+   struct workqueue_struct *workqueue_aux;
 
/* prevents concurrent FW reconfiguration */
struct mutex conf_mutex;
@@ -695,6 +697,9 @@ struct ath10k {
int num_active_peers;
int num_tids;
 
+   struct work_struct svc_rdy_work;
+   struct sk_buff *svc_rdy_skb;
+
struct work_struct offchan_tx_work;
struct sk_buff_head offchan_tx_queue;
struct completion offchan_tx_completed;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 4189d4a..d9832dc 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -519,7 +519,7 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct 
sk_buff *skb)
break;
case WMI_TLV_SERVICE_READY_EVENTID:
ath10k_wmi_event_service_ready(ar, skb);
-   break;
+   return;
case WMI_TLV_READY_EVENTID:
ath10k_wmi_event_ready(ar, skb);
break;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 0791a43..dc85355 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3789,7 +3789,7 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, 
u32 req_id,
ar-wmi.mem_chunks[idx].vaddr = dma_alloc_coherent(ar-dev,
   pool_size,
   paddr,
-  GFP_ATOMIC);
+  GFP_KERNEL);
if (!ar-wmi.mem_chunks[idx].vaddr) {
ath10k_warn(ar, failed to allocate memory chunk\n);
return -ENOMEM;
@@ -3878,12 +3878,19

[PATCH 2/2] ath10k: Increase max client to 512 in qca99x0

2015-07-20 Thread Raja Mani
When max client was set to 512 in qca99x0, there was host memory
alloc failure during wmi service ready event handling. This issue
got resolved now, increasing max client limit from 256 to 512.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/hw.h | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 9172285..a43105d 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -363,10 +363,7 @@ enum ath10k_hw_rate_cck {
 (TARGET_10_4_NUM_VDEVS))
 #define TARGET_10_4_ACTIVE_PEERS   0
 
-/* TODO: increase qcache max client limit to 512 after
- * testing with 512 client.
- */
-#define TARGET_10_4_NUM_QCACHE_PEERS_MAX   256
+#define TARGET_10_4_NUM_QCACHE_PEERS_MAX   512
 #define TARGET_10_4_QCACHE_ACTIVE_PEERS50
 #define TARGET_10_4_NUM_OFFLOAD_PEERS  0
 #define TARGET_10_4_NUM_OFFLOAD_REORDER_BUFFS  0
-- 
1.8.1.2

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


[PATCH 1/2] ath10k: ensure pktlog disable cmd reaches fw before pdev suspend

2015-07-09 Thread Raja Mani
Found incorrect sequence in ath10k_core_stop() where wmi pktlog
disable cmd is passed from ath10k_debug_stop() to firmware
immediately after wmi pdev suspend cmd. Firmware will not accept
any wmi cmd after receiving wmi pdev suspend cmd.

Fix this issue in ath10k_core_stop() by moving ath10k_debug_stop()
just before sending pdev suspend cmd. So that pktlog disable cmd
will get passed before pdev suspend cmd.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index f79fa6c..6d19d3d 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1368,13 +1368,13 @@ int ath10k_wait_for_suspend(struct ath10k *ar, u32 
suspend_opt)
 void ath10k_core_stop(struct ath10k *ar)
 {
lockdep_assert_held(ar-conf_mutex);
+   ath10k_debug_stop(ar);
 
/* try to suspend target */
if (ar-state != ATH10K_STATE_RESTARTING 
ar-state != ATH10K_STATE_UTF)
ath10k_wait_for_suspend(ar, WMI_PDEV_SUSPEND_AND_DISABLE_INTR);
 
-   ath10k_debug_stop(ar);
ath10k_hif_stop(ar);
ath10k_htt_tx_free(ar-htt);
ath10k_htt_rx_free(ar-htt);
-- 
1.8.1.2

--
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 2/2] ath10k: free collected fw stats memory if .pull_fw_stats fails

2015-07-09 Thread Raja Mani
If .pull_fw_stats() fails for some reason while processing
fw stats event, collected pdev/vdev/peer stats just before
the failure should be freed. This is unlikely to happen,
just code review catch.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/debug.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index edf6047..fc6852c 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -321,7 +321,7 @@ void ath10k_debug_fw_stats_process(struct ath10k *ar, 
struct sk_buff *skb)
ret = ath10k_wmi_pull_fw_stats(ar, skb, stats);
if (ret) {
ath10k_warn(ar, failed to pull fw stats: %d\n, ret);
-   goto unlock;
+   goto free;
}
 
/* Stat data may exceed htc-wmi buffer limit. In such case firmware
@@ -384,7 +384,6 @@ free:
ath10k_debug_fw_stats_vdevs_free(stats.vdevs);
ath10k_debug_fw_stats_peers_free(stats.peers);
 
-unlock:
spin_unlock_bh(ar-data_lock);
 }
 
-- 
1.8.1.2

--
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] ath10k: add pktlog support for 10.4 firmware

2015-06-23 Thread Raja Mani
10.4 firmware uses dedicated copy engine for pktlog transaction.
Whatever the data received in that dedicated copy engine will
have only pkt log header and followed by pktlog payload (will not
have htc header). In the current design, htc layer callback
registered with hif are acting as default receiver for all copy
engine. We need to change the design in a way dedicated copy
engine assigned for pktlog directly goes to pktlog module
(bypassing htc) and rest of copy engine data goes to htc layer.
In order to meet this, hif layer is changed to maintain copy
engine specific tx and rx callbacks.

Also, new firmware ie is added to get copy engine number used
for pktlog in the firmware. Based this, pktlog receiver callback
handler will be plugged into hif layer.

pktlog.c/h are newly added to have pktlog related stuff.
10.4 firmware pktlog header differs from non 10.4 firmware.
So, new pktlog header is added for 10.4.

This patch enables pktlog to capture only TX related info on
10.4 firmware. Some more effort is need to capture RX related
info in pktlog which is not covered in this patch.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/Makefile |  3 +-
 drivers/net/wireless/ath/ath10k/core.c   | 28 +-
 drivers/net/wireless/ath/ath10k/core.h   |  3 ++
 drivers/net/wireless/ath/ath10k/hif.h| 12 
 drivers/net/wireless/ath/ath10k/htc.c| 15 --
 drivers/net/wireless/ath/ath10k/htt_rx.c |  1 +
 drivers/net/wireless/ath/ath10k/hw.h | 12 ++--
 drivers/net/wireless/ath/ath10k/pci.c| 26 +++-
 drivers/net/wireless/ath/ath10k/pci.h|  2 +-
 drivers/net/wireless/ath/ath10k/pktlog.c | 51 
 drivers/net/wireless/ath/ath10k/pktlog.h | 41 +
 11 files changed, 168 insertions(+), 26 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/pktlog.c
 create mode 100644 drivers/net/wireless/ath/ath10k/pktlog.h

diff --git a/drivers/net/wireless/ath/ath10k/Makefile 
b/drivers/net/wireless/ath/ath10k/Makefile
index c04fb00..c811b8e 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -12,7 +12,8 @@ ath10k_core-y += mac.o \
 bmi.o \
 hw.o \
 p2p.o \
-swap.o
+swap.o \
+pktlog.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 be5f01c..39211c8 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -29,6 +29,7 @@
 #include htt.h
 #include testmode.h
 #include wmi-ops.h
+#include pktlog.h
 
 unsigned int ath10k_debug_mask;
 static bool uart_print;
@@ -675,7 +676,7 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k 
*ar, const char *name)
int ie_id, i, index, bit, ret;
struct ath10k_fw_ie *hdr;
const u8 *data;
-   __le32 *timestamp, *version;
+   __le32 *timestamp, *version, *ce_id;
 
/* first fetch the firmware file (firmware-*.bin) */
ar-firmware = ath10k_fetch_fw_file(ar, ar-hw_params.fw.dir, name);
@@ -819,6 +820,24 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k 
*ar, const char *name)
ar-swap.firmware_codeswap_data = data;
ar-swap.firmware_codeswap_len = ie_len;
break;
+   case ATH10K_FW_IE_PKTLOG_DEDICATED_CE:
+   if (ie_len != sizeof(u32))
+   break;
+
+   ce_id = (__le32 *)data;
+   ar-pktlog_ce = le32_to_cpup(ce_id);
+
+   if (ar-pktlog_ce = CE_COUNT) {
+   ath10k_warn(ar, invalid ce number supplied for 
pktlog %d\n,
+   ar-pktlog_ce);
+   break;
+   }
+
+   ar-pktlog_ce_found = true;
+   ath10k_dbg(ar, ATH10K_DBG_BOOT,
+  found fw ie dedicated ce number for pktlog 
%d\n,
+  ar-pktlog_ce);
+   break;
default:
ath10k_warn(ar, Unknown FW IE: %u\n,
le32_to_cpu(hdr-id));
@@ -1499,6 +1518,13 @@ static void ath10k_core_register_work(struct work_struct 
*work)
goto err_spectral_destroy;
}
 
+   status = ath10k_pktlog_init(ar);
+   if (status) {
+   ath10k_err(ar, failed to initialize pktlog: %d\n,
+  status);
+   goto err_spectral_destroy;
+   }
+
set_bit(ATH10K_FLAG_CORE_REGISTERED, ar-dev_flags);
return;
 
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b

[PATCH v2 10/10] ath10k: handle 10.4 fw wmi ready event

2015-06-22 Thread Raja Mani
Reuse existing function ath10k_wmi_op_pull_rdy_ev()
to parse WMI_10_4_READY_EVENTID and handle the same
event in ath10k_wmi_10_4_op_rx().

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 62ea0bc..271ad2f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4338,6 +4338,9 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
ath10k_wmi_event_mgmt_rx(ar, skb);
/* mgmt_rx() owns the skb now! */
return;
+   case WMI_10_4_READY_EVENTID:
+   ath10k_wmi_event_ready(ar, skb);
+   break;
default:
ath10k_warn(ar, Unknown eventid: %d\n, id);
break;
@@ -6270,6 +6273,7 @@ static const struct wmi_ops wmi_10_4_ops = {
.map_svc = wmi_10_4_svc_map,
.pull_mgmt_rx = ath10k_wmi_10_4_op_pull_mgmt_rx_ev,
.pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev,
+   .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
.gen_init = ath10k_wmi_10_4_op_gen_init,
 };
 
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in


[PATCH v2 4/8] ath10k: add scan support for 10.4 fw

2015-06-22 Thread Raja Mani
Existing non 10.4 firmware scan related events and commands are
matching with 10.4 firmware (except chan info event). Link general
start scan,stop scan, scan channel list configuration functions
to 10.4 wmi function table and add a new handler to parse 10.4
specific chan info event.

10.4 firmware has extra scan completion reason
WMI_SCAN_REASON_INTERNAL_FAILURE and new scan event
WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT compared to previous firmware
versions. These things are added in respective enum.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
v2 changes:
 - WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT is added newly.
 - BIT() macro is used to define the values of enum wmi_scan_event_type
 - New member rx_frame_count is added in struct wmi_10_4_chan_info_event

 drivers/net/wireless/ath/ath10k/wmi.c | 42 +++
 drivers/net/wireless/ath/ath10k/wmi.h | 36 ++
 2 files changed, 69 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index c4d777d..fffdae1 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1923,6 +1923,8 @@ ath10k_wmi_event_scan_type_str(enum wmi_scan_event_type 
type,
return completed [preempted];
case WMI_SCAN_REASON_TIMEDOUT:
return completed [timedout];
+   case WMI_SCAN_REASON_INTERNAL_FAILURE:
+   return completed [internal err];
case WMI_SCAN_REASON_MAX:
break;
}
@@ -1937,6 +1939,10 @@ ath10k_wmi_event_scan_type_str(enum wmi_scan_event_type 
type,
return preempted;
case WMI_SCAN_EVENT_START_FAILED:
return start failed;
+   case WMI_SCAN_EVENT_RESTARTED:
+   return restarted;
+   case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT:
+   return foreign channel exit;
default:
return unknown;
}
@@ -2012,6 +2018,8 @@ int ath10k_wmi_event_scan(struct ath10k *ar, struct 
sk_buff *skb)
break;
case WMI_SCAN_EVENT_DEQUEUED:
case WMI_SCAN_EVENT_PREEMPTED:
+   case WMI_SCAN_EVENT_RESTARTED:
+   case WMI_SCAN_EVENT_FOREIGN_CHANNEL_EXIT:
default:
break;
}
@@ -2318,6 +2326,29 @@ static int ath10k_wmi_op_pull_ch_info_ev(struct ath10k 
*ar, struct sk_buff *skb,
return 0;
 }
 
+static int ath10k_wmi_10_4_op_pull_ch_info_ev(struct ath10k *ar,
+ struct sk_buff *skb,
+ struct wmi_ch_info_ev_arg *arg)
+{
+   struct wmi_10_4_chan_info_event *ev = (void *)skb-data;
+
+   if (skb-len  sizeof(*ev))
+   return -EPROTO;
+
+   skb_pull(skb, sizeof(*ev));
+   arg-err_code = ev-err_code;
+   arg-freq = ev-freq;
+   arg-cmd_flags = ev-cmd_flags;
+   arg-noise_floor = ev-noise_floor;
+   arg-rx_clear_count = ev-rx_clear_count;
+   arg-cycle_count = ev-cycle_count;
+   arg-chan_tx_pwr_range = ev-chan_tx_pwr_range;
+   arg-chan_tx_pwr_tp = ev-chan_tx_pwr_tp;
+   arg-rx_frame_count = ev-rx_frame_count;
+
+   return 0;
+}
+
 void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb)
 {
struct wmi_ch_info_ev_arg arg = {};
@@ -4427,6 +4458,12 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
case WMI_10_4_SERVICE_READY_EVENTID:
ath10k_wmi_event_service_ready(ar, skb);
break;
+   case WMI_10_4_SCAN_EVENTID:
+   ath10k_wmi_event_scan(ar, skb);
+   break;
+   case WMI_10_4_CHAN_INFO_EVENTID:
+   ath10k_wmi_event_chan_info(ar, skb);
+   break;
case WMI_10_4_READY_EVENTID:
ath10k_wmi_event_ready(ar, skb);
break;
@@ -6382,7 +6419,10 @@ static const struct wmi_ops wmi_10_2_4_ops = {
 static const struct wmi_ops wmi_10_4_ops = {
.rx = ath10k_wmi_10_4_op_rx,
.map_svc = wmi_10_4_svc_map,
+
+   .pull_scan = ath10k_wmi_op_pull_scan_ev,
.pull_mgmt_rx = ath10k_wmi_10_4_op_pull_mgmt_rx_ev,
+   .pull_ch_info = ath10k_wmi_10_4_op_pull_ch_info_ev,
.pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev,
.pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev,
.pull_swba = ath10k_wmi_10_4_op_pull_swba_ev,
@@ -6394,6 +6434,8 @@ static const struct wmi_ops wmi_10_4_ops = {
.gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
.gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
.gen_init = ath10k_wmi_10_4_op_gen_init,
+   .gen_start_scan = ath10k_wmi_op_gen_start_scan,
+   .gen_stop_scan = ath10k_wmi_op_gen_stop_scan,
.gen_vdev_create = ath10k_wmi_op_gen_vdev_create,
.gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete

[PATCH v2 6/8] ath10k: advertise 10.4 fw ap and sta iface combination to mac80211

2015-06-22 Thread Raja Mani
10.4 fw supports upto 16 interface in ap mode and 1 interface
in station mode, overall total interfaces supported are 16
interfaces. Populate this limit in wiphy-iface_combinations.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/mac.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index f9989d1..bbdf7a9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6620,6 +6620,33 @@ static struct ieee80211_iface_combination 
ath10k_tlv_qcs_if_comb[] = {
},
 };
 
+static const struct ieee80211_iface_limit ath10k_10_4_if_limits[] = {
+   {
+   .max = 1,
+   .types = BIT(NL80211_IFTYPE_STATION),
+   },
+   {
+   .max= 16,
+   .types  = BIT(NL80211_IFTYPE_AP)
+   },
+};
+
+static const struct ieee80211_iface_combination ath10k_10_4_if_comb[] = {
+   {
+   .limits = ath10k_10_4_if_limits,
+   .n_limits = ARRAY_SIZE(ath10k_10_4_if_limits),
+   .max_interfaces = 16,
+   .num_different_channels = 1,
+   .beacon_int_infra_match = true,
+#ifdef CONFIG_ATH10K_DFS_CERTIFIED
+   .radar_detect_widths =  BIT(NL80211_CHAN_WIDTH_20_NOHT) |
+   BIT(NL80211_CHAN_WIDTH_20) |
+   BIT(NL80211_CHAN_WIDTH_40) |
+   BIT(NL80211_CHAN_WIDTH_80),
+#endif
+   },
+};
+
 static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
 {
struct ieee80211_sta_vht_cap vht_cap = {0};
@@ -6944,6 +6971,9 @@ int ath10k_mac_register(struct ath10k *ar)
ARRAY_SIZE(ath10k_10x_if_comb);
break;
case ATH10K_FW_WMI_OP_VERSION_10_4:
+   ar-hw-wiphy-iface_combinations = ath10k_10_4_if_comb;
+   ar-hw-wiphy-n_iface_combinations =
+   ARRAY_SIZE(ath10k_10_4_if_comb);
break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in


[PATCH v2 5/8] ath10k: add 10.4 fw specific htt msg definitions

2015-06-22 Thread Raja Mani
New htt event table is added for 10.4 firmware. Following new htt
events are available only 10.4. adding this to generic htt event
table,
HTT_T2H_MSG_TYPE_EN_STATS,
HTT_T2H_MSG_TYPE_TX_FETCH_IND,
HTT_T2H_MSG_TYPE_TX_FETCH_CONF,
HTT_T2H_MSG_TYPE_TX_LOW_LATENCY_IND

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
v2 changes:
 - updated htt msg ids based on stable 10.4 firmware.

 drivers/net/wireless/ath/ath10k/core.c   |  3 +++
 drivers/net/wireless/ath/ath10k/htt.c| 41 
 drivers/net/wireless/ath/ath10k/htt.h| 36 
 drivers/net/wireless/ath/ath10k/htt_rx.c |  4 
 drivers/net/wireless/ath/ath10k/hw.h |  2 ++
 5 files changed, 86 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 020ac9f..b43565d 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1121,6 +1121,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-num_active_peers = TARGET_10_4_ACTIVE_PEERS;
ar-max_num_vdevs = TARGET_10_4_NUM_VDEVS;
ar-num_tids = TARGET_10_4_TGT_NUM_TIDS;
+   ar-htt.max_num_pending_tx = TARGET_10_4_NUM_MSDU_DESC;
ar-fw_stats_req_mask = WMI_STAT_PEER;
break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
@@ -1146,6 +1147,8 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-htt.op_version = ATH10K_FW_HTT_OP_VERSION_TLV;
break;
case ATH10K_FW_WMI_OP_VERSION_10_4:
+   ar-htt.op_version = ATH10K_FW_HTT_OP_VERSION_10_4;
+   break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
WARN_ON(1);
diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
index 6da6ef2..6f71f94 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -102,6 +102,43 @@ static const enum htt_t2h_msg_type htt_tlv_t2h_msg_types[] 
= {
[HTT_TLV_T2H_MSG_TYPE_TEST] = HTT_T2H_MSG_TYPE_TEST,
 };
 
+static const enum htt_t2h_msg_type htt_10_4_t2h_msg_types[] = {
+   [HTT_10_4_T2H_MSG_TYPE_VERSION_CONF] = HTT_T2H_MSG_TYPE_VERSION_CONF,
+   [HTT_10_4_T2H_MSG_TYPE_RX_IND] = HTT_T2H_MSG_TYPE_RX_IND,
+   [HTT_10_4_T2H_MSG_TYPE_RX_FLUSH] = HTT_T2H_MSG_TYPE_RX_FLUSH,
+   [HTT_10_4_T2H_MSG_TYPE_PEER_MAP] = HTT_T2H_MSG_TYPE_PEER_MAP,
+   [HTT_10_4_T2H_MSG_TYPE_PEER_UNMAP] = HTT_T2H_MSG_TYPE_PEER_UNMAP,
+   [HTT_10_4_T2H_MSG_TYPE_RX_ADDBA] = HTT_T2H_MSG_TYPE_RX_ADDBA,
+   [HTT_10_4_T2H_MSG_TYPE_RX_DELBA] = HTT_T2H_MSG_TYPE_RX_DELBA,
+   [HTT_10_4_T2H_MSG_TYPE_TX_COMPL_IND] = HTT_T2H_MSG_TYPE_TX_COMPL_IND,
+   [HTT_10_4_T2H_MSG_TYPE_PKTLOG] = HTT_T2H_MSG_TYPE_PKTLOG,
+   [HTT_10_4_T2H_MSG_TYPE_STATS_CONF] = HTT_T2H_MSG_TYPE_STATS_CONF,
+   [HTT_10_4_T2H_MSG_TYPE_RX_FRAG_IND] = HTT_T2H_MSG_TYPE_RX_FRAG_IND,
+   [HTT_10_4_T2H_MSG_TYPE_SEC_IND] = HTT_T2H_MSG_TYPE_SEC_IND,
+   [HTT_10_4_T2H_MSG_TYPE_RC_UPDATE_IND] = HTT_T2H_MSG_TYPE_RC_UPDATE_IND,
+   [HTT_10_4_T2H_MSG_TYPE_TX_INSPECT_IND] =
+   HTT_T2H_MSG_TYPE_TX_INSPECT_IND,
+   [HTT_10_4_T2H_MSG_TYPE_MGMT_TX_COMPL_IND] =
+   HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION,
+   [HTT_10_4_T2H_MSG_TYPE_CHAN_CHANGE] = HTT_T2H_MSG_TYPE_CHAN_CHANGE,
+   [HTT_10_4_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND] =
+   HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND,
+   [HTT_10_4_T2H_MSG_TYPE_RX_PN_IND] = HTT_T2H_MSG_TYPE_RX_PN_IND,
+   [HTT_10_4_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND] =
+   HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND,
+   [HTT_10_4_T2H_MSG_TYPE_TEST] = HTT_T2H_MSG_TYPE_TEST,
+   [HTT_10_4_T2H_MSG_TYPE_EN_STATS] = HTT_T2H_MSG_TYPE_EN_STATS,
+   [HTT_10_4_T2H_MSG_TYPE_AGGR_CONF] = HTT_T2H_MSG_TYPE_AGGR_CONF,
+   [HTT_10_4_T2H_MSG_TYPE_TX_FETCH_IND] =
+   HTT_T2H_MSG_TYPE_TX_FETCH_IND,
+   [HTT_10_4_T2H_MSG_TYPE_TX_FETCH_CONF] =
+   HTT_T2H_MSG_TYPE_TX_FETCH_CONF,
+   [HTT_10_4_T2H_MSG_TYPE_STATS_NOUPLOAD] =
+   HTT_T2H_MSG_TYPE_STATS_NOUPLOAD,
+   [HTT_10_4_T2H_MSG_TYPE_TX_LOW_LATENCY_IND] =
+   HTT_T2H_MSG_TYPE_TX_LOW_LATENCY_IND,
+};
+
 int ath10k_htt_connect(struct ath10k_htt *htt)
 {
struct ath10k_htc_svc_conn_req conn_req;
@@ -147,6 +184,10 @@ int ath10k_htt_init(struct ath10k *ar)
2; /* ip4 dscp or ip6 priority */
 
switch (ar-htt.op_version) {
+   case ATH10K_FW_HTT_OP_VERSION_10_4:
+   ar-htt.t2h_msg_types = htt_10_4_t2h_msg_types;
+   ar-htt.t2h_msg_types_max

[PATCH v2 8/8] ath10k: configure frag desc memory to target for qca99X0

2015-06-22 Thread Raja Mani
Pre qca99X0 chipsets follows the model where dynamically allocate
memory for frag desc on getting new skb for TX. But, this is not
going to be the case in qca99X0. It expects frag desc memory to be
allocated at boot time and let the driver to reuse allocated memory
after every TX completion. So there won't be any dynamic frag memory
memory allocation in qca99X0 during data transmission.

qca99X0 hardware doesn't need fragment desc address to be programmed
in msdu descriptor for every data transaction. It needs to know only
starting address of fragment descriptor at the time of the boot.
During data transmission, qca99X0 hardware can retrieve corresponding
frag addr by adding programmed frag desc base addr + msdu id.

Allocate continuous fragment descriptor memory (same size as number of
descriptor) at the time of target initialization and configure allocated
dma address to the target via HTT_H2T_MSG_TYPE_FRAG_DESC_BANK_CFG.

How this is allocated continuous memory is going to be used is not
covered in this patch. It just allocates memory and hand over to firmware.
If we don't do it at init time, qca99X0 will stall when firmware tries
to do TX.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c   |  1 +
 drivers/net/wireless/ath/ath10k/core.h   |  6 +++
 drivers/net/wireless/ath/ath10k/htt.c|  4 ++
 drivers/net/wireless/ath/ath10k/htt.h| 11 +
 drivers/net/wireless/ath/ath10k/htt_tx.c | 76 +++-
 5 files changed, 96 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 3c8d5c5..be5f01c 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -111,6 +111,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.otp_exe_param = 0x0700,
+   .continuous_frag_desc = true,
.fw = {
.dir = QCA99X0_HW_2_0_FW_DIR,
.fw = QCA99X0_HW_2_0_FW_FILE,
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index f0811d0..2e5c935 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -582,6 +582,12 @@ struct ath10k {
 */
bool has_shifted_cc_wraparound;
 
+   /* Some of chip expects fragment descriptor to be continuous
+* memory for any TX operation. Set continuous_frag_desc flag
+* for the hardware which have such requirement.
+*/
+   bool continuous_frag_desc;
+
struct ath10k_hw_params_fw {
const char *dir;
const char *fw;
diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
index 6f71f94..4474c3e 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -249,5 +249,9 @@ int ath10k_htt_setup(struct ath10k_htt *htt)
if (status)
return status;
 
+   status = ath10k_htt_send_frag_desc_bank_cfg(htt);
+   if (status)
+   return status;
+
return ath10k_htt_send_rx_ring_cfg_ll(htt);
 }
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index 8e64ace..8bdf1e7 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -87,6 +87,11 @@ struct htt_data_tx_desc_frag {
__le32 len;
 } __packed;
 
+struct htt_msdu_ext_desc {
+   __le32 tso_flag[4];
+   struct htt_data_tx_desc_frag frags[6];
+};
+
 enum htt_data_tx_desc_flags0 {
HTT_DATA_TX_DESC_FLAGS0_MAC_HDR_PRESENT = 1  0,
HTT_DATA_TX_DESC_FLAGS0_NO_AGGR = 1  1,
@@ -1466,6 +1471,11 @@ struct ath10k_htt {
 
/* rx_status template */
struct ieee80211_rx_status rx_status;
+
+   struct {
+   dma_addr_t paddr;
+   struct htt_msdu_ext_desc *vaddr;
+   } frag_desc;
 };
 
 #define RX_HTT_HDR_STATUS_LEN 64
@@ -1533,6 +1543,7 @@ void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct 
sk_buff *skb);
 void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb);
 int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt);
 int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u8 mask, u64 cookie);
+int ath10k_htt_send_frag_desc_bank_cfg(struct ath10k_htt *htt);
 int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt);
 int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt,
u8 max_subfrms_ampdu,
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index a60ef7d..148d5b6 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c

[PATCH v2 07/10] ath10k: fill 10.4 fw wmi init cmd default values

2015-06-22 Thread Raja Mani
Define 10.4 wmi init command structure and introduce new function
ath10k_wmi_10_4_op_gen_init() to fill default values for each field
which goes as part of wmi init cmd to 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c |   7 ++
 drivers/net/wireless/ath/ath10k/core.h |   2 +
 drivers/net/wireless/ath/ath10k/hw.h   |  54 
 drivers/net/wireless/ath/ath10k/wmi.c  |  83 +
 drivers/net/wireless/ath/ath10k/wmi.h  | 220 +
 5 files changed, 366 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 5e8d8af..020ac9f 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1116,6 +1116,13 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
WMI_STAT_PEER;
break;
case ATH10K_FW_WMI_OP_VERSION_10_4:
+   ar-max_num_peers = TARGET_10_4_NUM_PEERS;
+   ar-max_num_stations = TARGET_10_4_NUM_STATIONS;
+   ar-num_active_peers = TARGET_10_4_ACTIVE_PEERS;
+   ar-max_num_vdevs = TARGET_10_4_NUM_VDEVS;
+   ar-num_tids = TARGET_10_4_TGT_NUM_TIDS;
+   ar-fw_stats_req_mask = WMI_STAT_PEER;
+   break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
WARN_ON(1);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index afd21d5..58b02ae 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -684,6 +684,8 @@ struct ath10k {
int max_num_stations;
int max_num_vdevs;
int max_num_tdls_vdevs;
+   int num_active_peers;
+   int num_tids;
 
struct work_struct offchan_tx_work;
struct sk_buff_head offchan_tx_queue;
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index b0c89b4..52fc024 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -354,6 +354,60 @@ enum ath10k_hw_rate_cck {
 
 #define NUM_TARGET_CE_CONFIG_WLAN ar-hw_values-num_target_ce_config_wlan
 
+/* Target specific defines for 10.4 firmware */
+#define TARGET_10_4_NUM_VDEVS  16
+#define TARGET_10_4_NUM_STATIONS   32
+#define TARGET_10_4_NUM_PEERS  ((TARGET_10_4_NUM_STATIONS) + \
+(TARGET_10_4_NUM_VDEVS))
+#define TARGET_10_4_ACTIVE_PEERS   0
+#define TARGET_10_4_NUM_OFFLOAD_PEERS  0
+#define TARGET_10_4_NUM_OFFLOAD_REORDER_BUFFS  0
+#define TARGET_10_4_NUM_PEER_KEYS  2
+#define TARGET_10_4_TGT_NUM_TIDS   ((TARGET_10_4_NUM_PEERS) * 2)
+#define TARGET_10_4_AST_SKID_LIMIT 32
+#define TARGET_10_4_TX_CHAIN_MASK  (BIT(0) | BIT(1) | \
+BIT(2) | BIT(3))
+#define TARGET_10_4_RX_CHAIN_MASK  (BIT(0) | BIT(1) | \
+BIT(2) | BIT(3))
+
+/* 100 ms for video, best-effort, and background */
+#define TARGET_10_4_RX_TIMEOUT_LO_PRI  100
+
+/* 40 ms for voice */
+#define TARGET_10_4_RX_TIMEOUT_HI_PRI  40
+
+#define TARGET_10_4_RX_DECAP_MODE  ATH10K_HW_TXRX_NATIVE_WIFI
+#define TARGET_10_4_SCAN_MAX_REQS  4
+#define TARGET_10_4_BMISS_OFFLOAD_MAX_VDEV 3
+#define TARGET_10_4_ROAM_OFFLOAD_MAX_VDEV  3
+#define TARGET_10_4_ROAM_OFFLOAD_MAX_PROFILES   8
+
+/* Note: mcast to ucast is disabled by default */
+#define TARGET_10_4_NUM_MCAST_GROUPS   0
+#define TARGET_10_4_NUM_MCAST_TABLE_ELEMS  0
+#define TARGET_10_4_MCAST2UCAST_MODE   0
+
+#define TARGET_10_4_TX_DBG_LOG_SIZE1024
+#define TARGET_10_4_NUM_WDS_ENTRIES32
+#define TARGET_10_4_DMA_BURST_SIZE 1
+#define TARGET_10_4_MAC_AGGR_DELIM 0
+#define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
+#define TARGET_10_4_VOW_CONFIG 0
+#define TARGET_10_4_GTK_OFFLOAD_MAX_VDEV   3
+#define TARGET_10_4_NUM_MSDU_DESC  (1024 + 400)
+#define TARGET_10_4_11AC_TX_MAX_FRAGS  2
+#define TARGET_10_4_MAX_PEER_EXT_STATS 16
+#define TARGET_10_4_SMART_ANT_CAP  0
+#define TARGET_10_4_BK_MIN_FREE0
+#define TARGET_10_4_BE_MIN_FREE0
+#define TARGET_10_4_VI_MIN_FREE0
+#define TARGET_10_4_VO_MIN_FREE0
+#define TARGET_10_4_RX_BATCH_MODE  1
+#define TARGET_10_4_THERMAL_THROTTLING_CONFIG  0
+#define TARGET_10_4_ATF_CONFIG 0
+#define TARGET_10_4_IPHDR_PAD_CONFIG   1
+#define TARGET_10_4_QWRAP_CONFIG   0
+
 /* Number of Copy Engines supported */
 #define CE_COUNT ar-hw_values

[PATCH v2 08/10] ath10k: handle 10.4 fw wmi mgmt rx event

2015-06-22 Thread Raja Mani
10.4 firmware wmi mgmt rx event format differs from non 10.4
firmware and changing existing wmi mgmt rx event parsing function
ath10k_wmi_op_pull_mgmt_rx_ev() for 10.4 would add more complex.

This patch adds new function to receive any wmi rx event from
10.4 firmware and also introduce new function to parse wmi mgmt
rx event.

In addition, fw main branch service rdy event parsing function
is linked in wmi ops table.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi.c | 64 +++
 drivers/net/wireless/ath/ath10k/wmi.h | 15 
 2 files changed, 79 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 6c51b20..9502032 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2124,6 +2124,40 @@ static int ath10k_wmi_op_pull_mgmt_rx_ev(struct ath10k 
*ar, struct sk_buff *skb,
return 0;
 }
 
+static int ath10k_wmi_10_4_op_pull_mgmt_rx_ev(struct ath10k *ar,
+ struct sk_buff *skb,
+ struct wmi_mgmt_rx_ev_arg *arg)
+{
+   struct wmi_10_4_mgmt_rx_event *ev;
+   struct wmi_10_4_mgmt_rx_hdr *ev_hdr;
+   size_t pull_len;
+   u32 msdu_len;
+
+   ev = (struct wmi_10_4_mgmt_rx_event *)skb-data;
+   ev_hdr = ev-hdr;
+   pull_len = sizeof(*ev);
+
+   if (skb-len  pull_len)
+   return -EPROTO;
+
+   skb_pull(skb, pull_len);
+   arg-channel = ev_hdr-channel;
+   arg-buf_len = ev_hdr-buf_len;
+   arg-status = ev_hdr-status;
+   arg-snr = ev_hdr-snr;
+   arg-phy_mode = ev_hdr-phy_mode;
+   arg-rate = ev_hdr-rate;
+
+   msdu_len = __le32_to_cpu(arg-buf_len);
+   if (skb-len  msdu_len)
+   return -EPROTO;
+
+   /* Make sure bytes added for padding are removed. */
+   skb_trim(skb, msdu_len);
+
+   return 0;
+}
+
 int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
 {
struct wmi_mgmt_rx_ev_arg arg = {};
@@ -4267,6 +4301,33 @@ out:
dev_kfree_skb(skb);
 }
 
+static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, struct sk_buff *skb)
+{
+   struct wmi_cmd_hdr *cmd_hdr;
+   enum wmi_10_4_event_id id;
+
+   cmd_hdr = (struct wmi_cmd_hdr *)skb-data;
+   id = MS(__le32_to_cpu(cmd_hdr-cmd_id), WMI_CMD_HDR_CMD_ID);
+
+   if (!skb_pull(skb, sizeof(struct wmi_cmd_hdr)))
+   goto out;
+
+   trace_ath10k_wmi_event(ar, id, skb-data, skb-len);
+
+   switch (id) {
+   case WMI_10_4_MGMT_RX_EVENTID:
+   ath10k_wmi_event_mgmt_rx(ar, skb);
+   /* mgmt_rx() owns the skb now! */
+   return;
+   default:
+   ath10k_warn(ar, Unknown eventid: %d\n, id);
+   break;
+   }
+
+out:
+   dev_kfree_skb(skb);
+}
+
 static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb)
 {
int ret;
@@ -6186,7 +6247,10 @@ static const struct wmi_ops wmi_10_2_4_ops = {
 };
 
 static const struct wmi_ops wmi_10_4_ops = {
+   .rx = ath10k_wmi_10_4_op_rx,
.map_svc = wmi_10_4_svc_map,
+   .pull_mgmt_rx = ath10k_wmi_10_4_op_pull_mgmt_rx_ev,
+   .pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev,
.gen_init = ath10k_wmi_10_4_op_gen_init,
 };
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index dbb9f1c..b1bec03 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2947,6 +2947,21 @@ struct wmi_mgmt_rx_event_v2 {
u8 buf[0];
 } __packed;
 
+struct wmi_10_4_mgmt_rx_hdr {
+   __le32 channel;
+   __le32 snr;
+   u8 rssi_ctl[4];
+   __le32 rate;
+   __le32 phy_mode;
+   __le32 buf_len;
+   __le32 status;
+} __packed;
+
+struct wmi_10_4_mgmt_rx_event {
+   struct wmi_10_4_mgmt_rx_hdr hdr;
+   u8 buf[0];
+} __packed;
+
 #define WMI_RX_STATUS_OK   0x00
 #define WMI_RX_STATUS_ERR_CRC  0x01
 #define WMI_RX_STATUS_ERR_DECRYPT  0x08
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in


[PATCH v2 06/10] ath10k: add 10.4 fw wmi pdev cmd ids

2015-06-22 Thread Raja Mani
Include 10.4 firmware wmi pdev cmd id and prepare wmi vdev map
table wmi_10_4_pdev_param_map and update non 10.4 firmware
pdev cmd map table with newly added vdev cmd id specifically for
10.4 firmware as unsupported.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
v2 changes:
 - udpated pdev cmd id table based on stable 10.4 firmware.

 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  42 ++
 drivers/net/wireless/ath/ath10k/wmi.c | 228 ++
 drivers/net/wireless/ath/ath10k/wmi.h | 136 ++
 3 files changed, 406 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index b2a8e32..620b37b 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -3236,6 +3236,48 @@ static struct wmi_pdev_param_map wmi_tlv_pdev_param_map 
= {
.burst_dur = WMI_TLV_PDEV_PARAM_BURST_DUR,
.burst_enable = WMI_TLV_PDEV_PARAM_BURST_ENABLE,
.cal_period = WMI_PDEV_PARAM_UNSUPPORTED,
+   .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED,
+   .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED,
+   .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
+   .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
+   .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED,
+   .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .txbf_sound_period_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_promisc_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_burst_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .en_stats = WMI_PDEV_PARAM_UNSUPPORTED,
+   .mu_group_policy = WMI_PDEV_PARAM_UNSUPPORTED,
+   .noise_detection = WMI_PDEV_PARAM_UNSUPPORTED,
+   .noise_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
+   .dpd_enable = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast_bcast_echo = WMI_PDEV_PARAM_UNSUPPORTED,
+   .atf_strict_sch = WMI_PDEV_PARAM_UNSUPPORTED,
+   .atf_sched_duration = WMI_PDEV_PARAM_UNSUPPORTED,
+   .ant_plzn = WMI_PDEV_PARAM_UNSUPPORTED,
+   .mgmt_retry_limit = WMI_PDEV_PARAM_UNSUPPORTED,
+   .sensitivity_level = WMI_PDEV_PARAM_UNSUPPORTED,
+   .signed_txpower_2g = WMI_PDEV_PARAM_UNSUPPORTED,
+   .signed_txpower_5g = WMI_PDEV_PARAM_UNSUPPORTED,
+   .enable_per_tid_amsdu = WMI_PDEV_PARAM_UNSUPPORTED,
+   .enable_per_tid_ampdu = WMI_PDEV_PARAM_UNSUPPORTED,
+   .cca_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
+   .rts_fixed_rate = WMI_PDEV_PARAM_UNSUPPORTED,
+   .pdev_reset = WMI_PDEV_PARAM_UNSUPPORTED,
+   .wapi_mbssid_offset = WMI_PDEV_PARAM_UNSUPPORTED,
+   .arp_srcaddr = WMI_PDEV_PARAM_UNSUPPORTED,
+   .arp_dstaddr = WMI_PDEV_PARAM_UNSUPPORTED,
 };
 
 static struct wmi_vdev_param_map wmi_tlv_vdev_param_map = {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 087dea8..3f29886 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1053,6 +1053,48 @@ static struct wmi_pdev_param_map wmi_pdev_param_map = {
.burst_dur = WMI_PDEV_PARAM_UNSUPPORTED,
.burst_enable = WMI_PDEV_PARAM_UNSUPPORTED,
.cal_period = WMI_PDEV_PARAM_UNSUPPORTED,
+   .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED,
+   .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED,
+   .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
+   .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
+   .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED,
+   .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED

[PATCH v2 2/8] ath10k: handle 10.4 firmware wmi swba event

2015-06-22 Thread Raja Mani
10.4 firmware swba event payload has space to accommodate upto
512 client traffic indication info  one p2p noa descriptor.
It's is not matching with exiting swba event format defined for
non 10.4 firmware. Non 10.4 firmware swba event format is designed
to support only upto only 128 client and four p2p notice of absence
descriptor.

following changes are done in this patch to enable ath10k to handle
10.4 firmware swba event,

 - link generic ath10k_wmi_event_host_swba() to handle 10.4 swba
   event in 10.4 wmi rx handler.

 - add 10.4 specific swba event structure wmi_10_4_host_swba_event.

 - new function ath10k_wmi_10_4_op_pull_swba_ev() to parse
   10.4 swba event.

 - increase tim_bitmap[] size in ath10k_vif to 64 to hold 512 station
   power save state.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.h |  4 +--
 drivers/net/wireless/ath/ath10k/wmi.c  | 61 ++
 drivers/net/wireless/ath/ath10k/wmi.h  | 41 +++
 3 files changed, 104 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 58b02ae..86c4015 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -328,8 +328,8 @@ struct ath10k_vif {
u32 uapsd;
} sta;
struct {
-   /* 127 stations; wmi limit */
-   u8 tim_bitmap[16];
+   /* 512 stations */
+   u8 tim_bitmap[64];
u8 tim_len;
u32 ssid_len;
u8 ssid[IEEE80211_MAX_SSID_LEN];
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index d6a3ff2..48ea442 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3030,6 +3030,63 @@ static int ath10k_wmi_op_pull_swba_ev(struct ath10k *ar, 
struct sk_buff *skb,
return 0;
 }
 
+static int ath10k_wmi_10_4_op_pull_swba_ev(struct ath10k *ar,
+  struct sk_buff *skb,
+  struct wmi_swba_ev_arg *arg)
+{
+   struct wmi_10_4_host_swba_event *ev = (void *)skb-data;
+   u32 map, tim_len;
+   size_t i;
+
+   if (skb-len  sizeof(*ev))
+   return -EPROTO;
+
+   skb_pull(skb, sizeof(*ev));
+   arg-vdev_map = ev-vdev_map;
+
+   for (i = 0, map = __le32_to_cpu(ev-vdev_map); map; map = 1) {
+   if (!(map  BIT(0)))
+   continue;
+
+   /* If this happens there were some changes in firmware and
+* ath10k should update the max size of tim_info array.
+*/
+   if (WARN_ON_ONCE(i == ARRAY_SIZE(arg-tim_info)))
+   break;
+
+   if (__le32_to_cpu(ev-bcn_info[i].tim_info.tim_len) 
+ sizeof(ev-bcn_info[i].tim_info.tim_bitmap)) {
+   ath10k_warn(ar, refusing to parse invalid swba 
structure\n);
+   return -EPROTO;
+   }
+
+   tim_len = __le32_to_cpu(ev-bcn_info[i].tim_info.tim_len);
+   if (tim_len) {
+   /* Exclude 4 byte guard length */
+   tim_len -= 4;
+   arg-tim_info[i].tim_len = __cpu_to_le32(tim_len);
+   } else {
+   arg-tim_info[i].tim_len = 0;
+   }
+
+   arg-tim_info[i].tim_mcast = ev-bcn_info[i].tim_info.tim_mcast;
+   arg-tim_info[i].tim_bitmap =
+   ev-bcn_info[i].tim_info.tim_bitmap;
+   arg-tim_info[i].tim_changed =
+   ev-bcn_info[i].tim_info.tim_changed;
+   arg-tim_info[i].tim_num_ps_pending =
+   ev-bcn_info[i].tim_info.tim_num_ps_pending;
+
+   /* 10.4 firmware doesn't have p2p support. notice of absence
+* info can be ignored for now.
+*/
+
+   i++;
+   }
+
+   return 0;
+}
+
 void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb)
 {
struct wmi_swba_ev_arg arg = {};
@@ -4364,6 +4421,9 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
case WMI_10_4_READY_EVENTID:
ath10k_wmi_event_ready(ar, skb);
break;
+   case WMI_10_4_HOST_SWBA_EVENTID:
+   ath10k_wmi_event_host_swba(ar, skb);
+   break;
default:
ath10k_warn(ar, Unknown eventid: %d\n, id);
break;
@@ -6295,6 +6355,7 @@ static const struct wmi_ops wmi_10_4_ops = {
.rx = ath10k_wmi_10_4_op_rx,
.map_svc = wmi_10_4_svc_map,
.pull_mgmt_rx = ath10k_wmi_10_4_op_pull_mgmt_rx_ev,
+   .pull_swba

[PATCH v2 0/8] add beacon and htt msg support for 10.4 firmware

2015-06-22 Thread Raja Mani
This is the continuation of earlier patch set posted for adding 10.4 wmi 
support.
This patch series covers following items w.r.t 10.4 firmware,

- Enhance existing swba event handler to handle variable size tim bitmap
  and add support to handle 10.4 swba event.
- Enable pdev, vdev, peer related wmi operations like create, delete, 
etc.
- Includes scan support.
- Add 10.4 specific htt msg.
- Advertise 10.4 iface combination to mac80211.
- Adjust max ss and initialize continuous frag descriptor memory

v2 changes:
   - rebased on top of introduce wmi support for qca99x0 patch series.
   - updated htt msg definitions as per stable 10.4 firmware.
   - synced scan related info as per stable 10.4 firmware.

Raja Mani (8):
  ath10k: enhance swba event handler to adapt different size tim bitmap
  ath10k: handle 10.4 firmware wmi swba event
  ath10k: enable vdev and peer related operations for 10.4 fw
  ath10k: add scan support for 10.4 fw
  ath10k: add 10.4 fw specific htt msg definitions
  ath10k: advertise 10.4 fw ap and sta iface combination to mac80211
  ath10k: set max spatial stream to 4 for 10.4 fw
  ath10k: configure frag desc memory to target for qca99X0

 drivers/net/wireless/ath/ath10k/core.c|   8 ++
 drivers/net/wireless/ath/ath10k/core.h|  11 +-
 drivers/net/wireless/ath/ath10k/htt.c |  45 ++
 drivers/net/wireless/ath/ath10k/htt.h |  47 +++
 drivers/net/wireless/ath/ath10k/htt_rx.c  |   4 +
 drivers/net/wireless/ath/ath10k/htt_tx.c  |  76 ++-
 drivers/net/wireless/ath/ath10k/hw.h  |   2 +
 drivers/net/wireless/ath/ath10k/mac.c |  30 
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  18 ++-
 drivers/net/wireless/ath/ath10k/wmi.c | 220 +++---
 drivers/net/wireless/ath/ath10k/wmi.h |  90 ++--
 11 files changed, 519 insertions(+), 32 deletions(-)

-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in


[PATCH v2 3/8] ath10k: enable vdev and peer related operations for 10.4 fw

2015-06-22 Thread Raja Mani
Most of existing vdev and peer related functions (vdev create,
vdev delete, vdev start, peer create, peer delete, peer flush, etc)
are reusable for 10.4 firmware. Link those general vdev and peer
functions to 10.4 wmi function table.

Existing general pktlog enable/disable, dbglog configuration functions
are reusable for 10.4 and add them also in wmi function table.

Also handle few wmi events (sevice rdy, echo, dbg msg, tbtt offset
update, dbg print) in ath10k_wmi_10_4_op_rx(). wow event is not
applicable in 10.4 firmware, have it under not implemented print.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi.c | 62 +++
 1 file changed, 62 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 48ea442..c4d777d 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4418,12 +4418,40 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
ath10k_wmi_event_mgmt_rx(ar, skb);
/* mgmt_rx() owns the skb now! */
return;
+   case WMI_10_4_ECHO_EVENTID:
+   ath10k_wmi_event_echo(ar, skb);
+   break;
+   case WMI_10_4_DEBUG_MESG_EVENTID:
+   ath10k_wmi_event_debug_mesg(ar, skb);
+   break;
+   case WMI_10_4_SERVICE_READY_EVENTID:
+   ath10k_wmi_event_service_ready(ar, skb);
+   break;
case WMI_10_4_READY_EVENTID:
ath10k_wmi_event_ready(ar, skb);
break;
+   case WMI_10_4_PEER_STA_KICKOUT_EVENTID:
+   ath10k_wmi_event_peer_sta_kickout(ar, skb);
+   break;
case WMI_10_4_HOST_SWBA_EVENTID:
ath10k_wmi_event_host_swba(ar, skb);
break;
+   case WMI_10_4_TBTTOFFSET_UPDATE_EVENTID:
+   ath10k_wmi_event_tbttoffset_update(ar, skb);
+   break;
+   case WMI_10_4_DEBUG_PRINT_EVENTID:
+   ath10k_wmi_event_debug_print(ar, skb);
+   break;
+   case WMI_10_4_VDEV_START_RESP_EVENTID:
+   ath10k_wmi_event_vdev_start_resp(ar, skb);
+   break;
+   case WMI_10_4_VDEV_STOPPED_EVENTID:
+   ath10k_wmi_event_vdev_stopped(ar, skb);
+   break;
+   case WMI_10_4_WOW_WAKEUP_HOST_EVENTID:
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  received event id %d not implemented\n, id);
+   break;
default:
ath10k_warn(ar, Unknown eventid: %d\n, id);
break;
@@ -6355,10 +6383,44 @@ static const struct wmi_ops wmi_10_4_ops = {
.rx = ath10k_wmi_10_4_op_rx,
.map_svc = wmi_10_4_svc_map,
.pull_mgmt_rx = ath10k_wmi_10_4_op_pull_mgmt_rx_ev,
+   .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev,
+   .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev,
.pull_swba = ath10k_wmi_10_4_op_pull_swba_ev,
.pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev,
.pull_rdy = ath10k_wmi_op_pull_rdy_ev,
+
+   .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
+   .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
+   .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
+   .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
.gen_init = ath10k_wmi_10_4_op_gen_init,
+   .gen_vdev_create = ath10k_wmi_op_gen_vdev_create,
+   .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete,
+   .gen_vdev_start = ath10k_wmi_op_gen_vdev_start,
+   .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop,
+   .gen_vdev_up = ath10k_wmi_op_gen_vdev_up,
+   .gen_vdev_down = ath10k_wmi_op_gen_vdev_down,
+   .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param,
+   .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key,
+   .gen_peer_create = ath10k_wmi_op_gen_peer_create,
+   .gen_peer_delete = ath10k_wmi_op_gen_peer_delete,
+   .gen_peer_flush = ath10k_wmi_op_gen_peer_flush,
+   .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param,
+   .gen_set_psmode = ath10k_wmi_op_gen_set_psmode,
+   .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps,
+   .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps,
+   .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list,
+   .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma,
+   .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm,
+   .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang,
+   .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx,
+   .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg,
+   .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
+   .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
+   .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
+
+   /* shared with 10.2 */
+   .gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
 };
 
 int ath10k_wmi_attach(struct

[PATCH v2 7/8] ath10k: set max spatial stream to 4 for 10.4 fw

2015-06-22 Thread Raja Mani
10.4 fw supports upto 4 spatial stream. Limit max spatial
stream to 4 for 10.4 firmware and to 3 for non 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c | 4 
 drivers/net/wireless/ath/ath10k/core.h | 1 +
 drivers/net/wireless/ath/ath10k/wmi.c  | 6 +++---
 drivers/net/wireless/ath/ath10k/wmi.h  | 3 ++-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index b43565d..3c8d5c5 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1095,6 +1095,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-htt.max_num_pending_tx = TARGET_NUM_MSDU_DESC;
ar-fw_stats_req_mask = WMI_STAT_PDEV | WMI_STAT_VDEV |
WMI_STAT_PEER;
+   ar-max_spatial_stream = WMI_MAX_SPATIAL_STREAM;
break;
case ATH10K_FW_WMI_OP_VERSION_10_1:
case ATH10K_FW_WMI_OP_VERSION_10_2:
@@ -1104,6 +1105,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-max_num_vdevs = TARGET_10X_NUM_VDEVS;
ar-htt.max_num_pending_tx = TARGET_10X_NUM_MSDU_DESC;
ar-fw_stats_req_mask = WMI_STAT_PEER;
+   ar-max_spatial_stream = WMI_MAX_SPATIAL_STREAM;
break;
case ATH10K_FW_WMI_OP_VERSION_TLV:
ar-max_num_peers = TARGET_TLV_NUM_PEERS;
@@ -1114,6 +1116,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-wow.max_num_patterns = TARGET_TLV_NUM_WOW_PATTERNS;
ar-fw_stats_req_mask = WMI_STAT_PDEV | WMI_STAT_VDEV |
WMI_STAT_PEER;
+   ar-max_spatial_stream = WMI_MAX_SPATIAL_STREAM;
break;
case ATH10K_FW_WMI_OP_VERSION_10_4:
ar-max_num_peers = TARGET_10_4_NUM_PEERS;
@@ -1123,6 +1126,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-num_tids = TARGET_10_4_TGT_NUM_TIDS;
ar-htt.max_num_pending_tx = TARGET_10_4_NUM_MSDU_DESC;
ar-fw_stats_req_mask = WMI_STAT_PEER;
+   ar-max_spatial_stream = WMI_10_4_MAX_SPATIAL_STREAM;
break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 86c4015..f0811d0 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -546,6 +546,7 @@ struct ath10k {
u32 ht_cap_info;
u32 vht_cap_info;
u32 num_rf_chains;
+   u32 max_spatial_stream;
/* protected by conf_mutex */
bool ani_enabled;
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index fffdae1..a00e3ca 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3911,10 +3911,10 @@ void ath10k_wmi_event_service_ready(struct ath10k *ar, 
struct sk_buff *skb)
if (ar-fw_api == 1  ar-fw_version_build  636)
set_bit(ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX, ar-fw_features);
 
-   if (ar-num_rf_chains  WMI_MAX_SPATIAL_STREAM) {
+   if (ar-num_rf_chains  ar-max_spatial_stream) {
ath10k_warn(ar, hardware advertises support for more spatial 
streams than it should (%d  %d)\n,
-   ar-num_rf_chains, WMI_MAX_SPATIAL_STREAM);
-   ar-num_rf_chains = WMI_MAX_SPATIAL_STREAM;
+   ar-num_rf_chains, ar-max_spatial_stream);
+   ar-num_rf_chains = ar-max_spatial_stream;
}
 
ar-supp_tx_chainmask = (1  ar-num_rf_chains) - 1;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 6e806cb..0d4efc9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1747,7 +1747,8 @@ enum wmi_channel_change_cause {
 /* Indicate reason for channel switch */
 #define WMI_CHANNEL_CHANGE_CAUSE_CSA (1  13)
 
-#define WMI_MAX_SPATIAL_STREAM   3
+#define WMI_MAX_SPATIAL_STREAM3 /* default max ss */
+#define WMI_10_4_MAX_SPATIAL_STREAM   4
 
 /* HT Capabilities*/
 #define WMI_HT_CAP_ENABLED0x0001   /* HT Enabled/ disabled */
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in


[PATCH v2 1/8] ath10k: enhance swba event handler to adapt different size tim bitmap

2015-06-22 Thread Raja Mani
Due to 512 client support in 10.4 firmware, size of tim ie is going
to be slightly higher than non 10.4 firmware. So, size of tim_bitmap
what is carried in swba event from 10.4 firmware is bit higher.

The only bottle neck to reuse existing swba handler
ath10k_wmi_event_host_swba() for 10.4 is that code designed to deal
with fixed size tim bitmap(ie, tim_info[].tim_bitmap in wmi_swba_ev_arg).
This patch removes such size limitation and makes it more suitable
to handle swba event which has different size tim bitmap.

All existing swba event parsing functions are changed to adapt this
change. Actual support to handle 10.4 swba event is added in next patch.
Only preparation is made in this patch.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 18 +++-
 drivers/net/wireless/ath/ath10k/wmi.c | 49 +++
 drivers/net/wireless/ath/ath10k/wmi.h | 10 ++-
 3 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 620b37b..ced35a1 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -709,6 +709,8 @@ static int ath10k_wmi_tlv_swba_tim_parse(struct ath10k *ar, 
u16 tag, u16 len,
 const void *ptr, void *data)
 {
struct wmi_tlv_swba_parse *swba = data;
+   struct wmi_tim_info_arg *tim_info_arg;
+   const struct wmi_tim_info *tim_info_ev = ptr;
 
if (tag != WMI_TLV_TAG_STRUCT_TIM_INFO)
return -EPROTO;
@@ -716,7 +718,21 @@ static int ath10k_wmi_tlv_swba_tim_parse(struct ath10k 
*ar, u16 tag, u16 len,
if (swba-n_tim = ARRAY_SIZE(swba-arg-tim_info))
return -ENOBUFS;
 
-   swba-arg-tim_info[swba-n_tim++] = ptr;
+   if (__le32_to_cpu(tim_info_ev-tim_len) 
+sizeof(tim_info_ev-tim_bitmap)) {
+   ath10k_warn(ar, refusing to parse invalid swba structure\n);
+   return -EPROTO;
+   }
+
+   tim_info_arg = swba-arg-tim_info[swba-n_tim];
+   tim_info_arg-tim_len = tim_info_ev-tim_len;
+   tim_info_arg-tim_mcast = tim_info_ev-tim_mcast;
+   tim_info_arg-tim_bitmap = tim_info_ev-tim_bitmap;
+   tim_info_arg-tim_changed = tim_info_ev-tim_changed;
+   tim_info_arg-tim_num_ps_pending = tim_info_ev-tim_num_ps_pending;
+
+   swba-n_tim++;
+
return 0;
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 271ad2f..d6a3ff2 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2874,33 +2874,38 @@ exit:
 static void ath10k_wmi_update_tim(struct ath10k *ar,
  struct ath10k_vif *arvif,
  struct sk_buff *bcn,
- const struct wmi_tim_info *tim_info)
+ const struct wmi_tim_info_arg *tim_info)
 {
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)bcn-data;
struct ieee80211_tim_ie *tim;
u8 *ies, *ie;
u8 ie_len, pvm_len;
__le32 t;
-   u32 v;
+   u32 v, tim_len;
+
+   /* When FW reports 0 in tim_len, ensure atleast first byte
+* in tim_bitmap is considered for pvm calculation.
+*/
+   tim_len = tim_info-tim_len ? __le32_to_cpu(tim_info-tim_len) : 1;
 
/* if next SWBA has no tim_changed the tim_bitmap is garbage.
 * we must copy the bitmap upon change and reuse it later */
if (__le32_to_cpu(tim_info-tim_changed)) {
int i;
 
-   BUILD_BUG_ON(sizeof(arvif-u.ap.tim_bitmap) !=
-sizeof(tim_info-tim_bitmap));
+   WARN_ON(sizeof(arvif-u.ap.tim_bitmap)  tim_len);
 
-   for (i = 0; i  sizeof(arvif-u.ap.tim_bitmap); i++) {
+   for (i = 0; i  tim_len; i++) {
t = tim_info-tim_bitmap[i / 4];
v = __le32_to_cpu(t);
arvif-u.ap.tim_bitmap[i] = (v  ((i % 4) * 8))  0xFF;
}
 
-   /* FW reports either length 0 or 16
-* so we calculate this on our own */
+   /* FW reports either length 0 or length based on max supported
+* station. so we calculate this on our own
+*/
arvif-u.ap.tim_len = 0;
-   for (i = 0; i  sizeof(arvif-u.ap.tim_bitmap); i++)
+   for (i = 0; i  tim_len; i++)
if (arvif-u.ap.tim_bitmap[i])
arvif-u.ap.tim_len = i;
 
@@ -2924,7 +2929,7 @@ static void ath10k_wmi_update_tim(struct ath10k *ar,
pvm_len = ie_len - 3; /* exclude dtim count, dtim period, bmap ctl */
 
if (pvm_len  arvif-u.ap.tim_len) {
-   int expand_size = sizeof(arvif-u.ap.tim_bitmap

[PATCH v2 00/10] introduce wmi support for qca99X0

2015-06-22 Thread Raja Mani
qca99X0 uses 10.4 firmware. This patch series adds 10.4 firmware
specific WMI cmds/events/parsing logic. All these patches tested
on top of qca99X0 initial bring up patches.

v2 changes:
   - Synced wmi service/cmd/event/pdev/vdev ids to most
 stable 10.4 firmware.

Raja Mani (10):
  ath10k: include new wmi op version for 10.4 fw
  ath10k: add 10.4 fw wmi service bitmap definition
  ath10k: include 10.4 fw specific wmi cmd and event ids
  ath10k: set 10.4 fw exclusive wmi cmd as unsupported for other fw
versions
  ath10k: add 10.4 fw wmi vdev cmd ids
  ath10k: add 10.4 fw wmi pdev cmd ids
  ath10k: fill 10.4 fw wmi init cmd default values
  ath10k: handle 10.4 fw wmi mgmt rx event
  ath10k: adjust default peer limits if qcache enabled in 10.4 fw
  ath10k: handle 10.4 fw wmi ready event

 drivers/net/wireless/ath/ath10k/core.c|   9 +
 drivers/net/wireless/ath/ath10k/core.h|   2 +
 drivers/net/wireless/ath/ath10k/hw.h  |  61 +++
 drivers/net/wireless/ath/ath10k/mac.c |   2 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  90 +++
 drivers/net/wireless/ath/ath10k/wmi.c | 879 +-
 drivers/net/wireless/ath/ath10k/wmi.h | 859 -
 7 files changed, 1896 insertions(+), 6 deletions(-)

-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in


[PATCH v2 02/10] ath10k: add 10.4 fw wmi service bitmap definition

2015-06-22 Thread Raja Mani
Include new enum to define wmi service bitmap definitions for
10.4 firmware and a function wmi_10_4_svc_map() to remap 10.4
firmware wmi service bitmap definitions to ath10k generic wmi
services.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
v2 changes:
 - updated wmi service ids based on stable 10.4 firmware.

 drivers/net/wireless/ath/ath10k/wmi.c |   5 ++
 drivers/net/wireless/ath/ath10k/wmi.h | 146 ++
 2 files changed, 151 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index b32bb68..52493d1 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5412,10 +5412,15 @@ static const struct wmi_ops wmi_10_2_4_ops = {
/* .gen_adaptive_qcs not implemented */
 };
 
+static const struct wmi_ops wmi_10_4_ops = {
+   .map_svc = wmi_10_4_svc_map,
+};
+
 int ath10k_wmi_attach(struct ath10k *ar)
 {
switch (ar-wmi.op_version) {
case ATH10K_FW_WMI_OP_VERSION_10_4:
+   ar-wmi.ops = wmi_10_4_ops;
break;
case ATH10K_FW_WMI_OP_VERSION_10_2_4:
ar-wmi.cmd = wmi_10_2_4_cmd_map;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index cf44a3d..b54d14b 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -150,6 +150,12 @@ enum wmi_service {
WMI_SERVICE_SAP_AUTH_OFFLOAD,
WMI_SERVICE_ATF,
WMI_SERVICE_COEX_GPIO,
+   WMI_SERVICE_ENHANCED_PROXY_STA,
+   WMI_SERVICE_TT,
+   WMI_SERVICE_PEER_CACHING,
+   WMI_SERVICE_AUX_SPECTRAL_INTF,
+   WMI_SERVICE_AUX_CHAN_LOAD_INTF,
+   WMI_SERVICE_BSS_CHANNEL_INFO_64,
 
/* keep last */
WMI_SERVICE_MAX,
@@ -218,6 +224,51 @@ enum wmi_main_service {
WMI_MAIN_SERVICE_TX_ENCAP,
 };
 
+enum wmi_10_4_service {
+   WMI_10_4_SERVICE_BEACON_OFFLOAD = 0,
+   WMI_10_4_SERVICE_SCAN_OFFLOAD,
+   WMI_10_4_SERVICE_ROAM_OFFLOAD,
+   WMI_10_4_SERVICE_BCN_MISS_OFFLOAD,
+   WMI_10_4_SERVICE_STA_PWRSAVE,
+   WMI_10_4_SERVICE_STA_ADVANCED_PWRSAVE,
+   WMI_10_4_SERVICE_AP_UAPSD,
+   WMI_10_4_SERVICE_AP_DFS,
+   WMI_10_4_SERVICE_11AC,
+   WMI_10_4_SERVICE_BLOCKACK,
+   WMI_10_4_SERVICE_PHYERR,
+   WMI_10_4_SERVICE_BCN_FILTER,
+   WMI_10_4_SERVICE_RTT,
+   WMI_10_4_SERVICE_RATECTRL,
+   WMI_10_4_SERVICE_WOW,
+   WMI_10_4_SERVICE_RATECTRL_CACHE,
+   WMI_10_4_SERVICE_IRAM_TIDS,
+   WMI_10_4_SERVICE_BURST,
+   WMI_10_4_SERVICE_SMART_ANTENNA_SW_SUPPORT,
+   WMI_10_4_SERVICE_GTK_OFFLOAD,
+   WMI_10_4_SERVICE_SCAN_SCH,
+   WMI_10_4_SERVICE_CSA_OFFLOAD,
+   WMI_10_4_SERVICE_CHATTER,
+   WMI_10_4_SERVICE_COEX_FREQAVOID,
+   WMI_10_4_SERVICE_PACKET_POWER_SAVE,
+   WMI_10_4_SERVICE_FORCE_FW_HANG,
+   WMI_10_4_SERVICE_SMART_ANTENNA_HW_SUPPORT,
+   WMI_10_4_SERVICE_GPIO,
+   WMI_10_4_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG,
+   WMI_10_4_SERVICE_STA_UAPSD_VAR_AUTO_TRIG,
+   WMI_10_4_SERVICE_STA_KEEP_ALIVE,
+   WMI_10_4_SERVICE_TX_ENCAP,
+   WMI_10_4_SERVICE_AP_PS_DETECT_OUT_OF_SYNC,
+   WMI_10_4_SERVICE_EARLY_RX,
+   WMI_10_4_SERVICE_ENHANCED_PROXY_STA,
+   WMI_10_4_SERVICE_TT,
+   WMI_10_4_SERVICE_ATF,
+   WMI_10_4_SERVICE_PEER_CACHING,
+   WMI_10_4_SERVICE_COEX_GPIO,
+   WMI_10_4_SERVICE_AUX_SPECTRAL_INTF,
+   WMI_10_4_SERVICE_AUX_CHAN_LOAD_INTF,
+   WMI_10_4_SERVICE_BSS_CHANNEL_INFO_64,
+};
+
 static inline char *wmi_service_name(int service_id)
 {
 #define SVCSTR(x) case x: return #x
@@ -299,6 +350,12 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_SAP_AUTH_OFFLOAD);
SVCSTR(WMI_SERVICE_ATF);
SVCSTR(WMI_SERVICE_COEX_GPIO);
+   SVCSTR(WMI_SERVICE_ENHANCED_PROXY_STA);
+   SVCSTR(WMI_SERVICE_TT);
+   SVCSTR(WMI_SERVICE_PEER_CACHING);
+   SVCSTR(WMI_SERVICE_AUX_SPECTRAL_INTF);
+   SVCSTR(WMI_SERVICE_AUX_CHAN_LOAD_INTF);
+   SVCSTR(WMI_SERVICE_BSS_CHANNEL_INFO_64);
default:
return NULL;
}
@@ -437,6 +494,95 @@ static inline void wmi_main_svc_map(const __le32 *in, 
unsigned long *out,
   WMI_SERVICE_TX_ENCAP, len);
 }
 
+static inline void wmi_10_4_svc_map(const __le32 *in, unsigned long *out,
+   size_t len)
+{
+   SVCMAP(WMI_10_4_SERVICE_BEACON_OFFLOAD,
+  WMI_SERVICE_BEACON_OFFLOAD, len);
+   SVCMAP(WMI_10_4_SERVICE_SCAN_OFFLOAD,
+  WMI_SERVICE_SCAN_OFFLOAD, len);
+   SVCMAP(WMI_10_4_SERVICE_ROAM_OFFLOAD,
+  WMI_SERVICE_ROAM_OFFLOAD, len);
+   SVCMAP(WMI_10_4_SERVICE_BCN_MISS_OFFLOAD,
+  WMI_SERVICE_BCN_MISS_OFFLOAD, len);
+   SVCMAP(WMI_10_4_SERVICE_STA_PWRSAVE,
+  WMI_SERVICE_STA_PWRSAVE, len);
+   SVCMAP(WMI_10_4_SERVICE_STA_ADVANCED_PWRSAVE

[PATCH v2 01/10] ath10k: include new wmi op version for 10.4 fw

2015-06-22 Thread Raja Mani
qca99X0 chip uses firmware version 10.4. Define a new macro
ATH10K_FW_WMI_OP_VERSION_10_4 for 10.4 firmware and include
in switch cases where ATH10K_FW_WMI_OP_VERSION_* is used
to avoid compilation error.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c | 2 ++
 drivers/net/wireless/ath/ath10k/hw.h   | 1 +
 drivers/net/wireless/ath/ath10k/mac.c  | 2 ++
 drivers/net/wireless/ath/ath10k/wmi.c  | 2 ++
 4 files changed, 7 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 80f38b5..5e8d8af 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1115,6 +1115,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-fw_stats_req_mask = WMI_STAT_PDEV | WMI_STAT_VDEV |
WMI_STAT_PEER;
break;
+   case ATH10K_FW_WMI_OP_VERSION_10_4:
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
WARN_ON(1);
@@ -1137,6 +1138,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
case ATH10K_FW_WMI_OP_VERSION_TLV:
ar-htt.op_version = ATH10K_FW_HTT_OP_VERSION_TLV;
break;
+   case ATH10K_FW_WMI_OP_VERSION_10_4:
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
WARN_ON(1);
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 3e27781..b0c89b4 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -137,6 +137,7 @@ enum ath10k_fw_wmi_op_version {
ATH10K_FW_WMI_OP_VERSION_10_2 = 3,
ATH10K_FW_WMI_OP_VERSION_TLV = 4,
ATH10K_FW_WMI_OP_VERSION_10_2_4 = 5,
+   ATH10K_FW_WMI_OP_VERSION_10_4 = 6,
 
/* keep last */
ATH10K_FW_WMI_OP_VERSION_MAX,
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 2ec2b0b..f9989d1 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6943,6 +6943,8 @@ int ath10k_mac_register(struct ath10k *ar)
ar-hw-wiphy-n_iface_combinations =
ARRAY_SIZE(ath10k_10x_if_comb);
break;
+   case ATH10K_FW_WMI_OP_VERSION_10_4:
+   break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
WARN_ON(1);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 6c046c2..b32bb68 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5415,6 +5415,8 @@ static const struct wmi_ops wmi_10_2_4_ops = {
 int ath10k_wmi_attach(struct ath10k *ar)
 {
switch (ar-wmi.op_version) {
+   case ATH10K_FW_WMI_OP_VERSION_10_4:
+   break;
case ATH10K_FW_WMI_OP_VERSION_10_2_4:
ar-wmi.cmd = wmi_10_2_4_cmd_map;
ar-wmi.ops = wmi_10_2_4_ops;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in


[PATCH v2 03/10] ath10k: include 10.4 fw specific wmi cmd and event ids

2015-06-22 Thread Raja Mani
10.4 firmware wmi cmd and event id values are not exactly aligned
with previous firmware versions (main, 10.x, 10.2, etc). Add new
enum to define wmi cmd  event definitions for 10.4 firmware and
prepare wmi_10_4_cmd_map based on 10.4 firmware wmi cmd definitions.

wmi_cmd_map is extended to accommodate new wmi commands which are
exclusively available in 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
v2 changes:
 - updated wmi cmd/event ids based on stable 10.4 firmware.

 drivers/net/wireless/ath/ath10k/wmi.c | 184 +
 drivers/net/wireless/ath/ath10k/wmi.h | 252 ++
 2 files changed, 436 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 52493d1..8dc937d 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -395,6 +395,189 @@ static struct wmi_cmd_map wmi_10_2_4_cmd_map = {
.pdev_get_temperature_cmdid = WMI_10_2_PDEV_GET_TEMPERATURE_CMDID,
 };
 
+/* 10.4 WMI cmd track */
+static struct wmi_cmd_map wmi_10_4_cmd_map = {
+   .init_cmdid = WMI_10_4_INIT_CMDID,
+   .start_scan_cmdid = WMI_10_4_START_SCAN_CMDID,
+   .stop_scan_cmdid = WMI_10_4_STOP_SCAN_CMDID,
+   .scan_chan_list_cmdid = WMI_10_4_SCAN_CHAN_LIST_CMDID,
+   .scan_sch_prio_tbl_cmdid = WMI_10_4_SCAN_SCH_PRIO_TBL_CMDID,
+   .pdev_set_regdomain_cmdid = WMI_10_4_PDEV_SET_REGDOMAIN_CMDID,
+   .pdev_set_channel_cmdid = WMI_10_4_PDEV_SET_CHANNEL_CMDID,
+   .pdev_set_param_cmdid = WMI_10_4_PDEV_SET_PARAM_CMDID,
+   .pdev_pktlog_enable_cmdid = WMI_10_4_PDEV_PKTLOG_ENABLE_CMDID,
+   .pdev_pktlog_disable_cmdid = WMI_10_4_PDEV_PKTLOG_DISABLE_CMDID,
+   .pdev_set_wmm_params_cmdid = WMI_10_4_PDEV_SET_WMM_PARAMS_CMDID,
+   .pdev_set_ht_cap_ie_cmdid = WMI_10_4_PDEV_SET_HT_CAP_IE_CMDID,
+   .pdev_set_vht_cap_ie_cmdid = WMI_10_4_PDEV_SET_VHT_CAP_IE_CMDID,
+   .pdev_set_dscp_tid_map_cmdid = WMI_10_4_PDEV_SET_DSCP_TID_MAP_CMDID,
+   .pdev_set_quiet_mode_cmdid = WMI_10_4_PDEV_SET_QUIET_MODE_CMDID,
+   .pdev_green_ap_ps_enable_cmdid = WMI_10_4_PDEV_GREEN_AP_PS_ENABLE_CMDID,
+   .pdev_get_tpc_config_cmdid = WMI_10_4_PDEV_GET_TPC_CONFIG_CMDID,
+   .pdev_set_base_macaddr_cmdid = WMI_10_4_PDEV_SET_BASE_MACADDR_CMDID,
+   .vdev_create_cmdid = WMI_10_4_VDEV_CREATE_CMDID,
+   .vdev_delete_cmdid = WMI_10_4_VDEV_DELETE_CMDID,
+   .vdev_start_request_cmdid = WMI_10_4_VDEV_START_REQUEST_CMDID,
+   .vdev_restart_request_cmdid = WMI_10_4_VDEV_RESTART_REQUEST_CMDID,
+   .vdev_up_cmdid = WMI_10_4_VDEV_UP_CMDID,
+   .vdev_stop_cmdid = WMI_10_4_VDEV_STOP_CMDID,
+   .vdev_down_cmdid = WMI_10_4_VDEV_DOWN_CMDID,
+   .vdev_set_param_cmdid = WMI_10_4_VDEV_SET_PARAM_CMDID,
+   .vdev_install_key_cmdid = WMI_10_4_VDEV_INSTALL_KEY_CMDID,
+   .peer_create_cmdid = WMI_10_4_PEER_CREATE_CMDID,
+   .peer_delete_cmdid = WMI_10_4_PEER_DELETE_CMDID,
+   .peer_flush_tids_cmdid = WMI_10_4_PEER_FLUSH_TIDS_CMDID,
+   .peer_set_param_cmdid = WMI_10_4_PEER_SET_PARAM_CMDID,
+   .peer_assoc_cmdid = WMI_10_4_PEER_ASSOC_CMDID,
+   .peer_add_wds_entry_cmdid = WMI_10_4_PEER_ADD_WDS_ENTRY_CMDID,
+   .peer_remove_wds_entry_cmdid = WMI_10_4_PEER_REMOVE_WDS_ENTRY_CMDID,
+   .peer_mcast_group_cmdid = WMI_10_4_PEER_MCAST_GROUP_CMDID,
+   .bcn_tx_cmdid = WMI_10_4_BCN_TX_CMDID,
+   .pdev_send_bcn_cmdid = WMI_10_4_PDEV_SEND_BCN_CMDID,
+   .bcn_tmpl_cmdid = WMI_10_4_BCN_PRB_TMPL_CMDID,
+   .bcn_filter_rx_cmdid = WMI_10_4_BCN_FILTER_RX_CMDID,
+   .prb_req_filter_rx_cmdid = WMI_10_4_PRB_REQ_FILTER_RX_CMDID,
+   .mgmt_tx_cmdid = WMI_10_4_MGMT_TX_CMDID,
+   .prb_tmpl_cmdid = WMI_10_4_PRB_TMPL_CMDID,
+   .addba_clear_resp_cmdid = WMI_10_4_ADDBA_CLEAR_RESP_CMDID,
+   .addba_send_cmdid = WMI_10_4_ADDBA_SEND_CMDID,
+   .addba_status_cmdid = WMI_10_4_ADDBA_STATUS_CMDID,
+   .delba_send_cmdid = WMI_10_4_DELBA_SEND_CMDID,
+   .addba_set_resp_cmdid = WMI_10_4_ADDBA_SET_RESP_CMDID,
+   .send_singleamsdu_cmdid = WMI_10_4_SEND_SINGLEAMSDU_CMDID,
+   .sta_powersave_mode_cmdid = WMI_10_4_STA_POWERSAVE_MODE_CMDID,
+   .sta_powersave_param_cmdid = WMI_10_4_STA_POWERSAVE_PARAM_CMDID,
+   .sta_mimo_ps_mode_cmdid = WMI_10_4_STA_MIMO_PS_MODE_CMDID,
+   .pdev_dfs_enable_cmdid = WMI_10_4_PDEV_DFS_ENABLE_CMDID,
+   .pdev_dfs_disable_cmdid = WMI_10_4_PDEV_DFS_DISABLE_CMDID,
+   .roam_scan_mode = WMI_10_4_ROAM_SCAN_MODE,
+   .roam_scan_rssi_threshold = WMI_10_4_ROAM_SCAN_RSSI_THRESHOLD,
+   .roam_scan_period = WMI_10_4_ROAM_SCAN_PERIOD,
+   .roam_scan_rssi_change_threshold =
+   WMI_10_4_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
+   .roam_ap_profile = WMI_10_4_ROAM_AP_PROFILE,
+   .ofl_scan_add_ap_profile = WMI_10_4_OFL_SCAN_ADD_AP_PROFILE,
+   .ofl_scan_remove_ap_profile = WMI_10_4_OFL_SCAN_REMOVE_AP_PROFILE

[PATCH v2 05/10] ath10k: add 10.4 fw wmi vdev cmd ids

2015-06-22 Thread Raja Mani
Include 10.4 firmware wmi vdev cmd id and make up wmi vdev map
table wmi_10_4_vdev_param_map and also update non 10.4 firmware
vdev cmd map table with newly added vdev cmd id specifically for
10.4 firmware as unsupported.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
v2 changes:
 - udpated vdev cmd id table based on stable 10.4 firmware.

 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  16 
 drivers/net/wireless/ath/ath10k/wmi.c | 124 ++
 drivers/net/wireless/ath/ath10k/wmi.h |  85 
 3 files changed, 225 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 7e75dec..b2a8e32 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -3294,6 +3294,22 @@ static struct wmi_vdev_param_map wmi_tlv_vdev_param_map 
= {
.tx_encap_type = WMI_TLV_VDEV_PARAM_TX_ENCAP_TYPE,
.ap_detect_out_of_sync_sleeping_sta_time_secs =
WMI_TLV_VDEV_PARAM_UNSUPPORTED,
+   .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED,
+   .cabq_maxdur = WMI_VDEV_PARAM_UNSUPPORTED,
+   .mfptest_set = WMI_VDEV_PARAM_UNSUPPORTED,
+   .rts_fixed_rate = WMI_VDEV_PARAM_UNSUPPORTED,
+   .vht_sgimask = WMI_VDEV_PARAM_UNSUPPORTED,
+   .vht80_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_adjust_enable = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_tgt_bmiss_num = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_bmiss_sample_cycle = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_slop_step = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_init_slop = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_adjust_pause = WMI_VDEV_PARAM_UNSUPPORTED,
+   .proxy_sta = WMI_VDEV_PARAM_UNSUPPORTED,
+   .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED,
+   .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED,
+   .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
 };
 
 static const struct wmi_ops wmi_tlv_ops = {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index a58ddb7..087dea8 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -761,6 +761,22 @@ static struct wmi_vdev_param_map wmi_vdev_param_map = {
.tx_encap_type = WMI_VDEV_PARAM_TX_ENCAP_TYPE,
.ap_detect_out_of_sync_sleeping_sta_time_secs =
WMI_VDEV_PARAM_UNSUPPORTED,
+   .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED,
+   .cabq_maxdur = WMI_VDEV_PARAM_UNSUPPORTED,
+   .mfptest_set = WMI_VDEV_PARAM_UNSUPPORTED,
+   .rts_fixed_rate = WMI_VDEV_PARAM_UNSUPPORTED,
+   .vht_sgimask = WMI_VDEV_PARAM_UNSUPPORTED,
+   .vht80_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_adjust_enable = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_tgt_bmiss_num = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_bmiss_sample_cycle = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_slop_step = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_init_slop = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_adjust_pause = WMI_VDEV_PARAM_UNSUPPORTED,
+   .proxy_sta = WMI_VDEV_PARAM_UNSUPPORTED,
+   .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED,
+   .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED,
+   .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
 };
 
 /* 10.X WMI VDEV param map */
@@ -820,6 +836,22 @@ static struct wmi_vdev_param_map wmi_10x_vdev_param_map = {
.tx_encap_type = WMI_VDEV_PARAM_UNSUPPORTED,
.ap_detect_out_of_sync_sleeping_sta_time_secs =
WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS,
+   .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED,
+   .cabq_maxdur = WMI_VDEV_PARAM_UNSUPPORTED,
+   .mfptest_set = WMI_VDEV_PARAM_UNSUPPORTED,
+   .rts_fixed_rate = WMI_VDEV_PARAM_UNSUPPORTED,
+   .vht_sgimask = WMI_VDEV_PARAM_UNSUPPORTED,
+   .vht80_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_adjust_enable = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_tgt_bmiss_num = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_bmiss_sample_cycle = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_slop_step = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_init_slop = WMI_VDEV_PARAM_UNSUPPORTED,
+   .early_rx_adjust_pause = WMI_VDEV_PARAM_UNSUPPORTED,
+   .proxy_sta = WMI_VDEV_PARAM_UNSUPPORTED,
+   .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED,
+   .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED,
+   .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
 };
 
 static struct wmi_vdev_param_map wmi_10_2_4_vdev_param_map = {
@@ -878,6 +910,97 @@ static struct wmi_vdev_param_map wmi_10_2_4_vdev_param_map 
= {
.tx_encap_type = WMI_VDEV_PARAM_UNSUPPORTED,
.ap_detect_out_of_sync_sleeping_sta_time_secs =
WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS,
+   .rc_num_retries = WMI_VDEV_PARAM_UNSUPPORTED,
+   .cabq_maxdur

[PATCH v2 04/10] ath10k: set 10.4 fw exclusive wmi cmd as unsupported for other fw versions

2015-06-22 Thread Raja Mani
In fact, explicit assigned to ZERO for unsupported wmi commands
are not really needed. Global static variable will have ZERO by
default. However, just for better readability setting all wmi cmds
in non 10.4 firmware wmi mapping table as unsupported for wmi cmd
which are exclusively available only in 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  32 ++
 drivers/net/wireless/ath/ath10k/wmi.c | 158 ++
 2 files changed, 190 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 8fdba38..7e75dec 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -3151,6 +3151,38 @@ static struct wmi_cmd_map wmi_tlv_cmd_map = {
.tdls_set_state_cmdid = WMI_TLV_TDLS_SET_STATE_CMDID,
.tdls_peer_update_cmdid = WMI_TLV_TDLS_PEER_UPDATE_CMDID,
.adaptive_qcs_cmdid = WMI_TLV_RESMGR_ADAPTIVE_OCS_CMDID,
+   .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED,
+   .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED,
+   .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED,
+   .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED,
+   .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED,
+   .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED,
+   .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED,
+   .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
+   .oem_req_cmdid = WMI_CMD_UNSUPPORTED,
+   .nan_cmdid = WMI_CMD_UNSUPPORTED,
+   .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED,
+   .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED,
+   .tt_set_conf_cmdid = WMI_CMD_UNSUPPORTED,
+   .fwtest_cmdid = WMI_CMD_UNSUPPORTED,
+   .vdev_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_atf_request_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_get_ani_cck_config_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_get_ani_ofdm_config_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_reserve_ast_entry_cmdid = WMI_CMD_UNSUPPORTED,
 };
 
 static struct wmi_pdev_param_map wmi_tlv_pdev_param_map = {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 8dc937d..a58ddb7 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -148,6 +148,48 @@ static struct wmi_cmd_map wmi_cmd_map = {
.gpio_config_cmdid = WMI_GPIO_CONFIG_CMDID,
.gpio_output_cmdid = WMI_GPIO_OUTPUT_CMDID,
.pdev_get_temperature_cmdid = WMI_CMD_UNSUPPORTED,
+   .scan_update_request_cmdid = WMI_CMD_UNSUPPORTED,
+   .vdev_standby_response_cmdid = WMI_CMD_UNSUPPORTED,
+   .vdev_resume_response_cmdid = WMI_CMD_UNSUPPORTED,
+   .wlan_peer_caching_add_peer_cmdid = WMI_CMD_UNSUPPORTED,
+   .wlan_peer_caching_evict_peer_cmdid = WMI_CMD_UNSUPPORTED,
+   .wlan_peer_caching_restore_peer_cmdid = WMI_CMD_UNSUPPORTED,
+   .wlan_peer_caching_print_all_peers_info_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_update_wds_entry_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_add_proxy_sta_entry_cmdid = WMI_CMD_UNSUPPORTED,
+   .rtt_keepalive_cmdid = WMI_CMD_UNSUPPORTED,
+   .oem_req_cmdid = WMI_CMD_UNSUPPORTED,
+   .nan_cmdid = WMI_CMD_UNSUPPORTED,
+   .vdev_ratemask_cmdid = WMI_CMD_UNSUPPORTED,
+   .qboost_cfg_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_smart_ant_enable_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_smart_ant_set_rx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_smart_ant_set_tx_antenna_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_smart_ant_set_train_info_cmdid = WMI_CMD_UNSUPPORTED,
+   .peer_smart_ant_set_node_config_ops_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_set_antenna_switch_table_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_set_ctl_table_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_set_mimogain_table_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_ratepwr_table_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_ratepwr_chainmsk_table_cmdid = WMI_CMD_UNSUPPORTED,
+   .pdev_fips_cmdid = WMI_CMD_UNSUPPORTED,
+   .tt_set_conf_cmdid

[PATCH 7/8] ath10k: set max spatial stream to 4 for 10.4 fw

2015-06-15 Thread Raja Mani
10.4 fw supports upto 4 spatial stream. Limit max spatial
stream to 4 for 10.4 firmware and to 3 for non 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c | 4 
 drivers/net/wireless/ath/ath10k/core.h | 1 +
 drivers/net/wireless/ath/ath10k/wmi.c  | 6 +++---
 drivers/net/wireless/ath/ath10k/wmi.h  | 3 ++-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 23e855c..e9f2bf9f 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1292,6 +1292,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-htt.max_num_pending_tx = TARGET_NUM_MSDU_DESC;
ar-fw_stats_req_mask = WMI_STAT_PDEV | WMI_STAT_VDEV |
WMI_STAT_PEER;
+   ar-max_spatial_stream = WMI_MAX_SPATIAL_STREAM;
break;
case ATH10K_FW_WMI_OP_VERSION_10_1:
case ATH10K_FW_WMI_OP_VERSION_10_2:
@@ -1301,6 +1302,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-max_num_vdevs = TARGET_10X_NUM_VDEVS;
ar-htt.max_num_pending_tx = TARGET_10X_NUM_MSDU_DESC;
ar-fw_stats_req_mask = WMI_STAT_PEER;
+   ar-max_spatial_stream = WMI_MAX_SPATIAL_STREAM;
break;
case ATH10K_FW_WMI_OP_VERSION_TLV:
ar-max_num_peers = TARGET_TLV_NUM_PEERS;
@@ -1311,6 +1313,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-wow.max_num_patterns = TARGET_TLV_NUM_WOW_PATTERNS;
ar-fw_stats_req_mask = WMI_STAT_PDEV | WMI_STAT_VDEV |
WMI_STAT_PEER;
+   ar-max_spatial_stream = WMI_MAX_SPATIAL_STREAM;
break;
case ATH10K_FW_WMI_OP_VERSION_10_4:
ar-max_num_peers = TARGET_10_4_NUM_PEERS;
@@ -1320,6 +1323,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-num_tids = TARGET_10_4_TGT_NUM_TIDS;
ar-htt.max_num_pending_tx = TARGET_10_4_NUM_MSDU_DESC;
ar-fw_stats_req_mask = WMI_STAT_PEER;
+   ar-max_spatial_stream = WMI_10_4_MAX_SPATIAL_STREAM;
break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 7721548..8647ca3 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -578,6 +578,7 @@ struct ath10k {
u32 ht_cap_info;
u32 vht_cap_info;
u32 num_rf_chains;
+   u32 max_spatial_stream;
/* protected by conf_mutex */
bool ani_enabled;
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 00201eb..2f81ff2 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3818,10 +3818,10 @@ void ath10k_wmi_event_service_ready(struct ath10k *ar, 
struct sk_buff *skb)
if (ar-fw_api == 1  ar-fw_version_build  636)
set_bit(ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX, ar-fw_features);
 
-   if (ar-num_rf_chains  WMI_MAX_SPATIAL_STREAM) {
+   if (ar-num_rf_chains  ar-max_spatial_stream) {
ath10k_warn(ar, hardware advertises support for more spatial 
streams than it should (%d  %d)\n,
-   ar-num_rf_chains, WMI_MAX_SPATIAL_STREAM);
-   ar-num_rf_chains = WMI_MAX_SPATIAL_STREAM;
+   ar-num_rf_chains, ar-max_spatial_stream);
+   ar-num_rf_chains = ar-max_spatial_stream;
}
 
ar-supp_tx_chainmask = (1  ar-num_rf_chains) - 1;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 90c872c..aa9b313 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1702,7 +1702,8 @@ enum wmi_channel_change_cause {
 /* Indicate reason for channel switch */
 #define WMI_CHANNEL_CHANGE_CAUSE_CSA (1  13)
 
-#define WMI_MAX_SPATIAL_STREAM   3
+#define WMI_MAX_SPATIAL_STREAM3 /* default max ss */
+#define WMI_10_4_MAX_SPATIAL_STREAM   4
 
 /* HT Capabilities*/
 #define WMI_HT_CAP_ENABLED0x0001   /* HT Enabled/ disabled */
-- 
1.8.1.2

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


[PATCH 5/8] ath10k: add 10.4 fw specific htt msg definitions

2015-06-15 Thread Raja Mani
New htt event table is added for 10.4 firmware. New htt event
HTT_T2H_MSG_TYPE_EN_STATS is available only in 10.4, adding this
to generic htt event table.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c   |  3 +++
 drivers/net/wireless/ath/ath10k/htt.c| 35 
 drivers/net/wireless/ath/ath10k/htt.h| 30 +++
 drivers/net/wireless/ath/ath10k/htt_rx.c |  3 +++
 drivers/net/wireless/ath/ath10k/hw.h |  2 ++
 5 files changed, 73 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 4e762d0..23e855c 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1318,6 +1318,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-num_active_peers = TARGET_10_4_ACTIVE_PEERS;
ar-max_num_vdevs = TARGET_10_4_NUM_VDEVS;
ar-num_tids = TARGET_10_4_TGT_NUM_TIDS;
+   ar-htt.max_num_pending_tx = TARGET_10_4_NUM_MSDU_DESC;
ar-fw_stats_req_mask = WMI_STAT_PEER;
break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
@@ -1343,6 +1344,8 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-htt.op_version = ATH10K_FW_HTT_OP_VERSION_TLV;
break;
case ATH10K_FW_WMI_OP_VERSION_10_4:
+   ar-htt.op_version = ATH10K_FW_HTT_OP_VERSION_10_4;
+   break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
WARN_ON(1);
diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
index 6da6ef2..2bb9acc 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -102,6 +102,37 @@ static const enum htt_t2h_msg_type htt_tlv_t2h_msg_types[] 
= {
[HTT_TLV_T2H_MSG_TYPE_TEST] = HTT_T2H_MSG_TYPE_TEST,
 };
 
+static const enum htt_t2h_msg_type htt_10_4_t2h_msg_types[] = {
+   [HTT_10_4_T2H_MSG_TYPE_VERSION_CONF] = HTT_T2H_MSG_TYPE_VERSION_CONF,
+   [HTT_10_4_T2H_MSG_TYPE_RX_IND] = HTT_T2H_MSG_TYPE_RX_IND,
+   [HTT_10_4_T2H_MSG_TYPE_RX_FLUSH] = HTT_T2H_MSG_TYPE_RX_FLUSH,
+   [HTT_10_4_T2H_MSG_TYPE_PEER_MAP] = HTT_T2H_MSG_TYPE_PEER_MAP,
+   [HTT_10_4_T2H_MSG_TYPE_PEER_UNMAP] = HTT_T2H_MSG_TYPE_PEER_UNMAP,
+   [HTT_10_4_T2H_MSG_TYPE_RX_ADDBA] = HTT_T2H_MSG_TYPE_RX_ADDBA,
+   [HTT_10_4_T2H_MSG_TYPE_RX_DELBA] = HTT_T2H_MSG_TYPE_RX_DELBA,
+   [HTT_10_4_T2H_MSG_TYPE_TX_COMPL_IND] = HTT_T2H_MSG_TYPE_TX_COMPL_IND,
+   [HTT_10_4_T2H_MSG_TYPE_PKTLOG] = HTT_T2H_MSG_TYPE_PKTLOG,
+   [HTT_10_4_T2H_MSG_TYPE_STATS_CONF] = HTT_T2H_MSG_TYPE_STATS_CONF,
+   [HTT_10_4_T2H_MSG_TYPE_RX_FRAG_IND] = HTT_T2H_MSG_TYPE_RX_FRAG_IND,
+   [HTT_10_4_T2H_MSG_TYPE_SEC_IND] = HTT_T2H_MSG_TYPE_SEC_IND,
+   [HTT_10_4_T2H_MSG_TYPE_RC_UPDATE_IND] = HTT_T2H_MSG_TYPE_RC_UPDATE_IND,
+   [HTT_10_4_T2H_MSG_TYPE_TX_INSPECT_IND] =
+   HTT_T2H_MSG_TYPE_TX_INSPECT_IND,
+   [HTT_10_4_T2H_MSG_TYPE_MGMT_TX_COMPL_IND] =
+   HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION,
+   [HTT_10_4_T2H_MSG_TYPE_CHAN_CHANGE] = HTT_T2H_MSG_TYPE_CHAN_CHANGE,
+   [HTT_10_4_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND] =
+   HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND,
+   [HTT_10_4_T2H_MSG_TYPE_RX_PN_IND] = HTT_T2H_MSG_TYPE_RX_PN_IND,
+   [HTT_10_4_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND] =
+   HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND,
+   [HTT_10_4_T2H_MSG_TYPE_TEST] = HTT_T2H_MSG_TYPE_TEST,
+   [HTT_10_4_T2H_MSG_TYPE_EN_STATS] = HTT_T2H_MSG_TYPE_EN_STATS,
+   [HTT_10_4_T2H_MSG_TYPE_AGGR_CONF] = HTT_T2H_MSG_TYPE_AGGR_CONF,
+   [HTT_10_4_T2H_MSG_TYPE_STATS_NOUPLOAD] =
+   HTT_T2H_MSG_TYPE_STATS_NOUPLOAD,
+};
+
 int ath10k_htt_connect(struct ath10k_htt *htt)
 {
struct ath10k_htc_svc_conn_req conn_req;
@@ -147,6 +178,10 @@ int ath10k_htt_init(struct ath10k *ar)
2; /* ip4 dscp or ip6 priority */
 
switch (ar-htt.op_version) {
+   case ATH10K_FW_HTT_OP_VERSION_10_4:
+   ar-htt.t2h_msg_types = htt_10_4_t2h_msg_types;
+   ar-htt.t2h_msg_types_max = HTT_10_4_T2H_NUM_MSGS;
+   break;
case ATH10K_FW_HTT_OP_VERSION_10_1:
ar-htt.t2h_msg_types = htt_10x_t2h_msg_types;
ar-htt.t2h_msg_types_max = HTT_10X_T2H_NUM_MSGS;
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index 7e8a0d8..2a2ba12 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -349,6 +349,35 @@ enum htt_tlv_t2h_msg_type {
HTT_TLV_T2H_NUM_MSGS
 };
 
+enum htt_10_4_t2h_msg_type

[PATCH 6/8] ath10k: advertise 10.4 fw ap and sta iface combination to mac80211

2015-06-15 Thread Raja Mani
10.4 fw supports upto 16 interface in ap mode and 1 interface
in station mode, overall total interfaces supported are 16
interfaces. Populate this limit in wiphy-iface_combinations.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/mac.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 187e524..3c5d2b0 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6620,6 +6620,33 @@ static struct ieee80211_iface_combination 
ath10k_tlv_qcs_if_comb[] = {
},
 };
 
+static const struct ieee80211_iface_limit ath10k_10_4_if_limits[] = {
+   {
+   .max = 1,
+   .types = BIT(NL80211_IFTYPE_STATION),
+   },
+   {
+   .max= 16,
+   .types  = BIT(NL80211_IFTYPE_AP)
+   },
+};
+
+static const struct ieee80211_iface_combination ath10k_10_4_if_comb[] = {
+   {
+   .limits = ath10k_10_4_if_limits,
+   .n_limits = ARRAY_SIZE(ath10k_10_4_if_limits),
+   .max_interfaces = 16,
+   .num_different_channels = 1,
+   .beacon_int_infra_match = true,
+#ifdef CONFIG_ATH10K_DFS_CERTIFIED
+   .radar_detect_widths =  BIT(NL80211_CHAN_WIDTH_20_NOHT) |
+   BIT(NL80211_CHAN_WIDTH_20) |
+   BIT(NL80211_CHAN_WIDTH_40) |
+   BIT(NL80211_CHAN_WIDTH_80),
+#endif
+   },
+};
+
 static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
 {
struct ieee80211_sta_vht_cap vht_cap = {0};
@@ -6942,6 +6969,9 @@ int ath10k_mac_register(struct ath10k *ar)
ARRAY_SIZE(ath10k_10x_if_comb);
break;
case ATH10K_FW_WMI_OP_VERSION_10_4:
+   ar-hw-wiphy-iface_combinations = ath10k_10_4_if_comb;
+   ar-hw-wiphy-n_iface_combinations =
+   ARRAY_SIZE(ath10k_10_4_if_comb);
break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
-- 
1.8.1.2

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


[PATCH 8/8] ath10k: configure frag desc memory to target for qca99X0

2015-06-15 Thread Raja Mani
Pre qca99X0 chipsets follows the model where dynamically allocate
memory for frag desc on getting new skb for TX. But, this is not
going to be the case in qca99X0. It expects frag desc memory to be
allocated at boot time and let the driver to reuse allocated memory
after every TX completion. So there won't be any dynamic frag memory
memory allocation in qca99X0 during data transmission.

qca99X0 hardware doesn't need fragment desc address to be programmed
in msdu descriptor for every data transaction. It needs to know only
starting address of fragment descriptor at the time of the boot.
During data transmission, qca99X0 hardware can retrieve corresponding
frag addr by adding programmed frag desc base addr + msdu id.

Allocate continuous fragment descriptor memory (same size as number of
descriptor) at the time of target initialization and configure allocated
dma address to the target via HTT_H2T_MSG_TYPE_FRAG_DESC_BANK_CFG.

How this is allocated continuous memory is going to be used is not
covered in this patch. It just allocates memory and hand over to firmware.
If we don't do it at init time, qca99X0 will stall when firmware tries
to do TX.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c   |  1 +
 drivers/net/wireless/ath/ath10k/core.h   |  6 +++
 drivers/net/wireless/ath/ath10k/htt.c|  4 ++
 drivers/net/wireless/ath/ath10k/htt.h| 11 +
 drivers/net/wireless/ath/ath10k/htt_tx.c | 76 +++-
 5 files changed, 96 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index e9f2bf9f..566b1de 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -111,6 +111,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.otp_exe_param = 0x0700,
+   .continuous_frag_desc = true,
.fw = {
.dir = QCA99X0_HW_2_0_FW_DIR,
.fw = QCA99X0_HW_2_0_FW_FILE,
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 8647ca3..bb1a4ed 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -614,6 +614,12 @@ struct ath10k {
 */
bool has_shifted_cc_wraparound;
 
+   /* Some of chip expects fragment descriptor to be continuous
+* memory for any TX operation. Set continuous_frag_desc flag
+* for the hardware which have such requirement.
+*/
+   bool continuous_frag_desc;
+
struct ath10k_hw_params_fw {
const char *dir;
const char *fw;
diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
index 2bb9acc..15f2a49 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -243,5 +243,9 @@ int ath10k_htt_setup(struct ath10k_htt *htt)
if (status)
return status;
 
+   status = ath10k_htt_send_frag_desc_bank_cfg(htt);
+   if (status)
+   return status;
+
return ath10k_htt_send_rx_ring_cfg_ll(htt);
 }
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index 2a2ba12..230eca5 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -87,6 +87,11 @@ struct htt_data_tx_desc_frag {
__le32 len;
 } __packed;
 
+struct htt_msdu_ext_desc {
+   __le32 tso_flag[4];
+   struct htt_data_tx_desc_frag frags[6];
+};
+
 enum htt_data_tx_desc_flags0 {
HTT_DATA_TX_DESC_FLAGS0_MAC_HDR_PRESENT = 1  0,
HTT_DATA_TX_DESC_FLAGS0_NO_AGGR = 1  1,
@@ -1460,6 +1465,11 @@ struct ath10k_htt {
 
/* rx_status template */
struct ieee80211_rx_status rx_status;
+
+   struct {
+   dma_addr_t paddr;
+   struct htt_msdu_ext_desc *vaddr;
+   } frag_desc;
 };
 
 #define RX_HTT_HDR_STATUS_LEN 64
@@ -1527,6 +1537,7 @@ void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct 
sk_buff *skb);
 void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb);
 int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt);
 int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u8 mask, u64 cookie);
+int ath10k_htt_send_frag_desc_bank_cfg(struct ath10k_htt *htt);
 int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt);
 int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt,
u8 max_subfrms_ampdu,
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index a60ef7d..148d5b6 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c

[PATCH 07/10] ath10k: fill 10.4 fw wmi init cmd default values

2015-06-15 Thread Raja Mani
Define 10.4 wmi init command structure and introduce new function
ath10k_wmi_10_4_op_gen_init() to fill default values for each field
which goes as part of wmi init cmd to 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c |   7 ++
 drivers/net/wireless/ath/ath10k/core.h |   2 +
 drivers/net/wireless/ath/ath10k/hw.h   |  54 
 drivers/net/wireless/ath/ath10k/wmi.c  |  83 +
 drivers/net/wireless/ath/ath10k/wmi.h  | 220 +
 5 files changed, 366 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index f4f6da6..4e762d0 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1313,6 +1313,13 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
WMI_STAT_PEER;
break;
case ATH10K_FW_WMI_OP_VERSION_10_4:
+   ar-max_num_peers = TARGET_10_4_NUM_PEERS;
+   ar-max_num_stations = TARGET_10_4_NUM_STATIONS;
+   ar-num_active_peers = TARGET_10_4_ACTIVE_PEERS;
+   ar-max_num_vdevs = TARGET_10_4_NUM_VDEVS;
+   ar-num_tids = TARGET_10_4_TGT_NUM_TIDS;
+   ar-fw_stats_req_mask = WMI_STAT_PEER;
+   break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
WARN_ON(1);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 581f849..7c2ffb3 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -717,6 +717,8 @@ struct ath10k {
int max_num_stations;
int max_num_vdevs;
int max_num_tdls_vdevs;
+   int num_active_peers;
+   int num_tids;
 
struct work_struct offchan_tx_work;
struct sk_buff_head offchan_tx_queue;
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index eb65709..d76b52a 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -355,6 +355,60 @@ enum ath10k_hw_rate_cck {
 
 #define NUM_TARGET_CE_CONFIG_WLAN ar-hw_values-num_target_ce_config_wlan
 
+/* Target specific defines for 10.4 firmware */
+#define TARGET_10_4_NUM_VDEVS  16
+#define TARGET_10_4_NUM_STATIONS   32
+#define TARGET_10_4_NUM_PEERS  ((TARGET_10_4_NUM_STATIONS) + \
+(TARGET_10_4_NUM_VDEVS))
+#define TARGET_10_4_ACTIVE_PEERS   0
+#define TARGET_10_4_NUM_OFFLOAD_PEERS  0
+#define TARGET_10_4_NUM_OFFLOAD_REORDER_BUFFS  0
+#define TARGET_10_4_NUM_PEER_KEYS  2
+#define TARGET_10_4_TGT_NUM_TIDS   ((TARGET_10_4_NUM_PEERS) * 2)
+#define TARGET_10_4_AST_SKID_LIMIT 32
+#define TARGET_10_4_TX_CHAIN_MASK  (BIT(0) | BIT(1) | \
+BIT(2) | BIT(3))
+#define TARGET_10_4_RX_CHAIN_MASK  (BIT(0) | BIT(1) | \
+BIT(2) | BIT(3))
+
+/* 100 ms for video, best-effort, and background */
+#define TARGET_10_4_RX_TIMEOUT_LO_PRI  100
+
+/* 40 ms for voice */
+#define TARGET_10_4_RX_TIMEOUT_HI_PRI  40
+
+#define TARGET_10_4_RX_DECAP_MODE  ATH10K_HW_TXRX_NATIVE_WIFI
+#define TARGET_10_4_SCAN_MAX_REQS  4
+#define TARGET_10_4_BMISS_OFFLOAD_MAX_VDEV 3
+#define TARGET_10_4_ROAM_OFFLOAD_MAX_VDEV  3
+#define TARGET_10_4_ROAM_OFFLOAD_MAX_PROFILES   8
+
+/* Note: mcast to ucast is disabled by default */
+#define TARGET_10_4_NUM_MCAST_GROUPS   0
+#define TARGET_10_4_NUM_MCAST_TABLE_ELEMS  0
+#define TARGET_10_4_MCAST2UCAST_MODE   0
+
+#define TARGET_10_4_TX_DBG_LOG_SIZE1024
+#define TARGET_10_4_NUM_WDS_ENTRIES32
+#define TARGET_10_4_DMA_BURST_SIZE 1
+#define TARGET_10_4_MAC_AGGR_DELIM 0
+#define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
+#define TARGET_10_4_VOW_CONFIG 0
+#define TARGET_10_4_GTK_OFFLOAD_MAX_VDEV   3
+#define TARGET_10_4_NUM_MSDU_DESC  (1024 + 400)
+#define TARGET_10_4_11AC_TX_MAX_FRAGS  2
+#define TARGET_10_4_MAX_PEER_EXT_STATS 16
+#define TARGET_10_4_SMART_ANT_CAP  0
+#define TARGET_10_4_BK_MIN_FREE0
+#define TARGET_10_4_BE_MIN_FREE0
+#define TARGET_10_4_VI_MIN_FREE0
+#define TARGET_10_4_VO_MIN_FREE0
+#define TARGET_10_4_RX_BATCH_MODE  1
+#define TARGET_10_4_THERMAL_THROTTLING_CONFIG  0
+#define TARGET_10_4_ATF_CONFIG 0
+#define TARGET_10_4_IPHDR_PAD_CONFIG   1
+#define TARGET_10_4_QWRAP_CONFIG   0
+
 /* Number of Copy Engines supported */
 #define CE_COUNT ar-hw_values

[PATCH 03/10] ath10k: include 10.4 fw specific wmi cmd and event ids

2015-06-15 Thread Raja Mani
10.4 firmware wmi cmd and event id values are not exactly aligned
with previous firmware versions (main, 10.x, 10.2, etc). Add new
enum to define wmi cmd  event definitions for 10.4 firmware and
prepare wmi_10_4_cmd_map based on 10.4 firmware wmi cmd definitions.

wmi_cmd_map is extended to accommodate new wmi commands which are
exclusively available in 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi.c | 172 ++
 drivers/net/wireless/ath/ath10k/wmi.h | 225 ++
 2 files changed, 397 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 52493d1..d3a5d46 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -395,6 +395,177 @@ static struct wmi_cmd_map wmi_10_2_4_cmd_map = {
.pdev_get_temperature_cmdid = WMI_10_2_PDEV_GET_TEMPERATURE_CMDID,
 };
 
+/* 10.4 WMI cmd track */
+static struct wmi_cmd_map wmi_10_4_cmd_map = {
+   .init_cmdid = WMI_10_4_INIT_CMDID,
+   .start_scan_cmdid = WMI_10_4_START_SCAN_CMDID,
+   .stop_scan_cmdid = WMI_10_4_STOP_SCAN_CMDID,
+   .scan_chan_list_cmdid = WMI_10_4_SCAN_CHAN_LIST_CMDID,
+   .scan_sch_prio_tbl_cmdid = WMI_10_4_SCAN_SCH_PRIO_TBL_CMDID,
+   .pdev_set_regdomain_cmdid = WMI_10_4_PDEV_SET_REGDOMAIN_CMDID,
+   .pdev_set_channel_cmdid = WMI_10_4_PDEV_SET_CHANNEL_CMDID,
+   .pdev_set_param_cmdid = WMI_10_4_PDEV_SET_PARAM_CMDID,
+   .pdev_pktlog_enable_cmdid = WMI_10_4_PDEV_PKTLOG_ENABLE_CMDID,
+   .pdev_pktlog_disable_cmdid = WMI_10_4_PDEV_PKTLOG_DISABLE_CMDID,
+   .pdev_set_wmm_params_cmdid = WMI_10_4_PDEV_SET_WMM_PARAMS_CMDID,
+   .pdev_set_ht_cap_ie_cmdid = WMI_10_4_PDEV_SET_HT_CAP_IE_CMDID,
+   .pdev_set_vht_cap_ie_cmdid = WMI_10_4_PDEV_SET_VHT_CAP_IE_CMDID,
+   .pdev_set_dscp_tid_map_cmdid = WMI_10_4_PDEV_SET_DSCP_TID_MAP_CMDID,
+   .pdev_set_quiet_mode_cmdid = WMI_10_4_PDEV_SET_QUIET_MODE_CMDID,
+   .pdev_green_ap_ps_enable_cmdid = WMI_10_4_PDEV_GREEN_AP_PS_ENABLE_CMDID,
+   .pdev_get_tpc_config_cmdid = WMI_10_4_PDEV_GET_TPC_CONFIG_CMDID,
+   .pdev_set_base_macaddr_cmdid = WMI_10_4_PDEV_SET_BASE_MACADDR_CMDID,
+   .vdev_create_cmdid = WMI_10_4_VDEV_CREATE_CMDID,
+   .vdev_delete_cmdid = WMI_10_4_VDEV_DELETE_CMDID,
+   .vdev_start_request_cmdid = WMI_10_4_VDEV_START_REQUEST_CMDID,
+   .vdev_restart_request_cmdid = WMI_10_4_VDEV_RESTART_REQUEST_CMDID,
+   .vdev_up_cmdid = WMI_10_4_VDEV_UP_CMDID,
+   .vdev_stop_cmdid = WMI_10_4_VDEV_STOP_CMDID,
+   .vdev_down_cmdid = WMI_10_4_VDEV_DOWN_CMDID,
+   .vdev_set_param_cmdid = WMI_10_4_VDEV_SET_PARAM_CMDID,
+   .vdev_install_key_cmdid = WMI_10_4_VDEV_INSTALL_KEY_CMDID,
+   .peer_create_cmdid = WMI_10_4_PEER_CREATE_CMDID,
+   .peer_delete_cmdid = WMI_10_4_PEER_DELETE_CMDID,
+   .peer_flush_tids_cmdid = WMI_10_4_PEER_FLUSH_TIDS_CMDID,
+   .peer_set_param_cmdid = WMI_10_4_PEER_SET_PARAM_CMDID,
+   .peer_assoc_cmdid = WMI_10_4_PEER_ASSOC_CMDID,
+   .peer_add_wds_entry_cmdid = WMI_10_4_PEER_ADD_WDS_ENTRY_CMDID,
+   .peer_remove_wds_entry_cmdid = WMI_10_4_PEER_REMOVE_WDS_ENTRY_CMDID,
+   .peer_mcast_group_cmdid = WMI_10_4_PEER_MCAST_GROUP_CMDID,
+   .bcn_tx_cmdid = WMI_10_4_BCN_TX_CMDID,
+   .pdev_send_bcn_cmdid = WMI_10_4_PDEV_SEND_BCN_CMDID,
+   .bcn_tmpl_cmdid = WMI_10_4_BCN_PRB_TMPL_CMDID,
+   .bcn_filter_rx_cmdid = WMI_10_4_BCN_FILTER_RX_CMDID,
+   .prb_req_filter_rx_cmdid = WMI_10_4_PRB_REQ_FILTER_RX_CMDID,
+   .mgmt_tx_cmdid = WMI_10_4_MGMT_TX_CMDID,
+   .prb_tmpl_cmdid = WMI_10_4_PRB_TMPL_CMDID,
+   .addba_clear_resp_cmdid = WMI_10_4_ADDBA_CLEAR_RESP_CMDID,
+   .addba_send_cmdid = WMI_10_4_ADDBA_SEND_CMDID,
+   .addba_status_cmdid = WMI_10_4_ADDBA_STATUS_CMDID,
+   .delba_send_cmdid = WMI_10_4_DELBA_SEND_CMDID,
+   .addba_set_resp_cmdid = WMI_10_4_ADDBA_SET_RESP_CMDID,
+   .send_singleamsdu_cmdid = WMI_10_4_SEND_SINGLEAMSDU_CMDID,
+   .sta_powersave_mode_cmdid = WMI_10_4_STA_POWERSAVE_MODE_CMDID,
+   .sta_powersave_param_cmdid = WMI_10_4_STA_POWERSAVE_PARAM_CMDID,
+   .sta_mimo_ps_mode_cmdid = WMI_10_4_STA_MIMO_PS_MODE_CMDID,
+   .pdev_dfs_enable_cmdid = WMI_10_4_PDEV_DFS_ENABLE_CMDID,
+   .pdev_dfs_disable_cmdid = WMI_10_4_PDEV_DFS_DISABLE_CMDID,
+   .roam_scan_mode = WMI_10_4_ROAM_SCAN_MODE,
+   .roam_scan_rssi_threshold = WMI_10_4_ROAM_SCAN_RSSI_THRESHOLD,
+   .roam_scan_period = WMI_10_4_ROAM_SCAN_PERIOD,
+   .roam_scan_rssi_change_threshold =
+   WMI_10_4_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
+   .roam_ap_profile = WMI_10_4_ROAM_AP_PROFILE,
+   .ofl_scan_add_ap_profile = WMI_10_4_OFL_SCAN_ADD_AP_PROFILE,
+   .ofl_scan_remove_ap_profile = WMI_10_4_OFL_SCAN_REMOVE_AP_PROFILE,
+   .ofl_scan_period = WMI_10_4_OFL_SCAN_PERIOD

[PATCH 01/10] ath10k: include new wmi op version for 10.4 fw

2015-06-15 Thread Raja Mani
qca99X0 chip uses firmware version 10.4. Define a new macro
ATH10K_FW_WMI_OP_VERSION_10_4 for 10.4 firmware and include
in switch cases where ATH10K_FW_WMI_OP_VERSION_* is used
to avoid compilation error.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.c | 2 ++
 drivers/net/wireless/ath/ath10k/hw.h   | 1 +
 drivers/net/wireless/ath/ath10k/mac.c  | 2 ++
 drivers/net/wireless/ath/ath10k/wmi.c  | 2 ++
 4 files changed, 7 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 102191a..f4f6da6 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1312,6 +1312,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
ar-fw_stats_req_mask = WMI_STAT_PDEV | WMI_STAT_VDEV |
WMI_STAT_PEER;
break;
+   case ATH10K_FW_WMI_OP_VERSION_10_4:
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
WARN_ON(1);
@@ -1334,6 +1335,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
case ATH10K_FW_WMI_OP_VERSION_TLV:
ar-htt.op_version = ATH10K_FW_HTT_OP_VERSION_TLV;
break;
+   case ATH10K_FW_WMI_OP_VERSION_10_4:
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
WARN_ON(1);
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 5635340..eb65709 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -137,6 +137,7 @@ enum ath10k_fw_wmi_op_version {
ATH10K_FW_WMI_OP_VERSION_10_2 = 3,
ATH10K_FW_WMI_OP_VERSION_TLV = 4,
ATH10K_FW_WMI_OP_VERSION_10_2_4 = 5,
+   ATH10K_FW_WMI_OP_VERSION_10_4 = 6,
 
/* keep last */
ATH10K_FW_WMI_OP_VERSION_MAX,
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index e834a9d..187e524 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6941,6 +6941,8 @@ int ath10k_mac_register(struct ath10k *ar)
ar-hw-wiphy-n_iface_combinations =
ARRAY_SIZE(ath10k_10x_if_comb);
break;
+   case ATH10K_FW_WMI_OP_VERSION_10_4:
+   break;
case ATH10K_FW_WMI_OP_VERSION_UNSET:
case ATH10K_FW_WMI_OP_VERSION_MAX:
WARN_ON(1);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 6c046c2..b32bb68 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5415,6 +5415,8 @@ static const struct wmi_ops wmi_10_2_4_ops = {
 int ath10k_wmi_attach(struct ath10k *ar)
 {
switch (ar-wmi.op_version) {
+   case ATH10K_FW_WMI_OP_VERSION_10_4:
+   break;
case ATH10K_FW_WMI_OP_VERSION_10_2_4:
ar-wmi.cmd = wmi_10_2_4_cmd_map;
ar-wmi.ops = wmi_10_2_4_ops;
-- 
1.8.1.2

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


[PATCH 06/10] ath10k: add 10.4 fw wmi pdev cmd ids

2015-06-15 Thread Raja Mani
Include 10.4 firmware wmi pdev cmd id and prepare wmi vdev map
table wmi_10_4_pdev_param_map and update non 10.4 firmware
pdev cmd map table with newly added vdev cmd id specifically for
10.4 firmware as unsupported.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  32 +
 drivers/net/wireless/ath/ath10k/wmi.c | 188 ++
 drivers/net/wireless/ath/ath10k/wmi.h | 116 ++
 3 files changed, 336 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index df8ac2e..e165e26 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -3204,6 +3204,38 @@ static struct wmi_pdev_param_map wmi_tlv_pdev_param_map 
= {
.burst_dur = WMI_TLV_PDEV_PARAM_BURST_DUR,
.burst_enable = WMI_TLV_PDEV_PARAM_BURST_ENABLE,
.cal_period = WMI_PDEV_PARAM_UNSUPPORTED,
+   .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED,
+   .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED,
+   .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
+   .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
+   .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED,
+   .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .txbf_sound_period_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_promisc_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_burst_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .en_stats = WMI_PDEV_PARAM_UNSUPPORTED,
+   .mu_group_policy = WMI_PDEV_PARAM_UNSUPPORTED,
+   .noise_detection = WMI_PDEV_PARAM_UNSUPPORTED,
+   .noise_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
+   .dpd_enable = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast_bcast_echo = WMI_PDEV_PARAM_UNSUPPORTED,
+   .atf_strict_sch = WMI_PDEV_PARAM_UNSUPPORTED,
+   .atf_sched_duration = WMI_PDEV_PARAM_UNSUPPORTED,
+   .ant_plzn = WMI_PDEV_PARAM_UNSUPPORTED,
+   .rts_fixed_rate = WMI_PDEV_PARAM_UNSUPPORTED,
+   .pdev_reset = WMI_PDEV_PARAM_UNSUPPORTED,
 };
 
 static struct wmi_vdev_param_map wmi_tlv_vdev_param_map = {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 9aa6989..0625009 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1007,6 +1007,38 @@ static struct wmi_pdev_param_map wmi_pdev_param_map = {
.burst_dur = WMI_PDEV_PARAM_UNSUPPORTED,
.burst_enable = WMI_PDEV_PARAM_UNSUPPORTED,
.cal_period = WMI_PDEV_PARAM_UNSUPPORTED,
+   .aggr_burst = WMI_PDEV_PARAM_UNSUPPORTED,
+   .rx_decap_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .smart_antenna_default_antenna = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_override = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_tid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .antenna_gain = WMI_PDEV_PARAM_UNSUPPORTED,
+   .rx_filter = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast_to_ucast_tid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .proxy_sta_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
+   .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED,
+   .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED,
+   .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED,
+   .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_msdu_ttl_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_ppdu_duration_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .txbf_sound_period_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_promisc_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_burst_mode_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
+   .en_stats = WMI_PDEV_PARAM_UNSUPPORTED,
+   .mu_group_policy = WMI_PDEV_PARAM_UNSUPPORTED,
+   .noise_detection = WMI_PDEV_PARAM_UNSUPPORTED,
+   .noise_threshold = WMI_PDEV_PARAM_UNSUPPORTED,
+   .dpd_enable = WMI_PDEV_PARAM_UNSUPPORTED,
+   .set_mcast_bcast_echo = WMI_PDEV_PARAM_UNSUPPORTED,
+   .atf_strict_sch = WMI_PDEV_PARAM_UNSUPPORTED,
+   .atf_sched_duration = WMI_PDEV_PARAM_UNSUPPORTED,
+   .ant_plzn

[PATCH 02/10] ath10k: add 10.4 fw wmi service bitmap definition

2015-06-15 Thread Raja Mani
Include new enum to define wmi service bitmap definitions for
10.4 firmware and a function wmi_10_4_svc_map() to remap 10.4
firmware wmi service bitmap definitions to ath10k generic wmi
services.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi.c |   5 ++
 drivers/net/wireless/ath/ath10k/wmi.h | 128 ++
 2 files changed, 133 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index b32bb68..52493d1 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5412,10 +5412,15 @@ static const struct wmi_ops wmi_10_2_4_ops = {
/* .gen_adaptive_qcs not implemented */
 };
 
+static const struct wmi_ops wmi_10_4_ops = {
+   .map_svc = wmi_10_4_svc_map,
+};
+
 int ath10k_wmi_attach(struct ath10k *ar)
 {
switch (ar-wmi.op_version) {
case ATH10K_FW_WMI_OP_VERSION_10_4:
+   ar-wmi.ops = wmi_10_4_ops;
break;
case ATH10K_FW_WMI_OP_VERSION_10_2_4:
ar-wmi.cmd = wmi_10_2_4_cmd_map;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index cf44a3d..95b7c89 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -150,6 +150,9 @@ enum wmi_service {
WMI_SERVICE_SAP_AUTH_OFFLOAD,
WMI_SERVICE_ATF,
WMI_SERVICE_COEX_GPIO,
+   WMI_SERVICE_ENHANCED_PROXY_STA,
+   WMI_SERVICE_TT,
+   WMI_SERVICE_PEER_CACHING,
 
/* keep last */
WMI_SERVICE_MAX,
@@ -218,6 +221,47 @@ enum wmi_main_service {
WMI_MAIN_SERVICE_TX_ENCAP,
 };
 
+enum wmi_10_4_service {
+   WMI_10_4_SERVICE_BEACON_OFFLOAD = 0,
+   WMI_10_4_SERVICE_SCAN_OFFLOAD,
+   WMI_10_4_SERVICE_ROAM_OFFLOAD,
+   WMI_10_4_SERVICE_BCN_MISS_OFFLOAD,
+   WMI_10_4_SERVICE_STA_PWRSAVE,
+   WMI_10_4_SERVICE_STA_ADVANCED_PWRSAVE,
+   WMI_10_4_SERVICE_AP_UAPSD,
+   WMI_10_4_SERVICE_AP_DFS,
+   WMI_10_4_SERVICE_11AC,
+   WMI_10_4_SERVICE_BLOCKACK,
+   WMI_10_4_SERVICE_PHYERR,
+   WMI_10_4_SERVICE_BCN_FILTER,
+   WMI_10_4_SERVICE_RTT,
+   WMI_10_4_SERVICE_RATECTRL,
+   WMI_10_4_SERVICE_WOW,
+   WMI_10_4_SERVICE_RATECTRL_CACHE,
+   WMI_10_4_SERVICE_IRAM_TIDS,
+   WMI_10_4_SERVICE_BURST,
+   WMI_10_4_SERVICE_SMART_ANTENNA_SW_SUPPORT,
+   WMI_10_4_SERVICE_GTK_OFFLOAD,
+   WMI_10_4_SERVICE_SCAN_SCH,
+   WMI_10_4_SERVICE_CSA_OFFLOAD,
+   WMI_10_4_SERVICE_CHATTER,
+   WMI_10_4_SERVICE_COEX_FREQAVOID,
+   WMI_10_4_SERVICE_PACKET_POWER_SAVE,
+   WMI_10_4_SERVICE_FORCE_FW_HANG,
+   WMI_10_4_SERVICE_SMART_ANTENNA_HW_SUPPORT,
+   WMI_10_4_SERVICE_GPIO,
+   WMI_10_4_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG,
+   WMI_10_4_SERVICE_STA_UAPSD_VAR_AUTO_TRIG,
+   WMI_10_4_SERVICE_STA_KEEP_ALIVE,
+   WMI_10_4_SERVICE_TX_ENCAP,
+   WMI_10_4_SERVICE_AP_PS_DETECT_OUT_OF_SYNC,
+   WMI_10_4_SERVICE_EARLY_RX,
+   WMI_10_4_SERVICE_ENHANCED_PROXY_STA,
+   WMI_10_4_SERVICE_TT,
+   WMI_10_4_SERVICE_ATF,
+   WMI_10_4_SERVICE_PEER_CACHING,
+};
+
 static inline char *wmi_service_name(int service_id)
 {
 #define SVCSTR(x) case x: return #x
@@ -299,6 +343,9 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_SAP_AUTH_OFFLOAD);
SVCSTR(WMI_SERVICE_ATF);
SVCSTR(WMI_SERVICE_COEX_GPIO);
+   SVCSTR(WMI_SERVICE_ENHANCED_PROXY_STA);
+   SVCSTR(WMI_SERVICE_TT);
+   SVCSTR(WMI_SERVICE_PEER_CACHING);
default:
return NULL;
}
@@ -437,6 +484,87 @@ static inline void wmi_main_svc_map(const __le32 *in, 
unsigned long *out,
   WMI_SERVICE_TX_ENCAP, len);
 }
 
+static inline void wmi_10_4_svc_map(const __le32 *in, unsigned long *out,
+   size_t len)
+{
+   SVCMAP(WMI_10_4_SERVICE_BEACON_OFFLOAD,
+  WMI_SERVICE_BEACON_OFFLOAD, len);
+   SVCMAP(WMI_10_4_SERVICE_SCAN_OFFLOAD,
+  WMI_SERVICE_SCAN_OFFLOAD, len);
+   SVCMAP(WMI_10_4_SERVICE_ROAM_OFFLOAD,
+  WMI_SERVICE_ROAM_OFFLOAD, len);
+   SVCMAP(WMI_10_4_SERVICE_BCN_MISS_OFFLOAD,
+  WMI_SERVICE_BCN_MISS_OFFLOAD, len);
+   SVCMAP(WMI_10_4_SERVICE_STA_PWRSAVE,
+  WMI_SERVICE_STA_PWRSAVE, len);
+   SVCMAP(WMI_10_4_SERVICE_STA_ADVANCED_PWRSAVE,
+  WMI_SERVICE_STA_ADVANCED_PWRSAVE, len);
+   SVCMAP(WMI_10_4_SERVICE_AP_UAPSD,
+  WMI_SERVICE_AP_UAPSD, len);
+   SVCMAP(WMI_10_4_SERVICE_AP_DFS,
+  WMI_SERVICE_AP_DFS, len);
+   SVCMAP(WMI_10_4_SERVICE_11AC,
+  WMI_SERVICE_11AC, len);
+   SVCMAP(WMI_10_4_SERVICE_BLOCKACK,
+  WMI_SERVICE_BLOCKACK, len);
+   SVCMAP(WMI_10_4_SERVICE_PHYERR,
+  WMI_SERVICE_PHYERR, len);
+   SVCMAP(WMI_10_4_SERVICE_BCN_FILTER

[PATCH 00/10] introduce wmi support for qca99X0

2015-06-15 Thread Raja Mani
qca99X0 uses 10.4 firmware. This patch series adds 10.4 firmware
specific WMI cmds/events/parsing logic. All these patches tested
on top of qca99X0 initial bring up patches.

Raja Mani (10):
  ath10k: include new wmi op version for 10.4 fw
  ath10k: add 10.4 fw wmi service bitmap definition
  ath10k: include 10.4 fw specific wmi cmd and event ids
  ath10k: set 10.4 fw exclusive wmi cmd as unsupported for other fw
versions
  ath10k: add 10.4 fw wmi vdev cmd ids
  ath10k: add 10.4 fw wmi pdev cmd ids
  ath10k: fill 10.4 fw wmi init cmd default values
  ath10k: handle 10.4 fw wmi mgmt rx event
  ath10k: adjust default peer limits if qcache enabled in 10.4 fw
  ath10k: handle 10.4 fw wmi ready event

 drivers/net/wireless/ath/ath10k/core.c|   9 +
 drivers/net/wireless/ath/ath10k/core.h|   2 +
 drivers/net/wireless/ath/ath10k/hw.h  |  61 +++
 drivers/net/wireless/ath/ath10k/mac.c |   2 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  47 ++
 drivers/net/wireless/ath/ath10k/wmi.c | 793 +-
 drivers/net/wireless/ath/ath10k/wmi.h | 792 -
 7 files changed, 1700 insertions(+), 6 deletions(-)

-- 
1.8.1.2

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


[PATCH 10/10] ath10k: handle 10.4 fw wmi ready event

2015-06-15 Thread Raja Mani
Reuse existing function ath10k_wmi_op_pull_rdy_ev()
to parse WMI_10_4_READY_EVENTID and handle the same
event in ath10k_wmi_10_4_op_rx().

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index e5d948e..8d4ff3e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4252,6 +4252,9 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
ath10k_wmi_event_mgmt_rx(ar, skb);
/* mgmt_rx() owns the skb now! */
return;
+   case WMI_10_4_READY_EVENTID:
+   ath10k_wmi_event_ready(ar, skb);
+   break;
default:
ath10k_warn(ar, Unknown eventid: %d\n, id);
break;
@@ -6184,6 +6187,7 @@ static const struct wmi_ops wmi_10_4_ops = {
.map_svc = wmi_10_4_svc_map,
.pull_mgmt_rx = ath10k_wmi_10_4_op_pull_mgmt_rx_ev,
.pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev,
+   .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
.gen_init = ath10k_wmi_10_4_op_gen_init,
 };
 
-- 
1.8.1.2

--
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 2/8] ath10k: handle 10.4 firmware wmi swba event

2015-06-15 Thread Raja Mani
10.4 firmware swba event payload has space to accommodate upto
512 client traffic indication info  one p2p noa descriptor.
It's is not matching with exiting swba event format defined for
non 10.4 firmware. Non 10.4 firmware swba event format is designed
to support only upto only 128 client and four p2p notice of absence
descriptor.

following changes are done in this patch to enable ath10k to handle
10.4 firmware swba event,

 - link generic ath10k_wmi_event_host_swba() to handle 10.4 swba
   event in 10.4 wmi rx handler.

 - add 10.4 specific swba event structure wmi_10_4_host_swba_event.

 - new function ath10k_wmi_10_4_op_pull_swba_ev() to parse
   10.4 swba event.

 - increase tim_bitmap[] size in ath10k_vif to 64 to hold 512 station
   power save state.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.h |  4 +--
 drivers/net/wireless/ath/ath10k/wmi.c  | 61 ++
 drivers/net/wireless/ath/ath10k/wmi.h  | 41 +++
 3 files changed, 104 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 7c2ffb3..7721548 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -360,8 +360,8 @@ struct ath10k_vif {
u32 uapsd;
} sta;
struct {
-   /* 127 stations; wmi limit */
-   u8 tim_bitmap[16];
+   /* 512 stations */
+   u8 tim_bitmap[64];
u8 tim_len;
u32 ssid_len;
u8 ssid[IEEE80211_MAX_SSID_LEN];
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 793d7c21..bbcc943 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2944,6 +2944,63 @@ static int ath10k_wmi_op_pull_swba_ev(struct ath10k *ar, 
struct sk_buff *skb,
return 0;
 }
 
+static int ath10k_wmi_10_4_op_pull_swba_ev(struct ath10k *ar,
+  struct sk_buff *skb,
+  struct wmi_swba_ev_arg *arg)
+{
+   struct wmi_10_4_host_swba_event *ev = (void *)skb-data;
+   u32 map, tim_len;
+   size_t i;
+
+   if (skb-len  sizeof(*ev))
+   return -EPROTO;
+
+   skb_pull(skb, sizeof(*ev));
+   arg-vdev_map = ev-vdev_map;
+
+   for (i = 0, map = __le32_to_cpu(ev-vdev_map); map; map = 1) {
+   if (!(map  BIT(0)))
+   continue;
+
+   /* If this happens there were some changes in firmware and
+* ath10k should update the max size of tim_info array.
+*/
+   if (WARN_ON_ONCE(i == ARRAY_SIZE(arg-tim_info)))
+   break;
+
+   if (__le32_to_cpu(ev-bcn_info[i].tim_info.tim_len) 
+ sizeof(ev-bcn_info[i].tim_info.tim_bitmap)) {
+   ath10k_warn(ar, refusing to parse invalid swba 
structure\n);
+   return -EPROTO;
+   }
+
+   tim_len = __le32_to_cpu(ev-bcn_info[i].tim_info.tim_len);
+   if (tim_len) {
+   /* Exclude 4 byte guard length */
+   tim_len -= 4;
+   arg-tim_info[i].tim_len = __cpu_to_le32(tim_len);
+   } else {
+   arg-tim_info[i].tim_len = 0;
+   }
+
+   arg-tim_info[i].tim_mcast = ev-bcn_info[i].tim_info.tim_mcast;
+   arg-tim_info[i].tim_bitmap =
+   ev-bcn_info[i].tim_info.tim_bitmap;
+   arg-tim_info[i].tim_changed =
+   ev-bcn_info[i].tim_info.tim_changed;
+   arg-tim_info[i].tim_num_ps_pending =
+   ev-bcn_info[i].tim_info.tim_num_ps_pending;
+
+   /* 10.4 firmware doesn't have p2p support. notice of absence
+* info can be ignored for now.
+*/
+
+   i++;
+   }
+
+   return 0;
+}
+
 void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb)
 {
struct wmi_swba_ev_arg arg = {};
@@ -4278,6 +4335,9 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
case WMI_10_4_READY_EVENTID:
ath10k_wmi_event_ready(ar, skb);
break;
+   case WMI_10_4_HOST_SWBA_EVENTID:
+   ath10k_wmi_event_host_swba(ar, skb);
+   break;
default:
ath10k_warn(ar, Unknown eventid: %d\n, id);
break;
@@ -6209,6 +6269,7 @@ static const struct wmi_ops wmi_10_4_ops = {
.rx = ath10k_wmi_10_4_op_rx,
.map_svc = wmi_10_4_svc_map,
.pull_mgmt_rx = ath10k_wmi_10_4_op_pull_mgmt_rx_ev,
+   .pull_swba

[PATCH 3/8] ath10k: enable vdev and peer related operations for 10.4 fw

2015-06-15 Thread Raja Mani
Most of existing vdev and peer related functions (vdev create,
vdev delete, vdev start, peer create, peer delete, peer flush, etc)
are reusable for 10.4 firmware. Link those general vdev and peer
functions to 10.4 wmi function table.

Existing general pktlog enable/disable, dbglog configuration functions
are reusable for 10.4 and add them also in wmi function table.

Also handle few wmi events (sevice rdy, echo, dbg msg, tbtt offset
update, dbg print) in ath10k_wmi_10_4_op_rx(). wow event is not
applicable in 10.4 firmware, have it under not implemented print.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi.c | 62 +++
 1 file changed, 62 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index bbcc943..da21597 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4332,12 +4332,40 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, 
struct sk_buff *skb)
ath10k_wmi_event_mgmt_rx(ar, skb);
/* mgmt_rx() owns the skb now! */
return;
+   case WMI_10_4_ECHO_EVENTID:
+   ath10k_wmi_event_echo(ar, skb);
+   break;
+   case WMI_10_4_DEBUG_MESG_EVENTID:
+   ath10k_wmi_event_debug_mesg(ar, skb);
+   break;
+   case WMI_10_4_SERVICE_READY_EVENTID:
+   ath10k_wmi_event_service_ready(ar, skb);
+   break;
case WMI_10_4_READY_EVENTID:
ath10k_wmi_event_ready(ar, skb);
break;
+   case WMI_10_4_PEER_STA_KICKOUT_EVENTID:
+   ath10k_wmi_event_peer_sta_kickout(ar, skb);
+   break;
case WMI_10_4_HOST_SWBA_EVENTID:
ath10k_wmi_event_host_swba(ar, skb);
break;
+   case WMI_10_4_TBTTOFFSET_UPDATE_EVENTID:
+   ath10k_wmi_event_tbttoffset_update(ar, skb);
+   break;
+   case WMI_10_4_DEBUG_PRINT_EVENTID:
+   ath10k_wmi_event_debug_print(ar, skb);
+   break;
+   case WMI_10_4_VDEV_START_RESP_EVENTID:
+   ath10k_wmi_event_vdev_start_resp(ar, skb);
+   break;
+   case WMI_10_4_VDEV_STOPPED_EVENTID:
+   ath10k_wmi_event_vdev_stopped(ar, skb);
+   break;
+   case WMI_10_4_WOW_WAKEUP_HOST_EVENTID:
+   ath10k_dbg(ar, ATH10K_DBG_WMI,
+  received event id %d not implemented\n, id);
+   break;
default:
ath10k_warn(ar, Unknown eventid: %d\n, id);
break;
@@ -6269,10 +6297,44 @@ static const struct wmi_ops wmi_10_4_ops = {
.rx = ath10k_wmi_10_4_op_rx,
.map_svc = wmi_10_4_svc_map,
.pull_mgmt_rx = ath10k_wmi_10_4_op_pull_mgmt_rx_ev,
+   .pull_vdev_start = ath10k_wmi_op_pull_vdev_start_ev,
+   .pull_peer_kick = ath10k_wmi_op_pull_peer_kick_ev,
.pull_swba = ath10k_wmi_10_4_op_pull_swba_ev,
.pull_svc_rdy = ath10k_wmi_main_op_pull_svc_rdy_ev,
.pull_rdy = ath10k_wmi_op_pull_rdy_ev,
+
+   .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
+   .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
+   .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
+   .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
.gen_init = ath10k_wmi_10_4_op_gen_init,
+   .gen_vdev_create = ath10k_wmi_op_gen_vdev_create,
+   .gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete,
+   .gen_vdev_start = ath10k_wmi_op_gen_vdev_start,
+   .gen_vdev_stop = ath10k_wmi_op_gen_vdev_stop,
+   .gen_vdev_up = ath10k_wmi_op_gen_vdev_up,
+   .gen_vdev_down = ath10k_wmi_op_gen_vdev_down,
+   .gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param,
+   .gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key,
+   .gen_peer_create = ath10k_wmi_op_gen_peer_create,
+   .gen_peer_delete = ath10k_wmi_op_gen_peer_delete,
+   .gen_peer_flush = ath10k_wmi_op_gen_peer_flush,
+   .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param,
+   .gen_set_psmode = ath10k_wmi_op_gen_set_psmode,
+   .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps,
+   .gen_set_ap_ps = ath10k_wmi_op_gen_set_ap_ps,
+   .gen_scan_chan_list = ath10k_wmi_op_gen_scan_chan_list,
+   .gen_beacon_dma = ath10k_wmi_op_gen_beacon_dma,
+   .gen_pdev_set_wmm = ath10k_wmi_op_gen_pdev_set_wmm,
+   .gen_force_fw_hang = ath10k_wmi_op_gen_force_fw_hang,
+   .gen_mgmt_tx = ath10k_wmi_op_gen_mgmt_tx,
+   .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg,
+   .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
+   .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
+   .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
+
+   /* shared with 10.2 */
+   .gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
 };
 
 int ath10k_wmi_attach(struct

[PATCH] ath10k: remove unused variable hdr in ath10k_htt_rx_h_undecap()

2015-06-11 Thread Raja Mani
Just found this during code review.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 89eb16b..7399e45 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1201,7 +1201,6 @@ static void ath10k_htt_rx_h_undecap(struct ath10k *ar,
 {
struct htt_rx_desc *rxd;
enum rx_msdu_decap_format decap;
-   struct ieee80211_hdr *hdr;
 
/* First msdu's decapped header:
 * [802.11 header] -- padded to 4 bytes long
@@ -1215,7 +1214,6 @@ static void ath10k_htt_rx_h_undecap(struct ath10k *ar,
 */
 
rxd = (void *)msdu-data - sizeof(*rxd);
-   hdr = (void *)rxd-rx_hdr_status;
decap = MS(__le32_to_cpu(rxd-msdu_start.info1),
   RX_MSDU_START_INFO1_DECAP_FORMAT);
 
-- 
1.8.1.2

--
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] ath10k: remove unused variable 'id' in ath10k_pci_tx_pipe_cleanup()

2015-06-02 Thread Raja Mani
mete_data is extracted from ce descriptor and stored in variable 'id'.
later, id is not used anywhere in the same function.

Fixes: d84a512dca23 (ath10k: remove transfer_id from
ath10k_hif_cb::tx_completion)

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---

V2 changes:
  - added original commit msg detail in commit log which 
introduced this unused variable.

 drivers/net/wireless/ath/ath10k/pci.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 969a123..bbc349a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1275,7 +1275,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
struct ath10k_ce_ring *ce_ring;
struct ce_desc *ce_desc;
struct sk_buff *skb;
-   unsigned int id;
int i;
 
ar = pci_pipe-hif_ce_state;
@@ -1299,8 +1298,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
continue;
 
ce_ring-per_transfer_context[i] = NULL;
-   id = MS(__le16_to_cpu(ce_desc[i].flags),
-   CE_DESC_FLAGS_META_DATA);
 
ar_pci-msg_callbacks_current.tx_completion(ar, skb);
}
-- 
1.7.10.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


[PATCH] ath10k: remove unused variable 'id' in ath10k_pci_tx_pipe_cleanup()

2015-06-02 Thread Raja Mani
mete_data is extracted from ce descriptor and stored in variable 'id'.
later, id is not used anywhere in the same function.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/pci.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 969a123..bbc349a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1275,7 +1275,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
struct ath10k_ce_ring *ce_ring;
struct ce_desc *ce_desc;
struct sk_buff *skb;
-   unsigned int id;
int i;
 
ar = pci_pipe-hif_ce_state;
@@ -1299,8 +1298,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
continue;
 
ce_ring-per_transfer_context[i] = NULL;
-   id = MS(__le16_to_cpu(ce_desc[i].flags),
-   CE_DESC_FLAGS_META_DATA);
 
ar_pci-msg_callbacks_current.tx_completion(ar, skb);
}
-- 
1.7.10.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


[PATCH] ath10k: free wmi mgmt event skb when parsing fails

2015-06-01 Thread Raja Mani
When wmi mgmt event function fails to parse given skb,
it should be freed on failure condition to avoid memory
leaks. Found this during the code review.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/wmi.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index b892eb8..818bd25 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2089,6 +2089,7 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct 
sk_buff *skb)
ret = ath10k_wmi_pull_mgmt_rx(ar, skb, arg);
if (ret) {
ath10k_warn(ar, failed to parse mgmt rx event: %d\n, ret);
+   dev_kfree_skb(skb);
return ret;
}
 
-- 
1.7.10.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