diff options
author | George <george0505@realtek.com> | 2011-02-19 17:29:17 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-02-21 15:39:57 -0500 |
commit | 442888c706e90634c4cc3441751b43115a7d8506 (patch) | |
tree | b66e2f1e1b563c8e14320d4f6660accc173f21d2 /drivers/net/wireless/rtlwifi | |
parent | 4295cd254af3181873c7ad15969421d3cb852cf9 (diff) |
rtlwifi: rtl8192cu: Add routines dm, fw, led and sw
Add the rtlwifi/rtl8192cu routines for dm.c, fw.c, led.c and sw.c.
Where possible, these routines use the corresponding code in rtl8192ce.
Signed-off-by: George <george0505@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi')
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192cu/dm.c | 116 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192cu/fw.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192cu/led.c | 142 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 327 |
4 files changed, 615 insertions, 0 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c new file mode 100644 index 000000000000..a4649a2f7e6f --- /dev/null +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c | |||
@@ -0,0 +1,116 @@ | |||
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 "../wifi.h" | ||
31 | #include "../base.h" | ||
32 | #include "reg.h" | ||
33 | #include "def.h" | ||
34 | #include "phy.h" | ||
35 | #include "dm.h" | ||
36 | #include "fw.h" | ||
37 | |||
38 | #include "../rtl8192c/dm_common.c" | ||
39 | |||
40 | void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw) | ||
41 | { | ||
42 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
43 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | ||
44 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | ||
45 | long undecorated_smoothed_pwdb; | ||
46 | |||
47 | if (!rtlpriv->dm.dynamic_txpower_enable) | ||
48 | return; | ||
49 | |||
50 | if (rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) { | ||
51 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; | ||
52 | return; | ||
53 | } | ||
54 | |||
55 | if ((mac->link_state < MAC80211_LINKED) && | ||
56 | (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { | ||
57 | RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, | ||
58 | ("Not connected to any\n")); | ||
59 | |||
60 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; | ||
61 | |||
62 | rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; | ||
63 | return; | ||
64 | } | ||
65 | |||
66 | if (mac->link_state >= MAC80211_LINKED) { | ||
67 | if (mac->opmode == NL80211_IFTYPE_ADHOC) { | ||
68 | undecorated_smoothed_pwdb = | ||
69 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | ||
70 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
71 | ("AP Client PWDB = 0x%lx\n", | ||
72 | undecorated_smoothed_pwdb)); | ||
73 | } else { | ||
74 | undecorated_smoothed_pwdb = | ||
75 | rtlpriv->dm.undecorated_smoothed_pwdb; | ||
76 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
77 | ("STA Default Port PWDB = 0x%lx\n", | ||
78 | undecorated_smoothed_pwdb)); | ||
79 | } | ||
80 | } else { | ||
81 | undecorated_smoothed_pwdb = | ||
82 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | ||
83 | |||
84 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
85 | ("AP Ext Port PWDB = 0x%lx\n", | ||
86 | undecorated_smoothed_pwdb)); | ||
87 | } | ||
88 | |||
89 | if (undecorated_smoothed_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { | ||
90 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; | ||
91 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
92 | ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n")); | ||
93 | } else if ((undecorated_smoothed_pwdb < | ||
94 | (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && | ||
95 | (undecorated_smoothed_pwdb >= | ||
96 | TX_POWER_NEAR_FIELD_THRESH_LVL1)) { | ||
97 | |||
98 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; | ||
99 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
100 | ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n")); | ||
101 | } else if (undecorated_smoothed_pwdb < | ||
102 | (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { | ||
103 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; | ||
104 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
105 | ("TXHIGHPWRLEVEL_NORMAL\n")); | ||
106 | } | ||
107 | |||
108 | if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { | ||
109 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
110 | ("PHY_SetTxPowerLevel8192S() Channel = %d\n", | ||
111 | rtlphy->current_channel)); | ||
112 | rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); | ||
113 | } | ||
114 | |||
115 | rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; | ||
116 | } | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/fw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/fw.c new file mode 100644 index 000000000000..8e350eea3422 --- /dev/null +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/fw.c | |||
@@ -0,0 +1,30 @@ | |||
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.c" | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/led.c b/drivers/net/wireless/rtlwifi/rtl8192cu/led.c new file mode 100644 index 000000000000..332c74348a69 --- /dev/null +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/led.c | |||
@@ -0,0 +1,142 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. | ||
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 | *****************************************************************************/ | ||
27 | |||
28 | #include "../wifi.h" | ||
29 | #include "../usb.h" | ||
30 | #include "reg.h" | ||
31 | #include "led.h" | ||
32 | |||
33 | static void _rtl92cu_init_led(struct ieee80211_hw *hw, | ||
34 | struct rtl_led *pled, enum rtl_led_pin ledpin) | ||
35 | { | ||
36 | pled->hw = hw; | ||
37 | pled->ledpin = ledpin; | ||
38 | pled->ledon = false; | ||
39 | } | ||
40 | |||
41 | static void _rtl92cu_deInit_led(struct rtl_led *pled) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | void rtl92cu_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) | ||
46 | { | ||
47 | u8 ledcfg; | ||
48 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
49 | |||
50 | RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, | ||
51 | ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin)); | ||
52 | ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); | ||
53 | switch (pled->ledpin) { | ||
54 | case LED_PIN_GPIO0: | ||
55 | break; | ||
56 | case LED_PIN_LED0: | ||
57 | rtl_write_byte(rtlpriv, | ||
58 | REG_LEDCFG2, (ledcfg & 0xf0) | BIT(5) | BIT(6)); | ||
59 | break; | ||
60 | case LED_PIN_LED1: | ||
61 | rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0x0f) | BIT(5)); | ||
62 | break; | ||
63 | default: | ||
64 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
65 | ("switch case not process\n")); | ||
66 | break; | ||
67 | } | ||
68 | pled->ledon = true; | ||
69 | } | ||
70 | |||
71 | void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) | ||
72 | { | ||
73 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
74 | struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw); | ||
75 | u8 ledcfg; | ||
76 | |||
77 | RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, | ||
78 | ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin)); | ||
79 | ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); | ||
80 | switch (pled->ledpin) { | ||
81 | case LED_PIN_GPIO0: | ||
82 | break; | ||
83 | case LED_PIN_LED0: | ||
84 | ledcfg &= 0xf0; | ||
85 | if (usbpriv->ledctl.led_opendrain == true) | ||
86 | rtl_write_byte(rtlpriv, REG_LEDCFG2, | ||
87 | (ledcfg | BIT(1) | BIT(5) | BIT(6))); | ||
88 | else | ||
89 | rtl_write_byte(rtlpriv, REG_LEDCFG2, | ||
90 | (ledcfg | BIT(3) | BIT(5) | BIT(6))); | ||
91 | break; | ||
92 | case LED_PIN_LED1: | ||
93 | ledcfg &= 0x0f; | ||
94 | rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg | BIT(3))); | ||
95 | break; | ||
96 | default: | ||
97 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
98 | ("switch case not process\n")); | ||
99 | break; | ||
100 | } | ||
101 | pled->ledon = false; | ||
102 | } | ||
103 | |||
104 | void rtl92cu_init_sw_leds(struct ieee80211_hw *hw) | ||
105 | { | ||
106 | struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw); | ||
107 | _rtl92cu_init_led(hw, &(usbpriv->ledctl.sw_led0), LED_PIN_LED0); | ||
108 | _rtl92cu_init_led(hw, &(usbpriv->ledctl.sw_led1), LED_PIN_LED1); | ||
109 | } | ||
110 | |||
111 | void rtl92cu_deinit_sw_leds(struct ieee80211_hw *hw) | ||
112 | { | ||
113 | struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw); | ||
114 | _rtl92cu_deInit_led(&(usbpriv->ledctl.sw_led0)); | ||
115 | _rtl92cu_deInit_led(&(usbpriv->ledctl.sw_led1)); | ||
116 | } | ||
117 | |||
118 | static void _rtl92cu_sw_led_control(struct ieee80211_hw *hw, | ||
119 | enum led_ctl_mode ledaction) | ||
120 | { | ||
121 | } | ||
122 | |||
123 | void rtl92cu_led_control(struct ieee80211_hw *hw, | ||
124 | enum led_ctl_mode ledaction) | ||
125 | { | ||
126 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
127 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); | ||
128 | |||
129 | if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) && | ||
130 | (ledaction == LED_CTL_TX || | ||
131 | ledaction == LED_CTL_RX || | ||
132 | ledaction == LED_CTL_SITE_SURVEY || | ||
133 | ledaction == LED_CTL_LINK || | ||
134 | ledaction == LED_CTL_NO_LINK || | ||
135 | ledaction == LED_CTL_START_TO_LINK || | ||
136 | ledaction == LED_CTL_POWER_ON)) { | ||
137 | return; | ||
138 | } | ||
139 | RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, ("ledaction %d,\n", | ||
140 | ledaction)); | ||
141 | _rtl92cu_sw_led_control(hw, ledaction); | ||
142 | } | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c new file mode 100644 index 000000000000..4e937e0da8e2 --- /dev/null +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | |||
@@ -0,0 +1,327 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. | ||
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 "../wifi.h" | ||
31 | #include "../core.h" | ||
32 | #include "../usb.h" | ||
33 | #include "../efuse.h" | ||
34 | #include "reg.h" | ||
35 | #include "def.h" | ||
36 | #include "phy.h" | ||
37 | #include "mac.h" | ||
38 | #include "dm.h" | ||
39 | #include "sw.h" | ||
40 | #include "trx.h" | ||
41 | #include "led.h" | ||
42 | #include "hw.h" | ||
43 | |||
44 | |||
45 | MODULE_AUTHOR("Georgia <georgia@realtek.com>"); | ||
46 | MODULE_AUTHOR("Ziv Huang <ziv_huang@realtek.com>"); | ||
47 | MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>"); | ||
48 | MODULE_LICENSE("GPL"); | ||
49 | MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n USB wireless"); | ||
50 | MODULE_FIRMWARE("rtlwifi/rtl8192cufw.bin"); | ||
51 | |||
52 | static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw) | ||
53 | { | ||
54 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
55 | |||
56 | rtlpriv->dm.dm_initialgain_enable = 1; | ||
57 | rtlpriv->dm.dm_flag = 0; | ||
58 | rtlpriv->dm.disable_framebursting = 0; | ||
59 | rtlpriv->dm.thermalvalue = 0; | ||
60 | rtlpriv->rtlhal.pfirmware = vmalloc(0x4000); | ||
61 | if (!rtlpriv->rtlhal.pfirmware) { | ||
62 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
63 | ("Can't alloc buffer for fw.\n")); | ||
64 | return 1; | ||
65 | } | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static void rtl92cu_deinit_sw_vars(struct ieee80211_hw *hw) | ||
70 | { | ||
71 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
72 | |||
73 | if (rtlpriv->rtlhal.pfirmware) { | ||
74 | vfree(rtlpriv->rtlhal.pfirmware); | ||
75 | rtlpriv->rtlhal.pfirmware = NULL; | ||
76 | } | ||
77 | } | ||
78 | |||
79 | static struct rtl_hal_ops rtl8192cu_hal_ops = { | ||
80 | .init_sw_vars = rtl92cu_init_sw_vars, | ||
81 | .deinit_sw_vars = rtl92cu_deinit_sw_vars, | ||
82 | .read_chip_version = rtl92c_read_chip_version, | ||
83 | .read_eeprom_info = rtl92cu_read_eeprom_info, | ||
84 | .enable_interrupt = rtl92c_enable_interrupt, | ||
85 | .disable_interrupt = rtl92c_disable_interrupt, | ||
86 | .hw_init = rtl92cu_hw_init, | ||
87 | .hw_disable = rtl92cu_card_disable, | ||
88 | .set_network_type = rtl92cu_set_network_type, | ||
89 | .set_chk_bssid = rtl92cu_set_check_bssid, | ||
90 | .set_qos = rtl92c_set_qos, | ||
91 | .set_bcn_reg = rtl92cu_set_beacon_related_registers, | ||
92 | .set_bcn_intv = rtl92cu_set_beacon_interval, | ||
93 | .update_interrupt_mask = rtl92cu_update_interrupt_mask, | ||
94 | .get_hw_reg = rtl92cu_get_hw_reg, | ||
95 | .set_hw_reg = rtl92cu_set_hw_reg, | ||
96 | .update_rate_table = rtl92cu_update_hal_rate_table, | ||
97 | .update_rate_mask = rtl92cu_update_hal_rate_mask, | ||
98 | .fill_tx_desc = rtl92cu_tx_fill_desc, | ||
99 | .fill_fake_txdesc = rtl92cu_fill_fake_txdesc, | ||
100 | .fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc, | ||
101 | .cmd_send_packet = rtl92cu_cmd_send_packet, | ||
102 | .query_rx_desc = rtl92cu_rx_query_desc, | ||
103 | .set_channel_access = rtl92cu_update_channel_access_setting, | ||
104 | .radio_onoff_checking = rtl92cu_gpio_radio_on_off_checking, | ||
105 | .set_bw_mode = rtl92c_phy_set_bw_mode, | ||
106 | .switch_channel = rtl92c_phy_sw_chnl, | ||
107 | .dm_watchdog = rtl92c_dm_watchdog, | ||
108 | .scan_operation_backup = rtl92c_phy_scan_operation_backup, | ||
109 | .set_rf_power_state = rtl92c_phy_set_rf_power_state, | ||
110 | .led_control = rtl92cu_led_control, | ||
111 | .enable_hw_sec = rtl92cu_enable_hw_security_config, | ||
112 | .set_key = rtl92c_set_key, | ||
113 | .init_sw_leds = rtl92cu_init_sw_leds, | ||
114 | .deinit_sw_leds = rtl92cu_deinit_sw_leds, | ||
115 | .get_bbreg = rtl92c_phy_query_bb_reg, | ||
116 | .set_bbreg = rtl92c_phy_set_bb_reg, | ||
117 | .get_rfreg = rtl92c_phy_query_rf_reg, | ||
118 | .set_rfreg = rtl92c_phy_set_rf_reg, | ||
119 | }; | ||
120 | |||
121 | static struct rtl_mod_params rtl92cu_mod_params = { | ||
122 | .sw_crypto = 0, | ||
123 | }; | ||
124 | |||
125 | static struct rtl_hal_usbint_cfg rtl92cu_interface_cfg = { | ||
126 | /* rx */ | ||
127 | .in_ep_num = RTL92C_USB_BULK_IN_NUM, | ||
128 | .rx_urb_num = RTL92C_NUM_RX_URBS, | ||
129 | .rx_max_size = RTL92C_SIZE_MAX_RX_BUFFER, | ||
130 | .usb_rx_hdl = rtl8192cu_rx_hdl, | ||
131 | .usb_rx_segregate_hdl = NULL, /* rtl8192c_rx_segregate_hdl; */ | ||
132 | /* tx */ | ||
133 | .usb_tx_cleanup = rtl8192c_tx_cleanup, | ||
134 | .usb_tx_post_hdl = rtl8192c_tx_post_hdl, | ||
135 | .usb_tx_aggregate_hdl = rtl8192c_tx_aggregate_hdl, | ||
136 | /* endpoint mapping */ | ||
137 | .usb_endpoint_mapping = rtl8192cu_endpoint_mapping, | ||
138 | .usb_mq_to_hwq = rtl8192cu_mq_to_hwq, | ||
139 | }; | ||
140 | |||
141 | static struct rtl_hal_cfg rtl92cu_hal_cfg = { | ||
142 | .name = "rtl92c_usb", | ||
143 | .fw_name = "rtlwifi/rtl8192cufw.bin", | ||
144 | .ops = &rtl8192cu_hal_ops, | ||
145 | .mod_params = &rtl92cu_mod_params, | ||
146 | .usb_interface_cfg = &rtl92cu_interface_cfg, | ||
147 | |||
148 | .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, | ||
149 | .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN, | ||
150 | .maps[SYS_CLK] = REG_SYS_CLKR, | ||
151 | .maps[MAC_RCR_AM] = AM, | ||
152 | .maps[MAC_RCR_AB] = AB, | ||
153 | .maps[MAC_RCR_ACRC32] = ACRC32, | ||
154 | .maps[MAC_RCR_ACF] = ACF, | ||
155 | .maps[MAC_RCR_AAP] = AAP, | ||
156 | |||
157 | .maps[EFUSE_TEST] = REG_EFUSE_TEST, | ||
158 | .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, | ||
159 | .maps[EFUSE_CLK] = 0, | ||
160 | .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL, | ||
161 | .maps[EFUSE_PWC_EV12V] = PWC_EV12V, | ||
162 | .maps[EFUSE_FEN_ELDR] = FEN_ELDR, | ||
163 | .maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN, | ||
164 | .maps[EFUSE_ANA8M] = EFUSE_ANA8M, | ||
165 | .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE, | ||
166 | .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION, | ||
167 | .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN, | ||
168 | |||
169 | .maps[RWCAM] = REG_CAMCMD, | ||
170 | .maps[WCAMI] = REG_CAMWRITE, | ||
171 | .maps[RCAMO] = REG_CAMREAD, | ||
172 | .maps[CAMDBG] = REG_CAMDBG, | ||
173 | .maps[SECR] = REG_SECCFG, | ||
174 | .maps[SEC_CAM_NONE] = CAM_NONE, | ||
175 | .maps[SEC_CAM_WEP40] = CAM_WEP40, | ||
176 | .maps[SEC_CAM_TKIP] = CAM_TKIP, | ||
177 | .maps[SEC_CAM_AES] = CAM_AES, | ||
178 | .maps[SEC_CAM_WEP104] = CAM_WEP104, | ||
179 | |||
180 | .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6, | ||
181 | .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5, | ||
182 | .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4, | ||
183 | .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3, | ||
184 | .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2, | ||
185 | .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1, | ||
186 | .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, | ||
187 | .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7, | ||
188 | .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6, | ||
189 | .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5, | ||
190 | .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4, | ||
191 | .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3, | ||
192 | .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2, | ||
193 | .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1, | ||
194 | .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2, | ||
195 | .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1, | ||
196 | |||
197 | .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW, | ||
198 | .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT, | ||
199 | .maps[RTL_IMR_BcnInt] = IMR_BCNINT, | ||
200 | .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW, | ||
201 | .maps[RTL_IMR_RDU] = IMR_RDU, | ||
202 | .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND, | ||
203 | .maps[RTL_IMR_BDOK] = IMR_BDOK, | ||
204 | .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK, | ||
205 | .maps[RTL_IMR_TBDER] = IMR_TBDER, | ||
206 | .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK, | ||
207 | .maps[RTL_IMR_TBDOK] = IMR_TBDOK, | ||
208 | .maps[RTL_IMR_BKDOK] = IMR_BKDOK, | ||
209 | .maps[RTL_IMR_BEDOK] = IMR_BEDOK, | ||
210 | .maps[RTL_IMR_VIDOK] = IMR_VIDOK, | ||
211 | .maps[RTL_IMR_VODOK] = IMR_VODOK, | ||
212 | .maps[RTL_IMR_ROK] = IMR_ROK, | ||
213 | .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER), | ||
214 | |||
215 | .maps[RTL_RC_CCK_RATE1M] = DESC92C_RATE1M, | ||
216 | .maps[RTL_RC_CCK_RATE2M] = DESC92C_RATE2M, | ||
217 | .maps[RTL_RC_CCK_RATE5_5M] = DESC92C_RATE5_5M, | ||
218 | .maps[RTL_RC_CCK_RATE11M] = DESC92C_RATE11M, | ||
219 | .maps[RTL_RC_OFDM_RATE6M] = DESC92C_RATE6M, | ||
220 | .maps[RTL_RC_OFDM_RATE9M] = DESC92C_RATE9M, | ||
221 | .maps[RTL_RC_OFDM_RATE12M] = DESC92C_RATE12M, | ||
222 | .maps[RTL_RC_OFDM_RATE18M] = DESC92C_RATE18M, | ||
223 | .maps[RTL_RC_OFDM_RATE24M] = DESC92C_RATE24M, | ||
224 | .maps[RTL_RC_OFDM_RATE36M] = DESC92C_RATE36M, | ||
225 | .maps[RTL_RC_OFDM_RATE48M] = DESC92C_RATE48M, | ||
226 | .maps[RTL_RC_OFDM_RATE54M] = DESC92C_RATE54M, | ||
227 | .maps[RTL_RC_HT_RATEMCS7] = DESC92C_RATEMCS7, | ||
228 | .maps[RTL_RC_HT_RATEMCS15] = DESC92C_RATEMCS15, | ||
229 | }; | ||
230 | |||
231 | #define USB_VENDER_ID_REALTEK 0x0bda | ||
232 | |||
233 | /* 2010-10-19 DID_USB_V3.4 */ | ||
234 | static struct usb_device_id rtl8192c_usb_ids[] = { | ||
235 | |||
236 | /*=== Realtek demoboard ===*/ | ||
237 | /* Default ID */ | ||
238 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8191, rtl92cu_hal_cfg)}, | ||
239 | |||
240 | /****** 8188CU ********/ | ||
241 | /* 8188CE-VAU USB minCard */ | ||
242 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8170, rtl92cu_hal_cfg)}, | ||
243 | /* 8188cu 1*1 dongle */ | ||
244 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8176, rtl92cu_hal_cfg)}, | ||
245 | /* 8188cu 1*1 dongle, (b/g mode only) */ | ||
246 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8177, rtl92cu_hal_cfg)}, | ||
247 | /* 8188cu Slim Solo */ | ||
248 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817a, rtl92cu_hal_cfg)}, | ||
249 | /* 8188cu Slim Combo */ | ||
250 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817b, rtl92cu_hal_cfg)}, | ||
251 | /* 8188RU High-power USB Dongle */ | ||
252 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817d, rtl92cu_hal_cfg)}, | ||
253 | /* 8188CE-VAU USB minCard (b/g mode only) */ | ||
254 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817e, rtl92cu_hal_cfg)}, | ||
255 | /* 8188 Combo for BC4 */ | ||
256 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8754, rtl92cu_hal_cfg)}, | ||
257 | |||
258 | /****** 8192CU ********/ | ||
259 | /* 8191cu 1*2 */ | ||
260 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8177, rtl92cu_hal_cfg)}, | ||
261 | /* 8192cu 2*2 */ | ||
262 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817b, rtl92cu_hal_cfg)}, | ||
263 | /* 8192CE-VAU USB minCard */ | ||
264 | {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817c, rtl92cu_hal_cfg)}, | ||
265 | |||
266 | /*=== Customer ID ===*/ | ||
267 | /****** 8188CU ********/ | ||
268 | {RTL_USB_DEVICE(0x050d, 0x1102, rtl92cu_hal_cfg)}, /*Belkin - Edimax*/ | ||
269 | {RTL_USB_DEVICE(0x06f8, 0xe033, rtl92cu_hal_cfg)}, /*Hercules - Edimax*/ | ||
270 | {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ | ||
271 | {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ | ||
272 | {RTL_USB_DEVICE(0x0Df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ | ||
273 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ | ||
274 | /* HP - Lite-On ,8188CUS Slim Combo */ | ||
275 | {RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)}, | ||
276 | {RTL_USB_DEVICE(0x2001, 0x3308, rtl92cu_hal_cfg)}, /*D-Link - Alpha*/ | ||
277 | {RTL_USB_DEVICE(0x2019, 0xab2a, rtl92cu_hal_cfg)}, /*Planex - Abocom*/ | ||
278 | {RTL_USB_DEVICE(0x2019, 0xed17, rtl92cu_hal_cfg)}, /*PCI - Edimax*/ | ||
279 | {RTL_USB_DEVICE(0x20f4, 0x648b, rtl92cu_hal_cfg)}, /*TRENDnet - Cameo*/ | ||
280 | {RTL_USB_DEVICE(0x7392, 0x7811, rtl92cu_hal_cfg)}, /*Edimax - Edimax*/ | ||
281 | {RTL_USB_DEVICE(0x3358, 0x13d3, rtl92cu_hal_cfg)}, /*Azwave 8188CE-VAU*/ | ||
282 | /* Russian customer -Azwave (8188CE-VAU b/g mode only) */ | ||
283 | {RTL_USB_DEVICE(0x3359, 0x13d3, rtl92cu_hal_cfg)}, | ||
284 | |||
285 | /****** 8192CU ********/ | ||
286 | {RTL_USB_DEVICE(0x0586, 0x341f, rtl92cu_hal_cfg)}, /*Zyxel -Abocom*/ | ||
287 | {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/ | ||
288 | {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ | ||
289 | {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Abocom -Abocom*/ | ||
290 | {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/ | ||
291 | {RTL_USB_DEVICE(0x2001, 0x3309, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/ | ||
292 | {RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/ | ||
293 | {RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/ | ||
294 | {RTL_USB_DEVICE(0x7392, 0x7822, rtl92cu_hal_cfg)}, /*Edimax -Edimax*/ | ||
295 | {} | ||
296 | }; | ||
297 | |||
298 | MODULE_DEVICE_TABLE(usb, rtl8192c_usb_ids); | ||
299 | |||
300 | static struct usb_driver rtl8192cu_driver = { | ||
301 | .name = "rtl8192cu", | ||
302 | .probe = rtl_usb_probe, | ||
303 | .disconnect = rtl_usb_disconnect, | ||
304 | .id_table = rtl8192c_usb_ids, | ||
305 | |||
306 | #ifdef CONFIG_PM | ||
307 | /* .suspend = rtl_usb_suspend, */ | ||
308 | /* .resume = rtl_usb_resume, */ | ||
309 | /* .reset_resume = rtl8192c_resume, */ | ||
310 | #endif /* CONFIG_PM */ | ||
311 | #ifdef CONFIG_AUTOSUSPEND | ||
312 | .supports_autosuspend = 1, | ||
313 | #endif | ||
314 | }; | ||
315 | |||
316 | static int __init rtl8192cu_init(void) | ||
317 | { | ||
318 | return usb_register(&rtl8192cu_driver); | ||
319 | } | ||
320 | |||
321 | static void __exit rtl8192cu_exit(void) | ||
322 | { | ||
323 | usb_deregister(&rtl8192cu_driver); | ||
324 | } | ||
325 | |||
326 | module_init(rtl8192cu_init); | ||
327 | module_exit(rtl8192cu_exit); | ||