Commit 62009b7f authored by Larry Finger's avatar Larry Finger Committed by John W. Linville

rtlwifi: rtl8192cu: Add new firmware

Vendor driver rtl8188C_8192C_8192D_usb_linux_v3.4.2_3727.20120404 introduced
new firmware for these chips. The code try for the new file, and fall back to
the original firmware if the new file is not available.
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8fd77aec
...@@ -46,10 +46,20 @@ void rtl_fw_cb(const struct firmware *firmware, void *context) ...@@ -46,10 +46,20 @@ void rtl_fw_cb(const struct firmware *firmware, void *context)
"Firmware callback routine entered!\n"); "Firmware callback routine entered!\n");
complete(&rtlpriv->firmware_loading_complete); complete(&rtlpriv->firmware_loading_complete);
if (!firmware) { if (!firmware) {
if (rtlpriv->cfg->alt_fw_name) {
err = request_firmware(&firmware,
rtlpriv->cfg->alt_fw_name,
rtlpriv->io.dev);
pr_info("Loading alternative firmware %s\n",
rtlpriv->cfg->alt_fw_name);
if (!err)
goto found_alt;
}
pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name); pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name);
rtlpriv->max_fw_size = 0; rtlpriv->max_fw_size = 0;
return; return;
} }
found_alt:
if (firmware->size > rtlpriv->max_fw_size) { if (firmware->size > rtlpriv->max_fw_size) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"Firmware is too big!\n"); "Firmware is too big!\n");
......
...@@ -50,6 +50,9 @@ MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>"); ...@@ -50,6 +50,9 @@ MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n USB wireless"); MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n USB wireless");
MODULE_FIRMWARE("rtlwifi/rtl8192cufw.bin"); MODULE_FIRMWARE("rtlwifi/rtl8192cufw.bin");
MODULE_FIRMWARE("rtlwifi/rtl8192cufw_A.bin");
MODULE_FIRMWARE("rtlwifi/rtl8192cufw_B.bin");
MODULE_FIRMWARE("rtlwifi/rtl8192cufw_TMSC.bin");
static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw) static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw)
{ {
...@@ -69,14 +72,21 @@ static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw) ...@@ -69,14 +72,21 @@ static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw)
"Can't alloc buffer for fw\n"); "Can't alloc buffer for fw\n");
return 1; return 1;
} }
if (IS_VENDOR_UMC_A_CUT(rtlpriv->rtlhal.version) &&
!IS_92C_SERIAL(rtlpriv->rtlhal.version)) {
rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_A.bin";
} else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlpriv->rtlhal.version)) {
rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_B.bin";
} else {
rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_TMSC.bin";
}
/* provide name of alternative file */
rtlpriv->cfg->alt_fw_name = "rtlwifi/rtl8192cufw.bin";
pr_info("Loading firmware %s\n", rtlpriv->cfg->fw_name); pr_info("Loading firmware %s\n", rtlpriv->cfg->fw_name);
rtlpriv->max_fw_size = 0x4000; rtlpriv->max_fw_size = 0x4000;
err = request_firmware_nowait(THIS_MODULE, 1, err = request_firmware_nowait(THIS_MODULE, 1,
rtlpriv->cfg->fw_name, rtlpriv->io.dev, rtlpriv->cfg->fw_name, rtlpriv->io.dev,
GFP_KERNEL, hw, rtl_fw_cb); GFP_KERNEL, hw, rtl_fw_cb);
return err; return err;
} }
......
...@@ -1804,6 +1804,7 @@ struct rtl_hal_cfg { ...@@ -1804,6 +1804,7 @@ struct rtl_hal_cfg {
bool write_readback; bool write_readback;
char *name; char *name;
char *fw_name; char *fw_name;
char *alt_fw_name;
struct rtl_hal_ops *ops; struct rtl_hal_ops *ops;
struct rtl_mod_params *mod_params; struct rtl_mod_params *mod_params;
struct rtl_hal_usbint_cfg *usb_interface_cfg; struct rtl_hal_usbint_cfg *usb_interface_cfg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment