.. | .. |
---|
1 | | -/****************************************************************************** |
---|
2 | | - * |
---|
3 | | - * Copyright(c) 2009-2012 Realtek Corporation. |
---|
4 | | - * |
---|
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. |
---|
8 | | - * |
---|
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 |
---|
12 | | - * more details. |
---|
13 | | - * |
---|
14 | | - * The full GNU General Public License is included in this distribution in the |
---|
15 | | - * file called LICENSE. |
---|
16 | | - * |
---|
17 | | - * Contact Information: |
---|
18 | | - * wlanfae <wlanfae@realtek.com> |
---|
19 | | - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, |
---|
20 | | - * Hsinchu 300, Taiwan. |
---|
21 | | - * |
---|
22 | | - * Larry Finger <Larry.Finger@lwfinger.net> |
---|
23 | | - * |
---|
24 | | - *****************************************************************************/ |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
| 2 | +/* Copyright(c) 2009-2012 Realtek Corporation.*/ |
---|
25 | 3 | |
---|
26 | 4 | #include "../wifi.h" |
---|
27 | 5 | #include "../pci.h" |
---|
.. | .. |
---|
44 | 22 | u32 original_value, readback_value, bitshift; |
---|
45 | 23 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
---|
46 | 24 | |
---|
47 | | - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, |
---|
48 | | - "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n", |
---|
49 | | - regaddr, rfpath, bitmask); |
---|
| 25 | + rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, |
---|
| 26 | + "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n", |
---|
| 27 | + regaddr, rfpath, bitmask); |
---|
50 | 28 | if (rtlphy->rf_mode != RF_OP_BY_FW) { |
---|
51 | 29 | original_value = _rtl92c_phy_rf_serial_read(hw, |
---|
52 | 30 | rfpath, regaddr); |
---|
.. | .. |
---|
56 | 34 | } |
---|
57 | 35 | bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); |
---|
58 | 36 | readback_value = (original_value & bitmask) >> bitshift; |
---|
59 | | - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, |
---|
60 | | - "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n", |
---|
61 | | - regaddr, rfpath, bitmask, original_value); |
---|
| 37 | + rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, |
---|
| 38 | + "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n", |
---|
| 39 | + regaddr, rfpath, bitmask, original_value); |
---|
62 | 40 | return readback_value; |
---|
63 | 41 | } |
---|
64 | 42 | |
---|
.. | .. |
---|
70 | 48 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
---|
71 | 49 | u32 original_value, bitshift; |
---|
72 | 50 | |
---|
73 | | - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, |
---|
74 | | - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", |
---|
75 | | - regaddr, bitmask, data, rfpath); |
---|
| 51 | + rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, |
---|
| 52 | + "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", |
---|
| 53 | + regaddr, bitmask, data, rfpath); |
---|
76 | 54 | if (rtlphy->rf_mode != RF_OP_BY_FW) { |
---|
77 | 55 | if (bitmask != RFREG_OFFSET_MASK) { |
---|
78 | 56 | original_value = _rtl92c_phy_rf_serial_read(hw, |
---|
.. | .. |
---|
96 | 74 | } |
---|
97 | 75 | _rtl92c_phy_fw_rf_serial_write(hw, rfpath, regaddr, data); |
---|
98 | 76 | } |
---|
99 | | - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, |
---|
100 | | - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", |
---|
101 | | - regaddr, bitmask, data, rfpath); |
---|
| 77 | + rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, |
---|
| 78 | + "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", |
---|
| 79 | + regaddr, bitmask, data, rfpath); |
---|
102 | 80 | } |
---|
103 | 81 | |
---|
104 | 82 | bool rtl92cu_phy_mac_config(struct ieee80211_hw *hw) |
---|
.. | .. |
---|
125 | 103 | rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL + 1, 0xdb); |
---|
126 | 104 | rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB); |
---|
127 | 105 | rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | |
---|
128 | | - FEN_BB_GLB_RSTn | FEN_BBRSTB); |
---|
| 106 | + FEN_BB_GLB_RSTN | FEN_BBRSTB); |
---|
129 | 107 | regval32 = rtl_read_dword(rtlpriv, 0x87c); |
---|
130 | 108 | rtl_write_dword(rtlpriv, 0x87c, regval32 & (~BIT(31))); |
---|
131 | 109 | rtl_write_byte(rtlpriv, REG_LDOHCI12_CTRL, 0x0f); |
---|
.. | .. |
---|
143 | 121 | u32 arraylength; |
---|
144 | 122 | u32 *ptrarray; |
---|
145 | 123 | |
---|
146 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_Array\n"); |
---|
| 124 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_ARRAY\n"); |
---|
147 | 125 | arraylength = rtlphy->hwparam_tables[MAC_REG].length ; |
---|
148 | 126 | ptrarray = rtlphy->hwparam_tables[MAC_REG].pdata; |
---|
149 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Img:RTL8192CUMAC_2T_ARRAY\n"); |
---|
| 127 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, "Img:RTL8192CUMAC_2T_ARRAY\n"); |
---|
150 | 128 | for (i = 0; i < arraylength; i = i + 2) |
---|
151 | 129 | rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]); |
---|
152 | 130 | return true; |
---|
.. | .. |
---|
180 | 158 | rtl_set_bbreg(hw, phy_regarray_table[i], MASKDWORD, |
---|
181 | 159 | phy_regarray_table[i + 1]); |
---|
182 | 160 | udelay(1); |
---|
183 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
184 | | - "The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n", |
---|
185 | | - phy_regarray_table[i], |
---|
186 | | - phy_regarray_table[i + 1]); |
---|
| 161 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
| 162 | + "The phy_regarray_table[0] is %x Rtl819XPHY_REGARRAY[1] is %x\n", |
---|
| 163 | + phy_regarray_table[i], |
---|
| 164 | + phy_regarray_table[i + 1]); |
---|
187 | 165 | } |
---|
188 | 166 | } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { |
---|
189 | 167 | for (i = 0; i < agctab_arraylen; i = i + 2) { |
---|
190 | 168 | rtl_set_bbreg(hw, agctab_array_table[i], MASKDWORD, |
---|
191 | 169 | agctab_array_table[i + 1]); |
---|
192 | 170 | udelay(1); |
---|
193 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
194 | | - "The agctab_array_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n", |
---|
195 | | - agctab_array_table[i], |
---|
196 | | - agctab_array_table[i + 1]); |
---|
| 171 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
| 172 | + "The agctab_array_table[0] is %x Rtl819XPHY_REGARRAY[1] is %x\n", |
---|
| 173 | + agctab_array_table[i], |
---|
| 174 | + agctab_array_table[i + 1]); |
---|
197 | 175 | } |
---|
198 | 176 | } |
---|
199 | 177 | return true; |
---|
.. | .. |
---|
214 | 192 | if (configtype == BASEBAND_CONFIG_PHY_REG) { |
---|
215 | 193 | for (i = 0; i < phy_regarray_pg_len; i = i + 3) { |
---|
216 | 194 | rtl_addr_delay(phy_regarray_table_pg[i]); |
---|
217 | | - _rtl92c_store_pwrIndex_diffrate_offset(hw, |
---|
| 195 | + _rtl92c_store_pwrindex_diffrate_offset(hw, |
---|
218 | 196 | phy_regarray_table_pg[i], |
---|
219 | 197 | phy_regarray_table_pg[i + 1], |
---|
220 | 198 | phy_regarray_table_pg[i + 2]); |
---|
221 | 199 | } |
---|
222 | 200 | } else { |
---|
223 | | - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, |
---|
224 | | - "configtype != BaseBand_Config_PHY_REG\n"); |
---|
| 201 | + rtl_dbg(rtlpriv, COMP_SEND, DBG_TRACE, |
---|
| 202 | + "configtype != BaseBand_Config_PHY_REG\n"); |
---|
225 | 203 | } |
---|
226 | 204 | return true; |
---|
227 | 205 | } |
---|
.. | .. |
---|
242 | 220 | radioa_array_table = rtlphy->hwparam_tables[RADIOA_2T].pdata; |
---|
243 | 221 | radiob_arraylen = rtlphy->hwparam_tables[RADIOB_2T].length; |
---|
244 | 222 | radiob_array_table = rtlphy->hwparam_tables[RADIOB_2T].pdata; |
---|
245 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
246 | | - "Radio_A:RTL8192CURADIOA_2TARRAY\n"); |
---|
247 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
248 | | - "Radio_B:RTL8192CU_RADIOB_2TARRAY\n"); |
---|
| 223 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
| 224 | + "Radio_A:RTL8192CURADIOA_2TARRAY\n"); |
---|
| 225 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
| 226 | + "Radio_B:RTL8192CU_RADIOB_2TARRAY\n"); |
---|
249 | 227 | } else { |
---|
250 | 228 | radioa_arraylen = rtlphy->hwparam_tables[RADIOA_1T].length; |
---|
251 | 229 | radioa_array_table = rtlphy->hwparam_tables[RADIOA_1T].pdata; |
---|
252 | 230 | radiob_arraylen = rtlphy->hwparam_tables[RADIOB_1T].length; |
---|
253 | 231 | radiob_array_table = rtlphy->hwparam_tables[RADIOB_1T].pdata; |
---|
254 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
255 | | - "Radio_A:RTL8192CU_RADIOA_1TARRAY\n"); |
---|
256 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
257 | | - "Radio_B:RTL8192CU_RADIOB_1TARRAY\n"); |
---|
| 232 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
| 233 | + "Radio_A:RTL8192CU_RADIOA_1TARRAY\n"); |
---|
| 234 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
| 235 | + "Radio_B:RTL8192CU_RADIOB_1TARRAY\n"); |
---|
258 | 236 | } |
---|
259 | | - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Radio No %x\n", rfpath); |
---|
| 237 | + rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, "Radio No %x\n", rfpath); |
---|
260 | 238 | switch (rfpath) { |
---|
261 | 239 | case RF90_PATH_A: |
---|
262 | 240 | for (i = 0; i < radioa_arraylen; i = i + 2) { |
---|
.. | .. |
---|
291 | 269 | u8 reg_bw_opmode; |
---|
292 | 270 | u8 reg_prsr_rsc; |
---|
293 | 271 | |
---|
294 | | - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n", |
---|
295 | | - rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? |
---|
296 | | - "20MHz" : "40MHz"); |
---|
| 272 | + rtl_dbg(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n", |
---|
| 273 | + rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? |
---|
| 274 | + "20MHz" : "40MHz"); |
---|
297 | 275 | if (is_hal_stop(rtlhal)) { |
---|
298 | 276 | rtlphy->set_bwmode_inprogress = false; |
---|
299 | 277 | return; |
---|
.. | .. |
---|
341 | 319 | } |
---|
342 | 320 | rtl92cu_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); |
---|
343 | 321 | rtlphy->set_bwmode_inprogress = false; |
---|
344 | | - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); |
---|
| 322 | + rtl_dbg(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); |
---|
345 | 323 | } |
---|
346 | 324 | |
---|
347 | 325 | void rtl92cu_bb_block_on(struct ieee80211_hw *hw) |
---|
.. | .. |
---|
408 | 386 | if ((ppsc->rfpwr_state == ERFOFF) && |
---|
409 | 387 | RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { |
---|
410 | 388 | bool rtstatus; |
---|
411 | | - u32 InitializeCount = 0; |
---|
| 389 | + u32 init_count = 0; |
---|
412 | 390 | |
---|
413 | 391 | do { |
---|
414 | | - InitializeCount++; |
---|
415 | | - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, |
---|
416 | | - "IPS Set eRf nic enable\n"); |
---|
| 392 | + init_count++; |
---|
| 393 | + rtl_dbg(rtlpriv, COMP_RF, DBG_DMESG, |
---|
| 394 | + "IPS Set eRf nic enable\n"); |
---|
417 | 395 | rtstatus = rtl_ps_enable_nic(hw); |
---|
418 | | - } while (!rtstatus && (InitializeCount < 10)); |
---|
| 396 | + } while (!rtstatus && (init_count < 10)); |
---|
419 | 397 | RT_CLEAR_PS_LEVEL(ppsc, |
---|
420 | 398 | RT_RF_OFF_LEVL_HALT_NIC); |
---|
421 | 399 | } else { |
---|
422 | | - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, |
---|
423 | | - "Set ERFON sleeped:%d ms\n", |
---|
424 | | - jiffies_to_msecs(jiffies - |
---|
425 | | - ppsc->last_sleep_jiffies)); |
---|
| 400 | + rtl_dbg(rtlpriv, COMP_RF, DBG_DMESG, |
---|
| 401 | + "Set ERFON slept:%d ms\n", |
---|
| 402 | + jiffies_to_msecs(jiffies - |
---|
| 403 | + ppsc->last_sleep_jiffies)); |
---|
426 | 404 | ppsc->last_awake_jiffies = jiffies; |
---|
427 | 405 | rtl92ce_phy_set_rf_on(hw); |
---|
428 | 406 | } |
---|
.. | .. |
---|
443 | 421 | queue_id++; |
---|
444 | 422 | continue; |
---|
445 | 423 | } else { |
---|
446 | | - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, |
---|
447 | | - "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", |
---|
448 | | - i + 1, |
---|
449 | | - queue_id, |
---|
450 | | - skb_queue_len(&ring->queue)); |
---|
| 424 | + rtl_dbg(rtlpriv, COMP_ERR, DBG_WARNING, |
---|
| 425 | + "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", |
---|
| 426 | + i + 1, |
---|
| 427 | + queue_id, |
---|
| 428 | + skb_queue_len(&ring->queue)); |
---|
451 | 429 | udelay(10); |
---|
452 | 430 | i++; |
---|
453 | 431 | } |
---|
454 | 432 | if (i >= MAX_DOZE_WAITING_TIMES_9x) { |
---|
455 | | - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, |
---|
456 | | - "ERFOFF: %d times TcbBusyQueue[%d] = %d !\n", |
---|
457 | | - MAX_DOZE_WAITING_TIMES_9x, |
---|
458 | | - queue_id, |
---|
459 | | - skb_queue_len(&ring->queue)); |
---|
| 433 | + rtl_dbg(rtlpriv, COMP_ERR, DBG_WARNING, |
---|
| 434 | + "ERFOFF: %d times TcbBusyQueue[%d] = %d !\n", |
---|
| 435 | + MAX_DOZE_WAITING_TIMES_9x, |
---|
| 436 | + queue_id, |
---|
| 437 | + skb_queue_len(&ring->queue)); |
---|
460 | 438 | break; |
---|
461 | 439 | } |
---|
462 | 440 | } |
---|
463 | 441 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { |
---|
464 | | - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, |
---|
465 | | - "IPS Set eRf nic disable\n"); |
---|
| 442 | + rtl_dbg(rtlpriv, COMP_RF, DBG_DMESG, |
---|
| 443 | + "IPS Set eRf nic disable\n"); |
---|
466 | 444 | rtl_ps_disable_nic(hw); |
---|
467 | 445 | RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); |
---|
468 | 446 | } else { |
---|
.. | .. |
---|
485 | 463 | queue_id++; |
---|
486 | 464 | continue; |
---|
487 | 465 | } else { |
---|
488 | | - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, |
---|
489 | | - "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", |
---|
490 | | - i + 1, queue_id, |
---|
491 | | - skb_queue_len(&ring->queue)); |
---|
| 466 | + rtl_dbg(rtlpriv, COMP_ERR, DBG_WARNING, |
---|
| 467 | + "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", |
---|
| 468 | + i + 1, queue_id, |
---|
| 469 | + skb_queue_len(&ring->queue)); |
---|
492 | 470 | udelay(10); |
---|
493 | 471 | i++; |
---|
494 | 472 | } |
---|
495 | 473 | if (i >= MAX_DOZE_WAITING_TIMES_9x) { |
---|
496 | | - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, |
---|
497 | | - "ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n", |
---|
498 | | - MAX_DOZE_WAITING_TIMES_9x, |
---|
499 | | - queue_id, |
---|
500 | | - skb_queue_len(&ring->queue)); |
---|
| 474 | + rtl_dbg(rtlpriv, COMP_ERR, DBG_WARNING, |
---|
| 475 | + "ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n", |
---|
| 476 | + MAX_DOZE_WAITING_TIMES_9x, |
---|
| 477 | + queue_id, |
---|
| 478 | + skb_queue_len(&ring->queue)); |
---|
501 | 479 | break; |
---|
502 | 480 | } |
---|
503 | 481 | } |
---|
504 | | - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, |
---|
505 | | - "Set ERFSLEEP awaked:%d ms\n", |
---|
506 | | - jiffies_to_msecs(jiffies - ppsc->last_awake_jiffies)); |
---|
| 482 | + rtl_dbg(rtlpriv, COMP_RF, DBG_DMESG, |
---|
| 483 | + "Set ERFSLEEP awaked:%d ms\n", |
---|
| 484 | + jiffies_to_msecs(jiffies - ppsc->last_awake_jiffies)); |
---|
507 | 485 | ppsc->last_sleep_jiffies = jiffies; |
---|
508 | 486 | _rtl92c_phy_set_rf_sleep(hw); |
---|
509 | 487 | break; |
---|