rf.c 13.8 KB
Newer Older
L
Larry Finger 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/******************************************************************************
 *
 * Copyright(c) 2009-2012  Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * The full GNU General Public License is included in this distribution in the
 * file called LICENSE.
 *
 * Contact Information:
 * wlanfae <wlanfae@realtek.com>
 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
 * Hsinchu 300, Taiwan.
 *
 * Larry Finger <Larry.Finger@lwfinger.net>
 *
 *****************************************************************************/

#include "../wifi.h"
#include "reg.h"
#include "def.h"
#include "phy.h"
#include "rf.h"
#include "dm.h"

33 34 35
static bool _rtl8723e_phy_rf6052_config_parafile(struct ieee80211_hw *hw);

void rtl8723e_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
L
Larry Finger 已提交
36 37
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
38
	struct rtl_phy *rtlphy = &rtlpriv->phy;
L
Larry Finger 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

	switch (bandwidth) {
	case HT_CHANNEL_WIDTH_20:
		rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
					     0xfffff3ff) | 0x0400);
		rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
			      rtlphy->rfreg_chnlval[0]);
		break;
	case HT_CHANNEL_WIDTH_20_40:
		rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] &
					     0xfffff3ff));
		rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK,
			      rtlphy->rfreg_chnlval[0]);
		break;
	default:
		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
			 "unknown bandwidth: %#X\n", bandwidth);
		break;
	}
}

60 61
void rtl8723e_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
					 u8 *ppowerlevel)
L
Larry Finger 已提交
62 63
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
64
	struct rtl_phy *rtlphy = &rtlpriv->phy;
L
Larry Finger 已提交
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
	struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
	u32 tx_agc[2] = {0, 0}, tmpval;
	bool turbo_scanoff = false;
	u8 idx1, idx2;
	u8 *ptr;

	if (rtlefuse->eeprom_regulatory != 0)
		turbo_scanoff = true;

	if (mac->act_scanning == true) {
		tx_agc[RF90_PATH_A] = 0x3f3f3f3f;
		tx_agc[RF90_PATH_B] = 0x3f3f3f3f;

		if (turbo_scanoff) {
80 81
			for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B;
				idx1++) {
L
Larry Finger 已提交
82 83 84 85 86 87 88 89 90
				tx_agc[idx1] = ppowerlevel[idx1] |
				    (ppowerlevel[idx1] << 8) |
				    (ppowerlevel[idx1] << 16) |
				    (ppowerlevel[idx1] << 24);
			}
		}
	} else {
		for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
			tx_agc[idx1] = ppowerlevel[idx1] |
91 92 93
			    (ppowerlevel[idx1] << 8) |
			    (ppowerlevel[idx1] << 16) |
			    (ppowerlevel[idx1] << 24);
L
Larry Finger 已提交
94 95 96
		}

		if (rtlefuse->eeprom_regulatory == 0) {
97 98 99 100
			tmpval =
			    (rtlphy->mcs_txpwrlevel_origoffset[0][6]) +
			    (rtlphy->mcs_txpwrlevel_origoffset[0][7] <<
			     8);
L
Larry Finger 已提交
101 102
			tx_agc[RF90_PATH_A] += tmpval;

103 104 105
			tmpval = (rtlphy->mcs_txpwrlevel_origoffset[0][14]) +
			    (rtlphy->mcs_txpwrlevel_origoffset[0][15] <<
			     24);
L
Larry Finger 已提交
106 107 108 109 110
			tx_agc[RF90_PATH_B] += tmpval;
		}
	}

	for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) {
111
		ptr = (u8 *)&tx_agc[idx1];
L
Larry Finger 已提交
112 113 114 115 116 117 118 119 120 121 122 123
		for (idx2 = 0; idx2 < 4; idx2++) {
			if (*ptr > RF6052_MAX_TX_PWR)
				*ptr = RF6052_MAX_TX_PWR;
			ptr++;
		}
	}

	tmpval = tx_agc[RF90_PATH_A] & 0xff;
	rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval);

	RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
		"CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", tmpval,
124
		 RTXAGC_A_CCK1_MCS32);
