aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartosz Markowski <bartosz.markowski@tieto.com>2013-09-26 11:47:09 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2013-09-27 07:58:14 -0400
commit6f97d256b7c0c624f7cd5881beeabb5c7a3678b8 (patch)
tree5b29fadb94ec6542bf87445752b2ff6a98a49cc4
parent8a6618b00f280a35cef36f6156cb7f80b35553c3 (diff)
ath10k: split ath10k_wmi_service_ready_event_rx
Since the both firmwares we are going to support, have significantly different APIs (WMI and shared structures), it's easier to actually split the whole event handling functions, instead cutting them inside. The fork starts now on ath10k_wmi_process_rx(). Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.c65
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.h40
2 files changed, 104 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index ef80291737b4..ed79d325b610 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1301,6 +1301,69 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
1301 complete(&ar->wmi.service_ready); 1301 complete(&ar->wmi.service_ready);
1302} 1302}
1303 1303
1304static void ath10k_wmi_10x_service_ready_event_rx(struct ath10k *ar,
1305 struct sk_buff *skb)
1306{
1307 struct wmi_service_ready_event_10x *ev = (void *)skb->data;
1308
1309 if (skb->len < sizeof(*ev)) {
1310 ath10k_warn("Service ready event was %d B but expected %zu B. Wrong firmware version?\n",
1311 skb->len, sizeof(*ev));
1312 return;
1313 }
1314
1315 ar->hw_min_tx_power = __le32_to_cpu(ev->hw_min_tx_power);
1316 ar->hw_max_tx_power = __le32_to_cpu(ev->hw_max_tx_power);
1317 ar->ht_cap_info = __le32_to_cpu(ev->ht_cap_info);
1318 ar->vht_cap_info = __le32_to_cpu(ev->vht_cap_info);
1319 ar->fw_version_major =
1320 (__le32_to_cpu(ev->sw_version) & 0xff000000) >> 24;
1321 ar->fw_version_minor = (__le32_to_cpu(ev->sw_version) & 0x00ffffff);
1322 ar->phy_capability = __le32_to_cpu(ev->phy_capability);
1323 ar->num_rf_chains = __le32_to_cpu(ev->num_rf_chains);
1324
1325 if (ar->num_rf_chains > WMI_MAX_SPATIAL_STREAM) {
1326 ath10k_warn("hardware advertises support for more spatial streams than it should (%d > %d)\n",
1327 ar->num_rf_chains, WMI_MAX_SPATIAL_STREAM);
1328 ar->num_rf_chains = WMI_MAX_SPATIAL_STREAM;
1329 }
1330
1331 ar->ath_common.regulatory.current_rd =
1332 __le32_to_cpu(ev->hal_reg_capabilities.eeprom_rd);
1333
1334 ath10k_debug_read_service_map(ar, ev->wmi_service_bitmap,
1335 sizeof(ev->wmi_service_bitmap));
1336
1337 if (strlen(ar->hw->wiphy->fw_version) == 0) {
1338 snprintf(ar->hw->wiphy->fw_version,
1339 sizeof(ar->hw->wiphy->fw_version),
1340 "%u.%u",
1341 ar->fw_version_major,
1342 ar->fw_version_minor);
1343 }
1344
1345 /* FIXME: it probably should be better to support this.
1346 TODO: Next patch introduce memory chunks. It's a must for 10.x FW */
1347 if (__le32_to_cpu(ev->num_mem_reqs) > 0) {
1348 ath10k_warn("target requested %d memory chunks; ignoring\n",
1349 __le32_to_cpu(ev->num_mem_reqs));
1350 }
1351
1352 ath10k_dbg(ATH10K_DBG_WMI,
1353 "wmi event service ready sw_ver 0x%08x abi_ver %u phy_cap 0x%08x ht_cap 0x%08x vht_cap 0x%08x vht_supp_msc 0x%08x sys_cap_info 0x%08x mem_reqs %u num_rf_chains %u\n",
1354 __le32_to_cpu(ev->sw_version),
1355 __le32_to_cpu(ev->abi_version),
1356 __le32_to_cpu(ev->phy_capability),
1357 __le32_to_cpu(ev->ht_cap_info),
1358 __le32_to_cpu(ev->vht_cap_info),
1359 __le32_to_cpu(ev->vht_supp_mcs),
1360 __le32_to_cpu(ev->sys_cap_info),
1361 __le32_to_cpu(ev->num_mem_reqs),
1362 __le32_to_cpu(ev->num_rf_chains));
1363
1364 complete(&ar->wmi.service_ready);
1365}
1366
1304static int ath10k_wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb) 1367static int ath10k_wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
1305{ 1368{
1306 struct wmi_ready_event *ev = (struct wmi_ready_event *)skb->data; 1369 struct wmi_ready_event *ev = (struct wmi_ready_event *)skb->data;
@@ -1537,7 +1600,7 @@ static void ath10k_wmi_10x_process_rx(struct ath10k *ar, struct sk_buff *skb)
1537 ath10k_wmi_event_vdev_resume_req(ar, skb); 1600 ath10k_wmi_event_vdev_resume_req(ar, skb);
1538 break; 1601 break;
1539 case WMI_10X_SERVICE_READY_EVENTID: 1602 case WMI_10X_SERVICE_READY_EVENTID:
1540 ath10k_wmi_service_ready_event_rx(ar, skb); 1603 ath10k_wmi_10x_service_ready_event_rx(ar, skb);
1541 break; 1604 break;
1542 case WMI_10X_READY_EVENTID: 1605 case WMI_10X_READY_EVENTID:
1543 ath10k_wmi_ready_event_rx(ar, skb); 1606 ath10k_wmi_ready_event_rx(ar, skb);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index d8414abb3483..a0cfdfd87faf 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1130,6 +1130,46 @@ struct wmi_service_ready_event {
1130 struct wlan_host_mem_req mem_reqs[1]; 1130 struct wlan_host_mem_req mem_reqs[1];
1131} __packed; 1131} __packed;
1132 1132
1133/* This is the definition from 10.X firmware branch */
1134struct wmi_service_ready_event_10x {
1135 __le32 sw_version;
1136 __le32 abi_version;
1137
1138 /* WMI_PHY_CAPABILITY */
1139 __le32 phy_capability;
1140
1141 /* Maximum number of frag table entries that SW will populate less 1 */
1142 __le32 max_frag_entry;
1143 __le32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
1144 __le32 num_rf_chains;
1145
1146 /*
1147 * The following field is only valid for service type
1148 * WMI_SERVICE_11AC
1149 */
1150 __le32 ht_cap_info; /* WMI HT Capability */
1151 __le32 vht_cap_info; /* VHT capability info field of 802.11ac */
1152 __le32 vht_supp_mcs; /* VHT Supported MCS Set field Rx/Tx same */
1153 __le32 hw_min_tx_power;
1154 __le32 hw_max_tx_power;
1155
1156 struct hal_reg_capabilities hal_reg_capabilities;
1157
1158 __le32 sys_cap_info;
1159 __le32 min_pkt_size_enable; /* Enterprise mode short pkt enable */
1160
1161 /*
1162 * request to host to allocate a chuck of memory and pss it down to FW
1163 * via WM_INIT. FW uses this as FW extesnsion memory for saving its
1164 * data structures. Only valid for low latency interfaces like PCIE
1165 * where FW can access this memory directly (or) by DMA.
1166 */
1167 __le32 num_mem_reqs;
1168
1169 struct wlan_host_mem_req mem_reqs[1];
1170} __packed;
1171
1172
1133#define WMI_SERVICE_READY_TIMEOUT_HZ (5*HZ) 1173#define WMI_SERVICE_READY_TIMEOUT_HZ (5*HZ)
1134#define WMI_UNIFIED_READY_TIMEOUT_HZ (5*HZ) 1174#define WMI_UNIFIED_READY_TIMEOUT_HZ (5*HZ)
1135 1175