diff options
Diffstat (limited to 'drivers/net/wireless/rtlwifi/rtl8192ce')
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192ce/phy.c | 191 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192ce/phy.h | 51 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192ce/rf.c | 24 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192ce/rf.h | 17 |
4 files changed, 157 insertions, 126 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c index d0541e8c6012..bbba6f8a8349 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c | |||
@@ -38,7 +38,9 @@ | |||
38 | #include "dm.h" | 38 | #include "dm.h" |
39 | #include "table.h" | 39 | #include "table.h" |
40 | 40 | ||
41 | u32 rtl92ce_phy_query_rf_reg(struct ieee80211_hw *hw, | 41 | static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); |
42 | |||
43 | u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, | ||
42 | enum radio_path rfpath, u32 regaddr, u32 bitmask) | 44 | enum radio_path rfpath, u32 regaddr, u32 bitmask) |
43 | { | 45 | { |
44 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 46 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
@@ -73,9 +75,47 @@ u32 rtl92ce_phy_query_rf_reg(struct ieee80211_hw *hw, | |||
73 | return readback_value; | 75 | return readback_value; |
74 | } | 76 | } |
75 | 77 | ||
78 | bool rtl92c_phy_mac_config(struct ieee80211_hw *hw) | ||
79 | { | ||
80 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
81 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | ||
82 | bool is92c = IS_92C_SERIAL(rtlhal->version); | ||
83 | bool rtstatus = _rtl92c_phy_config_mac_with_headerfile(hw); | ||
84 | |||
85 | if (is92c) | ||
86 | rtl_write_byte(rtlpriv, 0x14, 0x71); | ||
87 | return rtstatus; | ||
88 | } | ||
89 | |||
90 | bool rtl92c_phy_bb_config(struct ieee80211_hw *hw) | ||
91 | { | ||
92 | bool rtstatus = true; | ||
93 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
94 | u16 regval; | ||
95 | u32 regvaldw; | ||
96 | u8 reg_hwparafile = 1; | ||
97 | |||
98 | _rtl92c_phy_init_bb_rf_register_definition(hw); | ||
99 | regval = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); | ||
100 | rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, | ||
101 | regval | BIT(13) | BIT(0) | BIT(1)); | ||
102 | rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, 0x83); | ||
103 | rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL + 1, 0xdb); | ||
104 | rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB); | ||
105 | rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, | ||
106 | FEN_PPLL | FEN_PCIEA | FEN_DIO_PCIE | | ||
107 | FEN_BB_GLB_RSTn | FEN_BBRSTB); | ||
108 | rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL + 1, 0x80); | ||
109 | regvaldw = rtl_read_dword(rtlpriv, REG_LEDCFG0); | ||
110 | rtl_write_dword(rtlpriv, REG_LEDCFG0, regvaldw | BIT(23)); | ||
111 | if (reg_hwparafile == 1) | ||
112 | rtstatus = _rtl92c_phy_bb8192c_config_parafile(hw); | ||
113 | return rtstatus; | ||
114 | } | ||
115 | |||
76 | void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, | 116 | void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, |
77 | enum radio_path rfpath, | 117 | enum radio_path rfpath, |
78 | u32 regaddr, u32 bitmask, u32 data) | 118 | u32 regaddr, u32 bitmask, u32 data) |
79 | { | 119 | { |
80 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 120 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
81 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 121 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
@@ -121,45 +161,7 @@ void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, | |||
121 | bitmask, data, rfpath)); | 161 | bitmask, data, rfpath)); |
122 | } | 162 | } |
123 | 163 | ||
124 | bool rtl92ce_phy_mac_config(struct ieee80211_hw *hw) | 164 | static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw) |
125 | { | ||
126 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
127 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | ||
128 | bool is92c = IS_92C_SERIAL(rtlhal->version); | ||
129 | bool rtstatus = _rtl92ce_phy_config_mac_with_headerfile(hw); | ||
130 | |||
131 | if (is92c) | ||
132 | rtl_write_byte(rtlpriv, 0x14, 0x71); | ||
133 | return rtstatus; | ||
134 | } | ||
135 | |||
136 | bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw) | ||
137 | { | ||
138 | bool rtstatus = true; | ||
139 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
140 | u16 regval; | ||
141 | u32 regvaldw; | ||
142 | u8 reg_hwparafile = 1; | ||
143 | |||
144 | _rtl92c_phy_init_bb_rf_register_definition(hw); | ||
145 | regval = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); | ||
146 | rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, | ||
147 | regval | BIT(13) | BIT(0) | BIT(1)); | ||
148 | rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, 0x83); | ||
149 | rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL + 1, 0xdb); | ||
150 | rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB); | ||
151 | rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, | ||
152 | FEN_PPLL | FEN_PCIEA | FEN_DIO_PCIE | | ||
153 | FEN_BB_GLB_RSTn | FEN_BBRSTB); | ||
154 | rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL + 1, 0x80); | ||
155 | regvaldw = rtl_read_dword(rtlpriv, REG_LEDCFG0); | ||
156 | rtl_write_dword(rtlpriv, REG_LEDCFG0, regvaldw | BIT(23)); | ||
157 | if (reg_hwparafile == 1) | ||
158 | rtstatus = _rtl92c_phy_bb8192c_config_parafile(hw); | ||
159 | return rtstatus; | ||
160 | } | ||
161 | |||
162 | bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw) | ||
163 | { | 165 | { |
164 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 166 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
165 | u32 i; | 167 | u32 i; |
@@ -177,7 +179,7 @@ bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw) | |||
177 | } | 179 | } |
178 | 180 | ||
179 | bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, | 181 | bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, |
180 | u8 configtype) | 182 | u8 configtype) |
181 | { | 183 | { |
182 | int i; | 184 | int i; |
183 | u32 *phy_regarray_table; | 185 | u32 *phy_regarray_table; |
@@ -236,7 +238,7 @@ bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, | |||
236 | } | 238 | } |
237 | 239 | ||
238 | bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, | 240 | bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, |
239 | u8 configtype) | 241 | u8 configtype) |
240 | { | 242 | { |
241 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 243 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
242 | int i; | 244 | int i; |
@@ -274,7 +276,7 @@ bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, | |||
274 | return true; | 276 | return true; |
275 | } | 277 | } |
276 | 278 | ||
277 | bool rtl92ce_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 279 | bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
278 | enum radio_path rfpath) | 280 | enum radio_path rfpath) |
279 | { | 281 | { |
280 | 282 | ||
@@ -364,7 +366,7 @@ bool rtl92ce_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | |||
364 | return true; | 366 | return true; |
365 | } | 367 | } |
366 | 368 | ||
367 | void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw) | 369 | static void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw) |
368 | { | 370 | { |
369 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 371 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
370 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 372 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
@@ -378,8 +380,10 @@ void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw) | |||
378 | rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? | 380 | rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? |
379 | "20MHz" : "40MHz")) | 381 | "20MHz" : "40MHz")) |
380 | 382 | ||
381 | if (is_hal_stop(rtlhal)) | 383 | if (is_hal_stop(rtlhal)) { |
384 | rtlphy->set_bwmode_inprogress = false; | ||
382 | return; | 385 | return; |
386 | } | ||
383 | 387 | ||
384 | reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE); | 388 | reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE); |
385 | reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2); | 389 | reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2); |
@@ -389,16 +393,13 @@ void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw) | |||
389 | reg_bw_opmode |= BW_OPMODE_20MHZ; | 393 | reg_bw_opmode |= BW_OPMODE_20MHZ; |
390 | rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); | 394 | rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); |
391 | break; | 395 | break; |
392 | |||
393 | case HT_CHANNEL_WIDTH_20_40: | 396 | case HT_CHANNEL_WIDTH_20_40: |
394 | reg_bw_opmode &= ~BW_OPMODE_20MHZ; | 397 | reg_bw_opmode &= ~BW_OPMODE_20MHZ; |
395 | rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); | 398 | rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); |
396 | |||
397 | reg_prsr_rsc = | 399 | reg_prsr_rsc = |
398 | (reg_prsr_rsc & 0x90) | (mac->cur_40_prime_sc << 5); | 400 | (reg_prsr_rsc & 0x90) | (mac->cur_40_prime_sc << 5); |
399 | rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc); | 401 | rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc); |
400 | break; | 402 | break; |
401 | |||
402 | default: | 403 | default: |
403 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 404 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
404 | ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); | 405 | ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); |
@@ -414,10 +415,12 @@ void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw) | |||
414 | case HT_CHANNEL_WIDTH_20_40: | 415 | case HT_CHANNEL_WIDTH_20_40: |
415 | rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1); | 416 | rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1); |
416 | rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1); | 417 | rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1); |
418 | |||
417 | rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCK_SIDEBAND, | 419 | rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCK_SIDEBAND, |
418 | (mac->cur_40_prime_sc >> 1)); | 420 | (mac->cur_40_prime_sc >> 1)); |
419 | rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc); | 421 | rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc); |
420 | rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 0); | 422 | rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 0); |
423 | |||
421 | rtl_set_bbreg(hw, 0x818, (BIT(26) | BIT(27)), | 424 | rtl_set_bbreg(hw, 0x818, (BIT(26) | BIT(27)), |
422 | (mac->cur_40_prime_sc == | 425 | (mac->cur_40_prime_sc == |
423 | HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); | 426 | HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); |
@@ -427,11 +430,34 @@ void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw) | |||
427 | ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); | 430 | ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); |
428 | break; | 431 | break; |
429 | } | 432 | } |
430 | rtl92c_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); | 433 | #if 0 /* temporary */ |
434 | rtl92ce_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); | ||
435 | #endif | ||
431 | rtlphy->set_bwmode_inprogress = false; | 436 | rtlphy->set_bwmode_inprogress = false; |
432 | RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); | 437 | RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); |
433 | } | 438 | } |
434 | 439 | ||
440 | void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, | ||
441 | enum nl80211_channel_type ch_type) | ||
442 | { | ||
443 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
444 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | ||
445 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | ||
446 | u8 tmp_bw = rtlphy->current_chan_bw; | ||
447 | |||
448 | if (rtlphy->set_bwmode_inprogress) | ||
449 | return; | ||
450 | rtlphy->set_bwmode_inprogress = true; | ||
451 | if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { | ||
452 | rtl92c_phy_set_bw_mode_callback(hw); | ||
453 | } else { | ||
454 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
455 | ("FALSE driver sleep or unload\n")); | ||
456 | rtlphy->set_bwmode_inprogress = false; | ||
457 | rtlphy->current_chan_bw = tmp_bw; | ||
458 | } | ||
459 | } | ||
460 | |||
435 | void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) | 461 | void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) |
436 | { | 462 | { |
437 | u8 tmpreg; | 463 | u8 tmpreg; |
@@ -477,6 +503,36 @@ void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) | |||
477 | } | 503 | } |
478 | } | 504 | } |
479 | 505 | ||
506 | static void _rtl92ce_phy_set_rf_sleep(struct ieee80211_hw *hw) | ||
507 | { | ||
508 | u32 u4b_tmp; | ||
509 | u8 delay = 5; | ||
510 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
511 | |||
512 | rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); | ||
513 | rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00); | ||
514 | rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); | ||
515 | u4b_tmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, RFREG_OFFSET_MASK); | ||
516 | while (u4b_tmp != 0 && delay > 0) { | ||
517 | rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x0); | ||
518 | rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00); | ||
519 | rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); | ||
520 | u4b_tmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, RFREG_OFFSET_MASK); | ||
521 | delay--; | ||
522 | } | ||
523 | if (delay == 0) { | ||
524 | rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x00); | ||
525 | rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); | ||
526 | rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); | ||
527 | rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); | ||
528 | RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, | ||
529 | ("Switch RF timeout !!!.\n")); | ||
530 | return; | ||
531 | } | ||
532 | rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); | ||
533 | rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x22); | ||
534 | } | ||
535 | |||
480 | static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, | 536 | static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, |
481 | enum rf_pwrstate rfpwr_state) | 537 | enum rf_pwrstate rfpwr_state) |
482 | { | 538 | { |
@@ -523,33 +579,6 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, | |||
523 | break; | 579 | break; |
524 | } | 580 | } |
525 | case ERFOFF:{ | 581 | case ERFOFF:{ |
526 | for (queue_id = 0, i = 0; | ||
527 | queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { | ||
528 | ring = &pcipriv->dev.tx_ring[queue_id]; | ||
529 | if (skb_queue_len(&ring->queue) == 0 || | ||
530 | queue_id == BEACON_QUEUE) { | ||
531 | queue_id++; | ||
532 | continue; | ||
533 | } else { | ||
534 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
535 | ("eRf Off/Sleep: %d times " | ||
536 | "TcbBusyQueue[%d] " | ||
537 | "=%d before doze!\n", (i + 1), | ||
538 | queue_id, | ||
539 | skb_queue_len(&ring->queue))); | ||
540 | udelay(10); | ||
541 | i++; | ||
542 | } | ||
543 | if (i >= MAX_DOZE_WAITING_TIMES_9x) { | ||
544 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | ||
545 | ("\nERFOFF: %d times " | ||
546 | "TcbBusyQueue[%d] = %d !\n", | ||
547 | MAX_DOZE_WAITING_TIMES_9x, | ||
548 | queue_id, | ||
549 | skb_queue_len(&ring->queue))); | ||
550 | break; | ||
551 | } | ||
552 | } | ||
553 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { | 582 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { |
554 | RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, | 583 | RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, |
555 | ("IPS Set eRf nic disable\n")); | 584 | ("IPS Set eRf nic disable\n")); |
@@ -581,6 +610,7 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, | |||
581 | "TcbBusyQueue[%d] =%d before " | 610 | "TcbBusyQueue[%d] =%d before " |
582 | "doze!\n", (i + 1), queue_id, | 611 | "doze!\n", (i + 1), queue_id, |
583 | skb_queue_len(&ring->queue))); | 612 | skb_queue_len(&ring->queue))); |
613 | |||
584 | udelay(10); | 614 | udelay(10); |
585 | i++; | 615 | i++; |
586 | } | 616 | } |
@@ -599,7 +629,7 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, | |||
599 | jiffies_to_msecs(jiffies - | 629 | jiffies_to_msecs(jiffies - |
600 | ppsc->last_awake_jiffies))); | 630 | ppsc->last_awake_jiffies))); |
601 | ppsc->last_sleep_jiffies = jiffies; | 631 | ppsc->last_sleep_jiffies = jiffies; |
602 | _rtl92c_phy_set_rf_sleep(hw); | 632 | _rtl92ce_phy_set_rf_sleep(hw); |
603 | break; | 633 | break; |
604 | } | 634 | } |
605 | default: | 635 | default: |
@@ -614,10 +644,11 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, | |||
614 | return bresult; | 644 | return bresult; |
615 | } | 645 | } |
616 | 646 | ||
617 | bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, | 647 | bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, |
618 | enum rf_pwrstate rfpwr_state) | 648 | enum rf_pwrstate rfpwr_state) |
619 | { | 649 | { |
620 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); | 650 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); |
651 | |||
621 | bool bresult = false; | 652 | bool bresult = false; |
622 | 653 | ||
623 | if (rfpwr_state == ppsc->rfpwr_state) | 654 | if (rfpwr_state == ppsc->rfpwr_state) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h index a37267e3fc22..eb93088d0ed8 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h | |||
@@ -39,6 +39,7 @@ | |||
39 | #define RT_CANNOT_IO(hw) false | 39 | #define RT_CANNOT_IO(hw) false |
40 | #define HIGHPOWER_RADIOA_ARRAYLEN 22 | 40 | #define HIGHPOWER_RADIOA_ARRAYLEN 22 |
41 | 41 | ||
42 | #define IQK_ADDA_REG_NUM 16 | ||
42 | #define MAX_TOLERANCE 5 | 43 | #define MAX_TOLERANCE 5 |
43 | #define IQK_DELAY_TIME 1 | 44 | #define IQK_DELAY_TIME 1 |
44 | 45 | ||
@@ -56,6 +57,8 @@ | |||
56 | #define IQK_ADDA_REG_NUM 16 | 57 | #define IQK_ADDA_REG_NUM 16 |
57 | #define IQK_MAC_REG_NUM 4 | 58 | #define IQK_MAC_REG_NUM 4 |
58 | 59 | ||
60 | #define IQK_DELAY_TIME 1 | ||
61 | |||
59 | #define RF90_PATH_MAX 2 | 62 | #define RF90_PATH_MAX 2 |
60 | 63 | ||
61 | #define CT_OFFSET_MAC_ADDR 0X16 | 64 | #define CT_OFFSET_MAC_ADDR 0X16 |
@@ -76,7 +79,7 @@ | |||
76 | #define CT_OFFSET_CUSTOMER_ID 0x7F | 79 | #define CT_OFFSET_CUSTOMER_ID 0x7F |
77 | 80 | ||
78 | #define RTL92C_MAX_PATH_NUM 2 | 81 | #define RTL92C_MAX_PATH_NUM 2 |
79 | #define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER 255 | 82 | |
80 | enum swchnlcmd_id { | 83 | enum swchnlcmd_id { |
81 | CMDID_END, | 84 | CMDID_END, |
82 | CMDID_SET_TXPOWEROWER_LEVEL, | 85 | CMDID_SET_TXPOWEROWER_LEVEL, |
@@ -184,43 +187,44 @@ struct tx_power_struct { | |||
184 | u32 mcs_original_offset[4][16]; | 187 | u32 mcs_original_offset[4][16]; |
185 | }; | 188 | }; |
186 | 189 | ||
187 | extern u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, | 190 | bool rtl92c_phy_bb_config(struct ieee80211_hw *hw); |
191 | u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, | ||
188 | u32 regaddr, u32 bitmask); | 192 | u32 regaddr, u32 bitmask); |
189 | extern void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, | 193 | void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, |
190 | u32 regaddr, u32 bitmask, u32 data); | 194 | u32 regaddr, u32 bitmask, u32 data); |
191 | extern u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, | 195 | u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, |
192 | enum radio_path rfpath, u32 regaddr, | 196 | enum radio_path rfpath, u32 regaddr, |
193 | u32 bitmask); | 197 | u32 bitmask); |
194 | extern void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, | 198 | extern void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, |
195 | enum radio_path rfpath, u32 regaddr, | 199 | enum radio_path rfpath, u32 regaddr, |
196 | u32 bitmask, u32 data); | 200 | u32 bitmask, u32 data); |
197 | extern bool rtl92c_phy_mac_config(struct ieee80211_hw *hw); | 201 | bool rtl92c_phy_mac_config(struct ieee80211_hw *hw); |
198 | bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw); | 202 | bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw); |
199 | extern bool rtl92c_phy_rf_config(struct ieee80211_hw *hw); | 203 | bool rtl92c_phy_rf_config(struct ieee80211_hw *hw); |
200 | extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, | 204 | bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, |
201 | enum radio_path rfpath); | 205 | enum radio_path rfpath); |
202 | extern void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); | 206 | void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); |
203 | extern void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, | 207 | void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, |
204 | long *powerlevel); | 208 | long *powerlevel); |
205 | extern void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); | 209 | void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); |
206 | extern bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, | 210 | bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, |
207 | long power_indbm); | 211 | long power_indbm); |
208 | extern void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, | 212 | void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, |
209 | u8 operation); | 213 | u8 operation); |
210 | extern void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw); | 214 | void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, |
211 | extern void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, | ||
212 | enum nl80211_channel_type ch_type); | 215 | enum nl80211_channel_type ch_type); |
213 | extern void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); | 216 | void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); |
214 | extern u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); | 217 | u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); |
215 | extern void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); | 218 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); |
216 | extern void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, | 219 | void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, |
217 | u16 beaconinterval); | 220 | u16 beaconinterval); |
218 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); | 221 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); |
219 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); | 222 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); |
223 | void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t); | ||
220 | void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); | 224 | void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); |
221 | bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 225 | bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
222 | enum radio_path rfpath); | 226 | enum radio_path rfpath); |
223 | extern bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, | 227 | bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, |
224 | u32 rfpath); | 228 | u32 rfpath); |
225 | bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); | 229 | bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); |
226 | bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, | 230 | bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, |
@@ -237,9 +241,6 @@ u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask); | |||
237 | void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, | 241 | void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, |
238 | enum radio_path rfpath, u32 offset, | 242 | enum radio_path rfpath, u32 offset, |
239 | u32 data); | 243 | u32 data); |
240 | void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, | ||
241 | u32 regaddr, u32 bitmask, | ||
242 | u32 data); | ||
243 | void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, | 244 | void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, |
244 | enum radio_path rfpath, u32 offset, | 245 | enum radio_path rfpath, u32 offset, |
245 | u32 data); | 246 | u32 data); |
@@ -250,5 +251,7 @@ bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); | |||
250 | void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw); | 251 | void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw); |
251 | bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw); | 252 | bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw); |
252 | void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw); | 253 | void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw); |
254 | bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, | ||
255 | enum rf_pwrstate rfpwr_state); | ||
253 | 256 | ||
254 | #endif | 257 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c index e301b12e281a..90d0f2cf3b27 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c | |||
@@ -34,9 +34,9 @@ | |||
34 | #include "rf.h" | 34 | #include "rf.h" |
35 | #include "dm.h" | 35 | #include "dm.h" |
36 | 36 | ||
37 | static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw); | 37 | static bool _rtl92ce_phy_rf6052_config_parafile(struct ieee80211_hw *hw); |
38 | 38 | ||
39 | void rtl92c_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) | 39 | void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) |
40 | { | 40 | { |
41 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 41 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
42 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 42 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
@@ -62,7 +62,7 @@ void rtl92c_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, | 64 | void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, |
65 | u8 *ppowerlevel) | 65 | u8 *ppowerlevel) |
66 | { | 66 | { |
67 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 67 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
68 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 68 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
@@ -128,8 +128,7 @@ void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, | |||
128 | 128 | ||
129 | tmpval = tx_agc[RF90_PATH_A] >> 8; | 129 | tmpval = tx_agc[RF90_PATH_A] >> 8; |
130 | 130 | ||
131 | if (mac->mode == WIRELESS_MODE_B) | 131 | tmpval = tmpval & 0xff00ffff; |
132 | tmpval = tmpval & 0xff00ffff; | ||
133 | 132 | ||
134 | rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); | 133 | rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); |
135 | 134 | ||
@@ -440,16 +439,17 @@ bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw) | |||
440 | else | 439 | else |
441 | rtlphy->num_total_rfpath = 2; | 440 | rtlphy->num_total_rfpath = 2; |
442 | 441 | ||
443 | return _rtl92c_phy_rf6052_config_parafile(hw); | 442 | return _rtl92ce_phy_rf6052_config_parafile(hw); |
443 | |||
444 | } | 444 | } |
445 | 445 | ||
446 | static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw) | 446 | static bool _rtl92ce_phy_rf6052_config_parafile(struct ieee80211_hw *hw) |
447 | { | 447 | { |
448 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 448 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
449 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 449 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
450 | u32 u4_regvalue = 0; | 450 | u32 u4_regvalue = 0; |
451 | u8 rfpath; | 451 | u8 rfpath; |
452 | bool rtstatus; | 452 | bool rtstatus = true; |
453 | struct bb_reg_def *pphyreg; | 453 | struct bb_reg_def *pphyreg; |
454 | 454 | ||
455 | for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { | 455 | for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { |
@@ -484,12 +484,12 @@ static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw) | |||
484 | 484 | ||
485 | switch (rfpath) { | 485 | switch (rfpath) { |
486 | case RF90_PATH_A: | 486 | case RF90_PATH_A: |
487 | rtstatus = rtl92ce_phy_config_rf_with_headerfile(hw, | 487 | rtstatus = rtl92c_phy_config_rf_with_headerfile(hw, |
488 | (enum radio_path) rfpath); | 488 | (enum radio_path)rfpath); |
489 | break; | 489 | break; |
490 | case RF90_PATH_B: | 490 | case RF90_PATH_B: |
491 | rtstatus = rtl92ce_phy_config_rf_with_headerfile(hw, | 491 | rtstatus = rtl92c_phy_config_rf_with_headerfile(hw, |
492 | (enum radio_path) rfpath); | 492 | (enum radio_path)rfpath); |
493 | break; | 493 | break; |
494 | case RF90_PATH_C: | 494 | case RF90_PATH_C: |
495 | break; | 495 | break; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h index 3aa520c1c171..39ff03685986 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h | |||
@@ -34,14 +34,11 @@ | |||
34 | #define RF6052_MAX_REG 0x3F | 34 | #define RF6052_MAX_REG 0x3F |
35 | #define RF6052_MAX_PATH 2 | 35 | #define RF6052_MAX_PATH 2 |
36 | 36 | ||
37 | extern void rtl92c_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, | 37 | extern void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, |
38 | u8 bandwidth); | 38 | u8 bandwidth); |
39 | extern void rtl92c_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, | 39 | extern void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, |
40 | u8 *ppowerlevel); | 40 | u8 *ppowerlevel); |
41 | extern void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, | 41 | extern void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, |
42 | u8 *ppowerlevel, u8 channel); | 42 | u8 *ppowerlevel, u8 channel); |
43 | bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw); | 43 | extern bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw); |
44 | bool rtl92ce_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | ||
45 | enum radio_path rfpath); | ||
46 | |||
47 | #endif | 44 | #endif |