rf.c 15 KB

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