Without this patch, developers may well need to power cycle machines with net2280 cards in order to switch gadget drivers (or versions thereof). Please merge.
- Dave
This creates a module parameter "enable_suspend", and changes the default behavior to avoid the need to power cycle machines with net2280 cards to recover from some common developer actions (like rmmod/modprobe). When set to 1, the net2280, for better or worse, will enter low-power mode when the USB host requests it. This is fine except in situations involving a power-cycling host or rmmoding the gadget driver while connected to a suspended (or disconnected!) port. When set to 0 (now the default), the driver will report suspend requests to the gadget driver, but will not place the NET2280 into low-power mode. This works fine in all situations except bus-powered devices (for which a PCI+Linux-based NET2280 generally doesn't make much sense anyway) It also (finally...) updates NetChip references to refer to PLX; and updates the dates on the driver. From: Alex Sanks <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> --- 1.67/drivers/usb/gadget/net2280.c Sat Oct 23 08:29:06 2004 +++ edited/drivers/usb/gadget/net2280.c Thu Feb 3 03:41:28 2005 @@ -1,8 +1,9 @@ /* - * Driver for the NetChip 2280 USB device controller. - * Specs and errata are available from <http://www.netchip.com>. + * Driver for the PLX NET2280 USB device controller. + * Specs and errata are available from <http://www.plxtech.com>. * - * NetChip Technology Inc. supported the development of this driver. + * PLX Technology Inc. (formerly NetChip Technology) supported the + * development of this driver. * * * CODE STATUS HIGHLIGHTS @@ -23,7 +24,7 @@ /* * Copyright (C) 2003 David Brownell - * Copyright (C) 2003 NetChip Technologies + * Copyright (C) 2003-2005 PLX Technology, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,8 +70,8 @@ #include <asm/unaligned.h> -#define DRIVER_DESC "NetChip 2280 USB Peripheral Controller" -#define DRIVER_VERSION "2004 Jan 14" +#define DRIVER_DESC "PLX NET2280 USB Peripheral Controller" +#define DRIVER_VERSION "2005 Feb 03" #define DMA_ADDR_INVALID (~(dma_addr_t)0) #define EP_DONTUSE 13 /* nonzero */ @@ -113,6 +114,16 @@ /* "modprobe net2280 fifo_mode=1" etc */ module_param (fifo_mode, ushort, 0644); +/* enable_suspend -- When enabled, the driver will respond to + * USB suspend requests by powering down the NET2280. Otherwise, + * USB suspend requests will be ignored. This is acceptible for + * self-powered devices, and helps avoid some quirks. + */ +static int enable_suspend = 0; + +/* "modprobe net2280 enable_suspend=1" etc */ +module_param (enable_suspend, bool, S_IRUGO); + #define DIR_STRING(bAddress) (((bAddress) & USB_DIR_IN) ? "in" : "out") @@ -2561,6 +2572,8 @@ if (stat & (1 << SUSPEND_REQUEST_INTERRUPT)) { if (dev->driver->suspend) dev->driver->suspend (&dev->gadget); + if (!enable_suspend) + stat &= ~(1 << SUSPEND_REQUEST_INTERRUPT); } else { if (dev->driver->resume) dev->driver->resume (&dev->gadget);