L
Larry Finger 已提交
125 126 127 128 129 130 131 132 133

	tmpval = tx_agc[RF90_PATH_A] >> 8;

	tmpval = tmpval & 0xff00ffff;

	rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval);

	RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
		"CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", tmpval,
134
		 RTXAGC_B_CCK11_A_CCK2_11);
L
Larry Finger 已提交
135 136 137 138 139 140

	tmpval = tx_agc[RF90_PATH_B] >> 24;
	rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval);

	RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
		"CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", tmpval,
141
		 RTXAGC_B_CCK11_A_CCK2_11);
L
Larry Finger 已提交
142 143 144 145 146 147

	tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff;
	rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval);

	RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
		"CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n", tmpval,
148
		 RTXAGC_B_CCK1_55_MCS32);
L
Larry Finger 已提交
149 150
}

151 152 153
static void rtl8723e_phy_get_power_base(struct ieee80211_hw *hw,
					u8 *ppowerlevel, u8 channel,
					u32 *ofdmbase, u32 *mcsbase)
L
Larry Finger 已提交
154 155
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
156
	struct rtl_phy *rtlphy = &rtlpriv->phy;
L
Larry Finger 已提交
157
	struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
158
	u32 powerbase0, powerbase1;
L
Larry Finger 已提交
159 160 161 162 163 164
	u8 legacy_pwrdiff, ht20_pwrdiff;
	u8 i, powerlevel[2];

	for (i = 0; i < 2; i++) {
		powerlevel[i] = ppowerlevel[i];
		legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1];
165
		powerbase0 = powerlevel[i] + legacy_pwrdiff;
L
Larry Finger 已提交
166

167 168 169
		powerbase0 = (powerbase0 << 24) | (powerbase0 << 16) |
		    (powerbase0 << 8) | powerbase0;
		*(ofdmbase + i) = powerbase0;
L
Larry Finger 已提交
170 171
		RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
			" [OFDM power base index rf(%c) = 0x%x]\n",
172
			 ((i == 0) ? 'A' : 'B'), *(ofdmbase + i));
L
Larry Finger 已提交
173 174 175 176
	}

	for (i = 0; i < 2; i++) {
		if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) {
177 178
			ht20_pwrdiff =
				rtlefuse->txpwr_ht20diff[i][channel - 1];
L
Larry Finger 已提交
179 180
			powerlevel[i] += ht20_pwrdiff;
		}
181 182 183
		powerbase1 = powerlevel[i];
		powerbase1 = (powerbase1 << 24) |
		    (powerbase1 << 16) | (powerbase1 << 8) | powerbase1;
L
Larry Finger 已提交
184

185
		*(mcsbase + i) = powerbase1;
L
Larry Finger 已提交
186 187 188

		RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
			" [MCS power base index rf(%c) = 0x%x]\n",
189
			 ((i == 0) ? 'A' : 'B'), *(mcsbase + i));
L
Larry Finger 已提交
190 191 192
	}
}

193 194 195 196 197
static void get_txpower_writeval_by_reg(struct ieee80211_hw *hw,
					u8 channel, u8 index,
					u32 *powerbase0,
					u32 *powerbase1,
					u32 *p_outwriteval)
L
Larry Finger 已提交
198 199
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
200
	struct rtl_phy *rtlphy = &rtlpriv->phy;
L
Larry Finger 已提交
201 202
	struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
	u8 i, chnlgroup = 0, pwr_diff_limit[4];
203
	u32 writeval, customer_limit, rf;
L
Larry Finger 已提交
204 205 206 207 208 209

	for (rf = 0; rf < 2; rf++) {
		switch (rtlefuse->eeprom_regulatory) {
		case 0:
			chnlgroup = 0;

210 211 212 213
			writeval =
			    rtlphy->mcs_txpwrlevel_origoffset[chnlgroup][index +
								(rf ? 8 : 0)]
			    + ((index < 2) ? powerbase0[rf] : powerbase1[rf]);
L
Larry Finger 已提交
214 215

			RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
216 217
				"RTK better performance, writeval(%c) = 0x%x\n",
				((rf == 0) ? 'A' : 'B'), writeval);
L
Larry Finger 已提交
218 219 220
			break;
		case 1:
			if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
221 222
				writeval = ((index < 2) ? powerbase0[rf] :
					    powerbase1[rf]);
L
Larry Finger 已提交
223 224

				RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
225 226
					"Realtek regulatory, 40MHz, writeval(%c) = 0x%x\n",
					((rf == 0) ? 'A' : 'B'), writeval);
