41 static bool _rtl92c_phy_config_mac_with_headerfile(
struct ieee80211_hw *
hw);
47 u32 original_value, readback_value, bitshift;
51 "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
52 regaddr, rfpath, bitmask);
54 spin_lock(&rtlpriv->
locks.rf_lock);
65 readback_value = (original_value &
bitmask) >> bitshift;
67 spin_unlock(&rtlpriv->
locks.rf_lock);
70 "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
71 regaddr, rfpath, bitmask, original_value);
73 return readback_value;
81 bool rtstatus = _rtl92c_phy_config_mac_with_headerfile(hw);
84 rtl_write_byte(rtlpriv, 0x14, 0x71);
94 u8 reg_hwparafile = 1;
109 if (reg_hwparafile == 1)
120 u32 original_value, bitshift;
123 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
124 regaddr, bitmask, data, rfpath);
126 spin_lock(&rtlpriv->
locks.rf_lock);
135 ((original_value & (~bitmask)) |
147 ((original_value & (~bitmask)) |
153 spin_unlock(&rtlpriv->
locks.rf_lock);
156 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
157 regaddr, bitmask, data, rfpath);
160 static bool _rtl92c_phy_config_mac_with_headerfile(
struct ieee80211_hw *
hw)
171 for (i = 0; i < arraylength; i = i + 2)
172 rtl_write_byte(rtlpriv, ptrarray[i], (
u8) ptrarray[i + 1]);
180 u32 *phy_regarray_table;
181 u32 *agctab_array_table;
182 u16 phy_reg_arraylen, agctab_arraylen;
198 for (i = 0; i < phy_reg_arraylen; i = i + 2) {
199 if (phy_regarray_table[i] == 0xfe)
201 else if (phy_regarray_table[i] == 0xfd)
203 else if (phy_regarray_table[i] == 0xfc)
205 else if (phy_regarray_table[i] == 0xfb)
207 else if (phy_regarray_table[i] == 0xfa)
209 else if (phy_regarray_table[i] == 0xf9)
211 rtl_set_bbreg(hw, phy_regarray_table[i],
MASKDWORD,
212 phy_regarray_table[i + 1]);
215 "The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
216 phy_regarray_table[i],
217 phy_regarray_table[i + 1]);
220 for (i = 0; i < agctab_arraylen; i = i + 2) {
221 rtl_set_bbreg(hw, agctab_array_table[i],
MASKDWORD,
222 agctab_array_table[i + 1]);
225 "The agctab_array_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
226 agctab_array_table[i],
227 agctab_array_table[i + 1]);
238 u32 *phy_regarray_table_pg;
239 u16 phy_regarray_pg_len;
245 for (i = 0; i < phy_regarray_pg_len; i = i + 3) {
246 if (phy_regarray_table_pg[i] == 0xfe)
248 else if (phy_regarray_table_pg[i] == 0xfd)
250 else if (phy_regarray_table_pg[i] == 0xfc)
252 else if (phy_regarray_table_pg[i] == 0xfb)
254 else if (phy_regarray_table_pg[i] == 0xfa)
256 else if (phy_regarray_table_pg[i] == 0xf9)
260 phy_regarray_table_pg[i],
261 phy_regarray_table_pg[i + 1],
262 phy_regarray_table_pg[i + 2]);
267 "configtype != BaseBand_Config_PHY_REG\n");
277 u32 *radioa_array_table;
278 u32 *radiob_array_table;
279 u16 radioa_arraylen, radiob_arraylen;
289 "Radio_A:RTL8192CERADIOA_2TARRAY\n");
291 "Radio_B:RTL8192CE_RADIOB_2TARRAY\n");
298 "Radio_A:RTL8192CE_RADIOA_1TARRAY\n");
300 "Radio_B:RTL8192CE_RADIOB_1TARRAY\n");
305 for (i = 0; i < radioa_arraylen; i = i + 2) {
306 if (radioa_array_table[i] == 0xfe)
308 else if (radioa_array_table[i] == 0xfd)
310 else if (radioa_array_table[i] == 0xfc)
312 else if (radioa_array_table[i] == 0xfb)
314 else if (radioa_array_table[i] == 0xfa)
316 else if (radioa_array_table[i] == 0xf9)
319 rtl_set_rfreg(hw, rfpath, radioa_array_table[i],
321 radioa_array_table[i + 1]);
327 for (i = 0; i < radiob_arraylen; i = i + 2) {
328 if (radiob_array_table[i] == 0xfe) {
330 }
else if (radiob_array_table[i] == 0xfd)
332 else if (radiob_array_table[i] == 0xfc)
334 else if (radiob_array_table[i] == 0xfb)
336 else if (radiob_array_table[i] == 0xfa)
338 else if (radiob_array_table[i] == 0xf9)
341 rtl_set_rfreg(hw, rfpath, radiob_array_table[i],
343 radiob_array_table[i + 1]);
350 "switch case not processed\n");
354 "switch case not processed\n");
373 if (is_hal_stop(rtlhal)) {
379 reg_prsr_rsc = rtl_read_byte(rtlpriv,
REG_RRSR + 2);
391 rtl_write_byte(rtlpriv,
REG_RRSR + 2, reg_prsr_rsc);
414 rtl_set_bbreg(hw, 0x818, (
BIT(26) |
BIT(27)),
431 u32 rf_a_mode = 0, rf_b_mode = 0, lc_cal;
434 tmpreg = rtl_read_byte(rtlpriv, 0xd03);
436 if ((tmpreg & 0x70) != 0)
437 rtl_write_byte(rtlpriv, 0xd03, tmpreg & 0x8F);
441 if ((tmpreg & 0x70) != 0) {
449 (rf_a_mode & 0x8FFFF) | 0x10000);
453 (rf_b_mode & 0x8FFFF) | 0x10000);
461 if ((tmpreg & 0x70) != 0) {
462 rtl_write_byte(rtlpriv, 0xd03, tmpreg);
473 static void _rtl92ce_phy_set_rf_sleep(
struct ieee80211_hw *hw)
483 while (u4b_tmp != 0 && delay > 0) {
496 "Switch RF timeout !!!\n");
503 static bool _rtl92ce_phy_set_rf_power_state(
struct ieee80211_hw *hw,
514 switch (rfpwr_state) {
519 u32 InitializeCount = 0;
523 "IPS Set eRf nic enable\n");
525 }
while (!rtstatus && (InitializeCount < 10));
530 "Set ERFON sleeped:%d ms\n",
533 last_sleep_jiffies));
538 rtlpriv->
cfg->ops->led_control(hw,
541 rtlpriv->
cfg->ops->led_control(hw,
549 "IPS Set eRf nic disable\n");
554 rtlpriv->
cfg->ops->led_control(hw,
557 rtlpriv->
cfg->ops->led_control(hw,
566 for (queue_id = 0, i = 0;
568 ring = &pcipriv->
dev.tx_ring[queue_id];
569 if (skb_queue_len(&ring->
queue) == 0) {
574 "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
576 skb_queue_len(&ring->
queue));
583 "ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n",
586 skb_queue_len(&ring->
queue));
591 "Set ERFSLEEP awaked:%d ms\n",
595 _rtl92ce_phy_set_rf_sleep(hw);
600 "switch case not processed\n");
614 bool bresult =
false;
618 bresult = _rtl92ce_phy_set_rf_power_state(hw, rfpwr_state);