aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/mwifiex/fw.h10
-rw-r--r--drivers/net/wireless/mwifiex/main.c13
-rw-r--r--drivers/net/wireless/mwifiex/main.h1
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmd.c62
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c15
5 files changed, 101 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h
index d3c1e01b4fc2..d6ada7354c14 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -271,6 +271,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
271#define HostCmd_CMD_802_11_SUBSCRIBE_EVENT 0x0075 271#define HostCmd_CMD_802_11_SUBSCRIBE_EVENT 0x0075
272#define HostCmd_CMD_802_11_TX_RATE_QUERY 0x007f 272#define HostCmd_CMD_802_11_TX_RATE_QUERY 0x007f
273#define HostCmd_CMD_802_11_IBSS_COALESCING_STATUS 0x0083 273#define HostCmd_CMD_802_11_IBSS_COALESCING_STATUS 0x0083
274#define HostCmd_CMD_CFG_DATA 0x008f
274#define HostCmd_CMD_VERSION_EXT 0x0097 275#define HostCmd_CMD_VERSION_EXT 0x0097
275#define HostCmd_CMD_MEF_CFG 0x009a 276#define HostCmd_CMD_MEF_CFG 0x009a
276#define HostCmd_CMD_RSSI_INFO 0x00a4 277#define HostCmd_CMD_RSSI_INFO 0x00a4
@@ -465,6 +466,8 @@ enum P2P_MODES {
465#define MWIFIEX_CRITERIA_UNICAST BIT(1) 466#define MWIFIEX_CRITERIA_UNICAST BIT(1)
466#define MWIFIEX_CRITERIA_MULTICAST BIT(3) 467#define MWIFIEX_CRITERIA_MULTICAST BIT(3)
467 468
469#define CFG_DATA_TYPE_CAL 2
470
468struct mwifiex_ie_types_header { 471struct mwifiex_ie_types_header {
469 __le16 type; 472 __le16 type;
470 __le16 len; 473 __le16 len;
@@ -1579,6 +1582,12 @@ struct mwifiex_ie_list {
1579 struct mwifiex_ie ie_list[MAX_MGMT_IE_INDEX]; 1582 struct mwifiex_ie ie_list[MAX_MGMT_IE_INDEX];
1580} __packed; 1583} __packed;
1581 1584
1585struct host_cmd_ds_802_11_cfg_data {
1586 __le16 action;
1587 __le16 type;
1588 __le16 data_len;
1589} __packed;
1590
1582struct host_cmd_ds_command { 1591struct host_cmd_ds_command {
1583 __le16 command; 1592 __le16 command;
1584 __le16 size; 1593 __le16 size;
@@ -1638,6 +1647,7 @@ struct host_cmd_ds_command {
1638 struct host_cmd_ds_sys_config uap_sys_config; 1647 struct host_cmd_ds_sys_config uap_sys_config;
1639 struct host_cmd_ds_sta_deauth sta_deauth; 1648 struct host_cmd_ds_sta_deauth sta_deauth;
1640 struct host_cmd_11ac_vht_cfg vht_cfg; 1649 struct host_cmd_11ac_vht_cfg vht_cfg;
1650 struct host_cmd_ds_802_11_cfg_data cfg_data;
1641 } params; 1651 } params;
1642} __packed; 1652} __packed;
1643 1653
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index eb8518618622..29d83f0c1fb8 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -25,6 +25,8 @@
25#define VERSION "1.0" 25#define VERSION "1.0"
26 26
27const char driver_version[] = "mwifiex " VERSION " (%s) "; 27const char driver_version[] = "mwifiex " VERSION " (%s) ";
28static char *cal_data_cfg;
29module_param(cal_data_cfg, charp, 0);
28 30
29/* 31/*
30 * This function registers the device and performs all the necessary 32 * This function registers the device and performs all the necessary
@@ -336,6 +338,13 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
336 338
337 dev_notice(adapter->dev, "WLAN FW is active\n"); 339 dev_notice(adapter->dev, "WLAN FW is active\n");
338 340
341 if (cal_data_cfg) {
342 if ((request_firmware(&adapter->cal_data, cal_data_cfg,
343 adapter->dev)) < 0)
344 dev_err(adapter->dev,
345 "Cal data request_firmware() failed\n");
346 }
347
339 adapter->init_wait_q_woken = false; 348 adapter->init_wait_q_woken = false;
340 ret = mwifiex_init_fw(adapter); 349 ret = mwifiex_init_fw(adapter);
341 if (ret == -1) { 350 if (ret == -1) {
@@ -390,6 +399,10 @@ err_init_fw:
390 pr_debug("info: %s: unregister device\n", __func__); 399 pr_debug("info: %s: unregister device\n", __func__);
391 adapter->if_ops.unregister_dev(adapter); 400 adapter->if_ops.unregister_dev(adapter);
392done: 401done:
402 if (adapter->cal_data) {
403 release_firmware(adapter->cal_data);
404 adapter->cal_data = NULL;
405 }
393 release_firmware(adapter->firmware); 406 release_firmware(adapter->firmware);
394 complete(&adapter->fw_load); 407 complete(&adapter->fw_load);
395 return; 408 return;
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 9cf6852f6da3..0832c2437daf 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -730,6 +730,7 @@ struct mwifiex_adapter {
730 u16 max_mgmt_ie_index; 730 u16 max_mgmt_ie_index;
731 u8 scan_delay_cnt; 731 u8 scan_delay_cnt;
732 u8 empty_tx_q_cnt; 732 u8 empty_tx_q_cnt;
733 const struct firmware *cal_data;
733 734
734 /* 11AC */ 735 /* 11AC */
735 u32 is_hw_11ac_capable; 736 u32 is_hw_11ac_capable;
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c
index b193e25977d2..8ece48580642 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -1134,6 +1134,55 @@ mwifiex_cmd_mef_cfg(struct mwifiex_private *priv,
1134 return 0; 1134 return 0;
1135} 1135}
1136 1136
1137/* This function parse cal data from ASCII to hex */
1138static u32 mwifiex_parse_cal_cfg(u8 *src, size_t len, u8 *dst)
1139{
1140 u8 *s = src, *d = dst;
1141
1142 while (s - src < len) {
1143 if (*s && (isspace(*s) || *s == '\t')) {
1144 s++;
1145 continue;
1146 }
1147 if (isxdigit(*s)) {
1148 *d++ = simple_strtol(s, NULL, 16);
1149 s += 2;
1150 } else {
1151 s++;
1152 }
1153 }
1154
1155 return d - dst;
1156}
1157
1158/* This function prepares command of set_cfg_data. */
1159static int mwifiex_cmd_cfg_data(struct mwifiex_private *priv,
1160 struct host_cmd_ds_command *cmd,
1161 u16 cmd_action)
1162{
1163 struct host_cmd_ds_802_11_cfg_data *cfg_data = &cmd->params.cfg_data;
1164 struct mwifiex_adapter *adapter = priv->adapter;
1165 u32 len, cal_data_offset;
1166 u8 *tmp_cmd = (u8 *)cmd;
1167
1168 cal_data_offset = S_DS_GEN + sizeof(*cfg_data);
1169 if ((adapter->cal_data->data) && (adapter->cal_data->size > 0))
1170 len = mwifiex_parse_cal_cfg((u8 *)adapter->cal_data->data,
1171 adapter->cal_data->size,
1172 (u8 *)(tmp_cmd + cal_data_offset));
1173 else
1174 return -1;
1175
1176 cfg_data->action = cpu_to_le16(cmd_action);
1177 cfg_data->type = cpu_to_le16(CFG_DATA_TYPE_CAL);
1178 cfg_data->data_len = cpu_to_le16(len);
1179
1180 cmd->command = cpu_to_le16(HostCmd_CMD_CFG_DATA);
1181 cmd->size = cpu_to_le16(S_DS_GEN + sizeof(*cfg_data) + len);
1182
1183 return 0;
1184}
1185
1137/* 1186/*
1138 * This function prepares the commands before sending them to the firmware. 1187 * This function prepares the commands before sending them to the firmware.
1139 * 1188 *
@@ -1152,6 +1201,9 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
1152 case HostCmd_CMD_GET_HW_SPEC: 1201 case HostCmd_CMD_GET_HW_SPEC:
1153 ret = mwifiex_cmd_get_hw_spec(priv, cmd_ptr); 1202 ret = mwifiex_cmd_get_hw_spec(priv, cmd_ptr);
1154 break; 1203 break;
1204 case HostCmd_CMD_CFG_DATA:
1205 ret = mwifiex_cmd_cfg_data(priv, cmd_ptr, cmd_action);
1206 break;
1155 case HostCmd_CMD_MAC_CONTROL: 1207 case HostCmd_CMD_MAC_CONTROL:
1156 ret = mwifiex_cmd_mac_control(priv, cmd_ptr, cmd_action, 1208 ret = mwifiex_cmd_mac_control(priv, cmd_ptr, cmd_action,
1157 data_buf); 1209 data_buf);
@@ -1384,6 +1436,7 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
1384 */ 1436 */
1385int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) 1437int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
1386{ 1438{
1439 struct mwifiex_adapter *adapter = priv->adapter;
1387 int ret; 1440 int ret;
1388 u16 enable = true; 1441 u16 enable = true;
1389 struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl; 1442 struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl;
@@ -1404,6 +1457,15 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
1404 HostCmd_ACT_GEN_SET, 0, NULL); 1457 HostCmd_ACT_GEN_SET, 0, NULL);
1405 if (ret) 1458 if (ret)
1406 return -1; 1459 return -1;
1460
1461 /* Download calibration data to firmware */
1462 if (adapter->cal_data) {
1463 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_CFG_DATA,
1464 HostCmd_ACT_GEN_SET, 0, NULL);
1465 if (ret)
1466 return -1;
1467 }
1468
1407 /* Read MAC address from HW */ 1469 /* Read MAC address from HW */
1408 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_GET_HW_SPEC, 1470 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_GET_HW_SPEC,
1409 HostCmd_ACT_GEN_GET, 0, NULL); 1471 HostCmd_ACT_GEN_GET, 0, NULL);
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index c710a1bb05ce..d85df158cc6c 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -818,6 +818,18 @@ static int mwifiex_ret_subsc_evt(struct mwifiex_private *priv,
818 return 0; 818 return 0;
819} 819}
820 820
821/* This function handles the command response of set_cfg_data */
822static int mwifiex_ret_cfg_data(struct mwifiex_private *priv,
823 struct host_cmd_ds_command *resp)
824{
825 if (resp->result != HostCmd_RESULT_OK) {
826 dev_err(priv->adapter->dev, "Cal data cmd resp failed\n");
827 return -1;
828 }
829
830 return 0;
831}
832
821/* 833/*
822 * This function handles the command responses. 834 * This function handles the command responses.
823 * 835 *
@@ -841,6 +853,9 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
841 case HostCmd_CMD_GET_HW_SPEC: 853 case HostCmd_CMD_GET_HW_SPEC:
842 ret = mwifiex_ret_get_hw_spec(priv, resp); 854 ret = mwifiex_ret_get_hw_spec(priv, resp);
843 break; 855 break;
856 case HostCmd_CMD_CFG_DATA:
857 ret = mwifiex_ret_cfg_data(priv, resp);
858 break;
844 case HostCmd_CMD_MAC_CONTROL: 859 case HostCmd_CMD_MAC_CONTROL:
845 break; 860 break;
846 case HostCmd_CMD_802_11_MAC_ADDRESS: 861 case HostCmd_CMD_802_11_MAC_ADDRESS: