1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2009-2012 Realtek Corporation.*/
17 static u32
_rtl92s_phy_calculate_bit_shift(u32 bitmask
)
21 for (i
= 0; i
<= 31; i
++) {
22 if (((bitmask
>> i
) & 0x1) == 1)
29 u32
rtl92s_phy_query_bb_reg(struct ieee80211_hw
*hw
, u32 regaddr
, u32 bitmask
)
31 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
32 u32 returnvalue
= 0, originalvalue
, bitshift
;
34 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
, "regaddr(%#x), bitmask(%#x)\n",
37 originalvalue
= rtl_read_dword(rtlpriv
, regaddr
);
38 bitshift
= _rtl92s_phy_calculate_bit_shift(bitmask
);
39 returnvalue
= (originalvalue
& bitmask
) >> bitshift
;
41 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
, "BBR MASK=0x%x Addr[0x%x]=0x%x\n",
42 bitmask
, regaddr
, originalvalue
);
48 void rtl92s_phy_set_bb_reg(struct ieee80211_hw
*hw
, u32 regaddr
, u32 bitmask
,
51 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
52 u32 originalvalue
, bitshift
;
54 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
,
55 "regaddr(%#x), bitmask(%#x), data(%#x)\n",
56 regaddr
, bitmask
, data
);
58 if (bitmask
!= MASKDWORD
) {
59 originalvalue
= rtl_read_dword(rtlpriv
, regaddr
);
60 bitshift
= _rtl92s_phy_calculate_bit_shift(bitmask
);
61 data
= ((originalvalue
& (~bitmask
)) | (data
<< bitshift
));
64 rtl_write_dword(rtlpriv
, regaddr
, data
);
66 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
,
67 "regaddr(%#x), bitmask(%#x), data(%#x)\n",
68 regaddr
, bitmask
, data
);
72 static u32
_rtl92s_phy_rf_serial_read(struct ieee80211_hw
*hw
,
73 enum radio_path rfpath
, u32 offset
)
76 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
77 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
78 struct bb_reg_def
*pphyreg
= &rtlphy
->phyreg_def
[rfpath
];
80 u32 tmplong
, tmplong2
;
87 tmplong
= rtl_get_bbreg(hw
, RFPGA0_XA_HSSIPARAMETER2
, MASKDWORD
);
89 if (rfpath
== RF90_PATH_A
)
92 tmplong2
= rtl_get_bbreg(hw
, pphyreg
->rfhssi_para2
, MASKDWORD
);
94 tmplong2
= (tmplong2
& (~BLSSI_READADDRESS
)) | (newoffset
<< 23) |
97 rtl_set_bbreg(hw
, RFPGA0_XA_HSSIPARAMETER2
, MASKDWORD
,
98 tmplong
& (~BLSSI_READEDGE
));
102 rtl_set_bbreg(hw
, pphyreg
->rfhssi_para2
, MASKDWORD
, tmplong2
);
105 rtl_set_bbreg(hw
, RFPGA0_XA_HSSIPARAMETER2
, MASKDWORD
, tmplong
|
109 if (rfpath
== RF90_PATH_A
)
110 rfpi_enable
= (u8
)rtl_get_bbreg(hw
, RFPGA0_XA_HSSIPARAMETER1
,
112 else if (rfpath
== RF90_PATH_B
)
113 rfpi_enable
= (u8
)rtl_get_bbreg(hw
, RFPGA0_XB_HSSIPARAMETER1
,
117 retvalue
= rtl_get_bbreg(hw
, pphyreg
->rf_rbpi
,
118 BLSSI_READBACK_DATA
);
120 retvalue
= rtl_get_bbreg(hw
, pphyreg
->rf_rb
,
121 BLSSI_READBACK_DATA
);
123 retvalue
= rtl_get_bbreg(hw
, pphyreg
->rf_rb
,
124 BLSSI_READBACK_DATA
);
126 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
, "RFR-%d Addr[0x%x]=0x%x\n",
127 rfpath
, pphyreg
->rf_rb
, retvalue
);
133 static void _rtl92s_phy_rf_serial_write(struct ieee80211_hw
*hw
,
134 enum radio_path rfpath
, u32 offset
,
137 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
138 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
139 struct bb_reg_def
*pphyreg
= &rtlphy
->phyreg_def
[rfpath
];
140 u32 data_and_addr
= 0;
146 data_and_addr
= ((newoffset
<< 20) | (data
& 0x000fffff)) & 0x0fffffff;
147 rtl_set_bbreg(hw
, pphyreg
->rf3wire_offset
, MASKDWORD
, data_and_addr
);
149 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
, "RFW-%d Addr[0x%x]=0x%x\n",
150 rfpath
, pphyreg
->rf3wire_offset
, data_and_addr
);
154 u32
rtl92s_phy_query_rf_reg(struct ieee80211_hw
*hw
, enum radio_path rfpath
,
155 u32 regaddr
, u32 bitmask
)
157 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
158 u32 original_value
, readback_value
, bitshift
;
160 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
,
161 "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
162 regaddr
, rfpath
, bitmask
);
164 spin_lock(&rtlpriv
->locks
.rf_lock
);
166 original_value
= _rtl92s_phy_rf_serial_read(hw
, rfpath
, regaddr
);
168 bitshift
= _rtl92s_phy_calculate_bit_shift(bitmask
);
169 readback_value
= (original_value
& bitmask
) >> bitshift
;
171 spin_unlock(&rtlpriv
->locks
.rf_lock
);
173 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
,
174 "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
175 regaddr
, rfpath
, bitmask
, original_value
);
177 return readback_value
;
180 void rtl92s_phy_set_rf_reg(struct ieee80211_hw
*hw
, enum radio_path rfpath
,
181 u32 regaddr
, u32 bitmask
, u32 data
)
183 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
184 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
185 u32 original_value
, bitshift
;
187 if (!((rtlphy
->rf_pathmap
>> rfpath
) & 0x1))
190 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
,
191 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
192 regaddr
, bitmask
, data
, rfpath
);
194 spin_lock(&rtlpriv
->locks
.rf_lock
);
196 if (bitmask
!= RFREG_OFFSET_MASK
) {
197 original_value
= _rtl92s_phy_rf_serial_read(hw
, rfpath
,
199 bitshift
= _rtl92s_phy_calculate_bit_shift(bitmask
);
200 data
= ((original_value
& (~bitmask
)) | (data
<< bitshift
));
203 _rtl92s_phy_rf_serial_write(hw
, rfpath
, regaddr
, data
);
205 spin_unlock(&rtlpriv
->locks
.rf_lock
);
207 RT_TRACE(rtlpriv
, COMP_RF
, DBG_TRACE
,
208 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
209 regaddr
, bitmask
, data
, rfpath
);
213 void rtl92s_phy_scan_operation_backup(struct ieee80211_hw
*hw
,
216 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
218 if (!is_hal_stop(rtlhal
)) {
220 case SCAN_OPT_BACKUP
:
221 rtl92s_phy_set_fw_cmd(hw
, FW_CMD_PAUSE_DM_BY_SCAN
);
223 case SCAN_OPT_RESTORE
:
224 rtl92s_phy_set_fw_cmd(hw
, FW_CMD_RESUME_DM_BY_SCAN
);
227 pr_err("Unknown operation\n");
233 void rtl92s_phy_set_bw_mode(struct ieee80211_hw
*hw
,
234 enum nl80211_channel_type ch_type
)
236 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
237 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
238 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
239 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
242 RT_TRACE(rtlpriv
, COMP_SCAN
, DBG_TRACE
, "Switch to %s bandwidth\n",
243 rtlphy
->current_chan_bw
== HT_CHANNEL_WIDTH_20
?
246 if (rtlphy
->set_bwmode_inprogress
)
248 if (is_hal_stop(rtlhal
))
251 rtlphy
->set_bwmode_inprogress
= true;
253 reg_bw_opmode
= rtl_read_byte(rtlpriv
, BW_OPMODE
);
255 rtl_read_byte(rtlpriv
, RRSR
+ 2);
257 switch (rtlphy
->current_chan_bw
) {
258 case HT_CHANNEL_WIDTH_20
:
259 reg_bw_opmode
|= BW_OPMODE_20MHZ
;
260 rtl_write_byte(rtlpriv
, BW_OPMODE
, reg_bw_opmode
);
262 case HT_CHANNEL_WIDTH_20_40
:
263 reg_bw_opmode
&= ~BW_OPMODE_20MHZ
;
264 rtl_write_byte(rtlpriv
, BW_OPMODE
, reg_bw_opmode
);
267 pr_err("unknown bandwidth: %#X\n",
268 rtlphy
->current_chan_bw
);
272 switch (rtlphy
->current_chan_bw
) {
273 case HT_CHANNEL_WIDTH_20
:
274 rtl_set_bbreg(hw
, RFPGA0_RFMOD
, BRFMOD
, 0x0);
275 rtl_set_bbreg(hw
, RFPGA1_RFMOD
, BRFMOD
, 0x0);
277 if (rtlhal
->version
>= VERSION_8192S_BCUT
)
278 rtl_write_byte(rtlpriv
, RFPGA0_ANALOGPARAMETER2
, 0x58);
280 case HT_CHANNEL_WIDTH_20_40
:
281 rtl_set_bbreg(hw
, RFPGA0_RFMOD
, BRFMOD
, 0x1);
282 rtl_set_bbreg(hw
, RFPGA1_RFMOD
, BRFMOD
, 0x1);
284 rtl_set_bbreg(hw
, RCCK0_SYSTEM
, BCCK_SIDEBAND
,
285 (mac
->cur_40_prime_sc
>> 1));
286 rtl_set_bbreg(hw
, ROFDM1_LSTF
, 0xC00, mac
->cur_40_prime_sc
);
288 if (rtlhal
->version
>= VERSION_8192S_BCUT
)
289 rtl_write_byte(rtlpriv
, RFPGA0_ANALOGPARAMETER2
, 0x18);
292 pr_err("unknown bandwidth: %#X\n",
293 rtlphy
->current_chan_bw
);
297 rtl92s_phy_rf6052_set_bandwidth(hw
, rtlphy
->current_chan_bw
);
298 rtlphy
->set_bwmode_inprogress
= false;
299 RT_TRACE(rtlpriv
, COMP_SCAN
, DBG_TRACE
, "<==\n");
302 static bool _rtl92s_phy_set_sw_chnl_cmdarray(struct swchnlcmd
*cmdtable
,
303 u32 cmdtableidx
, u32 cmdtablesz
, enum swchnlcmd_id cmdid
,
304 u32 para1
, u32 para2
, u32 msdelay
)
306 struct swchnlcmd
*pcmd
;
308 if (cmdtable
== NULL
) {
309 WARN_ONCE(true, "rtl8192se: cmdtable cannot be NULL\n");
313 if (cmdtableidx
>= cmdtablesz
)
316 pcmd
= cmdtable
+ cmdtableidx
;
320 pcmd
->msdelay
= msdelay
;
325 static bool _rtl92s_phy_sw_chnl_step_by_step(struct ieee80211_hw
*hw
,
326 u8 channel
, u8
*stage
, u8
*step
, u32
*delay
)
328 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
329 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
330 struct swchnlcmd precommoncmd
[MAX_PRECMD_CNT
];
332 struct swchnlcmd postcommoncmd
[MAX_POSTCMD_CNT
];
333 u32 postcommoncmdcnt
;
334 struct swchnlcmd rfdependcmd
[MAX_RFDEPENDCMD_CNT
];
336 struct swchnlcmd
*currentcmd
= NULL
;
338 u8 num_total_rfpath
= rtlphy
->num_total_rfpath
;
341 _rtl92s_phy_set_sw_chnl_cmdarray(precommoncmd
, precommoncmdcnt
++,
342 MAX_PRECMD_CNT
, CMDID_SET_TXPOWEROWER_LEVEL
, 0, 0, 0);
343 _rtl92s_phy_set_sw_chnl_cmdarray(precommoncmd
, precommoncmdcnt
++,
344 MAX_PRECMD_CNT
, CMDID_END
, 0, 0, 0);
346 postcommoncmdcnt
= 0;
348 _rtl92s_phy_set_sw_chnl_cmdarray(postcommoncmd
, postcommoncmdcnt
++,
349 MAX_POSTCMD_CNT
, CMDID_END
, 0, 0, 0);
353 WARN_ONCE((channel
< 1 || channel
> 14),
354 "rtl8192se: invalid channel for Zebra: %d\n", channel
);
356 _rtl92s_phy_set_sw_chnl_cmdarray(rfdependcmd
, rfdependcmdcnt
++,
357 MAX_RFDEPENDCMD_CNT
, CMDID_RF_WRITEREG
,
358 RF_CHNLBW
, channel
, 10);
360 _rtl92s_phy_set_sw_chnl_cmdarray(rfdependcmd
, rfdependcmdcnt
++,
361 MAX_RFDEPENDCMD_CNT
, CMDID_END
, 0, 0, 0);
366 currentcmd
= &precommoncmd
[*step
];
369 currentcmd
= &rfdependcmd
[*step
];
372 currentcmd
= &postcommoncmd
[*step
];
378 if (currentcmd
->cmdid
== CMDID_END
) {
388 switch (currentcmd
->cmdid
) {
389 case CMDID_SET_TXPOWEROWER_LEVEL
:
390 rtl92s_phy_set_txpower(hw
, channel
);
392 case CMDID_WRITEPORT_ULONG
:
393 rtl_write_dword(rtlpriv
, currentcmd
->para1
,
396 case CMDID_WRITEPORT_USHORT
:
397 rtl_write_word(rtlpriv
, currentcmd
->para1
,
398 (u16
)currentcmd
->para2
);
400 case CMDID_WRITEPORT_UCHAR
:
401 rtl_write_byte(rtlpriv
, currentcmd
->para1
,
402 (u8
)currentcmd
->para2
);
404 case CMDID_RF_WRITEREG
:
405 for (rfpath
= 0; rfpath
< num_total_rfpath
; rfpath
++) {
406 rtlphy
->rfreg_chnlval
[rfpath
] =
407 ((rtlphy
->rfreg_chnlval
[rfpath
] &
408 0xfffffc00) | currentcmd
->para2
);
409 rtl_set_rfreg(hw
, (enum radio_path
)rfpath
,
412 rtlphy
->rfreg_chnlval
[rfpath
]);
416 pr_err("switch case %#x not processed\n",
424 (*delay
) = currentcmd
->msdelay
;
429 u8
rtl92s_phy_sw_chnl(struct ieee80211_hw
*hw
)
431 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
432 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
433 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
437 RT_TRACE(rtlpriv
, COMP_SCAN
, DBG_TRACE
, "switch to channel%d\n",
438 rtlphy
->current_channel
);
440 if (rtlphy
->sw_chnl_inprogress
)
443 if (rtlphy
->set_bwmode_inprogress
)
446 if (is_hal_stop(rtlhal
))
449 rtlphy
->sw_chnl_inprogress
= true;
450 rtlphy
->sw_chnl_stage
= 0;
451 rtlphy
->sw_chnl_step
= 0;
454 if (!rtlphy
->sw_chnl_inprogress
)
457 ret
= _rtl92s_phy_sw_chnl_step_by_step(hw
,
458 rtlphy
->current_channel
,
459 &rtlphy
->sw_chnl_stage
,
460 &rtlphy
->sw_chnl_step
, &delay
);
467 rtlphy
->sw_chnl_inprogress
= false;
472 rtlphy
->sw_chnl_inprogress
= false;
474 RT_TRACE(rtlpriv
, COMP_SCAN
, DBG_TRACE
, "<==\n");
479 static void _rtl92se_phy_set_rf_sleep(struct ieee80211_hw
*hw
)
481 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
484 u1btmp
= rtl_read_byte(rtlpriv
, LDOV12D_CTRL
);
487 rtl_write_byte(rtlpriv
, LDOV12D_CTRL
, u1btmp
);
488 rtl_write_byte(rtlpriv
, SPS1_CTRL
, 0x0);
489 rtl_write_byte(rtlpriv
, TXPAUSE
, 0xFF);
490 rtl_write_word(rtlpriv
, CMDR
, 0x57FC);
493 rtl_write_word(rtlpriv
, CMDR
, 0x77FC);
494 rtl_write_byte(rtlpriv
, PHY_CCA
, 0x0);
497 rtl_write_word(rtlpriv
, CMDR
, 0x37FC);
500 rtl_write_word(rtlpriv
, CMDR
, 0x77FC);
503 rtl_write_word(rtlpriv
, CMDR
, 0x57FC);
505 /* we should chnge GPIO to input mode
506 * this will drop away current about 25mA*/
507 rtl8192se_gpiobit3_cfg_inputmode(hw
);
510 bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw
*hw
,
511 enum rf_pwrstate rfpwr_state
)
513 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
514 struct rtl_pci_priv
*pcipriv
= rtl_pcipriv(hw
);
515 struct rtl_mac
*mac
= rtl_mac(rtl_priv(hw
));
516 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
519 struct rtl8192_tx_ring
*ring
= NULL
;
521 if (rfpwr_state
== ppsc
->rfpwr_state
)
524 switch (rfpwr_state
) {
526 if ((ppsc
->rfpwr_state
== ERFOFF
) &&
527 RT_IN_PS_LEVEL(ppsc
, RT_RF_OFF_LEVL_HALT_NIC
)) {
530 u32 initializecount
= 0;
533 RT_TRACE(rtlpriv
, COMP_RF
, DBG_DMESG
,
534 "IPS Set eRf nic enable\n");
535 rtstatus
= rtl_ps_enable_nic(hw
);
536 } while (!rtstatus
&& (initializecount
< 10));
538 RT_CLEAR_PS_LEVEL(ppsc
,
539 RT_RF_OFF_LEVL_HALT_NIC
);
541 RT_TRACE(rtlpriv
, COMP_POWER
, DBG_DMESG
,
542 "awake, sleeped:%d ms state_inap:%x\n",
543 jiffies_to_msecs(jiffies
-
546 rtlpriv
->psc
.state_inap
);
547 ppsc
->last_awake_jiffies
= jiffies
;
548 rtl_write_word(rtlpriv
, CMDR
, 0x37FC);
549 rtl_write_byte(rtlpriv
, TXPAUSE
, 0x00);
550 rtl_write_byte(rtlpriv
, PHY_CCA
, 0x3);
553 if (mac
->link_state
== MAC80211_LINKED
)
554 rtlpriv
->cfg
->ops
->led_control(hw
,
557 rtlpriv
->cfg
->ops
->led_control(hw
,
562 if (ppsc
->reg_rfps_level
& RT_RF_OFF_LEVL_HALT_NIC
) {
563 RT_TRACE(rtlpriv
, COMP_RF
, DBG_DMESG
,
564 "IPS Set eRf nic disable\n");
565 rtl_ps_disable_nic(hw
);
566 RT_SET_PS_LEVEL(ppsc
, RT_RF_OFF_LEVL_HALT_NIC
);
568 if (ppsc
->rfoff_reason
== RF_CHANGE_BY_IPS
)
569 rtlpriv
->cfg
->ops
->led_control(hw
,
572 rtlpriv
->cfg
->ops
->led_control(hw
,
578 if (ppsc
->rfpwr_state
== ERFOFF
)
581 for (queue_id
= 0, i
= 0;
582 queue_id
< RTL_PCI_MAX_TX_QUEUE_COUNT
;) {
583 ring
= &pcipriv
->dev
.tx_ring
[queue_id
];
584 if (skb_queue_len(&ring
->queue
) == 0 ||
585 queue_id
== BEACON_QUEUE
) {
589 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_WARNING
,
590 "eRf Off/Sleep: %d times TcbBusyQueue[%d] = %d before doze!\n",
592 skb_queue_len(&ring
->queue
));
598 if (i
>= MAX_DOZE_WAITING_TIMES_9x
) {
599 RT_TRACE(rtlpriv
, COMP_ERR
, DBG_WARNING
,
600 "ERFOFF: %d times TcbBusyQueue[%d] = %d !\n",
601 MAX_DOZE_WAITING_TIMES_9x
,
603 skb_queue_len(&ring
->queue
));
608 RT_TRACE(rtlpriv
, COMP_POWER
, DBG_DMESG
,
609 "Set ERFSLEEP awaked:%d ms\n",
610 jiffies_to_msecs(jiffies
-
611 ppsc
->last_awake_jiffies
));
613 RT_TRACE(rtlpriv
, COMP_POWER
, DBG_DMESG
,
614 "sleep awaked:%d ms state_inap:%x\n",
615 jiffies_to_msecs(jiffies
-
616 ppsc
->last_awake_jiffies
),
617 rtlpriv
->psc
.state_inap
);
618 ppsc
->last_sleep_jiffies
= jiffies
;
619 _rtl92se_phy_set_rf_sleep(hw
);
622 pr_err("switch case %#x not processed\n",
629 ppsc
->rfpwr_state
= rfpwr_state
;
634 static bool _rtl92s_phy_config_rfpa_bias_current(struct ieee80211_hw
*hw
,
635 enum radio_path rfpath
)
637 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
638 bool rtstatus
= true;
641 /* If inferiority IC, we have to increase the PA bias current */
642 if (rtlhal
->ic_class
!= IC_INFERIORITY_A
) {
643 tmpval
= rtl92s_phy_query_rf_reg(hw
, rfpath
, RF_IPA
, 0xf);
644 rtl92s_phy_set_rf_reg(hw
, rfpath
, RF_IPA
, 0xf, tmpval
+ 1);
650 static void _rtl92s_store_pwrindex_diffrate_offset(struct ieee80211_hw
*hw
,
651 u32 reg_addr
, u32 bitmask
, u32 data
)
653 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
654 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
657 if (reg_addr
== RTXAGC_RATE18_06
)
659 else if (reg_addr
== RTXAGC_RATE54_24
)
661 else if (reg_addr
== RTXAGC_CCK_MCS32
)
663 else if (reg_addr
== RTXAGC_MCS03_MCS00
)
665 else if (reg_addr
== RTXAGC_MCS07_MCS04
)
667 else if (reg_addr
== RTXAGC_MCS11_MCS08
)
669 else if (reg_addr
== RTXAGC_MCS15_MCS12
)
674 rtlphy
->mcs_offset
[rtlphy
->pwrgroup_cnt
][index
] = data
;
676 rtlphy
->pwrgroup_cnt
++;
679 static void _rtl92s_phy_init_register_definition(struct ieee80211_hw
*hw
)
681 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
682 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
684 /*RF Interface Sowrtware Control */
685 rtlphy
->phyreg_def
[RF90_PATH_A
].rfintfs
= RFPGA0_XAB_RFINTERFACESW
;
686 rtlphy
->phyreg_def
[RF90_PATH_B
].rfintfs
= RFPGA0_XAB_RFINTERFACESW
;
687 rtlphy
->phyreg_def
[RF90_PATH_C
].rfintfs
= RFPGA0_XCD_RFINTERFACESW
;
688 rtlphy
->phyreg_def
[RF90_PATH_D
].rfintfs
= RFPGA0_XCD_RFINTERFACESW
;
690 /* RF Interface Readback Value */
691 rtlphy
->phyreg_def
[RF90_PATH_A
].rfintfi
= RFPGA0_XAB_RFINTERFACERB
;
692 rtlphy
->phyreg_def
[RF90_PATH_B
].rfintfi
= RFPGA0_XAB_RFINTERFACERB
;
693 rtlphy
->phyreg_def
[RF90_PATH_C
].rfintfi
= RFPGA0_XCD_RFINTERFACERB
;
694 rtlphy
->phyreg_def
[RF90_PATH_D
].rfintfi
= RFPGA0_XCD_RFINTERFACERB
;
696 /* RF Interface Output (and Enable) */
697 rtlphy
->phyreg_def
[RF90_PATH_A
].rfintfo
= RFPGA0_XA_RFINTERFACEOE
;
698 rtlphy
->phyreg_def
[RF90_PATH_B
].rfintfo
= RFPGA0_XB_RFINTERFACEOE
;
699 rtlphy
->phyreg_def
[RF90_PATH_C
].rfintfo
= RFPGA0_XC_RFINTERFACEOE
;
700 rtlphy
->phyreg_def
[RF90_PATH_D
].rfintfo
= RFPGA0_XD_RFINTERFACEOE
;
702 /* RF Interface (Output and) Enable */
703 rtlphy
->phyreg_def
[RF90_PATH_A
].rfintfe
= RFPGA0_XA_RFINTERFACEOE
;
704 rtlphy
->phyreg_def
[RF90_PATH_B
].rfintfe
= RFPGA0_XB_RFINTERFACEOE
;
705 rtlphy
->phyreg_def
[RF90_PATH_C
].rfintfe
= RFPGA0_XC_RFINTERFACEOE
;
706 rtlphy
->phyreg_def
[RF90_PATH_D
].rfintfe
= RFPGA0_XD_RFINTERFACEOE
;
708 /* Addr of LSSI. Wirte RF register by driver */
709 rtlphy
->phyreg_def
[RF90_PATH_A
].rf3wire_offset
=
710 RFPGA0_XA_LSSIPARAMETER
;
711 rtlphy
->phyreg_def
[RF90_PATH_B
].rf3wire_offset
=
712 RFPGA0_XB_LSSIPARAMETER
;
713 rtlphy
->phyreg_def
[RF90_PATH_C
].rf3wire_offset
=
714 RFPGA0_XC_LSSIPARAMETER
;
715 rtlphy
->phyreg_def
[RF90_PATH_D
].rf3wire_offset
=
716 RFPGA0_XD_LSSIPARAMETER
;
719 rtlphy
->phyreg_def
[RF90_PATH_A
].rflssi_select
= RFPGA0_XAB_RFPARAMETER
;
720 rtlphy
->phyreg_def
[RF90_PATH_B
].rflssi_select
= RFPGA0_XAB_RFPARAMETER
;
721 rtlphy
->phyreg_def
[RF90_PATH_C
].rflssi_select
= RFPGA0_XCD_RFPARAMETER
;
722 rtlphy
->phyreg_def
[RF90_PATH_D
].rflssi_select
= RFPGA0_XCD_RFPARAMETER
;
724 /* Tx AGC Gain Stage (same for all path. Should we remove this?) */
725 rtlphy
->phyreg_def
[RF90_PATH_A
].rftxgain_stage
= RFPGA0_TXGAINSTAGE
;
726 rtlphy
->phyreg_def
[RF90_PATH_B
].rftxgain_stage
= RFPGA0_TXGAINSTAGE
;
727 rtlphy
->phyreg_def
[RF90_PATH_C
].rftxgain_stage
= RFPGA0_TXGAINSTAGE
;
728 rtlphy
->phyreg_def
[RF90_PATH_D
].rftxgain_stage
= RFPGA0_TXGAINSTAGE
;
730 /* Tranceiver A~D HSSI Parameter-1 */
731 rtlphy
->phyreg_def
[RF90_PATH_A
].rfhssi_para1
= RFPGA0_XA_HSSIPARAMETER1
;
732 rtlphy
->phyreg_def
[RF90_PATH_B
].rfhssi_para1
= RFPGA0_XB_HSSIPARAMETER1
;
733 rtlphy
->phyreg_def
[RF90_PATH_C
].rfhssi_para1
= RFPGA0_XC_HSSIPARAMETER1
;
734 rtlphy
->phyreg_def
[RF90_PATH_D
].rfhssi_para1
= RFPGA0_XD_HSSIPARAMETER1
;
736 /* Tranceiver A~D HSSI Parameter-2 */
737 rtlphy
->phyreg_def
[RF90_PATH_A
].rfhssi_para2
= RFPGA0_XA_HSSIPARAMETER2
;
738 rtlphy
->phyreg_def
[RF90_PATH_B
].rfhssi_para2
= RFPGA0_XB_HSSIPARAMETER2
;
739 rtlphy
->phyreg_def
[RF90_PATH_C
].rfhssi_para2
= RFPGA0_XC_HSSIPARAMETER2
;
740 rtlphy
->phyreg_def
[RF90_PATH_D
].rfhssi_para2
= RFPGA0_XD_HSSIPARAMETER2
;
742 /* RF switch Control */
743 rtlphy
->phyreg_def
[RF90_PATH_A
].rfsw_ctrl
= RFPGA0_XAB_SWITCHCONTROL
;
744 rtlphy
->phyreg_def
[RF90_PATH_B
].rfsw_ctrl
= RFPGA0_XAB_SWITCHCONTROL
;
745 rtlphy
->phyreg_def
[RF90_PATH_C
].rfsw_ctrl
= RFPGA0_XCD_SWITCHCONTROL
;
746 rtlphy
->phyreg_def
[RF90_PATH_D
].rfsw_ctrl
= RFPGA0_XCD_SWITCHCONTROL
;
749 rtlphy
->phyreg_def
[RF90_PATH_A
].rfagc_control1
= ROFDM0_XAAGCCORE1
;
750 rtlphy
->phyreg_def
[RF90_PATH_B
].rfagc_control1
= ROFDM0_XBAGCCORE1
;
751 rtlphy
->phyreg_def
[RF90_PATH_C
].rfagc_control1
= ROFDM0_XCAGCCORE1
;
752 rtlphy
->phyreg_def
[RF90_PATH_D
].rfagc_control1
= ROFDM0_XDAGCCORE1
;
755 rtlphy
->phyreg_def
[RF90_PATH_A
].rfagc_control2
= ROFDM0_XAAGCCORE2
;
756 rtlphy
->phyreg_def
[RF90_PATH_B
].rfagc_control2
= ROFDM0_XBAGCCORE2
;
757 rtlphy
->phyreg_def
[RF90_PATH_C
].rfagc_control2
= ROFDM0_XCAGCCORE2
;
758 rtlphy
->phyreg_def
[RF90_PATH_D
].rfagc_control2
= ROFDM0_XDAGCCORE2
;
760 /* RX AFE control 1 */
761 rtlphy
->phyreg_def
[RF90_PATH_A
].rfrxiq_imbal
= ROFDM0_XARXIQIMBALANCE
;
762 rtlphy
->phyreg_def
[RF90_PATH_B
].rfrxiq_imbal
= ROFDM0_XBRXIQIMBALANCE
;
763 rtlphy
->phyreg_def
[RF90_PATH_C
].rfrxiq_imbal
= ROFDM0_XCRXIQIMBALANCE
;
764 rtlphy
->phyreg_def
[RF90_PATH_D
].rfrxiq_imbal
= ROFDM0_XDRXIQIMBALANCE
;
766 /* RX AFE control 1 */
767 rtlphy
->phyreg_def
[RF90_PATH_A
].rfrx_afe
= ROFDM0_XARXAFE
;
768 rtlphy
->phyreg_def
[RF90_PATH_B
].rfrx_afe
= ROFDM0_XBRXAFE
;
769 rtlphy
->phyreg_def
[RF90_PATH_C
].rfrx_afe
= ROFDM0_XCRXAFE
;
770 rtlphy
->phyreg_def
[RF90_PATH_D
].rfrx_afe
= ROFDM0_XDRXAFE
;
772 /* Tx AFE control 1 */
773 rtlphy
->phyreg_def
[RF90_PATH_A
].rftxiq_imbal
= ROFDM0_XATXIQIMBALANCE
;
774 rtlphy
->phyreg_def
[RF90_PATH_B
].rftxiq_imbal
= ROFDM0_XBTXIQIMBALANCE
;
775 rtlphy
->phyreg_def
[RF90_PATH_C
].rftxiq_imbal
= ROFDM0_XCTXIQIMBALANCE
;
776 rtlphy
->phyreg_def
[RF90_PATH_D
].rftxiq_imbal
= ROFDM0_XDTXIQIMBALANCE
;
778 /* Tx AFE control 2 */
779 rtlphy
->phyreg_def
[RF90_PATH_A
].rftx_afe
= ROFDM0_XATXAFE
;
780 rtlphy
->phyreg_def
[RF90_PATH_B
].rftx_afe
= ROFDM0_XBTXAFE
;
781 rtlphy
->phyreg_def
[RF90_PATH_C
].rftx_afe
= ROFDM0_XCTXAFE
;
782 rtlphy
->phyreg_def
[RF90_PATH_D
].rftx_afe
= ROFDM0_XDTXAFE
;
784 /* Tranceiver LSSI Readback */
785 rtlphy
->phyreg_def
[RF90_PATH_A
].rf_rb
= RFPGA0_XA_LSSIREADBACK
;
786 rtlphy
->phyreg_def
[RF90_PATH_B
].rf_rb
= RFPGA0_XB_LSSIREADBACK
;
787 rtlphy
->phyreg_def
[RF90_PATH_C
].rf_rb
= RFPGA0_XC_LSSIREADBACK
;
788 rtlphy
->phyreg_def
[RF90_PATH_D
].rf_rb
= RFPGA0_XD_LSSIREADBACK
;
790 /* Tranceiver LSSI Readback PI mode */
791 rtlphy
->phyreg_def
[RF90_PATH_A
].rf_rbpi
= TRANSCEIVERA_HSPI_READBACK
;
792 rtlphy
->phyreg_def
[RF90_PATH_B
].rf_rbpi
= TRANSCEIVERB_HSPI_READBACK
;
796 static bool _rtl92s_phy_config_bb(struct ieee80211_hw
*hw
, u8 configtype
)
801 u16 phy_reg_len
, agc_len
;
803 agc_len
= AGCTAB_ARRAYLENGTH
;
804 agc_table
= rtl8192seagctab_array
;
805 /* Default RF_type: 2T2R */
806 phy_reg_len
= PHY_REG_2T2RARRAYLENGTH
;
807 phy_reg_table
= rtl8192sephy_reg_2t2rarray
;
809 if (configtype
== BASEBAND_CONFIG_PHY_REG
) {
810 for (i
= 0; i
< phy_reg_len
; i
= i
+ 2) {
811 rtl_addr_delay(phy_reg_table
[i
]);
813 /* Add delay for ECS T20 & LG malow platform, */
816 rtl92s_phy_set_bb_reg(hw
, phy_reg_table
[i
], MASKDWORD
,
817 phy_reg_table
[i
+ 1]);
819 } else if (configtype
== BASEBAND_CONFIG_AGC_TAB
) {
820 for (i
= 0; i
< agc_len
; i
= i
+ 2) {
821 rtl92s_phy_set_bb_reg(hw
, agc_table
[i
], MASKDWORD
,
824 /* Add delay for ECS T20 & LG malow platform */
832 static bool _rtl92s_phy_set_bb_to_diff_rf(struct ieee80211_hw
*hw
,
835 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
836 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
837 u32
*phy_regarray2xtxr_table
;
838 u16 phy_regarray2xtxr_len
;
841 if (rtlphy
->rf_type
== RF_1T1R
) {
842 phy_regarray2xtxr_table
= rtl8192sephy_changeto_1t1rarray
;
843 phy_regarray2xtxr_len
= PHY_CHANGETO_1T1RARRAYLENGTH
;
844 } else if (rtlphy
->rf_type
== RF_1T2R
) {
845 phy_regarray2xtxr_table
= rtl8192sephy_changeto_1t2rarray
;
846 phy_regarray2xtxr_len
= PHY_CHANGETO_1T2RARRAYLENGTH
;
851 if (configtype
== BASEBAND_CONFIG_PHY_REG
) {
852 for (i
= 0; i
< phy_regarray2xtxr_len
; i
= i
+ 3) {
853 rtl_addr_delay(phy_regarray2xtxr_table
[i
]);
855 rtl92s_phy_set_bb_reg(hw
, phy_regarray2xtxr_table
[i
],
856 phy_regarray2xtxr_table
[i
+ 1],
857 phy_regarray2xtxr_table
[i
+ 2]);
864 static bool _rtl92s_phy_config_bb_with_pg(struct ieee80211_hw
*hw
,
871 phy_pg_len
= PHY_REG_ARRAY_PGLENGTH
;
872 phy_table_pg
= rtl8192sephy_reg_array_pg
;
874 if (configtype
== BASEBAND_CONFIG_PHY_REG
) {
875 for (i
= 0; i
< phy_pg_len
; i
= i
+ 3) {
876 rtl_addr_delay(phy_table_pg
[i
]);
878 _rtl92s_store_pwrindex_diffrate_offset(hw
,
881 phy_table_pg
[i
+ 2]);
882 rtl92s_phy_set_bb_reg(hw
, phy_table_pg
[i
],
884 phy_table_pg
[i
+ 2]);
891 static bool _rtl92s_phy_bb_config_parafile(struct ieee80211_hw
*hw
)
893 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
894 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
895 struct rtl_efuse
*rtlefuse
= rtl_efuse(rtl_priv(hw
));
896 bool rtstatus
= true;
898 /* 1. Read PHY_REG.TXT BB INIT!! */
899 /* We will separate as 1T1R/1T2R/1T2R_GREEN/2T2R */
900 if (rtlphy
->rf_type
== RF_1T2R
|| rtlphy
->rf_type
== RF_2T2R
||
901 rtlphy
->rf_type
== RF_1T1R
|| rtlphy
->rf_type
== RF_2T2R_GREEN
) {
902 rtstatus
= _rtl92s_phy_config_bb(hw
, BASEBAND_CONFIG_PHY_REG
);
904 if (rtlphy
->rf_type
!= RF_2T2R
&&
905 rtlphy
->rf_type
!= RF_2T2R_GREEN
)
906 /* so we should reconfig BB reg with the right
908 rtstatus
= _rtl92s_phy_set_bb_to_diff_rf(hw
,
909 BASEBAND_CONFIG_PHY_REG
);
915 pr_err("Write BB Reg Fail!!\n");
916 goto phy_bb8190_config_parafile_fail
;
919 /* 2. If EEPROM or EFUSE autoload OK, We must config by
921 if (rtlefuse
->autoload_failflag
== false) {
922 rtlphy
->pwrgroup_cnt
= 0;
924 rtstatus
= _rtl92s_phy_config_bb_with_pg(hw
,
925 BASEBAND_CONFIG_PHY_REG
);
928 pr_err("_rtl92s_phy_bb_config_parafile(): BB_PG Reg Fail!!\n");
929 goto phy_bb8190_config_parafile_fail
;
932 /* 3. BB AGC table Initialization */
933 rtstatus
= _rtl92s_phy_config_bb(hw
, BASEBAND_CONFIG_AGC_TAB
);
936 pr_err("%s(): AGC Table Fail\n", __func__
);
937 goto phy_bb8190_config_parafile_fail
;
940 /* Check if the CCK HighPower is turned ON. */
941 /* This is used to calculate PWDB. */
942 rtlphy
->cck_high_power
= (bool)(rtl92s_phy_query_bb_reg(hw
,
943 RFPGA0_XA_HSSIPARAMETER2
, 0x200));
945 phy_bb8190_config_parafile_fail
:
949 u8
rtl92s_phy_config_rf(struct ieee80211_hw
*hw
, enum radio_path rfpath
)
951 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
952 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
954 bool rtstatus
= true;
957 u16 radio_a_tblen
, radio_b_tblen
;
959 radio_a_tblen
= RADIOA_1T_ARRAYLENGTH
;
960 radio_a_table
= rtl8192seradioa_1t_array
;
962 /* Using Green mode array table for RF_2T2R_GREEN */
963 if (rtlphy
->rf_type
== RF_2T2R_GREEN
) {
964 radio_b_table
= rtl8192seradiob_gm_array
;
965 radio_b_tblen
= RADIOB_GM_ARRAYLENGTH
;
967 radio_b_table
= rtl8192seradiob_array
;
968 radio_b_tblen
= RADIOB_ARRAYLENGTH
;
971 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_LOUD
, "Radio No %x\n", rfpath
);
976 for (i
= 0; i
< radio_a_tblen
; i
= i
+ 2) {
977 rtl_rfreg_delay(hw
, rfpath
, radio_a_table
[i
],
978 MASK20BITS
, radio_a_table
[i
+ 1]);
982 /* PA Bias current for inferiority IC */
983 _rtl92s_phy_config_rfpa_bias_current(hw
, rfpath
);
986 for (i
= 0; i
< radio_b_tblen
; i
= i
+ 2) {
987 rtl_rfreg_delay(hw
, rfpath
, radio_b_table
[i
],
988 MASK20BITS
, radio_b_table
[i
+ 1]);
1005 bool rtl92s_phy_mac_config(struct ieee80211_hw
*hw
)
1007 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1012 arraylength
= MAC_2T_ARRAYLENGTH
;
1013 ptrarray
= rtl8192semac_2t_array
;
1015 for (i
= 0; i
< arraylength
; i
= i
+ 2)
1016 rtl_write_byte(rtlpriv
, ptrarray
[i
], (u8
)ptrarray
[i
+ 1]);
1022 bool rtl92s_phy_bb_config(struct ieee80211_hw
*hw
)
1024 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1025 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
1026 bool rtstatus
= true;
1027 u8 pathmap
, index
, rf_num
= 0;
1030 _rtl92s_phy_init_register_definition(hw
);
1032 /* Config BB and AGC */
1033 rtstatus
= _rtl92s_phy_bb_config_parafile(hw
);
1036 /* Check BB/RF confiuration setting. */
1037 /* We only need to configure RF which is turned on. */
1038 path1
= (u8
)(rtl92s_phy_query_bb_reg(hw
, RFPGA0_TXINFO
, 0xf));
1040 path2
= (u8
)(rtl92s_phy_query_bb_reg(hw
, ROFDM0_TRXPATHENABLE
, 0xf));
1041 pathmap
= path1
| path2
;
1043 rtlphy
->rf_pathmap
= pathmap
;
1044 for (index
= 0; index
< 4; index
++) {
1045 if ((pathmap
>> index
) & 0x1)
1049 if ((rtlphy
->rf_type
== RF_1T1R
&& rf_num
!= 1) ||
1050 (rtlphy
->rf_type
== RF_1T2R
&& rf_num
!= 2) ||
1051 (rtlphy
->rf_type
== RF_2T2R
&& rf_num
!= 2) ||
1052 (rtlphy
->rf_type
== RF_2T2R_GREEN
&& rf_num
!= 2)) {
1053 pr_err("RF_Type(%x) does not match RF_Num(%x)!!\n",
1054 rtlphy
->rf_type
, rf_num
);
1055 pr_err("path1 0x%x, path2 0x%x, pathmap 0x%x\n",
1056 path1
, path2
, pathmap
);
1062 bool rtl92s_phy_rf_config(struct ieee80211_hw
*hw
)
1064 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1065 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
1067 /* Initialize general global value */
1068 if (rtlphy
->rf_type
== RF_1T1R
)
1069 rtlphy
->num_total_rfpath
= 1;
1071 rtlphy
->num_total_rfpath
= 2;
1073 /* Config BB and RF */
1074 return rtl92s_phy_rf6052_config(hw
);
1077 void rtl92s_phy_get_hw_reg_originalvalue(struct ieee80211_hw
*hw
)
1079 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1080 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
1082 /* read rx initial gain */
1083 rtlphy
->default_initialgain
[0] = rtl_get_bbreg(hw
,
1084 ROFDM0_XAAGCCORE1
, MASKBYTE0
);
1085 rtlphy
->default_initialgain
[1] = rtl_get_bbreg(hw
,
1086 ROFDM0_XBAGCCORE1
, MASKBYTE0
);
1087 rtlphy
->default_initialgain
[2] = rtl_get_bbreg(hw
,
1088 ROFDM0_XCAGCCORE1
, MASKBYTE0
);
1089 rtlphy
->default_initialgain
[3] = rtl_get_bbreg(hw
,
1090 ROFDM0_XDAGCCORE1
, MASKBYTE0
);
1091 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_LOUD
,
1092 "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n",
1093 rtlphy
->default_initialgain
[0],
1094 rtlphy
->default_initialgain
[1],
1095 rtlphy
->default_initialgain
[2],
1096 rtlphy
->default_initialgain
[3]);
1098 /* read framesync */
1099 rtlphy
->framesync
= rtl_get_bbreg(hw
, ROFDM0_RXDETECTOR3
, MASKBYTE0
);
1100 rtlphy
->framesync_c34
= rtl_get_bbreg(hw
, ROFDM0_RXDETECTOR2
,
1102 RT_TRACE(rtlpriv
, COMP_INIT
, DBG_LOUD
,
1103 "Default framesync (0x%x) = 0x%x\n",
1104 ROFDM0_RXDETECTOR3
, rtlphy
->framesync
);
1108 static void _rtl92s_phy_get_txpower_index(struct ieee80211_hw
*hw
, u8 channel
,
1109 u8
*cckpowerlevel
, u8
*ofdmpowerlevel
)
1111 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1112 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
1113 struct rtl_efuse
*rtlefuse
= rtl_efuse(rtl_priv(hw
));
1114 u8 index
= (channel
- 1);
1118 cckpowerlevel
[0] = rtlefuse
->txpwrlevel_cck
[0][index
];
1120 cckpowerlevel
[1] = rtlefuse
->txpwrlevel_cck
[1][index
];
1122 /* 2. OFDM for 1T or 2T */
1123 if (rtlphy
->rf_type
== RF_1T2R
|| rtlphy
->rf_type
== RF_1T1R
) {
1124 /* Read HT 40 OFDM TX power */
1125 ofdmpowerlevel
[0] = rtlefuse
->txpwrlevel_ht40_1s
[0][index
];
1126 ofdmpowerlevel
[1] = rtlefuse
->txpwrlevel_ht40_1s
[1][index
];
1127 } else if (rtlphy
->rf_type
== RF_2T2R
) {
1128 /* Read HT 40 OFDM TX power */
1129 ofdmpowerlevel
[0] = rtlefuse
->txpwrlevel_ht40_2s
[0][index
];
1130 ofdmpowerlevel
[1] = rtlefuse
->txpwrlevel_ht40_2s
[1][index
];
1132 ofdmpowerlevel
[0] = 0;
1133 ofdmpowerlevel
[1] = 0;
1137 static void _rtl92s_phy_ccxpower_indexcheck(struct ieee80211_hw
*hw
,
1138 u8 channel
, u8
*cckpowerlevel
, u8
*ofdmpowerlevel
)
1140 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1141 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
1143 rtlphy
->cur_cck_txpwridx
= cckpowerlevel
[0];
1144 rtlphy
->cur_ofdm24g_txpwridx
= ofdmpowerlevel
[0];
1147 void rtl92s_phy_set_txpower(struct ieee80211_hw
*hw
, u8 channel
)
1149 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1150 struct rtl_efuse
*rtlefuse
= rtl_efuse(rtl_priv(hw
));
1151 /* [0]:RF-A, [1]:RF-B */
1152 u8 cckpowerlevel
[2], ofdmpowerlevel
[2];
1154 if (!rtlefuse
->txpwr_fromeprom
)
1157 /* Mainly we use RF-A Tx Power to write the Tx Power registers,
1158 * but the RF-B Tx Power must be calculated by the antenna diff.
1159 * So we have to rewrite Antenna gain offset register here.
1160 * Please refer to BB register 0x80c
1162 * 2. For OFDM 1T or 2T */
1163 _rtl92s_phy_get_txpower_index(hw
, channel
, &cckpowerlevel
[0],
1164 &ofdmpowerlevel
[0]);
1166 RT_TRACE(rtlpriv
, COMP_POWER
, DBG_LOUD
,
1167 "Channel-%d, cckPowerLevel (A / B) = 0x%x / 0x%x, ofdmPowerLevel (A / B) = 0x%x / 0x%x\n",
1168 channel
, cckpowerlevel
[0], cckpowerlevel
[1],
1169 ofdmpowerlevel
[0], ofdmpowerlevel
[1]);
1171 _rtl92s_phy_ccxpower_indexcheck(hw
, channel
, &cckpowerlevel
[0],
1172 &ofdmpowerlevel
[0]);
1174 rtl92s_phy_rf6052_set_ccktxpower(hw
, cckpowerlevel
[0]);
1175 rtl92s_phy_rf6052_set_ofdmtxpower(hw
, &ofdmpowerlevel
[0], channel
);
1179 void rtl92s_phy_chk_fwcmd_iodone(struct ieee80211_hw
*hw
)
1181 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1182 u16 pollingcnt
= 10000;
1185 /* Make sure that CMD IO has be accepted by FW. */
1189 tmpvalue
= rtl_read_dword(rtlpriv
, WFM5
);
1192 } while (--pollingcnt
);
1194 if (pollingcnt
== 0)
1195 pr_err("Set FW Cmd fail!!\n");
1199 static void _rtl92s_phy_set_fwcmd_io(struct ieee80211_hw
*hw
)
1201 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1202 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
1203 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
1204 u32 input
, current_aid
= 0;
1206 if (is_hal_stop(rtlhal
))
1209 if (hal_get_firmwareversion(rtlpriv
) < 0x34)
1211 /* We re-map RA related CMD IO to combinational ones */
1212 /* if FW version is v.52 or later. */
1213 switch (rtlhal
->current_fwcmd_io
) {
1214 case FW_CMD_RA_REFRESH_N
:
1215 rtlhal
->current_fwcmd_io
= FW_CMD_RA_REFRESH_N_COMB
;
1217 case FW_CMD_RA_REFRESH_BG
:
1218 rtlhal
->current_fwcmd_io
= FW_CMD_RA_REFRESH_BG_COMB
;
1225 switch (rtlhal
->current_fwcmd_io
) {
1226 case FW_CMD_RA_RESET
:
1227 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_DMESG
, "FW_CMD_RA_RESET\n");
1228 rtl_write_dword(rtlpriv
, WFM5
, FW_RA_RESET
);
1229 rtl92s_phy_chk_fwcmd_iodone(hw
);
1231 case FW_CMD_RA_ACTIVE
:
1232 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_DMESG
, "FW_CMD_RA_ACTIVE\n");
1233 rtl_write_dword(rtlpriv
, WFM5
, FW_RA_ACTIVE
);
1234 rtl92s_phy_chk_fwcmd_iodone(hw
);
1236 case FW_CMD_RA_REFRESH_N
:
1237 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_DMESG
, "FW_CMD_RA_REFRESH_N\n");
1238 input
= FW_RA_REFRESH
;
1239 rtl_write_dword(rtlpriv
, WFM5
, input
);
1240 rtl92s_phy_chk_fwcmd_iodone(hw
);
1241 rtl_write_dword(rtlpriv
, WFM5
, FW_RA_ENABLE_RSSI_MASK
);
1242 rtl92s_phy_chk_fwcmd_iodone(hw
);
1244 case FW_CMD_RA_REFRESH_BG
:
1245 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_DMESG
,
1246 "FW_CMD_RA_REFRESH_BG\n");
1247 rtl_write_dword(rtlpriv
, WFM5
, FW_RA_REFRESH
);
1248 rtl92s_phy_chk_fwcmd_iodone(hw
);
1249 rtl_write_dword(rtlpriv
, WFM5
, FW_RA_DISABLE_RSSI_MASK
);
1250 rtl92s_phy_chk_fwcmd_iodone(hw
);
1252 case FW_CMD_RA_REFRESH_N_COMB
:
1253 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_DMESG
,
1254 "FW_CMD_RA_REFRESH_N_COMB\n");
1255 input
= FW_RA_IOT_N_COMB
;
1256 rtl_write_dword(rtlpriv
, WFM5
, input
);
1257 rtl92s_phy_chk_fwcmd_iodone(hw
);
1259 case FW_CMD_RA_REFRESH_BG_COMB
:
1260 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_DMESG
,
1261 "FW_CMD_RA_REFRESH_BG_COMB\n");
1262 input
= FW_RA_IOT_BG_COMB
;
1263 rtl_write_dword(rtlpriv
, WFM5
, input
);
1264 rtl92s_phy_chk_fwcmd_iodone(hw
);
1266 case FW_CMD_IQK_ENABLE
:
1267 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_DMESG
, "FW_CMD_IQK_ENABLE\n");
1268 rtl_write_dword(rtlpriv
, WFM5
, FW_IQK_ENABLE
);
1269 rtl92s_phy_chk_fwcmd_iodone(hw
);
1271 case FW_CMD_PAUSE_DM_BY_SCAN
:
1272 /* Lower initial gain */
1273 rtl_set_bbreg(hw
, ROFDM0_XAAGCCORE1
, MASKBYTE0
, 0x17);
1274 rtl_set_bbreg(hw
, ROFDM0_XBAGCCORE1
, MASKBYTE0
, 0x17);
1276 rtl_set_bbreg(hw
, RCCK0_CCA
, MASKBYTE2
, 0x40);
1278 case FW_CMD_RESUME_DM_BY_SCAN
:
1280 rtl_set_bbreg(hw
, RCCK0_CCA
, MASKBYTE2
, 0xcd);
1281 rtl92s_phy_set_txpower(hw
, rtlphy
->current_channel
);
1283 case FW_CMD_HIGH_PWR_DISABLE
:
1284 if (rtlpriv
->dm
.dm_flag
& HAL_DM_HIPWR_DISABLE
)
1287 /* Lower initial gain */
1288 rtl_set_bbreg(hw
, ROFDM0_XAAGCCORE1
, MASKBYTE0
, 0x17);
1289 rtl_set_bbreg(hw
, ROFDM0_XBAGCCORE1
, MASKBYTE0
, 0x17);
1291 rtl_set_bbreg(hw
, RCCK0_CCA
, MASKBYTE2
, 0x40);
1293 case FW_CMD_HIGH_PWR_ENABLE
:
1294 if ((rtlpriv
->dm
.dm_flag
& HAL_DM_HIPWR_DISABLE
) ||
1295 rtlpriv
->dm
.dynamic_txpower_enable
)
1299 rtl_set_bbreg(hw
, RCCK0_CCA
, MASKBYTE2
, 0xcd);
1301 case FW_CMD_LPS_ENTER
:
1302 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_DMESG
, "FW_CMD_LPS_ENTER\n");
1303 current_aid
= rtlpriv
->mac80211
.assoc_id
;
1304 rtl_write_dword(rtlpriv
, WFM5
, (FW_LPS_ENTER
|
1305 ((current_aid
| 0xc000) << 8)));
1306 rtl92s_phy_chk_fwcmd_iodone(hw
);
1307 /* FW set TXOP disable here, so disable EDCA
1308 * turbo mode until driver leave LPS */
1310 case FW_CMD_LPS_LEAVE
:
1311 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_DMESG
, "FW_CMD_LPS_LEAVE\n");
1312 rtl_write_dword(rtlpriv
, WFM5
, FW_LPS_LEAVE
);
1313 rtl92s_phy_chk_fwcmd_iodone(hw
);
1315 case FW_CMD_ADD_A2_ENTRY
:
1316 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_DMESG
, "FW_CMD_ADD_A2_ENTRY\n");
1317 rtl_write_dword(rtlpriv
, WFM5
, FW_ADD_A2_ENTRY
);
1318 rtl92s_phy_chk_fwcmd_iodone(hw
);
1320 case FW_CMD_CTRL_DM_BY_DRIVER
:
1321 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
1322 "FW_CMD_CTRL_DM_BY_DRIVER\n");
1323 rtl_write_dword(rtlpriv
, WFM5
, FW_CTRL_DM_BY_DRIVER
);
1324 rtl92s_phy_chk_fwcmd_iodone(hw
);
1331 rtl92s_phy_chk_fwcmd_iodone(hw
);
1333 /* Clear FW CMD operation flag. */
1334 rtlhal
->set_fwcmd_inprogress
= false;
1337 bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw
*hw
, enum fwcmd_iotype fw_cmdio
)
1339 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1340 struct dig_t
*digtable
= &rtlpriv
->dm_digtable
;
1341 struct rtl_hal
*rtlhal
= rtl_hal(rtl_priv(hw
));
1342 struct rtl_efuse
*rtlefuse
= rtl_efuse(rtl_priv(hw
));
1343 u32 fw_param
= FW_CMD_IO_PARA_QUERY(rtlpriv
);
1344 u16 fw_cmdmap
= FW_CMD_IO_QUERY(rtlpriv
);
1345 bool postprocessing
= false;
1347 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
1348 "Set FW Cmd(%#x), set_fwcmd_inprogress(%d)\n",
1349 fw_cmdio
, rtlhal
->set_fwcmd_inprogress
);
1352 /* We re-map to combined FW CMD ones if firmware version */
1353 /* is v.53 or later. */
1354 if (hal_get_firmwareversion(rtlpriv
) >= 0x35) {
1356 case FW_CMD_RA_REFRESH_N
:
1357 fw_cmdio
= FW_CMD_RA_REFRESH_N_COMB
;
1359 case FW_CMD_RA_REFRESH_BG
:
1360 fw_cmdio
= FW_CMD_RA_REFRESH_BG_COMB
;
1366 if ((fw_cmdio
== FW_CMD_IQK_ENABLE
) ||
1367 (fw_cmdio
== FW_CMD_RA_REFRESH_N
) ||
1368 (fw_cmdio
== FW_CMD_RA_REFRESH_BG
)) {
1369 postprocessing
= true;
1374 /* If firmware version is v.62 or later,
1375 * use FW_CMD_IO_SET for FW_CMD_CTRL_DM_BY_DRIVER */
1376 if (hal_get_firmwareversion(rtlpriv
) >= 0x3E) {
1377 if (fw_cmdio
== FW_CMD_CTRL_DM_BY_DRIVER
)
1378 fw_cmdio
= FW_CMD_CTRL_DM_BY_DRIVER_NEW
;
1382 /* We shall revise all FW Cmd IO into Reg0x364
1383 * DM map table in the future. */
1385 case FW_CMD_RA_INIT
:
1386 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
, "RA init!!\n");
1387 fw_cmdmap
|= FW_RA_INIT_CTL
;
1388 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1389 /* Clear control flag to sync with FW. */
1390 FW_CMD_IO_CLR(rtlpriv
, FW_RA_INIT_CTL
);
1392 case FW_CMD_DIG_DISABLE
:
1393 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
1394 "Set DIG disable!!\n");
1395 fw_cmdmap
&= ~FW_DIG_ENABLE_CTL
;
1396 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1398 case FW_CMD_DIG_ENABLE
:
1399 case FW_CMD_DIG_RESUME
:
1400 if (!(rtlpriv
->dm
.dm_flag
& HAL_DM_DIG_DISABLE
)) {
1401 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
1402 "Set DIG enable or resume!!\n");
1403 fw_cmdmap
|= (FW_DIG_ENABLE_CTL
| FW_SS_CTL
);
1404 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1407 case FW_CMD_DIG_HALT
:
1408 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
1409 "Set DIG halt!!\n");
1410 fw_cmdmap
&= ~(FW_DIG_ENABLE_CTL
| FW_SS_CTL
);
1411 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1413 case FW_CMD_TXPWR_TRACK_THERMAL
: {
1415 fw_cmdmap
|= FW_PWR_TRK_CTL
;
1417 /* Clear FW parameter in terms of thermal parts. */
1418 fw_param
&= FW_PWR_TRK_PARAM_CLR
;
1420 thermalval
= rtlpriv
->dm
.thermalvalue
;
1421 fw_param
|= ((thermalval
<< 24) |
1422 (rtlefuse
->thermalmeter
[0] << 16));
1424 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
1425 "Set TxPwr tracking!! FwCmdMap(%#x), FwParam(%#x)\n",
1426 fw_cmdmap
, fw_param
);
1428 FW_CMD_PARA_SET(rtlpriv
, fw_param
);
1429 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1431 /* Clear control flag to sync with FW. */
1432 FW_CMD_IO_CLR(rtlpriv
, FW_PWR_TRK_CTL
);
1435 /* The following FW CMDs are only compatible to
1437 case FW_CMD_RA_REFRESH_N_COMB
:
1438 fw_cmdmap
|= FW_RA_N_CTL
;
1440 /* Clear RA BG mode control. */
1441 fw_cmdmap
&= ~(FW_RA_BG_CTL
| FW_RA_INIT_CTL
);
1443 /* Clear FW parameter in terms of RA parts. */
1444 fw_param
&= FW_RA_PARAM_CLR
;
1446 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
1447 "[FW CMD] [New Version] Set RA/IOT Comb in n mode!! FwCmdMap(%#x), FwParam(%#x)\n",
1448 fw_cmdmap
, fw_param
);
1450 FW_CMD_PARA_SET(rtlpriv
, fw_param
);
1451 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1453 /* Clear control flag to sync with FW. */
1454 FW_CMD_IO_CLR(rtlpriv
, FW_RA_N_CTL
);
1456 case FW_CMD_RA_REFRESH_BG_COMB
:
1457 fw_cmdmap
|= FW_RA_BG_CTL
;
1459 /* Clear RA n-mode control. */
1460 fw_cmdmap
&= ~(FW_RA_N_CTL
| FW_RA_INIT_CTL
);
1461 /* Clear FW parameter in terms of RA parts. */
1462 fw_param
&= FW_RA_PARAM_CLR
;
1464 FW_CMD_PARA_SET(rtlpriv
, fw_param
);
1465 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1467 /* Clear control flag to sync with FW. */
1468 FW_CMD_IO_CLR(rtlpriv
, FW_RA_BG_CTL
);
1470 case FW_CMD_IQK_ENABLE
:
1471 fw_cmdmap
|= FW_IQK_CTL
;
1472 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1473 /* Clear control flag to sync with FW. */
1474 FW_CMD_IO_CLR(rtlpriv
, FW_IQK_CTL
);
1476 /* The following FW CMD is compatible to v.62 or later. */
1477 case FW_CMD_CTRL_DM_BY_DRIVER_NEW
:
1478 fw_cmdmap
|= FW_DRIVER_CTRL_DM_CTL
;
1479 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1481 /* The followed FW Cmds needs post-processing later. */
1482 case FW_CMD_RESUME_DM_BY_SCAN
:
1483 fw_cmdmap
|= (FW_DIG_ENABLE_CTL
|
1484 FW_HIGH_PWR_ENABLE_CTL
|
1487 if (rtlpriv
->dm
.dm_flag
& HAL_DM_DIG_DISABLE
||
1488 !digtable
->dig_enable_flag
)
1489 fw_cmdmap
&= ~FW_DIG_ENABLE_CTL
;
1491 if ((rtlpriv
->dm
.dm_flag
& HAL_DM_HIPWR_DISABLE
) ||
1492 rtlpriv
->dm
.dynamic_txpower_enable
)
1493 fw_cmdmap
&= ~FW_HIGH_PWR_ENABLE_CTL
;
1495 if ((digtable
->dig_ext_port_stage
==
1496 DIG_EXT_PORT_STAGE_0
) ||
1497 (digtable
->dig_ext_port_stage
==
1498 DIG_EXT_PORT_STAGE_1
))
1499 fw_cmdmap
&= ~FW_DIG_ENABLE_CTL
;
1501 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1502 postprocessing
= true;
1504 case FW_CMD_PAUSE_DM_BY_SCAN
:
1505 fw_cmdmap
&= ~(FW_DIG_ENABLE_CTL
|
1506 FW_HIGH_PWR_ENABLE_CTL
|
1508 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1509 postprocessing
= true;
1511 case FW_CMD_HIGH_PWR_DISABLE
:
1512 fw_cmdmap
&= ~FW_HIGH_PWR_ENABLE_CTL
;
1513 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1514 postprocessing
= true;
1516 case FW_CMD_HIGH_PWR_ENABLE
:
1517 if (!(rtlpriv
->dm
.dm_flag
& HAL_DM_HIPWR_DISABLE
) &&
1518 !rtlpriv
->dm
.dynamic_txpower_enable
) {
1519 fw_cmdmap
|= (FW_HIGH_PWR_ENABLE_CTL
|
1521 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1522 postprocessing
= true;
1525 case FW_CMD_DIG_MODE_FA
:
1526 fw_cmdmap
|= FW_FA_CTL
;
1527 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1529 case FW_CMD_DIG_MODE_SS
:
1530 fw_cmdmap
&= ~FW_FA_CTL
;
1531 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1533 case FW_CMD_PAPE_CONTROL
:
1534 RT_TRACE(rtlpriv
, COMP_CMD
, DBG_LOUD
,
1535 "[FW CMD] Set PAPE Control\n");
1536 fw_cmdmap
&= ~FW_PAPE_CTL_BY_SW_HW
;
1538 FW_CMD_IO_SET(rtlpriv
, fw_cmdmap
);
1541 /* Pass to original FW CMD processing callback
1543 postprocessing
= true;
1548 /* We shall post processing these FW CMD if
1549 * variable postprocessing is set.
1551 if (postprocessing
&& !rtlhal
->set_fwcmd_inprogress
) {
1552 rtlhal
->set_fwcmd_inprogress
= true;
1553 /* Update current FW Cmd for callback use. */
1554 rtlhal
->current_fwcmd_io
= fw_cmdio
;
1559 _rtl92s_phy_set_fwcmd_io(hw
);
1563 static void _rtl92s_phy_check_ephy_switchready(struct ieee80211_hw
*hw
)
1565 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1569 regu1
= rtl_read_byte(rtlpriv
, 0x554);
1570 while ((regu1
& BIT(5)) && (delay
> 0)) {
1571 regu1
= rtl_read_byte(rtlpriv
, 0x554);
1573 /* We delay only 50us to prevent
1574 * being scheduled out. */
1579 void rtl92s_phy_switch_ephy_parameter(struct ieee80211_hw
*hw
)
1581 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1582 struct rtl_ps_ctl
*ppsc
= rtl_psc(rtl_priv(hw
));
1584 /* The way to be capable to switch clock request
1585 * when the PG setting does not support clock request.
1586 * This is the backdoor solution to switch clock
1587 * request before ASPM or D3. */
1588 rtl_write_dword(rtlpriv
, 0x540, 0x73c11);
1589 rtl_write_dword(rtlpriv
, 0x548, 0x2407c);
1591 /* Switch EPHY parameter!!!! */
1592 rtl_write_word(rtlpriv
, 0x550, 0x1000);
1593 rtl_write_byte(rtlpriv
, 0x554, 0x20);
1594 _rtl92s_phy_check_ephy_switchready(hw
);
1596 rtl_write_word(rtlpriv
, 0x550, 0xa0eb);
1597 rtl_write_byte(rtlpriv
, 0x554, 0x3e);
1598 _rtl92s_phy_check_ephy_switchready(hw
);
1600 rtl_write_word(rtlpriv
, 0x550, 0xff80);
1601 rtl_write_byte(rtlpriv
, 0x554, 0x39);
1602 _rtl92s_phy_check_ephy_switchready(hw
);
1604 /* Delay L1 enter time */
1605 if (ppsc
->support_aspm
&& !ppsc
->support_backdoor
)
1606 rtl_write_byte(rtlpriv
, 0x560, 0x40);
1608 rtl_write_byte(rtlpriv
, 0x560, 0x00);
1612 void rtl92s_phy_set_beacon_hwreg(struct ieee80211_hw
*hw
, u16 beaconinterval
)
1614 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
1615 u32 new_bcn_num
= 0;
1617 if (hal_get_firmwareversion(rtlpriv
) >= 0x33) {
1618 /* Fw v.51 and later. */
1619 rtl_write_dword(rtlpriv
, WFM5
, 0xF1000000 |
1620 (beaconinterval
<< 8));
1622 new_bcn_num
= beaconinterval
* 32 - 64;
1623 rtl_write_dword(rtlpriv
, WFM3
+ 4, new_bcn_num
);
1624 rtl_write_dword(rtlpriv
, WFM3
, 0xB026007C);