main.c 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463
  1. /*
  2. * This file is part of wl18xx
  3. *
  4. * Copyright (C) 2011 Texas Instruments
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * version 2 as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  18. * 02110-1301 USA
  19. *
  20. */
  21. #include <linux/module.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/ip.h>
  24. #include <linux/firmware.h>
  25. #include "../wlcore/wlcore.h"
  26. #include "../wlcore/debug.h"
  27. #include "../wlcore/io.h"
  28. #include "../wlcore/acx.h"
  29. #include "../wlcore/tx.h"
  30. #include "../wlcore/rx.h"
  31. #include "../wlcore/io.h"
  32. #include "../wlcore/boot.h"
  33. #include "reg.h"
  34. #include "conf.h"
  35. #include "acx.h"
  36. #include "tx.h"
  37. #include "wl18xx.h"
  38. #include "io.h"
  39. #include "debugfs.h"
  40. #define WL18XX_RX_CHECKSUM_MASK 0x40
  41. static char *ht_mode_param = "wide";
  42. static char *board_type_param = "hdk";
  43. static bool checksum_param = false;
  44. static bool enable_11a_param = true;
  45. /* phy paramters */
  46. static int dc2dc_param = -1;
  47. static int n_antennas_2_param = -1;
  48. static int n_antennas_5_param = -1;
  49. static int low_band_component_param = -1;
  50. static int low_band_component_type_param = -1;
  51. static int high_band_component_param = -1;
  52. static int high_band_component_type_param = -1;
  53. static int pwr_limit_reference_11_abg_param = -1;
  54. static const u8 wl18xx_rate_to_idx_2ghz[] = {
  55. /* MCS rates are used only with 11n */
  56. 15, /* WL18XX_CONF_HW_RXTX_RATE_MCS15 */
  57. 14, /* WL18XX_CONF_HW_RXTX_RATE_MCS14 */
  58. 13, /* WL18XX_CONF_HW_RXTX_RATE_MCS13 */
  59. 12, /* WL18XX_CONF_HW_RXTX_RATE_MCS12 */
  60. 11, /* WL18XX_CONF_HW_RXTX_RATE_MCS11 */
  61. 10, /* WL18XX_CONF_HW_RXTX_RATE_MCS10 */
  62. 9, /* WL18XX_CONF_HW_RXTX_RATE_MCS9 */
  63. 8, /* WL18XX_CONF_HW_RXTX_RATE_MCS8 */
  64. 7, /* WL18XX_CONF_HW_RXTX_RATE_MCS7 */
  65. 6, /* WL18XX_CONF_HW_RXTX_RATE_MCS6 */
  66. 5, /* WL18XX_CONF_HW_RXTX_RATE_MCS5 */
  67. 4, /* WL18XX_CONF_HW_RXTX_RATE_MCS4 */
  68. 3, /* WL18XX_CONF_HW_RXTX_RATE_MCS3 */
  69. 2, /* WL18XX_CONF_HW_RXTX_RATE_MCS2 */
  70. 1, /* WL18XX_CONF_HW_RXTX_RATE_MCS1 */
  71. 0, /* WL18XX_CONF_HW_RXTX_RATE_MCS0 */
  72. 11, /* WL18XX_CONF_HW_RXTX_RATE_54 */
  73. 10, /* WL18XX_CONF_HW_RXTX_RATE_48 */
  74. 9, /* WL18XX_CONF_HW_RXTX_RATE_36 */
  75. 8, /* WL18XX_CONF_HW_RXTX_RATE_24 */
  76. /* TI-specific rate */
  77. CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_22 */
  78. 7, /* WL18XX_CONF_HW_RXTX_RATE_18 */
  79. 6, /* WL18XX_CONF_HW_RXTX_RATE_12 */
  80. 3, /* WL18XX_CONF_HW_RXTX_RATE_11 */
  81. 5, /* WL18XX_CONF_HW_RXTX_RATE_9 */
  82. 4, /* WL18XX_CONF_HW_RXTX_RATE_6 */
  83. 2, /* WL18XX_CONF_HW_RXTX_RATE_5_5 */
  84. 1, /* WL18XX_CONF_HW_RXTX_RATE_2 */
  85. 0 /* WL18XX_CONF_HW_RXTX_RATE_1 */
  86. };
  87. static const u8 wl18xx_rate_to_idx_5ghz[] = {
  88. /* MCS rates are used only with 11n */
  89. 15, /* WL18XX_CONF_HW_RXTX_RATE_MCS15 */
  90. 14, /* WL18XX_CONF_HW_RXTX_RATE_MCS14 */
  91. 13, /* WL18XX_CONF_HW_RXTX_RATE_MCS13 */
  92. 12, /* WL18XX_CONF_HW_RXTX_RATE_MCS12 */
  93. 11, /* WL18XX_CONF_HW_RXTX_RATE_MCS11 */
  94. 10, /* WL18XX_CONF_HW_RXTX_RATE_MCS10 */
  95. 9, /* WL18XX_CONF_HW_RXTX_RATE_MCS9 */
  96. 8, /* WL18XX_CONF_HW_RXTX_RATE_MCS8 */
  97. 7, /* WL18XX_CONF_HW_RXTX_RATE_MCS7 */
  98. 6, /* WL18XX_CONF_HW_RXTX_RATE_MCS6 */
  99. 5, /* WL18XX_CONF_HW_RXTX_RATE_MCS5 */
  100. 4, /* WL18XX_CONF_HW_RXTX_RATE_MCS4 */
  101. 3, /* WL18XX_CONF_HW_RXTX_RATE_MCS3 */
  102. 2, /* WL18XX_CONF_HW_RXTX_RATE_MCS2 */
  103. 1, /* WL18XX_CONF_HW_RXTX_RATE_MCS1 */
  104. 0, /* WL18XX_CONF_HW_RXTX_RATE_MCS0 */
  105. 7, /* WL18XX_CONF_HW_RXTX_RATE_54 */
  106. 6, /* WL18XX_CONF_HW_RXTX_RATE_48 */
  107. 5, /* WL18XX_CONF_HW_RXTX_RATE_36 */
  108. 4, /* WL18XX_CONF_HW_RXTX_RATE_24 */
  109. /* TI-specific rate */
  110. CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_22 */
  111. 3, /* WL18XX_CONF_HW_RXTX_RATE_18 */
  112. 2, /* WL18XX_CONF_HW_RXTX_RATE_12 */
  113. CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_11 */
  114. 1, /* WL18XX_CONF_HW_RXTX_RATE_9 */
  115. 0, /* WL18XX_CONF_HW_RXTX_RATE_6 */
  116. CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_5_5 */
  117. CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_2 */
  118. CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_1 */
  119. };
  120. static const u8 *wl18xx_band_rate_to_idx[] = {
  121. [IEEE80211_BAND_2GHZ] = wl18xx_rate_to_idx_2ghz,
  122. [IEEE80211_BAND_5GHZ] = wl18xx_rate_to_idx_5ghz
  123. };
  124. enum wl18xx_hw_rates {
  125. WL18XX_CONF_HW_RXTX_RATE_MCS15 = 0,
  126. WL18XX_CONF_HW_RXTX_RATE_MCS14,
  127. WL18XX_CONF_HW_RXTX_RATE_MCS13,
  128. WL18XX_CONF_HW_RXTX_RATE_MCS12,
  129. WL18XX_CONF_HW_RXTX_RATE_MCS11,
  130. WL18XX_CONF_HW_RXTX_RATE_MCS10,
  131. WL18XX_CONF_HW_RXTX_RATE_MCS9,
  132. WL18XX_CONF_HW_RXTX_RATE_MCS8,
  133. WL18XX_CONF_HW_RXTX_RATE_MCS7,
  134. WL18XX_CONF_HW_RXTX_RATE_MCS6,
  135. WL18XX_CONF_HW_RXTX_RATE_MCS5,
  136. WL18XX_CONF_HW_RXTX_RATE_MCS4,
  137. WL18XX_CONF_HW_RXTX_RATE_MCS3,
  138. WL18XX_CONF_HW_RXTX_RATE_MCS2,
  139. WL18XX_CONF_HW_RXTX_RATE_MCS1,
  140. WL18XX_CONF_HW_RXTX_RATE_MCS0,
  141. WL18XX_CONF_HW_RXTX_RATE_54,
  142. WL18XX_CONF_HW_RXTX_RATE_48,
  143. WL18XX_CONF_HW_RXTX_RATE_36,
  144. WL18XX_CONF_HW_RXTX_RATE_24,
  145. WL18XX_CONF_HW_RXTX_RATE_22,
  146. WL18XX_CONF_HW_RXTX_RATE_18,
  147. WL18XX_CONF_HW_RXTX_RATE_12,
  148. WL18XX_CONF_HW_RXTX_RATE_11,
  149. WL18XX_CONF_HW_RXTX_RATE_9,
  150. WL18XX_CONF_HW_RXTX_RATE_6,
  151. WL18XX_CONF_HW_RXTX_RATE_5_5,
  152. WL18XX_CONF_HW_RXTX_RATE_2,
  153. WL18XX_CONF_HW_RXTX_RATE_1,
  154. WL18XX_CONF_HW_RXTX_RATE_MAX,
  155. };
  156. static struct wlcore_conf wl18xx_conf = {
  157. .sg = {
  158. .params = {
  159. [CONF_SG_ACL_BT_MASTER_MIN_BR] = 10,
  160. [CONF_SG_ACL_BT_MASTER_MAX_BR] = 180,
  161. [CONF_SG_ACL_BT_SLAVE_MIN_BR] = 10,
  162. [CONF_SG_ACL_BT_SLAVE_MAX_BR] = 180,
  163. [CONF_SG_ACL_BT_MASTER_MIN_EDR] = 10,
  164. [CONF_SG_ACL_BT_MASTER_MAX_EDR] = 80,
  165. [CONF_SG_ACL_BT_SLAVE_MIN_EDR] = 10,
  166. [CONF_SG_ACL_BT_SLAVE_MAX_EDR] = 80,
  167. [CONF_SG_ACL_WLAN_PS_MASTER_BR] = 8,
  168. [CONF_SG_ACL_WLAN_PS_SLAVE_BR] = 8,
  169. [CONF_SG_ACL_WLAN_PS_MASTER_EDR] = 20,
  170. [CONF_SG_ACL_WLAN_PS_SLAVE_EDR] = 20,
  171. [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_BR] = 20,
  172. [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_BR] = 35,
  173. [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_BR] = 16,
  174. [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_BR] = 35,
  175. [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_EDR] = 32,
  176. [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_EDR] = 50,
  177. [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_EDR] = 28,
  178. [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_EDR] = 50,
  179. [CONF_SG_ACL_ACTIVE_SCAN_WLAN_BR] = 10,
  180. [CONF_SG_ACL_ACTIVE_SCAN_WLAN_EDR] = 20,
  181. [CONF_SG_ACL_PASSIVE_SCAN_BT_BR] = 75,
  182. [CONF_SG_ACL_PASSIVE_SCAN_WLAN_BR] = 15,
  183. [CONF_SG_ACL_PASSIVE_SCAN_BT_EDR] = 27,
  184. [CONF_SG_ACL_PASSIVE_SCAN_WLAN_EDR] = 17,
  185. /* active scan params */
  186. [CONF_SG_AUTO_SCAN_PROBE_REQ] = 170,
  187. [CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_HV3] = 50,
  188. [CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_A2DP] = 100,
  189. /* passive scan params */
  190. [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_BR] = 800,
  191. [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_EDR] = 200,
  192. [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_HV3] = 200,
  193. /* passive scan in dual antenna params */
  194. [CONF_SG_CONSECUTIVE_HV3_IN_PASSIVE_SCAN] = 0,
  195. [CONF_SG_BCN_HV3_COLLISION_THRESH_IN_PASSIVE_SCAN] = 0,
  196. [CONF_SG_TX_RX_PROTECTION_BWIDTH_IN_PASSIVE_SCAN] = 0,
  197. /* general params */
  198. [CONF_SG_STA_FORCE_PS_IN_BT_SCO] = 1,
  199. [CONF_SG_ANTENNA_CONFIGURATION] = 0,
  200. [CONF_SG_BEACON_MISS_PERCENT] = 60,
  201. [CONF_SG_DHCP_TIME] = 5000,
  202. [CONF_SG_RXT] = 1200,
  203. [CONF_SG_TXT] = 1000,
  204. [CONF_SG_ADAPTIVE_RXT_TXT] = 1,
  205. [CONF_SG_GENERAL_USAGE_BIT_MAP] = 3,
  206. [CONF_SG_HV3_MAX_SERVED] = 6,
  207. [CONF_SG_PS_POLL_TIMEOUT] = 10,
  208. [CONF_SG_UPSD_TIMEOUT] = 10,
  209. [CONF_SG_CONSECUTIVE_CTS_THRESHOLD] = 2,
  210. [CONF_SG_STA_RX_WINDOW_AFTER_DTIM] = 5,
  211. [CONF_SG_STA_CONNECTION_PROTECTION_TIME] = 30,
  212. /* AP params */
  213. [CONF_AP_BEACON_MISS_TX] = 3,
  214. [CONF_AP_RX_WINDOW_AFTER_BEACON] = 10,
  215. [CONF_AP_BEACON_WINDOW_INTERVAL] = 2,
  216. [CONF_AP_CONNECTION_PROTECTION_TIME] = 0,
  217. [CONF_AP_BT_ACL_VAL_BT_SERVE_TIME] = 25,
  218. [CONF_AP_BT_ACL_VAL_WL_SERVE_TIME] = 25,
  219. /* CTS Diluting params */
  220. [CONF_SG_CTS_DILUTED_BAD_RX_PACKETS_TH] = 0,
  221. [CONF_SG_CTS_CHOP_IN_DUAL_ANT_SCO_MASTER] = 0,
  222. },
  223. .state = CONF_SG_PROTECTIVE,
  224. },
  225. .rx = {
  226. .rx_msdu_life_time = 512000,
  227. .packet_detection_threshold = 0,
  228. .ps_poll_timeout = 15,
  229. .upsd_timeout = 15,
  230. .rts_threshold = IEEE80211_MAX_RTS_THRESHOLD,
  231. .rx_cca_threshold = 0,
  232. .irq_blk_threshold = 0xFFFF,
  233. .irq_pkt_threshold = 0,
  234. .irq_timeout = 600,
  235. .queue_type = CONF_RX_QUEUE_TYPE_LOW_PRIORITY,
  236. },
  237. .tx = {
  238. .tx_energy_detection = 0,
  239. .sta_rc_conf = {
  240. .enabled_rates = 0,
  241. .short_retry_limit = 10,
  242. .long_retry_limit = 10,
  243. .aflags = 0,
  244. },
  245. .ac_conf_count = 4,
  246. .ac_conf = {
  247. [CONF_TX_AC_BE] = {
  248. .ac = CONF_TX_AC_BE,
  249. .cw_min = 15,
  250. .cw_max = 63,
  251. .aifsn = 3,
  252. .tx_op_limit = 0,
  253. },
  254. [CONF_TX_AC_BK] = {
  255. .ac = CONF_TX_AC_BK,
  256. .cw_min = 15,
  257. .cw_max = 63,
  258. .aifsn = 7,
  259. .tx_op_limit = 0,
  260. },
  261. [CONF_TX_AC_VI] = {
  262. .ac = CONF_TX_AC_VI,
  263. .cw_min = 15,
  264. .cw_max = 63,
  265. .aifsn = CONF_TX_AIFS_PIFS,
  266. .tx_op_limit = 3008,
  267. },
  268. [CONF_TX_AC_VO] = {
  269. .ac = CONF_TX_AC_VO,
  270. .cw_min = 15,
  271. .cw_max = 63,
  272. .aifsn = CONF_TX_AIFS_PIFS,
  273. .tx_op_limit = 1504,
  274. },
  275. },
  276. .max_tx_retries = 100,
  277. .ap_aging_period = 300,
  278. .tid_conf_count = 4,
  279. .tid_conf = {
  280. [CONF_TX_AC_BE] = {
  281. .queue_id = CONF_TX_AC_BE,
  282. .channel_type = CONF_CHANNEL_TYPE_EDCF,
  283. .tsid = CONF_TX_AC_BE,
  284. .ps_scheme = CONF_PS_SCHEME_LEGACY,
  285. .ack_policy = CONF_ACK_POLICY_LEGACY,
  286. .apsd_conf = {0, 0},
  287. },
  288. [CONF_TX_AC_BK] = {
  289. .queue_id = CONF_TX_AC_BK,
  290. .channel_type = CONF_CHANNEL_TYPE_EDCF,
  291. .tsid = CONF_TX_AC_BK,
  292. .ps_scheme = CONF_PS_SCHEME_LEGACY,
  293. .ack_policy = CONF_ACK_POLICY_LEGACY,
  294. .apsd_conf = {0, 0},
  295. },
  296. [CONF_TX_AC_VI] = {
  297. .queue_id = CONF_TX_AC_VI,
  298. .channel_type = CONF_CHANNEL_TYPE_EDCF,
  299. .tsid = CONF_TX_AC_VI,
  300. .ps_scheme = CONF_PS_SCHEME_LEGACY,
  301. .ack_policy = CONF_ACK_POLICY_LEGACY,
  302. .apsd_conf = {0, 0},
  303. },
  304. [CONF_TX_AC_VO] = {
  305. .queue_id = CONF_TX_AC_VO,
  306. .channel_type = CONF_CHANNEL_TYPE_EDCF,
  307. .tsid = CONF_TX_AC_VO,
  308. .ps_scheme = CONF_PS_SCHEME_LEGACY,
  309. .ack_policy = CONF_ACK_POLICY_LEGACY,
  310. .apsd_conf = {0, 0},
  311. },
  312. },
  313. .frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD,
  314. .tx_compl_timeout = 350,
  315. .tx_compl_threshold = 10,
  316. .basic_rate = CONF_HW_BIT_RATE_1MBPS,
  317. .basic_rate_5 = CONF_HW_BIT_RATE_6MBPS,
  318. .tmpl_short_retry_limit = 10,
  319. .tmpl_long_retry_limit = 10,
  320. .tx_watchdog_timeout = 5000,
  321. },
  322. .conn = {
  323. .wake_up_event = CONF_WAKE_UP_EVENT_DTIM,
  324. .listen_interval = 1,
  325. .suspend_wake_up_event = CONF_WAKE_UP_EVENT_N_DTIM,
  326. .suspend_listen_interval = 3,
  327. .bcn_filt_mode = CONF_BCN_FILT_MODE_ENABLED,
  328. .bcn_filt_ie_count = 3,
  329. .bcn_filt_ie = {
  330. [0] = {
  331. .ie = WLAN_EID_CHANNEL_SWITCH,
  332. .rule = CONF_BCN_RULE_PASS_ON_APPEARANCE,
  333. },
  334. [1] = {
  335. .ie = WLAN_EID_HT_OPERATION,
  336. .rule = CONF_BCN_RULE_PASS_ON_CHANGE,
  337. },
  338. [2] = {
  339. .ie = WLAN_EID_ERP_INFO,
  340. .rule = CONF_BCN_RULE_PASS_ON_CHANGE,
  341. },
  342. },
  343. .synch_fail_thold = 12,
  344. .bss_lose_timeout = 400,
  345. .beacon_rx_timeout = 10000,
  346. .broadcast_timeout = 20000,
  347. .rx_broadcast_in_ps = 1,
  348. .ps_poll_threshold = 10,
  349. .bet_enable = CONF_BET_MODE_ENABLE,
  350. .bet_max_consecutive = 50,
  351. .psm_entry_retries = 8,
  352. .psm_exit_retries = 16,
  353. .psm_entry_nullfunc_retries = 3,
  354. .dynamic_ps_timeout = 200,
  355. .forced_ps = false,
  356. .keep_alive_interval = 55000,
  357. .max_listen_interval = 20,
  358. .sta_sleep_auth = WL1271_PSM_ILLEGAL,
  359. },
  360. .itrim = {
  361. .enable = false,
  362. .timeout = 50000,
  363. },
  364. .pm_config = {
  365. .host_clk_settling_time = 5000,
  366. .host_fast_wakeup_support = CONF_FAST_WAKEUP_DISABLE,
  367. },
  368. .roam_trigger = {
  369. .trigger_pacing = 1,
  370. .avg_weight_rssi_beacon = 20,
  371. .avg_weight_rssi_data = 10,
  372. .avg_weight_snr_beacon = 20,
  373. .avg_weight_snr_data = 10,
  374. },
  375. .scan = {
  376. .min_dwell_time_active = 7500,
  377. .max_dwell_time_active = 30000,
  378. .min_dwell_time_passive = 100000,
  379. .max_dwell_time_passive = 100000,
  380. .num_probe_reqs = 2,
  381. .split_scan_timeout = 50000,
  382. },
  383. .sched_scan = {
  384. /*
  385. * Values are in TU/1000 but since sched scan FW command
  386. * params are in TUs rounding up may occur.
  387. */
  388. .base_dwell_time = 7500,
  389. .max_dwell_time_delta = 22500,
  390. /* based on 250bits per probe @1Mbps */
  391. .dwell_time_delta_per_probe = 2000,
  392. /* based on 250bits per probe @6Mbps (plus a bit more) */
  393. .dwell_time_delta_per_probe_5 = 350,
  394. .dwell_time_passive = 100000,
  395. .dwell_time_dfs = 150000,
  396. .num_probe_reqs = 2,
  397. .rssi_threshold = -90,
  398. .snr_threshold = 0,
  399. },
  400. .ht = {
  401. .rx_ba_win_size = 10,
  402. .tx_ba_win_size = 64,
  403. .inactivity_timeout = 10000,
  404. .tx_ba_tid_bitmap = CONF_TX_BA_ENABLED_TID_BITMAP,
  405. },
  406. .mem = {
  407. .num_stations = 1,
  408. .ssid_profiles = 1,
  409. .rx_block_num = 40,
  410. .tx_min_block_num = 40,
  411. .dynamic_memory = 1,
  412. .min_req_tx_blocks = 45,
  413. .min_req_rx_blocks = 22,
  414. .tx_min = 27,
  415. },
  416. .fm_coex = {
  417. .enable = true,
  418. .swallow_period = 5,
  419. .n_divider_fref_set_1 = 0xff, /* default */
  420. .n_divider_fref_set_2 = 12,
  421. .m_divider_fref_set_1 = 0xffff,
  422. .m_divider_fref_set_2 = 148, /* default */
  423. .coex_pll_stabilization_time = 0xffffffff, /* default */
  424. .ldo_stabilization_time = 0xffff, /* default */
  425. .fm_disturbed_band_margin = 0xff, /* default */
  426. .swallow_clk_diff = 0xff, /* default */
  427. },
  428. .rx_streaming = {
  429. .duration = 150,
  430. .queues = 0x1,
  431. .interval = 20,
  432. .always = 0,
  433. },
  434. .fwlog = {
  435. .mode = WL12XX_FWLOG_ON_DEMAND,
  436. .mem_blocks = 2,
  437. .severity = 0,
  438. .timestamp = WL12XX_FWLOG_TIMESTAMP_DISABLED,
  439. .output = WL12XX_FWLOG_OUTPUT_HOST,
  440. .threshold = 0,
  441. },
  442. .rate = {
  443. .rate_retry_score = 32000,
  444. .per_add = 8192,
  445. .per_th1 = 2048,
  446. .per_th2 = 4096,
  447. .max_per = 8100,
  448. .inverse_curiosity_factor = 5,
  449. .tx_fail_low_th = 4,
  450. .tx_fail_high_th = 10,
  451. .per_alpha_shift = 4,
  452. .per_add_shift = 13,
  453. .per_beta1_shift = 10,
  454. .per_beta2_shift = 8,
  455. .rate_check_up = 2,
  456. .rate_check_down = 12,
  457. .rate_retry_policy = {
  458. 0x00, 0x00, 0x00, 0x00, 0x00,
  459. 0x00, 0x00, 0x00, 0x00, 0x00,
  460. 0x00, 0x00, 0x00,
  461. },
  462. },
  463. .hangover = {
  464. .recover_time = 0,
  465. .hangover_period = 20,
  466. .dynamic_mode = 1,
  467. .early_termination_mode = 1,
  468. .max_period = 20,
  469. .min_period = 1,
  470. .increase_delta = 1,
  471. .decrease_delta = 2,
  472. .quiet_time = 4,
  473. .increase_time = 1,
  474. .window_size = 16,
  475. },
  476. };
  477. static struct wl18xx_priv_conf wl18xx_default_priv_conf = {
  478. .phy = {
  479. .phy_standalone = 0x00,
  480. .primary_clock_setting_time = 0x05,
  481. .clock_valid_on_wake_up = 0x00,
  482. .secondary_clock_setting_time = 0x05,
  483. .rdl = 0x01,
  484. .auto_detect = 0x00,
  485. .dedicated_fem = FEM_NONE,
  486. .low_band_component = COMPONENT_2_WAY_SWITCH,
  487. .low_band_component_type = 0x05,
  488. .high_band_component = COMPONENT_2_WAY_SWITCH,
  489. .high_band_component_type = 0x09,
  490. .tcxo_ldo_voltage = 0x00,
  491. .xtal_itrim_val = 0x04,
  492. .srf_state = 0x00,
  493. .io_configuration = 0x01,
  494. .sdio_configuration = 0x00,
  495. .settings = 0x00,
  496. .enable_clpc = 0x00,
  497. .enable_tx_low_pwr_on_siso_rdl = 0x00,
  498. .rx_profile = 0x00,
  499. .pwr_limit_reference_11_abg = 0xc8,
  500. .psat = 0,
  501. .low_power_val = 0x00,
  502. .med_power_val = 0x0a,
  503. .high_power_val = 0x1e,
  504. .external_pa_dc2dc = 0,
  505. .number_of_assembled_ant2_4 = 1,
  506. .number_of_assembled_ant5 = 1,
  507. },
  508. };
  509. static const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = {
  510. [PART_TOP_PRCM_ELP_SOC] = {
  511. .mem = { .start = 0x00A02000, .size = 0x00010000 },
  512. .reg = { .start = 0x00807000, .size = 0x00005000 },
  513. .mem2 = { .start = 0x00800000, .size = 0x0000B000 },
  514. .mem3 = { .start = 0x00000000, .size = 0x00000000 },
  515. },
  516. [PART_DOWN] = {
  517. .mem = { .start = 0x00000000, .size = 0x00014000 },
  518. .reg = { .start = 0x00810000, .size = 0x0000BFFF },
  519. .mem2 = { .start = 0x00000000, .size = 0x00000000 },
  520. .mem3 = { .start = 0x00000000, .size = 0x00000000 },
  521. },
  522. [PART_BOOT] = {
  523. .mem = { .start = 0x00700000, .size = 0x0000030c },
  524. .reg = { .start = 0x00802000, .size = 0x00014578 },
  525. .mem2 = { .start = 0x00B00404, .size = 0x00001000 },
  526. .mem3 = { .start = 0x00C00000, .size = 0x00000400 },
  527. },
  528. [PART_WORK] = {
  529. .mem = { .start = 0x00800000, .size = 0x000050FC },
  530. .reg = { .start = 0x00B00404, .size = 0x00001000 },
  531. .mem2 = { .start = 0x00C00000, .size = 0x00000400 },
  532. .mem3 = { .start = 0x00000000, .size = 0x00000000 },
  533. },
  534. [PART_PHY_INIT] = {
  535. .mem = { .start = 0x80926000,
  536. .size = sizeof(struct wl18xx_mac_and_phy_params) },
  537. .reg = { .start = 0x00000000, .size = 0x00000000 },
  538. .mem2 = { .start = 0x00000000, .size = 0x00000000 },
  539. .mem3 = { .start = 0x00000000, .size = 0x00000000 },
  540. },
  541. };
  542. static const int wl18xx_rtable[REG_TABLE_LEN] = {
  543. [REG_ECPU_CONTROL] = WL18XX_REG_ECPU_CONTROL,
  544. [REG_INTERRUPT_NO_CLEAR] = WL18XX_REG_INTERRUPT_NO_CLEAR,
  545. [REG_INTERRUPT_ACK] = WL18XX_REG_INTERRUPT_ACK,
  546. [REG_COMMAND_MAILBOX_PTR] = WL18XX_REG_COMMAND_MAILBOX_PTR,
  547. [REG_EVENT_MAILBOX_PTR] = WL18XX_REG_EVENT_MAILBOX_PTR,
  548. [REG_INTERRUPT_TRIG] = WL18XX_REG_INTERRUPT_TRIG_H,
  549. [REG_INTERRUPT_MASK] = WL18XX_REG_INTERRUPT_MASK,
  550. [REG_PC_ON_RECOVERY] = WL18XX_SCR_PAD4,
  551. [REG_CHIP_ID_B] = WL18XX_REG_CHIP_ID_B,
  552. [REG_CMD_MBOX_ADDRESS] = WL18XX_CMD_MBOX_ADDRESS,
  553. /* data access memory addresses, used with partition translation */
  554. [REG_SLV_MEM_DATA] = WL18XX_SLV_MEM_DATA,
  555. [REG_SLV_REG_DATA] = WL18XX_SLV_REG_DATA,
  556. /* raw data access memory addresses */
  557. [REG_RAW_FW_STATUS_ADDR] = WL18XX_FW_STATUS_ADDR,
  558. };
  559. static const struct wl18xx_clk_cfg wl18xx_clk_table[NUM_CLOCK_CONFIGS] = {
  560. [CLOCK_CONFIG_16_2_M] = { 7, 104, 801, 4, true },
  561. [CLOCK_CONFIG_16_368_M] = { 9, 132, 3751, 4, true },
  562. [CLOCK_CONFIG_16_8_M] = { 7, 100, 0, 0, false },
  563. [CLOCK_CONFIG_19_2_M] = { 8, 100, 0, 0, false },
  564. [CLOCK_CONFIG_26_M] = { 13, 120, 0, 0, false },
  565. [CLOCK_CONFIG_32_736_M] = { 9, 132, 3751, 4, true },
  566. [CLOCK_CONFIG_33_6_M] = { 7, 100, 0, 0, false },
  567. [CLOCK_CONFIG_38_468_M] = { 8, 100, 0, 0, false },
  568. [CLOCK_CONFIG_52_M] = { 13, 120, 0, 0, false },
  569. };
  570. /* TODO: maybe move to a new header file? */
  571. #define WL18XX_FW_NAME "ti-connectivity/wl18xx-fw.bin"
  572. static int wl18xx_identify_chip(struct wl1271 *wl)
  573. {
  574. int ret = 0;
  575. switch (wl->chip.id) {
  576. case CHIP_ID_185x_PG20:
  577. wl1271_debug(DEBUG_BOOT, "chip id 0x%x (185x PG20)",
  578. wl->chip.id);
  579. wl->sr_fw_name = WL18XX_FW_NAME;
  580. /* wl18xx uses the same firmware for PLT */
  581. wl->plt_fw_name = WL18XX_FW_NAME;
  582. wl->quirks |= WLCORE_QUIRK_NO_ELP |
  583. WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN |
  584. WLCORE_QUIRK_TX_PAD_LAST_FRAME;
  585. break;
  586. case CHIP_ID_185x_PG10:
  587. wl1271_debug(DEBUG_BOOT, "chip id 0x%x (185x PG10)",
  588. wl->chip.id);
  589. wl->sr_fw_name = WL18XX_FW_NAME;
  590. /* wl18xx uses the same firmware for PLT */
  591. wl->plt_fw_name = WL18XX_FW_NAME;
  592. wl->quirks |= WLCORE_QUIRK_NO_ELP |
  593. WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED |
  594. WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN |
  595. WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN;
  596. /* PG 1.0 has some problems with MCS_13, so disable it */
  597. wl->ht_cap[IEEE80211_BAND_2GHZ].mcs.rx_mask[1] &= ~BIT(5);
  598. break;
  599. default:
  600. wl1271_warning("unsupported chip id: 0x%x", wl->chip.id);
  601. ret = -ENODEV;
  602. goto out;
  603. }
  604. out:
  605. return ret;
  606. }
  607. static void wl18xx_set_clk(struct wl1271 *wl)
  608. {
  609. u32 clk_freq;
  610. wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]);
  611. /* TODO: PG2: apparently we need to read the clk type */
  612. clk_freq = wl18xx_top_reg_read(wl, PRIMARY_CLK_DETECT);
  613. wl1271_debug(DEBUG_BOOT, "clock freq %d (%d, %d, %d, %d, %s)", clk_freq,
  614. wl18xx_clk_table[clk_freq].n, wl18xx_clk_table[clk_freq].m,
  615. wl18xx_clk_table[clk_freq].p, wl18xx_clk_table[clk_freq].q,
  616. wl18xx_clk_table[clk_freq].swallow ? "swallow" : "spit");
  617. wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_N, wl18xx_clk_table[clk_freq].n);
  618. wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_M, wl18xx_clk_table[clk_freq].m);
  619. if (wl18xx_clk_table[clk_freq].swallow) {
  620. /* first the 16 lower bits */
  621. wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_1,
  622. wl18xx_clk_table[clk_freq].q &
  623. PLLSH_WCS_PLL_Q_FACTOR_CFG_1_MASK);
  624. /* then the 16 higher bits, masked out */
  625. wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_2,
  626. (wl18xx_clk_table[clk_freq].q >> 16) &
  627. PLLSH_WCS_PLL_Q_FACTOR_CFG_2_MASK);
  628. /* first the 16 lower bits */
  629. wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_1,
  630. wl18xx_clk_table[clk_freq].p &
  631. PLLSH_WCS_PLL_P_FACTOR_CFG_1_MASK);
  632. /* then the 16 higher bits, masked out */
  633. wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_2,
  634. (wl18xx_clk_table[clk_freq].p >> 16) &
  635. PLLSH_WCS_PLL_P_FACTOR_CFG_2_MASK);
  636. } else {
  637. wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_SWALLOW_EN,
  638. PLLSH_WCS_PLL_SWALLOW_EN_VAL2);
  639. }
  640. }
  641. static void wl18xx_boot_soft_reset(struct wl1271 *wl)
  642. {
  643. /* disable Rx/Tx */
  644. wl1271_write32(wl, WL18XX_ENABLE, 0x0);
  645. /* disable auto calibration on start*/
  646. wl1271_write32(wl, WL18XX_SPARE_A2, 0xffff);
  647. }
  648. static int wl18xx_pre_boot(struct wl1271 *wl)
  649. {
  650. wl18xx_set_clk(wl);
  651. /* Continue the ELP wake up sequence */
  652. wl1271_write32(wl, WL18XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL);
  653. udelay(500);
  654. wlcore_set_partition(wl, &wl->ptable[PART_BOOT]);
  655. /* Disable interrupts */
  656. wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL);
  657. wl18xx_boot_soft_reset(wl);
  658. return 0;
  659. }
  660. static void wl18xx_pre_upload(struct wl1271 *wl)
  661. {
  662. u32 tmp;
  663. wlcore_set_partition(wl, &wl->ptable[PART_BOOT]);
  664. /* TODO: check if this is all needed */
  665. wl1271_write32(wl, WL18XX_EEPROMLESS_IND, WL18XX_EEPROMLESS_IND);
  666. tmp = wlcore_read_reg(wl, REG_CHIP_ID_B);
  667. wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp);
  668. tmp = wl1271_read32(wl, WL18XX_SCR_PAD2);
  669. }
  670. static void wl18xx_set_mac_and_phy(struct wl1271 *wl)
  671. {
  672. struct wl18xx_priv *priv = wl->priv;
  673. size_t len;
  674. /* the parameters struct is smaller for PG1 */
  675. if (wl->chip.id == CHIP_ID_185x_PG10)
  676. len = offsetof(struct wl18xx_mac_and_phy_params, psat) + 1;
  677. else
  678. len = sizeof(struct wl18xx_mac_and_phy_params);
  679. wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]);
  680. wl1271_write(wl, WL18XX_PHY_INIT_MEM_ADDR, (u8 *)&priv->conf.phy, len,
  681. false);
  682. }
  683. static void wl18xx_enable_interrupts(struct wl1271 *wl)
  684. {
  685. u32 event_mask, intr_mask;
  686. if (wl->chip.id == CHIP_ID_185x_PG10) {
  687. event_mask = WL18XX_ACX_EVENTS_VECTOR_PG1;
  688. intr_mask = WL18XX_INTR_MASK_PG1;
  689. } else {
  690. event_mask = WL18XX_ACX_EVENTS_VECTOR_PG2;
  691. intr_mask = WL18XX_INTR_MASK_PG2;
  692. }
  693. wlcore_write_reg(wl, REG_INTERRUPT_MASK, event_mask);
  694. wlcore_enable_interrupts(wl);
  695. wlcore_write_reg(wl, REG_INTERRUPT_MASK,
  696. WL1271_ACX_INTR_ALL & ~intr_mask);
  697. }
  698. static int wl18xx_boot(struct wl1271 *wl)
  699. {
  700. int ret;
  701. ret = wl18xx_pre_boot(wl);
  702. if (ret < 0)
  703. goto out;
  704. wl18xx_pre_upload(wl);
  705. ret = wlcore_boot_upload_firmware(wl);
  706. if (ret < 0)
  707. goto out;
  708. wl18xx_set_mac_and_phy(wl);
  709. ret = wlcore_boot_run_firmware(wl);
  710. if (ret < 0)
  711. goto out;
  712. wl18xx_enable_interrupts(wl);
  713. out:
  714. return ret;
  715. }
  716. static void wl18xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr,
  717. void *buf, size_t len)
  718. {
  719. struct wl18xx_priv *priv = wl->priv;
  720. memcpy(priv->cmd_buf, buf, len);
  721. memset(priv->cmd_buf + len, 0, WL18XX_CMD_MAX_SIZE - len);
  722. wl1271_write(wl, cmd_box_addr, priv->cmd_buf, WL18XX_CMD_MAX_SIZE,
  723. false);
  724. }
  725. static void wl18xx_ack_event(struct wl1271 *wl)
  726. {
  727. wlcore_write_reg(wl, REG_INTERRUPT_TRIG, WL18XX_INTR_TRIG_EVENT_ACK);
  728. }
  729. static u32 wl18xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks)
  730. {
  731. u32 blk_size = WL18XX_TX_HW_BLOCK_SIZE;
  732. return (len + blk_size - 1) / blk_size + spare_blks;
  733. }
  734. static void
  735. wl18xx_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc,
  736. u32 blks, u32 spare_blks)
  737. {
  738. desc->wl18xx_mem.total_mem_blocks = blks;
  739. }
  740. static void
  741. wl18xx_set_tx_desc_data_len(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc,
  742. struct sk_buff *skb)
  743. {
  744. desc->length = cpu_to_le16(skb->len);
  745. /* if only the last frame is to be padded, we unset this bit on Tx */
  746. if (wl->quirks & WLCORE_QUIRK_TX_PAD_LAST_FRAME)
  747. desc->wl18xx_mem.ctrl = WL18XX_TX_CTRL_NOT_PADDED;
  748. else
  749. desc->wl18xx_mem.ctrl = 0;
  750. wl1271_debug(DEBUG_TX, "tx_fill_hdr: hlid: %d "
  751. "len: %d life: %d mem: %d", desc->hlid,
  752. le16_to_cpu(desc->length),
  753. le16_to_cpu(desc->life_time),
  754. desc->wl18xx_mem.total_mem_blocks);
  755. }
  756. static enum wl_rx_buf_align
  757. wl18xx_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc)
  758. {
  759. if (rx_desc & RX_BUF_PADDED_PAYLOAD)
  760. return WLCORE_RX_BUF_PADDED;
  761. return WLCORE_RX_BUF_ALIGNED;
  762. }
  763. static u32 wl18xx_get_rx_packet_len(struct wl1271 *wl, void *rx_data,
  764. u32 data_len)
  765. {
  766. struct wl1271_rx_descriptor *desc = rx_data;
  767. /* invalid packet */
  768. if (data_len < sizeof(*desc))
  769. return 0;
  770. return data_len - sizeof(*desc);
  771. }
  772. static void wl18xx_tx_immediate_completion(struct wl1271 *wl)
  773. {
  774. wl18xx_tx_immediate_complete(wl);
  775. }
  776. static int wl18xx_set_host_cfg_bitmap(struct wl1271 *wl, u32 extra_mem_blk)
  777. {
  778. int ret;
  779. u32 sdio_align_size = 0;
  780. u32 host_cfg_bitmap = HOST_IF_CFG_RX_FIFO_ENABLE |
  781. HOST_IF_CFG_ADD_RX_ALIGNMENT;
  782. /* Enable Tx SDIO padding */
  783. if (wl->quirks & WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN) {
  784. host_cfg_bitmap |= HOST_IF_CFG_TX_PAD_TO_SDIO_BLK;
  785. sdio_align_size = WL12XX_BUS_BLOCK_SIZE;
  786. }
  787. /* Enable Rx SDIO padding */
  788. if (wl->quirks & WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN) {
  789. host_cfg_bitmap |= HOST_IF_CFG_RX_PAD_TO_SDIO_BLK;
  790. sdio_align_size = WL12XX_BUS_BLOCK_SIZE;
  791. }
  792. ret = wl18xx_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap,
  793. sdio_align_size, extra_mem_blk,
  794. WL18XX_HOST_IF_LEN_SIZE_FIELD);
  795. if (ret < 0)
  796. return ret;
  797. return 0;
  798. }
  799. static int wl18xx_hw_init(struct wl1271 *wl)
  800. {
  801. int ret;
  802. struct wl18xx_priv *priv = wl->priv;
  803. /* (re)init private structures. Relevant on recovery as well. */
  804. priv->last_fw_rls_idx = 0;
  805. priv->extra_spare_vif_count = 0;
  806. /* set the default amount of spare blocks in the bitmap */
  807. ret = wl18xx_set_host_cfg_bitmap(wl, WL18XX_TX_HW_BLOCK_SPARE);
  808. if (ret < 0)
  809. return ret;
  810. if (checksum_param) {
  811. ret = wl18xx_acx_set_checksum_state(wl);
  812. if (ret != 0)
  813. return ret;
  814. }
  815. return ret;
  816. }
  817. static void wl18xx_set_tx_desc_csum(struct wl1271 *wl,
  818. struct wl1271_tx_hw_descr *desc,
  819. struct sk_buff *skb)
  820. {
  821. u32 ip_hdr_offset;
  822. struct iphdr *ip_hdr;
  823. if (!checksum_param) {
  824. desc->wl18xx_checksum_data = 0;
  825. return;
  826. }
  827. if (skb->ip_summed != CHECKSUM_PARTIAL) {
  828. desc->wl18xx_checksum_data = 0;
  829. return;
  830. }
  831. ip_hdr_offset = skb_network_header(skb) - skb_mac_header(skb);
  832. if (WARN_ON(ip_hdr_offset >= (1<<7))) {
  833. desc->wl18xx_checksum_data = 0;
  834. return;
  835. }
  836. desc->wl18xx_checksum_data = ip_hdr_offset << 1;
  837. /* FW is interested only in the LSB of the protocol TCP=0 UDP=1 */
  838. ip_hdr = (void *)skb_network_header(skb);
  839. desc->wl18xx_checksum_data |= (ip_hdr->protocol & 0x01);
  840. }
  841. static void wl18xx_set_rx_csum(struct wl1271 *wl,
  842. struct wl1271_rx_descriptor *desc,
  843. struct sk_buff *skb)
  844. {
  845. if (desc->status & WL18XX_RX_CHECKSUM_MASK)
  846. skb->ip_summed = CHECKSUM_UNNECESSARY;
  847. }
  848. /*
  849. * TODO: instead of having these two functions to get the rate mask,
  850. * we should modify the wlvif->rate_set instead
  851. */
  852. static u32 wl18xx_sta_get_ap_rate_mask(struct wl1271 *wl,
  853. struct wl12xx_vif *wlvif)
  854. {
  855. u32 hw_rate_set = wlvif->rate_set;
  856. if (wlvif->channel_type == NL80211_CHAN_HT40MINUS ||
  857. wlvif->channel_type == NL80211_CHAN_HT40PLUS) {
  858. wl1271_debug(DEBUG_ACX, "using wide channel rate mask");
  859. hw_rate_set |= CONF_TX_RATE_USE_WIDE_CHAN;
  860. /* we don't support MIMO in wide-channel mode */
  861. hw_rate_set &= ~CONF_TX_MIMO_RATES;
  862. }
  863. return hw_rate_set;
  864. }
  865. static u32 wl18xx_ap_get_mimo_wide_rate_mask(struct wl1271 *wl,
  866. struct wl12xx_vif *wlvif)
  867. {
  868. if ((wlvif->channel_type == NL80211_CHAN_HT40MINUS ||
  869. wlvif->channel_type == NL80211_CHAN_HT40PLUS) &&
  870. !strcmp(ht_mode_param, "wide")) {
  871. wl1271_debug(DEBUG_ACX, "using wide channel rate mask");
  872. return CONF_TX_RATE_USE_WIDE_CHAN;
  873. } else if (!strcmp(ht_mode_param, "mimo")) {
  874. wl1271_debug(DEBUG_ACX, "using MIMO rate mask");
  875. /*
  876. * PG 1.0 has some problems with MCS_13, so disable it
  877. *
  878. * TODO: instead of hacking this in here, we should
  879. * make it more general and change a bit in the
  880. * wlvif->rate_set instead.
  881. */
  882. if (wl->chip.id == CHIP_ID_185x_PG10)
  883. return CONF_TX_MIMO_RATES & ~CONF_HW_BIT_RATE_MCS_13;
  884. return CONF_TX_MIMO_RATES;
  885. } else {
  886. return 0;
  887. }
  888. }
  889. static s8 wl18xx_get_pg_ver(struct wl1271 *wl)
  890. {
  891. u32 fuse;
  892. wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]);
  893. fuse = wl1271_read32(wl, WL18XX_REG_FUSE_DATA_1_3);
  894. fuse = (fuse & WL18XX_PG_VER_MASK) >> WL18XX_PG_VER_OFFSET;
  895. wlcore_set_partition(wl, &wl->ptable[PART_BOOT]);
  896. return (s8)fuse;
  897. }
  898. #define WL18XX_CONF_FILE_NAME "ti-connectivity/wl18xx-conf.bin"
  899. static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev)
  900. {
  901. struct wl18xx_priv *priv = wl->priv;
  902. struct wlcore_conf_file *conf_file;
  903. const struct firmware *fw;
  904. int ret;
  905. ret = request_firmware(&fw, WL18XX_CONF_FILE_NAME, dev);
  906. if (ret < 0) {
  907. wl1271_error("could not get configuration binary %s: %d",
  908. WL18XX_CONF_FILE_NAME, ret);
  909. goto out_fallback;
  910. }
  911. if (fw->size != WL18XX_CONF_SIZE) {
  912. wl1271_error("configuration binary file size is wrong, "
  913. "expected %d got %d", WL18XX_CONF_SIZE, fw->size);
  914. ret = -EINVAL;
  915. goto out;
  916. }
  917. conf_file = (struct wlcore_conf_file *) fw->data;
  918. if (conf_file->header.magic != cpu_to_le32(WL18XX_CONF_MAGIC)) {
  919. wl1271_error("configuration binary file magic number mismatch, "
  920. "expected 0x%0x got 0x%0x", WL18XX_CONF_MAGIC,
  921. conf_file->header.magic);
  922. ret = -EINVAL;
  923. goto out;
  924. }
  925. if (conf_file->header.version != cpu_to_le32(WL18XX_CONF_VERSION)) {
  926. wl1271_error("configuration binary file version not supported, "
  927. "expected 0x%08x got 0x%08x",
  928. WL18XX_CONF_VERSION, conf_file->header.version);
  929. ret = -EINVAL;
  930. goto out;
  931. }
  932. memcpy(&wl->conf, &conf_file->core, sizeof(wl18xx_conf));
  933. memcpy(&priv->conf, &conf_file->priv, sizeof(priv->conf));
  934. goto out;
  935. out_fallback:
  936. wl1271_warning("falling back to default config");
  937. /* apply driver default configuration */
  938. memcpy(&wl->conf, &wl18xx_conf, sizeof(wl18xx_conf));
  939. /* apply default private configuration */
  940. memcpy(&priv->conf, &wl18xx_default_priv_conf, sizeof(priv->conf));
  941. /* For now we just fallback */
  942. return 0;
  943. out:
  944. release_firmware(fw);
  945. return ret;
  946. }
  947. static int wl18xx_plt_init(struct wl1271 *wl)
  948. {
  949. wl1271_write32(wl, WL18XX_SCR_PAD8, WL18XX_SCR_PAD8_PLT);
  950. return wl->ops->boot(wl);
  951. }
  952. static void wl18xx_get_mac(struct wl1271 *wl)
  953. {
  954. u32 mac1, mac2;
  955. wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]);
  956. mac1 = wl1271_read32(wl, WL18XX_REG_FUSE_BD_ADDR_1);
  957. mac2 = wl1271_read32(wl, WL18XX_REG_FUSE_BD_ADDR_2);
  958. /* these are the two parts of the BD_ADDR */
  959. wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) +
  960. ((mac1 & 0xff000000) >> 24);
  961. wl->fuse_nic_addr = (mac1 & 0xffffff);
  962. wlcore_set_partition(wl, &wl->ptable[PART_DOWN]);
  963. }
  964. static int wl18xx_handle_static_data(struct wl1271 *wl,
  965. struct wl1271_static_data *static_data)
  966. {
  967. struct wl18xx_static_data_priv *static_data_priv =
  968. (struct wl18xx_static_data_priv *) static_data->priv;
  969. wl1271_info("PHY firmware version: %s", static_data_priv->phy_version);
  970. return 0;
  971. }
  972. static int wl18xx_get_spare_blocks(struct wl1271 *wl, bool is_gem)
  973. {
  974. struct wl18xx_priv *priv = wl->priv;
  975. /* If we have VIFs requiring extra spare, indulge them */
  976. if (priv->extra_spare_vif_count)
  977. return WL18XX_TX_HW_EXTRA_BLOCK_SPARE;
  978. return WL18XX_TX_HW_BLOCK_SPARE;
  979. }
  980. static int wl18xx_set_key(struct wl1271 *wl, enum set_key_cmd cmd,
  981. struct ieee80211_vif *vif,
  982. struct ieee80211_sta *sta,
  983. struct ieee80211_key_conf *key_conf)
  984. {
  985. struct wl18xx_priv *priv = wl->priv;
  986. bool change_spare = false;
  987. int ret;
  988. /*
  989. * when adding the first or removing the last GEM/TKIP interface,
  990. * we have to adjust the number of spare blocks.
  991. */
  992. change_spare = (key_conf->cipher == WL1271_CIPHER_SUITE_GEM ||
  993. key_conf->cipher == WLAN_CIPHER_SUITE_TKIP) &&
  994. ((priv->extra_spare_vif_count == 0 && cmd == SET_KEY) ||
  995. (priv->extra_spare_vif_count == 1 && cmd == DISABLE_KEY));
  996. /* no need to change spare - just regular set_key */
  997. if (!change_spare)
  998. return wlcore_set_key(wl, cmd, vif, sta, key_conf);
  999. /*
  1000. * stop the queues and flush to ensure the next packets are
  1001. * in sync with FW spare block accounting
  1002. */
  1003. wlcore_stop_queues(wl, WLCORE_QUEUE_STOP_REASON_SPARE_BLK);
  1004. wl1271_tx_flush(wl);
  1005. ret = wlcore_set_key(wl, cmd, vif, sta, key_conf);
  1006. if (ret < 0)
  1007. goto out;
  1008. /* key is now set, change the spare blocks */
  1009. if (cmd == SET_KEY) {
  1010. ret = wl18xx_set_host_cfg_bitmap(wl,
  1011. WL18XX_TX_HW_EXTRA_BLOCK_SPARE);
  1012. if (ret < 0)
  1013. goto out;
  1014. priv->extra_spare_vif_count++;
  1015. } else {
  1016. ret = wl18xx_set_host_cfg_bitmap(wl,
  1017. WL18XX_TX_HW_BLOCK_SPARE);
  1018. if (ret < 0)
  1019. goto out;
  1020. priv->extra_spare_vif_count--;
  1021. }
  1022. out:
  1023. wlcore_wake_queues(wl, WLCORE_QUEUE_STOP_REASON_SPARE_BLK);
  1024. return ret;
  1025. }
  1026. static u32 wl18xx_pre_pkt_send(struct wl1271 *wl,
  1027. u32 buf_offset, u32 last_len)
  1028. {
  1029. if (wl->quirks & WLCORE_QUIRK_TX_PAD_LAST_FRAME) {
  1030. struct wl1271_tx_hw_descr *last_desc;
  1031. /* get the last TX HW descriptor written to the aggr buf */
  1032. last_desc = (struct wl1271_tx_hw_descr *)(wl->aggr_buf +
  1033. buf_offset - last_len);
  1034. /* the last frame is padded up to an SDIO block */
  1035. last_desc->wl18xx_mem.ctrl &= ~WL18XX_TX_CTRL_NOT_PADDED;
  1036. return ALIGN(buf_offset, WL12XX_BUS_BLOCK_SIZE);
  1037. }
  1038. /* no modifications */
  1039. return buf_offset;
  1040. }
  1041. static struct wlcore_ops wl18xx_ops = {
  1042. .identify_chip = wl18xx_identify_chip,
  1043. .boot = wl18xx_boot,
  1044. .plt_init = wl18xx_plt_init,
  1045. .trigger_cmd = wl18xx_trigger_cmd,
  1046. .ack_event = wl18xx_ack_event,
  1047. .calc_tx_blocks = wl18xx_calc_tx_blocks,
  1048. .set_tx_desc_blocks = wl18xx_set_tx_desc_blocks,
  1049. .set_tx_desc_data_len = wl18xx_set_tx_desc_data_len,
  1050. .get_rx_buf_align = wl18xx_get_rx_buf_align,
  1051. .get_rx_packet_len = wl18xx_get_rx_packet_len,
  1052. .tx_immediate_compl = wl18xx_tx_immediate_completion,
  1053. .tx_delayed_compl = NULL,
  1054. .hw_init = wl18xx_hw_init,
  1055. .set_tx_desc_csum = wl18xx_set_tx_desc_csum,
  1056. .get_pg_ver = wl18xx_get_pg_ver,
  1057. .set_rx_csum = wl18xx_set_rx_csum,
  1058. .sta_get_ap_rate_mask = wl18xx_sta_get_ap_rate_mask,
  1059. .ap_get_mimo_wide_rate_mask = wl18xx_ap_get_mimo_wide_rate_mask,
  1060. .get_mac = wl18xx_get_mac,
  1061. .debugfs_init = wl18xx_debugfs_add_files,
  1062. .handle_static_data = wl18xx_handle_static_data,
  1063. .get_spare_blocks = wl18xx_get_spare_blocks,
  1064. .set_key = wl18xx_set_key,
  1065. .pre_pkt_send = wl18xx_pre_pkt_send,
  1066. };
  1067. /* HT cap appropriate for wide channels */
  1068. static struct ieee80211_sta_ht_cap wl18xx_siso40_ht_cap = {
  1069. .cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 |
  1070. IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_DSSSCCK40,
  1071. .ht_supported = true,
  1072. .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K,
  1073. .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
  1074. .mcs = {
  1075. .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
  1076. .rx_highest = cpu_to_le16(150),
  1077. .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
  1078. },
  1079. };
  1080. /* HT cap appropriate for SISO 20 */
  1081. static struct ieee80211_sta_ht_cap wl18xx_siso20_ht_cap = {
  1082. .cap = IEEE80211_HT_CAP_SGI_20,
  1083. .ht_supported = true,
  1084. .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K,
  1085. .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
  1086. .mcs = {
  1087. .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
  1088. .rx_highest = cpu_to_le16(72),
  1089. .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
  1090. },
  1091. };
  1092. /* HT cap appropriate for MIMO rates in 20mhz channel */
  1093. static struct ieee80211_sta_ht_cap wl18xx_mimo_ht_cap_2ghz = {
  1094. .cap = IEEE80211_HT_CAP_SGI_20,
  1095. .ht_supported = true,
  1096. .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K,
  1097. .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
  1098. .mcs = {
  1099. .rx_mask = { 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, },
  1100. .rx_highest = cpu_to_le16(144),
  1101. .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
  1102. },
  1103. };
  1104. static struct ieee80211_sta_ht_cap wl18xx_mimo_ht_cap_5ghz = {
  1105. .cap = IEEE80211_HT_CAP_SGI_20,
  1106. .ht_supported = true,
  1107. .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K,
  1108. .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
  1109. .mcs = {
  1110. .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
  1111. .rx_highest = cpu_to_le16(72),
  1112. .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
  1113. },
  1114. };
  1115. static int __devinit wl18xx_probe(struct platform_device *pdev)
  1116. {
  1117. struct wl1271 *wl;
  1118. struct ieee80211_hw *hw;
  1119. struct wl18xx_priv *priv;
  1120. int ret;
  1121. hw = wlcore_alloc_hw(sizeof(*priv));
  1122. if (IS_ERR(hw)) {
  1123. wl1271_error("can't allocate hw");
  1124. ret = PTR_ERR(hw);
  1125. goto out;
  1126. }
  1127. wl = hw->priv;
  1128. priv = wl->priv;
  1129. wl->ops = &wl18xx_ops;
  1130. wl->ptable = wl18xx_ptable;
  1131. wl->rtable = wl18xx_rtable;
  1132. wl->num_tx_desc = 32;
  1133. wl->num_rx_desc = 16;
  1134. wl->band_rate_to_idx = wl18xx_band_rate_to_idx;
  1135. wl->hw_tx_rate_tbl_size = WL18XX_CONF_HW_RXTX_RATE_MAX;
  1136. wl->hw_min_ht_rate = WL18XX_CONF_HW_RXTX_RATE_MCS0;
  1137. wl->fw_status_priv_len = sizeof(struct wl18xx_fw_status_priv);
  1138. wl->stats.fw_stats_len = sizeof(struct wl18xx_acx_statistics);
  1139. wl->static_data_priv_len = sizeof(struct wl18xx_static_data_priv);
  1140. if (!strcmp(ht_mode_param, "wide")) {
  1141. memcpy(&wl->ht_cap[IEEE80211_BAND_2GHZ],
  1142. &wl18xx_siso40_ht_cap,
  1143. sizeof(wl18xx_siso40_ht_cap));
  1144. memcpy(&wl->ht_cap[IEEE80211_BAND_5GHZ],
  1145. &wl18xx_siso40_ht_cap,
  1146. sizeof(wl18xx_siso40_ht_cap));
  1147. } else if (!strcmp(ht_mode_param, "mimo")) {
  1148. memcpy(&wl->ht_cap[IEEE80211_BAND_2GHZ],
  1149. &wl18xx_mimo_ht_cap_2ghz,
  1150. sizeof(wl18xx_mimo_ht_cap_2ghz));
  1151. memcpy(&wl->ht_cap[IEEE80211_BAND_5GHZ],
  1152. &wl18xx_mimo_ht_cap_5ghz,
  1153. sizeof(wl18xx_mimo_ht_cap_5ghz));
  1154. } else if (!strcmp(ht_mode_param, "siso20")) {
  1155. memcpy(&wl->ht_cap[IEEE80211_BAND_2GHZ],
  1156. &wl18xx_siso20_ht_cap,
  1157. sizeof(wl18xx_siso20_ht_cap));
  1158. memcpy(&wl->ht_cap[IEEE80211_BAND_5GHZ],
  1159. &wl18xx_siso20_ht_cap,
  1160. sizeof(wl18xx_siso20_ht_cap));
  1161. } else {
  1162. wl1271_error("invalid ht_mode '%s'", ht_mode_param);
  1163. ret = -EINVAL;
  1164. goto out_free;
  1165. }
  1166. ret = wl18xx_conf_init(wl, &pdev->dev);
  1167. if (ret < 0)
  1168. goto out_free;
  1169. if (!strcmp(board_type_param, "fpga")) {
  1170. priv->conf.phy.board_type = BOARD_TYPE_FPGA_18XX;
  1171. } else if (!strcmp(board_type_param, "hdk")) {
  1172. priv->conf.phy.board_type = BOARD_TYPE_HDK_18XX;
  1173. /* HACK! Just for now we hardcode HDK to 0x06 */
  1174. priv->conf.phy.low_band_component_type = 0x06;
  1175. } else if (!strcmp(board_type_param, "dvp")) {
  1176. priv->conf.phy.board_type = BOARD_TYPE_DVP_18XX;
  1177. } else if (!strcmp(board_type_param, "evb")) {
  1178. priv->conf.phy.board_type = BOARD_TYPE_EVB_18XX;
  1179. } else if (!strcmp(board_type_param, "com8")) {
  1180. priv->conf.phy.board_type = BOARD_TYPE_COM8_18XX;
  1181. /* HACK! Just for now we hardcode COM8 to 0x06 */
  1182. priv->conf.phy.low_band_component_type = 0x06;
  1183. } else {
  1184. wl1271_error("invalid board type '%s'", board_type_param);
  1185. ret = -EINVAL;
  1186. goto out_free;
  1187. }
  1188. /* If the module param is set, update it in conf */
  1189. if (low_band_component_param != -1)
  1190. priv->conf.phy.low_band_component = low_band_component_param;
  1191. if (low_band_component_type_param != -1)
  1192. priv->conf.phy.low_band_component_type =
  1193. low_band_component_type_param;
  1194. if (high_band_component_param != -1)
  1195. priv->conf.phy.high_band_component = high_band_component_param;
  1196. if (high_band_component_type_param != -1)
  1197. priv->conf.phy.high_band_component_type =
  1198. high_band_component_type_param;
  1199. if (pwr_limit_reference_11_abg_param != -1)
  1200. priv->conf.phy.pwr_limit_reference_11_abg =
  1201. pwr_limit_reference_11_abg_param;
  1202. if (n_antennas_2_param != -1)
  1203. priv->conf.phy.number_of_assembled_ant2_4 = n_antennas_2_param;
  1204. if (n_antennas_5_param != -1)
  1205. priv->conf.phy.number_of_assembled_ant5 = n_antennas_5_param;
  1206. if (dc2dc_param != -1)
  1207. priv->conf.phy.external_pa_dc2dc = dc2dc_param;
  1208. if (!checksum_param) {
  1209. wl18xx_ops.set_rx_csum = NULL;
  1210. wl18xx_ops.init_vif = NULL;
  1211. }
  1212. wl->enable_11a = enable_11a_param;
  1213. return wlcore_probe(wl, pdev);
  1214. out_free:
  1215. wlcore_free_hw(wl);
  1216. out:
  1217. return ret;
  1218. }
  1219. static const struct platform_device_id wl18xx_id_table[] __devinitconst = {
  1220. { "wl18xx", 0 },
  1221. { } /* Terminating Entry */
  1222. };
  1223. MODULE_DEVICE_TABLE(platform, wl18xx_id_table);
  1224. static struct platform_driver wl18xx_driver = {
  1225. .probe = wl18xx_probe,
  1226. .remove = __devexit_p(wlcore_remove),
  1227. .id_table = wl18xx_id_table,
  1228. .driver = {
  1229. .name = "wl18xx_driver",
  1230. .owner = THIS_MODULE,
  1231. }
  1232. };
  1233. static int __init wl18xx_init(void)
  1234. {
  1235. return platform_driver_register(&wl18xx_driver);
  1236. }
  1237. module_init(wl18xx_init);
  1238. static void __exit wl18xx_exit(void)
  1239. {
  1240. platform_driver_unregister(&wl18xx_driver);
  1241. }
  1242. module_exit(wl18xx_exit);
  1243. module_param_named(ht_mode, ht_mode_param, charp, S_IRUSR);
  1244. MODULE_PARM_DESC(ht_mode, "Force HT mode: wide (default), mimo or siso20");
  1245. module_param_named(board_type, board_type_param, charp, S_IRUSR);
  1246. MODULE_PARM_DESC(board_type, "Board type: fpga, hdk (default), evb, com8 or "
  1247. "dvp");
  1248. module_param_named(checksum, checksum_param, bool, S_IRUSR);
  1249. MODULE_PARM_DESC(checksum, "Enable TCP checksum: boolean (defaults to false)");
  1250. module_param_named(enable_11a, enable_11a_param, bool, S_IRUSR);
  1251. MODULE_PARM_DESC(enable_11a, "Enable 11a (5GHz): boolean (defaults to true)");
  1252. module_param_named(dc2dc, dc2dc_param, int, S_IRUSR);
  1253. MODULE_PARM_DESC(dc2dc, "External DC2DC: u8 (defaults to 0)");
  1254. module_param_named(n_antennas_2, n_antennas_2_param, int, S_IRUSR);
  1255. MODULE_PARM_DESC(n_antennas_2,
  1256. "Number of installed 2.4GHz antennas: 1 (default) or 2");
  1257. module_param_named(n_antennas_5, n_antennas_5_param, int, S_IRUSR);
  1258. MODULE_PARM_DESC(n_antennas_5,
  1259. "Number of installed 5GHz antennas: 1 (default) or 2");
  1260. module_param_named(low_band_component, low_band_component_param, int,
  1261. S_IRUSR);
  1262. MODULE_PARM_DESC(low_band_component, "Low band component: u8 "
  1263. "(default is 0x01)");
  1264. module_param_named(low_band_component_type, low_band_component_type_param,
  1265. int, S_IRUSR);
  1266. MODULE_PARM_DESC(low_band_component_type, "Low band component type: u8 "
  1267. "(default is 0x05 or 0x06 depending on the board_type)");
  1268. module_param_named(high_band_component, high_band_component_param, int,
  1269. S_IRUSR);
  1270. MODULE_PARM_DESC(high_band_component, "High band component: u8, "
  1271. "(default is 0x01)");
  1272. module_param_named(high_band_component_type, high_band_component_type_param,
  1273. int, S_IRUSR);
  1274. MODULE_PARM_DESC(high_band_component_type, "High band component type: u8 "
  1275. "(default is 0x09)");
  1276. module_param_named(pwr_limit_reference_11_abg,
  1277. pwr_limit_reference_11_abg_param, int, S_IRUSR);
  1278. MODULE_PARM_DESC(pwr_limit_reference_11_abg, "Power limit reference: u8 "
  1279. "(default is 0xc8)");
  1280. MODULE_LICENSE("GPL v2");
  1281. MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
  1282. MODULE_FIRMWARE(WL18XX_FW_NAME);