L
Larry Finger 已提交
227 228 229 230 231 232 233 234 235 236 237
			} else {
				if (rtlphy->pwrgroup_cnt == 1)
					chnlgroup = 0;
				if (rtlphy->pwrgroup_cnt >= 3) {
					if (channel <= 3)
						chnlgroup = 0;
					else if (channel >= 4 && channel <= 9)
						chnlgroup = 1;
					else if (channel > 9)
						chnlgroup = 2;
					if (rtlphy->current_chan_bw ==
238
						HT_CHANNEL_WIDTH_20)
L
Larry Finger 已提交
239 240 241 242 243
						chnlgroup++;
					else
						chnlgroup += 4;
				}

244 245
				writeval =
				    rtlphy->mcs_txpwrlevel_origoffset[chnlgroup]
L
Larry Finger 已提交
246
				    [index + (rf ? 8 : 0)] + ((index < 2) ?
247 248
							      powerbase0[rf] :
							      powerbase1[rf]);
L
Larry Finger 已提交
249 250

				RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
251 252
					"Realtek regulatory, 20MHz, writeval(%c) = 0x%x\n",
					((rf == 0) ? 'A' : 'B'), writeval);
L
Larry Finger 已提交
253 254 255
			}
			break;
		case 2:
256 257
			writeval =
			    ((index < 2) ? powerbase0[rf] : powerbase1[rf]);
L
Larry Finger 已提交
258 259

			RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
260 261
				"Better regulatory, writeval(%c) = 0x%x\n",
				((rf == 0) ? 'A' : 'B'), writeval);
L
Larry Finger 已提交
262 263 264 265 266 267 268 269
			break;
		case 3:
			chnlgroup = 0;

			if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
				RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
					"customer's limit, 40MHz rf(%c) = 0x%x\n",
					((rf == 0) ? 'A' : 'B'),
270 271
					rtlefuse->pwrgroup_ht40[rf][channel -
								     1]);
L
Larry Finger 已提交
272 273 274 275
			} else {
				RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
					"customer's limit, 20MHz rf(%c) = 0x%x\n",
					((rf == 0) ? 'A' : 'B'),
276 277
					rtlefuse->pwrgroup_ht20[rf][channel -
								     1]);
L
Larry Finger 已提交
278 279 280
			}
			for (i = 0; i < 4; i++) {
				pwr_diff_limit[i] =
281 282 283 284
				    (u8)((rtlphy->mcs_txpwrlevel_origoffset
					  [chnlgroup][index +
						(rf ? 8 : 0)] & (0x7f <<
						(i * 8))) >> (i * 8));
L
Larry Finger 已提交
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309

				if (rtlphy->current_chan_bw ==
				    HT_CHANNEL_WIDTH_20_40) {
					if (pwr_diff_limit[i] >
					    rtlefuse->
					    pwrgroup_ht40[rf][channel - 1])
						pwr_diff_limit[i] =
						    rtlefuse->pwrgroup_ht40[rf]
						    [channel - 1];
				} else {
					if (pwr_diff_limit[i] >
					    rtlefuse->
					    pwrgroup_ht20[rf][channel - 1])
						pwr_diff_limit[i] =
						    rtlefuse->pwrgroup_ht20[rf]
						    [channel - 1];
				}
			}

			customer_limit = (pwr_diff_limit[3] << 24) |
			    (pwr_diff_limit[2] << 16) |
			    (pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]);

			RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
				"Customer's limit rf(%c) = 0x%x\n",
310
				 ((rf == 0) ? 'A' : 'B'), customer_limit);
L
Larry Finger 已提交
311

312 313
			writeval = customer_limit +
			    ((index < 2) ? powerbase0[rf] : powerbase1[rf]);
L
Larry Finger 已提交
314 315

			RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
