1 /******************************************************************************
3 * Copyright(c) 2009-2012 Realtek Corporation.
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.
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
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
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
26 * Larry Finger <Larry.Finger@lwfinger.net>
28 *****************************************************************************/
38 void rtl92d_phy_rf6052_set_bandwidth(struct ieee80211_hw
*hw
, u8 bandwidth
)
40 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
41 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
45 case HT_CHANNEL_WIDTH_20
:
46 for (rfpath
= 0; rfpath
< rtlphy
->num_total_rfpath
; rfpath
++) {
47 rtlphy
->rfreg_chnlval
[rfpath
] = ((rtlphy
->rfreg_chnlval
48 [rfpath
] & 0xfffff3ff) | 0x0400);
49 rtl_set_rfreg(hw
, rfpath
, RF_CHNLBW
, BIT(10) |
52 RT_TRACE(rtlpriv
, COMP_RF
, DBG_LOUD
,
53 "20M RF 0x18 = 0x%x\n",
54 rtlphy
->rfreg_chnlval
[rfpath
]);
58 case HT_CHANNEL_WIDTH_20_40
:
59 for (rfpath
= 0; rfpath
< rtlphy
->num_total_rfpath
; rfpath
++) {
60 rtlphy
->rfreg_chnlval
[rfpath
] =
61 ((rtlphy
->rfreg_chnlval
[rfpath
] & 0xfffff3ff));
62 rtl_set_rfreg(hw
, rfpath
, RF_CHNLBW
, BIT(10) | BIT(11),
64 RT_TRACE(rtlpriv
, COMP_RF
, DBG_LOUD
,
65 "40M RF 0x18 = 0x%x\n",
66 rtlphy
->rfreg_chnlval
[rfpath
]);
70 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_EMERG
,
71 "unknown bandwidth: %#X\n", bandwidth
);
76 void rtl92d_phy_rf6052_set_cck_txpower(struct ieee80211_hw
*hw
,
79 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
80 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
81 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
82 struct rtl_efuse
*rtlefuse
= rtl_efuse(rtl_priv(hw
));
83 u32 tx_agc
[2] = {0, 0}, tmpval
;
84 bool turbo_scanoff
= false;
88 if (rtlefuse
->eeprom_regulatory
!= 0)
90 if (mac
->act_scanning
) {
91 tx_agc
[RF90_PATH_A
] = 0x3f3f3f3f;
92 tx_agc
[RF90_PATH_B
] = 0x3f3f3f3f;
94 for (idx1
= RF90_PATH_A
; idx1
<= RF90_PATH_B
; idx1
++) {
95 tx_agc
[idx1
] = ppowerlevel
[idx1
] |
96 (ppowerlevel
[idx1
] << 8) |
97 (ppowerlevel
[idx1
] << 16) |
98 (ppowerlevel
[idx1
] << 24);
102 for (idx1
= RF90_PATH_A
; idx1
<= RF90_PATH_B
; idx1
++) {
103 tx_agc
[idx1
] = ppowerlevel
[idx1
] |
104 (ppowerlevel
[idx1
] << 8) |
105 (ppowerlevel
[idx1
] << 16) |
106 (ppowerlevel
[idx1
] << 24);
108 if (rtlefuse
->eeprom_regulatory
== 0) {
109 tmpval
= (rtlphy
->mcs_offset
[0][6]) +
110 (rtlphy
->mcs_offset
[0][7] << 8);
111 tx_agc
[RF90_PATH_A
] += tmpval
;
112 tmpval
= (rtlphy
->mcs_offset
[0][14]) +
113 (rtlphy
->mcs_offset
[0][15] << 24);
114 tx_agc
[RF90_PATH_B
] += tmpval
;
118 for (idx1
= RF90_PATH_A
; idx1
<= RF90_PATH_B
; idx1
++) {
119 ptr
= (u8
*) (&(tx_agc
[idx1
]));
120 for (idx2
= 0; idx2
< 4; idx2
++) {
121 if (*ptr
> RF6052_MAX_TX_PWR
)
122 *ptr
= RF6052_MAX_TX_PWR
;
127 tmpval
= tx_agc
[RF90_PATH_A
] & 0xff;
128 rtl_set_bbreg(hw
, RTXAGC_A_CCK1_MCS32
, BMASKBYTE1
, 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 rtl_set_bbreg(hw
, RTXAGC_B_CCK11_A_CCK2_11
, 0xffffff00, tmpval
);
134 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
135 "CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n",
136 tmpval
, RTXAGC_B_CCK11_A_CCK2_11
);
137 tmpval
= tx_agc
[RF90_PATH_B
] >> 24;
138 rtl_set_bbreg(hw
, RTXAGC_B_CCK11_A_CCK2_11
, BMASKBYTE0
, tmpval
);
139 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
140 "CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n",
141 tmpval
, RTXAGC_B_CCK11_A_CCK2_11
);
142 tmpval
= tx_agc
[RF90_PATH_B
] & 0x00ffffff;
143 rtl_set_bbreg(hw
, RTXAGC_B_CCK1_55_MCS32
, 0xffffff00, tmpval
);
144 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
145 "CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n",
146 tmpval
, RTXAGC_B_CCK1_55_MCS32
);
149 static void _rtl92d_phy_get_power_base(struct ieee80211_hw
*hw
,
150 u8
*ppowerlevel
, u8 channel
,
151 u32
*ofdmbase
, u32
*mcsbase
)
153 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
154 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
155 struct rtl_efuse
*rtlefuse
= rtl_efuse(rtl_priv(hw
));
156 u32 powerbase0
, powerbase1
;
157 u8 legacy_pwrdiff
, ht20_pwrdiff
;
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
));
172 for (i
= 0; i
< 2; i
++) {
173 if (rtlphy
->current_chan_bw
== HT_CHANNEL_WIDTH_20
) {
174 ht20_pwrdiff
= rtlefuse
->txpwr_ht20diff
[i
][channel
- 1];
175 powerlevel
[i
] += ht20_pwrdiff
;
177 powerbase1
= powerlevel
[i
];
178 powerbase1
= (powerbase1
<< 24) | (powerbase1
<< 16) |
179 (powerbase1
<< 8) | powerbase1
;
180 *(mcsbase
+ i
) = powerbase1
;
181 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
182 " [MCS power base index rf(%c) = 0x%x]\n",
183 i
== 0 ? 'A' : 'B', *(mcsbase
+ i
));
187 static u8
_rtl92d_phy_get_chnlgroup_bypg(u8 chnlindex
)
190 u8 channel_info
[59] = {
191 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
192 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
193 60, 62, 64, 100, 102, 104, 106, 108, 110, 112,
194 114, 116, 118, 120, 122, 124, 126, 128, 130, 132,
195 134, 136, 138, 140, 149, 151, 153, 155, 157, 159,
199 if (channel_info
[chnlindex
] <= 3) /* Chanel 1-3 */
201 else if (channel_info
[chnlindex
] <= 9) /* Channel 4-9 */
203 else if (channel_info
[chnlindex
] <= 14) /* Channel 10-14 */
205 else if (channel_info
[chnlindex
] <= 64)
207 else if (channel_info
[chnlindex
] <= 140)
214 static void _rtl92d_get_txpower_writeval_by_regulatory(struct ieee80211_hw
*hw
,
215 u8 channel
, u8 index
,
220 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
221 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
222 struct rtl_efuse
*rtlefuse
= rtl_efuse(rtl_priv(hw
));
223 u8 i
, chnlgroup
= 0, pwr_diff_limit
[4];
224 u32 writeval
= 0, customer_limit
, rf
;
226 for (rf
= 0; rf
< 2; rf
++) {
227 switch (rtlefuse
->eeprom_regulatory
) {
230 writeval
= rtlphy
->mcs_offset
232 (rf
? 8 : 0)] + ((index
< 2) ?
235 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
236 "RTK better performance, writeval(%c) = 0x%x\n",
237 rf
== 0 ? 'A' : 'B', writeval
);
240 if (rtlphy
->pwrgroup_cnt
== 1)
242 if (rtlphy
->pwrgroup_cnt
>= MAX_PG_GROUP
) {
243 chnlgroup
= _rtl92d_phy_get_chnlgroup_bypg(
245 if (rtlphy
->current_chan_bw
==
250 writeval
= rtlphy
->mcs_offset
252 (rf
? 8 : 0)] + ((index
< 2) ?
255 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
256 "Realtek regulatory, 20MHz, writeval(%c) = 0x%x\n",
257 rf
== 0 ? 'A' : 'B', writeval
);
261 writeval
= ((index
< 2) ? powerbase0
[rf
] :
263 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
264 "Better regulatory, writeval(%c) = 0x%x\n",
265 rf
== 0 ? 'A' : 'B', writeval
);
269 if (rtlphy
->current_chan_bw
== HT_CHANNEL_WIDTH_20_40
) {
270 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
271 "customer's limit, 40MHz rf(%c) = 0x%x\n",
273 rtlefuse
->pwrgroup_ht40
[rf
]
276 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
277 "customer's limit, 20MHz rf(%c) = 0x%x\n",
279 rtlefuse
->pwrgroup_ht20
[rf
]
282 for (i
= 0; i
< 4; i
++) {
283 pwr_diff_limit
[i
] = (u8
)((rtlphy
->mcs_offset
284 [chnlgroup
][index
+ (rf
? 8 : 0)] &
285 (0x7f << (i
* 8))) >> (i
* 8));
286 if (rtlphy
->current_chan_bw
==
287 HT_CHANNEL_WIDTH_20_40
) {
288 if (pwr_diff_limit
[i
] >
289 rtlefuse
->pwrgroup_ht40
[rf
]
292 rtlefuse
->pwrgroup_ht40
295 if (pwr_diff_limit
[i
] >
296 rtlefuse
->pwrgroup_ht20
[rf
][
299 rtlefuse
->pwrgroup_ht20
[rf
]
303 customer_limit
= (pwr_diff_limit
[3] << 24) |
304 (pwr_diff_limit
[2] << 16) |
305 (pwr_diff_limit
[1] << 8) |
307 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
308 "Customer's limit rf(%c) = 0x%x\n",
309 rf
== 0 ? 'A' : 'B', customer_limit
);
310 writeval
= customer_limit
+ ((index
< 2) ?
311 powerbase0
[rf
] : powerbase1
[rf
]);
312 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
313 "Customer, writeval rf(%c)= 0x%x\n",
314 rf
== 0 ? 'A' : 'B', writeval
);
318 writeval
= rtlphy
->mcs_offset
[chnlgroup
][index
+
319 (rf
? 8 : 0)] + ((index
< 2) ?
320 powerbase0
[rf
] : powerbase1
[rf
]);
321 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
322 "RTK better performance, writeval rf(%c) = 0x%x\n",
323 rf
== 0 ? 'A' : 'B', writeval
);
326 *(p_outwriteval
+ rf
) = writeval
;
330 static void _rtl92d_write_ofdm_power_reg(struct ieee80211_hw
*hw
,
331 u8 index
, u32
*pvalue
)
333 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
334 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
335 static u16 regoffset_a
[6] = {
336 RTXAGC_A_RATE18_06
, RTXAGC_A_RATE54_24
,
337 RTXAGC_A_MCS03_MCS00
, RTXAGC_A_MCS07_MCS04
,
338 RTXAGC_A_MCS11_MCS08
, RTXAGC_A_MCS15_MCS12
340 static u16 regoffset_b
[6] = {
341 RTXAGC_B_RATE18_06
, RTXAGC_B_RATE54_24
,
342 RTXAGC_B_MCS03_MCS00
, RTXAGC_B_MCS07_MCS04
,
343 RTXAGC_B_MCS11_MCS08
, RTXAGC_B_MCS15_MCS12
345 u8 i
, rf
, pwr_val
[4];
349 for (rf
= 0; rf
< 2; rf
++) {
350 writeval
= pvalue
[rf
];
351 for (i
= 0; i
< 4; i
++) {
352 pwr_val
[i
] = (u8
) ((writeval
& (0x7f <<
353 (i
* 8))) >> (i
* 8));
354 if (pwr_val
[i
] > RF6052_MAX_TX_PWR
)
355 pwr_val
[i
] = RF6052_MAX_TX_PWR
;
357 writeval
= (pwr_val
[3] << 24) | (pwr_val
[2] << 16) |
358 (pwr_val
[1] << 8) | pwr_val
[0];
360 regoffset
= regoffset_a
[index
];
362 regoffset
= regoffset_b
[index
];
363 rtl_set_bbreg(hw
, regoffset
, BMASKDWORD
, writeval
);
364 RTPRINT(rtlpriv
, FPHY
, PHY_TXPWR
,
365 "Set 0x%x = %08x\n", regoffset
, writeval
);
366 if (((get_rf_type(rtlphy
) == RF_2T2R
) &&
367 (regoffset
== RTXAGC_A_MCS15_MCS12
||
368 regoffset
== RTXAGC_B_MCS15_MCS12
)) ||
369 ((get_rf_type(rtlphy
) != RF_2T2R
) &&
370 (regoffset
== RTXAGC_A_MCS07_MCS04
||
371 regoffset
== RTXAGC_B_MCS07_MCS04
))) {
372 writeval
= pwr_val
[3];
373 if (regoffset
== RTXAGC_A_MCS15_MCS12
||
374 regoffset
== RTXAGC_A_MCS07_MCS04
)
376 if (regoffset
== RTXAGC_B_MCS15_MCS12
||
377 regoffset
== RTXAGC_B_MCS07_MCS04
)
379 for (i
= 0; i
< 3; i
++) {
381 writeval
= (writeval
> 8) ?
384 writeval
= (writeval
> 6) ?
386 rtl_write_byte(rtlpriv
, (u32
) (regoffset
+ i
),
393 void rtl92d_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw
*hw
,
394 u8
*ppowerlevel
, u8 channel
)
396 u32 writeval
[2], powerbase0
[2], powerbase1
[2];
399 _rtl92d_phy_get_power_base(hw
, ppowerlevel
, channel
,
400 &powerbase0
[0], &powerbase1
[0]);
401 for (index
= 0; index
< 6; index
++) {
402 _rtl92d_get_txpower_writeval_by_regulatory(hw
,
403 channel
, index
, &powerbase0
[0],
404 &powerbase1
[0], &writeval
[0]);
405 _rtl92d_write_ofdm_power_reg(hw
, index
, &writeval
[0]);
409 bool rtl92d_phy_enable_anotherphy(struct ieee80211_hw
*hw
, bool bmac0
)
411 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
412 struct rtl_hal
*rtlhal
= &(rtlpriv
->rtlhal
);
414 u8 direct
= bmac0
? BIT(3) | BIT(2) : BIT(3);
415 u8 mac_reg
= bmac0
? REG_MAC1
: REG_MAC0
;
416 u8 mac_on_bit
= bmac0
? MAC1_ON
: MAC0_ON
;
417 bool bresult
= true; /* true: need to enable BB/RF power */
419 rtlhal
->during_mac0init_radiob
= false;
420 rtlhal
->during_mac1init_radioa
= false;
421 RT_TRACE(rtlpriv
, COMP_RF
, DBG_LOUD
, "===>\n");
422 /* MAC0 Need PHY1 load radio_b.txt . Driver use DBI to write. */
423 u1btmp
= rtl_read_byte(rtlpriv
, mac_reg
);
424 if (!(u1btmp
& mac_on_bit
)) {
425 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_LOUD
, "enable BB & RF\n");
426 /* Enable BB and RF power */
427 rtl92de_write_dword_dbi(hw
, REG_SYS_ISO_CTRL
,
428 rtl92de_read_dword_dbi(hw
, REG_SYS_ISO_CTRL
, direct
) |
429 BIT(29) | BIT(16) | BIT(17), direct
);
431 /* We think if MAC1 is ON,then radio_a.txt
432 * and radio_b.txt has been load. */
435 RT_TRACE(rtlpriv
, COMP_RF
, DBG_LOUD
, "<===\n");
440 void rtl92d_phy_powerdown_anotherphy(struct ieee80211_hw
*hw
, bool bmac0
)
442 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
443 struct rtl_hal
*rtlhal
= &(rtlpriv
->rtlhal
);
445 u8 direct
= bmac0
? BIT(3) | BIT(2) : BIT(3);
446 u8 mac_reg
= bmac0
? REG_MAC1
: REG_MAC0
;
447 u8 mac_on_bit
= bmac0
? MAC1_ON
: MAC0_ON
;
449 rtlhal
->during_mac0init_radiob
= false;
450 rtlhal
->during_mac1init_radioa
= false;
451 RT_TRACE(rtlpriv
, COMP_RF
, DBG_LOUD
, "====>\n");
452 /* check MAC0 enable or not again now, if
453 * enabled, not power down radio A. */
454 u1btmp
= rtl_read_byte(rtlpriv
, mac_reg
);
455 if (!(u1btmp
& mac_on_bit
)) {
456 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_LOUD
, "power down\n");
457 /* power down RF radio A according to YuNan's advice. */
458 rtl92de_write_dword_dbi(hw
, RFPGA0_XA_LSSIPARAMETER
,
461 RT_TRACE(rtlpriv
, COMP_RF
, DBG_LOUD
, "<====\n");
464 bool rtl92d_phy_rf6052_config(struct ieee80211_hw
*hw
)
466 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
467 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
468 bool rtstatus
= true;
469 struct rtl_hal
*rtlhal
= &(rtlpriv
->rtlhal
);
472 struct bb_reg_def
*pphyreg
;
473 bool mac1_initradioa_first
= false, mac0_initradiob_first
= false;
474 bool need_pwrdown_radioa
= false, need_pwrdown_radiob
= false;
475 bool true_bpath
= false;
477 if (rtlphy
->rf_type
== RF_1T1R
)
478 rtlphy
->num_total_rfpath
= 1;
480 rtlphy
->num_total_rfpath
= 2;
482 /* Single phy mode: use radio_a radio_b config path_A path_B */
483 /* seperately by MAC0, and MAC1 needn't configure RF; */
484 /* Dual PHY mode:MAC0 use radio_a config 1st phy path_A, */
485 /* MAC1 use radio_b config 2nd PHY path_A. */
486 /* DMDP,MAC0 on G band,MAC1 on A band. */
487 if (rtlhal
->macphymode
== DUALMAC_DUALPHY
) {
488 if (rtlhal
->current_bandtype
== BAND_ON_2_4G
&&
489 rtlhal
->interfaceindex
== 0) {
490 /* MAC0 needs PHY1 load radio_b.txt.
491 * Driver use DBI to write. */
492 if (rtl92d_phy_enable_anotherphy(hw
, true)) {
493 rtlphy
->num_total_rfpath
= 2;
494 mac0_initradiob_first
= true;
496 /* We think if MAC1 is ON,then radio_a.txt and
497 * radio_b.txt has been load. */
500 } else if (rtlhal
->current_bandtype
== BAND_ON_5G
&&
501 rtlhal
->interfaceindex
== 1) {
502 /* MAC1 needs PHY0 load radio_a.txt.
503 * Driver use DBI to write. */
504 if (rtl92d_phy_enable_anotherphy(hw
, false)) {
505 rtlphy
->num_total_rfpath
= 2;
506 mac1_initradioa_first
= true;
508 /* We think if MAC0 is ON,then radio_a.txt and
509 * radio_b.txt has been load. */
512 } else if (rtlhal
->interfaceindex
== 1) {
513 /* MAC0 enabled, only init radia B. */
518 for (rfpath
= 0; rfpath
< rtlphy
->num_total_rfpath
; rfpath
++) {
519 /* Mac1 use PHY0 write */
520 if (mac1_initradioa_first
) {
521 if (rfpath
== RF90_PATH_A
) {
522 rtlhal
->during_mac1init_radioa
= true;
523 need_pwrdown_radioa
= true;
524 } else if (rfpath
== RF90_PATH_B
) {
525 rtlhal
->during_mac1init_radioa
= false;
526 mac1_initradioa_first
= false;
527 rfpath
= RF90_PATH_A
;
529 rtlphy
->num_total_rfpath
= 1;
531 } else if (mac0_initradiob_first
) {
532 /* Mac0 use PHY1 write */
533 if (rfpath
== RF90_PATH_A
)
534 rtlhal
->during_mac0init_radiob
= false;
535 if (rfpath
== RF90_PATH_B
) {
536 rtlhal
->during_mac0init_radiob
= true;
537 mac0_initradiob_first
= false;
538 need_pwrdown_radiob
= true;
539 rfpath
= RF90_PATH_A
;
541 rtlphy
->num_total_rfpath
= 1;
544 pphyreg
= &rtlphy
->phyreg_def
[rfpath
];
548 u4_regvalue
= rtl_get_bbreg(hw
, pphyreg
->rfintfs
,
553 u4_regvalue
= rtl_get_bbreg(hw
, pphyreg
->rfintfs
,
557 rtl_set_bbreg(hw
, pphyreg
->rfintfe
, BRFSI_RFENV
<< 16, 0x1);
559 rtl_set_bbreg(hw
, pphyreg
->rfintfo
, BRFSI_RFENV
, 0x1);
561 /* Set bit number of Address and Data for RF register */
562 /* Set 1 to 4 bits for 8255 */
563 rtl_set_bbreg(hw
, pphyreg
->rfhssi_para2
,
564 B3WIREADDRESSLENGTH
, 0x0);
566 /* Set 0 to 12 bits for 8255 */
567 rtl_set_bbreg(hw
, pphyreg
->rfhssi_para2
, B3WIREDATALENGTH
, 0x0);
572 rtstatus
= rtl92d_phy_config_rf_with_headerfile(
574 (enum radio_path
)rfpath
);
576 rtstatus
= rtl92d_phy_config_rf_with_headerfile(
578 (enum radio_path
)rfpath
);
582 rtl92d_phy_config_rf_with_headerfile(hw
, radiob_txt
,
583 (enum radio_path
) rfpath
);
593 rtl_set_bbreg(hw
, pphyreg
->rfintfs
, BRFSI_RFENV
,
598 rtl_set_bbreg(hw
, pphyreg
->rfintfs
, BRFSI_RFENV
<< 16,
603 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
,
604 "Radio[%d] Fail!!", rfpath
);
605 goto phy_rf_cfg_fail
;
610 /* check MAC0 enable or not again, if enabled,
611 * not power down radio A. */
612 /* check MAC1 enable or not again, if enabled,
613 * not power down radio B. */
614 if (need_pwrdown_radioa
)
615 rtl92d_phy_powerdown_anotherphy(hw
, false);
616 else if (need_pwrdown_radiob
)
617 rtl92d_phy_powerdown_anotherphy(hw
, true);
618 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_TRACE
, "<---\n");