main.c 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. /*
  2. * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  17. #include <linux/module.h>
  18. #include <linux/firmware.h>
  19. #include <linux/platform_device.h>
  20. #include "wcn36xx.h"
  21. unsigned int wcn36xx_dbg_mask;
  22. module_param_named(debug_mask, wcn36xx_dbg_mask, uint, 0644);
  23. MODULE_PARM_DESC(debug_mask, "Debugging mask");
  24. #define CHAN2G(_freq, _idx) { \
  25. .band = IEEE80211_BAND_2GHZ, \
  26. .center_freq = (_freq), \
  27. .hw_value = (_idx), \
  28. .max_power = 25, \
  29. }
  30. #define CHAN5G(_freq, _idx) { \
  31. .band = IEEE80211_BAND_5GHZ, \
  32. .center_freq = (_freq), \
  33. .hw_value = (_idx), \
  34. .max_power = 25, \
  35. }
  36. /* The wcn firmware expects channel values to matching
  37. * their mnemonic values. So use these for .hw_value. */
  38. static struct ieee80211_channel wcn_2ghz_channels[] = {
  39. CHAN2G(2412, 1), /* Channel 1 */
  40. CHAN2G(2417, 2), /* Channel 2 */
  41. CHAN2G(2422, 3), /* Channel 3 */
  42. CHAN2G(2427, 4), /* Channel 4 */
  43. CHAN2G(2432, 5), /* Channel 5 */
  44. CHAN2G(2437, 6), /* Channel 6 */
  45. CHAN2G(2442, 7), /* Channel 7 */
  46. CHAN2G(2447, 8), /* Channel 8 */
  47. CHAN2G(2452, 9), /* Channel 9 */
  48. CHAN2G(2457, 10), /* Channel 10 */
  49. CHAN2G(2462, 11), /* Channel 11 */
  50. CHAN2G(2467, 12), /* Channel 12 */
  51. CHAN2G(2472, 13), /* Channel 13 */
  52. CHAN2G(2484, 14) /* Channel 14 */
  53. };
  54. static struct ieee80211_channel wcn_5ghz_channels[] = {
  55. CHAN5G(5180, 36),
  56. CHAN5G(5200, 40),
  57. CHAN5G(5220, 44),
  58. CHAN5G(5240, 48),
  59. CHAN5G(5260, 52),
  60. CHAN5G(5280, 56),
  61. CHAN5G(5300, 60),
  62. CHAN5G(5320, 64),
  63. CHAN5G(5500, 100),
  64. CHAN5G(5520, 104),
  65. CHAN5G(5540, 108),
  66. CHAN5G(5560, 112),
  67. CHAN5G(5580, 116),
  68. CHAN5G(5600, 120),
  69. CHAN5G(5620, 124),
  70. CHAN5G(5640, 128),
  71. CHAN5G(5660, 132),
  72. CHAN5G(5700, 140),
  73. CHAN5G(5745, 149),
  74. CHAN5G(5765, 153),
  75. CHAN5G(5785, 157),
  76. CHAN5G(5805, 161),
  77. CHAN5G(5825, 165)
  78. };
  79. #define RATE(_bitrate, _hw_rate, _flags) { \
  80. .bitrate = (_bitrate), \
  81. .flags = (_flags), \
  82. .hw_value = (_hw_rate), \
  83. .hw_value_short = (_hw_rate) \
  84. }
  85. static struct ieee80211_rate wcn_2ghz_rates[] = {
  86. RATE(10, HW_RATE_INDEX_1MBPS, 0),
  87. RATE(20, HW_RATE_INDEX_2MBPS, IEEE80211_RATE_SHORT_PREAMBLE),
  88. RATE(55, HW_RATE_INDEX_5_5MBPS, IEEE80211_RATE_SHORT_PREAMBLE),
  89. RATE(110, HW_RATE_INDEX_11MBPS, IEEE80211_RATE_SHORT_PREAMBLE),
  90. RATE(60, HW_RATE_INDEX_6MBPS, 0),
  91. RATE(90, HW_RATE_INDEX_9MBPS, 0),
  92. RATE(120, HW_RATE_INDEX_12MBPS, 0),
  93. RATE(180, HW_RATE_INDEX_18MBPS, 0),
  94. RATE(240, HW_RATE_INDEX_24MBPS, 0),
  95. RATE(360, HW_RATE_INDEX_36MBPS, 0),
  96. RATE(480, HW_RATE_INDEX_48MBPS, 0),
  97. RATE(540, HW_RATE_INDEX_54MBPS, 0)
  98. };
  99. static struct ieee80211_rate wcn_5ghz_rates[] = {
  100. RATE(60, HW_RATE_INDEX_6MBPS, 0),
  101. RATE(90, HW_RATE_INDEX_9MBPS, 0),
  102. RATE(120, HW_RATE_INDEX_12MBPS, 0),
  103. RATE(180, HW_RATE_INDEX_18MBPS, 0),
  104. RATE(240, HW_RATE_INDEX_24MBPS, 0),
  105. RATE(360, HW_RATE_INDEX_36MBPS, 0),
  106. RATE(480, HW_RATE_INDEX_48MBPS, 0),
  107. RATE(540, HW_RATE_INDEX_54MBPS, 0)
  108. };
  109. static struct ieee80211_supported_band wcn_band_2ghz = {
  110. .channels = wcn_2ghz_channels,
  111. .n_channels = ARRAY_SIZE(wcn_2ghz_channels),
  112. .bitrates = wcn_2ghz_rates,
  113. .n_bitrates = ARRAY_SIZE(wcn_2ghz_rates),
  114. .ht_cap = {
  115. .cap = IEEE80211_HT_CAP_GRN_FLD |
  116. IEEE80211_HT_CAP_SGI_20 |
  117. IEEE80211_HT_CAP_DSSSCCK40 |
  118. IEEE80211_HT_CAP_LSIG_TXOP_PROT,
  119. .ht_supported = true,
  120. .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K,
  121. .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
  122. .mcs = {
  123. .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
  124. .rx_highest = cpu_to_le16(72),
  125. .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
  126. }
  127. }
  128. };
  129. static struct ieee80211_supported_band wcn_band_5ghz = {
  130. .channels = wcn_5ghz_channels,
  131. .n_channels = ARRAY_SIZE(wcn_5ghz_channels),
  132. .bitrates = wcn_5ghz_rates,
  133. .n_bitrates = ARRAY_SIZE(wcn_5ghz_rates),
  134. .ht_cap = {
  135. .cap = IEEE80211_HT_CAP_GRN_FLD |
  136. IEEE80211_HT_CAP_SGI_20 |
  137. IEEE80211_HT_CAP_DSSSCCK40 |
  138. IEEE80211_HT_CAP_LSIG_TXOP_PROT |
  139. IEEE80211_HT_CAP_SGI_40 |
  140. IEEE80211_HT_CAP_SUP_WIDTH_20_40,
  141. .ht_supported = true,
  142. .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K,
  143. .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
  144. .mcs = {
  145. .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
  146. .rx_highest = cpu_to_le16(72),
  147. .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
  148. }
  149. }
  150. };
  151. #ifdef CONFIG_PM
  152. static const struct wiphy_wowlan_support wowlan_support = {
  153. .flags = WIPHY_WOWLAN_ANY
  154. };
  155. #endif
  156. static inline u8 get_sta_index(struct ieee80211_vif *vif,
  157. struct wcn36xx_sta *sta_priv)
  158. {
  159. return NL80211_IFTYPE_STATION == vif->type ?
  160. sta_priv->bss_sta_index :
  161. sta_priv->sta_index;
  162. }
  163. static const char * const wcn36xx_caps_names[] = {
  164. "MCC", /* 0 */
  165. "P2P", /* 1 */
  166. "DOT11AC", /* 2 */
  167. "SLM_SESSIONIZATION", /* 3 */
  168. "DOT11AC_OPMODE", /* 4 */
  169. "SAP32STA", /* 5 */
  170. "TDLS", /* 6 */
  171. "P2P_GO_NOA_DECOUPLE_INIT_SCAN",/* 7 */
  172. "WLANACTIVE_OFFLOAD", /* 8 */
  173. "BEACON_OFFLOAD", /* 9 */
  174. "SCAN_OFFLOAD", /* 10 */
  175. "ROAM_OFFLOAD", /* 11 */
  176. "BCN_MISS_OFFLOAD", /* 12 */
  177. "STA_POWERSAVE", /* 13 */
  178. "STA_ADVANCED_PWRSAVE", /* 14 */
  179. "AP_UAPSD", /* 15 */
  180. "AP_DFS", /* 16 */
  181. "BLOCKACK", /* 17 */
  182. "PHY_ERR", /* 18 */
  183. "BCN_FILTER", /* 19 */
  184. "RTT", /* 20 */
  185. "RATECTRL", /* 21 */
  186. "WOW" /* 22 */
  187. };
  188. static const char *wcn36xx_get_cap_name(enum place_holder_in_cap_bitmap x)
  189. {
  190. if (x >= ARRAY_SIZE(wcn36xx_caps_names))
  191. return "UNKNOWN";
  192. return wcn36xx_caps_names[x];
  193. }
  194. static void wcn36xx_feat_caps_info(struct wcn36xx *wcn)
  195. {
  196. int i;
  197. for (i = 0; i < MAX_FEATURE_SUPPORTED; i++) {
  198. if (get_feat_caps(wcn->fw_feat_caps, i))
  199. wcn36xx_info("FW Cap %s\n", wcn36xx_get_cap_name(i));
  200. }
  201. }
  202. static void wcn36xx_detect_chip_version(struct wcn36xx *wcn)
  203. {
  204. if (get_feat_caps(wcn->fw_feat_caps, DOT11AC)) {
  205. wcn36xx_info("Chip is 3680\n");
  206. wcn->chip_version = WCN36XX_CHIP_3680;
  207. } else {
  208. wcn36xx_info("Chip is 3660\n");
  209. wcn->chip_version = WCN36XX_CHIP_3660;
  210. }
  211. }
  212. static int wcn36xx_start(struct ieee80211_hw *hw)
  213. {
  214. struct wcn36xx *wcn = hw->priv;
  215. int ret;
  216. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac start\n");
  217. /* SMD initialization */
  218. ret = wcn36xx_smd_open(wcn);
  219. if (ret) {
  220. wcn36xx_err("Failed to open smd channel: %d\n", ret);
  221. goto out_err;
  222. }
  223. /* Allocate memory pools for Mgmt BD headers and Data BD headers */
  224. ret = wcn36xx_dxe_allocate_mem_pools(wcn);
  225. if (ret) {
  226. wcn36xx_err("Failed to alloc DXE mempool: %d\n", ret);
  227. goto out_smd_close;
  228. }
  229. ret = wcn36xx_dxe_alloc_ctl_blks(wcn);
  230. if (ret) {
  231. wcn36xx_err("Failed to alloc DXE ctl blocks: %d\n", ret);
  232. goto out_free_dxe_pool;
  233. }
  234. wcn->hal_buf = kmalloc(WCN36XX_HAL_BUF_SIZE, GFP_KERNEL);
  235. if (!wcn->hal_buf) {
  236. wcn36xx_err("Failed to allocate smd buf\n");
  237. ret = -ENOMEM;
  238. goto out_free_dxe_ctl;
  239. }
  240. ret = wcn36xx_smd_load_nv(wcn);
  241. if (ret) {
  242. wcn36xx_err("Failed to push NV to chip\n");
  243. goto out_free_smd_buf;
  244. }
  245. ret = wcn36xx_smd_start(wcn);
  246. if (ret) {
  247. wcn36xx_err("Failed to start chip\n");
  248. goto out_free_smd_buf;
  249. }
  250. if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
  251. ret = wcn36xx_smd_feature_caps_exchange(wcn);
  252. if (ret)
  253. wcn36xx_warn("Exchange feature caps failed\n");
  254. else
  255. wcn36xx_feat_caps_info(wcn);
  256. }
  257. wcn36xx_detect_chip_version(wcn);
  258. /* DMA channel initialization */
  259. ret = wcn36xx_dxe_init(wcn);
  260. if (ret) {
  261. wcn36xx_err("DXE init failed\n");
  262. goto out_smd_stop;
  263. }
  264. wcn36xx_debugfs_init(wcn);
  265. INIT_LIST_HEAD(&wcn->vif_list);
  266. return 0;
  267. out_smd_stop:
  268. wcn36xx_smd_stop(wcn);
  269. out_free_smd_buf:
  270. kfree(wcn->hal_buf);
  271. out_free_dxe_pool:
  272. wcn36xx_dxe_free_mem_pools(wcn);
  273. out_free_dxe_ctl:
  274. wcn36xx_dxe_free_ctl_blks(wcn);
  275. out_smd_close:
  276. wcn36xx_smd_close(wcn);
  277. out_err:
  278. return ret;
  279. }
  280. static void wcn36xx_stop(struct ieee80211_hw *hw)
  281. {
  282. struct wcn36xx *wcn = hw->priv;
  283. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac stop\n");
  284. wcn36xx_debugfs_exit(wcn);
  285. wcn36xx_smd_stop(wcn);
  286. wcn36xx_dxe_deinit(wcn);
  287. wcn36xx_smd_close(wcn);
  288. wcn36xx_dxe_free_mem_pools(wcn);
  289. wcn36xx_dxe_free_ctl_blks(wcn);
  290. kfree(wcn->hal_buf);
  291. }
  292. static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
  293. {
  294. struct wcn36xx *wcn = hw->priv;
  295. struct ieee80211_vif *vif = NULL;
  296. struct wcn36xx_vif *tmp;
  297. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac config changed 0x%08x\n", changed);
  298. if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  299. int ch = WCN36XX_HW_CHANNEL(wcn);
  300. wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n",
  301. ch);
  302. list_for_each_entry(tmp, &wcn->vif_list, list) {
  303. vif = container_of((void *)tmp,
  304. struct ieee80211_vif,
  305. drv_priv);
  306. wcn36xx_smd_switch_channel(wcn, vif, ch);
  307. }
  308. }
  309. return 0;
  310. }
  311. #define WCN36XX_SUPPORTED_FILTERS (0)
  312. static void wcn36xx_configure_filter(struct ieee80211_hw *hw,
  313. unsigned int changed,
  314. unsigned int *total, u64 multicast)
  315. {
  316. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac configure filter\n");
  317. *total &= WCN36XX_SUPPORTED_FILTERS;
  318. }
  319. static void wcn36xx_tx(struct ieee80211_hw *hw,
  320. struct ieee80211_tx_control *control,
  321. struct sk_buff *skb)
  322. {
  323. struct wcn36xx *wcn = hw->priv;
  324. struct wcn36xx_sta *sta_priv = NULL;
  325. if (control->sta)
  326. sta_priv = (struct wcn36xx_sta *)control->sta->drv_priv;
  327. if (wcn36xx_start_tx(wcn, sta_priv, skb))
  328. ieee80211_free_txskb(wcn->hw, skb);
  329. }
  330. static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
  331. struct ieee80211_vif *vif,
  332. struct ieee80211_sta *sta,
  333. struct ieee80211_key_conf *key_conf)
  334. {
  335. struct wcn36xx *wcn = hw->priv;
  336. struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
  337. struct wcn36xx_sta *sta_priv = vif_priv->sta;
  338. int ret = 0;
  339. u8 key[WLAN_MAX_KEY_LEN];
  340. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac80211 set key\n");
  341. wcn36xx_dbg(WCN36XX_DBG_MAC, "Key: cmd=0x%x algo:0x%x, id:%d, len:%d flags 0x%x\n",
  342. cmd, key_conf->cipher, key_conf->keyidx,
  343. key_conf->keylen, key_conf->flags);
  344. wcn36xx_dbg_dump(WCN36XX_DBG_MAC, "KEY: ",
  345. key_conf->key,
  346. key_conf->keylen);
  347. switch (key_conf->cipher) {
  348. case WLAN_CIPHER_SUITE_WEP40:
  349. vif_priv->encrypt_type = WCN36XX_HAL_ED_WEP40;
  350. break;
  351. case WLAN_CIPHER_SUITE_WEP104:
  352. vif_priv->encrypt_type = WCN36XX_HAL_ED_WEP40;
  353. break;
  354. case WLAN_CIPHER_SUITE_CCMP:
  355. vif_priv->encrypt_type = WCN36XX_HAL_ED_CCMP;
  356. break;
  357. case WLAN_CIPHER_SUITE_TKIP:
  358. vif_priv->encrypt_type = WCN36XX_HAL_ED_TKIP;
  359. break;
  360. default:
  361. wcn36xx_err("Unsupported key type 0x%x\n",
  362. key_conf->cipher);
  363. ret = -EOPNOTSUPP;
  364. goto out;
  365. }
  366. switch (cmd) {
  367. case SET_KEY:
  368. if (WCN36XX_HAL_ED_TKIP == vif_priv->encrypt_type) {
  369. /*
  370. * Supplicant is sending key in the wrong order:
  371. * Temporal Key (16 b) - TX MIC (8 b) - RX MIC (8 b)
  372. * but HW expects it to be in the order as described in
  373. * IEEE 802.11 spec (see chapter 11.7) like this:
  374. * Temporal Key (16 b) - RX MIC (8 b) - TX MIC (8 b)
  375. */
  376. memcpy(key, key_conf->key, 16);
  377. memcpy(key + 16, key_conf->key + 24, 8);
  378. memcpy(key + 24, key_conf->key + 16, 8);
  379. } else {
  380. memcpy(key, key_conf->key, key_conf->keylen);
  381. }
  382. if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) {
  383. sta_priv->is_data_encrypted = true;
  384. /* Reconfigure bss with encrypt_type */
  385. if (NL80211_IFTYPE_STATION == vif->type)
  386. wcn36xx_smd_config_bss(wcn,
  387. vif,
  388. sta,
  389. sta->addr,
  390. true);
  391. wcn36xx_smd_set_stakey(wcn,
  392. vif_priv->encrypt_type,
  393. key_conf->keyidx,
  394. key_conf->keylen,
  395. key,
  396. get_sta_index(vif, sta_priv));
  397. } else {
  398. wcn36xx_smd_set_bsskey(wcn,
  399. vif_priv->encrypt_type,
  400. key_conf->keyidx,
  401. key_conf->keylen,
  402. key);
  403. if ((WLAN_CIPHER_SUITE_WEP40 == key_conf->cipher) ||
  404. (WLAN_CIPHER_SUITE_WEP104 == key_conf->cipher)) {
  405. sta_priv->is_data_encrypted = true;
  406. wcn36xx_smd_set_stakey(wcn,
  407. vif_priv->encrypt_type,
  408. key_conf->keyidx,
  409. key_conf->keylen,
  410. key,
  411. get_sta_index(vif, sta_priv));
  412. }
  413. }
  414. break;
  415. case DISABLE_KEY:
  416. if (!(IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags)) {
  417. wcn36xx_smd_remove_bsskey(wcn,
  418. vif_priv->encrypt_type,
  419. key_conf->keyidx);
  420. } else {
  421. sta_priv->is_data_encrypted = false;
  422. /* do not remove key if disassociated */
  423. if (sta_priv->aid)
  424. wcn36xx_smd_remove_stakey(wcn,
  425. vif_priv->encrypt_type,
  426. key_conf->keyidx,
  427. get_sta_index(vif, sta_priv));
  428. }
  429. break;
  430. default:
  431. wcn36xx_err("Unsupported key cmd 0x%x\n", cmd);
  432. ret = -EOPNOTSUPP;
  433. goto out;
  434. }
  435. out:
  436. return ret;
  437. }
  438. static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw,
  439. struct ieee80211_vif *vif,
  440. const u8 *mac_addr)
  441. {
  442. struct wcn36xx *wcn = hw->priv;
  443. wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN);
  444. wcn36xx_smd_start_scan(wcn);
  445. }
  446. static void wcn36xx_sw_scan_complete(struct ieee80211_hw *hw,
  447. struct ieee80211_vif *vif)
  448. {
  449. struct wcn36xx *wcn = hw->priv;
  450. wcn36xx_smd_end_scan(wcn);
  451. wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN);
  452. }
  453. static void wcn36xx_update_allowed_rates(struct ieee80211_sta *sta,
  454. enum ieee80211_band band)
  455. {
  456. int i, size;
  457. u16 *rates_table;
  458. struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
  459. u32 rates = sta->supp_rates[band];
  460. memset(&sta_priv->supported_rates, 0,
  461. sizeof(sta_priv->supported_rates));
  462. sta_priv->supported_rates.op_rate_mode = STA_11n;
  463. size = ARRAY_SIZE(sta_priv->supported_rates.dsss_rates);
  464. rates_table = sta_priv->supported_rates.dsss_rates;
  465. if (band == IEEE80211_BAND_2GHZ) {
  466. for (i = 0; i < size; i++) {
  467. if (rates & 0x01) {
  468. rates_table[i] = wcn_2ghz_rates[i].hw_value;
  469. rates = rates >> 1;
  470. }
  471. }
  472. }
  473. size = ARRAY_SIZE(sta_priv->supported_rates.ofdm_rates);
  474. rates_table = sta_priv->supported_rates.ofdm_rates;
  475. for (i = 0; i < size; i++) {
  476. if (rates & 0x01) {
  477. rates_table[i] = wcn_5ghz_rates[i].hw_value;
  478. rates = rates >> 1;
  479. }
  480. }
  481. if (sta->ht_cap.ht_supported) {
  482. BUILD_BUG_ON(sizeof(sta->ht_cap.mcs.rx_mask) >
  483. sizeof(sta_priv->supported_rates.supported_mcs_set));
  484. memcpy(sta_priv->supported_rates.supported_mcs_set,
  485. sta->ht_cap.mcs.rx_mask,
  486. sizeof(sta->ht_cap.mcs.rx_mask));
  487. }
  488. }
  489. void wcn36xx_set_default_rates(struct wcn36xx_hal_supported_rates *rates)
  490. {
  491. u16 ofdm_rates[WCN36XX_HAL_NUM_OFDM_RATES] = {
  492. HW_RATE_INDEX_6MBPS,
  493. HW_RATE_INDEX_9MBPS,
  494. HW_RATE_INDEX_12MBPS,
  495. HW_RATE_INDEX_18MBPS,
  496. HW_RATE_INDEX_24MBPS,
  497. HW_RATE_INDEX_36MBPS,
  498. HW_RATE_INDEX_48MBPS,
  499. HW_RATE_INDEX_54MBPS
  500. };
  501. u16 dsss_rates[WCN36XX_HAL_NUM_DSSS_RATES] = {
  502. HW_RATE_INDEX_1MBPS,
  503. HW_RATE_INDEX_2MBPS,
  504. HW_RATE_INDEX_5_5MBPS,
  505. HW_RATE_INDEX_11MBPS
  506. };
  507. rates->op_rate_mode = STA_11n;
  508. memcpy(rates->dsss_rates, dsss_rates,
  509. sizeof(*dsss_rates) * WCN36XX_HAL_NUM_DSSS_RATES);
  510. memcpy(rates->ofdm_rates, ofdm_rates,
  511. sizeof(*ofdm_rates) * WCN36XX_HAL_NUM_OFDM_RATES);
  512. rates->supported_mcs_set[0] = 0xFF;
  513. }
  514. static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
  515. struct ieee80211_vif *vif,
  516. struct ieee80211_bss_conf *bss_conf,
  517. u32 changed)
  518. {
  519. struct wcn36xx *wcn = hw->priv;
  520. struct sk_buff *skb = NULL;
  521. u16 tim_off, tim_len;
  522. enum wcn36xx_hal_link_state link_state;
  523. struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
  524. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss info changed vif %p changed 0x%08x\n",
  525. vif, changed);
  526. if (changed & BSS_CHANGED_BEACON_INFO) {
  527. wcn36xx_dbg(WCN36XX_DBG_MAC,
  528. "mac bss changed dtim period %d\n",
  529. bss_conf->dtim_period);
  530. vif_priv->dtim_period = bss_conf->dtim_period;
  531. }
  532. if (changed & BSS_CHANGED_PS) {
  533. wcn36xx_dbg(WCN36XX_DBG_MAC,
  534. "mac bss PS set %d\n",
  535. bss_conf->ps);
  536. if (bss_conf->ps) {
  537. wcn36xx_pmc_enter_bmps_state(wcn, vif);
  538. } else {
  539. wcn36xx_pmc_exit_bmps_state(wcn, vif);
  540. }
  541. }
  542. if (changed & BSS_CHANGED_BSSID) {
  543. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed_bssid %pM\n",
  544. bss_conf->bssid);
  545. if (!is_zero_ether_addr(bss_conf->bssid)) {
  546. vif_priv->is_joining = true;
  547. vif_priv->bss_index = 0xff;
  548. wcn36xx_smd_join(wcn, bss_conf->bssid,
  549. vif->addr, WCN36XX_HW_CHANNEL(wcn));
  550. wcn36xx_smd_config_bss(wcn, vif, NULL,
  551. bss_conf->bssid, false);
  552. } else {
  553. vif_priv->is_joining = false;
  554. wcn36xx_smd_delete_bss(wcn, vif);
  555. }
  556. }
  557. if (changed & BSS_CHANGED_SSID) {
  558. wcn36xx_dbg(WCN36XX_DBG_MAC,
  559. "mac bss changed ssid\n");
  560. wcn36xx_dbg_dump(WCN36XX_DBG_MAC, "ssid ",
  561. bss_conf->ssid, bss_conf->ssid_len);
  562. vif_priv->ssid.length = bss_conf->ssid_len;
  563. memcpy(&vif_priv->ssid.ssid,
  564. bss_conf->ssid,
  565. bss_conf->ssid_len);
  566. }
  567. if (changed & BSS_CHANGED_ASSOC) {
  568. vif_priv->is_joining = false;
  569. if (bss_conf->assoc) {
  570. struct ieee80211_sta *sta;
  571. struct wcn36xx_sta *sta_priv;
  572. wcn36xx_dbg(WCN36XX_DBG_MAC,
  573. "mac assoc bss %pM vif %pM AID=%d\n",
  574. bss_conf->bssid,
  575. vif->addr,
  576. bss_conf->aid);
  577. rcu_read_lock();
  578. sta = ieee80211_find_sta(vif, bss_conf->bssid);
  579. if (!sta) {
  580. wcn36xx_err("sta %pM is not found\n",
  581. bss_conf->bssid);
  582. rcu_read_unlock();
  583. goto out;
  584. }
  585. sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
  586. wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn));
  587. wcn36xx_smd_set_link_st(wcn, bss_conf->bssid,
  588. vif->addr,
  589. WCN36XX_HAL_LINK_POSTASSOC_STATE);
  590. wcn36xx_smd_config_bss(wcn, vif, sta,
  591. bss_conf->bssid,
  592. true);
  593. sta_priv->aid = bss_conf->aid;
  594. /*
  595. * config_sta must be called from because this is the
  596. * place where AID is available.
  597. */
  598. wcn36xx_smd_config_sta(wcn, vif, sta);
  599. rcu_read_unlock();
  600. } else {
  601. wcn36xx_dbg(WCN36XX_DBG_MAC,
  602. "disassociated bss %pM vif %pM AID=%d\n",
  603. bss_conf->bssid,
  604. vif->addr,
  605. bss_conf->aid);
  606. wcn36xx_smd_set_link_st(wcn,
  607. bss_conf->bssid,
  608. vif->addr,
  609. WCN36XX_HAL_LINK_IDLE_STATE);
  610. }
  611. }
  612. if (changed & BSS_CHANGED_AP_PROBE_RESP) {
  613. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed ap probe resp\n");
  614. skb = ieee80211_proberesp_get(hw, vif);
  615. if (!skb) {
  616. wcn36xx_err("failed to alloc probereq skb\n");
  617. goto out;
  618. }
  619. wcn36xx_smd_update_proberesp_tmpl(wcn, vif, skb);
  620. dev_kfree_skb(skb);
  621. }
  622. if (changed & BSS_CHANGED_BEACON_ENABLED ||
  623. changed & BSS_CHANGED_BEACON) {
  624. wcn36xx_dbg(WCN36XX_DBG_MAC,
  625. "mac bss changed beacon enabled %d\n",
  626. bss_conf->enable_beacon);
  627. if (bss_conf->enable_beacon) {
  628. vif_priv->dtim_period = bss_conf->dtim_period;
  629. vif_priv->bss_index = 0xff;
  630. wcn36xx_smd_config_bss(wcn, vif, NULL,
  631. vif->addr, false);
  632. skb = ieee80211_beacon_get_tim(hw, vif, &tim_off,
  633. &tim_len);
  634. if (!skb) {
  635. wcn36xx_err("failed to alloc beacon skb\n");
  636. goto out;
  637. }
  638. wcn36xx_smd_send_beacon(wcn, vif, skb, tim_off, 0);
  639. dev_kfree_skb(skb);
  640. if (vif->type == NL80211_IFTYPE_ADHOC ||
  641. vif->type == NL80211_IFTYPE_MESH_POINT)
  642. link_state = WCN36XX_HAL_LINK_IBSS_STATE;
  643. else
  644. link_state = WCN36XX_HAL_LINK_AP_STATE;
  645. wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr,
  646. link_state);
  647. } else {
  648. wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr,
  649. WCN36XX_HAL_LINK_IDLE_STATE);
  650. wcn36xx_smd_delete_bss(wcn, vif);
  651. }
  652. }
  653. out:
  654. return;
  655. }
  656. /* this is required when using IEEE80211_HW_HAS_RATE_CONTROL */
  657. static int wcn36xx_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
  658. {
  659. struct wcn36xx *wcn = hw->priv;
  660. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac set RTS threshold %d\n", value);
  661. wcn36xx_smd_update_cfg(wcn, WCN36XX_HAL_CFG_RTS_THRESHOLD, value);
  662. return 0;
  663. }
  664. static void wcn36xx_remove_interface(struct ieee80211_hw *hw,
  665. struct ieee80211_vif *vif)
  666. {
  667. struct wcn36xx *wcn = hw->priv;
  668. struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
  669. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac remove interface vif %p\n", vif);
  670. list_del(&vif_priv->list);
  671. wcn36xx_smd_delete_sta_self(wcn, vif->addr);
  672. }
  673. static int wcn36xx_add_interface(struct ieee80211_hw *hw,
  674. struct ieee80211_vif *vif)
  675. {
  676. struct wcn36xx *wcn = hw->priv;
  677. struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
  678. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac add interface vif %p type %d\n",
  679. vif, vif->type);
  680. if (!(NL80211_IFTYPE_STATION == vif->type ||
  681. NL80211_IFTYPE_AP == vif->type ||
  682. NL80211_IFTYPE_ADHOC == vif->type ||
  683. NL80211_IFTYPE_MESH_POINT == vif->type)) {
  684. wcn36xx_warn("Unsupported interface type requested: %d\n",
  685. vif->type);
  686. return -EOPNOTSUPP;
  687. }
  688. list_add(&vif_priv->list, &wcn->vif_list);
  689. wcn36xx_smd_add_sta_self(wcn, vif);
  690. return 0;
  691. }
  692. static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  693. struct ieee80211_sta *sta)
  694. {
  695. struct wcn36xx *wcn = hw->priv;
  696. struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
  697. struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
  698. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta add vif %p sta %pM\n",
  699. vif, sta->addr);
  700. vif_priv->sta = sta_priv;
  701. sta_priv->vif = vif_priv;
  702. /*
  703. * For STA mode HW will be configured on BSS_CHANGED_ASSOC because
  704. * at this stage AID is not available yet.
  705. */
  706. if (NL80211_IFTYPE_STATION != vif->type) {
  707. wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn));
  708. sta_priv->aid = sta->aid;
  709. wcn36xx_smd_config_sta(wcn, vif, sta);
  710. }
  711. return 0;
  712. }
  713. static int wcn36xx_sta_remove(struct ieee80211_hw *hw,
  714. struct ieee80211_vif *vif,
  715. struct ieee80211_sta *sta)
  716. {
  717. struct wcn36xx *wcn = hw->priv;
  718. struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
  719. struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
  720. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta remove vif %p sta %pM index %d\n",
  721. vif, sta->addr, sta_priv->sta_index);
  722. wcn36xx_smd_delete_sta(wcn, sta_priv->sta_index);
  723. vif_priv->sta = NULL;
  724. sta_priv->vif = NULL;
  725. return 0;
  726. }
  727. #ifdef CONFIG_PM
  728. static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow)
  729. {
  730. struct wcn36xx *wcn = hw->priv;
  731. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n");
  732. flush_workqueue(wcn->hal_ind_wq);
  733. wcn36xx_smd_set_power_params(wcn, true);
  734. return 0;
  735. }
  736. static int wcn36xx_resume(struct ieee80211_hw *hw)
  737. {
  738. struct wcn36xx *wcn = hw->priv;
  739. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac resume\n");
  740. flush_workqueue(wcn->hal_ind_wq);
  741. wcn36xx_smd_set_power_params(wcn, false);
  742. return 0;
  743. }
  744. #endif
  745. static int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
  746. struct ieee80211_vif *vif,
  747. enum ieee80211_ampdu_mlme_action action,
  748. struct ieee80211_sta *sta, u16 tid, u16 *ssn,
  749. u8 buf_size)
  750. {
  751. struct wcn36xx *wcn = hw->priv;
  752. struct wcn36xx_sta *sta_priv = NULL;
  753. wcn36xx_dbg(WCN36XX_DBG_MAC, "mac ampdu action action %d tid %d\n",
  754. action, tid);
  755. sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
  756. switch (action) {
  757. case IEEE80211_AMPDU_RX_START:
  758. sta_priv->tid = tid;
  759. wcn36xx_smd_add_ba_session(wcn, sta, tid, ssn, 0,
  760. get_sta_index(vif, sta_priv));
  761. wcn36xx_smd_add_ba(wcn);
  762. wcn36xx_smd_trigger_ba(wcn, get_sta_index(vif, sta_priv));
  763. ieee80211_start_tx_ba_session(sta, tid, 0);
  764. break;
  765. case IEEE80211_AMPDU_RX_STOP:
  766. wcn36xx_smd_del_ba(wcn, tid, get_sta_index(vif, sta_priv));
  767. break;
  768. case IEEE80211_AMPDU_TX_START:
  769. ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
  770. break;
  771. case IEEE80211_AMPDU_TX_OPERATIONAL:
  772. wcn36xx_smd_add_ba_session(wcn, sta, tid, ssn, 1,
  773. get_sta_index(vif, sta_priv));
  774. break;
  775. case IEEE80211_AMPDU_TX_STOP_FLUSH:
  776. case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
  777. case IEEE80211_AMPDU_TX_STOP_CONT:
  778. ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
  779. break;
  780. default:
  781. wcn36xx_err("Unknown AMPDU action\n");
  782. }
  783. return 0;
  784. }
  785. static const struct ieee80211_ops wcn36xx_ops = {
  786. .start = wcn36xx_start,
  787. .stop = wcn36xx_stop,
  788. .add_interface = wcn36xx_add_interface,
  789. .remove_interface = wcn36xx_remove_interface,
  790. #ifdef CONFIG_PM
  791. .suspend = wcn36xx_suspend,
  792. .resume = wcn36xx_resume,
  793. #endif
  794. .config = wcn36xx_config,
  795. .configure_filter = wcn36xx_configure_filter,
  796. .tx = wcn36xx_tx,
  797. .set_key = wcn36xx_set_key,
  798. .sw_scan_start = wcn36xx_sw_scan_start,
  799. .sw_scan_complete = wcn36xx_sw_scan_complete,
  800. .bss_info_changed = wcn36xx_bss_info_changed,
  801. .set_rts_threshold = wcn36xx_set_rts_threshold,
  802. .sta_add = wcn36xx_sta_add,
  803. .sta_remove = wcn36xx_sta_remove,
  804. .ampdu_action = wcn36xx_ampdu_action,
  805. };
  806. static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
  807. {
  808. int ret = 0;
  809. static const u32 cipher_suites[] = {
  810. WLAN_CIPHER_SUITE_WEP40,
  811. WLAN_CIPHER_SUITE_WEP104,
  812. WLAN_CIPHER_SUITE_TKIP,
  813. WLAN_CIPHER_SUITE_CCMP,
  814. };
  815. wcn->hw->flags = IEEE80211_HW_SIGNAL_DBM |
  816. IEEE80211_HW_HAS_RATE_CONTROL |
  817. IEEE80211_HW_SUPPORTS_PS |
  818. IEEE80211_HW_CONNECTION_MONITOR |
  819. IEEE80211_HW_AMPDU_AGGREGATION |
  820. IEEE80211_HW_TIMING_BEACON_ONLY;
  821. wcn->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  822. BIT(NL80211_IFTYPE_AP) |
  823. BIT(NL80211_IFTYPE_ADHOC) |
  824. BIT(NL80211_IFTYPE_MESH_POINT);
  825. wcn->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wcn_band_2ghz;
  826. wcn->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wcn_band_5ghz;
  827. wcn->hw->wiphy->cipher_suites = cipher_suites;
  828. wcn->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  829. wcn->hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
  830. #ifdef CONFIG_PM
  831. wcn->hw->wiphy->wowlan = &wowlan_support;
  832. #endif
  833. wcn->hw->max_listen_interval = 200;
  834. wcn->hw->queues = 4;
  835. SET_IEEE80211_DEV(wcn->hw, wcn->dev);
  836. wcn->hw->sta_data_size = sizeof(struct wcn36xx_sta);
  837. wcn->hw->vif_data_size = sizeof(struct wcn36xx_vif);
  838. return ret;
  839. }
  840. static int wcn36xx_platform_get_resources(struct wcn36xx *wcn,
  841. struct platform_device *pdev)
  842. {
  843. struct resource *res;
  844. /* Set TX IRQ */
  845. res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
  846. "wcnss_wlantx_irq");
  847. if (!res) {
  848. wcn36xx_err("failed to get tx_irq\n");
  849. return -ENOENT;
  850. }
  851. wcn->tx_irq = res->start;
  852. /* Set RX IRQ */
  853. res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
  854. "wcnss_wlanrx_irq");
  855. if (!res) {
  856. wcn36xx_err("failed to get rx_irq\n");
  857. return -ENOENT;
  858. }
  859. wcn->rx_irq = res->start;
  860. /* Map the memory */
  861. res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
  862. "wcnss_mmio");
  863. if (!res) {
  864. wcn36xx_err("failed to get mmio\n");
  865. return -ENOENT;
  866. }
  867. wcn->mmio = ioremap(res->start, resource_size(res));
  868. if (!wcn->mmio) {
  869. wcn36xx_err("failed to map io memory\n");
  870. return -ENOMEM;
  871. }
  872. return 0;
  873. }
  874. static int wcn36xx_probe(struct platform_device *pdev)
  875. {
  876. struct ieee80211_hw *hw;
  877. struct wcn36xx *wcn;
  878. int ret;
  879. u8 addr[ETH_ALEN];
  880. wcn36xx_dbg(WCN36XX_DBG_MAC, "platform probe\n");
  881. hw = ieee80211_alloc_hw(sizeof(struct wcn36xx), &wcn36xx_ops);
  882. if (!hw) {
  883. wcn36xx_err("failed to alloc hw\n");
  884. ret = -ENOMEM;
  885. goto out_err;
  886. }
  887. platform_set_drvdata(pdev, hw);
  888. wcn = hw->priv;
  889. wcn->hw = hw;
  890. wcn->dev = &pdev->dev;
  891. wcn->ctrl_ops = pdev->dev.platform_data;
  892. mutex_init(&wcn->hal_mutex);
  893. if (!wcn->ctrl_ops->get_hw_mac(addr)) {
  894. wcn36xx_info("mac address: %pM\n", addr);
  895. SET_IEEE80211_PERM_ADDR(wcn->hw, addr);
  896. }
  897. ret = wcn36xx_platform_get_resources(wcn, pdev);
  898. if (ret)
  899. goto out_wq;
  900. wcn36xx_init_ieee80211(wcn);
  901. ret = ieee80211_register_hw(wcn->hw);
  902. if (ret)
  903. goto out_unmap;
  904. return 0;
  905. out_unmap:
  906. iounmap(wcn->mmio);
  907. out_wq:
  908. ieee80211_free_hw(hw);
  909. out_err:
  910. return ret;
  911. }
  912. static int wcn36xx_remove(struct platform_device *pdev)
  913. {
  914. struct ieee80211_hw *hw = platform_get_drvdata(pdev);
  915. struct wcn36xx *wcn = hw->priv;
  916. wcn36xx_dbg(WCN36XX_DBG_MAC, "platform remove\n");
  917. release_firmware(wcn->nv);
  918. mutex_destroy(&wcn->hal_mutex);
  919. ieee80211_unregister_hw(hw);
  920. iounmap(wcn->mmio);
  921. ieee80211_free_hw(hw);
  922. return 0;
  923. }
  924. static const struct platform_device_id wcn36xx_platform_id_table[] = {
  925. {
  926. .name = "wcn36xx",
  927. .driver_data = 0
  928. },
  929. {}
  930. };
  931. MODULE_DEVICE_TABLE(platform, wcn36xx_platform_id_table);
  932. static struct platform_driver wcn36xx_driver = {
  933. .probe = wcn36xx_probe,
  934. .remove = wcn36xx_remove,
  935. .driver = {
  936. .name = "wcn36xx",
  937. },
  938. .id_table = wcn36xx_platform_id_table,
  939. };
  940. static int __init wcn36xx_init(void)
  941. {
  942. platform_driver_register(&wcn36xx_driver);
  943. return 0;
  944. }
  945. module_init(wcn36xx_init);
  946. static void __exit wcn36xx_exit(void)
  947. {
  948. platform_driver_unregister(&wcn36xx_driver);
  949. }
  950. module_exit(wcn36xx_exit);
  951. MODULE_LICENSE("Dual BSD/GPL");
  952. MODULE_AUTHOR("Eugene Krasnikov k.eugene.e@gmail.com");
  953. MODULE_FIRMWARE(WLAN_NV_FILE);