rf.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  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, ("40MHz finalpwr_idx "
  113. "(A / B) = 0x%x / 0x%x\n", p_final_pwridx[0],
  114. p_final_pwridx[1]));
  115. } else {
  116. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, ("20MHz finalpwr_idx "
  117. "(A / B) = 0x%x / 0x%x\n", p_final_pwridx[0],
  118. 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 "
  139. "to RF-A = %d (0x%x)\n", ant_pwr_diff,
  140. ant_pwr_diff & 0xf));
  141. ant_pwr_diff &= 0xf;
  142. }
  143. /* Antenna TX power difference */
  144. rtlefuse->antenna_txpwdiff[2] = 0;/* RF-D, don't care */
  145. rtlefuse->antenna_txpwdiff[1] = 0;/* RF-C, don't care */
  146. rtlefuse->antenna_txpwdiff[0] = (u8)(ant_pwr_diff); /* RF-B */
  147. u4reg_val = rtlefuse->antenna_txpwdiff[2] << 8 |
  148. rtlefuse->antenna_txpwdiff[1] << 4 |
  149. rtlefuse->antenna_txpwdiff[0];
  150. rtl_set_bbreg(hw, RFPGA0_TXGAINSTAGE, (BXBTXAGC | BXCTXAGC | BXDTXAGC),
  151. u4reg_val);
  152. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  153. ("Write BCD-Diff(0x%x) = 0x%x\n",
  154. RFPGA0_TXGAINSTAGE, u4reg_val));
  155. }
  156. static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
  157. u8 chnl, u8 index,
  158. u32 pwrbase0,
  159. u32 pwrbase1,
  160. u32 *p_outwrite_val)
  161. {
  162. struct rtl_priv *rtlpriv = rtl_priv(hw);
  163. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  164. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  165. u8 i, chnlgroup, pwrdiff_limit[4];
  166. u32 writeval, customer_limit;
  167. /* Index 0 & 1= legacy OFDM, 2-5=HT_MCS rate */
  168. switch (rtlefuse->eeprom_regulatory) {
  169. case 0:
  170. /* Realtek better performance increase power diff
  171. * defined by Realtek for large power */
  172. chnlgroup = 0;
  173. writeval = rtlphy->mcs_txpwrlevel_origoffset
  174. [chnlgroup][index] +
  175. ((index < 2) ? pwrbase0 : pwrbase1);
  176. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  177. ("RTK better performance, "
  178. "writeval = 0x%x\n", writeval));
  179. break;
  180. case 1:
  181. /* Realtek regulatory increase power diff defined
  182. * by Realtek for regulatory */
  183. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
  184. writeval = ((index < 2) ? pwrbase0 : pwrbase1);
  185. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  186. ("Realtek regulatory, "
  187. "40MHz, writeval = 0x%x\n", writeval));
  188. } else {
  189. if (rtlphy->pwrgroup_cnt == 1)
  190. chnlgroup = 0;
  191. if (rtlphy->pwrgroup_cnt >= 3) {
  192. if (chnl <= 3)
  193. chnlgroup = 0;
  194. else if (chnl >= 4 && chnl <= 8)
  195. chnlgroup = 1;
  196. else if (chnl > 8)
  197. chnlgroup = 2;
  198. if (rtlphy->pwrgroup_cnt == 4)
  199. chnlgroup++;
  200. }
  201. writeval = rtlphy->mcs_txpwrlevel_origoffset
  202. [chnlgroup][index]
  203. + ((index < 2) ?
  204. pwrbase0 : pwrbase1);
  205. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  206. ("Realtek regulatory, "
  207. "20MHz, writeval = 0x%x\n", writeval));
  208. }
  209. break;
  210. case 2:
  211. /* Better regulatory don't increase any power diff */
  212. writeval = ((index < 2) ? pwrbase0 : pwrbase1);
  213. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  214. ("Better regulatory, "
  215. "writeval = 0x%x\n", writeval));
  216. break;
  217. case 3:
  218. /* Customer defined power diff. increase power diff
  219. defined by customer. */
  220. chnlgroup = 0;
  221. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
  222. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  223. ("customer's limit, 40MHz = 0x%x\n",
  224. rtlefuse->pwrgroup_ht40
  225. [RF90_PATH_A][chnl - 1]));
  226. } else {
  227. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  228. ("customer's limit, 20MHz = 0x%x\n",
  229. rtlefuse->pwrgroup_ht20
  230. [RF90_PATH_A][chnl - 1]));
  231. }
  232. for (i = 0; i < 4; i++) {
  233. pwrdiff_limit[i] =
  234. (u8)((rtlphy->mcs_txpwrlevel_origoffset
  235. [chnlgroup][index] & (0x7f << (i * 8)))
  236. >> (i * 8));
  237. if (rtlphy->current_chan_bw ==
  238. HT_CHANNEL_WIDTH_20_40) {
  239. if (pwrdiff_limit[i] >
  240. rtlefuse->pwrgroup_ht40
  241. [RF90_PATH_A][chnl - 1]) {
  242. pwrdiff_limit[i] =
  243. rtlefuse->pwrgroup_ht20
  244. [RF90_PATH_A][chnl - 1];
  245. }
  246. } else {
  247. if (pwrdiff_limit[i] >
  248. rtlefuse->pwrgroup_ht20
  249. [RF90_PATH_A][chnl - 1]) {
  250. pwrdiff_limit[i] =
  251. rtlefuse->pwrgroup_ht20
  252. [RF90_PATH_A][chnl - 1];
  253. }
  254. }
  255. }
  256. customer_limit = (pwrdiff_limit[3] << 24) |
  257. (pwrdiff_limit[2] << 16) |
  258. (pwrdiff_limit[1] << 8) |
  259. (pwrdiff_limit[0]);
  260. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  261. ("Customer's limit = 0x%x\n",
  262. customer_limit));
  263. writeval = customer_limit + ((index < 2) ?
  264. pwrbase0 : pwrbase1);
  265. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  266. ("Customer, writeval = "
  267. "0x%x\n", writeval));
  268. break;
  269. default:
  270. chnlgroup = 0;
  271. writeval = rtlphy->mcs_txpwrlevel_origoffset[chnlgroup][index] +
  272. ((index < 2) ? pwrbase0 : pwrbase1);
  273. RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
  274. ("RTK better performance, "
  275. "writeval = 0x%x\n", writeval));
  276. break;
  277. }
  278. if (rtlpriv->dm.dynamic_txhighpower_lvl == TX_HIGH_PWR_LEVEL_LEVEL1)
  279. writeval = 0x10101010;
  280. else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  281. TX_HIGH_PWR_LEVEL_LEVEL2)
  282. writeval = 0x0;
  283. *p_outwrite_val = writeval;
  284. }
  285. static void _rtl92s_write_ofdm_powerreg(struct ieee80211_hw *hw,
  286. u8 index, u32 val)
  287. {
  288. struct rtl_priv *rtlpriv = rtl_priv(hw);
  289. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  290. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  291. u16 regoffset[6] = {0xe00, 0xe04, 0xe10, 0xe14, 0xe18, 0xe1c};
  292. u8 i, rfa_pwr[4];
  293. u8 rfa_lower_bound = 0, rfa_upper_bound = 0, rf_pwr_diff = 0;
  294. u32 writeval = val;
  295. /* If path A and Path B coexist, we must limit Path A tx power.
  296. * Protect Path B pwr over or under flow. We need to calculate
  297. * upper and lower bound of path A tx power. */
  298. if (rtlphy->rf_type == RF_2T2R) {
  299. rf_pwr_diff = rtlefuse->antenna_txpwdiff[0];
  300. /* Diff=-8~-1 */
  301. if (rf_pwr_diff >= 8) {
  302. /* Prevent underflow!! */
  303. rfa_lower_bound = 0x10 - rf_pwr_diff;
  304. /* if (rf_pwr_diff >= 0) Diff = 0-7 */
  305. } else {
  306. rfa_upper_bound = RF6052_MAX_TX_PWR - rf_pwr_diff;
  307. }
  308. }
  309. for (i = 0; i < 4; i++) {
  310. rfa_pwr[i] = (u8)((writeval & (0x7f << (i * 8))) >> (i * 8));
  311. if (rfa_pwr[i] > RF6052_MAX_TX_PWR)
  312. rfa_pwr[i] = RF6052_MAX_TX_PWR;
  313. /* If path A and Path B coexist, we must limit Path A tx power.
  314. * Protect Path B pwr over or under flow. We need to calculate
  315. * upper and lower bound of path A tx power. */
  316. if (rtlphy->rf_type == RF_2T2R) {
  317. /* Diff=-8~-1 */
  318. if (rf_pwr_diff >= 8) {
  319. /* Prevent underflow!! */
  320. if (rfa_pwr[i] < rfa_lower_bound)
  321. rfa_pwr[i] = rfa_lower_bound;
  322. /* Diff = 0-7 */
  323. } else if (rf_pwr_diff >= 1) {
  324. /* Prevent overflow */
  325. if (rfa_pwr[i] > rfa_upper_bound)
  326. rfa_pwr[i] = rfa_upper_bound;
  327. }
  328. }
  329. }
  330. writeval = (rfa_pwr[3] << 24) | (rfa_pwr[2] << 16) | (rfa_pwr[1] << 8) |
  331. rfa_pwr[0];
  332. rtl_set_bbreg(hw, regoffset[index], 0x7f7f7f7f, writeval);
  333. }
  334. void rtl92s_phy_rf6052_set_ofdmtxpower(struct ieee80211_hw *hw,
  335. u8 *p_pwrlevel, u8 chnl)
  336. {
  337. u32 writeval, pwrbase0, pwrbase1;
  338. u8 index = 0;
  339. u8 finalpwr_idx[4];
  340. _rtl92s_get_powerbase(hw, p_pwrlevel, chnl, &pwrbase0, &pwrbase1,
  341. &finalpwr_idx[0]);
  342. _rtl92s_set_antennadiff(hw, &finalpwr_idx[0]);
  343. for (index = 0; index < 6; index++) {
  344. _rtl92s_get_txpower_writeval_byregulatory(hw, chnl, index,
  345. pwrbase0, pwrbase1, &writeval);
  346. _rtl92s_write_ofdm_powerreg(hw, index, writeval);
  347. }
  348. }
  349. void rtl92s_phy_rf6052_set_ccktxpower(struct ieee80211_hw *hw, u8 pwrlevel)
  350. {
  351. struct rtl_priv *rtlpriv = rtl_priv(hw);
  352. struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
  353. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  354. u32 txagc = 0;
  355. bool dont_inc_cck_or_turboscanoff = false;
  356. if (((rtlefuse->eeprom_version >= 2) &&
  357. (rtlefuse->txpwr_safetyflag == 1)) ||
  358. ((rtlefuse->eeprom_version >= 2) &&
  359. (rtlefuse->eeprom_regulatory != 0)))
  360. dont_inc_cck_or_turboscanoff = true;
  361. if (mac->act_scanning) {
  362. txagc = 0x3f;
  363. if (dont_inc_cck_or_turboscanoff)
  364. txagc = pwrlevel;
  365. } else {
  366. txagc = pwrlevel;
  367. if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  368. TX_HIGH_PWR_LEVEL_LEVEL1)
  369. txagc = 0x10;
  370. else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  371. TX_HIGH_PWR_LEVEL_LEVEL2)
  372. txagc = 0x0;
  373. }
  374. if (txagc > RF6052_MAX_TX_PWR)
  375. txagc = RF6052_MAX_TX_PWR;
  376. rtl_set_bbreg(hw, RTXAGC_CCK_MCS32, BTX_AGCRATECCK, txagc);
  377. }
  378. bool rtl92s_phy_rf6052_config(struct ieee80211_hw *hw)
  379. {
  380. struct rtl_priv *rtlpriv = rtl_priv(hw);
  381. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  382. u32 u4reg_val = 0;
  383. u8 rfpath;
  384. bool rtstatus = true;
  385. struct bb_reg_def *pphyreg;
  386. /* Initialize RF */
  387. for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) {
  388. pphyreg = &rtlphy->phyreg_def[rfpath];
  389. /* Store original RFENV control type */
  390. switch (rfpath) {
  391. case RF90_PATH_A:
  392. case RF90_PATH_C:
  393. u4reg_val = rtl92s_phy_query_bb_reg(hw,
  394. pphyreg->rfintfs,
  395. BRFSI_RFENV);
  396. break;
  397. case RF90_PATH_B:
  398. case RF90_PATH_D:
  399. u4reg_val = rtl92s_phy_query_bb_reg(hw,
  400. pphyreg->rfintfs,
  401. BRFSI_RFENV << 16);
  402. break;
  403. }
  404. /* Set RF_ENV enable */
  405. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfe,
  406. BRFSI_RFENV << 16, 0x1);
  407. /* Set RF_ENV output high */
  408. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1);
  409. /* Set bit number of Address and Data for RF register */
  410. rtl92s_phy_set_bb_reg(hw, pphyreg->rfhssi_para2,
  411. B3WIRE_ADDRESSLENGTH, 0x0);
  412. rtl92s_phy_set_bb_reg(hw, pphyreg->rfhssi_para2,
  413. B3WIRE_DATALENGTH, 0x0);
  414. /* Initialize RF fom connfiguration file */
  415. switch (rfpath) {
  416. case RF90_PATH_A:
  417. rtstatus = rtl92s_phy_config_rf(hw,
  418. (enum radio_path)rfpath);
  419. break;
  420. case RF90_PATH_B:
  421. rtstatus = rtl92s_phy_config_rf(hw,
  422. (enum radio_path)rfpath);
  423. break;
  424. case RF90_PATH_C:
  425. break;
  426. case RF90_PATH_D:
  427. break;
  428. }
  429. /* Restore RFENV control type */
  430. switch (rfpath) {
  431. case RF90_PATH_A:
  432. case RF90_PATH_C:
  433. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfs, BRFSI_RFENV,
  434. u4reg_val);
  435. break;
  436. case RF90_PATH_B:
  437. case RF90_PATH_D:
  438. rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfs,
  439. BRFSI_RFENV << 16,
  440. u4reg_val);
  441. break;
  442. }
  443. if (rtstatus != true) {
  444. pr_err("Radio[%d] Fail!!\n", rfpath);
  445. goto fail;
  446. }
  447. }
  448. return rtstatus;
  449. fail:
  450. return rtstatus;
  451. }
  452. void rtl92s_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
  453. {
  454. struct rtl_priv *rtlpriv = rtl_priv(hw);
  455. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  456. switch (bandwidth) {
  457. case HT_CHANNEL_WIDTH_20:
  458. rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
  459. 0xfffff3ff) | 0x0400);
  460. rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
  461. rtlphy->rfreg_chnlval[0]);
  462. break;
  463. case HT_CHANNEL_WIDTH_20_40:
  464. rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
  465. 0xfffff3ff));
  466. rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
  467. rtlphy->rfreg_chnlval[0]);
  468. break;
  469. default:
  470. RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
  471. ("unknown bandwidth: %#X\n",
  472. bandwidth));
  473. break;
  474. }
  475. }