aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rtlwifi/Kconfig7
-rw-r--r--drivers/net/wireless/rtlwifi/Makefile3
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/Makefile9
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c12
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h204
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c (renamed from drivers/net/wireless/rtlwifi/rtl8192ce/fw.c)13
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h (renamed from drivers/net/wireless/rtlwifi/rtl8192ce/fw.h)0
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/main.c (renamed from drivers/net/wireless/rtlwifi/rtl8192cu/fw.c)11
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c125
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h246
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/Makefile1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/dm.c7
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/dm.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/hw.c5
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/hw.h11
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/phy.c31
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/phy.h28
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/rf.c10
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/rf.h5
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/sw.c15
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/sw.h12
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/Makefile1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/dm.c5
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/dm.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/fw.h30
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.c7
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.h9
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/phy.c38
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/phy.h4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/rf.c12
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/rf.h19
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c15
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.h18
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h12
34 files changed, 744 insertions, 185 deletions
diff --git a/drivers/net/wireless/rtlwifi/Kconfig b/drivers/net/wireless/rtlwifi/Kconfig
index 86f8d4d64037..ce49e0ce7cad 100644
--- a/drivers/net/wireless/rtlwifi/Kconfig
+++ b/drivers/net/wireless/rtlwifi/Kconfig
@@ -3,6 +3,7 @@ config RTL8192CE
3 depends on MAC80211 && PCI && EXPERIMENTAL 3 depends on MAC80211 && PCI && EXPERIMENTAL
4 select FW_LOADER 4 select FW_LOADER
5 select RTLWIFI 5 select RTLWIFI
6 select RTL8192C_COMMON
6 ---help--- 7 ---help---
7 This is the driver for Realtek RTL8192CE/RTL8188CE 802.11n PCIe 8 This is the driver for Realtek RTL8192CE/RTL8188CE 802.11n PCIe
8 wireless network adapters. 9 wireless network adapters.
@@ -14,6 +15,7 @@ config RTL8192CU
14 depends on MAC80211 && USB && EXPERIMENTAL 15 depends on MAC80211 && USB && EXPERIMENTAL
15 select FW_LOADER 16 select FW_LOADER
16 select RTLWIFI 17 select RTLWIFI
18 select RTL8192C_COMMON
17 ---help--- 19 ---help---
18 This is the driver for Realtek RTL8192CU/RTL8188CU 802.11n USB 20 This is the driver for Realtek RTL8192CU/RTL8188CU 802.11n USB
19 wireless network adapters. 21 wireless network adapters.
@@ -24,3 +26,8 @@ config RTLWIFI
24 tristate 26 tristate
25 depends on RTL8192CE || RTL8192CU 27 depends on RTL8192CE || RTL8192CU
26 default m 28 default m
29
30config RTL8192C_COMMON
31 tristate
32 depends on RTL8192CE || RTL8192CU
33 default m
diff --git a/drivers/net/wireless/rtlwifi/Makefile b/drivers/net/wireless/rtlwifi/Makefile
index 52be12e718ab..9192fd583413 100644
--- a/drivers/net/wireless/rtlwifi/Makefile
+++ b/drivers/net/wireless/rtlwifi/Makefile
@@ -10,10 +10,13 @@ rtlwifi-objs := \
10 regd.o \ 10 regd.o \
11 usb.o 11 usb.o
12 12
13rtl8192c_common-objs += \
14
13ifeq ($(CONFIG_PCI),y) 15ifeq ($(CONFIG_PCI),y)
14rtlwifi-objs += pci.o 16rtlwifi-objs += pci.o
15endif 17endif
16 18
19obj-$(CONFIG_RTL8192C_COMMON) += rtl8192c/
17obj-$(CONFIG_RTL8192CE) += rtl8192ce/ 20obj-$(CONFIG_RTL8192CE) += rtl8192ce/
18obj-$(CONFIG_RTL8192CU) += rtl8192cu/ 21obj-$(CONFIG_RTL8192CU) += rtl8192cu/
19 22
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/Makefile b/drivers/net/wireless/rtlwifi/rtl8192c/Makefile
new file mode 100644
index 000000000000..aee42d7ae8a2
--- /dev/null
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/Makefile
@@ -0,0 +1,9 @@
1rtl8192c-common-objs := \
2 main.o \
3 dm_common.o \
4 fw_common.o \
5 phy_common.o
6
7obj-$(CONFIG_RTL8192C_COMMON) += rtl8192c-common.o
8
9ccflags-y += -D__CHECK_ENDIAN__
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
index b4f1e4e6b733..bb023274414c 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
@@ -27,6 +27,8 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include "dm_common.h"
31
30struct dig_t dm_digtable; 32struct dig_t dm_digtable;
31static struct ps_t dm_pstable; 33static struct ps_t dm_pstable;
32 34
@@ -517,6 +519,7 @@ void rtl92c_dm_write_dig(struct ieee80211_hw *hw)
517 dm_digtable.pre_igvalue = dm_digtable.cur_igvalue; 519 dm_digtable.pre_igvalue = dm_digtable.cur_igvalue;
518 } 520 }
519} 521}
522EXPORT_SYMBOL(rtl92c_dm_write_dig);
520 523
521static void rtl92c_dm_pwdb_monitor(struct ieee80211_hw *hw) 524static void rtl92c_dm_pwdb_monitor(struct ieee80211_hw *hw)
522{ 525{
@@ -554,6 +557,7 @@ void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw)
554 rtlpriv->dm.is_any_nonbepkts = false; 557 rtlpriv->dm.is_any_nonbepkts = false;
555 rtlpriv->dm.is_cur_rdlstate = false; 558 rtlpriv->dm.is_cur_rdlstate = false;
556} 559}
560EXPORT_SYMBOL(rtl92c_dm_init_edca_turbo);
557 561
558static void rtl92c_dm_check_edca_turbo(struct ieee80211_hw *hw) 562static void rtl92c_dm_check_edca_turbo(struct ieee80211_hw *hw)
559{ 563{
@@ -1103,6 +1107,7 @@ void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw)
1103{ 1107{
1104 rtl92c_dm_check_txpower_tracking_thermal_meter(hw); 1108 rtl92c_dm_check_txpower_tracking_thermal_meter(hw);
1105} 1109}
1110EXPORT_SYMBOL(rtl92c_dm_check_txpower_tracking);
1106 1111
1107void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw) 1112void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw)
1108{ 1113{
@@ -1118,6 +1123,7 @@ void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw)
1118 rtlpriv->dm.useramask = false; 1123 rtlpriv->dm.useramask = false;
1119 1124
1120} 1125}
1126EXPORT_SYMBOL(rtl92c_dm_init_rate_adaptive_mask);
1121 1127
1122static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw) 1128static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw)
1123{ 1129{
@@ -1307,6 +1313,7 @@ void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal)
1307 dm_pstable.pre_rfstate = dm_pstable.cur_rfstate; 1313 dm_pstable.pre_rfstate = dm_pstable.cur_rfstate;
1308 } 1314 }
1309} 1315}
1316EXPORT_SYMBOL(rtl92c_dm_rf_saving);
1310 1317
1311static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw) 1318static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw)
1312{ 1319{
@@ -1360,6 +1367,7 @@ void rtl92c_dm_init(struct ieee80211_hw *hw)
1360 rtl92c_dm_initialize_txpower_tracking(hw); 1367 rtl92c_dm_initialize_txpower_tracking(hw);
1361 rtl92c_dm_init_dynamic_bb_powersaving(hw); 1368 rtl92c_dm_init_dynamic_bb_powersaving(hw);
1362} 1369}
1370EXPORT_SYMBOL(rtl92c_dm_init);
1363 1371
1364void rtl92c_dm_watchdog(struct ieee80211_hw *hw) 1372void rtl92c_dm_watchdog(struct ieee80211_hw *hw)
1365{ 1373{
@@ -1380,9 +1388,11 @@ void rtl92c_dm_watchdog(struct ieee80211_hw *hw)
1380 rtl92c_dm_dig(hw); 1388 rtl92c_dm_dig(hw);
1381 rtl92c_dm_false_alarm_counter_statistics(hw); 1389 rtl92c_dm_false_alarm_counter_statistics(hw);
1382 rtl92c_dm_dynamic_bb_powersaving(hw); 1390 rtl92c_dm_dynamic_bb_powersaving(hw);
1383 rtl92c_dm_dynamic_txpower(hw); 1391 rtlpriv->cfg->ops->dm_dynamic_txpower(hw);
1384 rtl92c_dm_check_txpower_tracking(hw); 1392 rtl92c_dm_check_txpower_tracking(hw);
1385 rtl92c_dm_refresh_rate_adaptive_mask(hw); 1393 rtl92c_dm_refresh_rate_adaptive_mask(hw);
1386 rtl92c_dm_check_edca_turbo(hw); 1394 rtl92c_dm_check_edca_turbo(hw);
1395
1387 } 1396 }
1388} 1397}
1398EXPORT_SYMBOL(rtl92c_dm_watchdog);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h
new file mode 100644
index 000000000000..b9cbb0a3c03f
--- /dev/null
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h
@@ -0,0 +1,204 @@
1/******************************************************************************
2 *
3 * Copyright(c) 2009-2010 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 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
20 *
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
25 *
26 * Larry Finger <Larry.Finger@lwfinger.net>
27 *
28 *****************************************************************************/
29
30#ifndef __RTL92COMMON_DM_H__
31#define __RTL92COMMON_DM_H__
32
33#include "../wifi.h"
34#include "../rtl8192ce/def.h"
35#include "../rtl8192ce/reg.h"
36#include "fw_common.h"
37
38#define HAL_DM_DIG_DISABLE BIT(0)
39#define HAL_DM_HIPWR_DISABLE BIT(1)
40
41#define OFDM_TABLE_LENGTH 37
42#define CCK_TABLE_LENGTH 33
43
44#define OFDM_TABLE_SIZE 37
45#define CCK_TABLE_SIZE 33
46
47#define BW_AUTO_SWITCH_HIGH_LOW 25
48#define BW_AUTO_SWITCH_LOW_HIGH 30
49
50#define DM_DIG_THRESH_HIGH 40
51#define DM_DIG_THRESH_LOW 35
52
53#define DM_FALSEALARM_THRESH_LOW 400
54#define DM_FALSEALARM_THRESH_HIGH 1000
55
56#define DM_DIG_MAX 0x3e
57#define DM_DIG_MIN 0x1e
58
59#define DM_DIG_FA_UPPER 0x32
60#define DM_DIG_FA_LOWER 0x20
61#define DM_DIG_FA_TH0 0x20
62#define DM_DIG_FA_TH1 0x100
63#define DM_DIG_FA_TH2 0x200
64
65#define DM_DIG_BACKOFF_MAX 12
66#define DM_DIG_BACKOFF_MIN -4
67#define DM_DIG_BACKOFF_DEFAULT 10
68
69#define RXPATHSELECTION_SS_TH_lOW 30
70#define RXPATHSELECTION_DIFF_TH 18
71
72#define DM_RATR_STA_INIT 0
73#define DM_RATR_STA_HIGH 1
74#define DM_RATR_STA_MIDDLE 2
75#define DM_RATR_STA_LOW 3
76
77#define CTS2SELF_THVAL 30
78#define REGC38_TH 20
79
80#define WAIOTTHVal 25
81
82#define TXHIGHPWRLEVEL_NORMAL 0
83#define TXHIGHPWRLEVEL_LEVEL1 1
84#define TXHIGHPWRLEVEL_LEVEL2 2
85#define TXHIGHPWRLEVEL_BT1 3
86#define TXHIGHPWRLEVEL_BT2 4
87
88#define DM_TYPE_BYFW 0
89#define DM_TYPE_BYDRIVER 1
90
91#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74
92#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67
93
94struct ps_t {
95 u8 pre_ccastate;
96 u8 cur_ccasate;
97 u8 pre_rfstate;
98 u8 cur_rfstate;
99 long rssi_val_min;
100};
101
102struct dig_t {
103 u8 dig_enable_flag;
104 u8 dig_ext_port_stage;
105 u32 rssi_lowthresh;
106 u32 rssi_highthresh;
107 u32 fa_lowthresh;
108 u32 fa_highthresh;
109 u8 cursta_connectctate;
110 u8 presta_connectstate;
111 u8 curmultista_connectstate;
112 u8 pre_igvalue;
113 u8 cur_igvalue;
114 char backoff_val;
115 char backoff_val_range_max;
116 char backoff_val_range_min;
117 u8 rx_gain_range_max;
118 u8 rx_gain_range_min;
119 u8 rssi_val_min;
120 u8 pre_cck_pd_state;
121 u8 cur_cck_pd_state;
122 u8 pre_cck_fa_state;
123 u8 cur_cck_fa_state;
124 u8 pre_ccastate;
125 u8 cur_ccasate;
126};
127
128struct swat_t {
129 u8 failure_cnt;
130 u8 try_flag;
131 u8 stop_trying;
132 long pre_rssi;
133 long trying_threshold;
134 u8 cur_antenna;
135 u8 pre_antenna;
136};
137
138enum tag_dynamic_init_gain_operation_type_definition {
139 DIG_TYPE_THRESH_HIGH = 0,
140 DIG_TYPE_THRESH_LOW = 1,
141 DIG_TYPE_BACKOFF = 2,
142 DIG_TYPE_RX_GAIN_MIN = 3,
143 DIG_TYPE_RX_GAIN_MAX = 4,
144 DIG_TYPE_ENABLE = 5,
145 DIG_TYPE_DISABLE = 6,
146 DIG_OP_TYPE_MAX
147};
148
149enum tag_cck_packet_detection_threshold_type_definition {
150 CCK_PD_STAGE_LowRssi = 0,
151 CCK_PD_STAGE_HighRssi = 1,
152 CCK_FA_STAGE_Low = 2,
153 CCK_FA_STAGE_High = 3,
154 CCK_PD_STAGE_MAX = 4,
155};
156
157enum dm_1r_cca_e {
158 CCA_1R = 0,
159 CCA_2R = 1,
160 CCA_MAX = 2,
161};
162
163enum dm_rf_e {
164 RF_SAVE = 0,
165 RF_NORMAL = 1,
166 RF_MAX = 2,
167};
168
169enum dm_sw_ant_switch_e {
170 ANS_ANTENNA_B = 1,
171 ANS_ANTENNA_A = 2,
172 ANS_ANTENNA_MAX = 3,
173};
174
175enum dm_dig_ext_port_alg_e {
176 DIG_EXT_PORT_STAGE_0 = 0,
177 DIG_EXT_PORT_STAGE_1 = 1,
178 DIG_EXT_PORT_STAGE_2 = 2,
179 DIG_EXT_PORT_STAGE_3 = 3,
180 DIG_EXT_PORT_STAGE_MAX = 4,
181};
182
183enum dm_dig_connect_e {
184 DIG_STA_DISCONNECT = 0,
185 DIG_STA_CONNECT = 1,
186 DIG_STA_BEFORE_CONNECT = 2,
187 DIG_MULTISTA_DISCONNECT = 3,
188 DIG_MULTISTA_CONNECT = 4,
189 DIG_CONNECT_MAX
190};
191
192extern struct dig_t dm_digtable;
193void rtl92c_dm_init(struct ieee80211_hw *hw);
194void rtl92c_dm_watchdog(struct ieee80211_hw *hw);
195void rtl92c_dm_write_dig(struct ieee80211_hw *hw);
196void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw);
197void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw);
198void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw);
199void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal);
200void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
201void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw);
202void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery);
203
204#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/fw.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
index 11c8bdb4af59..5ef91374b230 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/fw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
@@ -31,10 +31,9 @@
31#include "../wifi.h" 31#include "../wifi.h"
32#include "../pci.h" 32#include "../pci.h"
33#include "../base.h" 33#include "../base.h"
34#include "reg.h" 34#include "../rtl8192ce/reg.h"
35#include "def.h" 35#include "../rtl8192ce/def.h"
36#include "fw.h" 36#include "fw_common.h"
37#include "table.h"
38 37
39static void _rtl92c_enable_fw_download(struct ieee80211_hw *hw, bool enable) 38static void _rtl92c_enable_fw_download(struct ieee80211_hw *hw, bool enable)
40{ 39{
@@ -279,6 +278,7 @@ int rtl92c_download_fw(struct ieee80211_hw *hw)
279 278
280 return 0; 279 return 0;
281} 280}
281EXPORT_SYMBOL(rtl92c_download_fw);
282 282
283static bool _rtl92c_check_fw_read_last_h2c(struct ieee80211_hw *hw, u8 boxnum) 283static bool _rtl92c_check_fw_read_last_h2c(struct ieee80211_hw *hw, u8 boxnum)
284{ 284{
@@ -517,6 +517,7 @@ void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw,
517 517
518 return; 518 return;
519} 519}
520EXPORT_SYMBOL(rtl92c_fill_h2c_cmd);
520 521
521void rtl92c_firmware_selfreset(struct ieee80211_hw *hw) 522void rtl92c_firmware_selfreset(struct ieee80211_hw *hw)
522{ 523{
@@ -537,6 +538,7 @@ void rtl92c_firmware_selfreset(struct ieee80211_hw *hw)
537 u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); 538 u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
538 } 539 }
539} 540}
541EXPORT_SYMBOL(rtl92c_firmware_selfreset);
540 542
541void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode) 543void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
542{ 544{
@@ -557,6 +559,7 @@ void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
557 rtl92c_fill_h2c_cmd(hw, H2C_SETPWRMODE, 3, u1_h2c_set_pwrmode); 559 rtl92c_fill_h2c_cmd(hw, H2C_SETPWRMODE, 3, u1_h2c_set_pwrmode);
558 560
559} 561}
562EXPORT_SYMBOL(rtl92c_set_fw_pwrmode_cmd);
560 563
561#define BEACON_PG 0 /*->1*/ 564#define BEACON_PG 0 /*->1*/
562#define PSPOLL_PG 2 565#define PSPOLL_PG 2
@@ -758,6 +761,7 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
758 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 761 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
759 ("Set RSVD page location to Fw FAIL!!!!!!.\n")); 762 ("Set RSVD page location to Fw FAIL!!!!!!.\n"));
760} 763}
764EXPORT_SYMBOL(rtl92c_set_fw_rsvdpagepkt);
761 765
762void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus) 766void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus)
763{ 767{
@@ -767,3 +771,4 @@ void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus)
767 771
768 rtl92c_fill_h2c_cmd(hw, H2C_JOINBSSRPT, 1, u1_joinbssrpt_parm); 772 rtl92c_fill_h2c_cmd(hw, H2C_JOINBSSRPT, 1, u1_joinbssrpt_parm);
769} 773}
774EXPORT_SYMBOL(rtl92c_set_fw_joinbss_report_cmd);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/fw.h b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h
index 3db33bd14666..3db33bd14666 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/fw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/fw.c b/drivers/net/wireless/rtlwifi/rtl8192c/main.c
index 8e350eea3422..2f624fc27499 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/fw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/main.c
@@ -27,4 +27,13 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include "../rtl8192ce/fw.c" 30#include "../wifi.h"
31
32
33MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>");
34MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>");
35MODULE_AUTHOR("Georgia <georgia@realtek.com>");
36MODULE_AUTHOR("Ziv Huang <ziv_huang@realtek.com>");
37MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>");
38MODULE_LICENSE("GPL");
39MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n PCI wireless");
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
index 3728abc4df59..30e3ef8badee 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
@@ -27,44 +27,15 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include "../wifi.h"
31#include "../rtl8192ce/reg.h"
32#include "../rtl8192ce/def.h"
33#include "dm_common.h"
34#include "phy_common.h"
35
30/* Define macro to shorten lines */ 36/* Define macro to shorten lines */
31#define MCS_TXPWR mcs_txpwrlevel_origoffset 37#define MCS_TXPWR mcs_txpwrlevel_origoffset
32 38
33static u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
34 enum radio_path rfpath, u32 offset);
35static void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
36 enum radio_path rfpath, u32 offset,
37 u32 data);
38static u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw,
39 enum radio_path rfpath, u32 offset);
40static void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
41 enum radio_path rfpath, u32 offset,
42 u32 data);
43static u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask);
44static bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw);
45static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
46static bool _rtl92c_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
47 u8 configtype);
48static bool _rtl92c_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
49 u8 configtype);
50static void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw);
51static bool _rtl92c_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable,
52 u32 cmdtableidx, u32 cmdtablesz,
53 enum swchnlcmd_id cmdid, u32 para1,
54 u32 para2, u32 msdelay);
55static bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
56 u8 channel, u8 *stage, u8 *step,
57 u32 *delay);
58static u8 _rtl92c_phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw,
59 enum wireless_mode wirelessmode,
60 long power_indbm);
61static bool _rtl92c_phy_config_rf_external_pa(struct ieee80211_hw *hw,
62 enum radio_path rfpath);
63static long _rtl92c_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
64 enum wireless_mode wirelessmode,
65 u8 txpwridx);
66static void _rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
67
68u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask) 39u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
69{ 40{
70 struct rtl_priv *rtlpriv = rtl_priv(hw); 41 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -84,6 +55,7 @@ u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
84 return returnvalue; 55 return returnvalue;
85 56
86} 57}
58EXPORT_SYMBOL(rtl92c_phy_query_bb_reg);
87 59
88void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, 60void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw,
89 u32 regaddr, u32 bitmask, u32 data) 61 u32 regaddr, u32 bitmask, u32 data)
@@ -106,24 +78,26 @@ void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw,
106 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," 78 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x),"
107 " data(%#x)\n", regaddr, bitmask, 79 " data(%#x)\n", regaddr, bitmask,
108 data)); 80 data));
109
110} 81}
82EXPORT_SYMBOL(rtl92c_phy_set_bb_reg);
111 83
112static u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, 84u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
113 enum radio_path rfpath, u32 offset) 85 enum radio_path rfpath, u32 offset)
114{ 86{
115 RT_ASSERT(false, ("deprecated!\n")); 87 RT_ASSERT(false, ("deprecated!\n"));
116 return 0; 88 return 0;
117} 89}
90EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_read);
118 91
119static void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, 92void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
120 enum radio_path rfpath, u32 offset, 93 enum radio_path rfpath, u32 offset,
121 u32 data) 94 u32 data)
122{ 95{
123 RT_ASSERT(false, ("deprecated!\n")); 96 RT_ASSERT(false, ("deprecated!\n"));
124} 97}
98EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_write);
125 99
126static u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, 100u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw,
127 enum radio_path rfpath, u32 offset) 101 enum radio_path rfpath, u32 offset)
128{ 102{
129 struct rtl_priv *rtlpriv = rtl_priv(hw); 103 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -172,8 +146,9 @@ static u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw,
172 retvalue)); 146 retvalue));
173 return retvalue; 147 return retvalue;
174} 148}
149EXPORT_SYMBOL(_rtl92c_phy_rf_serial_read);
175 150
176static void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, 151void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
177 enum radio_path rfpath, u32 offset, 152 enum radio_path rfpath, u32 offset,
178 u32 data) 153 u32 data)
179{ 154{
@@ -195,8 +170,9 @@ static void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
195 rfpath, pphyreg->rf3wire_offset, 170 rfpath, pphyreg->rf3wire_offset,
196 data_and_addr)); 171 data_and_addr));
197} 172}
173EXPORT_SYMBOL(_rtl92c_phy_rf_serial_write);
198 174
199static u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask) 175u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask)
200{ 176{
201 u32 i; 177 u32 i;
202 178
@@ -206,6 +182,7 @@ static u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask)
206 } 182 }
207 return i; 183 return i;
208} 184}
185EXPORT_SYMBOL(_rtl92c_phy_calculate_bit_shift);
209 186
210static void _rtl92c_phy_bb_config_1t(struct ieee80211_hw *hw) 187static void _rtl92c_phy_bb_config_1t(struct ieee80211_hw *hw)
211{ 188{
@@ -222,10 +199,13 @@ static void _rtl92c_phy_bb_config_1t(struct ieee80211_hw *hw)
222} 199}
223bool rtl92c_phy_rf_config(struct ieee80211_hw *hw) 200bool rtl92c_phy_rf_config(struct ieee80211_hw *hw)
224{ 201{
225 return rtl92c_phy_rf6052_config(hw); 202 struct rtl_priv *rtlpriv = rtl_priv(hw);
203
204 return rtlpriv->cfg->ops->phy_rf6052_config(hw);
226} 205}
206EXPORT_SYMBOL(rtl92c_phy_rf_config);
227 207
228static bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw) 208bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw)
229{ 209{
230 struct rtl_priv *rtlpriv = rtl_priv(hw); 210 struct rtl_priv *rtlpriv = rtl_priv(hw);
231 struct rtl_phy *rtlphy = &(rtlpriv->phy); 211 struct rtl_phy *rtlphy = &(rtlpriv->phy);
@@ -233,7 +213,7 @@ static bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw)
233 bool rtstatus; 213 bool rtstatus;
234 214
235 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("==>\n")); 215 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("==>\n"));
236 rtstatus = _rtl92c_phy_config_bb_with_headerfile(hw, 216 rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw,
237 BASEBAND_CONFIG_PHY_REG); 217 BASEBAND_CONFIG_PHY_REG);
238 if (rtstatus != true) { 218 if (rtstatus != true) {
239 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Write BB Reg Fail!!")); 219 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Write BB Reg Fail!!"));
@@ -245,14 +225,14 @@ static bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw)
245 } 225 }
246 if (rtlefuse->autoload_failflag == false) { 226 if (rtlefuse->autoload_failflag == false) {
247 rtlphy->pwrgroup_cnt = 0; 227 rtlphy->pwrgroup_cnt = 0;
248 rtstatus = _rtl92c_phy_config_bb_with_pgheaderfile(hw, 228 rtstatus = rtlpriv->cfg->ops->config_bb_with_pgheaderfile(hw,
249 BASEBAND_CONFIG_PHY_REG); 229 BASEBAND_CONFIG_PHY_REG);
250 } 230 }
251 if (rtstatus != true) { 231 if (rtstatus != true) {
252 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("BB_PG Reg Fail!!")); 232 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("BB_PG Reg Fail!!"));
253 return false; 233 return false;
254 } 234 }
255 rtstatus = _rtl92c_phy_config_bb_with_headerfile(hw, 235 rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw,
256 BASEBAND_CONFIG_AGC_TAB); 236 BASEBAND_CONFIG_AGC_TAB);
257 if (rtstatus != true) { 237 if (rtstatus != true) {
258 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("AGC Table Fail\n")); 238 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("AGC Table Fail\n"));
@@ -263,13 +243,9 @@ static bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw)
263 0x200)); 243 0x200));
264 return true; 244 return true;
265} 245}
246EXPORT_SYMBOL(_rtl92c_phy_bb8192c_config_parafile);
266 247
267 248void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
268void rtl92c_phy_config_bb_external_pa(struct ieee80211_hw *hw)
269{
270}
271
272static void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
273 u32 regaddr, u32 bitmask, 249 u32 regaddr, u32 bitmask,
274 u32 data) 250 u32 data)
275{ 251{
@@ -404,12 +380,7 @@ static void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
404 rtlphy->pwrgroup_cnt++; 380 rtlphy->pwrgroup_cnt++;
405 } 381 }
406} 382}
407 383EXPORT_SYMBOL(_rtl92c_store_pwrIndex_diffrate_offset);
408static bool _rtl92c_phy_config_rf_external_pa(struct ieee80211_hw *hw,
409 enum radio_path rfpath)
410{
411 return true;
412}
413 384
414void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw) 385void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
415{ 386{
@@ -443,7 +414,7 @@ void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
443 ROFDM0_RXDETECTOR3, rtlphy->framesync)); 414 ROFDM0_RXDETECTOR3, rtlphy->framesync));
444} 415}
445 416
446static void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw) 417void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw)
447{ 418{
448 struct rtl_priv *rtlpriv = rtl_priv(hw); 419 struct rtl_priv *rtlpriv = rtl_priv(hw);
449 struct rtl_phy *rtlphy = &(rtlpriv->phy); 420 struct rtl_phy *rtlphy = &(rtlpriv->phy);
@@ -547,6 +518,7 @@ static void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw)
547 TRANSCEIVEB_HSPI_READBACK; 518 TRANSCEIVEB_HSPI_READBACK;
548 519
549} 520}
521EXPORT_SYMBOL(_rtl92c_phy_init_bb_rf_register_definition);
550 522
551void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel) 523void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel)
552{ 524{
@@ -615,7 +587,8 @@ static void _rtl92c_ccxpower_index_check(struct ieee80211_hw *hw,
615 587
616void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel) 588void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel)
617{ 589{
618 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 590 struct rtl_priv *rtlpriv = rtl_priv(hw);
591 struct rtl_efuse *rtlefuse = rtl_efuse(rtlpriv);
619 u8 cckpowerlevel[2], ofdmpowerlevel[2]; 592 u8 cckpowerlevel[2], ofdmpowerlevel[2];
620 593
621 if (rtlefuse->txpwr_fromeprom == false) 594 if (rtlefuse->txpwr_fromeprom == false)
@@ -625,9 +598,11 @@ void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel)
625 _rtl92c_ccxpower_index_check(hw, 598 _rtl92c_ccxpower_index_check(hw,
626 channel, &cckpowerlevel[0], 599 channel, &cckpowerlevel[0],
627 &ofdmpowerlevel[0]); 600 &ofdmpowerlevel[0]);
628 rtl92c_phy_rf6052_set_cck_txpower(hw, &cckpowerlevel[0]); 601 rtlpriv->cfg->ops->phy_rf6052_set_cck_txpower(hw, &cckpowerlevel[0]);
629 rtl92c_phy_rf6052_set_ofdm_txpower(hw, &ofdmpowerlevel[0], channel); 602 rtlpriv->cfg->ops->phy_rf6052_set_ofdm_txpower(hw, &ofdmpowerlevel[0],
603 channel);
630} 604}
605EXPORT_SYMBOL(rtl92c_phy_set_txpower_level);
631 606
632bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, long power_indbm) 607bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, long power_indbm)
633{ 608{
@@ -662,10 +637,12 @@ bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, long power_indbm)
662 rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); 637 rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel);
663 return true; 638 return true;
664} 639}
640EXPORT_SYMBOL(rtl92c_phy_update_txpower_dbm);
665 641
666void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval) 642void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval)
667{ 643{
668} 644}
645EXPORT_SYMBOL(rtl92c_phy_set_beacon_hw_reg);
669 646
670static u8 _rtl92c_phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw, 647static u8 _rtl92c_phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw,
671 enum wireless_mode wirelessmode, 648 enum wireless_mode wirelessmode,
@@ -697,6 +674,7 @@ static u8 _rtl92c_phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw,
697 674
698 return txpwridx; 675 return txpwridx;
699} 676}
677EXPORT_SYMBOL(_rtl92c_phy_dbm_to_txpwr_Idx);
700 678
701static long _rtl92c_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw, 679static long _rtl92c_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
702 enum wireless_mode wirelessmode, 680 enum wireless_mode wirelessmode,
@@ -720,6 +698,7 @@ static long _rtl92c_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
720 pwrout_dbm = txpwridx / 2 + offset; 698 pwrout_dbm = txpwridx / 2 + offset;
721 return pwrout_dbm; 699 return pwrout_dbm;
722} 700}
701EXPORT_SYMBOL(_rtl92c_phy_txpwr_idx_to_dbm);
723 702
724void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation) 703void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
725{ 704{
@@ -749,6 +728,7 @@ void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
749 } 728 }
750 } 729 }
751} 730}
731EXPORT_SYMBOL(rtl92c_phy_scan_operation_backup);
752 732
753void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, 733void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
754 enum nl80211_channel_type ch_type) 734 enum nl80211_channel_type ch_type)
@@ -762,7 +742,7 @@ void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
762 return; 742 return;
763 rtlphy->set_bwmode_inprogress = true; 743 rtlphy->set_bwmode_inprogress = true;
764 if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) 744 if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw)))
765 rtl92c_phy_set_bw_mode_callback(hw); 745 rtlpriv->cfg->ops->phy_set_bw_mode_callback(hw);
766 else { 746 else {
767 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 747 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
768 ("FALSE driver sleep or unload\n")); 748 ("FALSE driver sleep or unload\n"));
@@ -770,6 +750,7 @@ void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
770 rtlphy->current_chan_bw = tmp_bw; 750 rtlphy->current_chan_bw = tmp_bw;
771 } 751 }
772} 752}
753EXPORT_SYMBOL(rtl92c_phy_set_bw_mode);
773 754
774void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw) 755void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw)
775{ 756{
@@ -798,6 +779,7 @@ void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw)
798 } while (true); 779 } while (true);
799 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 780 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n"));
800} 781}
782EXPORT_SYMBOL(rtl92c_phy_sw_chnl_callback);
801 783
802u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw) 784u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw)
803{ 785{
@@ -827,6 +809,7 @@ u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw)
827 } 809 }
828 return 1; 810 return 1;
829} 811}
812EXPORT_SYMBOL(rtl92c_phy_sw_chnl);
830 813
831static bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, 814static bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
832 u8 channel, u8 *stage, u8 *step, 815 u8 channel, u8 *stage, u8 *step,
@@ -961,6 +944,7 @@ bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, u32 rfpath)
961{ 944{
962 return true; 945 return true;
963} 946}
947EXPORT_SYMBOL(rtl8192_phy_check_is_legal_rfpath);
964 948
965static u8 _rtl92c_phy_path_a_iqk(struct ieee80211_hw *hw, bool config_pathb) 949static u8 _rtl92c_phy_path_a_iqk(struct ieee80211_hw *hw, bool config_pathb)
966{ 950{
@@ -1901,19 +1885,22 @@ void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery)
1901 _rtl92c_phy_save_adda_registers(hw, iqk_bb_reg, 1885 _rtl92c_phy_save_adda_registers(hw, iqk_bb_reg,
1902 rtlphy->iqk_bb_backup, 10); 1886 rtlphy->iqk_bb_backup, 10);
1903} 1887}
1888EXPORT_SYMBOL(rtl92c_phy_iq_calibrate);
1904 1889
1905void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw) 1890void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw)
1906{ 1891{
1892 struct rtl_priv *rtlpriv = rtl_priv(hw);
1907 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 1893 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1908 bool start_conttx = false, singletone = false; 1894 bool start_conttx = false, singletone = false;
1909 1895
1910 if (start_conttx || singletone) 1896 if (start_conttx || singletone)
1911 return; 1897 return;
1912 if (IS_92C_SERIAL(rtlhal->version)) 1898 if (IS_92C_SERIAL(rtlhal->version))
1913 _rtl92c_phy_lc_calibrate(hw, true); 1899 rtlpriv->cfg->ops->phy_lc_calibrate(hw, true);
1914 else 1900 else
1915 _rtl92c_phy_lc_calibrate(hw, false); 1901 rtlpriv->cfg->ops->phy_lc_calibrate(hw, false);
1916} 1902}
1903EXPORT_SYMBOL(rtl92c_phy_lc_calibrate);
1917 1904
1918void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta) 1905void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta)
1919{ 1906{
@@ -1928,6 +1915,7 @@ void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta)
1928 else 1915 else
1929 _rtl92c_phy_ap_calibrate(hw, delta, false); 1916 _rtl92c_phy_ap_calibrate(hw, delta, false);
1930} 1917}
1918EXPORT_SYMBOL(rtl92c_phy_ap_calibrate);
1931 1919
1932void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain) 1920void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain)
1933{ 1921{
@@ -1938,6 +1926,7 @@ void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain)
1938 else 1926 else
1939 _rtl92c_phy_set_rfpath_switch(hw, bmain, false); 1927 _rtl92c_phy_set_rfpath_switch(hw, bmain, false);
1940} 1928}
1929EXPORT_SYMBOL(rtl92c_phy_set_rfpath_switch);
1941 1930
1942bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype) 1931bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype)
1943{ 1932{
@@ -1976,6 +1965,7 @@ bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype)
1976 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, ("<--IO Type(%#x)\n", iotype)); 1965 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, ("<--IO Type(%#x)\n", iotype));
1977 return true; 1966 return true;
1978} 1967}
1968EXPORT_SYMBOL(rtl92c_phy_set_io_cmd);
1979 1969
1980void rtl92c_phy_set_io(struct ieee80211_hw *hw) 1970void rtl92c_phy_set_io(struct ieee80211_hw *hw)
1981{ 1971{
@@ -2005,6 +1995,7 @@ void rtl92c_phy_set_io(struct ieee80211_hw *hw)
2005 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 1995 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE,
2006 ("<---(%#x)\n", rtlphy->current_io_type)); 1996 ("<---(%#x)\n", rtlphy->current_io_type));
2007} 1997}
1998EXPORT_SYMBOL(rtl92c_phy_set_io);
2008 1999
2009void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw) 2000void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw)
2010{ 2001{
@@ -2017,8 +2008,9 @@ void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw)
2017 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); 2008 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3);
2018 rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); 2009 rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00);
2019} 2010}
2011EXPORT_SYMBOL(rtl92ce_phy_set_rf_on);
2020 2012
2021static void _rtl92ce_phy_set_rf_sleep(struct ieee80211_hw *hw) 2013void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw)
2022{ 2014{
2023 u32 u4b_tmp; 2015 u32 u4b_tmp;
2024 u8 delay = 5; 2016 u8 delay = 5;
@@ -2047,3 +2039,4 @@ static void _rtl92ce_phy_set_rf_sleep(struct ieee80211_hw *hw)
2047 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); 2039 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2);
2048 rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x22); 2040 rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x22);
2049} 2041}
2042EXPORT_SYMBOL(_rtl92c_phy_set_rf_sleep);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h
new file mode 100644
index 000000000000..148bc019f4bd
--- /dev/null
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h
@@ -0,0 +1,246 @@
1/******************************************************************************
2 *
3 * Copyright(c) 2009-2010 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 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
20 *
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
25 *
26 * Larry Finger <Larry.Finger@lwfinger.net>
27 *
28 *****************************************************************************/
29
30#ifndef __RTL92C_PHY_H__
31#define __RTL92C_PHY_H__
32
33#define MAX_PRECMD_CNT 16
34#define MAX_RFDEPENDCMD_CNT 16
35#define MAX_POSTCMD_CNT 16
36
37#define MAX_DOZE_WAITING_TIMES_9x 64
38
39#define RT_CANNOT_IO(hw) false
40#define HIGHPOWER_RADIOA_ARRAYLEN 22
41
42#define MAX_TOLERANCE 5
43#define IQK_DELAY_TIME 1
44
45#define APK_BB_REG_NUM 5
46#define APK_AFE_REG_NUM 16
47#define APK_CURVE_REG_NUM 4
48#define PATH_NUM 2
49
50#define LOOP_LIMIT 5
51#define MAX_STALL_TIME 50
52#define AntennaDiversityValue 0x80
53#define MAX_TXPWR_IDX_NMODE_92S 63
54#define Reset_Cnt_Limit 3
55
56#define IQK_ADDA_REG_NUM 16
57#define IQK_MAC_REG_NUM 4
58
59#define RF90_PATH_MAX 2
60
61#define CT_OFFSET_MAC_ADDR 0X16
62
63#define CT_OFFSET_CCK_TX_PWR_IDX 0x5A
64#define CT_OFFSET_HT401S_TX_PWR_IDX 0x60
65#define CT_OFFSET_HT402S_TX_PWR_IDX_DIF 0x66
66#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF 0x69
67#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF 0x6C
68
69#define CT_OFFSET_HT40_MAX_PWR_OFFSET 0x6F
70#define CT_OFFSET_HT20_MAX_PWR_OFFSET 0x72
71
72#define CT_OFFSET_CHANNEL_PLAH 0x75
73#define CT_OFFSET_THERMAL_METER 0x78
74#define CT_OFFSET_RF_OPTION 0x79
75#define CT_OFFSET_VERSION 0x7E
76#define CT_OFFSET_CUSTOMER_ID 0x7F
77
78#define RTL92C_MAX_PATH_NUM 2
79#define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER 255
80enum swchnlcmd_id {
81 CMDID_END,
82 CMDID_SET_TXPOWEROWER_LEVEL,
83 CMDID_BBREGWRITE10,
84 CMDID_WRITEPORT_ULONG,
85 CMDID_WRITEPORT_USHORT,
86 CMDID_WRITEPORT_UCHAR,
87 CMDID_RF_WRITEREG,
88};
89
90struct swchnlcmd {
91 enum swchnlcmd_id cmdid;
92 u32 para1;
93 u32 para2;
94 u32 msdelay;
95};
96
97enum hw90_block_e {
98 HW90_BLOCK_MAC = 0,
99 HW90_BLOCK_PHY0 = 1,
100 HW90_BLOCK_PHY1 = 2,
101 HW90_BLOCK_RF = 3,
102 HW90_BLOCK_MAXIMUM = 4,
103};
104
105enum baseband_config_type {
106 BASEBAND_CONFIG_PHY_REG = 0,
107 BASEBAND_CONFIG_AGC_TAB = 1,
108};
109
110enum ra_offset_area {
111 RA_OFFSET_LEGACY_OFDM1,
112 RA_OFFSET_LEGACY_OFDM2,
113 RA_OFFSET_HT_OFDM1,
114 RA_OFFSET_HT_OFDM2,
115 RA_OFFSET_HT_OFDM3,
116 RA_OFFSET_HT_OFDM4,
117 RA_OFFSET_HT_CCK,
118};
119
120enum antenna_path {
121 ANTENNA_NONE,
122 ANTENNA_D,
123 ANTENNA_C,
124 ANTENNA_CD,
125 ANTENNA_B,
126 ANTENNA_BD,
127 ANTENNA_BC,
128 ANTENNA_BCD,
129 ANTENNA_A,
130 ANTENNA_AD,
131 ANTENNA_AC,
132 ANTENNA_ACD,
133 ANTENNA_AB,
134 ANTENNA_ABD,
135 ANTENNA_ABC,
136 ANTENNA_ABCD
137};
138
139struct r_antenna_select_ofdm {
140 u32 r_tx_antenna:4;
141 u32 r_ant_l:4;
142 u32 r_ant_non_ht:4;
143 u32 r_ant_ht1:4;
144 u32 r_ant_ht2:4;
145 u32 r_ant_ht_s1:4;
146 u32 r_ant_non_ht_s1:4;
147 u32 ofdm_txsc:2;
148 u32 reserved:2;
149};
150
151struct r_antenna_select_cck {
152 u8 r_cckrx_enable_2:2;
153 u8 r_cckrx_enable:2;
154 u8 r_ccktx_enable:4;
155};
156
157struct efuse_contents {
158 u8 mac_addr[ETH_ALEN];
159 u8 cck_tx_power_idx[6];
160 u8 ht40_1s_tx_power_idx[6];
161 u8 ht40_2s_tx_power_idx_diff[3];
162 u8 ht20_tx_power_idx_diff[3];
163 u8 ofdm_tx_power_idx_diff[3];
164 u8 ht40_max_power_offset[3];
165 u8 ht20_max_power_offset[3];
166 u8 channel_plan;
167 u8 thermal_meter;
168 u8 rf_option[5];
169 u8 version;
170 u8 oem_id;
171 u8 regulatory;
172};
173
174struct tx_power_struct {
175 u8 cck[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER];
176 u8 ht40_1s[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER];
177 u8 ht40_2s[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER];
178 u8 ht20_diff[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER];
179 u8 legacy_ht_diff[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER];
180 u8 legacy_ht_txpowerdiff;
181 u8 groupht20[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER];
182 u8 groupht40[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER];
183 u8 pwrgroup_cnt;
184 u32 mcs_original_offset[4][16];
185};
186
187extern u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw,
188 u32 regaddr, u32 bitmask);
189extern void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw,
190 u32 regaddr, u32 bitmask, u32 data);
191extern u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
192 enum radio_path rfpath, u32 regaddr,
193 u32 bitmask);
194extern void rtl92c_phy_set_rf_reg(struct ieee80211_hw *hw,
195 enum radio_path rfpath, u32 regaddr,
196 u32 bitmask, u32 data);
197extern bool rtl92c_phy_mac_config(struct ieee80211_hw *hw);
198extern bool rtl92c_phy_bb_config(struct ieee80211_hw *hw);
199extern bool rtl92c_phy_rf_config(struct ieee80211_hw *hw);
200extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw,
201 enum radio_path rfpath);
202extern void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
203extern void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw,
204 long *powerlevel);
205extern void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel);
206extern bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw,
207 long power_indbm);
208extern void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw,
209 u8 operation);
210extern void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
211extern void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
212 enum nl80211_channel_type ch_type);
213extern void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw);
214extern u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw);
215extern void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
216extern void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw,
217 u16 beaconinterval);
218void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
219void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw);
220void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
221bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
222 enum radio_path rfpath);
223extern bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw,
224 u32 rfpath);
225extern bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw,
226 enum rf_pwrstate rfpwr_state);
227void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw);
228void rtl92c_phy_set_io(struct ieee80211_hw *hw);
229void rtl92c_bb_block_on(struct ieee80211_hw *hw);
230u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask);
231static long _rtl92c_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
232 enum wireless_mode wirelessmode,
233 u8 txpwridx);
234static u8 _rtl92c_phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw,
235 enum wireless_mode wirelessmode,
236 long power_indbm);
237void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw);
238static bool _rtl92c_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable,
239 u32 cmdtableidx, u32 cmdtablesz,
240 enum swchnlcmd_id cmdid, u32 para1,
241 u32 para2, u32 msdelay);
242static bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
243 u8 channel, u8 *stage, u8 *step,
244 u32 *delay);
245
246#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/Makefile b/drivers/net/wireless/rtlwifi/rtl8192ce/Makefile
index 5c5fdde637cb..c0cb0cfe7d37 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/Makefile
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/Makefile
@@ -1,6 +1,5 @@
1rtl8192ce-objs := \ 1rtl8192ce-objs := \
2 dm.o \ 2 dm.o \
3 fw.o \
4 hw.o \ 3 hw.o \
5 led.o \ 4 led.o \
6 phy.o \ 5 phy.o \
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c
index 888df5e2d2fc..7d76504df4d1 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c
@@ -33,11 +33,8 @@
33#include "def.h" 33#include "def.h"
34#include "phy.h" 34#include "phy.h"
35#include "dm.h" 35#include "dm.h"
36#include "fw.h"
37 36
38#include "../rtl8192c/dm_common.c" 37void rtl92ce_dm_dynamic_txpower(struct ieee80211_hw *hw)
39
40void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw)
41{ 38{
42 struct rtl_priv *rtlpriv = rtl_priv(hw); 39 struct rtl_priv *rtlpriv = rtl_priv(hw);
43 struct rtl_phy *rtlphy = &(rtlpriv->phy); 40 struct rtl_phy *rtlphy = &(rtlpriv->phy);
@@ -114,5 +111,3 @@ void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw)
114 111
115 rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; 112 rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl;
116} 113}
117
118
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h
index 5911d52a24ac..36302ebae4a3 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h
@@ -192,6 +192,6 @@ void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw);
192void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw); 192void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw);
193void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw); 193void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw);
194void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal); 194void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal);
195void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw); 195void rtl92ce_dm_dynamic_txpower(struct ieee80211_hw *hw);
196 196
197#endif 197#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
index 0b910921e606..05477f465a75 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
@@ -37,7 +37,6 @@
37#include "def.h" 37#include "def.h"
38#include "phy.h" 38#include "phy.h"
39#include "dm.h" 39#include "dm.h"
40#include "fw.h"
41#include "led.h" 40#include "led.h"
42#include "hw.h" 41#include "hw.h"
43 42
@@ -949,8 +948,8 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
949 } 948 }
950 949
951 rtlhal->last_hmeboxnum = 0; 950 rtlhal->last_hmeboxnum = 0;
952 rtl92c_phy_mac_config(hw); 951 rtl92ce_phy_mac_config(hw);
953 rtl92c_phy_bb_config(hw); 952 rtl92ce_phy_bb_config(hw);
954 rtlphy->rf_mode = RF_OP_BY_SW_3WIRE; 953 rtlphy->rf_mode = RF_OP_BY_SW_3WIRE;
955 rtl92c_phy_rf_config(hw); 954 rtl92c_phy_rf_config(hw);
956 rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0, 955 rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h
index 305c819c8c78..a3dfdb635168 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h
@@ -30,6 +30,8 @@
30#ifndef __RTL92CE_HW_H__ 30#ifndef __RTL92CE_HW_H__
31#define __RTL92CE_HW_H__ 31#define __RTL92CE_HW_H__
32 32
33#define H2C_RA_MASK 6
34
33void rtl92ce_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); 35void rtl92ce_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val);
34void rtl92ce_read_eeprom_info(struct ieee80211_hw *hw); 36void rtl92ce_read_eeprom_info(struct ieee80211_hw *hw);
35void rtl92ce_interrupt_recognized(struct ieee80211_hw *hw, 37void rtl92ce_interrupt_recognized(struct ieee80211_hw *hw,
@@ -53,5 +55,14 @@ void rtl92ce_enable_hw_security_config(struct ieee80211_hw *hw);
53void rtl92ce_set_key(struct ieee80211_hw *hw, u32 key_index, 55void rtl92ce_set_key(struct ieee80211_hw *hw, u32 key_index,
54 u8 *p_macaddr, bool is_group, u8 enc_algo, 56 u8 *p_macaddr, bool is_group, u8 enc_algo,
55 bool is_wepkey, bool clear_all); 57 bool is_wepkey, bool clear_all);
58bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
59void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished);
60void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
61void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
62int rtl92c_download_fw(struct ieee80211_hw *hw);
63void rtl92c_firmware_selfreset(struct ieee80211_hw *hw);
64void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw,
65 u8 element_id, u32 cmd_len, u8 *p_cmdbuffer);
66bool rtl92ce_phy_mac_config(struct ieee80211_hw *hw);
56 67
57#endif 68#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
index 191106033b3c..d0541e8c6012 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
@@ -32,14 +32,13 @@
32#include "../ps.h" 32#include "../ps.h"
33#include "reg.h" 33#include "reg.h"
34#include "def.h" 34#include "def.h"
35#include "hw.h"
35#include "phy.h" 36#include "phy.h"
36#include "rf.h" 37#include "rf.h"
37#include "dm.h" 38#include "dm.h"
38#include "table.h" 39#include "table.h"
39 40
40#include "../rtl8192c/phy_common.c" 41u32 rtl92ce_phy_query_rf_reg(struct ieee80211_hw *hw,
41
42u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
43 enum radio_path rfpath, u32 regaddr, u32 bitmask) 42 enum radio_path rfpath, u32 regaddr, u32 bitmask)
44{ 43{
45 struct rtl_priv *rtlpriv = rtl_priv(hw); 44 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -74,7 +73,7 @@ u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
74 return readback_value; 73 return readback_value;
75} 74}
76 75
77void rtl92c_phy_set_rf_reg(struct ieee80211_hw *hw, 76void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw,
78 enum radio_path rfpath, 77 enum radio_path rfpath,
79 u32 regaddr, u32 bitmask, u32 data) 78 u32 regaddr, u32 bitmask, u32 data)
80{ 79{
@@ -122,19 +121,19 @@ void rtl92c_phy_set_rf_reg(struct ieee80211_hw *hw,
122 bitmask, data, rfpath)); 121 bitmask, data, rfpath));
123} 122}
124 123
125bool rtl92c_phy_mac_config(struct ieee80211_hw *hw) 124bool rtl92ce_phy_mac_config(struct ieee80211_hw *hw)
126{ 125{
127 struct rtl_priv *rtlpriv = rtl_priv(hw); 126 struct rtl_priv *rtlpriv = rtl_priv(hw);
128 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 127 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
129 bool is92c = IS_92C_SERIAL(rtlhal->version); 128 bool is92c = IS_92C_SERIAL(rtlhal->version);
130 bool rtstatus = _rtl92c_phy_config_mac_with_headerfile(hw); 129 bool rtstatus = _rtl92ce_phy_config_mac_with_headerfile(hw);
131 130
132 if (is92c) 131 if (is92c)
133 rtl_write_byte(rtlpriv, 0x14, 0x71); 132 rtl_write_byte(rtlpriv, 0x14, 0x71);
134 return rtstatus; 133 return rtstatus;
135} 134}
136 135
137bool rtl92c_phy_bb_config(struct ieee80211_hw *hw) 136bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw)
138{ 137{
139 bool rtstatus = true; 138 bool rtstatus = true;
140 struct rtl_priv *rtlpriv = rtl_priv(hw); 139 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -160,7 +159,7 @@ bool rtl92c_phy_bb_config(struct ieee80211_hw *hw)
160 return rtstatus; 159 return rtstatus;
161} 160}
162 161
163static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw) 162bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
164{ 163{
165 struct rtl_priv *rtlpriv = rtl_priv(hw); 164 struct rtl_priv *rtlpriv = rtl_priv(hw);
166 u32 i; 165 u32 i;
@@ -177,7 +176,7 @@ static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
177 return true; 176 return true;
178} 177}
179 178
180static bool _rtl92c_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, 179bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
181 u8 configtype) 180 u8 configtype)
182{ 181{
183 int i; 182 int i;
@@ -221,7 +220,6 @@ static bool _rtl92c_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
221 phy_regarray_table[i], 220 phy_regarray_table[i],
222 phy_regarray_table[i + 1])); 221 phy_regarray_table[i + 1]));
223 } 222 }
224 rtl92c_phy_config_bb_external_pa(hw);
225 } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { 223 } else if (configtype == BASEBAND_CONFIG_AGC_TAB) {
226 for (i = 0; i < agctab_arraylen; i = i + 2) { 224 for (i = 0; i < agctab_arraylen; i = i + 2) {
227 rtl_set_bbreg(hw, agctab_array_table[i], MASKDWORD, 225 rtl_set_bbreg(hw, agctab_array_table[i], MASKDWORD,
@@ -237,7 +235,7 @@ static bool _rtl92c_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
237 return true; 235 return true;
238} 236}
239 237
240static bool _rtl92c_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, 238bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
241 u8 configtype) 239 u8 configtype)
242{ 240{
243 struct rtl_priv *rtlpriv = rtl_priv(hw); 241 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -276,7 +274,7 @@ static bool _rtl92c_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
276 return true; 274 return true;
277} 275}
278 276
279bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, 277bool rtl92ce_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
280 enum radio_path rfpath) 278 enum radio_path rfpath)
281{ 279{
282 280
@@ -331,7 +329,6 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
331 udelay(1); 329 udelay(1);
332 } 330 }
333 } 331 }
334 _rtl92c_phy_config_rf_external_pa(hw, rfpath);
335 break; 332 break;
336 case RF90_PATH_B: 333 case RF90_PATH_B:
337 for (i = 0; i < radiob_arraylen; i = i + 2) { 334 for (i = 0; i < radiob_arraylen; i = i + 2) {
@@ -367,7 +364,7 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
367 return true; 364 return true;
368} 365}
369 366
370void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw) 367void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
371{ 368{
372 struct rtl_priv *rtlpriv = rtl_priv(hw); 369 struct rtl_priv *rtlpriv = rtl_priv(hw);
373 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 370 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
@@ -435,7 +432,7 @@ void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
435 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 432 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n"));
436} 433}
437 434
438static void _rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) 435void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
439{ 436{
440 u8 tmpreg; 437 u8 tmpreg;
441 u32 rf_a_mode = 0, rf_b_mode = 0, lc_cal; 438 u32 rf_a_mode = 0, rf_b_mode = 0, lc_cal;
@@ -602,7 +599,7 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
602 jiffies_to_msecs(jiffies - 599 jiffies_to_msecs(jiffies -
603 ppsc->last_awake_jiffies))); 600 ppsc->last_awake_jiffies)));
604 ppsc->last_sleep_jiffies = jiffies; 601 ppsc->last_sleep_jiffies = jiffies;
605 _rtl92ce_phy_set_rf_sleep(hw); 602 _rtl92c_phy_set_rf_sleep(hw);
606 break; 603 break;
607 } 604 }
608 default: 605 default:
@@ -617,7 +614,7 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
617 return bresult; 614 return bresult;
618} 615}
619 616
620bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, 617bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
621 enum rf_pwrstate rfpwr_state) 618 enum rf_pwrstate rfpwr_state)
622{ 619{
623 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 620 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
index 3fc60e434cef..a37267e3fc22 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
@@ -191,11 +191,11 @@ extern void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw,
191extern u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, 191extern u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
192 enum radio_path rfpath, u32 regaddr, 192 enum radio_path rfpath, u32 regaddr,
193 u32 bitmask); 193 u32 bitmask);
194extern void rtl92c_phy_set_rf_reg(struct ieee80211_hw *hw, 194extern void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw,
195 enum radio_path rfpath, u32 regaddr, 195 enum radio_path rfpath, u32 regaddr,
196 u32 bitmask, u32 data); 196 u32 bitmask, u32 data);
197extern bool rtl92c_phy_mac_config(struct ieee80211_hw *hw); 197extern bool rtl92c_phy_mac_config(struct ieee80211_hw *hw);
198extern bool rtl92c_phy_bb_config(struct ieee80211_hw *hw); 198bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw);
199extern bool rtl92c_phy_rf_config(struct ieee80211_hw *hw); 199extern bool rtl92c_phy_rf_config(struct ieee80211_hw *hw);
200extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, 200extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw,
201 enum radio_path rfpath); 201 enum radio_path rfpath);
@@ -223,12 +223,32 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
223extern bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, 223extern bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw,
224 u32 rfpath); 224 u32 rfpath);
225bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); 225bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
226extern bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, 226bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
227 enum rf_pwrstate rfpwr_state); 227 enum rf_pwrstate rfpwr_state);
228void rtl92c_phy_config_bb_external_pa(struct ieee80211_hw *hw);
229void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw); 228void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw);
230bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); 229bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
231void rtl92c_phy_set_io(struct ieee80211_hw *hw); 230void rtl92c_phy_set_io(struct ieee80211_hw *hw);
232void rtl92c_bb_block_on(struct ieee80211_hw *hw); 231void rtl92c_bb_block_on(struct ieee80211_hw *hw);
232u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw,
233 enum radio_path rfpath, u32 offset);
234u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
235 enum radio_path rfpath, u32 offset);
236u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask);
237void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
238 enum radio_path rfpath, u32 offset,
239 u32 data);
240void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
241 u32 regaddr, u32 bitmask,
242 u32 data);
243void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
244 enum radio_path rfpath, u32 offset,
245 u32 data);
246void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
247 u32 regaddr, u32 bitmask,
248 u32 data);
249bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
250void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw);
251bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw);
252void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw);
233 253
234#endif 254#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
index ffd8e04c4028..669b1168dbec 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
@@ -61,7 +61,7 @@ void rtl92c_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
61 } 61 }
62} 62}
63 63
64void rtl92c_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, 64void 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);
@@ -410,7 +410,7 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
410 } 410 }
411} 411}
412 412
413void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, 413void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
414 u8 *ppowerlevel, u8 channel) 414 u8 *ppowerlevel, u8 channel)
415{ 415{
416 u32 writeVal[2], powerBase0[2], powerBase1[2]; 416 u32 writeVal[2], powerBase0[2], powerBase1[2];
@@ -430,7 +430,7 @@ void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
430 } 430 }
431} 431}
432 432
433bool rtl92c_phy_rf6052_config(struct ieee80211_hw *hw) 433bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw)
434{ 434{
435 struct rtl_priv *rtlpriv = rtl_priv(hw); 435 struct rtl_priv *rtlpriv = rtl_priv(hw);
436 struct rtl_phy *rtlphy = &(rtlpriv->phy); 436 struct rtl_phy *rtlphy = &(rtlpriv->phy);
@@ -484,11 +484,11 @@ 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 = rtl92c_phy_config_rf_with_headerfile(hw, 487 rtstatus = rtl92ce_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 = rtl92c_phy_config_rf_with_headerfile(hw, 491 rtstatus = rtl92ce_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:
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
index d3014f99bb7b..3aa520c1c171 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
@@ -40,5 +40,8 @@ extern void rtl92c_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
40 u8 *ppowerlevel); 40 u8 *ppowerlevel);
41extern void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, 41extern void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
42 u8 *ppowerlevel, u8 channel); 42 u8 *ppowerlevel, u8 channel);
43extern bool rtl92c_phy_rf6052_config(struct ieee80211_hw *hw); 43bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw);
44bool rtl92ce_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
45 enum radio_path rfpath);
46
44#endif 47#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
index b4df0b332832..b1cc4d44f534 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
@@ -37,6 +37,7 @@
37#include "phy.h" 37#include "phy.h"
38#include "dm.h" 38#include "dm.h"
39#include "hw.h" 39#include "hw.h"
40#include "rf.h"
40#include "sw.h" 41#include "sw.h"
41#include "trx.h" 42#include "trx.h"
42#include "led.h" 43#include "led.h"
@@ -122,7 +123,7 @@ static struct rtl_hal_ops rtl8192ce_hal_ops = {
122 .switch_channel = rtl92c_phy_sw_chnl, 123 .switch_channel = rtl92c_phy_sw_chnl,
123 .dm_watchdog = rtl92c_dm_watchdog, 124 .dm_watchdog = rtl92c_dm_watchdog,
124 .scan_operation_backup = rtl92c_phy_scan_operation_backup, 125 .scan_operation_backup = rtl92c_phy_scan_operation_backup,
125 .set_rf_power_state = rtl92c_phy_set_rf_power_state, 126 .set_rf_power_state = rtl92ce_phy_set_rf_power_state,
126 .led_control = rtl92ce_led_control, 127 .led_control = rtl92ce_led_control,
127 .set_desc = rtl92ce_set_desc, 128 .set_desc = rtl92ce_set_desc,
128 .get_desc = rtl92ce_get_desc, 129 .get_desc = rtl92ce_get_desc,
@@ -133,9 +134,17 @@ static struct rtl_hal_ops rtl8192ce_hal_ops = {
133 .deinit_sw_leds = rtl92ce_deinit_sw_leds, 134 .deinit_sw_leds = rtl92ce_deinit_sw_leds,
134 .get_bbreg = rtl92c_phy_query_bb_reg, 135 .get_bbreg = rtl92c_phy_query_bb_reg,
135 .set_bbreg = rtl92c_phy_set_bb_reg, 136 .set_bbreg = rtl92c_phy_set_bb_reg,
136 .get_rfreg = rtl92c_phy_query_rf_reg, 137 .get_rfreg = rtl92ce_phy_query_rf_reg,
137 .set_rfreg = rtl92c_phy_set_rf_reg, 138 .set_rfreg = rtl92ce_phy_set_rf_reg,
138 .cmd_send_packet = _rtl92c_cmd_send_packet, 139 .cmd_send_packet = _rtl92c_cmd_send_packet,
140 .phy_rf6052_config = rtl92ce_phy_rf6052_config,
141 .phy_rf6052_set_cck_txpower = rtl92ce_phy_rf6052_set_cck_txpower,
142 .phy_rf6052_set_ofdm_txpower = rtl92ce_phy_rf6052_set_ofdm_txpower,
143 .config_bb_with_headerfile = _rtl92ce_phy_config_bb_with_headerfile,
144 .config_bb_with_pgheaderfile = _rtl92ce_phy_config_bb_with_pgheaderfile,
145 .phy_lc_calibrate = _rtl92ce_phy_lc_calibrate,
146 .phy_set_bw_mode_callback = rtl92ce_phy_set_bw_mode_callback,
147 .dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower,
139}; 148};
140 149
141static struct rtl_mod_params rtl92ce_mod_params = { 150static struct rtl_mod_params rtl92ce_mod_params = {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h
index 0568d6dc83d7..36e657668c1e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h
@@ -35,5 +35,17 @@ void rtl92c_deinit_sw_vars(struct ieee80211_hw *hw);
35void rtl92c_init_var_map(struct ieee80211_hw *hw); 35void rtl92c_init_var_map(struct ieee80211_hw *hw);
36bool _rtl92c_cmd_send_packet(struct ieee80211_hw *hw, 36bool _rtl92c_cmd_send_packet(struct ieee80211_hw *hw,
37 struct sk_buff *skb); 37 struct sk_buff *skb);
38void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
39 u8 *ppowerlevel);
40void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
41 u8 *ppowerlevel, u8 channel);
42bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
43 u8 configtype);
44bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
45 u8 configtype);
46void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
47u32 rtl92ce_phy_query_rf_reg(struct ieee80211_hw *hw,
48 enum radio_path rfpath, u32 regaddr, u32 bitmask);
49void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
38 50
39#endif 51#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/Makefile b/drivers/net/wireless/rtlwifi/rtl8192cu/Makefile
index 91c65122ca80..ad2de6b839ef 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/Makefile
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/Makefile
@@ -1,6 +1,5 @@
1rtl8192cu-objs := \ 1rtl8192cu-objs := \
2 dm.o \ 2 dm.o \
3 fw.o \
4 hw.o \ 3 hw.o \
5 led.o \ 4 led.o \
6 mac.o \ 5 mac.o \
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c
index a4649a2f7e6f..f311baee668d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c
@@ -33,11 +33,8 @@
33#include "def.h" 33#include "def.h"
34#include "phy.h" 34#include "phy.h"
35#include "dm.h" 35#include "dm.h"
36#include "fw.h"
37 36
38#include "../rtl8192c/dm_common.c" 37void rtl92cu_dm_dynamic_txpower(struct ieee80211_hw *hw)
39
40void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw)
41{ 38{
42 struct rtl_priv *rtlpriv = rtl_priv(hw); 39 struct rtl_priv *rtlpriv = rtl_priv(hw);
43 struct rtl_phy *rtlphy = &(rtlpriv->phy); 40 struct rtl_phy *rtlphy = &(rtlpriv->phy);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h
index 5e7fbfc2851b..7f966c666b5a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h
@@ -29,4 +29,4 @@
29 29
30#include "../rtl8192ce/dm.h" 30#include "../rtl8192ce/dm.h"
31 31
32void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw); 32void rtl92cu_dm_dynamic_txpower(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/fw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/fw.h
deleted file mode 100644
index a3bbac811d08..000000000000
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/fw.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/******************************************************************************
2 *
3 * Copyright(c) 2009-2010 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 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
20 *
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
25 *
26 * Larry Finger <Larry.Finger@lwfinger.net>
27 *
28 *****************************************************************************/
29
30#include "../rtl8192ce/fw.h"
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
index df8fe3b51c9b..9444e76838cf 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -38,7 +38,6 @@
38#include "phy.h" 38#include "phy.h"
39#include "mac.h" 39#include "mac.h"
40#include "dm.h" 40#include "dm.h"
41#include "fw.h"
42#include "hw.h" 41#include "hw.h"
43#include "trx.h" 42#include "trx.h"
44#include "led.h" 43#include "led.h"
@@ -1190,8 +1189,8 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw)
1190 } 1189 }
1191 rtlhal->last_hmeboxnum = 0; /* h2c */ 1190 rtlhal->last_hmeboxnum = 0; /* h2c */
1192 _rtl92cu_phy_param_tab_init(hw); 1191 _rtl92cu_phy_param_tab_init(hw);
1193 rtl92c_phy_mac_config(hw); 1192 rtl92cu_phy_mac_config(hw);
1194 rtl92c_phy_bb_config(hw); 1193 rtl92cu_phy_bb_config(hw);
1195 rtlphy->rf_mode = RF_OP_BY_SW_3WIRE; 1194 rtlphy->rf_mode = RF_OP_BY_SW_3WIRE;
1196 rtl92c_phy_rf_config(hw); 1195 rtl92c_phy_rf_config(hw);
1197 if (IS_VENDOR_UMC_A_CUT(rtlhal->version) && 1196 if (IS_VENDOR_UMC_A_CUT(rtlhal->version) &&
@@ -1203,7 +1202,7 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw)
1203 RF_CHNLBW, RFREG_OFFSET_MASK); 1202 RF_CHNLBW, RFREG_OFFSET_MASK);
1204 rtlphy->rfreg_chnlval[1] = rtl_get_rfreg(hw, (enum radio_path)1, 1203 rtlphy->rfreg_chnlval[1] = rtl_get_rfreg(hw, (enum radio_path)1,
1205 RF_CHNLBW, RFREG_OFFSET_MASK); 1204 RF_CHNLBW, RFREG_OFFSET_MASK);
1206 rtl92c_bb_block_on(hw); 1205 rtl92cu_bb_block_on(hw);
1207 rtl_cam_reset_all_entry(hw); 1206 rtl_cam_reset_all_entry(hw);
1208 rtl92cu_enable_hw_security_config(hw); 1207 rtl92cu_enable_hw_security_config(hw);
1209 ppsc->rfpwr_state = ERFON; 1208 ppsc->rfpwr_state = ERFON;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
index 3c0ea5ea6db5..62af555bb61c 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
@@ -30,6 +30,8 @@
30#ifndef __RTL92CU_HW_H__ 30#ifndef __RTL92CU_HW_H__
31#define __RTL92CU_HW_H__ 31#define __RTL92CU_HW_H__
32 32
33#define H2C_RA_MASK 6
34
33#define LLT_POLLING_LLT_THRESHOLD 20 35#define LLT_POLLING_LLT_THRESHOLD 20
34#define LLT_POLLING_READY_TIMEOUT_COUNT 100 36#define LLT_POLLING_READY_TIMEOUT_COUNT 100
35#define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER 255 37#define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER 255
@@ -103,5 +105,12 @@ void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw);
103bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid); 105bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid);
104void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); 106void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid);
105u8 _rtl92c_get_chnl_group(u8 chnl); 107u8 _rtl92c_get_chnl_group(u8 chnl);
108int rtl92c_download_fw(struct ieee80211_hw *hw);
109void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
110void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished);
111void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
112void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw,
113 u8 element_id, u32 cmd_len, u8 *p_cmdbuffer);
114bool rtl92cu_phy_mac_config(struct ieee80211_hw *hw);
106 115
107#endif 116#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c
index dc65ef2bbeac..4e020e654e6b 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c
@@ -37,9 +37,7 @@
37#include "dm.h" 37#include "dm.h"
38#include "table.h" 38#include "table.h"
39 39
40#include "../rtl8192c/phy_common.c" 40u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw,
41
42u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
43 enum radio_path rfpath, u32 regaddr, u32 bitmask) 41 enum radio_path rfpath, u32 regaddr, u32 bitmask)
44{ 42{
45 struct rtl_priv *rtlpriv = rtl_priv(hw); 43 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -65,7 +63,7 @@ u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
65 return readback_value; 63 return readback_value;
66} 64}
67 65
68void rtl92c_phy_set_rf_reg(struct ieee80211_hw *hw, 66void rtl92cu_phy_set_rf_reg(struct ieee80211_hw *hw,
69 enum radio_path rfpath, 67 enum radio_path rfpath,
70 u32 regaddr, u32 bitmask, u32 data) 68 u32 regaddr, u32 bitmask, u32 data)
71{ 69{
@@ -104,20 +102,20 @@ void rtl92c_phy_set_rf_reg(struct ieee80211_hw *hw,
104 regaddr, bitmask, data, rfpath)); 102 regaddr, bitmask, data, rfpath));
105} 103}
106 104
107bool rtl92c_phy_mac_config(struct ieee80211_hw *hw) 105bool rtl92cu_phy_mac_config(struct ieee80211_hw *hw)
108{ 106{
109 bool rtstatus; 107 bool rtstatus;
110 struct rtl_priv *rtlpriv = rtl_priv(hw); 108 struct rtl_priv *rtlpriv = rtl_priv(hw);
111 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 109 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
112 bool is92c = IS_92C_SERIAL(rtlhal->version); 110 bool is92c = IS_92C_SERIAL(rtlhal->version);
113 111
114 rtstatus = _rtl92c_phy_config_mac_with_headerfile(hw); 112 rtstatus = _rtl92cu_phy_config_mac_with_headerfile(hw);
115 if (is92c && IS_HARDWARE_TYPE_8192CE(rtlhal)) 113 if (is92c && IS_HARDWARE_TYPE_8192CE(rtlhal))
116 rtl_write_byte(rtlpriv, 0x14, 0x71); 114 rtl_write_byte(rtlpriv, 0x14, 0x71);
117 return rtstatus; 115 return rtstatus;
118} 116}
119 117
120bool rtl92c_phy_bb_config(struct ieee80211_hw *hw) 118bool rtl92cu_phy_bb_config(struct ieee80211_hw *hw)
121{ 119{
122 bool rtstatus = true; 120 bool rtstatus = true;
123 struct rtl_priv *rtlpriv = rtl_priv(hw); 121 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -146,7 +144,7 @@ bool rtl92c_phy_bb_config(struct ieee80211_hw *hw)
146 return rtstatus; 144 return rtstatus;
147} 145}
148 146
149static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw) 147bool _rtl92cu_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
150{ 148{
151 struct rtl_priv *rtlpriv = rtl_priv(hw); 149 struct rtl_priv *rtlpriv = rtl_priv(hw);
152 struct rtl_phy *rtlphy = &(rtlpriv->phy); 150 struct rtl_phy *rtlphy = &(rtlpriv->phy);
@@ -164,7 +162,7 @@ static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
164 return true; 162 return true;
165} 163}
166 164
167static bool _rtl92c_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, 165bool _rtl92cu_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
168 u8 configtype) 166 u8 configtype)
169{ 167{
170 int i; 168 int i;
@@ -209,7 +207,6 @@ static bool _rtl92c_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
209 phy_regarray_table[i], 207 phy_regarray_table[i],
210 phy_regarray_table[i + 1])); 208 phy_regarray_table[i + 1]));
211 } 209 }
212 rtl92c_phy_config_bb_external_pa(hw);
213 } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { 210 } else if (configtype == BASEBAND_CONFIG_AGC_TAB) {
214 for (i = 0; i < agctab_arraylen; i = i + 2) { 211 for (i = 0; i < agctab_arraylen; i = i + 2) {
215 rtl_set_bbreg(hw, agctab_array_table[i], MASKDWORD, 212 rtl_set_bbreg(hw, agctab_array_table[i], MASKDWORD,
@@ -225,7 +222,7 @@ static bool _rtl92c_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
225 return true; 222 return true;
226} 223}
227 224
228static bool _rtl92c_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, 225bool _rtl92cu_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
229 u8 configtype) 226 u8 configtype)
230{ 227{
231 struct rtl_priv *rtlpriv = rtl_priv(hw); 228 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -263,7 +260,7 @@ static bool _rtl92c_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
263 return true; 260 return true;
264} 261}
265 262
266bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, 263bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
267 enum radio_path rfpath) 264 enum radio_path rfpath)
268{ 265{
269 int i; 266 int i;
@@ -316,7 +313,6 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
316 udelay(1); 313 udelay(1);
317 } 314 }
318 } 315 }
319 _rtl92c_phy_config_rf_external_pa(hw, rfpath);
320 break; 316 break;
321 case RF90_PATH_B: 317 case RF90_PATH_B:
322 for (i = 0; i < radiob_arraylen; i = i + 2) { 318 for (i = 0; i < radiob_arraylen; i = i + 2) {
@@ -352,7 +348,7 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
352 return true; 348 return true;
353} 349}
354 350
355void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw) 351void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
356{ 352{
357 struct rtl_priv *rtlpriv = rtl_priv(hw); 353 struct rtl_priv *rtlpriv = rtl_priv(hw);
358 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 354 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
@@ -410,12 +406,12 @@ void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
410 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 406 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw));
411 break; 407 break;
412 } 408 }
413 rtl92c_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); 409 rtl92cu_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw);
414 rtlphy->set_bwmode_inprogress = false; 410 rtlphy->set_bwmode_inprogress = false;
415 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 411 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n"));
416} 412}
417 413
418void rtl92c_bb_block_on(struct ieee80211_hw *hw) 414void rtl92cu_bb_block_on(struct ieee80211_hw *hw)
419{ 415{
420 struct rtl_priv *rtlpriv = rtl_priv(hw); 416 struct rtl_priv *rtlpriv = rtl_priv(hw);
421 417
@@ -425,7 +421,7 @@ void rtl92c_bb_block_on(struct ieee80211_hw *hw)
425 mutex_unlock(&rtlpriv->io.bb_mutex); 421 mutex_unlock(&rtlpriv->io.bb_mutex);
426} 422}
427 423
428static void _rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) 424void _rtl92cu_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
429{ 425{
430 u8 tmpreg; 426 u8 tmpreg;
431 u32 rf_a_mode = 0, rf_b_mode = 0, lc_cal; 427 u32 rf_a_mode = 0, rf_b_mode = 0, lc_cal;
@@ -463,7 +459,7 @@ static void _rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
463 } 459 }
464} 460}
465 461
466static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, 462bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
467 enum rf_pwrstate rfpwr_state) 463 enum rf_pwrstate rfpwr_state)
468{ 464{
469 struct rtl_priv *rtlpriv = rtl_priv(hw); 465 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -584,7 +580,7 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
584 jiffies_to_msecs(jiffies - 580 jiffies_to_msecs(jiffies -
585 ppsc->last_awake_jiffies))); 581 ppsc->last_awake_jiffies)));
586 ppsc->last_sleep_jiffies = jiffies; 582 ppsc->last_sleep_jiffies = jiffies;
587 _rtl92ce_phy_set_rf_sleep(hw); 583 _rtl92c_phy_set_rf_sleep(hw);
588 break; 584 break;
589 default: 585 default:
590 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 586 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
@@ -598,7 +594,7 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
598 return bresult; 594 return bresult;
599} 595}
600 596
601bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, 597bool rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
602 enum rf_pwrstate rfpwr_state) 598 enum rf_pwrstate rfpwr_state)
603{ 599{
604 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 600 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
@@ -606,6 +602,6 @@ bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw,
606 602
607 if (rfpwr_state == ppsc->rfpwr_state) 603 if (rfpwr_state == ppsc->rfpwr_state)
608 return bresult; 604 return bresult;
609 bresult = _rtl92ce_phy_set_rf_power_state(hw, rfpwr_state); 605 bresult = _rtl92cu_phy_set_rf_power_state(hw, rfpwr_state);
610 return bresult; 606 return bresult;
611} 607}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h
index c456c15afbf1..06299559ab68 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h
@@ -29,6 +29,8 @@
29 29
30#include "../rtl8192ce/phy.h" 30#include "../rtl8192ce/phy.h"
31 31
32void rtl92c_bb_block_on(struct ieee80211_hw *hw); 32void rtl92cu_bb_block_on(struct ieee80211_hw *hw);
33bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, u32 rfpath); 33bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, u32 rfpath);
34void rtl92c_phy_set_io(struct ieee80211_hw *hw); 34void rtl92c_phy_set_io(struct ieee80211_hw *hw);
35bool _rtl92cu_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
36bool rtl92cu_phy_bb_config(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
index 9149adcc8fa5..1c79c226f145 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
@@ -36,7 +36,7 @@
36 36
37static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw); 37static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw);
38 38
39void rtl92c_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) 39void rtl92cu_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);
@@ -61,7 +61,7 @@ void rtl92c_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
61 } 61 }
62} 62}
63 63
64void rtl92c_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, 64void rtl92cu_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);
@@ -388,7 +388,7 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
388 } 388 }
389} 389}
390 390
391void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, 391void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
392 u8 *ppowerlevel, u8 channel) 392 u8 *ppowerlevel, u8 channel)
393{ 393{
394 u32 writeVal[2], powerBase0[2], powerBase1[2]; 394 u32 writeVal[2], powerBase0[2], powerBase1[2];
@@ -406,7 +406,7 @@ void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
406 } 406 }
407} 407}
408 408
409bool rtl92c_phy_rf6052_config(struct ieee80211_hw *hw) 409bool rtl92cu_phy_rf6052_config(struct ieee80211_hw *hw)
410{ 410{
411 struct rtl_priv *rtlpriv = rtl_priv(hw); 411 struct rtl_priv *rtlpriv = rtl_priv(hw);
412 struct rtl_phy *rtlphy = &(rtlpriv->phy); 412 struct rtl_phy *rtlphy = &(rtlpriv->phy);
@@ -456,11 +456,11 @@ static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw)
456 udelay(1); 456 udelay(1);
457 switch (rfpath) { 457 switch (rfpath) {
458 case RF90_PATH_A: 458 case RF90_PATH_A:
459 rtstatus = rtl92c_phy_config_rf_with_headerfile(hw, 459 rtstatus = rtl92cu_phy_config_rf_with_headerfile(hw,
460 (enum radio_path) rfpath); 460 (enum radio_path) rfpath);
461 break; 461 break;
462 case RF90_PATH_B: 462 case RF90_PATH_B:
463 rtstatus = rtl92c_phy_config_rf_with_headerfile(hw, 463 rtstatus = rtl92cu_phy_config_rf_with_headerfile(hw,
464 (enum radio_path) rfpath); 464 (enum radio_path) rfpath);
465 break; 465 break;
466 case RF90_PATH_C: 466 case RF90_PATH_C:
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
index c4ed125ef4dc..86c2728cfa00 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
@@ -27,4 +27,21 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include "../rtl8192ce/rf.h" 30#ifndef __RTL92CU_RF_H__
31#define __RTL92CU_RF_H__
32
33#define RF6052_MAX_TX_PWR 0x3F
34#define RF6052_MAX_REG 0x3F
35#define RF6052_MAX_PATH 2
36
37extern void rtl92cu_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw,
38 u8 bandwidth);
39extern void rtl92c_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
40 u8 *ppowerlevel);
41extern void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
42 u8 *ppowerlevel, u8 channel);
43bool rtl92cu_phy_rf6052_config(struct ieee80211_hw *hw);
44bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
45 enum radio_path rfpath);
46
47#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 62604cbd75e8..71244a38d49e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -36,6 +36,7 @@
36#include "phy.h" 36#include "phy.h"
37#include "mac.h" 37#include "mac.h"
38#include "dm.h" 38#include "dm.h"
39#include "rf.h"
39#include "sw.h" 40#include "sw.h"
40#include "trx.h" 41#include "trx.h"
41#include "led.h" 42#include "led.h"
@@ -106,7 +107,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = {
106 .switch_channel = rtl92c_phy_sw_chnl, 107 .switch_channel = rtl92c_phy_sw_chnl,
107 .dm_watchdog = rtl92c_dm_watchdog, 108 .dm_watchdog = rtl92c_dm_watchdog,
108 .scan_operation_backup = rtl92c_phy_scan_operation_backup, 109 .scan_operation_backup = rtl92c_phy_scan_operation_backup,
109 .set_rf_power_state = rtl92c_phy_set_rf_power_state, 110 .set_rf_power_state = rtl92cu_phy_set_rf_power_state,
110 .led_control = rtl92cu_led_control, 111 .led_control = rtl92cu_led_control,
111 .enable_hw_sec = rtl92cu_enable_hw_security_config, 112 .enable_hw_sec = rtl92cu_enable_hw_security_config,
112 .set_key = rtl92c_set_key, 113 .set_key = rtl92c_set_key,
@@ -114,8 +115,16 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = {
114 .deinit_sw_leds = rtl92cu_deinit_sw_leds, 115 .deinit_sw_leds = rtl92cu_deinit_sw_leds,
115 .get_bbreg = rtl92c_phy_query_bb_reg, 116 .get_bbreg = rtl92c_phy_query_bb_reg,
116 .set_bbreg = rtl92c_phy_set_bb_reg, 117 .set_bbreg = rtl92c_phy_set_bb_reg,
117 .get_rfreg = rtl92c_phy_query_rf_reg, 118 .get_rfreg = rtl92cu_phy_query_rf_reg,
118 .set_rfreg = rtl92c_phy_set_rf_reg, 119 .set_rfreg = rtl92cu_phy_set_rf_reg,
120 .phy_rf6052_config = rtl92cu_phy_rf6052_config,
121 .phy_rf6052_set_cck_txpower = rtl92cu_phy_rf6052_set_cck_txpower,
122 .phy_rf6052_set_ofdm_txpower = rtl92cu_phy_rf6052_set_ofdm_txpower,
123 .config_bb_with_headerfile = _rtl92cu_phy_config_bb_with_headerfile,
124 .config_bb_with_pgheaderfile = _rtl92cu_phy_config_bb_with_pgheaderfile,
125 .phy_lc_calibrate = _rtl92cu_phy_lc_calibrate,
126 .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback,
127 .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower,
119}; 128};
120 129
121static struct rtl_mod_params rtl92cu_mod_params = { 130static struct rtl_mod_params rtl92cu_mod_params = {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
index 3b2c66339554..43b1177924ab 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
@@ -32,4 +32,22 @@
32 32
33#define EFUSE_MAX_SECTION 16 33#define EFUSE_MAX_SECTION 16
34 34
35void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
36 u8 *powerlevel);
37void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
38 u8 *ppowerlevel, u8 channel);
39bool _rtl92cu_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
40 u8 configtype);
41bool _rtl92cu_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
42 u8 configtype);
43void _rtl92cu_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
44void rtl92cu_phy_set_rf_reg(struct ieee80211_hw *hw,
45 enum radio_path rfpath,
46 u32 regaddr, u32 bitmask, u32 data);
47bool rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
48 enum rf_pwrstate rfpwr_state);
49u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw,
50 enum radio_path rfpath, u32 regaddr, u32 bitmask);
51void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
52
35#endif 53#endif
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 4b90b35f211e..9d0c01a86d0c 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1383,6 +1383,18 @@ struct rtl_hal_ops {
1383 u32 regaddr, u32 bitmask); 1383 u32 regaddr, u32 bitmask);
1384 void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, 1384 void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath,
1385 u32 regaddr, u32 bitmask, u32 data); 1385 u32 regaddr, u32 bitmask, u32 data);
1386 bool (*phy_rf6052_config) (struct ieee80211_hw *hw);
1387 void (*phy_rf6052_set_cck_txpower) (struct ieee80211_hw *hw,
1388 u8 *powerlevel);
1389 void (*phy_rf6052_set_ofdm_txpower) (struct ieee80211_hw *hw,
1390 u8 *ppowerlevel, u8 channel);
1391 bool (*config_bb_with_headerfile) (struct ieee80211_hw *hw,
1392 u8 configtype);
1393 bool (*config_bb_with_pgheaderfile) (struct ieee80211_hw *hw,
1394 u8 configtype);
1395 void (*phy_lc_calibrate) (struct ieee80211_hw *hw, bool is2t);
1396 void (*phy_set_bw_mode_callback) (struct ieee80211_hw *hw);
1397 void (*dm_dynamic_txpower) (struct ieee80211_hw *hw);
1386}; 1398};
1387 1399
1388struct rtl_intf_ops { 1400struct rtl_intf_ops {