316 317
				"Customer, writeval rf(%c)= 0x%x\n",
				 ((rf == 0) ? 'A' : 'B'), writeval);
L
Larry Finger 已提交
318 319 320
			break;
		default:
			chnlgroup = 0;
321 322 323 324
			writeval =
			    rtlphy->mcs_txpwrlevel_origoffset[chnlgroup]
			    [index + (rf ? 8 : 0)]
			    + ((index < 2) ? powerbase0[rf] : powerbase1[rf]);
L
Larry Finger 已提交
325 326

			RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
327 328
				"RTK better performance, writeval rf(%c) = 0x%x\n",
				((rf == 0) ? 'A' : 'B'), writeval);
L
Larry Finger 已提交
329 330 331 332
			break;
		}

		if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1)
333
			writeval = writeval - 0x06060606;
L
Larry Finger 已提交
334 335
		else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
			 TXHIGHPWRLEVEL_BT2)
336 337
			writeval = writeval - 0x0c0c0c0c;
		*(p_outwriteval + rf) = writeval;
L
Larry Finger 已提交
338 339 340
	}
}

341 342
static void _rtl8723e_write_ofdm_power_reg(struct ieee80211_hw *hw,
					   u8 index, u32 *pvalue)
L
Larry Finger 已提交
343 344
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
345
	struct rtl_phy *rtlphy = &rtlpriv->phy;
L
Larry Finger 已提交
346 347 348 349 350 351 352 353 354 355 356 357

	u16 regoffset_a[6] = {
		RTXAGC_A_RATE18_06, RTXAGC_A_RATE54_24,
		RTXAGC_A_MCS03_MCS00, RTXAGC_A_MCS07_MCS04,
		RTXAGC_A_MCS11_MCS08, RTXAGC_A_MCS15_MCS12
	};
	u16 regoffset_b[6] = {
		RTXAGC_B_RATE18_06, RTXAGC_B_RATE54_24,
		RTXAGC_B_MCS03_MCS00, RTXAGC_B_MCS07_MCS04,
		RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12
	};
	u8 i, rf, pwr_val[4];
358
	u32 writeval;
L
Larry Finger 已提交
359 360 361
	u16 regoffset;

	for (rf = 0; rf < 2; rf++) {
362
		writeval = pvalue[rf];
L
Larry Finger 已提交
363
		for (i = 0; i < 4; i++) {
364 365
			pwr_val[i] = (u8)((writeval & (0x7f <<
					   (i * 8))) >> (i * 8));
L
Larry Finger 已提交
366 367 368 369

			if (pwr_val[i] > RF6052_MAX_TX_PWR)
				pwr_val[i] = RF6052_MAX_TX_PWR;
		}
370
		writeval = (pwr_val[3] << 24) | (pwr_val[2] << 16) |
L
Larry Finger 已提交
371 372 373 374 375 376
		    (pwr_val[1] << 8) | pwr_val[0];

		if (rf == 0)
			regoffset = regoffset_a[index];
		else
			regoffset = regoffset_b[index];
377
		rtl_set_bbreg(hw, regoffset, MASKDWORD, writeval);
L
Larry Finger 已提交
378 379

		RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
380
			"Set 0x%x = %08x\n", regoffset, writeval);
L
Larry Finger 已提交
381 382 383 384 385 386 387 388

		if (((get_rf_type(rtlphy) == RF_2T2R) &&
		     (regoffset == RTXAGC_A_MCS15_MCS12 ||
		      regoffset == RTXAGC_B_MCS15_MCS12)) ||
		    ((get_rf_type(rtlphy) != RF_2T2R) &&
		     (regoffset == RTXAGC_A_MCS07_MCS04 ||
		      regoffset == RTXAGC_B_MCS07_MCS04))) {

389
			writeval = pwr_val[3];
L
Larry Finger 已提交
390 391 392 393 394 395 396 397
			if (regoffset == RTXAGC_A_MCS15_MCS12 ||
			    regoffset == RTXAGC_A_MCS07_MCS04)
				regoffset = 0xc90;
			if (regoffset == RTXAGC_B_MCS15_MCS12 ||
			    regoffset == RTXAGC_B_MCS07_MCS04)
				regoffset = 0xc98;

			for (i = 0; i < 3; i++) {
398
				writeval = (writeval > 6) ? (writeval - 6) : 0;
L
Larry Finger 已提交
399
				rtl_write_byte(rtlpriv, (u32) (regoffset + i),
400
					       (u8)writeval);
L
Larry Finger 已提交
401 402 403 404 405
			}
		}
	}
}

