diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-04 12:10:10 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-04 12:10:10 -0700 |
commit | 1f3175a66a04109fb39a5c9d3febcf4aeeec1e82 (patch) | |
tree | eff9b0cc2e493690e505918803f34b691342c6c0 /usb | |
parent | 89db993763d7241db3f0b8760c71dcb0cf6e5d91 (diff) | |
download | patches-1f3175a66a04109fb39a5c9d3febcf4aeeec1e82.tar.gz |
usb and driver core patches added
Diffstat (limited to 'usb')
-rw-r--r-- | usb/always-announce-new-usb-devices.patch | 6 | ||||
-rw-r--r-- | usb/usb-at91-usb-driver-supend-resume-fixes.patch | 137 | ||||
-rw-r--r-- | usb/usb-fix-gadget_is_musbhdrc.patch | 34 | ||||
-rw-r--r-- | usb/usb-g_ether-highspeed-conformance-fix.patch | 42 | ||||
-rw-r--r-- | usb/usb-gadget-zero-poisons-out-buffers.patch | 42 | ||||
-rw-r--r-- | usb/usb-gadgetfs-highspeed-bugfix.patch | 122 | ||||
-rw-r--r-- | usb/usb-linux-usb-net2280.h-common-definitions.patch | 895 | ||||
-rw-r--r-- | usb/usb-net2280-short-rx-status-fix.patch | 30 | ||||
-rw-r--r-- | usb/usb-otg-hub-support-is-optional.patch | 49 | ||||
-rw-r--r-- | usb/usb-rename-ax8817x_func-to-asix_func-and-add-utility-functions-to-reduce-bloat.patch | 713 | ||||
-rw-r--r-- | usb/usb-rndis_host-whitespace-comment-updates.patch | 81 | ||||
-rw-r--r-- | usb/usb-usbtest-scatterlist-out-data-pattern-testing.patch | 65 |
12 files changed, 2213 insertions, 3 deletions
diff --git a/usb/always-announce-new-usb-devices.patch b/usb/always-announce-new-usb-devices.patch index a50990b21f360..1b808fc0bbf7a 100644 --- a/usb/always-announce-new-usb-devices.patch +++ b/usb/always-announce-new-usb-devices.patch @@ -14,7 +14,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- gregkh-2.6.orig/drivers/usb/core/hub.c +++ gregkh-2.6/drivers/usb/core/hub.c -@@ -1260,7 +1260,6 @@ static int choose_configuration(struct u +@@ -1267,7 +1267,6 @@ static int choose_configuration(struct u return i; } @@ -22,7 +22,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> static void show_string(struct usb_device *udev, char *id, char *string) { if (!string) -@@ -1268,10 +1267,6 @@ static void show_string(struct usb_devic +@@ -1275,10 +1274,6 @@ static void show_string(struct usb_devic dev_printk(KERN_INFO, &udev->dev, "%s: %s\n", id, string); } @@ -33,7 +33,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> #ifdef CONFIG_USB_OTG -@@ -1316,7 +1311,10 @@ int usb_new_device(struct usb_device *ud +@@ -1323,7 +1318,10 @@ int usb_new_device(struct usb_device *ud udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber); /* Tell the world! */ diff --git a/usb/usb-at91-usb-driver-supend-resume-fixes.patch b/usb/usb-at91-usb-driver-supend-resume-fixes.patch new file mode 100644 index 0000000000000..6816b2f43c8e9 --- /dev/null +++ b/usb/usb-at91-usb-driver-supend-resume-fixes.patch @@ -0,0 +1,137 @@ +From david-b@pacbell.net Sun Apr 2 21:26:26 2006 +From: David Brownell <david-b@pacbell.net> +To: linux-usb-devel@lists.sourceforge.net +Subject: USB: at91 usb driver supend/resume fixes +Date: Sun, 2 Apr 2006 20:26:21 -0800 +Cc: Greg KH <greg@kroah.com> +Message-Id: <200604022126.21844.david-b@pacbell.net> + +AT91: the two USB drivers (OHCI, UDC) got out of sync with various +usbcore and driver model PM updates; fix. + +Also minor fixes to ohci: whitespace/style, MODULE_ALIAS so coldplug works +using /sys/.../modalias, and turn off _both_ clocks during suspend. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/usb/gadget/at91_udc.c | 4 ++-- + drivers/usb/host/ohci-at91.c | 35 +++++++++++++++++------------------ + 2 files changed, 19 insertions(+), 20 deletions(-) + +--- gregkh-2.6.orig/drivers/usb/gadget/at91_udc.c ++++ gregkh-2.6/drivers/usb/gadget/at91_udc.c +@@ -1709,7 +1709,7 @@ static int __devexit at91udc_remove(stru + } + + #ifdef CONFIG_PM +-static int at91udc_suspend(struct platform_device *dev, u32 state, u32 level) ++static int at91udc_suspend(struct platform_device *dev, pm_message_t mesg) + { + struct at91_udc *udc = platform_get_drvdata(dev); + +@@ -1731,7 +1731,7 @@ static int at91udc_suspend(struct platfo + return 0; + } + +-static int at91udc_resume(struct platform_device *dev, u32 level) ++static int at91udc_resume(struct platform_device *dev) + { + struct at91_udc *udc = platform_get_drvdata(dev); + +--- gregkh-2.6.orig/drivers/usb/host/ohci-at91.c ++++ gregkh-2.6/drivers/usb/host/ohci-at91.c +@@ -20,7 +20,7 @@ + #include <asm/arch/board.h> + + #ifndef CONFIG_ARCH_AT91RM9200 +-#error "This file is AT91RM9200 bus glue. CONFIG_ARCH_AT91RM9200 must be defined." ++#error "CONFIG_ARCH_AT91RM9200 must be defined." + #endif + + /* interface and function clocks */ +@@ -84,8 +84,6 @@ static int usb_hcd_at91_remove (struct u + * Allocates basic resources for this USB host controller, and + * then invokes the start() method for the HCD associated with it + * through the hotplug entry's driver_data. +- * +- * Store this function in the HCD's struct pci_driver as probe(). + */ + int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev) + { +@@ -148,7 +146,6 @@ int usb_hcd_at91_probe (const struct hc_ + } + + +-/* may be called without controller electrically present */ + /* may be called with controller, bus, and devices active */ + + /** +@@ -166,11 +163,11 @@ static int usb_hcd_at91_remove (struct u + usb_remove_hcd(hcd); + at91_stop_hc(pdev); + iounmap(hcd->regs); +- release_mem_region(hcd->rsrc_start, hcd->rsrc_len); ++ release_mem_region(hcd->rsrc_start, hcd->rsrc_len); + +- clk_put(fclk); +- clk_put(iclk); +- fclk = iclk = NULL; ++ clk_put(fclk); ++ clk_put(iclk); ++ fclk = iclk = NULL; + + dev_set_drvdata(&pdev->dev, NULL); + return 0; +@@ -235,8 +232,8 @@ static const struct hc_driver ohci_at91_ + .hub_control = ohci_hub_control, + + #ifdef CONFIG_PM +- .hub_suspend = ohci_hub_suspend, +- .hub_resume = ohci_hub_resume, ++ .bus_suspend = ohci_bus_suspend, ++ .bus_resume = ohci_bus_resume, + #endif + .start_port_reset = ohci_start_port_reset, + }; +@@ -254,21 +251,21 @@ static int ohci_hcd_at91_drv_remove(stru + } + + #ifdef CONFIG_PM +-static int ohci_hcd_at91_drv_suspend(struct platform_device *dev, u32 state, u32 level) +-{ +- printk("%s(%s:%d): not implemented yet\n", +- __func__, __FILE__, __LINE__); + ++/* REVISIT suspend/resume look "too" simple here */ ++ ++static int ++ohci_hcd_at91_drv_suspend(struct platform_device *dev, pm_message_t mesg) ++{ + clk_disable(fclk); ++ clk_disable(iclk); + + return 0; + } + +-static int ohci_hcd_at91_drv_resume(struct platform_device *dev, u32 state) ++static int ohci_hcd_at91_drv_resume(struct platform_device *dev) + { +- printk("%s(%s:%d): not implemented yet\n", +- __func__, __FILE__, __LINE__); +- ++ clk_enable(iclk); + clk_enable(fclk); + + return 0; +@@ -278,6 +275,8 @@ static int ohci_hcd_at91_drv_resume(stru + #define ohci_hcd_at91_drv_resume NULL + #endif + ++MODULE_ALIAS("at91rm9200-ohci"); ++ + static struct platform_driver ohci_hcd_at91_driver = { + .probe = ohci_hcd_at91_drv_probe, + .remove = ohci_hcd_at91_drv_remove, diff --git a/usb/usb-fix-gadget_is_musbhdrc.patch b/usb/usb-fix-gadget_is_musbhdrc.patch new file mode 100644 index 0000000000000..8f8c91547d4ea --- /dev/null +++ b/usb/usb-fix-gadget_is_musbhdrc.patch @@ -0,0 +1,34 @@ +From david-b@pacbell.net Sun Apr 2 11:38:12 2006 +From: David Brownell <david-b@pacbell.net> +To: linux-usb-devel@lists.sourceforge.net +Subject: USB: fix gadget_is_musbhdrc() +Date: Sun, 2 Apr 2006 10:18:34 -0800 +Cc: Greg KH <greg@kroah.com> +Message-Id: <200604021118.34657.david-b@pacbell.net> + +I submitted the wrong version of the patch teaching about the driver +for Mentor's Highspeed Dual Role Controller (HDRC), whoops! This +uses the right name for that driver. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/gadget_chips.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- gregkh-2.6.orig/drivers/usb/gadget/gadget_chips.h ++++ gregkh-2.6/drivers/usb/gadget/gadget_chips.h +@@ -100,9 +100,9 @@ + #define gadget_is_musbhsfc(g) 0 + #endif + +-/* Mentor high speed "dual role" controller, peripheral mode */ +-#ifdef CONFIG_USB_GADGET_MUSBHDRC +-#define gadget_is_musbhdrc(g) !strcmp("musbhdrc_udc", (g)->name) ++/* Mentor high speed "dual role" controller, in peripheral role */ ++#ifdef CONFIG_USB_GADGET_MUSB_HDRC ++#define gadget_is_musbhdrc(g) !strcmp("musb_hdrc", (g)->name) + #else + #define gadget_is_musbhdrc(g) 0 + #endif diff --git a/usb/usb-g_ether-highspeed-conformance-fix.patch b/usb/usb-g_ether-highspeed-conformance-fix.patch new file mode 100644 index 0000000000000..079f846535336 --- /dev/null +++ b/usb/usb-g_ether-highspeed-conformance-fix.patch @@ -0,0 +1,42 @@ +From david-b@pacbell.net Sun Apr 2 11:38:18 2006 +From: David Brownell <david-b@pacbell.net> +To: linux-usb-devel@lists.sourceforge.net +Subject: USB: g_ether, highspeed conformance fix +Date: Sun, 2 Apr 2006 10:20:43 -0800 +Cc: Greg KH <greg@kroah.com> +Content-Disposition: inline +Message-Id: <200604021120.43627.david-b@pacbell.net> + +Be sure to record the peripheral's ep0 maxpacket size BEFORE using +that to initialize the (high speed) device qualifier; that helps a +lot with USBCV testing. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/ether.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- gregkh-2.6.orig/drivers/usb/gadget/ether.c ++++ gregkh-2.6/drivers/usb/gadget/ether.c +@@ -2338,6 +2338,9 @@ autoconf_fail: + hs_subset_descriptors(); + } + ++ device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket; ++ usb_gadget_set_selfpowered (gadget); ++ + /* For now RNDIS is always a second config */ + if (rndis) + device_desc.bNumConfigurations = 2; +@@ -2361,9 +2364,6 @@ autoconf_fail: + #endif + #endif /* DUALSPEED */ + +- device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket; +- usb_gadget_set_selfpowered (gadget); +- + if (gadget->is_otg) { + otg_descriptor.bmAttributes |= USB_OTG_HNP, + eth_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP; diff --git a/usb/usb-gadget-zero-poisons-out-buffers.patch b/usb/usb-gadget-zero-poisons-out-buffers.patch new file mode 100644 index 0000000000000..f0deee8ecd3f5 --- /dev/null +++ b/usb/usb-gadget-zero-poisons-out-buffers.patch @@ -0,0 +1,42 @@ +From david-b@pacbell.net Sun Apr 2 11:38:18 2006 +From: David Brownell <david-b@pacbell.net> +To: linux-usb-devel@lists.sourceforge.net +Subject: USB: gadget zero poisons OUT buffers +Date: Sun, 2 Apr 2006 10:19:43 -0800 +Cc: Greg KH <greg@kroah.com> +Message-Id: <200604021119.43576.david-b@pacbell.net> + +Fill OUT buffers with 0x55 before RX, so that controller driver +bugs that mangle data can be more readily detected during testing. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/zero.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- gregkh-2.6.orig/drivers/usb/gadget/zero.c ++++ gregkh-2.6/drivers/usb/gadget/zero.c +@@ -572,9 +572,10 @@ static void source_sink_complete (struct + switch (status) { + + case 0: /* normal completion? */ +- if (ep == dev->out_ep) ++ if (ep == dev->out_ep) { + check_read_data (dev, ep, req); +- else ++ memset (req->buf, 0x55, req->length); ++ } else + reinit_write_data (dev, ep, req); + break; + +@@ -626,6 +627,8 @@ source_sink_start_ep (struct usb_ep *ep, + + if (strcmp (ep->name, EP_IN_NAME) == 0) + reinit_write_data (ep->driver_data, ep, req); ++ else ++ memset (req->buf, 0x55, req->length); + + status = usb_ep_queue (ep, req, gfp_flags); + if (status) { diff --git a/usb/usb-gadgetfs-highspeed-bugfix.patch b/usb/usb-gadgetfs-highspeed-bugfix.patch new file mode 100644 index 0000000000000..89319362baaec --- /dev/null +++ b/usb/usb-gadgetfs-highspeed-bugfix.patch @@ -0,0 +1,122 @@ +From david-b@pacbell.net Sun Apr 2 11:38:18 2006 +From: David Brownell <david-b@pacbell.net> +To: linux-usb-devel@lists.sourceforge.net +Subject: USB: gadgetfs highspeed bugfix +Date: Sun, 2 Apr 2006 10:19:23 -0800 +Cc: Greg KH <greg@kroah.com> +Message-Id: <200604021119.24169.david-b@pacbell.net> + +This catches up to a change in the Kconfig support for highspeed modes; +the change predated 2.6.10, and anyone using gadgetfs on a highspeed +device would see the kernel wrongly reject the alternate descriptors. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/inode.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +--- gregkh-2.6.orig/drivers/usb/gadget/inode.c ++++ gregkh-2.6/drivers/usb/gadget/inode.c +@@ -810,7 +810,7 @@ ep_config (struct file *fd, const char _ + if (value == 0) + data->state = STATE_EP_ENABLED; + break; +-#ifdef HIGHSPEED ++#ifdef CONFIG_USB_GADGET_DUALSPEED + case USB_SPEED_HIGH: + /* fails if caller didn't provide that descriptor... */ + value = usb_ep_enable (ep, &data->hs_desc); +@@ -982,7 +982,7 @@ ep0_read (struct file *fd, char __user * + /* assume that was SET_CONFIGURATION */ + if (dev->current_config) { + unsigned power; +-#ifdef HIGHSPEED ++#ifdef CONFIG_USB_GADGET_DUALSPEED + if (dev->gadget->speed == USB_SPEED_HIGH) + power = dev->hs_config->bMaxPower; + else +@@ -1262,7 +1262,7 @@ static struct file_operations ep0_io_ope + * Unrecognized ep0 requests may be handled in user space. + */ + +-#ifdef HIGHSPEED ++#ifdef CONFIG_USB_GADGET_DUALSPEED + static void make_qualifier (struct dev_data *dev) + { + struct usb_qualifier_descriptor qual; +@@ -1291,7 +1291,7 @@ static int + config_buf (struct dev_data *dev, u8 type, unsigned index) + { + int len; +-#ifdef HIGHSPEED ++#ifdef CONFIG_USB_GADGET_DUALSPEED + int hs; + #endif + +@@ -1299,7 +1299,7 @@ config_buf (struct dev_data *dev, u8 typ + if (index > 0) + return -EINVAL; + +-#ifdef HIGHSPEED ++#ifdef CONFIG_USB_GADGET_DUALSPEED + hs = (dev->gadget->speed == USB_SPEED_HIGH); + if (type == USB_DT_OTHER_SPEED_CONFIG) + hs = !hs; +@@ -1335,12 +1335,12 @@ gadgetfs_setup (struct usb_gadget *gadge + dev->state = STATE_CONNECTED; + dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket; + +-#ifdef HIGHSPEED ++#ifdef CONFIG_USB_GADGET_DUALSPEED + if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) { + ERROR (dev, "no high speed config??\n"); + return -EINVAL; + } +-#endif /* HIGHSPEED */ ++#endif /* CONFIG_USB_GADGET_DUALSPEED */ + + INFO (dev, "connected\n"); + event = next_event (dev, GADGETFS_CONNECT); +@@ -1352,11 +1352,11 @@ gadgetfs_setup (struct usb_gadget *gadge + /* ... down_trylock (&data->lock) ... */ + if (data->state != STATE_EP_DEFER_ENABLE) + continue; +-#ifdef HIGHSPEED ++#ifdef CONFIG_USB_GADGET_DUALSPEED + if (gadget->speed == USB_SPEED_HIGH) + value = usb_ep_enable (ep, &data->hs_desc); + else +-#endif /* HIGHSPEED */ ++#endif /* CONFIG_USB_GADGET_DUALSPEED */ + value = usb_ep_enable (ep, &data->desc); + if (value) { + ERROR (dev, "deferred %s enable --> %d\n", +@@ -1391,7 +1391,7 @@ gadgetfs_setup (struct usb_gadget *gadge + value = min (w_length, (u16) sizeof *dev->dev); + req->buf = dev->dev; + break; +-#ifdef HIGHSPEED ++#ifdef CONFIG_USB_GADGET_DUALSPEED + case USB_DT_DEVICE_QUALIFIER: + if (!dev->hs_config) + break; +@@ -1428,7 +1428,7 @@ gadgetfs_setup (struct usb_gadget *gadge + // user mode expected to disable endpoints + } else { + u8 config, power; +-#ifdef HIGHSPEED ++#ifdef CONFIG_USB_GADGET_DUALSPEED + if (gadget->speed == USB_SPEED_HIGH) { + config = dev->hs_config->bConfigurationValue; + power = dev->hs_config->bMaxPower; +@@ -1728,7 +1728,7 @@ gadgetfs_suspend (struct usb_gadget *gad + } + + static struct usb_gadget_driver gadgetfs_driver = { +-#ifdef HIGHSPEED ++#ifdef CONFIG_USB_GADGET_DUALSPEED + .speed = USB_SPEED_HIGH, + #else + .speed = USB_SPEED_FULL, diff --git a/usb/usb-linux-usb-net2280.h-common-definitions.patch b/usb/usb-linux-usb-net2280.h-common-definitions.patch new file mode 100644 index 0000000000000..0d8073a6af4cf --- /dev/null +++ b/usb/usb-linux-usb-net2280.h-common-definitions.patch @@ -0,0 +1,895 @@ +From david-b@pacbell.net Sun Apr 2 11:38:22 2006 +From: David Brownell <david-b@pacbell.net> +To: linux-usb-devel@lists.sourceforge.net +Subject: USB: linux/usb/net2280.h common definitions +Date: Sun, 2 Apr 2006 10:21:26 -0800 +Cc: Greg KH <greg@kroah.com>, Pete Zaitcev <zaitcev@redhat.com> +Message-Id: <200604021121.26835.david-b@pacbell.net> + +From: Pete Zaitcev <zaitcev@redhat.com> + +Move common definitions for NET2280 to <linux/usb/net2280.h>, so that I can +use them in prism54usb (it is not merged yet, but I plan to do it soon). + +Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/net2280.h | 417 ---------------------------------------- + include/linux/usb/net2280.h | 444 +++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 445 insertions(+), 416 deletions(-) + +--- gregkh-2.6.orig/drivers/usb/gadget/net2280.h ++++ gregkh-2.6/drivers/usb/gadget/net2280.h +@@ -22,422 +22,7 @@ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +-/*-------------------------------------------------------------------------*/ +- +-/* NET2280 MEMORY MAPPED REGISTERS +- * +- * The register layout came from the chip documentation, and the bit +- * number definitions were extracted from chip specification. +- * +- * Use the shift operator ('<<') to build bit masks, with readl/writel +- * to access the registers through PCI. +- */ +- +-/* main registers, BAR0 + 0x0000 */ +-struct net2280_regs { +- // offset 0x0000 +- u32 devinit; +-#define LOCAL_CLOCK_FREQUENCY 8 +-#define FORCE_PCI_RESET 7 +-#define PCI_ID 6 +-#define PCI_ENABLE 5 +-#define FIFO_SOFT_RESET 4 +-#define CFG_SOFT_RESET 3 +-#define PCI_SOFT_RESET 2 +-#define USB_SOFT_RESET 1 +-#define M8051_RESET 0 +- u32 eectl; +-#define EEPROM_ADDRESS_WIDTH 23 +-#define EEPROM_CHIP_SELECT_ACTIVE 22 +-#define EEPROM_PRESENT 21 +-#define EEPROM_VALID 20 +-#define EEPROM_BUSY 19 +-#define EEPROM_CHIP_SELECT_ENABLE 18 +-#define EEPROM_BYTE_READ_START 17 +-#define EEPROM_BYTE_WRITE_START 16 +-#define EEPROM_READ_DATA 8 +-#define EEPROM_WRITE_DATA 0 +- u32 eeclkfreq; +- u32 _unused0; +- // offset 0x0010 +- +- u32 pciirqenb0; /* interrupt PCI master ... */ +-#define SETUP_PACKET_INTERRUPT_ENABLE 7 +-#define ENDPOINT_F_INTERRUPT_ENABLE 6 +-#define ENDPOINT_E_INTERRUPT_ENABLE 5 +-#define ENDPOINT_D_INTERRUPT_ENABLE 4 +-#define ENDPOINT_C_INTERRUPT_ENABLE 3 +-#define ENDPOINT_B_INTERRUPT_ENABLE 2 +-#define ENDPOINT_A_INTERRUPT_ENABLE 1 +-#define ENDPOINT_0_INTERRUPT_ENABLE 0 +- u32 pciirqenb1; +-#define PCI_INTERRUPT_ENABLE 31 +-#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 +-#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 +-#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 +-#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 +-#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 +-#define PCI_TARGET_ABORT_ASSERTED_INTERRUPT_ENABLE 18 +-#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 +-#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 +-#define GPIO_INTERRUPT_ENABLE 13 +-#define DMA_D_INTERRUPT_ENABLE 12 +-#define DMA_C_INTERRUPT_ENABLE 11 +-#define DMA_B_INTERRUPT_ENABLE 10 +-#define DMA_A_INTERRUPT_ENABLE 9 +-#define EEPROM_DONE_INTERRUPT_ENABLE 8 +-#define VBUS_INTERRUPT_ENABLE 7 +-#define CONTROL_STATUS_INTERRUPT_ENABLE 6 +-#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 +-#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 +-#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 +-#define RESUME_INTERRUPT_ENABLE 1 +-#define SOF_INTERRUPT_ENABLE 0 +- u32 cpu_irqenb0; /* ... or onboard 8051 */ +-#define SETUP_PACKET_INTERRUPT_ENABLE 7 +-#define ENDPOINT_F_INTERRUPT_ENABLE 6 +-#define ENDPOINT_E_INTERRUPT_ENABLE 5 +-#define ENDPOINT_D_INTERRUPT_ENABLE 4 +-#define ENDPOINT_C_INTERRUPT_ENABLE 3 +-#define ENDPOINT_B_INTERRUPT_ENABLE 2 +-#define ENDPOINT_A_INTERRUPT_ENABLE 1 +-#define ENDPOINT_0_INTERRUPT_ENABLE 0 +- u32 cpu_irqenb1; +-#define CPU_INTERRUPT_ENABLE 31 +-#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 +-#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 +-#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 +-#define PCI_INTA_INTERRUPT_ENABLE 24 +-#define PCI_PME_INTERRUPT_ENABLE 23 +-#define PCI_SERR_INTERRUPT_ENABLE 22 +-#define PCI_PERR_INTERRUPT_ENABLE 21 +-#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 +-#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 +-#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 +-#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 +-#define GPIO_INTERRUPT_ENABLE 13 +-#define DMA_D_INTERRUPT_ENABLE 12 +-#define DMA_C_INTERRUPT_ENABLE 11 +-#define DMA_B_INTERRUPT_ENABLE 10 +-#define DMA_A_INTERRUPT_ENABLE 9 +-#define EEPROM_DONE_INTERRUPT_ENABLE 8 +-#define VBUS_INTERRUPT_ENABLE 7 +-#define CONTROL_STATUS_INTERRUPT_ENABLE 6 +-#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 +-#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 +-#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 +-#define RESUME_INTERRUPT_ENABLE 1 +-#define SOF_INTERRUPT_ENABLE 0 +- +- // offset 0x0020 +- u32 _unused1; +- u32 usbirqenb1; +-#define USB_INTERRUPT_ENABLE 31 +-#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 +-#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 +-#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 +-#define PCI_INTA_INTERRUPT_ENABLE 24 +-#define PCI_PME_INTERRUPT_ENABLE 23 +-#define PCI_SERR_INTERRUPT_ENABLE 22 +-#define PCI_PERR_INTERRUPT_ENABLE 21 +-#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 +-#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 +-#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 +-#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 +-#define GPIO_INTERRUPT_ENABLE 13 +-#define DMA_D_INTERRUPT_ENABLE 12 +-#define DMA_C_INTERRUPT_ENABLE 11 +-#define DMA_B_INTERRUPT_ENABLE 10 +-#define DMA_A_INTERRUPT_ENABLE 9 +-#define EEPROM_DONE_INTERRUPT_ENABLE 8 +-#define VBUS_INTERRUPT_ENABLE 7 +-#define CONTROL_STATUS_INTERRUPT_ENABLE 6 +-#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 +-#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 +-#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 +-#define RESUME_INTERRUPT_ENABLE 1 +-#define SOF_INTERRUPT_ENABLE 0 +- u32 irqstat0; +-#define INTA_ASSERTED 12 +-#define SETUP_PACKET_INTERRUPT 7 +-#define ENDPOINT_F_INTERRUPT 6 +-#define ENDPOINT_E_INTERRUPT 5 +-#define ENDPOINT_D_INTERRUPT 4 +-#define ENDPOINT_C_INTERRUPT 3 +-#define ENDPOINT_B_INTERRUPT 2 +-#define ENDPOINT_A_INTERRUPT 1 +-#define ENDPOINT_0_INTERRUPT 0 +- u32 irqstat1; +-#define POWER_STATE_CHANGE_INTERRUPT 27 +-#define PCI_ARBITER_TIMEOUT_INTERRUPT 26 +-#define PCI_PARITY_ERROR_INTERRUPT 25 +-#define PCI_INTA_INTERRUPT 24 +-#define PCI_PME_INTERRUPT 23 +-#define PCI_SERR_INTERRUPT 22 +-#define PCI_PERR_INTERRUPT 21 +-#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT 20 +-#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT 19 +-#define PCI_RETRY_ABORT_INTERRUPT 17 +-#define PCI_MASTER_CYCLE_DONE_INTERRUPT 16 +-#define SOF_DOWN_INTERRUPT 14 +-#define GPIO_INTERRUPT 13 +-#define DMA_D_INTERRUPT 12 +-#define DMA_C_INTERRUPT 11 +-#define DMA_B_INTERRUPT 10 +-#define DMA_A_INTERRUPT 9 +-#define EEPROM_DONE_INTERRUPT 8 +-#define VBUS_INTERRUPT 7 +-#define CONTROL_STATUS_INTERRUPT 6 +-#define ROOT_PORT_RESET_INTERRUPT 4 +-#define SUSPEND_REQUEST_INTERRUPT 3 +-#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2 +-#define RESUME_INTERRUPT 1 +-#define SOF_INTERRUPT 0 +- // offset 0x0030 +- u32 idxaddr; +- u32 idxdata; +- u32 fifoctl; +-#define PCI_BASE2_RANGE 16 +-#define IGNORE_FIFO_AVAILABILITY 3 +-#define PCI_BASE2_SELECT 2 +-#define FIFO_CONFIGURATION_SELECT 0 +- u32 _unused2; +- // offset 0x0040 +- u32 memaddr; +-#define START 28 +-#define DIRECTION 27 +-#define FIFO_DIAGNOSTIC_SELECT 24 +-#define MEMORY_ADDRESS 0 +- u32 memdata0; +- u32 memdata1; +- u32 _unused3; +- // offset 0x0050 +- u32 gpioctl; +-#define GPIO3_LED_SELECT 12 +-#define GPIO3_INTERRUPT_ENABLE 11 +-#define GPIO2_INTERRUPT_ENABLE 10 +-#define GPIO1_INTERRUPT_ENABLE 9 +-#define GPIO0_INTERRUPT_ENABLE 8 +-#define GPIO3_OUTPUT_ENABLE 7 +-#define GPIO2_OUTPUT_ENABLE 6 +-#define GPIO1_OUTPUT_ENABLE 5 +-#define GPIO0_OUTPUT_ENABLE 4 +-#define GPIO3_DATA 3 +-#define GPIO2_DATA 2 +-#define GPIO1_DATA 1 +-#define GPIO0_DATA 0 +- u32 gpiostat; +-#define GPIO3_INTERRUPT 3 +-#define GPIO2_INTERRUPT 2 +-#define GPIO1_INTERRUPT 1 +-#define GPIO0_INTERRUPT 0 +-} __attribute__ ((packed)); +- +-/* usb control, BAR0 + 0x0080 */ +-struct net2280_usb_regs { +- // offset 0x0080 +- u32 stdrsp; +-#define STALL_UNSUPPORTED_REQUESTS 31 +-#define SET_TEST_MODE 16 +-#define GET_OTHER_SPEED_CONFIGURATION 15 +-#define GET_DEVICE_QUALIFIER 14 +-#define SET_ADDRESS 13 +-#define ENDPOINT_SET_CLEAR_HALT 12 +-#define DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP 11 +-#define GET_STRING_DESCRIPTOR_2 10 +-#define GET_STRING_DESCRIPTOR_1 9 +-#define GET_STRING_DESCRIPTOR_0 8 +-#define GET_SET_INTERFACE 6 +-#define GET_SET_CONFIGURATION 5 +-#define GET_CONFIGURATION_DESCRIPTOR 4 +-#define GET_DEVICE_DESCRIPTOR 3 +-#define GET_ENDPOINT_STATUS 2 +-#define GET_INTERFACE_STATUS 1 +-#define GET_DEVICE_STATUS 0 +- u32 prodvendid; +-#define PRODUCT_ID 16 +-#define VENDOR_ID 0 +- u32 relnum; +- u32 usbctl; +-#define SERIAL_NUMBER_INDEX 16 +-#define PRODUCT_ID_STRING_ENABLE 13 +-#define VENDOR_ID_STRING_ENABLE 12 +-#define USB_ROOT_PORT_WAKEUP_ENABLE 11 +-#define VBUS_PIN 10 +-#define TIMED_DISCONNECT 9 +-#define SUSPEND_IMMEDIATELY 7 +-#define SELF_POWERED_USB_DEVICE 6 +-#define REMOTE_WAKEUP_SUPPORT 5 +-#define PME_POLARITY 4 +-#define USB_DETECT_ENABLE 3 +-#define PME_WAKEUP_ENABLE 2 +-#define DEVICE_REMOTE_WAKEUP_ENABLE 1 +-#define SELF_POWERED_STATUS 0 +- // offset 0x0090 +- u32 usbstat; +-#define HIGH_SPEED 7 +-#define FULL_SPEED 6 +-#define GENERATE_RESUME 5 +-#define GENERATE_DEVICE_REMOTE_WAKEUP 4 +- u32 xcvrdiag; +-#define FORCE_HIGH_SPEED_MODE 31 +-#define FORCE_FULL_SPEED_MODE 30 +-#define USB_TEST_MODE 24 +-#define LINE_STATE 16 +-#define TRANSCEIVER_OPERATION_MODE 2 +-#define TRANSCEIVER_SELECT 1 +-#define TERMINATION_SELECT 0 +- u32 setup0123; +- u32 setup4567; +- // offset 0x0090 +- u32 _unused0; +- u32 ouraddr; +-#define FORCE_IMMEDIATE 7 +-#define OUR_USB_ADDRESS 0 +- u32 ourconfig; +-} __attribute__ ((packed)); +- +-/* pci control, BAR0 + 0x0100 */ +-struct net2280_pci_regs { +- // offset 0x0100 +- u32 pcimstctl; +-#define PCI_ARBITER_PARK_SELECT 13 +-#define PCI_MULTI LEVEL_ARBITER 12 +-#define PCI_RETRY_ABORT_ENABLE 11 +-#define DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE 10 +-#define DMA_READ_MULTIPLE_ENABLE 9 +-#define DMA_READ_LINE_ENABLE 8 +-#define PCI_MASTER_COMMAND_SELECT 6 +-#define MEM_READ_OR_WRITE 0 +-#define IO_READ_OR_WRITE 1 +-#define CFG_READ_OR_WRITE 2 +-#define PCI_MASTER_START 5 +-#define PCI_MASTER_READ_WRITE 4 +-#define PCI_MASTER_WRITE 0 +-#define PCI_MASTER_READ 1 +-#define PCI_MASTER_BYTE_WRITE_ENABLES 0 +- u32 pcimstaddr; +- u32 pcimstdata; +- u32 pcimststat; +-#define PCI_ARBITER_CLEAR 2 +-#define PCI_EXTERNAL_ARBITER 1 +-#define PCI_HOST_MODE 0 +-} __attribute__ ((packed)); +- +-/* dma control, BAR0 + 0x0180 ... array of four structs like this, +- * for channels 0..3. see also struct net2280_dma: descriptor +- * that can be loaded into some of these registers. +- */ +-struct net2280_dma_regs { /* [11.7] */ +- // offset 0x0180, 0x01a0, 0x01c0, 0x01e0, +- u32 dmactl; +-#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25 +-#define DMA_CLEAR_COUNT_ENABLE 21 +-#define DESCRIPTOR_POLLING_RATE 19 +-#define POLL_CONTINUOUS 0 +-#define POLL_1_USEC 1 +-#define POLL_100_USEC 2 +-#define POLL_1_MSEC 3 +-#define DMA_VALID_BIT_POLLING_ENABLE 18 +-#define DMA_VALID_BIT_ENABLE 17 +-#define DMA_SCATTER_GATHER_ENABLE 16 +-#define DMA_OUT_AUTO_START_ENABLE 4 +-#define DMA_PREEMPT_ENABLE 3 +-#define DMA_FIFO_VALIDATE 2 +-#define DMA_ENABLE 1 +-#define DMA_ADDRESS_HOLD 0 +- u32 dmastat; +-#define DMA_ABORT_DONE_INTERRUPT 27 +-#define DMA_SCATTER_GATHER_DONE_INTERRUPT 25 +-#define DMA_TRANSACTION_DONE_INTERRUPT 24 +-#define DMA_ABORT 1 +-#define DMA_START 0 +- u32 _unused0 [2]; +- // offset 0x0190, 0x01b0, 0x01d0, 0x01f0, +- u32 dmacount; +-#define VALID_BIT 31 +-#define DMA_DIRECTION 30 +-#define DMA_DONE_INTERRUPT_ENABLE 29 +-#define END_OF_CHAIN 28 +-#define DMA_BYTE_COUNT_MASK ((1<<24)-1) +-#define DMA_BYTE_COUNT 0 +- u32 dmaaddr; +- u32 dmadesc; +- u32 _unused1; +-} __attribute__ ((packed)); +- +-/* dedicated endpoint registers, BAR0 + 0x0200 */ +- +-struct net2280_dep_regs { /* [11.8] */ +- // offset 0x0200, 0x0210, 0x220, 0x230, 0x240 +- u32 dep_cfg; +- // offset 0x0204, 0x0214, 0x224, 0x234, 0x244 +- u32 dep_rsp; +- u32 _unused [2]; +-} __attribute__ ((packed)); +- +-/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs +- * like this, for ep0 then the configurable endpoints A..F +- * ep0 reserved for control; E and F have only 64 bytes of fifo +- */ +-struct net2280_ep_regs { /* [11.9] */ +- // offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 +- u32 ep_cfg; +-#define ENDPOINT_BYTE_COUNT 16 +-#define ENDPOINT_ENABLE 10 +-#define ENDPOINT_TYPE 8 +-#define ENDPOINT_DIRECTION 7 +-#define ENDPOINT_NUMBER 0 +- u32 ep_rsp; +-#define SET_NAK_OUT_PACKETS 15 +-#define SET_EP_HIDE_STATUS_PHASE 14 +-#define SET_EP_FORCE_CRC_ERROR 13 +-#define SET_INTERRUPT_MODE 12 +-#define SET_CONTROL_STATUS_PHASE_HANDSHAKE 11 +-#define SET_NAK_OUT_PACKETS_MODE 10 +-#define SET_ENDPOINT_TOGGLE 9 +-#define SET_ENDPOINT_HALT 8 +-#define CLEAR_NAK_OUT_PACKETS 7 +-#define CLEAR_EP_HIDE_STATUS_PHASE 6 +-#define CLEAR_EP_FORCE_CRC_ERROR 5 +-#define CLEAR_INTERRUPT_MODE 4 +-#define CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE 3 +-#define CLEAR_NAK_OUT_PACKETS_MODE 2 +-#define CLEAR_ENDPOINT_TOGGLE 1 +-#define CLEAR_ENDPOINT_HALT 0 +- u32 ep_irqenb; +-#define SHORT_PACKET_OUT_DONE_INTERRUPT_ENABLE 6 +-#define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE 5 +-#define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE 3 +-#define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE 2 +-#define DATA_OUT_PING_TOKEN_INTERRUPT_ENABLE 1 +-#define DATA_IN_TOKEN_INTERRUPT_ENABLE 0 +- u32 ep_stat; +-#define FIFO_VALID_COUNT 24 +-#define HIGH_BANDWIDTH_OUT_TRANSACTION_PID 22 +-#define TIMEOUT 21 +-#define USB_STALL_SENT 20 +-#define USB_IN_NAK_SENT 19 +-#define USB_IN_ACK_RCVD 18 +-#define USB_OUT_PING_NAK_SENT 17 +-#define USB_OUT_ACK_SENT 16 +-#define FIFO_OVERFLOW 13 +-#define FIFO_UNDERFLOW 12 +-#define FIFO_FULL 11 +-#define FIFO_EMPTY 10 +-#define FIFO_FLUSH 9 +-#define SHORT_PACKET_OUT_DONE_INTERRUPT 6 +-#define SHORT_PACKET_TRANSFERRED_INTERRUPT 5 +-#define NAK_OUT_PACKETS 4 +-#define DATA_PACKET_RECEIVED_INTERRUPT 3 +-#define DATA_PACKET_TRANSMITTED_INTERRUPT 2 +-#define DATA_OUT_PING_TOKEN_INTERRUPT 1 +-#define DATA_IN_TOKEN_INTERRUPT 0 +- // offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 +- u32 ep_avail; +- u32 ep_data; +- u32 _unused0 [2]; +-} __attribute__ ((packed)); ++#include <linux/usb/net2280.h> + + /*-------------------------------------------------------------------------*/ + +--- /dev/null ++++ gregkh-2.6/include/linux/usb/net2280.h +@@ -0,0 +1,444 @@ ++/* ++ * NetChip 2280 high/full speed USB device controller. ++ * Unlike many such controllers, this one talks PCI. ++ */ ++#ifndef __LINUX_USB_NET2280_H ++#define __LINUX_USB_NET2280_H ++ ++/* ++ * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com) ++ * Copyright (C) 2003 David Brownell ++ * ++ * 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 ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++/*-------------------------------------------------------------------------*/ ++ ++/* NET2280 MEMORY MAPPED REGISTERS ++ * ++ * The register layout came from the chip documentation, and the bit ++ * number definitions were extracted from chip specification. ++ * ++ * Use the shift operator ('<<') to build bit masks, with readl/writel ++ * to access the registers through PCI. ++ */ ++ ++/* main registers, BAR0 + 0x0000 */ ++struct net2280_regs { ++ // offset 0x0000 ++ u32 devinit; ++#define LOCAL_CLOCK_FREQUENCY 8 ++#define FORCE_PCI_RESET 7 ++#define PCI_ID 6 ++#define PCI_ENABLE 5 ++#define FIFO_SOFT_RESET 4 ++#define CFG_SOFT_RESET 3 ++#define PCI_SOFT_RESET 2 ++#define USB_SOFT_RESET 1 ++#define M8051_RESET 0 ++ u32 eectl; ++#define EEPROM_ADDRESS_WIDTH 23 ++#define EEPROM_CHIP_SELECT_ACTIVE 22 ++#define EEPROM_PRESENT 21 ++#define EEPROM_VALID 20 ++#define EEPROM_BUSY 19 ++#define EEPROM_CHIP_SELECT_ENABLE 18 ++#define EEPROM_BYTE_READ_START 17 ++#define EEPROM_BYTE_WRITE_START 16 ++#define EEPROM_READ_DATA 8 ++#define EEPROM_WRITE_DATA 0 ++ u32 eeclkfreq; ++ u32 _unused0; ++ // offset 0x0010 ++ ++ u32 pciirqenb0; /* interrupt PCI master ... */ ++#define SETUP_PACKET_INTERRUPT_ENABLE 7 ++#define ENDPOINT_F_INTERRUPT_ENABLE 6 ++#define ENDPOINT_E_INTERRUPT_ENABLE 5 ++#define ENDPOINT_D_INTERRUPT_ENABLE 4 ++#define ENDPOINT_C_INTERRUPT_ENABLE 3 ++#define ENDPOINT_B_INTERRUPT_ENABLE 2 ++#define ENDPOINT_A_INTERRUPT_ENABLE 1 ++#define ENDPOINT_0_INTERRUPT_ENABLE 0 ++ u32 pciirqenb1; ++#define PCI_INTERRUPT_ENABLE 31 ++#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 ++#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 ++#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 ++#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 ++#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 ++#define PCI_TARGET_ABORT_ASSERTED_INTERRUPT_ENABLE 18 ++#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 ++#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 ++#define GPIO_INTERRUPT_ENABLE 13 ++#define DMA_D_INTERRUPT_ENABLE 12 ++#define DMA_C_INTERRUPT_ENABLE 11 ++#define DMA_B_INTERRUPT_ENABLE 10 ++#define DMA_A_INTERRUPT_ENABLE 9 ++#define EEPROM_DONE_INTERRUPT_ENABLE 8 ++#define VBUS_INTERRUPT_ENABLE 7 ++#define CONTROL_STATUS_INTERRUPT_ENABLE 6 ++#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 ++#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 ++#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 ++#define RESUME_INTERRUPT_ENABLE 1 ++#define SOF_INTERRUPT_ENABLE 0 ++ u32 cpu_irqenb0; /* ... or onboard 8051 */ ++#define SETUP_PACKET_INTERRUPT_ENABLE 7 ++#define ENDPOINT_F_INTERRUPT_ENABLE 6 ++#define ENDPOINT_E_INTERRUPT_ENABLE 5 ++#define ENDPOINT_D_INTERRUPT_ENABLE 4 ++#define ENDPOINT_C_INTERRUPT_ENABLE 3 ++#define ENDPOINT_B_INTERRUPT_ENABLE 2 ++#define ENDPOINT_A_INTERRUPT_ENABLE 1 ++#define ENDPOINT_0_INTERRUPT_ENABLE 0 ++ u32 cpu_irqenb1; ++#define CPU_INTERRUPT_ENABLE 31 ++#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 ++#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 ++#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 ++#define PCI_INTA_INTERRUPT_ENABLE 24 ++#define PCI_PME_INTERRUPT_ENABLE 23 ++#define PCI_SERR_INTERRUPT_ENABLE 22 ++#define PCI_PERR_INTERRUPT_ENABLE 21 ++#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 ++#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 ++#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 ++#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 ++#define GPIO_INTERRUPT_ENABLE 13 ++#define DMA_D_INTERRUPT_ENABLE 12 ++#define DMA_C_INTERRUPT_ENABLE 11 ++#define DMA_B_INTERRUPT_ENABLE 10 ++#define DMA_A_INTERRUPT_ENABLE 9 ++#define EEPROM_DONE_INTERRUPT_ENABLE 8 ++#define VBUS_INTERRUPT_ENABLE 7 ++#define CONTROL_STATUS_INTERRUPT_ENABLE 6 ++#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 ++#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 ++#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 ++#define RESUME_INTERRUPT_ENABLE 1 ++#define SOF_INTERRUPT_ENABLE 0 ++ ++ // offset 0x0020 ++ u32 _unused1; ++ u32 usbirqenb1; ++#define USB_INTERRUPT_ENABLE 31 ++#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 ++#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 ++#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 ++#define PCI_INTA_INTERRUPT_ENABLE 24 ++#define PCI_PME_INTERRUPT_ENABLE 23 ++#define PCI_SERR_INTERRUPT_ENABLE 22 ++#define PCI_PERR_INTERRUPT_ENABLE 21 ++#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 ++#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 ++#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 ++#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 ++#define GPIO_INTERRUPT_ENABLE 13 ++#define DMA_D_INTERRUPT_ENABLE 12 ++#define DMA_C_INTERRUPT_ENABLE 11 ++#define DMA_B_INTERRUPT_ENABLE 10 ++#define DMA_A_INTERRUPT_ENABLE 9 ++#define EEPROM_DONE_INTERRUPT_ENABLE 8 ++#define VBUS_INTERRUPT_ENABLE 7 ++#define CONTROL_STATUS_INTERRUPT_ENABLE 6 ++#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 ++#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 ++#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 ++#define RESUME_INTERRUPT_ENABLE 1 ++#define SOF_INTERRUPT_ENABLE 0 ++ u32 irqstat0; ++#define INTA_ASSERTED 12 ++#define SETUP_PACKET_INTERRUPT 7 ++#define ENDPOINT_F_INTERRUPT 6 ++#define ENDPOINT_E_INTERRUPT 5 ++#define ENDPOINT_D_INTERRUPT 4 ++#define ENDPOINT_C_INTERRUPT 3 ++#define ENDPOINT_B_INTERRUPT 2 ++#define ENDPOINT_A_INTERRUPT 1 ++#define ENDPOINT_0_INTERRUPT 0 ++ u32 irqstat1; ++#define POWER_STATE_CHANGE_INTERRUPT 27 ++#define PCI_ARBITER_TIMEOUT_INTERRUPT 26 ++#define PCI_PARITY_ERROR_INTERRUPT 25 ++#define PCI_INTA_INTERRUPT 24 ++#define PCI_PME_INTERRUPT 23 ++#define PCI_SERR_INTERRUPT 22 ++#define PCI_PERR_INTERRUPT 21 ++#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT 20 ++#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT 19 ++#define PCI_RETRY_ABORT_INTERRUPT 17 ++#define PCI_MASTER_CYCLE_DONE_INTERRUPT 16 ++#define SOF_DOWN_INTERRUPT 14 ++#define GPIO_INTERRUPT 13 ++#define DMA_D_INTERRUPT 12 ++#define DMA_C_INTERRUPT 11 ++#define DMA_B_INTERRUPT 10 ++#define DMA_A_INTERRUPT 9 ++#define EEPROM_DONE_INTERRUPT 8 ++#define VBUS_INTERRUPT 7 ++#define CONTROL_STATUS_INTERRUPT 6 ++#define ROOT_PORT_RESET_INTERRUPT 4 ++#define SUSPEND_REQUEST_INTERRUPT 3 ++#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2 ++#define RESUME_INTERRUPT 1 ++#define SOF_INTERRUPT 0 ++ // offset 0x0030 ++ u32 idxaddr; ++ u32 idxdata; ++ u32 fifoctl; ++#define PCI_BASE2_RANGE 16 ++#define IGNORE_FIFO_AVAILABILITY 3 ++#define PCI_BASE2_SELECT 2 ++#define FIFO_CONFIGURATION_SELECT 0 ++ u32 _unused2; ++ // offset 0x0040 ++ u32 memaddr; ++#define START 28 ++#define DIRECTION 27 ++#define FIFO_DIAGNOSTIC_SELECT 24 ++#define MEMORY_ADDRESS 0 ++ u32 memdata0; ++ u32 memdata1; ++ u32 _unused3; ++ // offset 0x0050 ++ u32 gpioctl; ++#define GPIO3_LED_SELECT 12 ++#define GPIO3_INTERRUPT_ENABLE 11 ++#define GPIO2_INTERRUPT_ENABLE 10 ++#define GPIO1_INTERRUPT_ENABLE 9 ++#define GPIO0_INTERRUPT_ENABLE 8 ++#define GPIO3_OUTPUT_ENABLE 7 ++#define GPIO2_OUTPUT_ENABLE 6 ++#define GPIO1_OUTPUT_ENABLE 5 ++#define GPIO0_OUTPUT_ENABLE 4 ++#define GPIO3_DATA 3 ++#define GPIO2_DATA 2 ++#define GPIO1_DATA 1 ++#define GPIO0_DATA 0 ++ u32 gpiostat; ++#define GPIO3_INTERRUPT 3 ++#define GPIO2_INTERRUPT 2 ++#define GPIO1_INTERRUPT 1 ++#define GPIO0_INTERRUPT 0 ++} __attribute__ ((packed)); ++ ++/* usb control, BAR0 + 0x0080 */ ++struct net2280_usb_regs { ++ // offset 0x0080 ++ u32 stdrsp; ++#define STALL_UNSUPPORTED_REQUESTS 31 ++#define SET_TEST_MODE 16 ++#define GET_OTHER_SPEED_CONFIGURATION 15 ++#define GET_DEVICE_QUALIFIER 14 ++#define SET_ADDRESS 13 ++#define ENDPOINT_SET_CLEAR_HALT 12 ++#define DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP 11 ++#define GET_STRING_DESCRIPTOR_2 10 ++#define GET_STRING_DESCRIPTOR_1 9 ++#define GET_STRING_DESCRIPTOR_0 8 ++#define GET_SET_INTERFACE 6 ++#define GET_SET_CONFIGURATION 5 ++#define GET_CONFIGURATION_DESCRIPTOR 4 ++#define GET_DEVICE_DESCRIPTOR 3 ++#define GET_ENDPOINT_STATUS 2 ++#define GET_INTERFACE_STATUS 1 ++#define GET_DEVICE_STATUS 0 ++ u32 prodvendid; ++#define PRODUCT_ID 16 ++#define VENDOR_ID 0 ++ u32 relnum; ++ u32 usbctl; ++#define SERIAL_NUMBER_INDEX 16 ++#define PRODUCT_ID_STRING_ENABLE 13 ++#define VENDOR_ID_STRING_ENABLE 12 ++#define USB_ROOT_PORT_WAKEUP_ENABLE 11 ++#define VBUS_PIN 10 ++#define TIMED_DISCONNECT 9 ++#define SUSPEND_IMMEDIATELY 7 ++#define SELF_POWERED_USB_DEVICE 6 ++#define REMOTE_WAKEUP_SUPPORT 5 ++#define PME_POLARITY 4 ++#define USB_DETECT_ENABLE 3 ++#define PME_WAKEUP_ENABLE 2 ++#define DEVICE_REMOTE_WAKEUP_ENABLE 1 ++#define SELF_POWERED_STATUS 0 ++ // offset 0x0090 ++ u32 usbstat; ++#define HIGH_SPEED 7 ++#define FULL_SPEED 6 ++#define GENERATE_RESUME 5 ++#define GENERATE_DEVICE_REMOTE_WAKEUP 4 ++ u32 xcvrdiag; ++#define FORCE_HIGH_SPEED_MODE 31 ++#define FORCE_FULL_SPEED_MODE 30 ++#define USB_TEST_MODE 24 ++#define LINE_STATE 16 ++#define TRANSCEIVER_OPERATION_MODE 2 ++#define TRANSCEIVER_SELECT 1 ++#define TERMINATION_SELECT 0 ++ u32 setup0123; ++ u32 setup4567; ++ // offset 0x0090 ++ u32 _unused0; ++ u32 ouraddr; ++#define FORCE_IMMEDIATE 7 ++#define OUR_USB_ADDRESS 0 ++ u32 ourconfig; ++} __attribute__ ((packed)); ++ ++/* pci control, BAR0 + 0x0100 */ ++struct net2280_pci_regs { ++ // offset 0x0100 ++ u32 pcimstctl; ++#define PCI_ARBITER_PARK_SELECT 13 ++#define PCI_MULTI LEVEL_ARBITER 12 ++#define PCI_RETRY_ABORT_ENABLE 11 ++#define DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE 10 ++#define DMA_READ_MULTIPLE_ENABLE 9 ++#define DMA_READ_LINE_ENABLE 8 ++#define PCI_MASTER_COMMAND_SELECT 6 ++#define MEM_READ_OR_WRITE 0 ++#define IO_READ_OR_WRITE 1 ++#define CFG_READ_OR_WRITE 2 ++#define PCI_MASTER_START 5 ++#define PCI_MASTER_READ_WRITE 4 ++#define PCI_MASTER_WRITE 0 ++#define PCI_MASTER_READ 1 ++#define PCI_MASTER_BYTE_WRITE_ENABLES 0 ++ u32 pcimstaddr; ++ u32 pcimstdata; ++ u32 pcimststat; ++#define PCI_ARBITER_CLEAR 2 ++#define PCI_EXTERNAL_ARBITER 1 ++#define PCI_HOST_MODE 0 ++} __attribute__ ((packed)); ++ ++/* dma control, BAR0 + 0x0180 ... array of four structs like this, ++ * for channels 0..3. see also struct net2280_dma: descriptor ++ * that can be loaded into some of these registers. ++ */ ++struct net2280_dma_regs { /* [11.7] */ ++ // offset 0x0180, 0x01a0, 0x01c0, 0x01e0, ++ u32 dmactl; ++#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25 ++#define DMA_CLEAR_COUNT_ENABLE 21 ++#define DESCRIPTOR_POLLING_RATE 19 ++#define POLL_CONTINUOUS 0 ++#define POLL_1_USEC 1 ++#define POLL_100_USEC 2 ++#define POLL_1_MSEC 3 ++#define DMA_VALID_BIT_POLLING_ENABLE 18 ++#define DMA_VALID_BIT_ENABLE 17 ++#define DMA_SCATTER_GATHER_ENABLE 16 ++#define DMA_OUT_AUTO_START_ENABLE 4 ++#define DMA_PREEMPT_ENABLE 3 ++#define DMA_FIFO_VALIDATE 2 ++#define DMA_ENABLE 1 ++#define DMA_ADDRESS_HOLD 0 ++ u32 dmastat; ++#define DMA_ABORT_DONE_INTERRUPT 27 ++#define DMA_SCATTER_GATHER_DONE_INTERRUPT 25 ++#define DMA_TRANSACTION_DONE_INTERRUPT 24 ++#define DMA_ABORT 1 ++#define DMA_START 0 ++ u32 _unused0 [2]; ++ // offset 0x0190, 0x01b0, 0x01d0, 0x01f0, ++ u32 dmacount; ++#define VALID_BIT 31 ++#define DMA_DIRECTION 30 ++#define DMA_DONE_INTERRUPT_ENABLE 29 ++#define END_OF_CHAIN 28 ++#define DMA_BYTE_COUNT_MASK ((1<<24)-1) ++#define DMA_BYTE_COUNT 0 ++ u32 dmaaddr; ++ u32 dmadesc; ++ u32 _unused1; ++} __attribute__ ((packed)); ++ ++/* dedicated endpoint registers, BAR0 + 0x0200 */ ++ ++struct net2280_dep_regs { /* [11.8] */ ++ // offset 0x0200, 0x0210, 0x220, 0x230, 0x240 ++ u32 dep_cfg; ++ // offset 0x0204, 0x0214, 0x224, 0x234, 0x244 ++ u32 dep_rsp; ++ u32 _unused [2]; ++} __attribute__ ((packed)); ++ ++/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs ++ * like this, for ep0 then the configurable endpoints A..F ++ * ep0 reserved for control; E and F have only 64 bytes of fifo ++ */ ++struct net2280_ep_regs { /* [11.9] */ ++ // offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 ++ u32 ep_cfg; ++#define ENDPOINT_BYTE_COUNT 16 ++#define ENDPOINT_ENABLE 10 ++#define ENDPOINT_TYPE 8 ++#define ENDPOINT_DIRECTION 7 ++#define ENDPOINT_NUMBER 0 ++ u32 ep_rsp; ++#define SET_NAK_OUT_PACKETS 15 ++#define SET_EP_HIDE_STATUS_PHASE 14 ++#define SET_EP_FORCE_CRC_ERROR 13 ++#define SET_INTERRUPT_MODE 12 ++#define SET_CONTROL_STATUS_PHASE_HANDSHAKE 11 ++#define SET_NAK_OUT_PACKETS_MODE 10 ++#define SET_ENDPOINT_TOGGLE 9 ++#define SET_ENDPOINT_HALT 8 ++#define CLEAR_NAK_OUT_PACKETS 7 ++#define CLEAR_EP_HIDE_STATUS_PHASE 6 ++#define CLEAR_EP_FORCE_CRC_ERROR 5 ++#define CLEAR_INTERRUPT_MODE 4 ++#define CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE 3 ++#define CLEAR_NAK_OUT_PACKETS_MODE 2 ++#define CLEAR_ENDPOINT_TOGGLE 1 ++#define CLEAR_ENDPOINT_HALT 0 ++ u32 ep_irqenb; ++#define SHORT_PACKET_OUT_DONE_INTERRUPT_ENABLE 6 ++#define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE 5 ++#define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE 3 ++#define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE 2 ++#define DATA_OUT_PING_TOKEN_INTERRUPT_ENABLE 1 ++#define DATA_IN_TOKEN_INTERRUPT_ENABLE 0 ++ u32 ep_stat; ++#define FIFO_VALID_COUNT 24 ++#define HIGH_BANDWIDTH_OUT_TRANSACTION_PID 22 ++#define TIMEOUT 21 ++#define USB_STALL_SENT 20 ++#define USB_IN_NAK_SENT 19 ++#define USB_IN_ACK_RCVD 18 ++#define USB_OUT_PING_NAK_SENT 17 ++#define USB_OUT_ACK_SENT 16 ++#define FIFO_OVERFLOW 13 ++#define FIFO_UNDERFLOW 12 ++#define FIFO_FULL 11 ++#define FIFO_EMPTY 10 ++#define FIFO_FLUSH 9 ++#define SHORT_PACKET_OUT_DONE_INTERRUPT 6 ++#define SHORT_PACKET_TRANSFERRED_INTERRUPT 5 ++#define NAK_OUT_PACKETS 4 ++#define DATA_PACKET_RECEIVED_INTERRUPT 3 ++#define DATA_PACKET_TRANSMITTED_INTERRUPT 2 ++#define DATA_OUT_PING_TOKEN_INTERRUPT 1 ++#define DATA_IN_TOKEN_INTERRUPT 0 ++ // offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 ++ u32 ep_avail; ++ u32 ep_data; ++ u32 _unused0 [2]; ++} __attribute__ ((packed)); ++ ++#endif /* __LINUX_USB_NET2280_H */ diff --git a/usb/usb-net2280-short-rx-status-fix.patch b/usb/usb-net2280-short-rx-status-fix.patch new file mode 100644 index 0000000000000..0f5eca685e435 --- /dev/null +++ b/usb/usb-net2280-short-rx-status-fix.patch @@ -0,0 +1,30 @@ +From david-b@pacbell.net Sun Apr 2 11:38:18 2006 +From: David Brownell <david-b@pacbell.net> +To: linux-usb-devel@lists.sourceforge.net +Subject: USB: net2280 short rx status fix +Date: Sun, 2 Apr 2006 10:18:53 -0800 +Cc: Greg KH <greg@kroah.com> +Message-Id: <200604021118.53528.david-b@pacbell.net> + +Some patch broke short-OUT packet handling for net2280, making it report +illegal status values. This updates the status code so it's correct. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/net2280.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- gregkh-2.6.orig/drivers/usb/gadget/net2280.c ++++ gregkh-2.6/drivers/usb/gadget/net2280.c +@@ -2241,7 +2241,8 @@ static void handle_ep_small (struct net2 + if (likely (req)) { + req->td->dmacount = 0; + t = readl (&ep->regs->ep_avail); +- dma_done (ep, req, count, t); ++ dma_done (ep, req, count, ++ (ep->out_overflow || t) ? -EOVERFLOW : 0); + } + + /* also flush to prevent erratum 0106 trouble */ diff --git a/usb/usb-otg-hub-support-is-optional.patch b/usb/usb-otg-hub-support-is-optional.patch new file mode 100644 index 0000000000000..93b22568e62d2 --- /dev/null +++ b/usb/usb-otg-hub-support-is-optional.patch @@ -0,0 +1,49 @@ +From david-b@pacbell.net Sun Apr 2 11:38:12 2006 +From: David Brownell <david-b@pacbell.net> +To: linux-usb-devel@lists.sourceforge.net +Subject: USB: otg hub support is optional +Date: Sun, 2 Apr 2006 10:18:09 -0800 +Cc: Greg KH <greg@kroah.com> +Message-Id: <200604021118.09660.david-b@pacbell.net> + +USB OTG devices are not required to support external hubs. This adds a +configuration option to disable that support. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/core/Kconfig | 7 +++++++ + drivers/usb/core/hub.c | 7 +++++++ + 2 files changed, 14 insertions(+) + +--- gregkh-2.6.orig/drivers/usb/core/Kconfig ++++ gregkh-2.6/drivers/usb/core/Kconfig +@@ -99,4 +99,11 @@ config USB_OTG_WHITELIST + normal Linux-USB hosts do (other than the warning), and is + convenient for many stages of product development. + ++config USB_OTG_BLACKLIST_HUB ++ bool "Disable external hubs" ++ depends on USB_OTG ++ help ++ If you say Y here, then Linux will refuse to enumerate ++ external hubs. OTG hosts are allowed to reduce hardware ++ and software costs by not supporting external hubs. + +--- gregkh-2.6.orig/drivers/usb/core/hub.c ++++ gregkh-2.6/drivers/usb/core/hub.c +@@ -836,6 +836,13 @@ static int hub_probe(struct usb_interfac + desc = intf->cur_altsetting; + hdev = interface_to_usbdev(intf); + ++#ifdef CONFIG_USB_OTG_BLACKLIST_HUB ++ if (hdev->parent) { ++ dev_warn(&intf->dev, "ignoring external hub\n"); ++ return -ENODEV; ++ } ++#endif ++ + /* Some hubs have a subclass of 1, which AFAICT according to the */ + /* specs is not defined, but it works */ + if ((desc->desc.bInterfaceSubClass != 0) && diff --git a/usb/usb-rename-ax8817x_func-to-asix_func-and-add-utility-functions-to-reduce-bloat.patch b/usb/usb-rename-ax8817x_func-to-asix_func-and-add-utility-functions-to-reduce-bloat.patch new file mode 100644 index 0000000000000..e783654b759d9 --- /dev/null +++ b/usb/usb-rename-ax8817x_func-to-asix_func-and-add-utility-functions-to-reduce-bloat.patch @@ -0,0 +1,713 @@ +From dhollis@davehollis.com Tue Mar 28 18:38:15 2006 +Date: Tue, 28 Mar 2006 20:15:42 -0500 +From: David Hollis <dhollis@davehollis.com> +Subject: USB: Rename ax8817x_func() to asix_func() and add utility functions to reduce bloat +To: Greg KH <greg@kroah.com> +Message-id: <1143594942.14921.1.camel@dhollis-lnx.sunera.com> + +Now that the ASIX code is supporting more than just the AX88172 devices, +make the utility function names more generic: ax8817x_func -> asix_func. +Functions that are chip specific now indicate as such: ax88772_func. + +Additionally, pull some common routines used in initialization and such +into simple functions to reduce the verbosity of certain functions such +as +the bind() routines and to make the error handling consistent across the +board. + +Signed-off-by: David Hollis <dhollis@davehollis.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/net/asix.c | 327 ++++++++++++++++++++++++------------------------- + 1 file changed, 163 insertions(+), 164 deletions(-) + +--- gregkh-2.6.orig/drivers/usb/net/asix.c ++++ gregkh-2.6/drivers/usb/net/asix.c +@@ -37,7 +37,6 @@ + + #include "usbnet.h" + +- + /* ASIX AX8817X based USB 2.0 Ethernet Devices */ + + #define AX_CMD_SET_SW_MII 0x06 +@@ -109,7 +108,7 @@ + #define AX_EEPROM_MAGIC 0xdeadbeef + + /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ +-struct ax8817x_data { ++struct asix_data { + u8 multi_filter[AX_MCAST_FILTER_SIZE]; + }; + +@@ -121,7 +120,7 @@ struct ax88172_int_data { + u16 res3; + } __attribute__ ((packed)); + +-static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, ++static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, + u16 size, void *data) + { + return usb_control_msg( +@@ -136,7 +135,7 @@ static int ax8817x_read_cmd(struct usbne + USB_CTRL_GET_TIMEOUT); + } + +-static int ax8817x_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, ++static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, + u16 size, void *data) + { + return usb_control_msg( +@@ -151,19 +150,80 @@ static int ax8817x_write_cmd(struct usbn + USB_CTRL_SET_TIMEOUT); + } + +-static void ax8817x_async_cmd_callback(struct urb *urb, struct pt_regs *regs) ++static void asix_async_cmd_callback(struct urb *urb, struct pt_regs *regs) + { + struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; + + if (urb->status < 0) +- printk(KERN_DEBUG "ax8817x_async_cmd_callback() failed with %d", ++ printk(KERN_DEBUG "asix_async_cmd_callback() failed with %d", + urb->status); + + kfree(req); + usb_free_urb(urb); + } + +-static void ax8817x_status(struct usbnet *dev, struct urb *urb) ++static inline int asix_set_sw_mii(struct usbnet *dev) ++{ ++ int ret; ++ ret = asix_write_cmd(dev, AX_CMD_SET_SW_MII, 0x0000, 0, 0, NULL); ++ if (ret < 0) ++ devdbg(dev, "Failed to enable software MII access"); ++ return ret; ++} ++ ++static inline int asix_set_hw_mii(struct usbnet *dev) ++{ ++ int ret; ++ ret = asix_write_cmd(dev, AX_CMD_SET_HW_MII, 0x0000, 0, 0, NULL); ++ if (ret < 0) ++ devdbg(dev, "Failed to enable hardware MII access"); ++ return ret; ++} ++ ++static inline int asix_get_phyid(struct usbnet *dev) ++{ ++ int ret = 0; ++ void *buf; ++ ++ buf = kmalloc(2, GFP_KERNEL); ++ if (!buf) ++ goto out1; ++ ++ if ((ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, ++ 0, 0, 2, buf)) < 2) { ++ devdbg(dev, "Error reading PHYID register: %02x", ret); ++ goto out2; ++ } ++ ret = *((u8 *)buf + 1); ++out2: ++ kfree(buf); ++out1: ++ return ret; ++} ++ ++static int asix_sw_reset(struct usbnet *dev, u8 flags) ++{ ++ int ret; ++ ++ ret = asix_write_cmd(dev, AX_CMD_SW_RESET, flags, 0, 0, NULL); ++ if (ret < 0) ++ devdbg(dev,"Failed to send software reset: %02x", ret); ++ ++ return ret; ++} ++ ++static int asix_write_rx_ctl(struct usbnet *dev, u16 mode) ++{ ++ int ret; ++ ++ ret = asix_write_cmd(dev, AX_CMD_WRITE_RX_CTL, mode, 0, 0, NULL); ++ if (ret < 0) ++ devdbg(dev, "Failed to write RX_CTL mode: %02x", ret); ++ ++ return ret; ++} ++ ++static void asix_status(struct usbnet *dev, struct urb *urb) + { + struct ax88172_int_data *event; + int link; +@@ -179,12 +239,12 @@ static void ax8817x_status(struct usbnet + usbnet_defer_kevent (dev, EVENT_LINK_RESET ); + } else + netif_carrier_off(dev->net); +- devdbg(dev, "ax8817x - Link Status is: %d", link); ++ devdbg(dev, "Link Status is: %d", link); + } + } + + static void +-ax8817x_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index, ++asix_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index, + u16 size, void *data) + { + struct usb_ctrlrequest *req; +@@ -211,7 +271,7 @@ ax8817x_write_cmd_async(struct usbnet *d + usb_fill_control_urb(urb, dev->udev, + usb_sndctrlpipe(dev->udev, 0), + (void *)req, data, size, +- ax8817x_async_cmd_callback, req); ++ asix_async_cmd_callback, req); + + if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { + deverr(dev, "Error submitting the control message: status=%d", +@@ -221,10 +281,10 @@ ax8817x_write_cmd_async(struct usbnet *d + } + } + +-static void ax8817x_set_multicast(struct net_device *net) ++static void asix_set_multicast(struct net_device *net) + { + struct usbnet *dev = netdev_priv(net); +- struct ax8817x_data *data = (struct ax8817x_data *)&dev->data; ++ struct asix_data *data = (struct asix_data *)&dev->data; + u8 rx_ctl = 0x8c; + + if (net->flags & IFF_PROMISC) { +@@ -255,53 +315,51 @@ static void ax8817x_set_multicast(struct + mc_list = mc_list->next; + } + +- ax8817x_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, ++ asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, + AX_MCAST_FILTER_SIZE, data->multi_filter); + + rx_ctl |= 0x10; + } + +- ax8817x_write_cmd_async(dev, AX_CMD_WRITE_RX_CTL, rx_ctl, 0, 0, NULL); ++ asix_write_cmd_async(dev, AX_CMD_WRITE_RX_CTL, rx_ctl, 0, 0, NULL); + } + +-static int ax8817x_mdio_read(struct net_device *netdev, int phy_id, int loc) ++static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc) + { + struct usbnet *dev = netdev_priv(netdev); + u16 res; +- u8 buf[1]; + +- ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, &buf); +- ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, ++ asix_set_sw_mii(dev); ++ asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, + (__u16)loc, 2, (u16 *)&res); +- ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf); ++ asix_set_hw_mii(dev); + + return res & 0xffff; + } + + /* same as above, but converts resulting value to cpu byte order */ +-static int ax8817x_mdio_read_le(struct net_device *netdev, int phy_id, int loc) ++static int asix_mdio_read_le(struct net_device *netdev, int phy_id, int loc) + { +- return le16_to_cpu(ax8817x_mdio_read(netdev,phy_id, loc)); ++ return le16_to_cpu(asix_mdio_read(netdev,phy_id, loc)); + } + + static void +-ax8817x_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) ++asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) + { + struct usbnet *dev = netdev_priv(netdev); + u16 res = val; +- u8 buf[1]; + +- ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, &buf); +- ax8817x_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, ++ asix_set_sw_mii(dev); ++ asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, + (__u16)loc, 2, (u16 *)&res); +- ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf); ++ asix_set_hw_mii(dev); + } + + /* same as above, but converts new value to le16 byte order before writing */ + static void +-ax8817x_mdio_write_le(struct net_device *netdev, int phy_id, int loc, int val) ++asix_mdio_write_le(struct net_device *netdev, int phy_id, int loc, int val) + { +- ax8817x_mdio_write( netdev, phy_id, loc, cpu_to_le16(val) ); ++ asix_mdio_write( netdev, phy_id, loc, cpu_to_le16(val) ); + } + + static int ax88172_link_reset(struct usbnet *dev) +@@ -312,23 +370,23 @@ static int ax88172_link_reset(struct usb + u8 mode; + + mode = AX_MEDIUM_TX_ABORT_ALLOW | AX_MEDIUM_FLOW_CONTROL_EN; +- lpa = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA); +- adv = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE); ++ lpa = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA); ++ adv = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE); + res = mii_nway_result(lpa|adv); + if (res & LPA_DUPLEX) + mode |= AX_MEDIUM_FULL_DUPLEX; +- ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); ++ asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); + + return 0; + } + + static void +-ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) ++asix_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) + { + struct usbnet *dev = netdev_priv(net); + u8 opt; + +- if (ax8817x_read_cmd(dev, AX_CMD_READ_MONITOR_MODE, 0, 0, 1, &opt) < 0) { ++ if (asix_read_cmd(dev, AX_CMD_READ_MONITOR_MODE, 0, 0, 1, &opt) < 0) { + wolinfo->supported = 0; + wolinfo->wolopts = 0; + return; +@@ -344,7 +402,7 @@ ax8817x_get_wol(struct net_device *net, + } + + static int +-ax8817x_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) ++asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) + { + struct usbnet *dev = netdev_priv(net); + u8 opt = 0; +@@ -357,19 +415,19 @@ ax8817x_set_wol(struct net_device *net, + if (opt != 0) + opt |= AX_MONITOR_MODE; + +- if (ax8817x_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, ++ if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, + opt, 0, 0, &buf) < 0) + return -EINVAL; + + return 0; + } + +-static int ax8817x_get_eeprom_len(struct net_device *net) ++static int asix_get_eeprom_len(struct net_device *net) + { + return AX_EEPROM_LEN; + } + +-static int ax8817x_get_eeprom(struct net_device *net, ++static int asix_get_eeprom(struct net_device *net, + struct ethtool_eeprom *eeprom, u8 *data) + { + struct usbnet *dev = netdev_priv(net); +@@ -386,14 +444,14 @@ static int ax8817x_get_eeprom(struct net + + /* ax8817x returns 2 bytes from eeprom on read */ + for (i=0; i < eeprom->len / 2; i++) { +- if (ax8817x_read_cmd(dev, AX_CMD_READ_EEPROM, ++ if (asix_read_cmd(dev, AX_CMD_READ_EEPROM, + eeprom->offset + i, 0, 2, &ebuf[i]) < 0) + return -EINVAL; + } + return 0; + } + +-static void ax8817x_get_drvinfo (struct net_device *net, ++static void asix_get_drvinfo (struct net_device *net, + struct ethtool_drvinfo *info) + { + /* Inherit standard device info */ +@@ -401,14 +459,14 @@ static void ax8817x_get_drvinfo (struct + info->eedump_len = 0x3e; + } + +-static int ax8817x_get_settings(struct net_device *net, struct ethtool_cmd *cmd) ++static int asix_get_settings(struct net_device *net, struct ethtool_cmd *cmd) + { + struct usbnet *dev = netdev_priv(net); + + return mii_ethtool_gset(&dev->mii,cmd); + } + +-static int ax8817x_set_settings(struct net_device *net, struct ethtool_cmd *cmd) ++static int asix_set_settings(struct net_device *net, struct ethtool_cmd *cmd) + { + struct usbnet *dev = netdev_priv(net); + +@@ -418,27 +476,27 @@ static int ax8817x_set_settings(struct n + /* We need to override some ethtool_ops so we require our + own structure so we don't interfere with other usbnet + devices that may be connected at the same time. */ +-static struct ethtool_ops ax8817x_ethtool_ops = { +- .get_drvinfo = ax8817x_get_drvinfo, ++static struct ethtool_ops ax88172_ethtool_ops = { ++ .get_drvinfo = asix_get_drvinfo, + .get_link = ethtool_op_get_link, + .get_msglevel = usbnet_get_msglevel, + .set_msglevel = usbnet_set_msglevel, +- .get_wol = ax8817x_get_wol, +- .set_wol = ax8817x_set_wol, +- .get_eeprom_len = ax8817x_get_eeprom_len, +- .get_eeprom = ax8817x_get_eeprom, +- .get_settings = ax8817x_get_settings, +- .set_settings = ax8817x_set_settings, ++ .get_wol = asix_get_wol, ++ .set_wol = asix_set_wol, ++ .get_eeprom_len = asix_get_eeprom_len, ++ .get_eeprom = asix_get_eeprom, ++ .get_settings = asix_get_settings, ++ .set_settings = asix_set_settings, + }; + +-static int ax8817x_ioctl (struct net_device *net, struct ifreq *rq, int cmd) ++static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd) + { + struct usbnet *dev = netdev_priv(net); + + return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); + } + +-static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf) ++static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) + { + int ret = 0; + void *buf; +@@ -455,55 +513,39 @@ static int ax8817x_bind(struct usbnet *d + + /* Toggle the GPIOs in a manufacturer/model specific way */ + for (i = 2; i >= 0; i--) { +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS, ++ if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, + (gpio_bits >> (i * 8)) & 0xff, 0, 0, + buf)) < 0) + goto out2; + msleep(5); + } + +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, +- 0x80, 0, 0, buf)) < 0) { +- dbg("send AX_CMD_WRITE_RX_CTL failed: %d", ret); ++ if ((ret = asix_write_rx_ctl(dev,0x80)) < 0) + goto out2; +- } + + /* Get the MAC address */ + memset(buf, 0, ETH_ALEN); +- if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_NODE_ID, ++ if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, + 0, 0, 6, buf)) < 0) { + dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); + goto out2; + } + memcpy(dev->net->dev_addr, buf, ETH_ALEN); + +- /* Get the PHY id */ +- if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, +- 0, 0, 2, buf)) < 0) { +- dbg("error on read AX_CMD_READ_PHY_ID: %02x", ret); +- goto out2; +- } else if (ret < 2) { +- /* this should always return 2 bytes */ +- dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x", +- ret); +- ret = -EIO; +- goto out2; +- } +- + /* Initialize MII structure */ + dev->mii.dev = dev->net; +- dev->mii.mdio_read = ax8817x_mdio_read; +- dev->mii.mdio_write = ax8817x_mdio_write; ++ dev->mii.mdio_read = asix_mdio_read; ++ dev->mii.mdio_write = asix_mdio_write; + dev->mii.phy_id_mask = 0x3f; + dev->mii.reg_num_mask = 0x1f; +- dev->mii.phy_id = *((u8 *)buf + 1); +- dev->net->do_ioctl = ax8817x_ioctl; ++ dev->mii.phy_id = asix_get_phyid(dev); ++ dev->net->do_ioctl = asix_ioctl; + +- dev->net->set_multicast_list = ax8817x_set_multicast; +- dev->net->ethtool_ops = &ax8817x_ethtool_ops; ++ dev->net->set_multicast_list = asix_set_multicast; ++ dev->net->ethtool_ops = &ax88172_ethtool_ops; + +- ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); +- ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE, ++ asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); ++ asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE, + ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP); + mii_nway_restart(&dev->mii); + +@@ -515,16 +557,16 @@ out1: + } + + static struct ethtool_ops ax88772_ethtool_ops = { +- .get_drvinfo = ax8817x_get_drvinfo, ++ .get_drvinfo = asix_get_drvinfo, + .get_link = ethtool_op_get_link, + .get_msglevel = usbnet_get_msglevel, + .set_msglevel = usbnet_set_msglevel, +- .get_wol = ax8817x_get_wol, +- .set_wol = ax8817x_set_wol, +- .get_eeprom_len = ax8817x_get_eeprom_len, +- .get_eeprom = ax8817x_get_eeprom, +- .get_settings = ax8817x_get_settings, +- .set_settings = ax8817x_set_settings, ++ .get_wol = asix_get_wol, ++ .set_wol = asix_set_wol, ++ .get_eeprom_len = asix_get_eeprom_len, ++ .get_eeprom = asix_get_eeprom, ++ .get_settings = asix_get_settings, ++ .set_settings = asix_set_settings, + }; + + static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) +@@ -541,62 +583,45 @@ static int ax88772_bind(struct usbnet *d + goto out1; + } + +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS, ++ if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, + 0x00B0, 0, 0, buf)) < 0) + goto out2; + + msleep(5); +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_PHY_SELECT, ++ if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, + 0x0001, 0, 0, buf)) < 0) { + dbg("Select PHY #1 failed: %d", ret); + goto out2; + } + +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPPD, +- 0, 0, buf)) < 0) { +- dbg("Failed to power down internal PHY: %d", ret); ++ if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD)) < 0) + goto out2; +- } + + msleep(150); +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_CLEAR, +- 0, 0, buf)) < 0) { +- dbg("Failed to perform software reset: %d", ret); ++ if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0) + goto out2; +- } + + msleep(150); +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, +- AX_SWRESET_IPRL | AX_SWRESET_PRL, +- 0, 0, buf)) < 0) { +- dbg("Failed to set Internal/External PHY reset control: %d", +- ret); ++ if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) + goto out2; +- } + + msleep(150); +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, +- 0x0000, 0, 0, buf)) < 0) { +- dbg("Failed to reset RX_CTL: %d", ret); ++ if ((ret = asix_write_rx_ctl(dev, 0x00)) < 0) + goto out2; +- } + + /* Get the MAC address */ + memset(buf, 0, ETH_ALEN); +- if ((ret = ax8817x_read_cmd(dev, AX88772_CMD_READ_NODE_ID, ++ if ((ret = asix_read_cmd(dev, AX88772_CMD_READ_NODE_ID, + 0, 0, ETH_ALEN, buf)) < 0) { + dbg("Failed to read MAC address: %d", ret); + goto out2; + } + memcpy(dev->net->dev_addr, buf, ETH_ALEN); + +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, +- 0, 0, 0, buf)) < 0) { +- dbg("Enabling software MII failed: %d", ret); ++ if ((ret = asix_set_sw_mii(dev)) < 0) + goto out2; +- } + +- if (((ret = ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, ++ if (((ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, + 0x0010, 2, 2, buf)) < 0) + || (*((u16 *)buf) != 0x003b)) { + dbg("Read PHY register 2 must be 0x3b00: %d", ret); +@@ -605,74 +630,49 @@ static int ax88772_bind(struct usbnet *d + + /* Initialize MII structure */ + dev->mii.dev = dev->net; +- dev->mii.mdio_read = ax8817x_mdio_read; +- dev->mii.mdio_write = ax8817x_mdio_write; ++ dev->mii.mdio_read = asix_mdio_read; ++ dev->mii.mdio_write = asix_mdio_write; + dev->mii.phy_id_mask = 0xff; + dev->mii.reg_num_mask = 0xff; +- dev->net->do_ioctl = ax8817x_ioctl; ++ dev->net->do_ioctl = asix_ioctl; ++ dev->mii.phy_id = asix_get_phyid(dev); + +- /* Get the PHY id */ +- if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, +- 0, 0, 2, buf)) < 0) { +- dbg("Error reading PHY ID: %02x", ret); ++ if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0) + goto out2; +- } else if (ret < 2) { +- /* this should always return 2 bytes */ +- dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x", +- ret); +- ret = -EIO; +- goto out2; +- } +- dev->mii.phy_id = *((u8 *)buf + 1); + +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_PRL, +- 0, 0, buf)) < 0) { +- dbg("Set external PHY reset pin level: %d", ret); +- goto out2; +- } + msleep(150); +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, +- AX_SWRESET_IPRL | AX_SWRESET_PRL, +- 0, 0, buf)) < 0) { +- dbg("Set Internal/External PHY reset control: %d", ret); ++ ++ if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) + goto out2; +- } +- msleep(150); + ++ msleep(150); + +- dev->net->set_multicast_list = ax8817x_set_multicast; ++ dev->net->set_multicast_list = asix_set_multicast; + dev->net->ethtool_ops = &ax88772_ethtool_ops; + +- ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); +- ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE, ++ asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); ++ asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE, + ADVERTISE_ALL | ADVERTISE_CSMA); + mii_nway_restart(&dev->mii); + +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, ++ if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, + AX88772_MEDIUM_DEFAULT, 0, 0, buf)) < 0) { + dbg("Write medium mode register: %d", ret); + goto out2; + } + +- if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_IPG0, ++ if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0, + AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, + AX88772_IPG2_DEFAULT, 0, buf)) < 0) { + dbg("Write IPG,IPG1,IPG2 failed: %d", ret); + goto out2; + } +- if ((ret = +- ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf)) < 0) { +- dbg("Failed to set hardware MII: %02x", ret); ++ if ((ret = asix_set_hw_mii(dev)) < 0) + goto out2; +- } + + /* Set RX_CTL to default values with 2k buffer, and enable cactus */ +- if ((ret = +- ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x0088, 0, 0, +- buf)) < 0) { +- dbg("Reset RX_CTL failed: %d", ret); ++ if ((ret = asix_write_rx_ctl(dev, 0x0088)) < 0) + goto out2; +- } + + kfree(buf); + +@@ -794,23 +794,23 @@ static int ax88772_link_reset(struct usb + u16 mode; + + mode = AX88772_MEDIUM_DEFAULT; +- lpa = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA); +- adv = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE); ++ lpa = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA); ++ adv = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE); + res = mii_nway_result(lpa|adv); + + if ((res & LPA_DUPLEX) == 0) + mode &= ~AX88772_MEDIUM_FULL_DUPLEX; + if ((res & LPA_100) == 0) + mode &= ~AX88772_MEDIUM_100MB; +- ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); ++ asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); + + return 0; + } + + static const struct driver_info ax8817x_info = { + .description = "ASIX AX8817x USB 2.0 Ethernet", +- .bind = ax8817x_bind, +- .status = ax8817x_status, ++ .bind = ax88172_bind, ++ .status = asix_status, + .link_reset = ax88172_link_reset, + .reset = ax88172_link_reset, + .flags = FLAG_ETHER, +@@ -819,8 +819,8 @@ static const struct driver_info ax8817x_ + + static const struct driver_info dlink_dub_e100_info = { + .description = "DLink DUB-E100 USB Ethernet", +- .bind = ax8817x_bind, +- .status = ax8817x_status, ++ .bind = ax88172_bind, ++ .status = asix_status, + .link_reset = ax88172_link_reset, + .reset = ax88172_link_reset, + .flags = FLAG_ETHER, +@@ -829,8 +829,8 @@ static const struct driver_info dlink_du + + static const struct driver_info netgear_fa120_info = { + .description = "Netgear FA-120 USB Ethernet", +- .bind = ax8817x_bind, +- .status = ax8817x_status, ++ .bind = ax88172_bind, ++ .status = asix_status, + .link_reset = ax88172_link_reset, + .reset = ax88172_link_reset, + .flags = FLAG_ETHER, +@@ -839,8 +839,8 @@ static const struct driver_info netgear_ + + static const struct driver_info hawking_uf200_info = { + .description = "Hawking UF200 USB Ethernet", +- .bind = ax8817x_bind, +- .status = ax8817x_status, ++ .bind = ax88172_bind, ++ .status = asix_status, + .link_reset = ax88172_link_reset, + .reset = ax88172_link_reset, + .flags = FLAG_ETHER, +@@ -850,13 +850,12 @@ static const struct driver_info hawking_ + static const struct driver_info ax88772_info = { + .description = "ASIX AX88772 USB 2.0 Ethernet", + .bind = ax88772_bind, +- .status = ax8817x_status, ++ .status = asix_status, + .link_reset = ax88772_link_reset, + .reset = ax88772_link_reset, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, + .rx_fixup = ax88772_rx_fixup, + .tx_fixup = ax88772_tx_fixup, +- .data = 0x00130103, + }; + + static const struct usb_device_id products [] = { diff --git a/usb/usb-rndis_host-whitespace-comment-updates.patch b/usb/usb-rndis_host-whitespace-comment-updates.patch new file mode 100644 index 0000000000000..b141a524ef43e --- /dev/null +++ b/usb/usb-rndis_host-whitespace-comment-updates.patch @@ -0,0 +1,81 @@ +From david-b@pacbell.net Sun Apr 2 11:38:18 2006 +From: David Brownell <david-b@pacbell.net> +To: linux-usb-devel@lists.sourceforge.net +Subject: USB: rndis_host whitespace/comment updates +Date: Sun, 2 Apr 2006 10:19:08 -0800 +Cc: Greg KH <greg@kroah.com> +Message-Id: <200604021119.08544.david-b@pacbell.net> + +This adds a "avoid proprietary protocols" warnoff, identifying several +of the known deficiencies in Microsoft's excuse-for-specification, and +fixes some whitespace bugs. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/net/rndis_host.c | 28 +++++++++++++++++++++------- + 1 file changed, 21 insertions(+), 7 deletions(-) + +--- gregkh-2.6.orig/drivers/usb/net/rndis_host.c ++++ gregkh-2.6/drivers/usb/net/rndis_host.c +@@ -39,6 +39,20 @@ + * RNDIS is NDIS remoted over USB. It's a MSFT variant of CDC ACM ... of + * course ACM was intended for modems, not Ethernet links! USB's standard + * for Ethernet links is "CDC Ethernet", which is significantly simpler. ++ * ++ * NOTE that Microsoft's "RNDIS 1.0" specification is incomplete. Issues ++ * include: ++ * - Power management in particular relies on information that's scattered ++ * through other documentation, and which is incomplete or incorrect even ++ * there. ++ * - There are various undocumented protocol requirements, such as the ++ * need to send unused garbage in control-OUT messages. ++ * - In some cases, MS-Windows will emit undocumented requests; this ++ * matters more to peripheral implementations than host ones. ++ * ++ * For these reasons and others, ** USE OF RNDIS IS STRONGLY DISCOURAGED ** in ++ * favor of such non-proprietary alternatives as CDC Ethernet or the newer (and ++ * currently rare) "Ethernet Emulation Model" (EEM). + */ + + /* +@@ -72,17 +86,17 @@ struct rndis_msg_hdr { + */ + #define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */ + #define RNDIS_MSG_INIT ccpu2(0x00000002) +-#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION) ++#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION) + #define RNDIS_MSG_HALT ccpu2(0x00000003) + #define RNDIS_MSG_QUERY ccpu2(0x00000004) +-#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION) ++#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION) + #define RNDIS_MSG_SET ccpu2(0x00000005) +-#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION) ++#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION) + #define RNDIS_MSG_RESET ccpu2(0x00000006) +-#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION) ++#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION) + #define RNDIS_MSG_INDICATE ccpu2(0x00000007) + #define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008) +-#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) ++#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) + + /* codes for "status" field of completion messages */ + #define RNDIS_STATUS_SUCCESS ccpu2(0x00000000) +@@ -596,13 +610,13 @@ static struct usb_driver rndis_driver = + + static int __init rndis_init(void) + { +- return usb_register(&rndis_driver); ++ return usb_register(&rndis_driver); + } + module_init(rndis_init); + + static void __exit rndis_exit(void) + { +- usb_deregister(&rndis_driver); ++ usb_deregister(&rndis_driver); + } + module_exit(rndis_exit); + diff --git a/usb/usb-usbtest-scatterlist-out-data-pattern-testing.patch b/usb/usb-usbtest-scatterlist-out-data-pattern-testing.patch new file mode 100644 index 0000000000000..1dcc1e75596e7 --- /dev/null +++ b/usb/usb-usbtest-scatterlist-out-data-pattern-testing.patch @@ -0,0 +1,65 @@ +From david-b@pacbell.net Sun Apr 2 11:38:18 2006 +From: David Brownell <david-b@pacbell.net> +To: linux-usb-devel@lists.sourceforge.net +Subject: USB: usbtest: scatterlist OUT data pattern testing +Date: Sun, 2 Apr 2006 10:20:15 -0800 +Cc: Greg KH <greg@kroah.com> +Message-Id: <200604021120.16233.david-b@pacbell.net> + +Previously, scatterlist tests didn't write patterned data. Given how many +corner cases are addresed by them, this was a significant gap in Linux-USB +test coverage. Moreover, when peripherals checked for correct data patterns, +false error reports would drown out the true ones. + +This adds the pattern on the way OUT from the host, so scatterlist tests can +now be used to uncover bugs like host TX or peripheral RX paths failing for +back-to-back short packets. It's easy enough to get an error there with at +least one of the {DMA,PIO}{RX,TX} code paths, or run into hardware races +that need to be defended against. + +Note this patch doesn't add checking for correct data patterns on the way +IN from peripherals, just a FIXME for later. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/misc/usbtest.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +--- gregkh-2.6.orig/drivers/usb/misc/usbtest.c ++++ gregkh-2.6/drivers/usb/misc/usbtest.c +@@ -381,6 +381,7 @@ alloc_sglist (int nents, int max, int va + + for (i = 0; i < nents; i++) { + char *buf; ++ unsigned j; + + buf = kzalloc (size, SLAB_KERNEL); + if (!buf) { +@@ -391,6 +392,16 @@ alloc_sglist (int nents, int max, int va + /* kmalloc pages are always physically contiguous! */ + sg_init_one(&sg[i], buf, size); + ++ switch (pattern) { ++ case 0: ++ /* already zeroed */ ++ break; ++ case 1: ++ for (j = 0; j < size; j++) ++ *buf++ = (u8) (j % 63); ++ break; ++ } ++ + if (vary) { + size += vary; + size %= max; +@@ -425,6 +436,8 @@ static int perform_sglist ( + usb_sg_wait (req); + retval = req->status; + ++ /* FIXME check resulting data pattern */ ++ + /* FIXME if endpoint halted, clear halt (and log) */ + } + |