rf.c 15 KB

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