diff options
Diffstat (limited to 'at76c503-i3861.c')
-rw-r--r-- | at76c503-i3861.c | 154 |
1 files changed, 26 insertions, 128 deletions
diff --git a/at76c503-i3861.c b/at76c503-i3861.c index 5594c82..abcafb1 100644 --- a/at76c503-i3861.c +++ b/at76c503-i3861.c @@ -1,11 +1,12 @@ /* -*- linux-c -*- */ /* - * at76c503-i3861.c: + * $Id: at76c503-i3861.c,v 1.14 2003/12/25 22:40:26 jal2 Exp $ * * Driver for at76c503-based devices based on the Atmel "Fast-Vnet" reference - * design using the Intersil 3861 radio chip + * design using Intersil 3861 radio chips * * Copyright (c) 2002 - 2003 Oliver Kurth <oku@masqmail.cx> + * Changes Copyright (c) 2003 Joerg Albert <joerg.albert@gmx.de> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -16,40 +17,39 @@ * This driver is derived from usb-skeleton.c * * This driver contains code specific to Atmel AT76C503 (USB wireless 802.11) - * devices which use the Intersil 3861 radio chip. Almost all of the actual - * driver is handled by the generic at76c503.c module, this file mostly just - * deals with the initial probes and downloading the correct firmware to the - * device before handing it off to at76c503. + * devices which use a Intersil 3861 radio chip. Almost + * all of the actual driver is handled by the generic at76c503.c module, this + * file just registers for the USB ids and passes the correct firmware to + * at76c503. * - * History: - * - * 2003_02_15 0.1: (alex) - * - created 3861-specific driver file - * - * 2003_02_18 0.2: (alex) - * - Reduced duplicated code and moved as much as possible into at76c503.c - * - Changed default netdev name to "wlan%d" */ +#include <linux/config.h> #include <linux/module.h> #include <linux/usb.h> #include <linux/init.h> +#include <linux/firmware.h> #include "at76c503.h" -#include "usbdfu.h" - -/* Include firmware data definition */ -#include "fw-i3861.h" +/* Include firmware data definition: a dummy or a statically compiled-in fw */ +#ifdef CONFIG_AT76C503_FIRMWARE_DOWNLOAD +# include "fw-empty.h" +#else +# include "fw-pkg-i3861.h" +#endif /* Version Information */ #define DRIVER_NAME "at76c503-i3861" #define DRIVER_AUTHOR \ "Oliver Kurth <oku@masqmail.cx>, Joerg Albert <joerg.albert@gmx.de>, Alex <alex@foogod.com>" -#define DRIVER_DESC "Atmel at76c503 (Intersil 3861) Wireless LAN Driver" +#define DRIVER_DESC "Atmel at76c503 (i3861) Wireless LAN Driver" + +/* firmware name to load if above include file contains empty fw only */ +#define FW_NAME DRIVER_NAME "-fw" -/* USB Device IDs supported by this driver */ +#define BOARDTYPE BOARDTYPE_INTERSIL #define VENDOR_ID_ATMEL 0x03eb #define PRODUCT_ID_ATMEL_503I 0x7603 /* Generic AT76C503/3861 device */ @@ -84,8 +84,8 @@ Wireless USB Adapter SMC2662W (v1) */ #define PRODUCT_ID_ADDTRON_AWU120 0xff31 /* AWU-120 */ /* also Compex WLU11 */ -#define VENDOR_ID_INTEL 0x8086 /* Intel */ -#define PRODUCT_ID_INTEL_AP310 0x0200 /* AP310 AnyPoint II usb */ +#define VENDOR_ID_INTEL 0x8086 /* Intel */ +#define PRODUCT_ID_INTEL_AP310 0x0200 /* AP310 AnyPoint II usb */ #define VENDOR_ID_CONCEPTRONIC 0x0d8e #define PRODUCT_ID_CONCEPTRONIC_C11U 0x7100 /* also Dynalink L11U */ @@ -93,6 +93,7 @@ Wireless USB Adapter SMC2662W (v1) */ #define VENDOR_ID_ARESCOM 0xd8e #define PRODUCT_ID_WL_210 0x7110 /* Arescom WL-210, FCC id 07J-GL2411USB */ + static struct usb_device_id dev_table[] = { { USB_DEVICE(VENDOR_ID_ATMEL, PRODUCT_ID_ATMEL_503I ) }, { USB_DEVICE(VENDOR_ID_LINKSYS, PRODUCT_ID_LINKSYS_WUSB11_V21) }, @@ -110,109 +111,6 @@ static struct usb_device_id dev_table[] = { { } }; -/* firmware / config variables */ - -static unsigned char fw_internal[] = FW_I3861_INTERNAL; -static unsigned char fw_external[] = FW_I3861_EXTERNAL; - -static int board_type = BOARDTYPE_INTERSIL; - -/*---------------------------------------------------------------------------*/ - -MODULE_DEVICE_TABLE (usb, dev_table); - -/* Module paramaters */ - -static char netdev_name[IFNAMSIZ+1] = "wlan%d"; -MODULE_PARM(netdev_name, "c" __MODULE_STRING(IFNAMSIZ)); -MODULE_PARM_DESC(netdev_name, - "network device name (default is wlan%d)"); - -/* local function prototypes */ - -static void *at76c50x_probe(struct usb_device *dev, unsigned int ifnum, - const struct usb_device_id *id); -static void at76c50x_disconnect(struct usb_device *dev, void *ptr); - -/* structure for registering this driver with the usb subsystem */ - -static struct usb_driver module_usb = { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) - owner: THIS_MODULE, -#endif - name: DRIVER_NAME, - probe: at76c50x_probe, - disconnect: at76c50x_disconnect, - id_table: dev_table, -}; - -/* structure for registering this firmware with the usbdfu subsystem */ - -static struct usbdfu_info module_usbdfu = { - name: DRIVER_NAME, - id_table: dev_table, - fw_buf: fw_internal, - fw_buf_len: sizeof(fw_internal), - post_download_hook: at76c503_usbdfu_post -}; - -/* Module and USB entry points */ - -static void *at76c50x_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id) -{ - if (usbdfu_in_use(udev, ifnum)) { - /* the device is in DFU mode and usbdfu.c is handling it */ - return NULL; - } - - return at76c503_do_probe(THIS_MODULE, udev, fw_external, sizeof(fw_external), board_type, netdev_name); -} - -static void at76c50x_disconnect(struct usb_device *udev, void *ptr) -{ - info("%s disconnected", ((struct at76c503 *)ptr)->netdev->name); - at76c503_delete_device(ptr); -} - -static int __init mod_init(void) -{ - int result; - - info(DRIVER_DESC " " DRIVER_VERSION); - - /* HZ became a variable with 2.4.23-preX */ - module_usbdfu.reset_delay=2*HZ; - - /* register with usbdfu so that the firmware will be automatically - * downloaded to the device on detection */ - result = usbdfu_register(&module_usbdfu); - if (result < 0) { - err("usbdfu_register failed (status %d)", result); - return -1; - } - - /* register this driver with the USB subsystem */ - result = usb_register(&module_usb); - if (result < 0) { - err("usb_register failed (status %d)", result); - usbdfu_deregister(&module_usbdfu); - return -1; - } - - return 0; -} - -static void __exit mod_exit(void) -{ - info(DRIVER_DESC " " DRIVER_VERSION " unloading"); - /* deregister this driver with the USB subsystem */ - usbdfu_deregister(&module_usbdfu); - usb_deregister(&module_usb); -} - -module_init (mod_init); -module_exit (mod_exit); - -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_LICENSE("GPL"); +/* jal: not really good style to include a .c file, but all but the above + is constant in the at76c503-*.c files ... */ +#include "at76c503-fw_skel.c" |