rf.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2010 Realtek Corporation.
  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. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called LICENSE.
  20. *
  21. * Contact Information:
  22. * wlanfae <wlanfae@realtek.com>
  23. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  24. * Hsinchu 300, Taiwan.
  25. *
  26. * Larry Finger <Larry.Finger@lwfinger.net>
  27. *
  28. *****************************************************************************/
  29. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  30. #include "../wifi.h"
  31. #include "reg.h"
  32. #include "def.h"
  33. #include "phy.h"
  34. #include "rf.h"
  35. #include "dm.h"
  36. static void _rtl92s_get_powerbase(struct ieee80211_hw *hw, u8 *p_pwrlevel,
  37. u8 chnl, u32 *ofdmbase, u32 *mcsbase,
  38. u8 *p_final_pwridx)
  39. {
  40. struct rtl_priv *rtlpriv = rtl_priv(hw);
  41. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  42. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  43. u32 pwrbase0, pwrbase1;
  44. u8 legacy_pwrdiff = 0, ht20_pwrdiff = 0;
  45. u8 i, pwrlevel[4];
  46. for (i = 0; i < 2; i++)
  47. pwrlevel[i] = p_pwrlevel[i];
  48. /* We only care about the path A for legacy. */
  49. if (rtlefuse->eeprom_version < 2) {
  50. pwrbase0 = pwrlevel[0] + (rtlefuse->legacy_httxpowerdiff & 0xf);
  51. } else if (rtlefuse->eeprom_version >= 2) {
  52. legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff
  53. [RF90_PATH_A][chnl - 1];
  54. /* For legacy OFDM, tx pwr always > HT OFDM pwr.
  55. * We do not care Path B
  56. * legacy OFDM pwr diff. NO BB register
  57. * to notify HW. */
  58. pwrbase0 = pwrlevel[0] + legacy_pwrdiff;
  59. }
  60. pwrbase0 = (pwrbase0 << 24) | (pwrbase0 << 16) | (pwrbase0 << 8) |
  61. pwrbase0;
  62. *ofdmbase = pwrbase0;
  63. /* MCS rates */
  64. if (rtlefuse->eeprom_version >= 2) {
  65. /* Check HT20 to HT40 diff */
  66. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) {
  67. for (i = 0; i < 2; i++) {
  68. /* rf-A, rf-B */
  69. /* HT 20<->40 pwr diff */
  70. ht20_pwrdiff = rtlefuse->txpwr_ht20diff
  71. [i][chnl - 1];
  72. if (ht20_pwrdiff < 8) /* 0~+7 */
  73. pwrlevel[i] += ht20_pwrdiff;
  74. else /* index8-15=-8~-1 */
  75. pwrlevel[i] -= (16 - ht20_pwrdiff);
  76. }
  77. }
  78. }
  79. /* use index of rf-A */
  80. pwrbase1 = pwrlevel[0];
  81. pwrbase1 = (pwrbase1 << 24) | (pwrbase1 << 16) | (pwrbase1 << 8) |
  82. pwrbase1;
  83. *mcsbase = pwrbase1;
  84. /* The following is for Antenna
  85. * diff from Ant-B to Ant-A */
  86. p_final_pwridx[0] = pwrlevel[0];
  87. p_final_pwridx[1] = pwrlevel[1];
  88. switch (rtlefuse->eeprom_regulatory) {
  89. case 3:
  90. /* The following is for calculation
  91. * of the power diff for Ant-B to Ant-A. */
  92. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
  93. p_final_pwridx[0] += rtlefuse->pwrgroup_ht40
  94. [RF90_PATH_A][
  95. chnl - 1];
  96. p_final_pwridx[1] += rtlefuse->pwrgroup_ht40
  97. [RF90_PATH_B][
  98. chnl - 1];
  99. } else {
  100. p_final_pwridx[0] += rtlefuse->pwrgroup_ht20
  101. [RF90_PATH_A][
  102. chnl - 1];
  103. p_final_pwridx[1] += rtlefuse->pwrgroup_ht20
  104. [RF90_PATH_B][
  105. chnl - 1];
  106. }
  107. break;
  108. default:
  109. break;
  110. }
  111. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
  112. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  113. "40MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n",
  114. p_final_pwridx[0], p_final_pwridx[1]);
  115. } else {
  116. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  117. "20MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n",
  118. p_final_pwridx[0], p_final_pwridx[1]);
  119. }
  120. }
  121. static void _rtl92s_set_antennadiff(struct ieee80211_hw *hw,
  122. u8 *p_final_pwridx)
  123. {
  124. struct rtl_priv *rtlpriv = rtl_priv(hw);
  125. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  126. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  127. char ant_pwr_diff = 0;
  128. u32 u4reg_val = 0;
  129. if (rtlphy->rf_type == RF_2T2R) {
  130. ant_pwr_diff = p_final_pwridx[1] - p_final_pwridx[0];
  131. /* range is from 7~-8,
  132. * index = 0x0~0xf */
  133. if (ant_pwr_diff > 7)
  134. ant_pwr_diff = 7;
  135. if (ant_pwr_diff < -8)
  136. ant_pwr_diff = -8;
  137. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  138. "Antenna Diff from RF-B to RF-A = %d (0x%x)\n",
  139. ant_pwr_diff, ant_pwr_diff & 0xf);
  140. ant_pwr_diff &= 0xf;
  141. }
  142. /* Antenna TX power difference */
  143. rtlefuse->antenna_txpwdiff[2] = 0;/* RF-D, don't care */
  144. rtlefuse->antenna_txpwdiff[1] = 0;/* RF-C, don't care */
  145. rtlefuse->antenna_txpwdiff[0] = (u8)(ant_pwr_diff); /* RF-B */
  146. u4reg_val = rtlefuse->antenna_txpwdiff[2] << 8 |
  147. rtlefuse->antenna_txpwdiff[1] << 4 |
  148. rtlefuse->antenna_txpwdiff[0];
  149. rtl_set_bbreg(hw, RFPGA0_TXGAINSTAGE, (BXBTXAGC | BXCTXAGC | BXDTXAGC),
  150. u4reg_val);
  151. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "Write BCD-Diff(0x%x) = 0x%x\n",
  152. RFPGA0_TXGAINSTAGE, u4reg_val);
  153. }
  154. static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
  155. u8 chnl, u8 index,
  156. u32 pwrbase0,
  157. u32 pwrbase1,
  158. u32 *p_outwrite_val)
  159. {
  160. struct rtl_priv *rtlpriv = rtl_priv(hw);
  161. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  162. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  163. u8 i, chnlgroup, pwrdiff_limit[4];
  164. u32 writeval, customer_limit;
  165. /* Index 0 & 1= legacy OFDM, 2-5=HT_MCS rate */
  166. switch (rtlefuse->eeprom_regulatory) {
  167. case 0:
  168. /* Realtek better performance increase power diff
  169. * defined by Realtek for large power */
  170. chnlgroup = 0;
  171. writeval = rtlphy->mcs_txpwrlevel_origoffset
  172. [chnlgroup][index] +
  173. ((index < 2) ? pwrbase0 : pwrbase1);
  174. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  175. "RTK better performance, writeval = 0x%x\n", writeval);
  176. break;
  177. case 1:
  178. /* Realtek regulatory increase power diff defined
  179. * by Realtek for regulatory */
  180. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
  181. writeval = ((index < 2) ? pwrbase0 : pwrbase1);
  182. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  183. "Realtek regulatory, 40MHz, writeval = 0x%x\n",
  184. writeval);
  185. } else {
  186. if (rtlphy->pwrgroup_cnt == 1)
  187. chnlgroup = 0;
  188. if (rtlphy->pwrgroup_cnt >= 3) {
  189. if (chnl <= 3)
  190. chnlgroup = 0;
  191. else if (chnl >= 4 && chnl <= 8)
  192. chnlgroup = 1;
  193. else if (chnl > 8)
  194. chnlgroup = 2;
  195. if (rtlphy->pwrgroup_cnt == 4)
  196. chnlgroup++;
  197. }
  198. writeval = rtlphy->mcs_txpwrlevel_origoffset
  199. [chnlgroup][index]
  200. + ((index < 2) ?
  201. pwrbase0 : pwrbase1);
  202. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  203. "Realtek regulatory, 20MHz, writeval = 0x%x\n",
  204. writeval);
  205. }
  206. break;
  207. case 2:
  208. /* Better regulatory don't increase any power diff */
  209. writeval = ((index < 2) ? pwrbase0 : pwrbase1);
  210. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  211. "Better regulatory, writeval = 0x%x\n", writeval);
  212. break;
  213. case 3:
  214. /* Customer defined power diff. increase power diff
  215. defined by customer. */
  216. chnlgroup = 0;
  217. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
  218. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  219. "customer's limit, 40MHz = 0x%x\n",
  220. rtlefuse->pwrgroup_ht40
  221. [RF90_PATH_A][chnl - 1]);
  222. } else {
  223. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  224. "customer's limit, 20MHz = 0x%x\n",
  225. rtlefuse->pwrgroup_ht20
  226. [RF90_PATH_A][chnl - 1]);
  227. }
  228. for (i = 0; i < 4; i++) {
  229. pwrdiff_limit[i] =
  230. (u8)((rtlphy->mcs_txpwrlevel_origoffset
  231. [chnlgroup][index] & (0x7f << (i * 8)))
  232. >> (i * 8));
  233. if (rtlphy->current_chan_bw ==
  234. HT_CHANNEL_WIDTH_20_40) {
  235. if (pwrdiff_limit[i] >
  236. rtlefuse->pwrgroup_ht40
  237. [RF90_PATH_A][chnl - 1]) {
  238. pwrdiff_limit[i] =
  239. rtlefuse->pwrgroup_ht20
  240. [RF90_PATH_A][chnl - 1];
  241. }
  242. } else {
  243. if (pwrdiff_limit[i] >
  244. rtlefuse->pwrgroup_ht20
  245. [RF90_PATH_A][chnl - 1]) {
  246. pwrdiff_limit[i] =
  247. rtlefuse->pwrgroup_ht20
  248. [RF90_PATH_A][chnl - 1];
  249. }
  250. }
  251. }
  252. customer_limit = (pwrdiff_limit[3] << 24) |
  253. (pwrdiff_limit[2] << 16) |
  254. (pwrdiff_limit[1] << 8) |
  255. (pwrdiff_limit[0]);
  256. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  257. "Customer's limit = 0x%x\n", customer_limit);
  258. writeval = customer_limit + ((index < 2) ?
  259. pwrbase0 : pwrbase1);
  260. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  261. "Customer, writeval = 0x%x\n", writeval);
  262. break;
  263. default:
  264. chnlgroup = 0;
  265. writeval = rtlphy->mcs_txpwrlevel_origoffset[chnlgroup][index] +
  266. ((index < 2) ? pwrbase0 : pwrbase1);
  267. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  268. "RTK better performance, writeval = 0x%x\n", writeval);
  269. break;
  270. }
  271. if (rtlpriv->dm.dynamic_txhighpower_lvl == TX_HIGH_PWR_LEVEL_LEVEL1)
  272. writeval = 0x10101010;
  273. else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  274. TX_HIGH_PWR_LEVEL_LEVEL2)
  275. writeval = 0x0;
  276. *p_outwrite_val = writeval;
  277. }
  278. static void _rtl92s_write_ofdm_powerreg(struct ieee80211_hw *hw,
  279. u8 index, u32 val)
  280. {
  281. struct rtl_priv *rtlpriv = rtl_priv(hw);
  282. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  283. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  284. u16 regoffset[6] = {0xe00, 0xe04, 0xe10, 0xe14, 0xe18, 0xe1c};
  285. u8 i, rfa_pwr[4];
  286. u8 rfa_lower_bound = 0, rfa_upper_bound = 0, rf_pwr_diff = 0;
  287. u32 writeval = val;
  288. /* If path A and Path B coexist, we must limit Path A tx power.
  289. * Protect Path B pwr over or under flow. We need to calculate
  290. * upper and lower bound of path A tx power. */
  291. if (rtlphy->rf_type == RF_2T2R) {
  292. rf_pwr_diff = rtlefuse->antenna_txpwdiff[0];
  293. /* Diff=-8~-1 */
  294. if (rf_pwr_diff >= 8) {
  295. /* Prevent underflow!! */
  296. rfa_lower_bound = 0x10 - rf_pwr_diff;
  297. /* if (rf_pwr_diff >= 0) Diff = 0-7 */
  298. } else {
  299. rfa_upper_bound = RF6052_MAX_TX_PWR - rf_pwr_diff;
  300. }
  301. }
  302. for (i = 0; i < 4; i++) {
  303. rfa_pwr[i] = (u8)((writeval & (0x7f << (i * 8))) >> (i * 8));
  304. if (rfa_pwr[i] > RF6052_MAX_TX_PWR)
  305. rfa_pwr[i] = RF6052_MAX_TX_PWR;
  306. /* If path A and Path B coexist, we must limit Path A tx power.
  307. * Protect Path B pwr over or under flow. We need to calculate
  308. * upper and lower bound of path A tx power. */
  309. if (rtlphy->rf_type == RF_2T2R) {
  310. /* Diff=-8~-1 */
  311. if (rf_pwr_diff >= 8) {
  312. /* Prevent underflow!! */
  313. if (rfa_pwr[i] < rfa_lower_bound)
  314. rfa_pwr[i] = rfa_lower_bound;
  315. /* Diff = 0-7 */
  316. } else if (rf_pwr_diff >= 1) {
  317. /* Prevent overflow */
  318. if (rfa_pwr[i] > rfa_upper_bound)
  319. rfa_pwr[i] = rfa_upper_bound;
  320. }
  321. }
  322. }
  323. writeval = (rfa_pwr[3] << 24) | (rfa_pwr[2] << 16) | (rfa_pwr[1] << 8) |
  324. rfa_pwr[0];
  325. rtl_set_bbreg(hw, regoffset[index], 0x7f7f7f7f, writeval);
  326. }
  327. void rtl92s_phy_rf6052_set_ofdmtxpower(struct ieee80211_hw *hw,
  328. u8 *p_pwrlevel, u8 chnl)
  329. {
  330. u32 writeval, pwrbase0, pwrbase1;
  331. u8 index = 0;
  332. u8 finalpwr_idx[4];
  333. _rtl92s_get_powerbase(hw, p_pwrlevel, chnl, &pwrbase0, &pwrbase1,
  334. &finalpwr_idx[0]);
  335. _rtl92s_set_antennadiff(hw, &finalpwr_idx[0]);
  336. for (index = 0; index < 6; index++) {
  337. _rtl92s_get_txpower_writeval_byregulatory(hw, chnl, index,
  338. pwrbase0, pwrbase1, &writeval);
  339. _rtl92s_write_ofdm_powerreg(hw, index, writeval);
  340. }
  341. }
  342. void rtl92s_phy_rf6052_set_ccktxpower(struct ieee80211_hw *hw, u8 pwrlevel)
  343. {
  344. struct rtl_priv *rtlpriv = rtl_priv(hw);
  345. struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
  346. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  347. u32 txagc = 0;
  348. bool dont_inc_cck_or_turboscanoff = false;
  349. if (((rtlefuse->eeprom_version >= 2) &&
  350. (rtlefuse->txpwr_safetyflag == 1)) ||
  351. ((rtlefuse->eeprom_version >= 2) &&
  352. (rtlefuse->eeprom_regulatory != 0)))
  353. dont_inc_cck_or_turboscanoff = true;
  354. if (mac->act_scanning) {
  355. txagc = 0x3f;
  356. if (dont_inc_cck_or_turboscanoff)
  357. txagc = pwrlevel;
  358. } else {
  359. txagc = pwrlevel;
  360. if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  361. TX_HIGH_PWR_LEVEL_LEVEL1)
  362. txagc = 0x10;
  363. else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  364. TX_HIGH_PWR_LEVEL_LEVEL2)
  365. txagc = 0x0;
  366. }
  367. if (txagc > RF6052_MAX_TX_PWR)
  368. txagc = RF6052_MAX_TX_PWR;
  369. rtl_set_bbreg(hw, RTXAGC_CCK_MCS32, BTX_AGCRATECCK, txagc);
  370. }
  371. bool rtl92s_phy_rf6052_config(struct ieee80211_hw *hw)
  372. {
  373. struct rtl_priv *rtlpriv = rtl_priv(hw);
  374. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  375. u32 u4reg_val = 0;
  376. u8 rfpath;
  377. bool rtstatus = true;
  378. struct bb_reg_def *pphyreg;
  379. /* Initialize RF */
  380. for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) {
  381. pphyreg = &rtlphy->phyreg_def[rfpath];
  382. /* Store original RFENV control type */
  383. switch (rfpath) {
  384. case RF90_PATH_A:
  385. case RF90_PATH_C:
  386. u4reg_val = rtl92s_phy_query_bb_reg(hw,
  387. pphyreg->rfintfs,
  388. BRFSI_RFENV);
  389. break;
  390. case RF90_PATH_B:
  391. case RF90_PATH_D:
  392. u4reg_val = rtl92s_phy_query_bb_reg(hw,
  393. pphyreg->rfintfs,
  394. BRFSI_RFENV << 16);
  395. break;
  396. }
  397. /* Set RF_ENV enable */
  398. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfe,
  399. BRFSI_RFENV << 16, 0x1);
  400. /* Set RF_ENV output high */
  401. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1);
  402. /* Set bit number of Address and Data for RF register */
  403. rtl92s_phy_set_bb_reg(hw, pphyreg->rfhssi_para2,
  404. B3WIRE_ADDRESSLENGTH, 0x0);
  405. rtl92s_phy_set_bb_reg(hw, pphyreg->rfhssi_para2,
  406. B3WIRE_DATALENGTH, 0x0);
  407. /* Initialize RF fom connfiguration file */
  408. switch (rfpath) {
  409. case RF90_PATH_A:
  410. rtstatus = rtl92s_phy_config_rf(hw,
  411. (enum radio_path)rfpath);
  412. break;
  413. case RF90_PATH_B:
  414. rtstatus = rtl92s_phy_config_rf(hw,
  415. (enum radio_path)rfpath);
  416. break;
  417. case RF90_PATH_C:
  418. break;
  419. case RF90_PATH_D:
  420. break;
  421. }
  422. /* Restore RFENV control type */
  423. switch (rfpath) {
  424. case RF90_PATH_A:
  425. case RF90_PATH_C:
  426. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfs, BRFSI_RFENV,
  427. u4reg_val);
  428. break;
  429. case RF90_PATH_B:
  430. case RF90_PATH_D:
  431. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfs,
  432. BRFSI_RFENV << 16,
  433. u4reg_val);
  434. break;
  435. }
  436. if (rtstatus != true) {
  437. pr_err("Radio[%d] Fail!!\n", rfpath);
  438. goto fail;
  439. }
  440. }
  441. return rtstatus;
  442. fail:
  443. return rtstatus;
  444. }
  445. void rtl92s_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
  446. {
  447. struct rtl_priv *rtlpriv = rtl_priv(hw);
  448. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  449. switch (bandwidth) {
  450. case HT_CHANNEL_WIDTH_20:
  451. rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
  452. 0xfffff3ff) | 0x0400);
  453. rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
  454. rtlphy->rfreg_chnlval[0]);
  455. break;
  456. case HT_CHANNEL_WIDTH_20_40:
  457. rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
  458. 0xfffff3ff));
  459. rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
  460. rtlphy->rfreg_chnlval[0]);
  461. break;
  462. default:
  463. RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
  464. "unknown bandwidth: %#X\n", bandwidth);
  465. break;
  466. }
  467. }