提交 68458ded 编写于 作者: Y Yogesh Ashok Powar 提交者: John W. Linville

mwifiex: add USB8897 support

Adding new device IDs and assigning generic function/variable
names instead of using device-id specific names.
Signed-off-by: NYogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: NNishant Sarmukadam <nishants@marvell.com>
Signed-off-by: NBing Zhao <bzhao@marvell.com>
Signed-off-by: NFrank Huang <frankh@marvell.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 f87f960b
...@@ -31,12 +31,12 @@ config MWIFIEX_PCIE ...@@ -31,12 +31,12 @@ config MWIFIEX_PCIE
mwifiex_pcie. mwifiex_pcie.
config MWIFIEX_USB config MWIFIEX_USB
tristate "Marvell WiFi-Ex Driver for USB8797" tristate "Marvell WiFi-Ex Driver for USB8797/8897"
depends on MWIFIEX && USB depends on MWIFIEX && USB
select FW_LOADER select FW_LOADER
---help--- ---help---
This adds support for wireless adapters based on Marvell This adds support for wireless adapters based on Marvell
Avastar 88W8797 chipset with USB interface. 8797/8897 chipset with USB interface.
If you choose to build it as a module, it will be called If you choose to build it as a module, it will be called
mwifiex_usb. mwifiex_usb.
...@@ -22,15 +22,21 @@ ...@@ -22,15 +22,21 @@
#define USB_VERSION "1.0" #define USB_VERSION "1.0"
static const char usbdriver_name[] = "usb8797"; static const char usbdriver_name[] = "usb8xxx";
static struct mwifiex_if_ops usb_ops; static struct mwifiex_if_ops usb_ops;
static struct semaphore add_remove_card_sem; static struct semaphore add_remove_card_sem;
static struct usb_card_rec *usb_card; static struct usb_card_rec *usb_card;
static struct usb_device_id mwifiex_usb_table[] = { static struct usb_device_id mwifiex_usb_table[] = {
{USB_DEVICE(USB8797_VID, USB8797_PID_1)}, /* 8797 */
{USB_DEVICE_AND_INTERFACE_INFO(USB8797_VID, USB8797_PID_2, {USB_DEVICE(USB8XXX_VID, USB8797_PID_1)},
{USB_DEVICE_AND_INTERFACE_INFO(USB8XXX_VID, USB8797_PID_2,
USB_CLASS_VENDOR_SPEC,
USB_SUBCLASS_VENDOR_SPEC, 0xff)},
/* 8897 */
{USB_DEVICE(USB8XXX_VID, USB8897_PID_1)},
{USB_DEVICE_AND_INTERFACE_INFO(USB8XXX_VID, USB8897_PID_2,
USB_CLASS_VENDOR_SPEC, USB_CLASS_VENDOR_SPEC,
USB_SUBCLASS_VENDOR_SPEC, 0xff)}, USB_SUBCLASS_VENDOR_SPEC, 0xff)},
{ } /* Terminating entry */ { } /* Terminating entry */
...@@ -343,10 +349,20 @@ static int mwifiex_usb_probe(struct usb_interface *intf, ...@@ -343,10 +349,20 @@ static int mwifiex_usb_probe(struct usb_interface *intf,
id_vendor, id_product, bcd_device); id_vendor, id_product, bcd_device);
/* PID_1 is used for firmware downloading only */ /* PID_1 is used for firmware downloading only */
if (id_product == USB8797_PID_1) switch (id_product) {
card->usb_boot_state = USB8797_FW_DNLD; case USB8797_PID_1:
else case USB8897_PID_1:
card->usb_boot_state = USB8797_FW_READY; card->usb_boot_state = USB8XXX_FW_DNLD;
break;
case USB8797_PID_2:
case USB8897_PID_2:
card->usb_boot_state = USB8XXX_FW_READY;
break;
default:
pr_warning("unknown id_product %#x\n", id_product);
card->usb_boot_state = USB8XXX_FW_DNLD;
break;
}
card->udev = udev; card->udev = udev;
card->intf = intf; card->intf = intf;
...@@ -755,9 +771,20 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) ...@@ -755,9 +771,20 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter)
card->adapter = adapter; card->adapter = adapter;
adapter->dev = &card->udev->dev; adapter->dev = &card->udev->dev;
strcpy(adapter->fw_name, USB8797_DEFAULT_FW_NAME);
usb_card = card; usb_card = card;
switch (le16_to_cpu(card->udev->descriptor.idProduct)) {
case USB8897_PID_1:
case USB8897_PID_2:
strcpy(adapter->fw_name, USB8897_DEFAULT_FW_NAME);
break;
case USB8797_PID_1:
case USB8797_PID_2:
default:
strcpy(adapter->fw_name, USB8797_DEFAULT_FW_NAME);
break;
}
return 0; return 0;
} }
...@@ -773,7 +800,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, ...@@ -773,7 +800,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
{ {
int ret = 0; int ret = 0;
u8 *firmware = fw->fw_buf, *recv_buff; u8 *firmware = fw->fw_buf, *recv_buff;
u32 retries = USB8797_FW_MAX_RETRY, dlen; u32 retries = USB8XXX_FW_MAX_RETRY, dlen;
u32 fw_seqnum = 0, tlen = 0, dnld_cmd = 0; u32 fw_seqnum = 0, tlen = 0, dnld_cmd = 0;
struct fw_data *fwdata; struct fw_data *fwdata;
struct fw_sync_header sync_fw; struct fw_sync_header sync_fw;
...@@ -875,7 +902,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, ...@@ -875,7 +902,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
continue; continue;
} }
retries = USB8797_FW_MAX_RETRY; retries = USB8XXX_FW_MAX_RETRY;
break; break;
} }
fw_seqnum++; fw_seqnum++;
...@@ -899,13 +926,13 @@ static int mwifiex_usb_dnld_fw(struct mwifiex_adapter *adapter, ...@@ -899,13 +926,13 @@ static int mwifiex_usb_dnld_fw(struct mwifiex_adapter *adapter,
int ret; int ret;
struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; struct usb_card_rec *card = (struct usb_card_rec *)adapter->card;
if (card->usb_boot_state == USB8797_FW_DNLD) { if (card->usb_boot_state == USB8XXX_FW_DNLD) {
ret = mwifiex_prog_fw_w_helper(adapter, fw); ret = mwifiex_prog_fw_w_helper(adapter, fw);
if (ret) if (ret)
return -1; return -1;
/* Boot state changes after successful firmware download */ /* Boot state changes after successful firmware download */
if (card->usb_boot_state == USB8797_FW_DNLD) if (card->usb_boot_state == USB8XXX_FW_DNLD)
return -1; return -1;
} }
...@@ -1039,4 +1066,5 @@ MODULE_AUTHOR("Marvell International Ltd."); ...@@ -1039,4 +1066,5 @@ MODULE_AUTHOR("Marvell International Ltd.");
MODULE_DESCRIPTION("Marvell WiFi-Ex USB Driver version" USB_VERSION); MODULE_DESCRIPTION("Marvell WiFi-Ex USB Driver version" USB_VERSION);
MODULE_VERSION(USB_VERSION); MODULE_VERSION(USB_VERSION);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_FIRMWARE("mrvl/usb8797_uapsta.bin"); MODULE_FIRMWARE(USB8797_DEFAULT_FW_NAME);
MODULE_FIRMWARE(USB8897_DEFAULT_FW_NAME);
...@@ -22,19 +22,23 @@ ...@@ -22,19 +22,23 @@
#include <linux/usb.h> #include <linux/usb.h>
#define USB8797_VID 0x1286 #define USB8XXX_VID 0x1286
#define USB8797_PID_1 0x2043 #define USB8797_PID_1 0x2043
#define USB8797_PID_2 0x2044 #define USB8797_PID_2 0x2044
#define USB8897_PID_1 0x2045
#define USB8897_PID_2 0x2046
#define USB8797_FW_DNLD 1 #define USB8XXX_FW_DNLD 1
#define USB8797_FW_READY 2 #define USB8XXX_FW_READY 2
#define USB8797_FW_MAX_RETRY 3 #define USB8XXX_FW_MAX_RETRY 3
#define MWIFIEX_TX_DATA_URB 6 #define MWIFIEX_TX_DATA_URB 6
#define MWIFIEX_RX_DATA_URB 6 #define MWIFIEX_RX_DATA_URB 6
#define MWIFIEX_USB_TIMEOUT 100 #define MWIFIEX_USB_TIMEOUT 100
#define USB8797_DEFAULT_FW_NAME "mrvl/usb8797_uapsta.bin" #define USB8797_DEFAULT_FW_NAME "mrvl/usb8797_uapsta.bin"
#define USB8897_DEFAULT_FW_NAME "mrvl/usb8897_uapsta.bin"
#define FW_DNLD_TX_BUF_SIZE 620 #define FW_DNLD_TX_BUF_SIZE 620
#define FW_DNLD_RX_BUF_SIZE 2048 #define FW_DNLD_RX_BUF_SIZE 2048
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册