406 407
void rtl8723e_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
					  u8 *ppowerlevel, u8 channel)
L
Larry Finger 已提交
408
{
409
	u32 writeval[2], powerbase0[2], powerbase1[2];
L
Larry Finger 已提交
410 411
	u8 index;

412 413
	rtl8723e_phy_get_power_base(hw, ppowerlevel,
				    channel, &powerbase0[0], &powerbase1[0]);
L
Larry Finger 已提交
414 415

	for (index = 0; index < 6; index++) {
416 417 418
		get_txpower_writeval_by_reg(hw, channel, index, &powerbase0[0],
					    &powerbase1[0],
					    &writeval[0]);
L
Larry Finger 已提交
419

420
		_rtl8723e_write_ofdm_power_reg(hw, index, &writeval[0]);
L
Larry Finger 已提交
421 422 423
	}
}

424
bool rtl8723e_phy_rf6052_config(struct ieee80211_hw *hw)
L
Larry Finger 已提交
425 426
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
427 428 429 430 431 432 433 434 435 436 437 438 439 440
	struct rtl_phy *rtlphy = &rtlpriv->phy;

	if (rtlphy->rf_type == RF_1T1R)
		rtlphy->num_total_rfpath = 1;
	else
		rtlphy->num_total_rfpath = 2;

	return _rtl8723e_phy_rf6052_config_parafile(hw);
}

static bool _rtl8723e_phy_rf6052_config_parafile(struct ieee80211_hw *hw)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_phy *rtlphy = &rtlpriv->phy;
L
Larry Finger 已提交
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
	u32 u4_regvalue = 0;
	u8 rfpath;
	bool rtstatus = true;
	struct bb_reg_def *pphyreg;

	for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) {

		pphyreg = &rtlphy->phyreg_def[rfpath];

		switch (rfpath) {
		case RF90_PATH_A:
		case RF90_PATH_C:
			u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs,
						    BRFSI_RFENV);
			break;
		case RF90_PATH_B:
		case RF90_PATH_D:
			u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs,
						    BRFSI_RFENV << 16);
			break;
		}

		rtl_set_bbreg(hw, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1);
		udelay(1);

		rtl_set_bbreg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1);
		udelay(1);

		rtl_set_bbreg(hw, pphyreg->rfhssi_para2,
			      B3WIREADDREAALENGTH, 0x0);
		udelay(1);

		rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0);
		udelay(1);

		switch (rfpath) {
		case RF90_PATH_A:
478
			rtstatus = rtl8723e_phy_config_rf_with_headerfile(hw,
L
Larry Finger 已提交
479 480 481
						(enum radio_path)rfpath);
			break;
		case RF90_PATH_B:
482 483
			rtstatus =
			  rtl8723e_phy_config_rf_with_headerfile(hw,
L
Larry Finger 已提交
484 485 486 487 488 489 490
						(enum radio_path)rfpath);
			break;
		case RF90_PATH_C:
			break;
		case RF90_PATH_D:
			break;
		}
491

L
Larry Finger 已提交
492 493 494 495 496 497 498 499 500 501 502 503
		switch (rfpath) {
		case RF90_PATH_A:
		case RF90_PATH_C:
			rtl_set_bbreg(hw, pphyreg->rfintfs,
				      BRFSI_RFENV, u4_regvalue);
			break;
		case RF90_PATH_B:
		case RF90_PATH_D:
			rtl_set_bbreg(hw, pphyreg->rfintfs,
				      BRFSI_RFENV << 16, u4_regvalue);
			break;
		}
504

L
Larry Finger 已提交
505 506 507 508 509 510 511
		if (rtstatus != true) {
			RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
				 "Radio[%d] Fail!!", rfpath);
			return false;
		}
	}

512 513
	RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "\n");
	return rtstatus;
L
Larry Finger 已提交
514
}