halmac_cfg_wmac_88xx.c 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. ******************************************************************************/
  15. #include "halmac_cfg_wmac_88xx.h"
  16. #include "halmac_88xx_cfg.h"
  17. #if HALMAC_88XX_SUPPORT
  18. #define MAC_CLK_SPEED 80 /* 80M */
  19. enum mac_clock_hw_def {
  20. MAC_CLK_HW_DEF_80M = 0,
  21. MAC_CLK_HW_DEF_40M = 1,
  22. MAC_CLK_HW_DEF_20M = 2,
  23. };
  24. /**
  25. * cfg_mac_addr_88xx() - config mac address
  26. * @adapter : the adapter of halmac
  27. * @port : 0 for port0, 1 for port1, 2 for port2, 3 for port3, 4 for port4
  28. * @addr : mac address
  29. * Author : KaiYuan Chang/Ivan Lin
  30. * Return : enum halmac_ret_status
  31. * More details of status code can be found in prototype document
  32. */
  33. enum halmac_ret_status
  34. cfg_mac_addr_88xx(struct halmac_adapter *adapter, u8 port,
  35. union halmac_wlan_addr *addr)
  36. {
  37. u32 offset;
  38. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  39. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  40. if (port >= HALMAC_PORTID_NUM) {
  41. PLTFM_MSG_ERR("[ERR]port index >= 5\n");
  42. return HALMAC_RET_PORT_NOT_SUPPORT;
  43. }
  44. switch (port) {
  45. case HALMAC_PORTID0:
  46. offset = REG_MACID;
  47. break;
  48. case HALMAC_PORTID1:
  49. offset = REG_MACID1;
  50. break;
  51. case HALMAC_PORTID2:
  52. offset = REG_MACID2;
  53. break;
  54. case HALMAC_PORTID3:
  55. offset = REG_MACID3;
  56. break;
  57. case HALMAC_PORTID4:
  58. offset = REG_MACID4;
  59. break;
  60. default:
  61. return HALMAC_RET_PORT_NOT_SUPPORT;
  62. }
  63. HALMAC_REG_W32(offset, rtk_le32_to_cpu(addr->addr_l_h.low));
  64. HALMAC_REG_W16(offset + 4, rtk_le16_to_cpu(addr->addr_l_h.high));
  65. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  66. return HALMAC_RET_SUCCESS;
  67. }
  68. /**
  69. * cfg_bssid_88xx() - config BSSID
  70. * @adapter : the adapter of halmac
  71. * @port : 0 for port0, 1 for port1, 2 for port2, 3 for port3, 4 for port4
  72. * @addr : bssid
  73. * Author : KaiYuan Chang/Ivan Lin
  74. * Return : enum halmac_ret_status
  75. * More details of status code can be found in prototype document
  76. */
  77. enum halmac_ret_status
  78. cfg_bssid_88xx(struct halmac_adapter *adapter, u8 port,
  79. union halmac_wlan_addr *addr)
  80. {
  81. u32 offset;
  82. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  83. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  84. if (port >= HALMAC_PORTID_NUM) {
  85. PLTFM_MSG_ERR("[ERR]port index > 5\n");
  86. return HALMAC_RET_PORT_NOT_SUPPORT;
  87. }
  88. switch (port) {
  89. case HALMAC_PORTID0:
  90. offset = REG_BSSID;
  91. break;
  92. case HALMAC_PORTID1:
  93. offset = REG_BSSID1;
  94. break;
  95. case HALMAC_PORTID2:
  96. offset = REG_BSSID2;
  97. break;
  98. case HALMAC_PORTID3:
  99. offset = REG_BSSID3;
  100. break;
  101. case HALMAC_PORTID4:
  102. offset = REG_BSSID4;
  103. break;
  104. default:
  105. return HALMAC_RET_PORT_NOT_SUPPORT;
  106. }
  107. HALMAC_REG_W32(offset, rtk_le32_to_cpu(addr->addr_l_h.low));
  108. HALMAC_REG_W16(offset + 4, rtk_le16_to_cpu(addr->addr_l_h.high));
  109. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  110. return HALMAC_RET_SUCCESS;
  111. }
  112. /**
  113. * cfg_transmitter_addr_88xx() - config transmitter address
  114. * @adapter : the adapter of halmac
  115. * @port : 0 for port0, 1 for port1, 2 for port2, 3 for port3, 4 for port4
  116. * @addr :
  117. * Author : Alan
  118. * Return : enum halmac_ret_status
  119. */
  120. enum halmac_ret_status
  121. cfg_transmitter_addr_88xx(struct halmac_adapter *adapter, u8 port,
  122. union halmac_wlan_addr *addr)
  123. {
  124. u32 offset;
  125. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  126. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  127. if (port >= HALMAC_PORTID_NUM) {
  128. PLTFM_MSG_ERR("[ERR]port index > 5\n");
  129. return HALMAC_RET_PORT_NOT_SUPPORT;
  130. }
  131. switch (port) {
  132. case HALMAC_PORTID0:
  133. offset = REG_TRANSMIT_ADDRSS_0;
  134. break;
  135. case HALMAC_PORTID1:
  136. offset = REG_TRANSMIT_ADDRSS_1;
  137. break;
  138. case HALMAC_PORTID2:
  139. offset = REG_TRANSMIT_ADDRSS_2;
  140. break;
  141. case HALMAC_PORTID3:
  142. offset = REG_TRANSMIT_ADDRSS_3;
  143. break;
  144. case HALMAC_PORTID4:
  145. offset = REG_TRANSMIT_ADDRSS_4;
  146. break;
  147. default:
  148. return HALMAC_RET_PORT_NOT_SUPPORT;
  149. }
  150. HALMAC_REG_W32(offset, rtk_le32_to_cpu(addr->addr_l_h.low));
  151. HALMAC_REG_W16(offset + 4, rtk_le16_to_cpu(addr->addr_l_h.high));
  152. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  153. return HALMAC_RET_SUCCESS;
  154. }
  155. /**
  156. * cfg_net_type_88xx() - config network type
  157. * @adapter : the adapter of halmac
  158. * @port : 0 for port0, 1 for port1, 2 for port2, 3 for port3, 4 for port4
  159. * @addr : mac address
  160. * Author : Alan
  161. * Return : enum halmac_ret_status
  162. */
  163. enum halmac_ret_status
  164. cfg_net_type_88xx(struct halmac_adapter *adapter, u8 port,
  165. enum halmac_network_type_select net_type)
  166. {
  167. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  168. u8 value8 = 0;
  169. u8 net_type_tmp = 0;
  170. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  171. if (net_type == HALMAC_NETWORK_AP) {
  172. if (port >= HALMAC_PORTID1) {
  173. PLTFM_MSG_ERR("[ERR]AP port > 1\n");
  174. return HALMAC_RET_PORT_NOT_SUPPORT;
  175. }
  176. }
  177. switch (port) {
  178. case HALMAC_PORTID0:
  179. net_type_tmp = net_type;
  180. value8 = ((HALMAC_REG_R8(REG_CR + 2) & 0xFC) | net_type_tmp);
  181. HALMAC_REG_W8(REG_CR + 2, value8);
  182. break;
  183. case HALMAC_PORTID1:
  184. net_type_tmp = (net_type << 2);
  185. value8 = ((HALMAC_REG_R8(REG_CR + 2) & 0xF3) | net_type_tmp);
  186. HALMAC_REG_W8(REG_CR + 2, value8);
  187. break;
  188. case HALMAC_PORTID2:
  189. net_type_tmp = net_type;
  190. value8 = ((HALMAC_REG_R8(REG_CR_EXT) & 0xFC) | net_type_tmp);
  191. HALMAC_REG_W8(REG_CR_EXT, value8);
  192. break;
  193. case HALMAC_PORTID3:
  194. net_type_tmp = (net_type << 2);
  195. value8 = ((HALMAC_REG_R8(REG_CR_EXT) & 0xF3) | net_type_tmp);
  196. HALMAC_REG_W8(REG_CR_EXT, value8);
  197. break;
  198. case HALMAC_PORTID4:
  199. net_type_tmp = (net_type << 4);
  200. value8 = ((HALMAC_REG_R8(REG_CR_EXT) & 0xCF) | net_type_tmp);
  201. HALMAC_REG_W8(REG_CR_EXT, value8);
  202. break;
  203. default:
  204. break;
  205. }
  206. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  207. return HALMAC_RET_SUCCESS;
  208. }
  209. /**
  210. * cfg_tsf_rst_88xx() - tsf reset
  211. * @adapter : the adapter of halmac
  212. * @port : 0 for port0, 1 for port1, 2 for port2, 3 for port3, 4 for port4
  213. * Author : Alan
  214. * Return : enum halmac_ret_status
  215. */
  216. enum halmac_ret_status
  217. cfg_tsf_rst_88xx(struct halmac_adapter *adapter, u8 port)
  218. {
  219. u8 tsf_rst = 0;
  220. u8 value8;
  221. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  222. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  223. switch (port) {
  224. case HALMAC_PORTID0:
  225. tsf_rst = BIT_TSFTR_RST;
  226. break;
  227. case HALMAC_PORTID1:
  228. tsf_rst = BIT_TSFTR_CLI0_RST;
  229. break;
  230. case HALMAC_PORTID2:
  231. tsf_rst = BIT_TSFTR_CLI1_RST;
  232. break;
  233. case HALMAC_PORTID3:
  234. tsf_rst = BIT_TSFTR_CLI2_RST;
  235. break;
  236. case HALMAC_PORTID4:
  237. tsf_rst = BIT_TSFTR_CLI3_RST;
  238. break;
  239. default:
  240. break;
  241. }
  242. value8 = HALMAC_REG_R8(REG_DUAL_TSF_RST);
  243. HALMAC_REG_W8(REG_DUAL_TSF_RST, value8 | tsf_rst);
  244. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  245. return HALMAC_RET_SUCCESS;
  246. }
  247. /**
  248. * cfg_bcn_space_88xx() - config beacon space
  249. * @adapter : the adapter of halmac
  250. * @port : 0 for port0, 1 for port1, 2 for port2, 3 for port3, 4 for port4
  251. * @bcn_space : beacon space
  252. * Author : Alan
  253. * Return : enum halmac_ret_status
  254. */
  255. enum halmac_ret_status
  256. cfg_bcn_space_88xx(struct halmac_adapter *adapter, u8 port, u32 bcn_space)
  257. {
  258. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  259. u16 bcn_space_real = 0;
  260. u16 value16 = 0;
  261. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  262. bcn_space_real = ((u16)bcn_space);
  263. switch (port) {
  264. case HALMAC_PORTID0:
  265. HALMAC_REG_W16(REG_MBSSID_BCN_SPACE, bcn_space_real);
  266. break;
  267. case HALMAC_PORTID1:
  268. value16 = HALMAC_REG_R16(REG_MBSSID_BCN_SPACE + 2) & 0xF000;
  269. value16 |= bcn_space_real;
  270. HALMAC_REG_W16(REG_MBSSID_BCN_SPACE + 2, value16);
  271. break;
  272. case HALMAC_PORTID2:
  273. value16 = HALMAC_REG_R16(REG_MBSSID_BCN_SPACE2) & 0xF000;
  274. value16 |= bcn_space_real;
  275. HALMAC_REG_W16(REG_MBSSID_BCN_SPACE2, value16);
  276. break;
  277. case HALMAC_PORTID3:
  278. value16 = HALMAC_REG_R16(REG_MBSSID_BCN_SPACE2 + 2) & 0xF000;
  279. value16 |= bcn_space_real;
  280. HALMAC_REG_W16(REG_MBSSID_BCN_SPACE2 + 2, value16);
  281. break;
  282. case HALMAC_PORTID4:
  283. value16 = HALMAC_REG_R16(REG_MBSSID_BCN_SPACE3) & 0xF000;
  284. value16 |= bcn_space_real;
  285. HALMAC_REG_W16(REG_MBSSID_BCN_SPACE3, value16);
  286. break;
  287. default:
  288. break;
  289. }
  290. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  291. return HALMAC_RET_SUCCESS;
  292. }
  293. /**
  294. * rw_bcn_ctrl_88xx() - r/w beacon control
  295. * @adapter : the adapter of halmac
  296. * @port : 0 for port0, 1 for port1, 2 for port2, 3 for port3, 4 for port4
  297. * @write_en : 1->write beacon function 0->read beacon function
  298. * @pBcn_ctrl : beacon control info
  299. * Author : KaiYuan Chang/Ivan Lin
  300. * Return : enum halmac_ret_status
  301. */
  302. enum halmac_ret_status
  303. rw_bcn_ctrl_88xx(struct halmac_adapter *adapter, u8 port, u8 write_en,
  304. struct halmac_bcn_ctrl *ctrl)
  305. {
  306. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  307. u8 ctrl_value = 0;
  308. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  309. if (write_en) {
  310. if (ctrl->dis_rx_bssid_fit == 1)
  311. ctrl_value |= BIT_DIS_RX_BSSID_FIT;
  312. if (ctrl->en_txbcn_rpt == 1)
  313. ctrl_value |= BIT_P0_EN_TXBCN_RPT;
  314. if (ctrl->dis_tsf_udt == 1)
  315. ctrl_value |= BIT_DIS_TSF_UDT;
  316. if (ctrl->en_bcn == 1)
  317. ctrl_value |= BIT_EN_BCN_FUNCTION;
  318. if (ctrl->en_rxbcn_rpt == 1)
  319. ctrl_value |= BIT_P0_EN_RXBCN_RPT;
  320. if (ctrl->en_p2p_ctwin == 1)
  321. ctrl_value |= BIT_EN_P2P_CTWINDOW;
  322. if (ctrl->en_p2p_bcn_area == 1)
  323. ctrl_value |= BIT_EN_P2P_BCNQ_AREA;
  324. switch (port) {
  325. case HALMAC_PORTID0:
  326. HALMAC_REG_W8(REG_BCN_CTRL, ctrl_value);
  327. break;
  328. case HALMAC_PORTID1:
  329. HALMAC_REG_W8(REG_BCN_CTRL_CLINT0, ctrl_value);
  330. break;
  331. case HALMAC_PORTID2:
  332. HALMAC_REG_W8(REG_BCN_CTRL_CLINT1, ctrl_value);
  333. break;
  334. case HALMAC_PORTID3:
  335. HALMAC_REG_W8(REG_BCN_CTRL_CLINT2, ctrl_value);
  336. break;
  337. case HALMAC_PORTID4:
  338. HALMAC_REG_W8(REG_BCN_CTRL_CLINT3, ctrl_value);
  339. break;
  340. default:
  341. break;
  342. }
  343. } else {
  344. switch (port) {
  345. case HALMAC_PORTID0:
  346. ctrl_value = HALMAC_REG_R8(REG_BCN_CTRL);
  347. break;
  348. case HALMAC_PORTID1:
  349. ctrl_value = HALMAC_REG_R8(REG_BCN_CTRL_CLINT0);
  350. break;
  351. case HALMAC_PORTID2:
  352. ctrl_value = HALMAC_REG_R8(REG_BCN_CTRL_CLINT1);
  353. break;
  354. case HALMAC_PORTID3:
  355. ctrl_value = HALMAC_REG_R8(REG_BCN_CTRL_CLINT2);
  356. break;
  357. case HALMAC_PORTID4:
  358. ctrl_value = HALMAC_REG_R8(REG_BCN_CTRL_CLINT3);
  359. break;
  360. default:
  361. break;
  362. }
  363. if (ctrl_value & BIT_EN_P2P_BCNQ_AREA)
  364. ctrl->en_p2p_bcn_area = 1;
  365. else
  366. ctrl->en_p2p_bcn_area = 0;
  367. if (ctrl_value & BIT_EN_P2P_CTWINDOW)
  368. ctrl->en_p2p_ctwin = 1;
  369. else
  370. ctrl->en_p2p_ctwin = 0;
  371. if (ctrl_value & BIT_P0_EN_RXBCN_RPT)
  372. ctrl->en_rxbcn_rpt = 1;
  373. else
  374. ctrl->en_rxbcn_rpt = 0;
  375. if (ctrl_value & BIT_EN_BCN_FUNCTION)
  376. ctrl->en_bcn = 1;
  377. else
  378. ctrl->en_bcn = 0;
  379. if (ctrl_value & BIT_DIS_TSF_UDT)
  380. ctrl->dis_tsf_udt = 1;
  381. else
  382. ctrl->dis_tsf_udt = 0;
  383. if (ctrl_value & BIT_P0_EN_TXBCN_RPT)
  384. ctrl->en_txbcn_rpt = 1;
  385. else
  386. ctrl->en_txbcn_rpt = 0;
  387. if (ctrl_value & BIT_DIS_RX_BSSID_FIT)
  388. ctrl->dis_rx_bssid_fit = 1;
  389. else
  390. ctrl->dis_rx_bssid_fit = 0;
  391. }
  392. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  393. return HALMAC_RET_SUCCESS;
  394. }
  395. /**
  396. * cfg_multicast_addr_88xx() - config multicast address
  397. * @adapter : the adapter of halmac
  398. * @addr : multicast address
  399. * Author : KaiYuan Chang/Ivan Lin
  400. * Return : enum halmac_ret_status
  401. * More details of status code can be found in prototype document
  402. */
  403. enum halmac_ret_status
  404. cfg_multicast_addr_88xx(struct halmac_adapter *adapter,
  405. union halmac_wlan_addr *addr)
  406. {
  407. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  408. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  409. HALMAC_REG_W32(REG_MAR, rtk_le32_to_cpu(addr->addr_l_h.low));
  410. HALMAC_REG_W16(REG_MAR + 4, rtk_le16_to_cpu(addr->addr_l_h.high));
  411. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  412. return HALMAC_RET_SUCCESS;
  413. }
  414. /**
  415. * cfg_operation_mode_88xx() - config operation mode
  416. * @adapter : the adapter of halmac
  417. * @mode : 802.11 standard(b/g/n/ac)
  418. * Author : KaiYuan Chang/Ivan Lin
  419. * Return : enum halmac_ret_status
  420. * More details of status code can be found in prototype document
  421. */
  422. enum halmac_ret_status
  423. cfg_operation_mode_88xx(struct halmac_adapter *adapter,
  424. enum halmac_wireless_mode mode)
  425. {
  426. return HALMAC_RET_SUCCESS;
  427. }
  428. /**
  429. * cfg_ch_bw_88xx() - config channel & bandwidth
  430. * @adapter : the adapter of halmac
  431. * @ch : WLAN channel, support 2.4G & 5G
  432. * @idx : primary channel index, idx1, idx2, idx3, idx4
  433. * @bw : band width, 20, 40, 80, 160, 5 ,10
  434. * Author : KaiYuan Chang
  435. * Return : enum halmac_ret_status
  436. * More details of status code can be found in prototype document
  437. */
  438. enum halmac_ret_status
  439. cfg_ch_bw_88xx(struct halmac_adapter *adapter, u8 ch,
  440. enum halmac_pri_ch_idx idx, enum halmac_bw bw)
  441. {
  442. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  443. cfg_pri_ch_idx_88xx(adapter, idx);
  444. cfg_bw_88xx(adapter, bw);
  445. cfg_ch_88xx(adapter, ch);
  446. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  447. return HALMAC_RET_SUCCESS;
  448. }
  449. enum halmac_ret_status
  450. cfg_ch_88xx(struct halmac_adapter *adapter, u8 ch)
  451. {
  452. u8 value8;
  453. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  454. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  455. value8 = HALMAC_REG_R8(REG_CCK_CHECK);
  456. value8 = value8 & (~(BIT(7)));
  457. if (ch > 35)
  458. value8 = value8 | BIT(7);
  459. HALMAC_REG_W8(REG_CCK_CHECK, value8);
  460. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  461. return HALMAC_RET_SUCCESS;
  462. }
  463. enum halmac_ret_status
  464. cfg_pri_ch_idx_88xx(struct halmac_adapter *adapter, enum halmac_pri_ch_idx idx)
  465. {
  466. u8 txsc40 = 0, txsc20 = 0;
  467. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  468. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  469. txsc20 = idx;
  470. if (txsc20 == HALMAC_CH_IDX_1 || txsc20 == HALMAC_CH_IDX_3)
  471. txsc40 = 9;
  472. else
  473. txsc40 = 10;
  474. HALMAC_REG_W8(REG_DATA_SC, BIT_TXSC_20M(txsc20) | BIT_TXSC_40M(txsc40));
  475. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  476. return HALMAC_RET_SUCCESS;
  477. }
  478. /**
  479. * cfg_bw_88xx() - config bandwidth
  480. * @adapter : the adapter of halmac
  481. * @bw : band width, 20, 40, 80, 160, 5 ,10
  482. * Author : KaiYuan Chang
  483. * Return : enum halmac_ret_status
  484. * More details of status code can be found in prototype document
  485. */
  486. enum halmac_ret_status
  487. cfg_bw_88xx(struct halmac_adapter *adapter, enum halmac_bw bw)
  488. {
  489. u32 value32;
  490. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  491. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  492. value32 = HALMAC_REG_R32(REG_WMAC_TRXPTCL_CTL);
  493. value32 = value32 & (~(BIT(7) | BIT(8)));
  494. switch (bw) {
  495. case HALMAC_BW_80:
  496. value32 = value32 | BIT(8);
  497. break;
  498. case HALMAC_BW_40:
  499. value32 = value32 | BIT(7);
  500. break;
  501. case HALMAC_BW_20:
  502. case HALMAC_BW_10:
  503. case HALMAC_BW_5:
  504. break;
  505. default:
  506. break;
  507. }
  508. HALMAC_REG_W32(REG_WMAC_TRXPTCL_CTL, value32);
  509. /* TODO:Move to change mac clk api later... */
  510. value32 = HALMAC_REG_R32(REG_AFE_CTRL1) & ~(BIT(20) | BIT(21));
  511. value32 |= (MAC_CLK_HW_DEF_80M << BIT_SHIFT_MAC_CLK_SEL);
  512. HALMAC_REG_W32(REG_AFE_CTRL1, value32);
  513. HALMAC_REG_W8(REG_USTIME_TSF, MAC_CLK_SPEED);
  514. HALMAC_REG_W8(REG_USTIME_EDCA, MAC_CLK_SPEED);
  515. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  516. return HALMAC_RET_SUCCESS;
  517. }
  518. void
  519. enable_bb_rf_88xx(struct halmac_adapter *adapter, u8 enable)
  520. {
  521. u8 value8;
  522. u32 value32;
  523. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  524. if (enable == 1) {
  525. value8 = HALMAC_REG_R8(REG_SYS_FUNC_EN);
  526. value8 = value8 | BIT(0) | BIT(1);
  527. HALMAC_REG_W8(REG_SYS_FUNC_EN, value8);
  528. value8 = HALMAC_REG_R8(REG_RF_CTRL);
  529. value8 = value8 | BIT(0) | BIT(1) | BIT(2);
  530. HALMAC_REG_W8(REG_RF_CTRL, value8);
  531. value32 = HALMAC_REG_R32(REG_WLRF1);
  532. value32 = value32 | BIT(24) | BIT(25) | BIT(26);
  533. HALMAC_REG_W32(REG_WLRF1, value32);
  534. } else {
  535. value8 = HALMAC_REG_R8(REG_SYS_FUNC_EN);
  536. value8 = value8 & (~(BIT(0) | BIT(1)));
  537. HALMAC_REG_W8(REG_SYS_FUNC_EN, value8);
  538. value8 = HALMAC_REG_R8(REG_RF_CTRL);
  539. value8 = value8 & (~(BIT(0) | BIT(1) | BIT(2)));
  540. HALMAC_REG_W8(REG_RF_CTRL, value8);
  541. value32 = HALMAC_REG_R32(REG_WLRF1);
  542. value32 = value32 & (~(BIT(24) | BIT(25) | BIT(26)));
  543. HALMAC_REG_W32(REG_WLRF1, value32);
  544. }
  545. }
  546. /**
  547. * cfg_la_mode_88xx() - config la mode
  548. * @adapter : the adapter of halmac
  549. * @mode :
  550. * disable : no TXFF space reserved for LA debug
  551. * partial : partial TXFF space is reserved for LA debug
  552. * full : all TXFF space is reserved for LA debug
  553. * Author : KaiYuan Chang
  554. * Return : enum halmac_ret_status
  555. * More details of status code can be found in prototype document
  556. */
  557. enum halmac_ret_status
  558. cfg_la_mode_88xx(struct halmac_adapter *adapter, enum halmac_la_mode mode)
  559. {
  560. if (adapter->api_registry.la_mode_en == 0)
  561. return HALMAC_RET_NOT_SUPPORT;
  562. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  563. adapter->txff_alloc.la_mode = mode;
  564. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  565. return HALMAC_RET_SUCCESS;
  566. }
  567. /**
  568. * cfg_rxfifo_expand_mode_88xx() - rx fifo expanding
  569. * @adapter : the adapter of halmac
  570. * @mode :
  571. * disable : normal mode
  572. * 1 block : Rx FIFO + 1 FIFO block; Tx fifo - 1 FIFO block
  573. * 2 block : Rx FIFO + 2 FIFO block; Tx fifo - 2 FIFO block
  574. * 3 block : Rx FIFO + 3 FIFO block; Tx fifo - 3 FIFO block
  575. * Author : Soar
  576. * Return : enum halmac_ret_status
  577. * More details of status code can be found in prototype document
  578. */
  579. enum halmac_ret_status
  580. cfg_rxfifo_expand_mode_88xx(struct halmac_adapter *adapter,
  581. enum halmac_rx_fifo_expanding_mode mode)
  582. {
  583. if (adapter->api_registry.rx_exp_en == 0)
  584. return HALMAC_RET_NOT_SUPPORT;
  585. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  586. adapter->txff_alloc.rx_fifo_exp_mode = mode;
  587. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  588. return HALMAC_RET_SUCCESS;
  589. }
  590. enum halmac_ret_status
  591. config_security_88xx(struct halmac_adapter *adapter,
  592. struct halmac_security_setting *setting)
  593. {
  594. u8 sec_cfg;
  595. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  596. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  597. HALMAC_REG_W16_SET(REG_CR, BIT_MAC_SEC_EN);
  598. if (setting->compare_keyid == 1) {
  599. HALMAC_REG_W8_SET(REG_SECCFG + 1, BIT(0));
  600. adapter->hw_cfg_info.chk_security_keyid = 1;
  601. } else {
  602. adapter->hw_cfg_info.chk_security_keyid = 0;
  603. }
  604. sec_cfg = HALMAC_REG_R8(REG_SECCFG);
  605. /* BC/MC uses default key */
  606. /* cam entry 0~3, kei id = 0 -> entry0, kei id = 1 -> entry1... */
  607. sec_cfg |= (BIT_TXBCUSEDK | BIT_RXBCUSEDK);
  608. if (setting->tx_encryption == 1)
  609. sec_cfg |= BIT_TXENC;
  610. else
  611. sec_cfg &= ~BIT_TXENC;
  612. if (setting->rx_decryption == 1)
  613. sec_cfg |= BIT_RXDEC;
  614. else
  615. sec_cfg &= ~BIT_RXDEC;
  616. HALMAC_REG_W8(REG_SECCFG, sec_cfg);
  617. if (setting->bip_enable == 1) {
  618. if (adapter->chip_id == HALMAC_CHIP_ID_8822B)
  619. return HALMAC_RET_BIP_NO_SUPPORT;
  620. #if (HALMAC_8821C_SUPPORT || HALMAC_8822C_SUPPORT || HALMAC_8812F_SUPPORT)
  621. sec_cfg = HALMAC_REG_R8(REG_WSEC_OPTION + 2);
  622. if (setting->tx_encryption == 1)
  623. sec_cfg |= (BIT(3) | BIT(5));
  624. else
  625. sec_cfg &= ~(BIT(3) | BIT(5));
  626. if (setting->rx_decryption == 1)
  627. sec_cfg |= (BIT(4) | BIT(6));
  628. else
  629. sec_cfg &= ~(BIT(4) | BIT(6));
  630. HALMAC_REG_W8(REG_WSEC_OPTION + 2, sec_cfg);
  631. #endif
  632. }
  633. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  634. return HALMAC_RET_SUCCESS;
  635. }
  636. u8
  637. get_used_cam_entry_num_88xx(struct halmac_adapter *adapter,
  638. enum hal_security_type sec_type)
  639. {
  640. u8 entry_num;
  641. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  642. switch (sec_type) {
  643. case HAL_SECURITY_TYPE_WEP40:
  644. case HAL_SECURITY_TYPE_WEP104:
  645. case HAL_SECURITY_TYPE_TKIP:
  646. case HAL_SECURITY_TYPE_AES128:
  647. case HAL_SECURITY_TYPE_GCMP128:
  648. case HAL_SECURITY_TYPE_GCMSMS4:
  649. case HAL_SECURITY_TYPE_BIP:
  650. entry_num = 1;
  651. break;
  652. case HAL_SECURITY_TYPE_WAPI:
  653. case HAL_SECURITY_TYPE_AES256:
  654. case HAL_SECURITY_TYPE_GCMP256:
  655. entry_num = 2;
  656. break;
  657. default:
  658. entry_num = 0;
  659. break;
  660. }
  661. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  662. return entry_num;
  663. }
  664. enum halmac_ret_status
  665. write_cam_88xx(struct halmac_adapter *adapter, u32 idx,
  666. struct halmac_cam_entry_info *info)
  667. {
  668. u32 i;
  669. u32 cmd = 0x80010000;
  670. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  671. struct halmac_cam_entry_format *fmt = NULL;
  672. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  673. if (idx >= adapter->hw_cfg_info.cam_entry_num)
  674. return HALMAC_RET_ENTRY_INDEX_ERROR;
  675. if (info->key_id > 3)
  676. return HALMAC_RET_FAIL;
  677. fmt = (struct halmac_cam_entry_format *)PLTFM_MALLOC(sizeof(*fmt));
  678. if (!fmt)
  679. return HALMAC_RET_NULL_POINTER;
  680. PLTFM_MEMSET(fmt, 0x00, sizeof(*fmt));
  681. if (adapter->hw_cfg_info.chk_security_keyid == 1)
  682. fmt->key_id = info->key_id;
  683. fmt->valid = info->valid;
  684. PLTFM_MEMCPY(fmt->mac_address, info->mac_address, 6);
  685. PLTFM_MEMCPY(fmt->key, info->key, 16);
  686. switch (info->security_type) {
  687. case HAL_SECURITY_TYPE_NONE:
  688. fmt->type = 0;
  689. break;
  690. case HAL_SECURITY_TYPE_WEP40:
  691. fmt->type = 1;
  692. break;
  693. case HAL_SECURITY_TYPE_WEP104:
  694. fmt->type = 5;
  695. break;
  696. case HAL_SECURITY_TYPE_TKIP:
  697. fmt->type = 2;
  698. break;
  699. case HAL_SECURITY_TYPE_AES128:
  700. fmt->type = 4;
  701. break;
  702. case HAL_SECURITY_TYPE_WAPI:
  703. fmt->type = 6;
  704. break;
  705. case HAL_SECURITY_TYPE_AES256:
  706. fmt->type = 4;
  707. fmt->ext_sectype = 1;
  708. break;
  709. case HAL_SECURITY_TYPE_GCMP128:
  710. fmt->type = 7;
  711. break;
  712. case HAL_SECURITY_TYPE_GCMP256:
  713. case HAL_SECURITY_TYPE_GCMSMS4:
  714. fmt->type = 7;
  715. fmt->ext_sectype = 1;
  716. break;
  717. case HAL_SECURITY_TYPE_BIP:
  718. fmt->type = (info->unicast == 1) ? 4 : 0;
  719. fmt->mgnt = 1;
  720. fmt->grp = (info->unicast == 1) ? 0 : 1;
  721. break;
  722. default:
  723. PLTFM_FREE(fmt, sizeof(*fmt));
  724. return HALMAC_RET_FAIL;
  725. }
  726. for (i = 0; i < 8; i++) {
  727. HALMAC_REG_W32(REG_CAMWRITE, *((u32 *)fmt + i));
  728. HALMAC_REG_W32(REG_CAMCMD, cmd | ((idx << 3) + i));
  729. }
  730. if (info->security_type == HAL_SECURITY_TYPE_WAPI ||
  731. info->security_type == HAL_SECURITY_TYPE_AES256 ||
  732. info->security_type == HAL_SECURITY_TYPE_GCMP256 ||
  733. info->security_type == HAL_SECURITY_TYPE_GCMSMS4) {
  734. fmt->mic = 1;
  735. PLTFM_MEMCPY(fmt->key, info->key_ext, 16);
  736. idx++;
  737. for (i = 0; i < 8; i++) {
  738. HALMAC_REG_W32(REG_CAMWRITE, *((u32 *)fmt + i));
  739. HALMAC_REG_W32(REG_CAMCMD, cmd | ((idx << 3) + i));
  740. }
  741. }
  742. PLTFM_FREE(fmt, sizeof(*fmt));
  743. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  744. return HALMAC_RET_SUCCESS;
  745. }
  746. enum halmac_ret_status
  747. read_cam_entry_88xx(struct halmac_adapter *adapter, u32 idx,
  748. struct halmac_cam_entry_format *content)
  749. {
  750. u32 i;
  751. u32 cmd = 0x80000000;
  752. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  753. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  754. if (idx >= adapter->hw_cfg_info.cam_entry_num)
  755. return HALMAC_RET_ENTRY_INDEX_ERROR;
  756. for (i = 0; i < 8; i++) {
  757. HALMAC_REG_W32(REG_CAMCMD, cmd | ((idx << 3) + i));
  758. *((u32 *)content + i) = HALMAC_REG_R32(REG_CAMREAD);
  759. }
  760. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  761. return HALMAC_RET_SUCCESS;
  762. }
  763. enum halmac_ret_status
  764. clear_cam_entry_88xx(struct halmac_adapter *adapter, u32 idx)
  765. {
  766. u32 i;
  767. u32 cmd = 0x80010000;
  768. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  769. struct halmac_cam_entry_format *fmt = NULL;
  770. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  771. if (idx >= adapter->hw_cfg_info.cam_entry_num)
  772. return HALMAC_RET_ENTRY_INDEX_ERROR;
  773. fmt = (struct halmac_cam_entry_format *)PLTFM_MALLOC(sizeof(*fmt));
  774. if (!fmt)
  775. return HALMAC_RET_NULL_POINTER;
  776. PLTFM_MEMSET(fmt, 0x00, sizeof(*fmt));
  777. for (i = 0; i < 8; i++) {
  778. HALMAC_REG_W32(REG_CAMWRITE, *((u32 *)fmt + i));
  779. HALMAC_REG_W32(REG_CAMCMD, cmd | ((idx << 3) + i));
  780. }
  781. PLTFM_FREE(fmt, sizeof(*fmt));
  782. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  783. return HALMAC_RET_SUCCESS;
  784. }
  785. void
  786. rx_shift_88xx(struct halmac_adapter *adapter, u8 enable)
  787. {
  788. u8 value8;
  789. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  790. value8 = HALMAC_REG_R8(REG_TXDMA_PQ_MAP);
  791. if (enable == 1)
  792. HALMAC_REG_W8(REG_TXDMA_PQ_MAP, value8 | BIT(1));
  793. else
  794. HALMAC_REG_W8(REG_TXDMA_PQ_MAP, value8 & ~(BIT(1)));
  795. }
  796. /**
  797. * cfg_edca_para_88xx() - config edca parameter
  798. * @adapter : the adapter of halmac
  799. * @acq_id : VO/VI/BE/BK
  800. * @param : aifs, cw, txop limit
  801. * Author : Ivan Lin
  802. * Return : enum halmac_ret_status
  803. * More details of status code can be found in prototype document
  804. */
  805. enum halmac_ret_status
  806. cfg_edca_para_88xx(struct halmac_adapter *adapter, enum halmac_acq_id acq_id,
  807. struct halmac_edca_para *param)
  808. {
  809. u32 offset;
  810. u32 value32;
  811. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  812. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  813. switch (acq_id) {
  814. case HALMAC_ACQ_ID_VO:
  815. offset = REG_EDCA_VO_PARAM;
  816. break;
  817. case HALMAC_ACQ_ID_VI:
  818. offset = REG_EDCA_VI_PARAM;
  819. break;
  820. case HALMAC_ACQ_ID_BE:
  821. offset = REG_EDCA_BE_PARAM;
  822. break;
  823. case HALMAC_ACQ_ID_BK:
  824. offset = REG_EDCA_BK_PARAM;
  825. break;
  826. default:
  827. return HALMAC_RET_SWITCH_CASE_ERROR;
  828. }
  829. param->txop_limit &= 0x7FF;
  830. value32 = (param->aifs) | (param->cw << 8) | (param->txop_limit << 16);
  831. HALMAC_REG_W32(offset, value32);
  832. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  833. return HALMAC_RET_SUCCESS;
  834. }
  835. void
  836. rx_clk_gate_88xx(struct halmac_adapter *adapter, u8 enable)
  837. {
  838. u8 value8;
  839. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  840. value8 = HALMAC_REG_R8(REG_RCR + 2);
  841. if (enable == 1)
  842. HALMAC_REG_W8(REG_RCR + 2, value8 & ~(BIT(3)));
  843. else
  844. HALMAC_REG_W8(REG_RCR + 2, value8 | BIT(3));
  845. }
  846. enum halmac_ret_status
  847. rx_cut_amsdu_cfg_88xx(struct halmac_adapter *adapter,
  848. struct halmac_cut_amsdu_cfg *cfg)
  849. {
  850. return HALMAC_RET_NOT_SUPPORT;
  851. }
  852. enum halmac_ret_status
  853. fast_edca_cfg_88xx(struct halmac_adapter *adapter,
  854. struct halmac_fast_edca_cfg *cfg)
  855. {
  856. u16 value16;
  857. u32 offset;
  858. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  859. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  860. switch (cfg->acq_id) {
  861. case HALMAC_ACQ_ID_VO:
  862. offset = REG_FAST_EDCA_VOVI_SETTING;
  863. break;
  864. case HALMAC_ACQ_ID_VI:
  865. offset = REG_FAST_EDCA_VOVI_SETTING + 2;
  866. break;
  867. case HALMAC_ACQ_ID_BE:
  868. offset = REG_FAST_EDCA_BEBK_SETTING;
  869. break;
  870. case HALMAC_ACQ_ID_BK:
  871. offset = REG_FAST_EDCA_BEBK_SETTING + 2;
  872. break;
  873. default:
  874. return HALMAC_RET_SWITCH_CASE_ERROR;
  875. }
  876. value16 = HALMAC_REG_R16(offset);
  877. value16 &= 0xFF;
  878. value16 = value16 | (cfg->queue_to << 8);
  879. HALMAC_REG_W16(offset, value16);
  880. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  881. return HALMAC_RET_SUCCESS;
  882. }
  883. /**
  884. * get_mac_addr_88xx() - get mac address
  885. * @adapter : the adapter of halmac
  886. * @port : 0 for port0, 1 for port1, 2 for port2, 3 for port3, 4 for port4
  887. * @addr : mac address
  888. * Author : Ivan Lin
  889. * Return : enum halmac_ret_status
  890. * More details of status code can be found in prototype document
  891. */
  892. enum halmac_ret_status
  893. get_mac_addr_88xx(struct halmac_adapter *adapter, u8 port,
  894. union halmac_wlan_addr *addr)
  895. {
  896. u16 mac_addr_h;
  897. u32 mac_addr_l;
  898. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  899. PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
  900. if (port >= HALMAC_PORTID_NUM) {
  901. PLTFM_MSG_ERR("[ERR]port index >= 5\n");
  902. return HALMAC_RET_PORT_NOT_SUPPORT;
  903. }
  904. switch (port) {
  905. case HALMAC_PORTID0:
  906. mac_addr_l = HALMAC_REG_R32(REG_MACID);
  907. mac_addr_h = HALMAC_REG_R16(REG_MACID + 4);
  908. break;
  909. case HALMAC_PORTID1:
  910. mac_addr_l = HALMAC_REG_R32(REG_MACID1);
  911. mac_addr_h = HALMAC_REG_R16(REG_MACID1 + 4);
  912. break;
  913. case HALMAC_PORTID2:
  914. mac_addr_l = HALMAC_REG_R32(REG_MACID2);
  915. mac_addr_h = HALMAC_REG_R16(REG_MACID2 + 4);
  916. break;
  917. case HALMAC_PORTID3:
  918. mac_addr_l = HALMAC_REG_R32(REG_MACID3);
  919. mac_addr_h = HALMAC_REG_R16(REG_MACID3 + 4);
  920. break;
  921. case HALMAC_PORTID4:
  922. mac_addr_l = HALMAC_REG_R32(REG_MACID4);
  923. mac_addr_h = HALMAC_REG_R16(REG_MACID4 + 4);
  924. break;
  925. default:
  926. return HALMAC_RET_PORT_NOT_SUPPORT;
  927. }
  928. addr->addr_l_h.low = rtk_cpu_to_le32(mac_addr_l);
  929. addr->addr_l_h.high = rtk_cpu_to_le16(mac_addr_h);
  930. PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
  931. return HALMAC_RET_SUCCESS;
  932. }
  933. void
  934. rts_full_bw_88xx(struct halmac_adapter *adapter, u8 enable)
  935. {
  936. u8 value8;
  937. struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
  938. value8 = HALMAC_REG_R8(REG_INIRTS_RATE_SEL);
  939. if (enable == 1)
  940. HALMAC_REG_W8(REG_INIRTS_RATE_SEL, value8 | BIT(5));
  941. else
  942. HALMAC_REG_W8(REG_INIRTS_RATE_SEL, value8 & ~(BIT(5)));
  943. }
  944. #endif /* HALMAC_88XX_SUPPORT */