forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/net/wireless/rsi/rsi_91x_mgmt.c
....@@ -1,4 +1,4 @@
1
-/**
1
+/*
22 * Copyright (c) 2014 Redpine Signals Inc.
33 *
44 * Permission to use, copy, modify, and/or distribute this software for any
....@@ -15,6 +15,7 @@
1515 */
1616
1717 #include <linux/etherdevice.h>
18
+#include <linux/timer.h>
1819 #include "rsi_mgmt.h"
1920 #include "rsi_common.h"
2021 #include "rsi_ps.h"
....@@ -208,6 +209,59 @@
208209 .beacon_resedue_alg_en = 0,
209210 };
210211
212
+static struct bootup_params_9116 boot_params_9116_20 = {
213
+ .magic_number = cpu_to_le16(LOADED_TOKEN),
214
+ .valid = cpu_to_le32(VALID_20),
215
+ .device_clk_info_9116 = {{
216
+ .pll_config_9116_g = {
217
+ .pll_ctrl_set_reg = cpu_to_le16(0xd518),
218
+ .pll_ctrl_clr_reg = cpu_to_le16(0x2ae7),
219
+ .pll_modem_conig_reg = cpu_to_le16(0x2000),
220
+ .soc_clk_config_reg = cpu_to_le16(0x0c18),
221
+ .adc_dac_strm1_config_reg = cpu_to_le16(0x1100),
222
+ .adc_dac_strm2_config_reg = cpu_to_le16(0x6600),
223
+ },
224
+ .switch_clk_9116_g = {
225
+ .switch_clk_info =
226
+ cpu_to_le32((RSI_SWITCH_TASS_CLK |
227
+ RSI_SWITCH_WLAN_BBP_LMAC_CLK_REG |
228
+ RSI_SWITCH_BBP_LMAC_CLK_REG)),
229
+ .tass_clock_reg = cpu_to_le32(0x083C0503),
230
+ .wlan_bbp_lmac_clk_reg_val = cpu_to_le32(0x01042001),
231
+ .zbbt_bbp_lmac_clk_reg_val = cpu_to_le32(0x02010001),
232
+ .bbp_lmac_clk_en_val = cpu_to_le32(0x0000003b),
233
+ }
234
+ },
235
+ },
236
+};
237
+
238
+static struct bootup_params_9116 boot_params_9116_40 = {
239
+ .magic_number = cpu_to_le16(LOADED_TOKEN),
240
+ .valid = cpu_to_le32(VALID_40),
241
+ .device_clk_info_9116 = {{
242
+ .pll_config_9116_g = {
243
+ .pll_ctrl_set_reg = cpu_to_le16(0xd518),
244
+ .pll_ctrl_clr_reg = cpu_to_le16(0x2ae7),
245
+ .pll_modem_conig_reg = cpu_to_le16(0x3000),
246
+ .soc_clk_config_reg = cpu_to_le16(0x0c18),
247
+ .adc_dac_strm1_config_reg = cpu_to_le16(0x0000),
248
+ .adc_dac_strm2_config_reg = cpu_to_le16(0x6600),
249
+ },
250
+ .switch_clk_9116_g = {
251
+ .switch_clk_info =
252
+ cpu_to_le32((RSI_SWITCH_TASS_CLK |
253
+ RSI_SWITCH_WLAN_BBP_LMAC_CLK_REG |
254
+ RSI_SWITCH_BBP_LMAC_CLK_REG |
255
+ RSI_MODEM_CLK_160MHZ)),
256
+ .tass_clock_reg = cpu_to_le32(0x083C0503),
257
+ .wlan_bbp_lmac_clk_reg_val = cpu_to_le32(0x01042002),
258
+ .zbbt_bbp_lmac_clk_reg_val = cpu_to_le32(0x04010002),
259
+ .bbp_lmac_clk_en_val = cpu_to_le32(0x0000003b),
260
+ }
261
+ },
262
+ },
263
+};
264
+
211265 static u16 mcs[] = {13, 26, 39, 52, 78, 104, 117, 130};
212266
213267 /**
....@@ -234,6 +288,26 @@
234288 common->obm_ant_sel_val = 2;
235289 common->beacon_interval = RSI_BEACON_INTERVAL;
236290 common->dtim_cnt = RSI_DTIM_COUNT;
291
+ common->w9116_features.pll_mode = 0x0;
292
+ common->w9116_features.rf_type = 1;
293
+ common->w9116_features.wireless_mode = 0;
294
+ common->w9116_features.enable_ppe = 0;
295
+ common->w9116_features.afe_type = 1;
296
+ common->w9116_features.dpd = 0;
297
+ common->w9116_features.sifs_tx_enable = 0;
298
+ common->w9116_features.ps_options = 0;
299
+}
300
+
301
+void init_bgscan_params(struct rsi_common *common)
302
+{
303
+ memset((u8 *)&common->bgscan, 0, sizeof(struct rsi_bgscan_params));
304
+ common->bgscan.bgscan_threshold = RSI_DEF_BGSCAN_THRLD;
305
+ common->bgscan.roam_threshold = RSI_DEF_ROAM_THRLD;
306
+ common->bgscan.bgscan_periodicity = RSI_BGSCAN_PERIODICITY;
307
+ common->bgscan.num_bgscan_channels = 0;
308
+ common->bgscan.two_probe = 1;
309
+ common->bgscan.active_scan_duration = RSI_ACTIVE_SCAN_TIME;
310
+ common->bgscan.passive_scan_duration = RSI_PASSIVE_SCAN_TIME;
237311 }
238312
239313 /**
....@@ -350,6 +424,10 @@
350424 }
351425 radio_caps->radio_info |= radio_id;
352426
427
+ if (adapter->device_model == RSI_DEV_9116 &&
428
+ common->channel_width == BW_20MHZ)
429
+ radio_caps->radio_cfg_info &= ~0x3;
430
+
353431 radio_caps->sifs_tx_11n = cpu_to_le16(SIFS_TX_11N_VALUE);
354432 radio_caps->sifs_tx_11b = cpu_to_le16(SIFS_TX_11B_VALUE);
355433 radio_caps->slot_rx_11n = cpu_to_le16(SHORT_SLOT_VALUE);
....@@ -365,14 +443,16 @@
365443 }
366444
367445 for (ii = 0; ii < NUM_EDCA_QUEUES; ii++) {
368
- radio_caps->qos_params[ii].cont_win_min_q =
369
- cpu_to_le16(common->edca_params[ii].cw_min);
370
- radio_caps->qos_params[ii].cont_win_max_q =
371
- cpu_to_le16(common->edca_params[ii].cw_max);
372
- radio_caps->qos_params[ii].aifsn_val_q =
373
- cpu_to_le16((common->edca_params[ii].aifs) << 8);
374
- radio_caps->qos_params[ii].txop_q =
375
- cpu_to_le16(common->edca_params[ii].txop);
446
+ if (common->edca_params[ii].cw_max > 0) {
447
+ radio_caps->qos_params[ii].cont_win_min_q =
448
+ cpu_to_le16(common->edca_params[ii].cw_min);
449
+ radio_caps->qos_params[ii].cont_win_max_q =
450
+ cpu_to_le16(common->edca_params[ii].cw_max);
451
+ radio_caps->qos_params[ii].aifsn_val_q =
452
+ cpu_to_le16(common->edca_params[ii].aifs << 8);
453
+ radio_caps->qos_params[ii].txop_q =
454
+ cpu_to_le16(common->edca_params[ii].txop);
455
+ }
376456 }
377457
378458 radio_caps->qos_params[BROADCAST_HW_Q].txop_q = cpu_to_le16(0xffff);
....@@ -396,8 +476,7 @@
396476 * rsi_mgmt_pkt_to_core() - This function is the entry point for Mgmt module.
397477 * @common: Pointer to the driver private structure.
398478 * @msg: Pointer to received packet.
399
- * @msg_len: Length of the recieved packet.
400
- * @type: Type of recieved packet.
479
+ * @msg_len: Length of the received packet.
401480 *
402481 * Return: 0 on success, -1 on failure.
403482 */
....@@ -448,6 +527,8 @@
448527 * @bssid: bssid.
449528 * @qos_enable: Qos is enabled.
450529 * @aid: Aid (unique for all STA).
530
+ * @sta_id: station id.
531
+ * @vif: Pointer to the ieee80211_vif structure.
451532 *
452533 * Return: status: 0 on success, corresponding negative error code on failure.
453534 */
....@@ -523,6 +604,7 @@
523604 * @ssn: ssn.
524605 * @buf_size: buffer size.
525606 * @event: notification about station connection.
607
+ * @sta_id: station id.
526608 *
527609 * Return: 0 on success, corresponding negative error code on failure.
528610 */
....@@ -619,7 +701,10 @@
619701 /**
620702 * rsi_set_vap_capabilities() - This function send vap capability to firmware.
621703 * @common: Pointer to the driver private structure.
622
- * @opmode: Operating mode of device.
704
+ * @mode: Operating mode of device.
705
+ * @mac_addr: MAC address
706
+ * @vap_id: Rate information - offset and mask
707
+ * @vap_status: VAP status - ADD, DELETE or UPDATE
623708 *
624709 * Return: 0 on success, corresponding negative error code on failure.
625710 */
....@@ -700,6 +785,8 @@
700785 * @key_type: Type of key: GROUP/PAIRWISE.
701786 * @key_id: Key index.
702787 * @cipher: Type of cipher used.
788
+ * @sta_id: Station id.
789
+ * @vif: Pointer to the ieee80211_vif structure.
703790 *
704791 * Return: 0 on success, -1 on failure.
705792 */
....@@ -880,6 +967,50 @@
880967 return rsi_send_internal_mgmt_frame(common, skb);
881968 }
882969
970
+static int rsi_load_9116_bootup_params(struct rsi_common *common)
971
+{
972
+ struct sk_buff *skb;
973
+ struct rsi_boot_params_9116 *boot_params;
974
+
975
+ rsi_dbg(MGMT_TX_ZONE, "%s: Sending boot params frame\n", __func__);
976
+
977
+ skb = dev_alloc_skb(sizeof(struct rsi_boot_params_9116));
978
+ if (!skb)
979
+ return -ENOMEM;
980
+ memset(skb->data, 0, sizeof(struct rsi_boot_params));
981
+ boot_params = (struct rsi_boot_params_9116 *)skb->data;
982
+
983
+ if (common->channel_width == BW_40MHZ) {
984
+ memcpy(&boot_params->bootup_params,
985
+ &boot_params_9116_40,
986
+ sizeof(struct bootup_params_9116));
987
+ rsi_dbg(MGMT_TX_ZONE, "%s: Packet 40MHZ <=== %d\n", __func__,
988
+ UMAC_CLK_40BW);
989
+ boot_params->umac_clk = cpu_to_le16(UMAC_CLK_40BW);
990
+ } else {
991
+ memcpy(&boot_params->bootup_params,
992
+ &boot_params_9116_20,
993
+ sizeof(struct bootup_params_9116));
994
+ if (boot_params_20.valid != cpu_to_le32(VALID_20)) {
995
+ boot_params->umac_clk = cpu_to_le16(UMAC_CLK_20BW);
996
+ rsi_dbg(MGMT_TX_ZONE,
997
+ "%s: Packet 20MHZ <=== %d\n", __func__,
998
+ UMAC_CLK_20BW);
999
+ } else {
1000
+ boot_params->umac_clk = cpu_to_le16(UMAC_CLK_40MHZ);
1001
+ rsi_dbg(MGMT_TX_ZONE,
1002
+ "%s: Packet 20MHZ <=== %d\n", __func__,
1003
+ UMAC_CLK_40MHZ);
1004
+ }
1005
+ }
1006
+ rsi_set_len_qno(&boot_params->desc_dword0.len_qno,
1007
+ sizeof(struct bootup_params_9116), RSI_WIFI_MGMT_Q);
1008
+ boot_params->desc_dword0.frame_type = BOOTUP_PARAMS_REQUEST;
1009
+ skb_put(skb, sizeof(struct rsi_boot_params_9116));
1010
+
1011
+ return rsi_send_internal_mgmt_frame(common, skb);
1012
+}
1013
+
8831014 /**
8841015 * rsi_send_reset_mac() - This function prepares reset MAC request and sends an
8851016 * internal management frame to indicate it to firmware.
....@@ -908,6 +1039,11 @@
9081039 mgmt_frame->desc_word[1] = cpu_to_le16(RESET_MAC_REQ);
9091040 mgmt_frame->desc_word[4] = cpu_to_le16(RETRY_COUNT << 8);
9101041
1042
+#define RSI_9116_DEF_TA_AGGR 3
1043
+ if (common->priv->device_model == RSI_DEV_9116)
1044
+ mgmt_frame->desc_word[3] |=
1045
+ cpu_to_le16(RSI_9116_DEF_TA_AGGR << 8);
1046
+
9111047 skb_put(skb, FRAME_DESC_SZ);
9121048
9131049 return rsi_send_internal_mgmt_frame(common, skb);
....@@ -916,6 +1052,7 @@
9161052 /**
9171053 * rsi_band_check() - This function programs the band
9181054 * @common: Pointer to the driver private structure.
1055
+ * @curchan: Pointer to the current channel structure.
9191056 *
9201057 * Return: 0 on success, corresponding error code on failure.
9211058 */
....@@ -958,7 +1095,10 @@
9581095 }
9591096
9601097 if (common->channel_width != prev_bw) {
961
- status = rsi_load_bootup_params(common);
1098
+ if (adapter->device_model == RSI_DEV_9116)
1099
+ status = rsi_load_9116_bootup_params(common);
1100
+ else
1101
+ status = rsi_load_bootup_params(common);
9621102 if (status)
9631103 return status;
9641104
....@@ -1033,7 +1173,6 @@
10331173 * rsi_send_radio_params_update() - This function sends the radio
10341174 * parameters update to device
10351175 * @common: Pointer to the driver private structure.
1036
- * @channel: Channel value to be set.
10371176 *
10381177 * Return: 0 on success, corresponding error code on failure.
10391178 */
....@@ -1157,6 +1296,9 @@
11571296 * rsi_send_auto_rate_request() - This function is to set rates for connection
11581297 * and send autorate request to firmware.
11591298 * @common: Pointer to the driver private structure.
1299
+ * @sta: mac80211 station.
1300
+ * @sta_id: station id.
1301
+ * @vif: Pointer to the ieee80211_vif structure.
11601302 *
11611303 * Return: 0 on success, corresponding error code on failure.
11621304 */
....@@ -1314,10 +1456,15 @@
13141456 * help of sta notify params by sending an internal
13151457 * management frame to firmware.
13161458 * @common: Pointer to the driver private structure.
1459
+ * @opmode: Operating mode of device.
13171460 * @status: Bss status type.
1318
- * @bssid: Bssid.
1461
+ * @addr: Address of the register.
13191462 * @qos_enable: Qos is enabled.
13201463 * @aid: Aid (unique for all STAs).
1464
+ * @sta: mac80211 station.
1465
+ * @sta_id: station id.
1466
+ * @assoc_cap: capabilities.
1467
+ * @vif: Pointer to the ieee80211_vif structure.
13211468 *
13221469 * Return: None.
13231470 */
....@@ -1410,9 +1557,9 @@
14101557 * This function sends a frame to block/unblock
14111558 * data queues in the firmware
14121559 *
1413
- * @param common Pointer to the driver private structure.
1414
- * @param block event - block if true, unblock if false
1415
- * @return 0 on success, -1 on failure.
1560
+ * @common: Pointer to the driver private structure.
1561
+ * @block_event: Event block if true, unblock if false
1562
+ * returns 0 on success, -1 on failure.
14161563 */
14171564 int rsi_send_block_unblock_frame(struct rsi_common *common, bool block_event)
14181565 {
....@@ -1456,7 +1603,7 @@
14561603 * @common: Pointer to the driver private structure.
14571604 * @rx_filter_word: Flags of filter packets
14581605 *
1459
- * @Return: 0 on success, -1 on failure.
1606
+ * Returns 0 on success, -1 on failure.
14601607 */
14611608 int rsi_send_rx_filter_frame(struct rsi_common *common, u16 rx_filter_word)
14621609 {
....@@ -1540,8 +1687,49 @@
15401687 return rsi_send_internal_mgmt_frame(common, skb);
15411688 }
15421689
1690
+static int rsi_send_w9116_features(struct rsi_common *common)
1691
+{
1692
+ struct rsi_wlan_9116_features *w9116_features;
1693
+ u16 frame_len = sizeof(struct rsi_wlan_9116_features);
1694
+ struct sk_buff *skb;
1695
+
1696
+ rsi_dbg(MGMT_TX_ZONE,
1697
+ "%s: Sending wlan 9116 features\n", __func__);
1698
+
1699
+ skb = dev_alloc_skb(frame_len);
1700
+ if (!skb)
1701
+ return -ENOMEM;
1702
+ memset(skb->data, 0, frame_len);
1703
+
1704
+ w9116_features = (struct rsi_wlan_9116_features *)skb->data;
1705
+
1706
+ w9116_features->pll_mode = common->w9116_features.pll_mode;
1707
+ w9116_features->rf_type = common->w9116_features.rf_type;
1708
+ w9116_features->wireless_mode = common->w9116_features.wireless_mode;
1709
+ w9116_features->enable_ppe = common->w9116_features.enable_ppe;
1710
+ w9116_features->afe_type = common->w9116_features.afe_type;
1711
+ if (common->w9116_features.dpd)
1712
+ w9116_features->feature_enable |= cpu_to_le32(RSI_DPD);
1713
+ if (common->w9116_features.sifs_tx_enable)
1714
+ w9116_features->feature_enable |=
1715
+ cpu_to_le32(RSI_SIFS_TX_ENABLE);
1716
+ if (common->w9116_features.ps_options & RSI_DUTY_CYCLING)
1717
+ w9116_features->feature_enable |= cpu_to_le32(RSI_DUTY_CYCLING);
1718
+ if (common->w9116_features.ps_options & RSI_END_OF_FRAME)
1719
+ w9116_features->feature_enable |= cpu_to_le32(RSI_END_OF_FRAME);
1720
+ w9116_features->feature_enable |=
1721
+ cpu_to_le32((common->w9116_features.ps_options & ~0x3) << 2);
1722
+
1723
+ rsi_set_len_qno(&w9116_features->desc.desc_dword0.len_qno,
1724
+ frame_len - FRAME_DESC_SZ, RSI_WIFI_MGMT_Q);
1725
+ w9116_features->desc.desc_dword0.frame_type = FEATURES_ENABLE;
1726
+ skb_put(skb, frame_len);
1727
+
1728
+ return rsi_send_internal_mgmt_frame(common, skb);
1729
+}
1730
+
15431731 /**
1544
- * rsi_set_antenna() - This fuction send antenna configuration request
1732
+ * rsi_set_antenna() - This function send antenna configuration request
15451733 * to device
15461734 *
15471735 * @common: Pointer to the driver private structure.
....@@ -1635,6 +1823,111 @@
16351823 }
16361824 #endif
16371825
1826
+int rsi_send_bgscan_params(struct rsi_common *common, int enable)
1827
+{
1828
+ struct rsi_bgscan_params *params = &common->bgscan;
1829
+ struct cfg80211_scan_request *scan_req = common->hwscan;
1830
+ struct rsi_bgscan_config *bgscan;
1831
+ struct sk_buff *skb;
1832
+ u16 frame_len = sizeof(*bgscan);
1833
+ u8 i;
1834
+
1835
+ rsi_dbg(MGMT_TX_ZONE, "%s: Sending bgscan params frame\n", __func__);
1836
+
1837
+ skb = dev_alloc_skb(frame_len);
1838
+ if (!skb)
1839
+ return -ENOMEM;
1840
+ memset(skb->data, 0, frame_len);
1841
+
1842
+ bgscan = (struct rsi_bgscan_config *)skb->data;
1843
+ rsi_set_len_qno(&bgscan->desc_dword0.len_qno,
1844
+ (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q);
1845
+ bgscan->desc_dword0.frame_type = BG_SCAN_PARAMS;
1846
+ bgscan->bgscan_threshold = cpu_to_le16(params->bgscan_threshold);
1847
+ bgscan->roam_threshold = cpu_to_le16(params->roam_threshold);
1848
+ if (enable)
1849
+ bgscan->bgscan_periodicity =
1850
+ cpu_to_le16(params->bgscan_periodicity);
1851
+ bgscan->active_scan_duration =
1852
+ cpu_to_le16(params->active_scan_duration);
1853
+ bgscan->passive_scan_duration =
1854
+ cpu_to_le16(params->passive_scan_duration);
1855
+ bgscan->two_probe = params->two_probe;
1856
+
1857
+ bgscan->num_bgscan_channels = scan_req->n_channels;
1858
+ for (i = 0; i < bgscan->num_bgscan_channels; i++)
1859
+ bgscan->channels2scan[i] =
1860
+ cpu_to_le16(scan_req->channels[i]->hw_value);
1861
+
1862
+ skb_put(skb, frame_len);
1863
+
1864
+ return rsi_send_internal_mgmt_frame(common, skb);
1865
+}
1866
+
1867
+/* This function sends the probe request to be used by firmware in
1868
+ * background scan
1869
+ */
1870
+int rsi_send_bgscan_probe_req(struct rsi_common *common,
1871
+ struct ieee80211_vif *vif)
1872
+{
1873
+ struct cfg80211_scan_request *scan_req = common->hwscan;
1874
+ struct rsi_bgscan_probe *bgscan;
1875
+ struct sk_buff *skb;
1876
+ struct sk_buff *probereq_skb;
1877
+ u16 frame_len = sizeof(*bgscan);
1878
+ size_t ssid_len = 0;
1879
+ u8 *ssid = NULL;
1880
+
1881
+ rsi_dbg(MGMT_TX_ZONE,
1882
+ "%s: Sending bgscan probe req frame\n", __func__);
1883
+
1884
+ if (common->priv->sc_nvifs <= 0)
1885
+ return -ENODEV;
1886
+
1887
+ if (scan_req->n_ssids) {
1888
+ ssid = scan_req->ssids[0].ssid;
1889
+ ssid_len = scan_req->ssids[0].ssid_len;
1890
+ }
1891
+
1892
+ skb = dev_alloc_skb(frame_len + MAX_BGSCAN_PROBE_REQ_LEN);
1893
+ if (!skb)
1894
+ return -ENOMEM;
1895
+ memset(skb->data, 0, frame_len + MAX_BGSCAN_PROBE_REQ_LEN);
1896
+
1897
+ bgscan = (struct rsi_bgscan_probe *)skb->data;
1898
+ bgscan->desc_dword0.frame_type = BG_SCAN_PROBE_REQ;
1899
+ bgscan->flags = cpu_to_le16(HOST_BG_SCAN_TRIG);
1900
+ if (common->band == NL80211_BAND_5GHZ) {
1901
+ bgscan->mgmt_rate = cpu_to_le16(RSI_RATE_6);
1902
+ bgscan->def_chan = cpu_to_le16(40);
1903
+ } else {
1904
+ bgscan->mgmt_rate = cpu_to_le16(RSI_RATE_1);
1905
+ bgscan->def_chan = cpu_to_le16(11);
1906
+ }
1907
+ bgscan->channel_scan_time = cpu_to_le16(RSI_CHANNEL_SCAN_TIME);
1908
+
1909
+ probereq_skb = ieee80211_probereq_get(common->priv->hw, vif->addr, ssid,
1910
+ ssid_len, scan_req->ie_len);
1911
+ if (!probereq_skb) {
1912
+ dev_kfree_skb(skb);
1913
+ return -ENOMEM;
1914
+ }
1915
+
1916
+ memcpy(&skb->data[frame_len], probereq_skb->data, probereq_skb->len);
1917
+
1918
+ bgscan->probe_req_length = cpu_to_le16(probereq_skb->len);
1919
+
1920
+ rsi_set_len_qno(&bgscan->desc_dword0.len_qno,
1921
+ (frame_len - FRAME_DESC_SZ + probereq_skb->len),
1922
+ RSI_WIFI_MGMT_Q);
1923
+
1924
+ skb_put(skb, frame_len + probereq_skb->len);
1925
+
1926
+ dev_kfree_skb(probereq_skb);
1927
+
1928
+ return rsi_send_internal_mgmt_frame(common, skb);
1929
+}
1930
+
16381931 /**
16391932 * rsi_handle_ta_confirm_type() - This function handles the confirm frames.
16401933 * @common: Pointer to the driver private structure.
....@@ -1655,15 +1948,26 @@
16551948 rsi_dbg(FSM_ZONE, "%s: Boot up params confirm received\n",
16561949 __func__);
16571950 if (common->fsm_state == FSM_BOOT_PARAMS_SENT) {
1658
- adapter->eeprom.length = (IEEE80211_ADDR_LEN +
1659
- WLAN_MAC_MAGIC_WORD_LEN +
1660
- WLAN_HOST_MODE_LEN);
1661
- adapter->eeprom.offset = WLAN_MAC_EEPROM_ADDR;
1662
- if (rsi_eeprom_read(common)) {
1663
- common->fsm_state = FSM_CARD_NOT_READY;
1664
- goto out;
1951
+ if (adapter->device_model == RSI_DEV_9116) {
1952
+ common->band = NL80211_BAND_5GHZ;
1953
+ common->num_supp_bands = 2;
1954
+
1955
+ if (rsi_send_reset_mac(common))
1956
+ goto out;
1957
+ else
1958
+ common->fsm_state = FSM_RESET_MAC_SENT;
1959
+ } else {
1960
+ adapter->eeprom.length =
1961
+ (IEEE80211_ADDR_LEN +
1962
+ WLAN_MAC_MAGIC_WORD_LEN +
1963
+ WLAN_HOST_MODE_LEN);
1964
+ adapter->eeprom.offset = WLAN_MAC_EEPROM_ADDR;
1965
+ if (rsi_eeprom_read(common)) {
1966
+ common->fsm_state = FSM_CARD_NOT_READY;
1967
+ goto out;
1968
+ }
1969
+ common->fsm_state = FSM_EEPROM_READ_MAC_ADDR;
16651970 }
1666
- common->fsm_state = FSM_EEPROM_READ_MAC_ADDR;
16671971 } else {
16681972 rsi_dbg(INFO_ZONE,
16691973 "%s: Received bootup params cfm in %d state\n",
....@@ -1742,6 +2046,12 @@
17422046 case RADIO_CAPABILITIES:
17432047 if (common->fsm_state == FSM_RADIO_CAPS_SENT) {
17442048 common->rf_reset = 1;
2049
+ if (adapter->device_model == RSI_DEV_9116 &&
2050
+ rsi_send_w9116_features(common)) {
2051
+ rsi_dbg(ERR_ZONE,
2052
+ "Failed to send 9116 features\n");
2053
+ goto out;
2054
+ }
17452055 if (rsi_program_bb_rf(common)) {
17462056 goto out;
17472057 } else {
....@@ -1781,9 +2091,28 @@
17812091 return 0;
17822092 }
17832093 break;
2094
+
2095
+ case SCAN_REQUEST:
2096
+ rsi_dbg(INFO_ZONE, "Set channel confirm\n");
2097
+ break;
2098
+
17842099 case WAKEUP_SLEEP_REQUEST:
17852100 rsi_dbg(INFO_ZONE, "Wakeup/Sleep confirmation.\n");
17862101 return rsi_handle_ps_confirm(adapter, msg);
2102
+
2103
+ case BG_SCAN_PROBE_REQ:
2104
+ rsi_dbg(INFO_ZONE, "BG scan complete event\n");
2105
+ if (common->bgscan_en) {
2106
+ struct cfg80211_scan_info info;
2107
+
2108
+ if (!rsi_send_bgscan_params(common, RSI_STOP_BGSCAN))
2109
+ common->bgscan_en = 0;
2110
+ info.aborted = false;
2111
+ ieee80211_scan_completed(adapter->hw, &info);
2112
+ }
2113
+ rsi_dbg(INFO_ZONE, "Background scan completed\n");
2114
+ break;
2115
+
17872116 default:
17882117 rsi_dbg(INFO_ZONE, "%s: Invalid TA confirm pkt received\n",
17892118 __func__);
....@@ -1798,6 +2127,8 @@
17982127
17992128 int rsi_handle_card_ready(struct rsi_common *common, u8 *msg)
18002129 {
2130
+ int status;
2131
+
18012132 switch (common->fsm_state) {
18022133 case FSM_CARD_NOT_READY:
18032134 rsi_dbg(INIT_ZONE, "Card ready indication from Common HAL\n");
....@@ -1809,14 +2140,29 @@
18092140 case FSM_COMMON_DEV_PARAMS_SENT:
18102141 rsi_dbg(INIT_ZONE, "Card ready indication from WLAN HAL\n");
18112142
2143
+ if (common->priv->device_model == RSI_DEV_9116) {
2144
+ if (msg[16] != MAGIC_WORD) {
2145
+ rsi_dbg(FSM_ZONE,
2146
+ "%s: [EEPROM_READ] Invalid token\n",
2147
+ __func__);
2148
+ common->fsm_state = FSM_CARD_NOT_READY;
2149
+ return -EINVAL;
2150
+ }
2151
+ memcpy(common->mac_addr, &msg[20], ETH_ALEN);
2152
+ rsi_dbg(INIT_ZONE, "MAC Addr %pM", common->mac_addr);
2153
+ }
18122154 /* Get usb buffer status register address */
18132155 common->priv->usb_buffer_status_reg = *(u32 *)&msg[8];
18142156 rsi_dbg(INFO_ZONE, "USB buffer status register = %x\n",
18152157 common->priv->usb_buffer_status_reg);
18162158
1817
- if (rsi_load_bootup_params(common)) {
2159
+ if (common->priv->device_model == RSI_DEV_9116)
2160
+ status = rsi_load_9116_bootup_params(common);
2161
+ else
2162
+ status = rsi_load_bootup_params(common);
2163
+ if (status < 0) {
18182164 common->fsm_state = FSM_CARD_NOT_READY;
1819
- return -EINVAL;
2165
+ return status;
18202166 }
18212167 common->fsm_state = FSM_BOOT_PARAMS_SENT;
18222168 break;
....@@ -1832,7 +2178,7 @@
18322178
18332179 /**
18342180 * rsi_mgmt_pkt_recv() - This function processes the management packets
1835
- * recieved from the hardware.
2181
+ * received from the hardware.
18362182 * @common: Pointer to the driver private structure.
18372183 * @msg: Pointer to the received packet.
18382184 *
....@@ -1880,6 +2226,35 @@
18802226 return -1;
18812227 rsi_send_beacon(common);
18822228 break;
2229
+ case WOWLAN_WAKEUP_REASON:
2230
+ rsi_dbg(ERR_ZONE, "\n\nWakeup Type: %x\n", msg[15]);
2231
+ switch (msg[15]) {
2232
+ case RSI_UNICAST_MAGIC_PKT:
2233
+ rsi_dbg(ERR_ZONE,
2234
+ "*** Wakeup for Unicast magic packet ***\n");
2235
+ break;
2236
+ case RSI_BROADCAST_MAGICPKT:
2237
+ rsi_dbg(ERR_ZONE,
2238
+ "*** Wakeup for Broadcast magic packet ***\n");
2239
+ break;
2240
+ case RSI_EAPOL_PKT:
2241
+ rsi_dbg(ERR_ZONE,
2242
+ "*** Wakeup for GTK renewal ***\n");
2243
+ break;
2244
+ case RSI_DISCONNECT_PKT:
2245
+ rsi_dbg(ERR_ZONE,
2246
+ "*** Wakeup for Disconnect ***\n");
2247
+ break;
2248
+ case RSI_HW_BMISS_PKT:
2249
+ rsi_dbg(ERR_ZONE,
2250
+ "*** Wakeup for HW Beacon miss ***\n");
2251
+ break;
2252
+ default:
2253
+ rsi_dbg(ERR_ZONE,
2254
+ "##### Un-intentional Wakeup #####\n");
2255
+ break;
2256
+ }
2257
+ break;
18832258 case RX_DOT11_MGMT:
18842259 return rsi_mgmt_pkt_to_core(common, msg, msg_len);
18852260 default: