rf.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2012 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 bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw);
  36. void rtl92cu_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
  37. {
  38. struct rtl_priv *rtlpriv = rtl_priv(hw);
  39. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  40. switch (bandwidth) {
  41. case HT_CHANNEL_WIDTH_20:
  42. rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
  43. 0xfffff3ff) | 0x0400);
  44. rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
  45. rtlphy->rfreg_chnlval[0]);
  46. break;
  47. case HT_CHANNEL_WIDTH_20_40:
  48. rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
  49. 0xfffff3ff));
  50. rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
  51. rtlphy->rfreg_chnlval[0]);
  52. break;
  53. default:
  54. RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
  55. "unknown bandwidth: %#X\n", bandwidth);
  56. break;
  57. }
  58. }
  59. void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
  60. u8 *ppowerlevel)
  61. {
  62. struct rtl_priv *rtlpriv = rtl_priv(hw);
  63. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  64. struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
  65. struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
  66. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  67. u32 tx_agc[2] = { 0, 0 }, tmpval = 0;
  68. bool turbo_scanoff = false;
  69. u8 idx1, idx2;
  70. u8 *ptr;
  71. if (rtlhal->interface == INTF_PCI) {
  72. if (rtlefuse->eeprom_regulatory != 0)
  73. turbo_scanoff = true;
  74. } else {
  75. if ((rtlefuse->eeprom_regulatory != 0) ||
  76. (rtlefuse->external_pa))
  77. turbo_scanoff = true;
  78. }
  79. if (mac->act_scanning) {
  80. tx_agc[RF90_PATH_A] = 0x3f3f3f3f;
  81. tx_agc[RF90_PATH_B] = 0x3f3f3f3f;
  82. if (turbo_scanoff) {
  83. for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
  84. tx_agc[idx1] = ppowerlevel[idx1] |
  85. (ppowerlevel[idx1] << 8) |
  86. (ppowerlevel[idx1] << 16) |
  87. (ppowerlevel[idx1] << 24);
  88. if (rtlhal->interface == INTF_USB) {
  89. if (tx_agc[idx1] > 0x20 &&
  90. rtlefuse->external_pa)
  91. tx_agc[idx1] = 0x20;
  92. }
  93. }
  94. }
  95. } else {
  96. if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  97. TXHIGHPWRLEVEL_LEVEL1) {
  98. tx_agc[RF90_PATH_A] = 0x10101010;
  99. tx_agc[RF90_PATH_B] = 0x10101010;
  100. } else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  101. TXHIGHPWRLEVEL_LEVEL2) {
  102. tx_agc[RF90_PATH_A] = 0x00000000;
  103. tx_agc[RF90_PATH_B] = 0x00000000;
  104. } else{
  105. for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
  106. tx_agc[idx1] = ppowerlevel[idx1] |
  107. (ppowerlevel[idx1] << 8) |
  108. (ppowerlevel[idx1] << 16) |
  109. (ppowerlevel[idx1] << 24);
  110. }
  111. if (rtlefuse->eeprom_regulatory == 0) {
  112. tmpval = (rtlphy->mcs_offset[0][6]) +
  113. (rtlphy->mcs_offset[0][7] << 8);
  114. tx_agc[RF90_PATH_A] += tmpval;
  115. tmpval = (rtlphy->mcs_offset[0][14]) +
  116. (rtlphy->mcs_offset[0][15] << 24);
  117. tx_agc[RF90_PATH_B] += tmpval;
  118. }
  119. }
  120. }
  121. for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
  122. ptr = (u8 *) (&(tx_agc[idx1]));
  123. for (idx2 = 0; idx2 < 4; idx2++) {
  124. if (*ptr > RF6052_MAX_TX_PWR)
  125. *ptr = RF6052_MAX_TX_PWR;
  126. ptr++;
  127. }
  128. }
  129. tmpval = tx_agc[RF90_PATH_A] & 0xff;
  130. rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval);
  131. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  132. "CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n",
  133. tmpval, RTXAGC_A_CCK1_MCS32);
  134. tmpval = tx_agc[RF90_PATH_A] >> 8;
  135. if (mac->mode == WIRELESS_MODE_B)
  136. tmpval = tmpval & 0xff00ffff;
  137. rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval);
  138. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  139. "CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n",
  140. tmpval, RTXAGC_B_CCK11_A_CCK2_11);
  141. tmpval = tx_agc[RF90_PATH_B] >> 24;
  142. rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval);
  143. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  144. "CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n",
  145. tmpval, RTXAGC_B_CCK11_A_CCK2_11);
  146. tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff;
  147. rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval);
  148. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  149. "CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n",
  150. tmpval, RTXAGC_B_CCK1_55_MCS32);
  151. }
  152. static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
  153. u8 *ppowerlevel, u8 channel,
  154. u32 *ofdmbase, u32 *mcsbase)
  155. {
  156. struct rtl_priv *rtlpriv = rtl_priv(hw);
  157. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  158. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  159. u32 powerBase0, powerBase1;
  160. u8 legacy_pwrdiff = 0, ht20_pwrdiff = 0;
  161. u8 i, powerlevel[2];
  162. for (i = 0; i < 2; i++) {
  163. powerlevel[i] = ppowerlevel[i];
  164. legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1];
  165. powerBase0 = powerlevel[i] + legacy_pwrdiff;
  166. powerBase0 = (powerBase0 << 24) | (powerBase0 << 16) |
  167. (powerBase0 << 8) | powerBase0;
  168. *(ofdmbase + i) = powerBase0;
  169. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  170. " [OFDM power base index rf(%c) = 0x%x]\n",
  171. i == 0 ? 'A' : 'B', *(ofdmbase + i));
  172. }
  173. for (i = 0; i < 2; i++) {
  174. if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) {
  175. ht20_pwrdiff = rtlefuse->txpwr_ht20diff[i][channel - 1];
  176. powerlevel[i] += ht20_pwrdiff;
  177. }
  178. powerBase1 = powerlevel[i];
  179. powerBase1 = (powerBase1 << 24) |
  180. (powerBase1 << 16) | (powerBase1 << 8) | powerBase1;
  181. *(mcsbase + i) = powerBase1;
  182. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  183. " [MCS power base index rf(%c) = 0x%x]\n",
  184. i == 0 ? 'A' : 'B', *(mcsbase + i));
  185. }
  186. }
  187. static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
  188. u8 channel, u8 index,
  189. u32 *powerBase0,
  190. u32 *powerBase1,
  191. u32 *p_outwriteval)
  192. {
  193. struct rtl_priv *rtlpriv = rtl_priv(hw);
  194. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  195. struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
  196. u8 i, chnlgroup = 0, pwr_diff_limit[4];
  197. u32 writeVal, customer_limit, rf;
  198. for (rf = 0; rf < 2; rf++) {
  199. switch (rtlefuse->eeprom_regulatory) {
  200. case 0:
  201. chnlgroup = 0;
  202. writeVal = rtlphy->mcs_offset
  203. [chnlgroup][index + (rf ? 8 : 0)]
  204. + ((index < 2) ? powerBase0[rf] : powerBase1[rf]);
  205. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  206. "RTK better performance,writeVal(%c) = 0x%x\n",
  207. rf == 0 ? 'A' : 'B', writeVal);
  208. break;
  209. case 1:
  210. if (rtlphy->pwrgroup_cnt == 1)
  211. chnlgroup = 0;
  212. if (rtlphy->pwrgroup_cnt >= 3) {
  213. if (channel <= 3)
  214. chnlgroup = 0;
  215. else if (channel >= 4 && channel <= 9)
  216. chnlgroup = 1;
  217. else if (channel > 9)
  218. chnlgroup = 2;
  219. if (rtlphy->current_chan_bw ==
  220. HT_CHANNEL_WIDTH_20)
  221. chnlgroup++;
  222. else
  223. chnlgroup += 4;
  224. }
  225. writeVal = rtlphy->mcs_offset[chnlgroup][index +
  226. (rf ? 8 : 0)] +
  227. ((index < 2) ? powerBase0[rf] :
  228. powerBase1[rf]);
  229. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  230. "Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n",
  231. rf == 0 ? 'A' : 'B', writeVal);
  232. break;
  233. case 2:
  234. writeVal = ((index < 2) ? powerBase0[rf] :
  235. powerBase1[rf]);
  236. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  237. "Better regulatory,writeVal(%c) = 0x%x\n",
  238. rf == 0 ? 'A' : 'B', writeVal);
  239. break;
  240. case 3:
  241. chnlgroup = 0;
  242. if (rtlphy->current_chan_bw ==
  243. HT_CHANNEL_WIDTH_20_40) {
  244. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  245. "customer's limit, 40MHzrf(%c) = 0x%x\n",
  246. rf == 0 ? 'A' : 'B',
  247. rtlefuse->pwrgroup_ht40[rf]
  248. [channel - 1]);
  249. } else {
  250. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  251. "customer's limit, 20MHz rf(%c) = 0x%x\n",
  252. rf == 0 ? 'A' : 'B',
  253. rtlefuse->pwrgroup_ht20[rf]
  254. [channel - 1]);
  255. }
  256. for (i = 0; i < 4; i++) {
  257. pwr_diff_limit[i] = (u8) ((rtlphy->mcs_offset
  258. [chnlgroup][index + (rf ? 8 : 0)]
  259. & (0x7f << (i * 8))) >> (i * 8));
  260. if (rtlphy->current_chan_bw ==
  261. HT_CHANNEL_WIDTH_20_40) {
  262. if (pwr_diff_limit[i] >
  263. rtlefuse->pwrgroup_ht40[rf]
  264. [channel - 1])
  265. pwr_diff_limit[i] = rtlefuse->
  266. pwrgroup_ht40[rf]
  267. [channel - 1];
  268. } else {
  269. if (pwr_diff_limit[i] >
  270. rtlefuse->pwrgroup_ht20[rf]
  271. [channel - 1])
  272. pwr_diff_limit[i] =
  273. rtlefuse->pwrgroup_ht20[rf]
  274. [channel - 1];
  275. }
  276. }
  277. customer_limit = (pwr_diff_limit[3] << 24) |
  278. (pwr_diff_limit[2] << 16) |
  279. (pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]);
  280. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  281. "Customer's limit rf(%c) = 0x%x\n",
  282. rf == 0 ? 'A' : 'B', customer_limit);
  283. writeVal = customer_limit + ((index < 2) ?
  284. powerBase0[rf] : powerBase1[rf]);
  285. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  286. "Customer, writeVal rf(%c)= 0x%x\n",
  287. rf == 0 ? 'A' : 'B', writeVal);
  288. break;
  289. default:
  290. chnlgroup = 0;
  291. writeVal = rtlphy->mcs_offset[chnlgroup]
  292. [index + (rf ? 8 : 0)] + ((index < 2) ?
  293. powerBase0[rf] : powerBase1[rf]);
  294. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  295. "RTK better performance, writeValrf(%c) = 0x%x\n",
  296. rf == 0 ? 'A' : 'B', writeVal);
  297. break;
  298. }
  299. if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  300. TXHIGHPWRLEVEL_LEVEL1)
  301. writeVal = 0x14141414;
  302. else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  303. TXHIGHPWRLEVEL_LEVEL2)
  304. writeVal = 0x00000000;
  305. if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1)
  306. writeVal = writeVal - 0x06060606;
  307. else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
  308. TXHIGHPWRLEVEL_BT2)
  309. writeVal = writeVal;
  310. *(p_outwriteval + rf) = writeVal;
  311. }
  312. }
  313. static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
  314. u8 index, u32 *pValue)
  315. {
  316. struct rtl_priv *rtlpriv = rtl_priv(hw);
  317. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  318. u16 regoffset_a[6] = {
  319. RTXAGC_A_RATE18_06, RTXAGC_A_RATE54_24,
  320. RTXAGC_A_MCS03_MCS00, RTXAGC_A_MCS07_MCS04,
  321. RTXAGC_A_MCS11_MCS08, RTXAGC_A_MCS15_MCS12
  322. };
  323. u16 regoffset_b[6] = {
  324. RTXAGC_B_RATE18_06, RTXAGC_B_RATE54_24,
  325. RTXAGC_B_MCS03_MCS00, RTXAGC_B_MCS07_MCS04,
  326. RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12
  327. };
  328. u8 i, rf, pwr_val[4];
  329. u32 writeVal;
  330. u16 regoffset;
  331. for (rf = 0; rf < 2; rf++) {
  332. writeVal = pValue[rf];
  333. for (i = 0; i < 4; i++) {
  334. pwr_val[i] = (u8)((writeVal & (0x7f << (i * 8))) >>
  335. (i * 8));
  336. if (pwr_val[i] > RF6052_MAX_TX_PWR)
  337. pwr_val[i] = RF6052_MAX_TX_PWR;
  338. }
  339. writeVal = (pwr_val[3] << 24) | (pwr_val[2] << 16) |
  340. (pwr_val[1] << 8) | pwr_val[0];
  341. if (rf == 0)
  342. regoffset = regoffset_a[index];
  343. else
  344. regoffset = regoffset_b[index];
  345. rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal);
  346. RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
  347. "Set 0x%x = %08x\n", regoffset, writeVal);
  348. if (((get_rf_type(rtlphy) == RF_2T2R) &&
  349. (regoffset == RTXAGC_A_MCS15_MCS12 ||
  350. regoffset == RTXAGC_B_MCS15_MCS12)) ||
  351. ((get_rf_type(rtlphy) != RF_2T2R) &&
  352. (regoffset == RTXAGC_A_MCS07_MCS04 ||
  353. regoffset == RTXAGC_B_MCS07_MCS04))) {
  354. writeVal = pwr_val[3];
  355. if (regoffset == RTXAGC_A_MCS15_MCS12 ||
  356. regoffset == RTXAGC_A_MCS07_MCS04)
  357. regoffset = 0xc90;
  358. if (regoffset == RTXAGC_B_MCS15_MCS12 ||
  359. regoffset == RTXAGC_B_MCS07_MCS04)
  360. regoffset = 0xc98;
  361. for (i = 0; i < 3; i++) {
  362. writeVal = (writeVal > 6) ? (writeVal - 6) : 0;
  363. rtl_write_byte(rtlpriv, (u32)(regoffset + i),
  364. (u8)writeVal);
  365. }
  366. }
  367. }
  368. }
  369. void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
  370. u8 *ppowerlevel, u8 channel)
  371. {
  372. u32 writeVal[2], powerBase0[2], powerBase1[2];
  373. u8 index = 0;
  374. rtl92c_phy_get_power_base(hw, ppowerlevel,
  375. channel, &powerBase0[0], &powerBase1[0]);
  376. for (index = 0; index < 6; index++) {
  377. _rtl92c_get_txpower_writeval_by_regulatory(hw,
  378. channel, index,
  379. &powerBase0[0],
  380. &powerBase1[0],
  381. &writeVal[0]);
  382. _rtl92c_write_ofdm_power_reg(hw, index, &writeVal[0]);
  383. }
  384. }
  385. bool rtl92cu_phy_rf6052_config(struct ieee80211_hw *hw)
  386. {
  387. struct rtl_priv *rtlpriv = rtl_priv(hw);
  388. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  389. bool rtstatus = true;
  390. u8 b_reg_hwparafile = 1;
  391. if (rtlphy->rf_type == RF_1T1R)
  392. rtlphy->num_total_rfpath = 1;
  393. else
  394. rtlphy->num_total_rfpath = 2;
  395. if (b_reg_hwparafile == 1)
  396. rtstatus = _rtl92c_phy_rf6052_config_parafile(hw);
  397. return rtstatus;
  398. }
  399. static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw)
  400. {
  401. struct rtl_priv *rtlpriv = rtl_priv(hw);
  402. struct rtl_phy *rtlphy = &(rtlpriv->phy);
  403. u32 u4_regvalue = 0;
  404. u8 rfpath;
  405. bool rtstatus = true;
  406. struct bb_reg_def *pphyreg;
  407. for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) {
  408. pphyreg = &rtlphy->phyreg_def[rfpath];
  409. switch (rfpath) {
  410. case RF90_PATH_A:
  411. case RF90_PATH_C:
  412. u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs,
  413. BRFSI_RFENV);
  414. break;
  415. case RF90_PATH_B:
  416. case RF90_PATH_D:
  417. u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs,
  418. BRFSI_RFENV << 16);
  419. break;
  420. }
  421. rtl_set_bbreg(hw, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1);
  422. udelay(1);
  423. rtl_set_bbreg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1);
  424. udelay(1);
  425. rtl_set_bbreg(hw, pphyreg->rfhssi_para2,
  426. B3WIREADDREAALENGTH, 0x0);
  427. udelay(1);
  428. rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0);
  429. udelay(1);
  430. switch (rfpath) {
  431. case RF90_PATH_A:
  432. rtstatus = rtl92cu_phy_config_rf_with_headerfile(hw,
  433. (enum radio_path) rfpath);
  434. break;
  435. case RF90_PATH_B:
  436. rtstatus = rtl92cu_phy_config_rf_with_headerfile(hw,
  437. (enum radio_path) rfpath);
  438. break;
  439. case RF90_PATH_C:
  440. break;
  441. case RF90_PATH_D:
  442. break;
  443. }
  444. switch (rfpath) {
  445. case RF90_PATH_A:
  446. case RF90_PATH_C:
  447. rtl_set_bbreg(hw, pphyreg->rfintfs,
  448. BRFSI_RFENV, u4_regvalue);
  449. break;
  450. case RF90_PATH_B:
  451. case RF90_PATH_D:
  452. rtl_set_bbreg(hw, pphyreg->rfintfs,
  453. BRFSI_RFENV << 16, u4_regvalue);
  454. break;
  455. }
  456. if (!rtstatus) {
  457. RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
  458. "Radio[%d] Fail!!", rfpath);
  459. goto phy_rf_cfg_fail;
  460. }
  461. }
  462. RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "<---\n");
  463. return rtstatus;
  464. phy_rf_cfg_fail:
  465. return rtstatus;
  466. }