aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2012-02-06 14:26:39 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-06 14:26:39 -0500
commit8926574c4d0055ca4c4a02d1f6b2c249d01a0621 (patch)
tree0c02c3cfff77e868d605246204add4664503b2af /drivers/net/wireless/rtlwifi/rtl8192se/sw.c
parentc056b734e54e12f38f34a2583a4824e6cecc16c1 (diff)
parentb0302aba812bcc39291cdab9ad7e37008f352a91 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts: drivers/net/wireless/rtlwifi/rtl8192se/sw.c
Diffstat (limited to 'drivers/net/wireless/rtlwifi/rtl8192se/sw.c')
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/sw.c82
1 files changed, 57 insertions, 25 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
index 36140ccf2abd..eda30b9d0f15 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 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 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,14 +27,11 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include <linux/vmalloc.h>
33#include <linux/module.h>
34
35#include "../wifi.h" 30#include "../wifi.h"
36#include "../core.h" 31#include "../core.h"
37#include "../pci.h" 32#include "../pci.h"
33#include "../base.h"
34#include "../pci.h"
38#include "reg.h" 35#include "reg.h"
39#include "def.h" 36#include "def.h"
40#include "phy.h" 37#include "phy.h"
@@ -45,6 +42,8 @@
45#include "trx.h" 42#include "trx.h"
46#include "led.h" 43#include "led.h"
47 44
45#include <linux/module.h>
46
48static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw) 47static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw)
49{ 48{
50 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 49 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
@@ -89,12 +88,53 @@ static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw)
89 rtlpci->const_support_pciaspm = 2; 88 rtlpci->const_support_pciaspm = 2;
90} 89}
91 90
91static void rtl92se_fw_cb(const struct firmware *firmware, void *context)
92{
93 struct ieee80211_hw *hw = context;
94 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
95 struct rtl_priv *rtlpriv = rtl_priv(hw);
96 struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
97 struct rt_firmware *pfirmware = NULL;
98 int err;
99
100 RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
101 "Firmware callback routine entered!\n");
102 complete(&rtlpriv->firmware_loading_complete);
103 if (!firmware) {
104 pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name);
105 rtlpriv->max_fw_size = 0;
106 return;
107 }
108 if (firmware->size > rtlpriv->max_fw_size) {
109 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
110 "Firmware is too big!\n");
111 release_firmware(firmware);
112 return;
113 }
114 pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware;
115 memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size);
116 pfirmware->sz_fw_tmpbufferlen = firmware->size;
117 release_firmware(firmware);
118
119 err = ieee80211_register_hw(hw);
120 if (err) {
121 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
122 "Can't register mac80211 hw\n");
123 return;
124 } else {
125 rtlpriv->mac80211.mac80211_registered = 1;
126 }
127 rtlpci->irq_alloc = 1;
128 set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
129
130 /*init rfkill */
131 rtl_init_rfkill(hw);
132}
133
92static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) 134static int rtl92s_init_sw_vars(struct ieee80211_hw *hw)
93{ 135{
94 struct rtl_priv *rtlpriv = rtl_priv(hw); 136 struct rtl_priv *rtlpriv = rtl_priv(hw);
95 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 137 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
96 const struct firmware *firmware;
97 struct rt_firmware *pfirmware = NULL;
98 int err = 0; 138 int err = 0;
99 u16 earlyrxthreshold = 7; 139 u16 earlyrxthreshold = 7;
100 140
@@ -168,9 +208,9 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw)
168 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; 208 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
169 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; 209 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
170 if (!rtlpriv->psc.inactiveps) 210 if (!rtlpriv->psc.inactiveps)
171 pr_info("rtl8192ce: Power Save off (module option)\n"); 211 pr_info("Power Save off (module option)\n");
172 if (!rtlpriv->psc.fwctrl_lps) 212 if (!rtlpriv->psc.fwctrl_lps)
173 pr_info("rtl8192ce: FW Power Save off (module option)\n"); 213 pr_info("FW Power Save off (module option)\n");
174 rtlpriv->psc.reg_fwctrl_lps = 3; 214 rtlpriv->psc.reg_fwctrl_lps = 3;
175 rtlpriv->psc.reg_max_lps_awakeintvl = 5; 215 rtlpriv->psc.reg_max_lps_awakeintvl = 5;
176 /* for ASPM, you can close aspm through 216 /* for ASPM, you can close aspm through
@@ -189,27 +229,19 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw)
189 if (!rtlpriv->rtlhal.pfirmware) 229 if (!rtlpriv->rtlhal.pfirmware)
190 return 1; 230 return 1;
191 231
232 rtlpriv->max_fw_size = sizeof(struct rt_firmware);
233
192 pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n" 234 pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n"
193 "Loading firmware %s\n", rtlpriv->cfg->fw_name); 235 "Loading firmware %s\n", rtlpriv->cfg->fw_name);
194 /* request fw */ 236 /* request fw */
195 err = request_firmware(&firmware, rtlpriv->cfg->fw_name, 237 err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name,
196 rtlpriv->io.dev); 238 rtlpriv->io.dev, GFP_KERNEL, hw,
239 rtl92se_fw_cb);
197 if (err) { 240 if (err) {
198 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 241 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
199 ("Failed to request firmware!\n")); 242 "Failed to request firmware!\n");
200 return 1; 243 return 1;
201 } 244 }
202 if (firmware->size > sizeof(struct rt_firmware)) {
203 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
204 ("Firmware is too big!\n"));
205 release_firmware(firmware);
206 return 1;
207 }
208
209 pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware;
210 memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size);
211 pfirmware->sz_fw_tmpbufferlen = firmware->size;
212 release_firmware(firmware);
213 245
214 return err; 246 return err;
215} 247}
@@ -423,7 +455,7 @@ static int __init rtl92se_module_init(void)
423 455
424 ret = pci_register_driver(&rtl92se_driver); 456 ret = pci_register_driver(&rtl92se_driver);
425 if (ret) 457 if (ret)
426 RT_ASSERT(false, (": No device found\n")); 458 RT_ASSERT(false, "No device found\n");
427 459
428 return ret; 460 return ret;
429} 461}