bk://kernel.bkbits.net/gregkh/linux/usb-2.6
stern@rowland.harvard.edu|ChangeSet|20040608231024|55229 stern

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/06/08 22:02:51-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb.h
#   2004/06/08 22:02:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/serial/cyberjack.c
#   2004/06/08 22:02:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/media/pwc-if.c
#   2004/06/08 22:02:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/media/Kconfig
#   2004/06/08 22:02:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/gadget/ether.c
#   2004/06/08 22:02:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/devio.c
#   2004/06/08 22:02:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/08 16:10:24-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Initialize endpoint autoconfig in g_file_storage
#   
#   This one-line patch corrects a simple problem in the g_file_storage
#   driver.  It neglected to initialize the endpoint-autoconfiguration library
#   before using it.  Please apply.
#   
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/gadget/file_storage.c
#   2004/06/08 04:03:07-07:00 stern@rowland.harvard.edu +1 -0
#   USB: Initialize endpoint autoconfig in g_file_storage
# 
# ChangeSet
#   2004/06/08 16:09:55-07:00 david-b@pacbell.net 
#   [PATCH] lh7a404 USB host against 2.6.7-rc2
#   
#   Support for the Sharp LH7A404 OHCI, another non-PCI implementation.
#   This uses a platform_device and a workaround for a register read
#   problem.
#   
#   Signed-off-by: Marc Singer <elf@buici.com>
#   Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# usb/host/ohci-lh7a404.c
#   2004/06/07 16:24:04-07:00 david-b@pacbell.net +387 -0
#   lh7a404 USB host against 2.6.7-rc2
# 
# drivers/usb/Kconfig
#   2004/06/07 09:24:04-07:00 david-b@pacbell.net +1 -1
#   lh7a404 USB host against 2.6.7-rc2
# 
# usb/host/ohci-lh7a404.c
#   2004/06/07 16:24:04-07:00 david-b@pacbell.net +0 -0
#   BitKeeper file /home/greg/linux/BK/usb-2.6/usb/host/ohci-lh7a404.c
# 
# drivers/usb/host/ohci.h
#   2004/06/07 09:24:04-07:00 david-b@pacbell.net +19 -0
#   lh7a404 USB host against 2.6.7-rc2
# 
# drivers/usb/host/ohci-q.c
#   2004/06/07 09:24:04-07:00 david-b@pacbell.net +3 -3
#   lh7a404 USB host against 2.6.7-rc2
# 
# drivers/usb/host/ohci-hub.c
#   2004/06/07 09:33:47-07:00 david-b@pacbell.net +21 -21
#   lh7a404 USB host against 2.6.7-rc2
# 
# drivers/usb/host/ohci-hcd.c
#   2004/06/07 09:24:04-07:00 david-b@pacbell.net +26 -16
#   lh7a404 USB host against 2.6.7-rc2
# 
# drivers/usb/host/ohci-dbg.c
#   2004/06/07 09:24:04-07:00 david-b@pacbell.net +15 -15
#   lh7a404 USB host against 2.6.7-rc2
# 
# ChangeSet
#   2004/06/08 16:09:24-07:00 david-b@pacbell.net 
#   [PATCH] USB: rndis (3/4) Big Endian support for gadget RNDIS
#   
#   Add byteswapping.  Original version partially worked on PPC with Net2280,
#   this version applies to the latest RNDIS code but hasn't been retested on
#   big-endian.  Ping should be working in at least one one direction.
#   
#   Also added a handful of other things from my BK:  track suspend/resume
#   (to eventually implement wake-on-lan), give a better rndis error
#   message, and add missing declarations for PM-related OIDs (usage is
#   #ifdeffed out by previous patch).
#   
#       From:	   Jon Neal <jon@ballardtech.com>
#       Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
#       Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/gadget/rndis.c
#   2004/06/07 11:30:16-07:00 david-b@pacbell.net +199 -163
#   USB: rndis (3/4) Big Endian support for gadget RNDIS
# 
# drivers/usb/gadget/ndis.h
#   2004/06/07 11:30:16-07:00 david-b@pacbell.net +30 -0
#   USB: rndis (3/4) Big Endian support for gadget RNDIS
# 
# drivers/usb/gadget/ether.c
#   2004/06/07 11:32:18-07:00 david-b@pacbell.net +28 -2
#   USB: rndis (3/4) Big Endian support for gadget RNDIS
# 
# ChangeSet
#   2004/06/08 16:08:52-07:00 david-b@pacbell.net 
#   [PATCH] USB: usb suspend/resume work better on net2280
#   
#   This makes net2280 behave more correctly with respect to
#   usb suspend and resume processing.
#   
#   So for example gadget zero autoresume testing works.
#   
#   Signed-off-by:	David Brownell <dbrownell@users.sourceforge.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/gadget/net2280.c
#   2004/06/07 07:31:53-07:00 david-b@pacbell.net +17 -8
#   USB: usb suspend/resume work better on net2280
# 
# ChangeSet
#   2004/06/08 16:08:19-07:00 david-b@pacbell.net 
#   [PATCH] USB: usb root hubs can set power budgets
#   
#   This adds hub_set_power_budget(), mostly so that HCDs for low
#   powered ports (cell phone, PDA, etc) can more easily report their
#   true power budgets.  It's not always 500mA per root hub port; this
#   makes dummy_hcd report the minimum, 8mA.
#   
#   Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/gadget/dummy_hcd.c
#   2004/06/07 07:31:53-07:00 david-b@pacbell.net +3 -0
#   USB: usb root hubs can set power budgets
# 
# drivers/usb/core/hub.h
#   2004/06/07 07:31:53-07:00 david-b@pacbell.net +11 -0
#   USB: usb root hubs can set power budgets
# 
# ChangeSet
#   2004/06/08 14:12:40-07:00 greg@kroah.com 
#   Merge kroah.com:/home/greg/linux/BK/bleed-2.6
#   into kroah.com:/home/greg/linux/BK/usb-2.6
# 
# include/linux/usb.h
#   2004/06/08 14:12:36-07:00 greg@kroah.com +0 -1
#   Auto merged
# 
# drivers/usb/serial/cyberjack.c
#   2004/06/08 14:12:36-07:00 greg@kroah.com +0 -6
#   Auto merged
# 
# drivers/usb/media/pwc-if.c
#   2004/06/08 14:12:36-07:00 greg@kroah.com +0 -1
#   Auto merged
# 
# drivers/usb/media/Kconfig
#   2004/06/08 14:12:35-07:00 greg@kroah.com +0 -1
#   Auto merged
# 
# drivers/usb/core/devio.c
#   2004/06/08 14:12:35-07:00 greg@kroah.com +0 -1
#   Auto merged
# 
# ChangeSet
#   2004/06/08 12:41:28-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb.h
#   2004/06/08 12:41:24-07:00 akpm@bix.(none) +0 -1
#   Auto merged
# 
# drivers/usb/serial/cyberjack.c
#   2004/06/08 12:41:24-07:00 akpm@bix.(none) +0 -6
#   Auto merged
# 
# drivers/usb/media/pwc-if.c
#   2004/06/08 12:41:24-07:00 akpm@bix.(none) +0 -1
#   Auto merged
# 
# drivers/usb/media/Kconfig
#   2004/06/08 12:41:24-07:00 akpm@bix.(none) +0 -1
#   Auto merged
# 
# drivers/usb/core/devio.c
#   2004/06/08 12:41:24-07:00 akpm@bix.(none) +0 -1
#   Auto merged
# 
# ChangeSet
#   2004/06/07 20:07:13-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb.h
#   2004/06/07 20:07:10-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/gadget/ether.c
#   2004/06/07 20:07:10-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/07 17:01:22-07:00 david-b@pacbell.net 
#   [PATCH] USB: rndis (4/4) start documenting spec variances
#   
#   This partially reverts one of the changes in an earlier patch,
#   starting to document where Microsoft's spec is lying.  Needed
#   to interop with Windows ME.
#   
#   
#   The Windows ME implementation of RNDIS relies on a message that
#   Microsoft's specification says isn't used.  Restore this (removed
#   in earlier cleanup), and start collecting comments specifically
#   on where MSFT violates its own specifications.
#   
#   Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/gadget/rndis.c
#   2004/06/07 07:04:50-07:00 david-b@pacbell.net +17 -0
#   USB: rndis (4/4) start documenting spec variances
# 
# ChangeSet
#   2004/06/07 16:58:23-07:00 david-b@pacbell.net 
#   [PATCH] USB: rndis (2/4) fix memory leaks
#   
#   Tao Huang wrote:
#   > I'm writing udc driver for S3C2410. I found RNDIS almost not call my
#   > driver's free_request and free_buffer. So after run my driver about 3
#   > hours the system will out of memory.
#   >
#   > This patch will fix the memory leak.
#   >
#   > There will still have memory leak when driver unload, but I don't known
#   > where is the proper place to fix it.
#   > 1) rndis.c should free resp_queue when it unload
#   > 2) ether.c should free tx_reqs and rx_reqs when it unload (as
#   > eth_reset_config)
#   
#   Thanks ... this is a nice patch to have.
#   
#   
#   From:          Tao Huang <huangt@star-net.cn>
#   Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/gadget/ether.c
#   2004/06/06 06:34:51-07:00 david-b@pacbell.net +13 -5
#   USB: rndis (2/4) fix memory leaks
# 
# ChangeSet
#   2004/06/07 16:57:06-07:00 david-b@pacbell.net 
#   [PATCH] USB: rndis (1/4) update OID support
#   
#   NDIS devices have a generic attribute get/set API where the attributes
#   are identified by 32 bit "OIDs".  This fixes some problems with the OIDs
#   supported by the original RNDIS patch:
#   
#     - It included OIDs not found in the RNDIS spec.  These have been
#       removed.  As a rule, these weren't exported in the "OIDs I support"
#       list, and only a couple wouldn't fail those accesses, so this mostly
#       changes what debug printk appears.
#   
#     - OIDs used for optional 802.3 statistics were partially supported.
#       They're all in the OID list now, but the support is #ifdeffed out.
#       (Those statistics were mostly just made up, anyway!)
#   
#     - "Required" OIDs for suspend, resume, and wakeup support weren't
#       listed.  Their messages are now defined, but support is #ifdeffed
#       out.  Seems the docs aren't entirely accurate, and Windows can
#       behave reasonably without them.  (This area needs help from someone
#       who knows MS-Windows power management.)
#   
#   There are also a few minor cleanups, more reasonable default volume level
#   for debug messages (never at KERN_INFO, keepalives only if VERBOSE), and
#   dumping of all bytes of some undocumented messages Windows XP has been
#   seen emitting shortly before the host suspended itself.
#   
#   Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/gadget/rndis.h
#   2004/06/06 06:06:42-07:00 david-b@pacbell.net +37 -4
#   USB: rndis (1/4) update OID support
# 
# drivers/usb/gadget/rndis.c
#   2004/06/06 06:06:42-07:00 david-b@pacbell.net +162 -166
#   USB: rndis (1/4) update OID support
# 
# ChangeSet
#   2004/06/07 16:55:44-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: unusual_devs.h update
#   
#   Given the problems that Dan Scholnik has reported, we should combine the
#   unusual_devs.h entries for the Casio QV cameras into one.  The new
#   NEED_OVERRIDE flag will prevent complaints about unnecessary overrides,
#   and Dan says the same subclass and protocol values should work for all the
#   cameras.  If they don't we'll hear about it soon enough!
#   
#   
#   On Tue, 1 Jun 2004, Dan Scholnik wrote:
#   > On Tue, 2004-06-01 at 14:14, Alan Stern wrote:
#   > > On Tue, 1 Jun 2004, Dan Scholnik wrote:
#   > >
#   > > > Up until the 2.6 kernels, there was one entry for all the QV cameras
#   > > > with both US_SC_8070 and US_PR_CB that I think seemed to work fine for
#   > > > everyone.  As far as I know the only problem was all the folks emailing
#   > > > the log entry stating that the Casio entry wasn't needed.  So, you could
#   > > > revert back to that, or revert back to the 2.6.3ish version (pre-as190)
#   > > > that had the overrides just for product IDs 1001-9009.  I'm not really
#   > > > an expert on Casio's cameras, I'm afraid, just the one model I own which
#   > > > is 4-5 years old now.
#   > > >
#   > > > I'll be happy to prepare a patch any way you choose to go.
#   > >
#   > > How does this work for you?
#   > >
#   > > Alan Stern
#   >
#   > Works fine for me; that's I think exactly how it was from the beginning
#   > until 2.6 and the later 2.4 kernels when all the changes were made.
#   > Just cross your fingers that it doesn't somehow break newer Casios, as
#   > it would seem every camera they ever made falls under that entry.
#   
#   
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/storage/unusual_devs.h
#   2004/06/01 05:46:58-07:00 stern@rowland.harvard.edu +3 -9
#   USB: unusual_devs.h update
# 
# ChangeSet
#   2004/06/07 16:55:17-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Fix resource leakage in the hub driver
#   
#   The hub driver is very careless about returning resources when an error
#   occurs while installing a new device.  This patch attempts to put some
#   order back into the situation.  Details:
#   
#   	Since usb_new_device() allocates neither the device structure
#   	nor the device address, it shouldn't release either one.
#   
#   	Because usb_new_device() no longer releases the device structure,
#   	usb_register_root_hub() doesn't need to take an extra reference
#   	to it.
#   
#   	Since the device address selection and TT setup code is used
#   	only for new devices, not ones being reset, move that code from
#   	hub_port_init() to hub_port_connect_change().  By the same token,
#   	hub_port_init() doesn't have to release the device address or
#   	the device structure.
#   
#   	Just to make things look better, move the failure code in
#   	hub_port_init() to the end of the routine.  And when disabling
#   	endpoint 0, disable both the IN and OUT parts of the endpoint.
#   
#   	In hub_port_connect_change(), make all the failure paths
#   	execute the same code so that resources are always released.
#   	These resources comprise: the pointer from the parent to the
#   	new child device, the HCD state for ep0, the device's address,
#   	and the device structure itself -- in short, everything that's
#   	set up before calling usb_new_device().
#   
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/hub.c
#   2004/06/07 10:08:06-07:00 stern@rowland.harvard.edu +45 -50
#   USB: Fix resource leakage in the hub driver
# 
# drivers/usb/core/hcd.c
#   2004/06/07 09:55:49-07:00 stern@rowland.harvard.edu +1 -3
#   USB: Fix resource leakage in the hub driver
# 
# ChangeSet
#   2004/06/07 16:54:49-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Check port reset return code
#   
#   This patch adds checking for the SET-FEATURE request that actually does a
#   port reset.  Without the check, the hub driver just assumes that the port
#   reset command actually was transferred okay.
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/hub.c
#   2004/06/07 08:20:11-07:00 stern@rowland.harvard.edu +6 -2
#   USB: Check port reset return code
# 
# ChangeSet
#   2004/06/07 16:34:04-07:00 baldrick@free.fr 
#   [PATCH] USB devio.c: deadlock fix
#   
#   proc_resetdevice is called with dev->serialize held.
#   usb_reset_device takes dev->serialize and then calls
#   __usb_reset_device.  To avoid deadlock, proc_resetdevice
#   should call __usb_reset_device directly.
#   
#   Signed-off-by: Duncan Sands <baldrick@free.fr>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# include/linux/usb.h
#   2004/06/07 01:39:20-07:00 baldrick@free.fr +1 -0
#   USB devio.c: deadlock fix
# 
# drivers/usb/core/devio.c
#   2004/06/07 01:39:20-07:00 baldrick@free.fr +1 -1
#   USB devio.c: deadlock fix
# 
# ChangeSet
#   2004/06/07 14:23:17-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/gadget/ether.c
#   2004/06/07 14:23:13-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/message.c
#   2004/06/07 14:23:13-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/07 14:22:27-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/input/hiddev.c
#   2004/06/07 14:22:24-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/07 13:00:07-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Fix logic in usb_get_descriptor()
#   
#   This patch fixes a simple logic error in usb_get_descriptor().  It also
#   takes the opportunity to make the subroutine a little easier to read.
#   Please apply.
#   
#   
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/message.c
#   2004/06/06 09:43:22-07:00 stern@rowland.harvard.edu +7 -7
#   USB: Fix logic in usb_get_descriptor()
# 
# ChangeSet
#   2004/06/07 12:59:41-07:00 kaie@kuix.de 
#   [PATCH] USB: enable pwc usb camera driver
#   
#   The attached patch enables the pwc driver included with kernel 2.6.7-rc2
#   
#   It also removes the warnings during compilation.
#   However, note that I blindly duplicated the release approach used by
#   other usb camera drivers, replacing the current no-op.
#   
#   The driver works for me with a Logitech QuickCam Notebook Pro and
#   GnomeMeeting.
#   
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/media/pwc-if.c
#   2004/06/07 02:42:50-07:00 kaie@kuix.de +1 -8
#   USB: enable pwc usb camera driver
# 
# drivers/usb/media/Kconfig
#   2004/06/07 02:27:03-07:00 kaie@kuix.de +1 -1
#   USB: enable pwc usb camera driver
# 
# ChangeSet
#   2004/06/07 12:59:12-07:00 mdharm-usb@one-eyed-alien.net 
#   [PATCH] USB Storage: GetMaxLUN tightening
#   
#   This patch started life from Alan Stern as as274, and has been heavily
#   modified.  It narrows the case where a clear_halt() is issued after a
#   failed GetMaxLUN command to only a STALL case.
#   
#   Since the only legimate responses to a GetMaxLUN are STALL or data,
#   anything else is now considered a fatal error and we give up on the device.
#   
#   
#   Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/storage/usb.c
#   2004/06/06 15:22:29-07:00 mdharm-usb@one-eyed-alien.net +8 -2
#   USB Storage: GetMaxLUN tightening
# 
# drivers/usb/storage/transport.c
#   2004/06/06 15:22:29-07:00 mdharm-usb@one-eyed-alien.net +13 -10
#   USB Storage: GetMaxLUN tightening
# 
# ChangeSet
#   2004/06/07 12:58:42-07:00 Siegfried.Hildebrand@FernUni-Hagen.de 
#   [PATCH] Re: Problems with cyberjack usb-serial-module since kernel 2.6.2
#   
#   > Send me a patch to back those changes out to fix your device and I'll
#   > apply it.  If the author is around to realize this, that should wake
#   > them up :)
#   
#   Ok, here you are! :)
#   Attached is a patch for linux-2.6.7-rc2. (though the patch hasn't changed
#   since -rc1)
#   
#   Again a short description:
#   (the patch removes most of the changes done in linux-2.6.2)
#   1. Removed the local buffer of cyberjack_write, because something goes wrong
#   upon a write-request bigger than the buffer. Without this, a write-request
#   stalls with error -3.
#   2. Removed some usb_clear_halt() lines. Without this, the device doesn't even
#   open and returns -7.
#   
#   It works for my cyberjack pinpad USB card reader on
#   - nforce2 chipset
#   - VIA KM266 chipset
#   - AMD Irongate chipset
#   
#   
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/serial/cyberjack.c
#   2004/06/06 09:25:11-07:00 Siegfried.Hildebrand@FernUni-Hagen.de +6 -15
#   Re: Problems with cyberjack usb-serial-module since kernel 2.6.2
# 
# ChangeSet
#   2004/06/07 11:27:28-07:00 greg@kroah.com 
#   USB: make usb devices remove their sysfs files when disconnected.
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/usb.h
#   2004/06/07 04:26:43-07:00 greg@kroah.com +2 -0
#   USB: make usb devices remove their sysfs files when disconnected.
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/sysfs.c
#   2004/06/07 04:26:43-07:00 greg@kroah.com +59 -30
#   USB: make usb devices remove their sysfs files when disconnected.
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/message.c
#   2004/06/07 04:26:43-07:00 greg@kroah.com +1 -0
#   USB: make usb devices remove their sysfs files when disconnected.
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/hub.c
#   2004/06/07 04:26:43-07:00 greg@kroah.com +1 -0
#   USB: make usb devices remove their sysfs files when disconnected.
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# ChangeSet
#   2004/06/07 10:30:35-07:00 greg@kroah.com 
#   Merge kroah.com:/home/greg/linux/BK/bleed-2.6
#   into kroah.com:/home/greg/linux/BK/usb-2.6
# 
# drivers/usb/gadget/ether.c
#   2004/06/07 10:30:30-07:00 greg@kroah.com +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/05 17:09:11-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# MAINTAINERS
#   2004/06/05 17:09:08-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/04 15:15:08-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Genuine changes to hub_port_debounce()
#   
#   This patch includes the algorithmic changes I would like to see in
#   hub_port_debounce().  They are:
#   
#   	Increase the total timeout period from 400 ms to 1500 ms.
#   
#   	Check the port's connect-changed status during the polling
#   	loop.
#   
#   	Return as soon as the connection has been stable for the
#   	required time, even if it has been stably _dis_-connected.
#   	(The current code waits for the full timeout period if there
#   	isn't a connection.)
#   
#   In previous emails I have responded to all the concerns raised by others
#   about these changes, and I can't imagine how they could cause any trouble.
#   
#   	Increasing the total timeout won't affect people with properly
#   	functioning hardware.  Their connections will quickly stabilize
#   	and the routine will return just as before.  People with flaky
#   	hardware that takes a long time to settle down will now be able
#   	to use their devices.
#   
#   	Checking the connect-changed status during the polling loop will
#   	make the test more conservative.  The code will be able to
#   	detect transient disconnections that it would have missed
#   	before, and it won't return until the connection really _is_
#   	stable.  Furthermore, this makes the test compliant with the
#   	USB specification, which requires the stability timer to be
#   	restarted whenever a connection change occurs.
#   
#   	Returning early for disconnections is a simple optimization.
#   	It's more important now that the total timeout length is 1.5
#   	seconds rather than 0.4 seconds.
#   
#   I urge you to apply this patch and for people to try it out.  If there do
#   turn out to be problems... the patch is very small, well-contained, and
#   easy to revert.
#   
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/hub.c
#   2004/06/04 07:28:00-07:00 stern@rowland.harvard.edu +4 -4
#   USB: Genuine changes to hub_port_debounce()
# 
# ChangeSet
#   2004/06/04 15:14:42-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Superficial improvements to hub_port_debounce()
#   
#   Since my previous suggestions for changes to hub_port_debounce()
#   encountered so much resistance, this patch makes some fairly superficial
#   improvements to the code while leaving the logic of the algorithm almost
#   completely intact.  The only behavioral change is that it actually
#   requests the port status at the start, rather than assuming the status is
#   not CONNECTED.  Changes include:
#   
#   	Vastly improved comments that are now unambiguous and accurately
#   	descriptive of the code.
#   
#   	Local variables changed to more sensible names.  The stability
#   	period is now reported in milliseconds rather than a meaningless
#   	poll count.
#   
#   	The sleep interval is moved from the start of the loop to the
#   	end, so that the first time through we read the port status
#   	immediately.
#   
#   	If the connection has not stabilized after the total timeout
#   	expires, -ETIMEDOUT is returned rather than whatever the
#   	current connect status happens to be.
#   
#   	If the connection does stabilize then the port status is returned
#   	so that hub_port_connect_change() will have an up-to-date value
#   	for the status rather than relying on the pre-debounce value.
#   
#   The changes I wanted to make but other people were worried about are
#   included as comments.  A later (small) patch will uncomment them for
#   testing.
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/hub.c
#   2004/06/04 07:15:37-07:00 stern@rowland.harvard.edu +34 -30
#   USB: Superficial improvements to hub_port_debounce()
# 
# ChangeSet
#   2004/06/04 15:14:11-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Debounce all connect change events
#   
#   This patch makes the hub driver debounce all connection changes.  Right
#   now the driver only does so if the status happens to be CONNECTED at one
#   particular instant.  However, the whole point of debouncing is that the
#   connection is subject to transient interruptions until it has stabilized;
#   hence deciding whether to debounce based on a single initial test defeats
#   the entire purpose.
#   
#   There are some additional smaller changes that go along with the major
#   one:
#   
#   	Comments added to hub_port_connect_change() detailing the
#   	conditions under which it will be called.
#   
#   	Don't clear the port's connect-changed feature if it wasn't
#   	set.
#   
#   	Skip debouncing if there wasn't a physical connection change
#   	but only a logical port-enable change (or a firmware-download-
#   	induced device morph -- not yet implemented).
#   
#   	Clear all the hub status change indicators in hub_events()
#   	before handling a connect change.  This will reduce syslog
#   	clutter from status change bits that remain set while khubd
#   	is busy taking care of a new device.
#   
#   The patch includes no changes to the debounce routine itself.  Please
#   apply.
#   
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/hub.c
#   2004/06/04 07:10:33-07:00 stern@rowland.harvard.edu +41 -22
#   USB: Debounce all connect change events
# 
# ChangeSet
#   2004/06/04 15:13:47-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Code cleanup for the UHCI driver
#   
#   This patch makes some simple cleanups in the UHCI driver:
#   
#   	It introduces msecs_to_jiffies() conversions and uses msleep().
#   
#   	It wakes up threads waiting for an endpoint to be disabled
#   	in the oddball case where interrupts aren't working.  (This
#   	should have been in a previous patch but I missed it.)
#   
#   	It disables PCI interrupt generation whenever the controller
#   	is reset and enables it when the controller is started.  This
#   	may possibly solve some people's problems with suspend/resume.
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/host/uhci-hcd.c
#   2004/06/04 08:14:49-07:00 stern@rowland.harvard.edu +28 -17
#   USB: Code cleanup for the UHCI driver
# 
# ChangeSet
#   2004/06/04 15:13:16-07:00 jnardelli@infosciences.com 
#   [PATCH] USB: fix Memory leak in visor.c and ftdi_sio.c
#   
#   Signed-off-by: Joe Nardelli <jnardelli@infosciences.com>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/serial/visor.c
#   2004/06/04 07:13:10-07:00 jnardelli@infosciences.com +1 -0
#   USB: fix Memory leak in visor.c and ftdi_sio.c
# 
# drivers/usb/serial/ftdi_sio.c
#   2004/06/04 06:53:27-07:00 jnardelli@infosciences.com +1 -0
#   USB: fix Memory leak in visor.c and ftdi_sio.c
# 
# ChangeSet
#   2004/06/04 15:12:44-07:00 spitalnik@penguin.cz 
#   [PATCH] USB: pegasus driver and ATEN device support
#   
#   I have created a patch to add support for ATEN device in pegasus usb driver.
#   I've sent the patch to the maintainer stated in pegasus.h but after several
#   weeks I didn't recieve a response, so I'm sending it to you now. The patch
#   should apply cleanly on 2.6.6, but it doesn't apply cleanly on todays -bk as
#   there was some patch adding some other device. One thing I'm not 100% sure
#   are the flags specified to PEGASUS_DEV, what means HAS_HOME_PNA?
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/net/pegasus.h
#   2004/04/15 14:37:12-07:00 spitalnik@penguin.cz +3 -0
#   USB: pegasus driver and ATEN device support
# 
# ChangeSet
#   2004/06/04 02:41:08-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/gadget/ether.c
#   2004/06/04 02:41:05-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/03 17:14:32-07:00 greg@kroah.com 
#   USB: remove "devfs" message from kernel log for usb-serial driver
#   
#   No one uses devfs on 2.6 :)
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/serial/bus.c
#   2004/06/03 17:14:00-07:00 greg@kroah.com +2 -2
#   USB: remove "devfs" message from kernel log for usb-serial driver
#   
#   No one uses devfs on 2.6 :)
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# ChangeSet
#   2004/06/03 16:50:29-07:00 scott@concord.org 
#   [PATCH] USB: kyocera 7135 patch
#   
#   Here is a patch based on 2.6.7-rc2 that makes the Kyocera 7135 work.
#   The Kyocera appears to have the same setup as the Trio.  Its endpoints
#   are laid out like this:
#   
#   > >>>type                  address
#   > >>>usb bulk out:         0x01
#   > >>>usb interrupt in:     0x82
#   > >>>usb bulk out:         0x03
#   > >>>usb bulk in:          0x84
#   The last two are the ones used for the syncing communication.
#   
#   So the patch adds the ids for the kyocera and makes the treo_attach
#   function handle the kyocera too.  I also changed the comment; it appears
#   there was an error in the original comment about the treo:
#   
#   Joe Nardelli wrote:
#   > Actually, the comment isn't quite right for Treos either (oops).  It
#   > should read:
#   >
#   > ...
#   > 1st bulk in endpoint to communicate with the 2nd bulk out endpoint
#   > ...
#   
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/serial/visor.h
#   2004/06/02 07:09:27-07:00 scott@concord.org +3 -0
#   USB: kyocera 7135 patch
# 
# drivers/usb/serial/visor.c
#   2004/06/02 10:03:04-07:00 scott@concord.org +11 -7
#   USB: kyocera 7135 patch
# 
# ChangeSet
#   2004/06/03 16:49:51-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: 2.6-BK usb (printing) broken
#   
#   On Sat, 29 May 2004, Jens Axboe wrote:
#   
#   > > > Both 2.6.7-rc1 and BK current spit out a bunch of:
#   > > >
#   > > > drivers/usb/class/usblp.c: usblp1: nonzero read/write bulk status received: -2
#   > > > drivers/usb/class/usblp.c: usblp1: error -2 reading from printer
#   > > > drivers/usb/class/usblp.c: usblp1: error -115 reading from printer
#   > > > drivers/usb/class/usblp.c: usblp1: error -115 reading from printer
#   > > > ...
#   > > >
#   > > > (about ~80 of that last line) but work for me.
#   
#   > Sorry wasn't quite clear - the above messages are with 2.6.7-rc1 and
#   > current bk with your patch backed out. Current bk with the patch reports
#   > only the timeouts I originally listed.
#   
#   Okay, I feel better.
#   
#   It looks like those errors you see are caused by a bug in the usblp
#   driver.  The patch below ought to help.
# 
# drivers/usb/class/usblp.c
#   2004/05/29 07:25:51-07:00 stern@rowland.harvard.edu +1 -0
#   USB: 2.6-BK usb (printing) broken
# 
# ChangeSet
#   2004/06/03 12:06:36-07:00 greg@kroah.com 
#   Cset exclude: vojtech@suse.cz|ChangeSet|20040602201956|45549
#   
#   Oops, this broke device removal pretty badly :(
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/storage/transport.c
#   2004/06/03 12:06:28-07:00 greg@kroah.com +0 -0
#   Exclude
# 
# drivers/usb/storage/isd200.c
#   2004/06/03 12:06:28-07:00 greg@kroah.com +0 -0
#   Exclude
# 
# ChangeSet
#   2004/06/03 10:45:02-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/06/03 10:44:58-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/02 23:58:29-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/core/usb.c
#   2004/06/02 23:58:25-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/02 14:07:26-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Move usb_new_device() et al. into hub.c
#   
#   This patch moves usb_new_device(), usb_disconnect(), usb_choose_address(),
#   and usb_release_address() from usb.c to hub.c.  As a side benefit,
#   choose_address() and release_address() can now become static.  The other
#   two can't, because they have to be exported for use by HCD's when
#   registering/unregistering root hubs.
#   
#   Some other features of the patch:
#   
#   	The usb_snddefctrl() and usb_rcvdefctrl() macros have been
#   	removed, since only one of them was used and only in one spot.
#   
#   	The comment about configuration choice needing to interact with
#   	hub power budgeting has been moved in accordance with David's
#   	wish.  usb_new_device() checks to make sure a configuration
#   	could be chosen and logs a warning if no choice was made.
#   
#   	Following Linus's preference, the #ifdef preprocessor stuff has
#   	been removed from around the calls the show_string routine.  It
#   	is now defined as a non-inline routine when debugging is enabled
#   	and as an inline no-op otherwise (the compiler will optimize
#   	away the useless tests).
#   
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/usb.c
#   2004/06/01 09:54:17-07:00 stern@rowland.harvard.edu +0 -229
#   USB: Move usb_new_device() et al. into hub.c
# 
# drivers/usb/core/hub.c
#   2004/06/01 09:54:17-07:00 stern@rowland.harvard.edu +231 -3
#   USB: Move usb_new_device() et al. into hub.c
# 
# drivers/usb/core/hcd.h
#   2004/06/01 09:54:17-07:00 stern@rowland.harvard.edu +0 -7
#   USB: Move usb_new_device() et al. into hub.c
# 
# ChangeSet
#   2004/06/02 14:06:55-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Minor cleanups for hub driver
#   
#   Greg:
#   
#   This patch takes care of some small miscellaneous items in hub.c:
#   
#   	Move the definition of CONFIG to the right place;
#   
#   	Print the proper value for submission status in the error log;
#   
#   	Remove an unused list of all hubs;
#   
#   	Remove some unneeded braces;
#   
#   	Kill an accidentally-resurrected comment.
#   
#   Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/hub.h
#   2004/06/01 09:31:11-07:00 stern@rowland.harvard.edu +0 -1
#   USB: Minor cleanups for hub driver
# 
# drivers/usb/core/hub.c
#   2004/06/01 09:39:04-07:00 stern@rowland.harvard.edu +9 -25
#   USB: Minor cleanups for hub driver
# 
# ChangeSet
#   2004/06/02 13:55:44-07:00 oliver@neukum.org 
#   [PATCH] USB: fix race between disconnect and write of acm driver
#   
#   acm uses a workqueue to defer part of a write operation.
#   In case of disconnect this work must be waited for.
#     - fix race between write and disconnect
#   
#   Signed-off-by: Oliver Neukum <oliver@neukum.name>
#   Signed-off-by: Vojtech Pavlik <vojtech@suse.cz>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/class/cdc-acm.c
#   2004/05/31 08:13:14-07:00 oliver@neukum.org +2 -0
#   USB: fix race between disconnect and write of acm driver
# 
# ChangeSet
#   2004/06/02 13:49:28-07:00 oliver@neukum.org 
#   [PATCH] USB: fix racy access to urb->status in cdc acm driver
#   
#   Hi,
#   
#   fix access to urb->status by introduction of an explicit flag
#   for finished data transfer.
#     - fix racy access to urb->status
#   
#   Signed-off-by: Oliver Neukum <oliver@neukum.name>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/class/cdc-acm.h
#   2004/05/31 08:02:12-07:00 oliver@neukum.org +1 -0
#   USB: fix racy access to urb->status in cdc acm driver
# 
# drivers/usb/class/cdc-acm.c
#   2004/05/31 08:02:12-07:00 oliver@neukum.org +10 -6
#   USB: fix racy access to urb->status in cdc acm driver
# 
# ChangeSet
#   2004/06/02 13:38:13-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/core/message.c
#   2004/06/02 13:38:09-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/02 13:37:23-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/06/02 13:37:20-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/06/02 13:36:24-07:00 oliver@neukum.org 
#   [PATCH] USB: error handling of open of acm driver
#   
#   this adds error handling to the open method of the cdc acm driver.
#   The change set is relative to my last patch rewriting probe.
#     - add error handling to open method
#   
#   
#   Signed-off-by: Oliver Neukum <oliver@neukum.name>
#   Signed-off-by: Vojtech Pavlik <vojtech@suse.cz>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/class/cdc-acm.c
#   2004/05/31 06:54:36-07:00 oliver@neukum.org +23 -8
#   USB: error handling of open of acm driver
# 
# ChangeSet
#   2004/06/02 13:31:54-07:00 oliver@neukum.org 
#   [PATCH] USB: proper evaluation of the union descriptor for CDC ACM
#   
#   this changes acm_probe() to using the proper union descriptor.
#   It contains the workaround David suggested. Please apply.
#   
#     - fix probing to use cdc union descriptor
#   
#   Signed-off-by: Oliver Neukum <oliver@neukum.name>
#   Signed-off-by: Vojtech Pavlik <vojtech@suse.cz>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/class/cdc-acm.c
#   2004/05/30 03:56:45-07:00 oliver@neukum.org +100 -174
#   USB: proper evaluation of the union descriptor for CDC ACM
# 
# drivers/usb/class/cdc-acm.h
#   2004/05/30 03:56:45-07:00 oliver@neukum.org +114 -0
#   USB: proper evaluation of the union descriptor for CDC ACM
# 
# drivers/usb/class/cdc-acm.h
#   2004/05/30 03:56:45-07:00 oliver@neukum.org +0 -0
#   BitKeeper file /home/greg/linux/BK/usb-2.6/drivers/usb/class/cdc-acm.h
# 
# ChangeSet
#   2004/06/02 13:25:59-07:00 david-b@pacbell.net 
#   [PATCH] USB: usb retry cleanups
#   
#   This patch stops changing the reported fault mode in cases where retries of
#   GET_DESCRIPTOR fail because the device just doesn't have such a descriptor.
#   Plus, it stops printing messages when retrying.
#   
#   It also reduces the number of retries; the first retry seems to resolve most
#   of these firmware problems.
#   
#   Signed-Off-By:  David Brownell <dbrownell@users.sourceforge.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/core/message.c
#   2004/06/01 08:10:37-07:00 david-b@pacbell.net +1 -4
#   USB: usb retry cleanups
# 
# ChangeSet
#   2004/06/02 13:25:08-07:00 david-b@pacbell.net 
#   [PATCH] USB: pxa/rndis device descriptor
#   
#   This fixes a problem that all pxa2xx_udc g_ether devices
#   would run into.  They'd give the wrong descriptors, like:
#   
#   > --------msg1- usbview ----------
#   > Device Descriptor: bcdUSB:             0x0200
#   > bDeviceClass:         0xFF
#   > bDeviceSubClass:      0x00
#   > bDeviceProtocol:      0x00
#   > bMaxPacketSize0:      0x10 (16)
#   
#   Windows doesn't like RNDIS-supporting devices to point
#   out that they're really vendor-specific.  So this patch
#   makes sure they don't.
#   
#   Signed-off-by: David Brownell <dbrownelL@users.sourceforge.net>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/gadget/ether.c
#   2004/05/29 04:01:44-07:00 david-b@pacbell.net +10 -11
#   USB: pxa/rndis device descriptor
# 
# ChangeSet
#   2004/06/02 13:19:23-07:00 numlock@freesurf.ch 
#   [PATCH] Add support for ISD-300 controller
#   
#   This patch adds support in unusual_devs.h for the ISD-300 USB controller
#   used in CD-ROM enclosures.
#   
#   With it, since 2.6.0 it allowed me to move gigabytes of data and worked
#   without a hitch.
#   
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/storage/unusual_devs.h
#   2004/05/25 20:32:24-07:00 numlock@freesurf.ch +6 -0
#   Add support for ISD-300 controller
# 
# ChangeSet
#   2004/06/02 13:18:53-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: Fix disconnect bug in dummy_hcd
#   
#   Greg:
#   
#   This patch fixes a bug in disconnect handling for the dummy_hcd driver.
#   After a disconnect the driver would still accept URBs for endpoint 0,
#   leading to an oops.  It also improves the ad-hoc technique used by the
#   driver to track its gadget's struct usb_device and fixes the way
#   port-power changes are handled.  Please apply.
#   
#   Alan Stern
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/gadget/dummy_hcd.c
#   2004/05/17 10:12:20-07:00 stern@rowland.harvard.edu +11 -4
#   USB: Fix disconnect bug in dummy_hcd
# 
# ChangeSet
#   2004/06/02 13:18:15-07:00 stern@rowland.harvard.edu 
#   [PATCH] USB: unusual_devs.h update
#   
#   On Mon, 3 May 2004, zcat wrote:
#   
#   > I am trying to get my camera going as a webcam (concord EyeQ Duo in PC
#   > mode, not HDD mode) with the 2.6.4 kernel using the se401 driver
#   > (compiled in).. It logged the following message, which doesn't mean much
#   > to me so I have no idea if it's useful information or not;
#   >
#   > May  3 21:08:11 mrsnorris kernel: usb 1-1: new full speed USB device
#   > using address 2
#   > May  3 21:08:16 mrsnorris kernel: usb 1-1: control timeout on ep0out
#   > May  3 21:08:16 mrsnorris kernel: usb-storage: This device
#   > (0595,4343,0100 S 00 P 00) has an unneeded Protocol entry in unusual_devs.h
#   > May  3 21:08:16 mrsnorris kernel:    Please send a copy of this message
#   > to <linux-usb-devel@lists.sourceforge.net>
#   
#   This fixes the "unneeded Protocol entry" message.  We never solved the
#   control timeout problem.
#   
#   Alan Stern
#   
#   
#   Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
# 
# drivers/usb/storage/unusual_devs.h
#   2004/05/03 04:15:35-07:00 stern@rowland.harvard.edu +1 -1
#   USB: unusual_devs.h update
# 
# ChangeSet
#   2004/06/01 13:57:49-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# MAINTAINERS
#   2004/06/01 13:57:45-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/30 00:23:52-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# MAINTAINERS
#   2004/05/30 00:23:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# CREDITS
#   2004/05/30 00:23:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/28 17:18:45-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/05/28 17:18:42-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/28 14:16:41-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/input/hiddev.c
#   2004/05/28 14:16:37-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/28 14:15:52-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/05/28 14:15:49-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# MAINTAINERS
#   2004/05/28 14:15:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/25 13:48:31-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/input/hiddev.c
#   2004/05/25 13:48:27-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/05/25 13:48:27-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/message.c
#   2004/05/25 13:48:27-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/25 13:47:38-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# MAINTAINERS
#   2004/05/25 13:47:34-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/24 11:48:01-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/05/24 11:47:57-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/22 23:48:51-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/05/22 23:48:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# MAINTAINERS
#   2004/05/22 23:48:48-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/21 19:09:03-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# arch/ia64/defconfig
#   2004/05/21 19:09:00-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# MAINTAINERS
#   2004/05/21 19:09:00-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/19 18:31:55-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# MAINTAINERS
#   2004/05/19 18:31:52-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/19 00:07:04-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb.h
#   2004/05/19 00:07:01-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# include/linux/pci_ids.h
#   2004/05/19 00:07:01-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/05/19 00:07:01-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc/defconfig
#   2004/05/19 00:07:01-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc/configs/pmac_defconfig
#   2004/05/19 00:07:01-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc/configs/common_defconfig
#   2004/05/19 00:07:01-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/18 14:54:09-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb.h
#   2004/05/18 14:54:06-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# include/linux/pci_ids.h
#   2004/05/18 14:54:06-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/input/hid-core.c
#   2004/05/18 14:54:06-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/05/18 14:54:06-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# CREDITS
#   2004/05/18 14:54:06-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/16 01:52:25-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/05/16 01:52:22-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/14 21:45:47-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/05/14 21:45:43-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/14 09:41:12-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/input/hid-core.c
#   2004/05/14 09:41:09-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/05/14 09:41:09-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/message.c
#   2004/05/14 09:41:09-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/12 20:32:44-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/core/inode.c
#   2004/05/12 20:32:41-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# MAINTAINERS
#   2004/05/12 20:32:41-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/12 01:26:11-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/input/wacom.c
#   2004/05/12 01:26:08-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/input/hid-core.c
#   2004/05/12 01:26:08-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/12 01:25:17-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/05/12 01:25:14-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/parisc/configs/c3000_defconfig
#   2004/05/12 01:25:14-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# MAINTAINERS
#   2004/05/12 01:25:14-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/05 14:52:58-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/core/message.c
#   2004/05/05 14:52:55-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/05 14:52:11-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# CREDITS
#   2004/05/05 14:52:08-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/04 14:13:11-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb.h
#   2004/05/04 14:13:08-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/01 15:23:25-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# MAINTAINERS
#   2004/05/01 15:23:22-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/30 22:06:45-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/core/inode.c
#   2004/04/30 22:06:42-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/29 16:00:47-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/04/29 16:00:44-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# MAINTAINERS
#   2004/04/29 16:00:44-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/28 13:38:52-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/input/hid-core.c
#   2004/04/28 13:38:49-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/27 19:39:13-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb.h
#   2004/04/27 19:39:10-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/04/27 19:39:10-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/message.c
#   2004/04/27 19:39:10-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/26 18:31:48-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb.h
#   2004/04/26 18:31:45-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/04/26 18:31:45-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/25 23:06:05-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/04/25 23:06:02-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/24 23:51:05-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/core/usb.c
#   2004/04/24 23:51:02-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/23 12:58:38-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# CREDITS
#   2004/04/23 12:58:35-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/19 19:45:10-07:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/04/19 19:45:07-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# MAINTAINERS
#   2004/04/19 19:45:07-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# CREDITS
#   2004/04/19 19:45:06-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/07 20:17:13-07:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/core/message.c
#   2004/04/07 20:17:11-07:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/02 11:35:28-08:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# include/linux/pci_ids.h
#   2004/04/02 11:35:25-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/04/01 15:16:14-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# CREDITS
#   2004/04/01 15:16:11-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/31 19:24:39-08:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb.h
#   2004/03/31 19:24:37-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/03/31 19:24:37-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/message.c
#   2004/03/31 19:24:37-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc64/defconfig
#   2004/03/31 19:24:36-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc64/configs/pSeries_defconfig
#   2004/03/31 19:24:36-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc/defconfig
#   2004/03/31 19:24:36-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc/configs/pmac_defconfig
#   2004/03/31 19:24:36-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc/configs/common_defconfig
#   2004/03/31 19:24:36-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/parisc/configs/c3000_defconfig
#   2004/03/31 19:24:36-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ia64/defconfig
#   2004/03/31 19:24:36-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ia64/configs/zx1_defconfig
#   2004/03/31 19:24:36-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ia64/configs/generic_defconfig
#   2004/03/31 19:24:36-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/arm/configs/neponset_defconfig
#   2004/03/31 19:24:36-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/30 20:18:36-08:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# arch/ppc64/defconfig
#   2004/03/30 20:18:33-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc64/configs/pSeries_defconfig
#   2004/03/30 20:18:33-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc/defconfig
#   2004/03/30 20:18:33-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc/configs/pmac_defconfig
#   2004/03/30 20:18:33-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ppc/configs/common_defconfig
#   2004/03/30 20:18:33-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/parisc/configs/c3000_defconfig
#   2004/03/30 20:18:33-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ia64/defconfig
#   2004/03/30 20:18:33-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ia64/configs/zx1_defconfig
#   2004/03/30 20:18:33-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/ia64/configs/generic_defconfig
#   2004/03/30 20:18:33-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# arch/arm/configs/neponset_defconfig
#   2004/03/30 20:18:32-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/30 12:09:32-08:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb.h
#   2004/03/30 12:09:29-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/03/30 12:09:29-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/message.c
#   2004/03/30 12:09:29-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/29 18:05:43-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# MAINTAINERS
#   2004/03/29 18:05:41-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/29 13:51:58-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# CREDITS
#   2004/03/29 13:51:56-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/28 12:29:41-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/core/message.c
#   2004/03/28 12:29:38-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/27 02:28:18-08:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/input/wacom.c
#   2004/03/27 02:28:16-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/26 12:24:49-08:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb_gadget.h
#   2004/03/26 12:24:46-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/03/26 12:24:46-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/20 13:26:55-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# CREDITS
#   2004/03/20 13:26:53-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/16 21:53:42-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/input/wacom.c
#   2004/03/16 21:53:39-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/input/hid-core.c
#   2004/03/16 21:53:39-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/16 12:59:58-08:00 akpm@bix.(none) 
#   Merge bk://kernel.bkbits.net/gregkh/linux/usb-2.6
#   into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb_gadget.h
#   2004/03/16 12:59:47-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# include/linux/usb.h
#   2004/03/16 12:59:47-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/03/16 12:59:46-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# MAINTAINERS
#   2004/03/16 12:59:46-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# CREDITS
#   2004/03/16 12:59:46-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/16 12:58:57-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# drivers/usb/input/wacom.c
#   2004/03/16 12:58:47-08:00 akpm@bix.(none) +0 -4
#   Auto merged
# 
# drivers/usb/input/hid-core.c
#   2004/03/16 12:58:47-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# CREDITS
#   2004/03/16 12:58:46-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/14 11:03:00-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# include/linux/usb_gadget.h
#   2004/03/14 11:02:47-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# include/linux/usb.h
#   2004/03/14 11:02:47-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# drivers/usb/core/usb.c
#   2004/03/14 11:02:47-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# MAINTAINERS
#   2004/03/14 11:02:47-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/03/12 10:57:17-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-usb
# 
# MAINTAINERS
#   2004/03/12 10:57:02-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# CREDITS
#   2004/03/12 10:57:01-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
diff -Nru a/drivers/usb/Kconfig b/drivers/usb/Kconfig
--- a/drivers/usb/Kconfig	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/Kconfig	2004-06-08 22:03:37 -07:00
@@ -7,7 +7,7 @@
 # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
 config USB
 	tristate "Support for Host-side USB"
-	depends on PCI || SA1111 || ARCH_OMAP1510 || ARCH_OMAP1610
+	depends on PCI || SA1111 || ARCH_OMAP1510 || ARCH_OMAP1610 || ARCH_LH7A404
 	---help---
 	  Universal Serial Bus (USB) is a specification for a serial bus
 	  subsystem which offers higher speeds and more features than the
diff -Nru a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
--- a/drivers/usb/class/cdc-acm.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/class/cdc-acm.c	2004-06-08 22:03:37 -07:00
@@ -27,6 +27,7 @@
  *	v0.22 - probe only the control interface. if usbcore doesn't choose the
  *		config we want, sysadmin changes bConfigurationValue in sysfs.
  *	v0.23 - use softirq for rx processing, as needed by tty layer
+ *	v0.24 - change probe method to evaluate CDC union descriptor
  */
 
 /*
@@ -60,6 +61,8 @@
 #include <linux/usb.h>
 #include <asm/byteorder.h>
 
+#include "cdc-acm.h"
+
 /*
  * Version Information
  */
@@ -67,102 +70,12 @@
 #define DRIVER_AUTHOR "Armin Fuerst, Pavel Machek, Johannes Erdfelt, Vojtech Pavlik"
 #define DRIVER_DESC "USB Abstract Control Model driver for USB modems and ISDN adapters"
 
-/*
- * CMSPAR, some architectures can't have space and mark parity.
- */
-
-#ifndef CMSPAR
-#define CMSPAR			0
-#endif
-
-/*
- * Major and minor numbers.
- */
-
-#define ACM_TTY_MAJOR		166
-#define ACM_TTY_MINORS		32
-
-/*
- * Requests.
- */
-
-#define USB_RT_ACM		(USB_TYPE_CLASS | USB_RECIP_INTERFACE)
-
-#define ACM_REQ_COMMAND		0x00
-#define ACM_REQ_RESPONSE	0x01
-#define ACM_REQ_SET_FEATURE	0x02
-#define ACM_REQ_GET_FEATURE	0x03
-#define ACM_REQ_CLEAR_FEATURE	0x04
-
-#define ACM_REQ_SET_LINE	0x20
-#define ACM_REQ_GET_LINE	0x21
-#define ACM_REQ_SET_CONTROL	0x22
-#define ACM_REQ_SEND_BREAK	0x23
-
-/*
- * IRQs.
- */
-
-#define ACM_IRQ_NETWORK		0x00
-#define ACM_IRQ_LINE_STATE	0x20
-
-/*
- * Output control lines.
- */
-
-#define ACM_CTRL_DTR		0x01
-#define ACM_CTRL_RTS		0x02
-
-/*
- * Input control lines and line errors.
- */
-
-#define ACM_CTRL_DCD		0x01
-#define ACM_CTRL_DSR		0x02
-#define ACM_CTRL_BRK		0x04
-#define ACM_CTRL_RI		0x08
-
-#define ACM_CTRL_FRAMING	0x10
-#define ACM_CTRL_PARITY		0x20
-#define ACM_CTRL_OVERRUN	0x40
-
-/*
- * Line speed and caracter encoding.
- */
-
-struct acm_line {
-	__u32 speed;
-	__u8 stopbits;
-	__u8 parity;
-	__u8 databits;
-} __attribute__ ((packed));
-
-/*
- * Internal driver structures.
- */
-
-struct acm {
-	struct usb_device *dev;				/* the corresponding usb device */
-	struct usb_interface *control;			/* control interface */
-	struct usb_interface *data;			/* data interface */
-	struct tty_struct *tty;				/* the corresponding tty */
-	struct urb *ctrlurb, *readurb, *writeurb;	/* urbs */
-	struct acm_line line;				/* line coding (bits, stop, parity) */
-	struct work_struct work;			/* work queue entry for line discipline waking up */
-	struct tasklet_struct bh;			/* rx processing */
-	unsigned int ctrlin;				/* input control lines (DCD, DSR, RI, break, overruns) */
-	unsigned int ctrlout;				/* output control lines (DTR, RTS) */
-	unsigned int writesize;				/* max packet size for the output bulk endpoint */
-	unsigned int used;				/* someone has this acm's device open */
-	unsigned int minor;				/* acm minor number */
-	unsigned char throttle;				/* throttled by tty layer */
-	unsigned char clocal;				/* termios CLOCAL */
-};
-
 static struct usb_driver acm_driver;
 static struct tty_driver *acm_tty_driver;
 static struct acm *acm_table[ACM_TTY_MINORS];
 
+static DECLARE_MUTEX(open_sem);
+
 #define ACM_READY(acm)	(acm && acm->dev && acm->used)
 
 /*
@@ -310,12 +223,14 @@
 	struct acm *acm = (struct acm *)urb->context;
 
 	if (!ACM_READY(acm))
-		return;
+		goto out;
 
 	if (urb->status)
 		dbg("nonzero write bulk status received: %d", urb->status);
 
 	schedule_work(&acm->work);
+out:
+	acm->ready_for_write = 1;
 }
 
 static void acm_softint(void *private)
@@ -346,22 +261,23 @@
 	tty->driver_data = acm;
 	acm->tty = tty;
 
-        lock_kernel();
+        down(&open_sem);
 
-	if (acm->used++) {
-                unlock_kernel();
-                return 0;
+	if (acm->used) {
+		goto done;
         }
 
-        unlock_kernel();
-
 	acm->ctrlurb->dev = acm->dev;
-	if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL))
+	if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) {
 		dbg("usb_submit_urb(ctrl irq) failed");
+		goto bail_out;
+	}
 
 	acm->readurb->dev = acm->dev;
-	if (usb_submit_urb(acm->readurb, GFP_KERNEL))
+	if (usb_submit_urb(acm->readurb, GFP_KERNEL)) {
 		dbg("usb_submit_urb(read bulk) failed");
+		goto bail_out_and_unlink;
+	}
 
 	acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS);
 
@@ -369,7 +285,16 @@
 	   otherwise it is scheduled, and with high data rates data can get lost. */
 	tty->low_latency = 1;
 
+done:
+	acm->used++;
+	up(&open_sem);
 	return 0;
+
+bail_out_and_unlink:
+	usb_unlink_urb(acm->ctrlurb);
+bail_out:
+	up(&open_sem);
+	return -EIO;
 }
 
 static void acm_tty_close(struct tty_struct *tty, struct file *filp)
@@ -379,6 +304,7 @@
 	if (!acm || !acm->used)
 		return;
 
+	down(&open_sem);
 	if (!--acm->used) {
 		if (acm->dev) {
 			acm_set_control(acm, acm->ctrlout = 0);
@@ -394,6 +320,7 @@
 			kfree(acm);
 		}
 	}
+	up(&open_sem);
 }
 
 static int acm_tty_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count)
@@ -403,7 +330,7 @@
 
 	if (!ACM_READY(acm))
 		return -EINVAL;
-	if (acm->writeurb->status == -EINPROGRESS)
+	if (!acm->ready_for_write)
 		return 0;
 	if (!count)
 		return 0;
@@ -419,10 +346,11 @@
 	acm->writeurb->transfer_buffer_length = count;
 	acm->writeurb->dev = acm->dev;
 
-	/* GFP_KERNEL probably works if from_user */
-	stat = usb_submit_urb(acm->writeurb, GFP_ATOMIC);
+	acm->ready_for_write = 0;
+	stat = usb_submit_urb(acm->writeurb, GFP_NOIO);
 	if (stat < 0) {
 		dbg("usb_submit_urb(write bulk) failed");
+		acm->ready_for_write = 1;
 		return stat;
 	}
 
@@ -434,7 +362,7 @@
 	struct acm *acm = tty->driver_data;
 	if (!ACM_READY(acm))
 		return -EINVAL;
-	return acm->writeurb->status == -EINPROGRESS ? 0 : acm->writesize;
+	return !acm->ready_for_write ? 0 : acm->writesize;
 }
 
 static int acm_tty_chars_in_buffer(struct tty_struct *tty)
@@ -442,7 +370,7 @@
 	struct acm *acm = tty->driver_data;
 	if (!ACM_READY(acm))
 		return -EINVAL;
-	return acm->writeurb->status == -EINPROGRESS ? acm->writeurb->transfer_buffer_length : 0;
+	return !acm->ready_for_write ? acm->writeurb->transfer_buffer_length : 0;
 }
 
 static void acm_tty_throttle(struct tty_struct *tty)
@@ -567,77 +495,102 @@
  * USB probe and disconnect routines.
  */
 
-#define CHECK_XFERTYPE(descr, xfer_type) (((descr)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == xfer_type)
-			
 static int acm_probe (struct usb_interface *intf,
 		      const struct usb_device_id *id)
 {
-	struct usb_device *dev;
+	struct union_desc *union_header = NULL;
+	char *buffer = intf->altsetting->extra;
+	int buflen = intf->altsetting->extralen;
+	struct usb_interface *control_interface;
+	struct usb_interface *data_interface;
+	struct usb_endpoint_descriptor *epctrl;
+	struct usb_endpoint_descriptor *epread;
+	struct usb_endpoint_descriptor *epwrite;
+	struct usb_device *usb_dev = interface_to_usbdev(intf);
 	struct acm *acm;
-	struct usb_host_config *cfacm;
-	struct usb_interface *data = NULL;
-	struct usb_host_interface *ifcom, *ifdata = NULL;
-	struct usb_endpoint_descriptor *epctrl = NULL;
-	struct usb_endpoint_descriptor *epread = NULL;
-	struct usb_endpoint_descriptor *epwrite = NULL;
-	int readsize, ctrlsize, minor, j;
-	unsigned char *buf;
-
-	dev = interface_to_usbdev (intf);
-
-	cfacm = dev->actconfig;
-
-	/* We know we're probe()d with the control interface. */
-	ifcom = intf->cur_altsetting;
-
-	/* ACM doesn't guarantee the data interface is
-	 * adjacent to the control interface, or that if one
-	 * is there it's not for call management ... so find
-	 * it
-	 */
-	for (j = 0; j < cfacm->desc.bNumInterfaces; j++) {
-		ifdata = cfacm->interface[j]->cur_altsetting;
-		data = cfacm->interface[j];
-
-		if (ifdata->desc.bInterfaceClass == USB_CLASS_CDC_DATA
-		    && ifdata->desc.bNumEndpoints == 2) {
-			
-			epctrl = &ifcom->endpoint[0].desc;
-			epread = &ifdata->endpoint[0].desc;
-			epwrite = &ifdata->endpoint[1].desc;
-
-			if ((epctrl->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN
-			    || !CHECK_XFERTYPE(epctrl,  USB_ENDPOINT_XFER_INT)
-			    || !CHECK_XFERTYPE(epread,  USB_ENDPOINT_XFER_BULK)
-			    || !CHECK_XFERTYPE(epwrite, USB_ENDPOINT_XFER_BULK)
-			    || ((epread->bEndpointAddress & USB_DIR_IN)
-			        ^ (epwrite->bEndpointAddress & USB_DIR_IN)) != USB_DIR_IN) {
-				/* not suitable */
-				goto next_interface;
-			}
-			
-			if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) {
-				/* descriptors are swapped */
-				epread = &ifdata->endpoint[1].desc;
-				epwrite = &ifdata->endpoint[0].desc;
-			}
-			dev_dbg(&intf->dev, "found data interface at %d\n", j);
-			break;
-		} else {
-next_interface:
-			ifdata = NULL;
-			data = NULL;
+	int minor;
+	int ctrlsize,readsize;
+	char *buf;
+
+	if (!buffer) {
+		err("Wierd descriptor references");
+		return -EINVAL;
+	}
+
+	while (buflen > 0) {
+		if (buffer [1] != USB_DT_CS_INTERFACE) {
+			err("skipping garbage");
+			goto next_desc;
 		}
+
+		switch (buffer [2]) {
+			case CDC_UNION_TYPE: /* we've found it */
+				if (union_header) {
+					err("More than one union descriptor, skipping ...");
+					goto next_desc;
+				}
+				union_header = (struct union_desc *)buffer;
+				break;
+			default:
+				err("Ignoring extra header");
+				break;
+			}
+next_desc:
+		buflen -= buffer[0];
+		buffer += buffer[0];
 	}
 
-	/* there's been a problem */
-	if (!ifdata) {
-		dev_dbg(&intf->dev, "data interface not found\n");
+	if (!union_header) {
+		dev_dbg(&intf->dev,"No union descriptor, giving up\n");
 		return -ENODEV;
+	}
 
+	control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0);
+	data_interface = usb_ifnum_to_if(usb_dev, union_header->bSlaveInterface0);
+	if (!control_interface || !data_interface) {
+		dev_dbg(&intf->dev,"no interfaces\n");
+		return -ENODEV;
+	}
+
+	if (usb_interface_claimed(data_interface)) { /* valid in this context */
+		dev_dbg(&intf->dev,"The data interface isn't available\n");
+		return -EBUSY;
 	}
 
+	/*workaround for switched interfaces */
+	if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) {
+		if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) {
+			struct usb_interface *t;
+			dev_dbg(&intf->dev,"Your device has switched interfaces.\n");
+
+			t = control_interface;
+			control_interface = data_interface;
+			data_interface = t;
+		} else {
+			return -EINVAL;
+		}
+	}
+	if (data_interface->cur_altsetting->desc.bNumEndpoints < 2)
+		return -EINVAL;
+
+	epctrl = &control_interface->cur_altsetting->endpoint[0].desc;
+	epread = &data_interface->cur_altsetting->endpoint[0].desc;
+	epwrite = &data_interface->cur_altsetting->endpoint[1].desc;
+
+
+	/* workaround for switched endpoints */
+	if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) {
+		/* descriptors are swapped */
+		struct usb_endpoint_descriptor *t;
+		dev_dbg(&intf->dev,"The data interface has switched endpoints\n");
+		
+		t = epread;
+		epread = epwrite;
+		epwrite = t;
+	}
+	dbg("interfaces are valid");
 	for (minor = 0; minor < ACM_TTY_MINORS && acm_table[minor]; minor++);
+
 	if (acm_table[minor]) {
 		err("no more free acm devices");
 		return -ENODEV;
@@ -647,20 +600,21 @@
 		dev_dbg(&intf->dev, "out of memory (acm kmalloc)\n");
 		return -ENOMEM;
 	}
-	
 	memset(acm, 0, sizeof(struct acm));
 
 	ctrlsize = epctrl->wMaxPacketSize;
 	readsize = epread->wMaxPacketSize;
 	acm->writesize = epwrite->wMaxPacketSize;
-	acm->control = intf;
-	acm->data = data;
+	acm->control = control_interface;
+	acm->data = data_interface;
 	acm->minor = minor;
-	acm->dev = dev;
+	acm->dev = usb_dev;
 
 	acm->bh.func = acm_rx_tasklet;
 	acm->bh.data = (unsigned long) acm;
 	INIT_WORK(&acm->work, acm_softint, acm);
+	acm->ready_for_write = 1;
+
 
 	if (!(buf = kmalloc(ctrlsize + readsize + acm->writesize, GFP_KERNEL))) {
 		dev_dbg(&intf->dev, "out of memory (buf kmalloc)\n");
@@ -693,29 +647,17 @@
 		return -ENOMEM;
 	}
 
-	usb_fill_int_urb(acm->ctrlurb, dev, usb_rcvintpipe(dev, epctrl->bEndpointAddress),
-		buf, ctrlsize, acm_ctrl_irq, acm, epctrl->bInterval);
+	usb_fill_int_urb(acm->ctrlurb, usb_dev, usb_rcvintpipe(usb_dev, epctrl->bEndpointAddress),
+			 buf, ctrlsize, acm_ctrl_irq, acm, epctrl->bInterval);
 
-	usb_fill_bulk_urb(acm->readurb, dev, usb_rcvbulkpipe(dev, epread->bEndpointAddress),
-		buf += ctrlsize, readsize, acm_read_bulk, acm);
+	usb_fill_bulk_urb(acm->readurb, usb_dev, usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress),
+			  buf += ctrlsize, readsize, acm_read_bulk, acm);
 	acm->readurb->transfer_flags |= URB_NO_FSBR;
 
-	usb_fill_bulk_urb(acm->writeurb, dev, usb_sndbulkpipe(dev, epwrite->bEndpointAddress),
-		buf += readsize, acm->writesize, acm_write_bulk, acm);
+	usb_fill_bulk_urb(acm->writeurb, usb_dev, usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress),
+			  buf += readsize, acm->writesize, acm_write_bulk, acm);
 	acm->writeurb->transfer_flags |= URB_NO_FSBR;
 
-	if ( (j = usb_driver_claim_interface(&acm_driver, data, acm)) != 0) {
-		err("claim failed");
-		usb_free_urb(acm->ctrlurb);
-		usb_free_urb(acm->readurb);
-		usb_free_urb(acm->writeurb);
-		kfree(acm);
-		kfree(buf);
-		return j;
-	} 
-
-	tty_register_device(acm_tty_driver, minor, &intf->dev);
-
 	dev_info(&intf->dev, "ttyACM%d: USB ACM device\n", minor);
 
 	acm_set_control(acm, acm->ctrlout);
@@ -724,11 +666,14 @@
 	acm->line.databits = 8;
 	acm_set_line(acm, &acm->line);
 
+	usb_driver_claim_interface(&acm_driver, data_interface, acm);
+
+	tty_register_device(acm_tty_driver, minor, &intf->dev);
+
 	acm_table[minor] = acm;
 	usb_set_intfdata (intf, acm);
 	return 0;
 }
-#undef CHECK_XFERTYPE
 
 static void acm_disconnect(struct usb_interface *intf)
 {
@@ -745,6 +690,8 @@
 	usb_unlink_urb(acm->ctrlurb);
 	usb_unlink_urb(acm->readurb);
 	usb_unlink_urb(acm->writeurb);
+
+	flush_scheduled_work(); /* wait for acm_softint */
 
 	kfree(acm->ctrlurb->transfer_buffer);
 
diff -Nru a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/class/cdc-acm.h	2004-06-08 22:03:37 -07:00
@@ -0,0 +1,115 @@
+/*
+ *
+ * Includes for cdc-acm.c
+ *
+ * Mainly take from usbnet's cdc-ether part
+ *
+ */
+
+/*
+ * CMSPAR, some architectures can't have space and mark parity.
+ */
+
+#ifndef CMSPAR
+#define CMSPAR			0
+#endif
+
+/*
+ * Major and minor numbers.
+ */
+
+#define ACM_TTY_MAJOR		166
+#define ACM_TTY_MINORS		32
+
+/*
+ * Requests.
+ */
+
+#define USB_RT_ACM		(USB_TYPE_CLASS | USB_RECIP_INTERFACE)
+
+#define ACM_REQ_COMMAND		0x00
+#define ACM_REQ_RESPONSE	0x01
+#define ACM_REQ_SET_FEATURE	0x02
+#define ACM_REQ_GET_FEATURE	0x03
+#define ACM_REQ_CLEAR_FEATURE	0x04
+
+#define ACM_REQ_SET_LINE	0x20
+#define ACM_REQ_GET_LINE	0x21
+#define ACM_REQ_SET_CONTROL	0x22
+#define ACM_REQ_SEND_BREAK	0x23
+
+/*
+ * IRQs.
+ */
+
+#define ACM_IRQ_NETWORK		0x00
+#define ACM_IRQ_LINE_STATE	0x20
+
+/*
+ * Output control lines.
+ */
+
+#define ACM_CTRL_DTR		0x01
+#define ACM_CTRL_RTS		0x02
+
+/*
+ * Input control lines and line errors.
+ */
+
+#define ACM_CTRL_DCD		0x01
+#define ACM_CTRL_DSR		0x02
+#define ACM_CTRL_BRK		0x04
+#define ACM_CTRL_RI		0x08
+
+#define ACM_CTRL_FRAMING	0x10
+#define ACM_CTRL_PARITY		0x20
+#define ACM_CTRL_OVERRUN	0x40
+
+/*
+ * Line speed and caracter encoding.
+ */
+
+struct acm_line {
+	__u32 speed;
+	__u8 stopbits;
+	__u8 parity;
+	__u8 databits;
+} __attribute__ ((packed));
+
+/*
+ * Internal driver structures.
+ */
+
+struct acm {
+	struct usb_device *dev;				/* the corresponding usb device */
+	struct usb_interface *control;			/* control interface */
+	struct usb_interface *data;			/* data interface */
+	struct tty_struct *tty;				/* the corresponding tty */
+	struct urb *ctrlurb, *readurb, *writeurb;	/* urbs */
+	struct acm_line line;				/* line coding (bits, stop, parity) */
+	struct work_struct work;			/* work queue entry for line discipline waking up */
+	struct tasklet_struct bh;			/* rx processing */
+	unsigned int ctrlin;				/* input control lines (DCD, DSR, RI, break, overruns) */
+	unsigned int ctrlout;				/* output control lines (DTR, RTS) */
+	unsigned int writesize;				/* max packet size for the output bulk endpoint */
+	unsigned int used;				/* someone has this acm's device open */
+	unsigned int minor;				/* acm minor number */
+	unsigned char throttle;				/* throttled by tty layer */
+	unsigned char clocal;				/* termios CLOCAL */
+	unsigned char ready_for_write;			/* write urb can be used */
+};
+
+/* "Union Functional Descriptor" from CDC spec 5.2.3.X */
+struct union_desc {
+	u8	bLength;
+	u8	bDescriptorType;
+	u8	bDescriptorSubType;
+
+	u8	bMasterInterface0;
+	u8	bSlaveInterface0;
+	/* ... and there could be other slave interfaces */
+} __attribute__ ((packed));
+
+#define CDC_UNION_TYPE		0x06
+#define CDC_DATA_INTERFACE_TYPE	0x0a
+
diff -Nru a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
--- a/drivers/usb/class/usblp.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/class/usblp.c	2004-06-08 22:03:37 -07:00
@@ -761,6 +761,7 @@
 			usblp->minor, usblp->readurb->status);
 		usblp->readurb->dev = usblp->dev;
  		usblp->readcount = 0;
+		usblp->rcomplete = 0;
 		if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0)
 			dbg("error submitting urb");
 		count = -EIO;
diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/core/hcd.c	2004-06-08 22:03:37 -07:00
@@ -787,14 +787,12 @@
 		return (retval < 0) ? retval : -EMSGSIZE;
 	}
 
-	(void) usb_get_dev (usb_dev);
 	down (&usb_dev->serialize);
 	retval = usb_new_device (usb_dev);
+	up (&usb_dev->serialize);
 	if (retval)
 		dev_err (parent_dev, "can't register root hub for %s, %d\n",
 				usb_dev->dev.bus_id, retval);
-	up (&usb_dev->serialize);
-	usb_put_dev (usb_dev);
 	return retval;
 }
 EXPORT_SYMBOL (usb_register_root_hub);
diff -Nru a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
--- a/drivers/usb/core/hcd.h	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/core/hcd.h	2004-06-08 22:03:37 -07:00
@@ -244,16 +244,9 @@
 					struct usb_bus *, unsigned port);
 extern int usb_new_device(struct usb_device *dev);
 extern void usb_disconnect(struct usb_device **);
-extern void usb_choose_address(struct usb_device *dev);
-extern void usb_release_address(struct usb_device *dev);
 
-/* exported to hub driver ONLY to support usb_reset_device () */
 extern int usb_get_configuration(struct usb_device *dev);
 extern void usb_destroy_configuration(struct usb_device *dev);
-
-/* use these only before the device's address has been set */
-#define usb_snddefctrl(dev)		((PIPE_CONTROL << 30))
-#define usb_rcvdefctrl(dev)		((PIPE_CONTROL << 30) | USB_DIR_IN)
 
 /*-------------------------------------------------------------------------*/
 
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/core/hub.c	2004-06-08 22:03:37 -07:00
@@ -9,6 +9,11 @@
  */
 
 #include <linux/config.h>
+#ifdef CONFIG_USB_DEBUG
+	#define DEBUG
+#else
+	#undef DEBUG
+#endif
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/module.h>
@@ -19,11 +24,6 @@
 #include <linux/slab.h>
 #include <linux/smp_lock.h>
 #include <linux/ioctl.h>
-#ifdef CONFIG_USB_DEBUG
-	#define DEBUG
-#else
-	#undef DEBUG
-#endif
 #include <linux/usb.h>
 #include <linux/usbdevice_fs.h>
 #include <linux/suspend.h>
@@ -40,7 +40,6 @@
 static spinlock_t hub_event_lock = SPIN_LOCK_UNLOCKED;
 
 static LIST_HEAD(hub_event_list);	/* List of hubs needing servicing */
-static LIST_HEAD(hub_list);		/* List of all hubs (for cleanup) */
 
 static DECLARE_WAIT_QUEUE_HEAD(khubd_wait);
 static pid_t khubd_pid = 0;			/* PID of khubd */
@@ -268,7 +267,7 @@
 	if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0
 			/* ENODEV means we raced disconnect() */
 			&& status != -ENODEV)
-		dev_err (&hub->intf->dev, "resubmit --> %d\n", urb->status);
+		dev_err (&hub->intf->dev, "resubmit --> %d\n", status);
 	if (status == 0)
 		hub->urb_active = 1;
 done:
@@ -646,7 +645,6 @@
 
 	/* Delete it and then reset it */
 	list_del_init(&hub->event_list);
-	list_del_init(&hub->hub_list);
 
 	spin_unlock_irqrestore(&hub_event_lock, flags);
 
@@ -695,7 +693,6 @@
 	struct usb_device *hdev;
 	struct usb_hub *hub;
 	struct device *hub_dev;
-	unsigned long flags;
 
 	desc = intf->cur_altsetting;
 	hdev = interface_to_usbdev(intf);
@@ -711,23 +708,19 @@
 	}
 
 	/* Multiple endpoints? What kind of mutant ninja-hub is this? */
-	if (desc->desc.bNumEndpoints != 1) {
+	if (desc->desc.bNumEndpoints != 1)
 		goto descriptor_error;
-	}
 
 	endpoint = &desc->endpoint[0].desc;
 
 	/* Output endpoint? Curiouser and curiouser.. */
-	if (!(endpoint->bEndpointAddress & USB_DIR_IN)) {
+	if (!(endpoint->bEndpointAddress & USB_DIR_IN))
 		goto descriptor_error;
-	}
 
 	/* If it's not an interrupt endpoint, we'd better punt! */
 	if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
-			!= USB_ENDPOINT_XFER_INT) {
+			!= USB_ENDPOINT_XFER_INT)
 		goto descriptor_error;
-		return -EIO;
-	}
 
 	/* We found a hub */
 	dev_info (hub_dev, "USB hub found\n");
@@ -745,12 +738,6 @@
 	init_MUTEX(&hub->khubd_sem);
 	INIT_WORK(&hub->leds, led_work, hub);
 
-	/* Record the new hub's existence */
-	spin_lock_irqsave(&hub_event_lock, flags);
-	INIT_LIST_HEAD(&hub->hub_list);
-	list_add(&hub->hub_list, &hub_list);
-	spin_unlock_irqrestore(&hub_event_lock, flags);
-
 	usb_set_intfdata (intf, hub);
 
 	if (hdev->speed == USB_SPEED_HIGH)
@@ -845,6 +832,233 @@
 	dev_err(&hdev->dev, "cannot disconnect hub!\n");
 }
 
+
+static void choose_address(struct usb_device *udev)
+{
+	int		devnum;
+	struct usb_bus	*bus = udev->bus;
+
+	/* If khubd ever becomes multithreaded, this will need a lock */
+
+	/* Try to allocate the next devnum beginning at bus->devnum_next. */
+	devnum = find_next_zero_bit(bus->devmap.devicemap, 128,
+			bus->devnum_next);
+	if (devnum >= 128)
+		devnum = find_next_zero_bit(bus->devmap.devicemap, 128, 1);
+
+	bus->devnum_next = ( devnum >= 127 ? 1 : devnum + 1);
+
+	if (devnum < 128) {
+		set_bit(devnum, bus->devmap.devicemap);
+		udev->devnum = devnum;
+	}
+}
+
+static void release_address(struct usb_device *udev)
+{
+	if (udev->devnum > 0) {
+		clear_bit(udev->devnum, udev->bus->devmap.devicemap);
+		udev->devnum = -1;
+	}
+}
+
+/**
+ * usb_disconnect - disconnect a device (usbcore-internal)
+ * @pdev: pointer to device being disconnected
+ * Context: !in_interrupt ()
+ *
+ * Something got disconnected. Get rid of it, and all of its children.
+ *
+ * Only hub drivers (including virtual root hub drivers for host
+ * controllers) should ever call this.
+ *
+ * This call is synchronous, and may not be used in an interrupt context.
+ */
+void usb_disconnect(struct usb_device **pdev)
+{
+	struct usb_device	*udev = *pdev;
+	struct usb_bus		*bus;
+	struct usb_operations	*ops;
+	int			i;
+
+	if (!udev) {
+		pr_debug ("%s nodev\n", __FUNCTION__);
+		return;
+	}
+	bus = udev->bus;
+	if (!bus) {
+		pr_debug ("%s nobus\n", __FUNCTION__);
+		return;
+	}
+	ops = bus->op;
+
+	*pdev = NULL;
+
+	/* mark the device as inactive, so any further urb submissions for
+	 * this device will fail.
+	 */
+	udev->state = USB_STATE_NOTATTACHED;
+	down(&udev->serialize);
+
+	dev_info (&udev->dev, "USB disconnect, address %d\n", udev->devnum);
+
+	/* Free up all the children before we remove this device */
+	for (i = 0; i < USB_MAXCHILDREN; i++) {
+		struct usb_device **child = udev->children + i;
+		if (*child)
+			usb_disconnect(child);
+	}
+
+	/* deallocate hcd/hardware state ... nuking all pending urbs and
+	 * cleaning up all state associated with the current configuration
+	 */
+	usb_disable_device(udev, 0);
+
+	/* Free the device number and remove the /proc/bus/usb entry */
+	dev_dbg (&udev->dev, "unregistering device\n");
+	release_address(udev);
+	usbfs_remove_device(udev);
+	up(&udev->serialize);
+	usb_remove_sysfs_dev_files(udev);
+	device_unregister(&udev->dev);
+}
+
+static int choose_configuration(struct usb_device *udev)
+{
+	int c, i;
+
+	/* NOTE: this should interact with hub power budgeting */
+
+	c = udev->config[0].desc.bConfigurationValue;
+	if (udev->descriptor.bNumConfigurations != 1) {
+		for (i = 0; i < udev->descriptor.bNumConfigurations; i++) {
+			struct usb_interface_descriptor	*desc;
+
+			/* heuristic:  Linux is more likely to have class
+			 * drivers, so avoid vendor-specific interfaces.
+			 */
+			desc = &udev->config[i].intf_cache[0]
+					->altsetting->desc;
+			if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC)
+				continue;
+			/* COMM/2/all is CDC ACM, except 0xff is MSFT RNDIS */
+			if (desc->bInterfaceClass == USB_CLASS_COMM
+					&& desc->bInterfaceSubClass == 2
+					&& desc->bInterfaceProtocol == 0xff)
+				continue;
+			c = udev->config[i].desc.bConfigurationValue;
+			break;
+		}
+		dev_info(&udev->dev,
+			"configuration #%d chosen from %d choices\n",
+			c, udev->descriptor.bNumConfigurations);
+	}
+	return c;
+}
+
+#ifdef DEBUG
+static void show_string(struct usb_device *udev, char *id, int index)
+{
+	char *buf;
+
+	if (!index)
+		return;
+	if (!(buf = kmalloc(256, GFP_KERNEL)))
+		return;
+	if (usb_string(udev, index, buf, 256) > 0)
+		dev_printk(KERN_INFO, &udev->dev, "%s: %s\n", id, buf);
+	kfree(buf);
+}
+
+#else
+static inline void show_string(struct usb_device *udev, char *id, int index)
+{}
+#endif
+
+/*
+ * usb_new_device - perform initial device setup (usbcore-internal)
+ * @dev: newly addressed device (in ADDRESS state)
+ *
+ * This is called with devices which have been enumerated, but not yet
+ * configured.  The device descriptor is available, but not descriptors
+ * for any device configuration.  The caller owns dev->serialize, and
+ * the device is not visible through sysfs or other filesystem code.
+ *
+ * Returns 0 for success (device is configured and listed, with its
+ * interfaces, in sysfs); else a negative errno value.  On error, one
+ * reference count to the device has been dropped.
+ *
+ * This call is synchronous, and may not be used in an interrupt context.
+ *
+ * Only the hub driver should ever call this; root hub registration
+ * uses it only indirectly.
+ */
+int usb_new_device(struct usb_device *udev)
+{
+	int err;
+	int c;
+
+	err = usb_get_configuration(udev);
+	if (err < 0) {
+		dev_err(&udev->dev, "can't read configurations, error %d\n",
+			err);
+		goto fail;
+	}
+
+	/* Tell the world! */
+	dev_dbg(&udev->dev, "new device strings: Mfr=%d, Product=%d, "
+			"SerialNumber=%d\n",
+			udev->descriptor.iManufacturer,
+			udev->descriptor.iProduct,
+			udev->descriptor.iSerialNumber);
+
+	if (udev->descriptor.iProduct)
+		show_string(udev, "Product",
+				udev->descriptor.iProduct);
+	if (udev->descriptor.iManufacturer)
+		show_string(udev, "Manufacturer",
+				udev->descriptor.iManufacturer);
+	if (udev->descriptor.iSerialNumber)
+		show_string(udev, "SerialNumber",
+				udev->descriptor.iSerialNumber);
+
+	/* put device-specific files into sysfs */
+	err = device_add (&udev->dev);
+	if (err) {
+		dev_err(&udev->dev, "can't device_add, error %d\n", err);
+		goto fail;
+	}
+	usb_create_sysfs_dev_files (udev);
+
+	/* choose and set the configuration. that registers the interfaces
+	 * with the driver core, and lets usb device drivers bind to them.
+	 */
+	c = choose_configuration(udev);
+	if (c < 0)
+		dev_warn(&udev->dev,
+				"can't choose an initial configuration\n");
+	else {
+		err = usb_set_configuration(udev, c);
+		if (err) {
+			dev_err(&udev->dev, "can't set config #%d, error %d\n",
+					c, err);
+			device_del(&udev->dev);
+			goto fail;
+		}
+	}
+
+	/* USB device state == configured ... usable */
+
+	/* add a /proc/bus/usb entry */
+	usbfs_add_device(udev);
+	return 0;
+
+fail:
+	udev->state = USB_STATE_NOTATTACHED;
+	return err;
+}
+
+
 static int hub_port_status(struct usb_device *hdev, int port,
 			       u16 *status, u16 *change)
 {
@@ -934,10 +1148,14 @@
 
 	/* Reset the port */
 	for (i = 0; i < PORT_RESET_TRIES; i++) {
-		set_port_feature(hdev, port + 1, USB_PORT_FEAT_RESET);
+		status = set_port_feature(hdev, port + 1, USB_PORT_FEAT_RESET);
+		if (status)
+			dev_err(hub_dev, "cannot reset port %d (err = %d)\n",
+					port + 1, status);
+		else
+			status = hub_port_wait_reset(hdev, port, udev, delay);
 
 		/* return on disconnect or reset */
-		status = hub_port_wait_reset(hdev, port, udev, delay);
 		if (status == -ENOTCONN || status == 0) {
 			clear_port_feature(hdev,
 				port + 1, USB_PORT_FEAT_C_RESET);
@@ -975,57 +1193,62 @@
 /* USB 2.0 spec, 7.1.7.3 / fig 7-29:
  *
  * Between connect detection and reset signaling there must be a delay
- * of 100ms at least for debounce and power-settling. The corresponding
+ * of 100ms at least for debounce and power-settling.  The corresponding
  * timer shall restart whenever the downstream port detects a disconnect.
  * 
- * Apparently there are some bluetooth and irda-dongles and a number
- * of low-speed devices which require longer delays of about 200-400ms.
+ * Apparently there are some bluetooth and irda-dongles and a number of
+ * low-speed devices for which this debounce period may last over a second.
  * Not covered by the spec - but easy to deal with.
  *
- * This implementation uses 400ms minimum debounce timeout and checks
- * every 25ms for transient disconnects to restart the delay.
+ * This implementation uses a 1500ms total debounce timeout; if the
+ * connection isn't stable by then it returns -ETIMEDOUT.  It checks
+ * every 25ms for transient disconnects.  When the port status has been
+ * unchanged for 100ms it returns the port status.
  */
 
-#define HUB_DEBOUNCE_TIMEOUT	400
-#define HUB_DEBOUNCE_STEP	 25
-#define HUB_DEBOUNCE_STABLE	  4
+#define HUB_DEBOUNCE_TIMEOUT	1500
+#define HUB_DEBOUNCE_STEP	  25
+#define HUB_DEBOUNCE_STABLE	 100
 
 static int hub_port_debounce(struct usb_device *hdev, int port)
 {
 	int ret;
-	int delay_time, stable_count;
+	int total_time, stable_time = 0;
 	u16 portchange, portstatus;
-	unsigned connection;
-
-	connection = 0;
-	stable_count = 0;
-	for (delay_time = 0; delay_time < HUB_DEBOUNCE_TIMEOUT; delay_time += HUB_DEBOUNCE_STEP) {
-		msleep(HUB_DEBOUNCE_STEP);
+	unsigned connection = 0xffff;
 
+	for (total_time = 0; ; total_time += HUB_DEBOUNCE_STEP) {
 		ret = hub_port_status(hdev, port, &portstatus, &portchange);
 		if (ret < 0)
 			return ret;
 
-		if ((portstatus & USB_PORT_STAT_CONNECTION) == connection) {
-			if (connection) {
-				if (++stable_count == HUB_DEBOUNCE_STABLE)
-					break;
-			}
+		if (!(portchange & USB_PORT_STAT_C_CONNECTION) &&
+		     (portstatus & USB_PORT_STAT_CONNECTION) == connection) {
+			stable_time += HUB_DEBOUNCE_STEP;
+			if (stable_time >= HUB_DEBOUNCE_STABLE)
+				break;
 		} else {
-			stable_count = 0;
+			stable_time = 0;
+			connection = portstatus & USB_PORT_STAT_CONNECTION;
 		}
-		connection = portstatus & USB_PORT_STAT_CONNECTION;
 
-		if ((portchange & USB_PORT_STAT_C_CONNECTION)) {
-			clear_port_feature(hdev, port+1, USB_PORT_FEAT_C_CONNECTION);
+		if (portchange & USB_PORT_STAT_C_CONNECTION) {
+			clear_port_feature(hdev, port+1,
+					USB_PORT_FEAT_C_CONNECTION);
 		}
+
+		if (total_time >= HUB_DEBOUNCE_TIMEOUT)
+			break;
+		msleep(HUB_DEBOUNCE_STEP);
 	}
 
 	dev_dbg (hubdev (hdev),
-		"debounce: port %d: delay %dms stable %d status 0x%x\n",
-		port + 1, delay_time, stable_count, portstatus);
+		"debounce: port %d: total %dms stable %dms status 0x%x\n",
+		port + 1, total_time, stable_time, portstatus);
 
-	return (portstatus & USB_PORT_STAT_CONNECTION) ? 0 : -ENOTCONN;
+	if (stable_time < HUB_DEBOUNCE_STABLE)
+		return -ETIMEDOUT;
+	return portstatus;
 }
 
 static int hub_set_address(struct usb_device *udev)
@@ -1037,7 +1260,7 @@
 	if (udev->state != USB_STATE_DEFAULT &&
 			udev->state != USB_STATE_ADDRESS)
 		return -EINVAL;
-	retval = usb_control_msg(udev, usb_snddefctrl(udev),
+	retval = usb_control_msg(udev, (PIPE_CONTROL << 30) /* Address 0 */,
 		USB_REQ_SET_ADDRESS, 0, udev->devnum, 0,
 		NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
 	if (retval == 0)
@@ -1109,33 +1332,9 @@
 	udev->epmaxpacketin [0] = i;
 	udev->epmaxpacketout[0] = i;
  
-	/* set the address */
-	if (udev->devnum <= 0) {
-		usb_choose_address(udev);
-		if (udev->devnum <= 0)
-			goto fail;
-
-		/* Set up TT records, if needed  */
-		if (hdev->tt) {
-			udev->tt = hdev->tt;
-			udev->ttport = hdev->ttport;
-		} else if (udev->speed != USB_SPEED_HIGH
-				&& hdev->speed == USB_SPEED_HIGH) {
-			struct usb_hub	*hub;
- 
-			hub = usb_get_intfdata (hdev->actconfig
-							->interface[0]);
-			udev->tt = &hub->tt;
-			udev->ttport = port + 1;
-		}
-
-		/* force the right log message (below) at low speed */
-		oldspeed = USB_SPEED_UNKNOWN;
-	}
- 
 	dev_info (&udev->dev,
 			"%s %s speed USB device using address %d\n",
-			(oldspeed == USB_SPEED_UNKNOWN) ? "new" : "reset",
+			(udev->config) ? "reset" : "new",
 			({ char *speed; switch (udev->speed) {
 			case USB_SPEED_LOW:	speed = "low";	break;
 			case USB_SPEED_FULL:	speed = "full";	break;
@@ -1164,12 +1363,7 @@
 			dev_err(&udev->dev,
 				"device not accepting address %d, error %d\n",
 				udev->devnum, retval);
- fail:
-			hub_port_disable(hdev, port);
-			usb_release_address(udev);
-			usb_put_dev(udev);
-			up(&usb_address0_sem);
-			return retval;
+			goto fail;
 		}
  
 		/* cope with hardware quirkiness:
@@ -1192,7 +1386,8 @@
 	if (udev->speed == USB_SPEED_FULL
 			&& (udev->epmaxpacketin [0]
 				!= udev->descriptor.bMaxPacketSize0)) {
-		usb_disable_endpoint(udev, 0);
+		usb_disable_endpoint(udev, 0 + USB_DIR_IN);
+		usb_disable_endpoint(udev, 0 + USB_DIR_OUT);
 		usb_endpoint_running(udev, 0, 1);
 		usb_endpoint_running(udev, 0, 0);
 		udev->epmaxpacketin [0] = udev->descriptor.bMaxPacketSize0;
@@ -1210,9 +1405,11 @@
 
 	/* now dev is visible to other tasks */
 	hdev->children[port] = udev;
+	retval = 0;
 
+fail:
 	up(&usb_address0_sem);
-	return 0;
+	return retval;
 }
 
 static void
@@ -1271,7 +1468,14 @@
 	}
 	return remaining;
 }
- 
+
+/* Handle physical or logical connection change events.
+ * This routine is called when:
+ * 	a port connection-change occurs;
+ *	a port enable-change occurs (often caused by EMI);
+ *	usb_reset_device() encounters changed descriptors (as from
+ *		a firmware download)
+ */
 static void hub_port_connect_change(struct usb_hub *hub, int port,
 					u16 portstatus, u16 portchange)
 {
@@ -1282,9 +1486,6 @@
 	dev_dbg (hub_dev,
 		"port %d, status %04x, change %04x, %s\n",
 		port + 1, portstatus, portchange, portspeed (portstatus));
- 
-	/* Clear the connection change status */
-	clear_port_feature(hdev, port + 1, USB_PORT_FEAT_C_CONNECTION);
 
 	if (hub->has_indicators) {
 		set_port_led(hdev, port + 1, HUB_LED_AUTO);
@@ -1295,6 +1496,17 @@
 	if (hdev->children[port])
 		usb_disconnect(&hdev->children[port]);
 
+	if (portchange & USB_PORT_STAT_C_CONNECTION) {
+		status = hub_port_debounce(hdev, port);
+		if (status < 0) {
+			dev_err (hub_dev,
+				"connect-debounce failed, port %d disabled\n",
+				port+1);
+			goto done;
+		}
+		portstatus = status;
+	}
+
 	/* Return now if nothing is connected */
 	if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
 
@@ -1308,13 +1520,6 @@
   			goto done;
 		return;
 	}
-  
-	if (hub_port_debounce(hdev, port)) {
-		dev_err (hub_dev,
-			"connect-debounce failed, port %d disabled\n",
-			port+1);
-		goto done;
-	}
 
 	for (i = 0; i < SET_CONFIG_TRIES; i++) {
 		struct usb_device *udev;
@@ -1329,20 +1534,36 @@
 			goto done;
 		}
 		udev->state = USB_STATE_POWERED;
-	  
+
 		/* hub can tell if it's lowspeed already:  D- pullup (not D+) */
 		if (portstatus & USB_PORT_STAT_LOW_SPEED)
 			udev->speed = USB_SPEED_LOW;
 		else
 			udev->speed = USB_SPEED_UNKNOWN;
 
-		/* reset, set address, get descriptor, add to hub's children */
 		down (&udev->serialize);
+ 
+		/* set the address */
+		choose_address(udev);
+		if (udev->devnum <= 0) {
+			status = -ENOTCONN;	/* Don't retry */
+			goto loop;
+		}
+
+		/* reset, get descriptor, add to hub's children */
 		status = hub_port_init(hdev, udev, port);
-		if (status == -ENOTCONN)
-			break;
 		if (status < 0)
-			continue;
+			goto loop;
+
+		/* Set up TT records, if needed  */
+		if (hdev->tt) {
+			udev->tt = hdev->tt;
+			udev->ttport = hdev->ttport;
+		} else if (udev->speed != USB_SPEED_HIGH
+				&& hdev->speed == USB_SPEED_HIGH) {
+			udev->tt = &hub->tt;
+			udev->ttport = port + 1;
+		}
 
 		/* consecutive bus-powered hubs aren't reliable; they can
 		 * violate the voltage drop budget.  if the new child has
@@ -1358,7 +1579,7 @@
 					&devstat);
 			if (status < 0) {
 				dev_dbg(&udev->dev, "get status %d ?\n", status);
-				continue;
+				goto loop;
 			}
 			cpu_to_le16s(&devstat);
 			if ((devstat & (1 << USB_DEVICE_SELF_POWERED)) == 0) {
@@ -1370,10 +1591,8 @@
 						INDICATOR_AMBER_BLINK;
 					schedule_work (&hub->leds);
 				}
-				hdev->children[port] = NULL;
-				usb_put_dev(udev);
-				hub_port_disable(hdev, port);
-				return;
+				status = -ENOTCONN;	/* Don't retry */
+				goto loop;
 			}
 		}
  
@@ -1385,11 +1604,8 @@
 
 		/* Run it through the hoops (find a driver, etc) */
 		status = usb_new_device(udev);
-		if (status != 0) {
-			hdev->children[port] = NULL;
-			continue;
-		}
-		up (&udev->serialize);
+		if (status)
+			goto loop;
 
 		status = hub_power_remaining(hub, hdev);
 		if (status)
@@ -1397,7 +1613,19 @@
 				"%dmA power budget left\n",
 				2 * status);
 
+		up (&udev->serialize);
 		return;
+
+loop:
+		hdev->children[port] = NULL;
+		hub_port_disable(hdev, port);
+		usb_disable_endpoint(udev, 0 + USB_DIR_IN);
+		usb_disable_endpoint(udev, 0 + USB_DIR_OUT);
+		release_address(udev);
+		up (&udev->serialize);
+		usb_put_dev(udev);
+		if (status == -ENOTCONN)
+			break;
 	}
  
 done:
@@ -1416,6 +1644,7 @@
 	u16 portstatus;
 	u16 portchange;
 	int i, ret;
+	int connect_change;
 
 	/*
 	 *  We restart the list every time to avoid a deadlock with
@@ -1461,16 +1690,22 @@
 
 		for (i = 0; i < hub->descriptor->bNbrPorts; i++) {
 			ret = hub_port_status(hdev, i, &portstatus, &portchange);
-			if (ret < 0) {
+			if (ret < 0)
 				continue;
-			}
+			connect_change = 0;
 
 			if (portchange & USB_PORT_STAT_C_CONNECTION) {
-				hub_port_connect_change(hub, i, portstatus, portchange);
-			} else if (portchange & USB_PORT_STAT_C_ENABLE) {
-				dev_dbg (hub_dev,
-					"port %d enable change, status %08x\n",
-					i + 1, portstatus);
+				clear_port_feature(hdev,
+					i + 1, USB_PORT_FEAT_C_CONNECTION);
+				connect_change = 1;
+			}
+
+			if (portchange & USB_PORT_STAT_C_ENABLE) {
+				if (!connect_change)
+					dev_dbg (hub_dev,
+						"port %d enable change, "
+						"status %08x\n",
+						i + 1, portstatus);
 				clear_port_feature(hdev,
 					i + 1, USB_PORT_FEAT_C_ENABLE);
 
@@ -1481,15 +1716,14 @@
 				 * Works at least with mouse driver. 
 				 */
 				if (!(portstatus & USB_PORT_STAT_ENABLE)
-				    && (portstatus & USB_PORT_STAT_CONNECTION)
-				    && (hdev->children[i])) {
+				    && !connect_change
+				    && hdev->children[i]) {
 					dev_err (hub_dev,
 					    "port %i "
 					    "disabled by hub (EMI?), "
 					    "re-enabling...",
 						i + 1);
-					hub_port_connect_change(hub,
-						i, portstatus, portchange);
+					connect_change = 1;
 				}
 			}
 
@@ -1517,6 +1751,10 @@
 				clear_port_feature(hdev,
 					i + 1, USB_PORT_FEAT_C_RESET);
 			}
+
+			if (connect_change)
+				hub_port_connect_change(hub, i,
+						portstatus, portchange);
 		} /* end for i */
 
 		/* deal with hub status changes */
@@ -1581,9 +1819,6 @@
 	.id_table =	hub_id_table,
 };
 
-/*
- * This should be a separate module.
- */
 int usb_hub_init(void)
 {
 	pid_t pid;
diff -Nru a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
--- a/drivers/usb/core/hub.h	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/core/hub.h	2004-06-08 22:03:37 -07:00
@@ -202,7 +202,6 @@
 	int			error;		/* last reported error */
 	int			nerrors;	/* track consecutive errors */
 
-	struct list_head	hub_list;	/* all hubs */
 	struct list_head	event_list;	/* hubs w/data or errs ready */
 
 	struct usb_hub_descriptor *descriptor;	/* class descriptor */
@@ -215,5 +214,16 @@
 	enum hub_led_mode	indicator[USB_MAXCHILDREN];
 	struct work_struct	leds;
 };
+
+/* use this for low-powered root hubs */
+static inline void
+hub_set_power_budget (struct usb_device *hubdev, unsigned mA)
+{
+	struct usb_hub	*hub;
+
+	hub = (struct usb_hub *)
+		usb_get_intfdata (hubdev->actconfig->interface[0]);
+	hub->power_budget = min(mA,(unsigned)500)/2;
+}
 
 #endif /* __LINUX_HUB_H */
diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/core/message.c	2004-06-08 22:03:37 -07:00
@@ -566,22 +566,19 @@
  */
 int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char index, void *buf, int size)
 {
-	int i = 5;
+	int i;
 	int result;
 	
 	memset(buf,0,size);	// Make sure we parse really received data
 
-	while (i--) {
+	for (i = 0; i < 3; ++i) {
 		/* retry on length 0 or stall; some devices are flakey */
-		if ((result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-				    USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
-				    (type << 8) + index, 0, buf, size,
-				    HZ * USB_CTRL_GET_TIMEOUT)) > 0
-				|| result != -EPIPE)
+		result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
+				USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
+				(type << 8) + index, 0, buf, size,
+				HZ * USB_CTRL_GET_TIMEOUT);
+		if (!(result == 0 || result == -EPIPE))
 			break;
-
-		dev_dbg (&dev->dev, "RETRY descriptor, result %d\n", result);
-		result = -ENOMSG;
 	}
 	return result;
 }
@@ -830,6 +827,7 @@
 			interface = dev->actconfig->interface[i];
 			dev_dbg (&dev->dev, "unregistering interface %s\n",
 				interface->dev.bus_id);
+			usb_remove_sysfs_intf_files(interface);
 			device_del (&interface->dev);
 		}
 
diff -Nru a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
--- a/drivers/usb/core/sysfs.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/core/sysfs.c	2004-06-08 22:03:37 -07:00
@@ -2,8 +2,8 @@
  * drivers/usb/core/sysfs.c
  *
  * (C) Copyright 2002 David Brownell
- * (C) Copyright 2002 Greg Kroah-Hartman
- * (C) Copyright 2002 IBM Corp.
+ * (C) Copyright 2002,2004 Greg Kroah-Hartman
+ * (C) Copyright 2002,2004 IBM Corp.
  *
  * All of the sysfs file attributes for usb devices and interfaces.
  *
@@ -162,29 +162,35 @@
 usb_descriptor_attr (bDeviceProtocol, "%02x\n")
 usb_descriptor_attr (bNumConfigurations, "%d\n")
 
+static struct attribute *dev_attrs[] = {
+	/* current configuration's attributes */
+	&dev_attr_bNumInterfaces.attr,
+	&dev_attr_bConfigurationValue.attr,
+	&dev_attr_bmAttributes.attr,
+	&dev_attr_bMaxPower.attr,
+	/* device attributes */
+	&dev_attr_idVendor.attr,
+	&dev_attr_idProduct.attr,
+	&dev_attr_bcdDevice.attr,
+	&dev_attr_bDeviceClass.attr,
+	&dev_attr_bDeviceSubClass.attr,
+	&dev_attr_bDeviceProtocol.attr,
+	&dev_attr_bNumConfigurations.attr,
+	&dev_attr_speed.attr,
+	&dev_attr_devnum.attr,
+	&dev_attr_version.attr,
+	&dev_attr_maxchild.attr,
+	NULL,
+};
+static struct attribute_group dev_attr_grp = {
+	.attrs = dev_attrs,
+};
 
 void usb_create_sysfs_dev_files (struct usb_device *udev)
 {
 	struct device *dev = &udev->dev;
 
-	/* current configuration's attributes */
-	device_create_file (dev, &dev_attr_bNumInterfaces);
-	device_create_file (dev, &dev_attr_bConfigurationValue);
-	device_create_file (dev, &dev_attr_bmAttributes);
-	device_create_file (dev, &dev_attr_bMaxPower);
-
-	/* device attributes */
-	device_create_file (dev, &dev_attr_idVendor);
-	device_create_file (dev, &dev_attr_idProduct);
-	device_create_file (dev, &dev_attr_bcdDevice);
-	device_create_file (dev, &dev_attr_bDeviceClass);
-	device_create_file (dev, &dev_attr_bDeviceSubClass);
-	device_create_file (dev, &dev_attr_bDeviceProtocol);
-	device_create_file (dev, &dev_attr_bNumConfigurations);
-
-	/* speed varies depending on how you connect the device */
-	device_create_file (dev, &dev_attr_speed);
-	// FIXME iff there are other speed configs, show how many
+	sysfs_create_group(&dev->kobj, &dev_attr_grp);
 
 	if (udev->descriptor.iManufacturer)
 		device_create_file (dev, &dev_attr_manufacturer);
@@ -192,10 +198,20 @@
 		device_create_file (dev, &dev_attr_product);
 	if (udev->descriptor.iSerialNumber)
 		device_create_file (dev, &dev_attr_serial);
+}
+
+void usb_remove_sysfs_dev_files (struct usb_device *udev)
+{
+	struct device *dev = &udev->dev;
 
-	device_create_file (dev, &dev_attr_devnum);
-	device_create_file (dev, &dev_attr_version);
-	device_create_file (dev, &dev_attr_maxchild);
+	sysfs_remove_group(&dev->kobj, &dev_attr_grp);
+
+	if (udev->descriptor.iManufacturer)
+		device_remove_file(dev, &dev_attr_manufacturer);
+	if (udev->descriptor.iProduct)
+		device_remove_file(dev, &dev_attr_product);
+	if (udev->descriptor.iSerialNumber)
+		device_remove_file(dev, &dev_attr_serial);
 }
 
 /* Interface fields */
@@ -217,13 +233,26 @@
 usb_intf_attr (bInterfaceProtocol, "%02x\n")
 usb_intf_attr (iInterface, "%02x\n")
 
+static struct attribute *intf_attrs[] = {
+	&dev_attr_bInterfaceNumber.attr,
+	&dev_attr_bAlternateSetting.attr,
+	&dev_attr_bNumEndpoints.attr,
+	&dev_attr_bInterfaceClass.attr,
+	&dev_attr_bInterfaceSubClass.attr,
+	&dev_attr_bInterfaceProtocol.attr,
+	&dev_attr_iInterface.attr,
+	NULL,
+};
+static struct attribute_group intf_attr_grp = {
+	.attrs = intf_attrs,
+};
+
 void usb_create_sysfs_intf_files (struct usb_interface *intf)
 {
-	device_create_file (&intf->dev, &dev_attr_bInterfaceNumber);
-	device_create_file (&intf->dev, &dev_attr_bAlternateSetting);
-	device_create_file (&intf->dev, &dev_attr_bNumEndpoints);
-	device_create_file (&intf->dev, &dev_attr_bInterfaceClass);
-	device_create_file (&intf->dev, &dev_attr_bInterfaceSubClass);
-	device_create_file (&intf->dev, &dev_attr_bInterfaceProtocol);
-	device_create_file (&intf->dev, &dev_attr_iInterface);
+	sysfs_create_group(&intf->dev.kobj, &intf_attr_grp);
+}
+
+void usb_remove_sysfs_intf_files (struct usb_interface *intf)
+{
+	sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp);
 }
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/core/usb.c	2004-06-08 22:03:37 -07:00
@@ -945,235 +945,6 @@
 }
 
 /**
- * usb_disconnect - disconnect a device (usbcore-internal)
- * @pdev: pointer to device being disconnected
- * Context: !in_interrupt ()
- *
- * Something got disconnected. Get rid of it, and all of its children.
- *
- * Only hub drivers (including virtual root hub drivers for host
- * controllers) should ever call this.
- *
- * This call is synchronous, and may not be used in an interrupt context.
- */
-void usb_disconnect(struct usb_device **pdev)
-{
-	struct usb_device	*dev = *pdev;
-	struct usb_bus		*bus;
-	struct usb_operations	*ops;
-	int			i;
-
-	might_sleep ();
-
-	if (!dev) {
-		pr_debug ("%s nodev\n", __FUNCTION__);
-		return;
-	}
-	bus = dev->bus;
-	if (!bus) {
-		pr_debug ("%s nobus\n", __FUNCTION__);
-		return;
-	}
-	ops = bus->op;
-
-	*pdev = NULL;
-
-	/* mark the device as inactive, so any further urb submissions for
-	 * this device will fail.
-	 */
-	dev->state = USB_STATE_NOTATTACHED;
-	down(&dev->serialize);
-
-	dev_info (&dev->dev, "USB disconnect, address %d\n", dev->devnum);
-
-	/* Free up all the children before we remove this device */
-	for (i = 0; i < USB_MAXCHILDREN; i++) {
-		struct usb_device **child = dev->children + i;
-		if (*child)
-			usb_disconnect(child);
-	}
-
-	/* deallocate hcd/hardware state ... nuking all pending urbs and
-	 * cleaning up all state associated with the current configuration
-	 */
-	usb_disable_device(dev, 0);
-
-	/* Free the device number and remove the /proc/bus/usb entry */
-	dev_dbg (&dev->dev, "unregistering device\n");
-	usb_release_address(dev);
-	usbfs_remove_device(dev);
-	up(&dev->serialize);
-	device_unregister(&dev->dev);
-}
-
-/**
- * usb_choose_address - pick device address (usbcore-internal)
- * @dev: newly detected device (in DEFAULT state)
- *
- * Picks a device address.  It's up to the hub (or root hub) driver
- * to handle and manage enumeration, starting from the DEFAULT state.
- * Only hub drivers (but not virtual root hub drivers for host
- * controllers) should ever call this.
- */
-void usb_choose_address(struct usb_device *dev)
-{
-	int devnum;
-	// FIXME needs locking for SMP!!
-	/* why? this is called only from the hub thread, 
-	 * which hopefully doesn't run on multiple CPU's simultaneously 8-)
-	 */
-
-	/* Try to allocate the next devnum beginning at bus->devnum_next. */
-	devnum = find_next_zero_bit(dev->bus->devmap.devicemap, 128, dev->bus->devnum_next);
-	if (devnum >= 128)
-		devnum = find_next_zero_bit(dev->bus->devmap.devicemap, 128, 1);
-
-	dev->bus->devnum_next = ( devnum >= 127 ? 1 : devnum + 1);
-
-	if (devnum < 128) {
-		set_bit(devnum, dev->bus->devmap.devicemap);
-		dev->devnum = devnum;
-	}
-}
-
-/**
- * usb_release_address - deallocate device address (usbcore-internal)
- * @dev: newly removed device
- *
- * Removes and deallocates the address assigned to a device.
- * Only hub drivers (but not virtual root hub drivers for host
- * controllers) should ever call this.
- */
-void usb_release_address(struct usb_device *dev)
-{
-	if (dev->devnum > 0) {
-		clear_bit(dev->devnum, dev->bus->devmap.devicemap);
-		dev->devnum = -1;
-	}
-}
-
-
-static inline void usb_show_string(struct usb_device *dev, char *id, int index)
-{
-	char *buf;
-
-	if (!index)
-		return;
-	if (!(buf = kmalloc(256, GFP_KERNEL)))
-		return;
-	if (usb_string(dev, index, buf, 256) > 0)
-		dev_printk(KERN_INFO, &dev->dev, "%s: %s\n", id, buf);
-	kfree(buf);
-}
-
-static int usb_choose_configuration(struct usb_device *dev)
-{
-	int c, i;
-
-	c = dev->config[0].desc.bConfigurationValue;
-	if (dev->descriptor.bNumConfigurations != 1) {
-		for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
-			struct usb_interface_descriptor	*desc;
-
-			/* heuristic:  Linux is more likely to have class
-			 * drivers, so avoid vendor-specific interfaces.
-			 */
-			desc = &dev->config[i].intf_cache[0]
-					->altsetting->desc;
-			if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC)
-				continue;
-			/* COMM/2/all is CDC ACM, except 0xff is MSFT RNDIS */
-			if (desc->bInterfaceClass == USB_CLASS_COMM
-					&& desc->bInterfaceSubClass == 2
-					&& desc->bInterfaceProtocol == 0xff)
-				continue;
-			c = dev->config[i].desc.bConfigurationValue;
-			break;
-		}
-		dev_info(&dev->dev,
-			"configuration #%d chosen from %d choices\n",
-			c, dev->descriptor.bNumConfigurations);
-	}
-	return c;
-}
-
-/*
- * usb_new_device - perform initial device setup (usbcore-internal)
- * @dev: newly addressed device (in ADDRESS state)
- *
- * This is called with devices which have been enumerated, but not yet
- * configured.  The device descriptor is available, but not descriptors
- * for any device configuration.  The caller owns dev->serialize, and
- * the device is not visible through sysfs or other filesystem code.
- *
- * Returns 0 for success (device is configured and listed, with its
- * interfaces, in sysfs); else a negative errno value.  On error, one
- * reference count to the device has been dropped.
- *
- * This call is synchronous, and may not be used in an interrupt context.
- *
- * Only the hub driver should ever call this; root hub registration
- * uses it only indirectly.
- */
-int usb_new_device(struct usb_device *dev)
-{
-	int err;
-	int c;
-
-	err = usb_get_configuration(dev);
-	if (err < 0) {
-		dev_err(&dev->dev, "can't read configurations, error %d\n",
-			err);
-		goto fail;
-	}
-
-	/* Tell the world! */
-	dev_dbg(&dev->dev, "new device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
-		dev->descriptor.iManufacturer, dev->descriptor.iProduct, dev->descriptor.iSerialNumber);
-
-#ifdef DEBUG
-	if (dev->descriptor.iProduct)
-		usb_show_string(dev, "Product", dev->descriptor.iProduct);
-	if (dev->descriptor.iManufacturer)
-		usb_show_string(dev, "Manufacturer", dev->descriptor.iManufacturer);
-	if (dev->descriptor.iSerialNumber)
-		usb_show_string(dev, "SerialNumber", dev->descriptor.iSerialNumber);
-#endif
-
-	/* put device-specific files into sysfs */
-	err = device_add (&dev->dev);
-	if (err) {
-		dev_err(&dev->dev, "can't device_add, error %d\n", err);
-		goto fail;
-	}
-	usb_create_sysfs_dev_files (dev);
-
-	/* choose and set the configuration. that registers the interfaces
-	 * with the driver core, and lets usb device drivers bind to them.
-	 * NOTE:  should interact with hub power budgeting.
-	 */
-	c = usb_choose_configuration(dev);
-	err = usb_set_configuration(dev, c);
-	if (err) {
-		dev_err(&dev->dev, "can't set config #%d, error %d\n", c, err);
-		device_del(&dev->dev);
-		goto fail;
-	}
-
-	/* USB device state == configured ... usable */
-
-	/* add a /proc/bus/usb entry */
-	usbfs_add_device(dev);
-
-	return 0;
-fail:
-	dev->state = USB_STATE_NOTATTACHED;
-	usb_release_address(dev);
-	usb_put_dev(dev);
-	return err;
-}
-
-/**
  * usb_buffer_alloc - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP
  * @dev: device the buffer will be used with
  * @size: requested buffer size
diff -Nru a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
--- a/drivers/usb/core/usb.h	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/core/usb.h	2004-06-08 22:03:37 -07:00
@@ -1,7 +1,9 @@
 /* Functions local to drivers/usb/core/ */
 
 extern void usb_create_sysfs_dev_files (struct usb_device *dev);
+extern void usb_remove_sysfs_dev_files (struct usb_device *dev);
 extern void usb_create_sysfs_intf_files (struct usb_interface *intf);
+extern void usb_remove_sysfs_intf_files (struct usb_interface *intf);
 extern int usb_probe_interface (struct device *dev);
 extern int usb_unbind_interface (struct device *dev);
 
diff -Nru a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
--- a/drivers/usb/gadget/dummy_hcd.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/gadget/dummy_hcd.c	2004-06-08 22:03:37 -07:00
@@ -825,8 +825,7 @@
 	dum = container_of (hcd, struct dummy, hcd);
 	spin_lock_irqsave (&dum->lock, flags);
 
-	if (!dum->hdev)
-		dum->hdev = urb->dev->hcpriv;
+	dum->hdev = urb->dev->hcpriv;
 	urb->hcpriv = dum;
 	if (usb_pipetype (urb->pipe) == PIPE_CONTROL)
 		urb->error_count = 1;		/* mark as a new urb */
@@ -994,10 +993,17 @@
 	return limit;
 }
 
+#define is_active(dum)	((dum->port_status & \
+		(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE | \
+			USB_PORT_STAT_SUSPEND)) \
+		== (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE))
+
 static struct dummy_ep *find_endpoint (struct dummy *dum, u8 address)
 {
 	int		i;
 
+	if (!is_active (dum))
+		return NULL;
 	if ((address & ~USB_DIR_IN) == 0)
 		return &dum->ep [0];
 	for (i = 1; i < DUMMY_ENDPOINTS; i++) {
@@ -1011,6 +1017,8 @@
 	return NULL;
 }
 
+#undef is_active
+
 #define Dev_Request	(USB_TYPE_STANDARD | USB_RECIP_DEVICE)
 #define Dev_InRequest	(Dev_Request | USB_DIR_IN)
 #define Intf_Request	(USB_TYPE_STANDARD | USB_RECIP_INTERFACE)
@@ -1404,9 +1412,8 @@
 			break;
 		case USB_PORT_FEAT_POWER:
 			dum->port_status = 0;
-			dum->address = 0;
-			dum->hdev = 0;
 			dum->resuming = 0;
+			stop_activity(dum, dum->driver);
 			break;
 		default:
 			dum->port_status &= ~(1 << wValue);
@@ -1678,6 +1685,9 @@
 		dum->hcd.state = USB_STATE_QUIESCING;
 		goto clean1;
 	}
+
+	/* only show a low-power port: just 8mA */
+	hub_set_power_budget (root, 8);
 
 	dum->started = 1;
 
diff -Nru a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
--- a/drivers/usb/gadget/ether.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/gadget/ether.c	2004-06-08 22:03:37 -07:00
@@ -118,6 +118,7 @@
 	unsigned		zlp:1;
 	unsigned		cdc:1;
 	unsigned		rndis:1;
+	unsigned		suspended:1;
 	u16			cdc_filter;
 	unsigned long		todo;
 #define	WORK_RX_MEMORY		0
@@ -1345,24 +1346,23 @@
 
 static void rndis_response_complete (struct usb_ep *ep, struct usb_request *req)
 {
-	struct eth_dev          *dev = ep->driver_data;
-	
 	if (req->status || req->actual != req->length)
 		DEBUG (dev, "rndis response complete --> %d, %d/%d\n",
 		       req->status, req->actual, req->length);
 
 	/* done sending after CDC_GET_ENCAPSULATED_RESPONSE */
-	rndis_free_response (dev->rndis_config, req->buf);
 }
 
 static void rndis_command_complete (struct usb_ep *ep, struct usb_request *req)
 {
 	struct eth_dev          *dev = ep->driver_data;
+	int			status;
 	
 	/* received RNDIS command from CDC_SEND_ENCAPSULATED_COMMAND */
 	spin_lock(&dev->lock);
-	if (rndis_msg_parser (dev->rndis_config, (u8 *) req->buf))
-		ERROR(dev, "%s: rndis parse error\n", __FUNCTION__ );
+	status = rndis_msg_parser (dev->rndis_config, (u8 *) req->buf);
+	if (status < 0)
+		ERROR(dev, "%s: rndis parse error %d\n", __FUNCTION__, status);
 	spin_unlock(&dev->lock);
 }
 
@@ -1580,6 +1580,7 @@
 			if (buf) {
 				memcpy (req->buf, buf, value);
 				req->complete = rndis_response_complete;
+				rndis_free_response(dev->rndis_config, buf);
 			}
 			/* else stalls ... spec says to avoid that */
 		}
@@ -2064,6 +2065,16 @@
 	}
 }
 
+static void rndis_control_ack_complete (struct usb_ep *ep, struct usb_request *req)
+{
+	if (req->status || req->actual != req->length)
+		DEBUG (dev, "rndis control ack complete --> %d, %d/%d\n",
+		       req->status, req->actual, req->length);
+
+	usb_ep_free_buffer(ep, req->buf, req->dma, 8);
+	usb_ep_free_request(ep, req);
+}
+
 static int rndis_control_ack (struct net_device *net)
 {
 	struct eth_dev          *dev = (struct eth_dev *) net->priv;
@@ -2095,7 +2106,7 @@
 	 * CDC_NOTIFY_RESPONSE_AVAILABLE should work too
 	 */
 	resp->length = 8;
-	resp->complete = rndis_response_complete;
+	resp->complete = rndis_control_ack_complete;
 	
 	*((u32 *) resp->buf) = __constant_cpu_to_le32 (1);
 	*((u32 *) resp->buf + 1) = __constant_cpu_to_le32 (0);
@@ -2103,7 +2114,7 @@
 	length = usb_ep_queue (dev->status_ep, resp, GFP_ATOMIC);
 	if (length < 0) {
 		resp->status = 0;
-		rndis_response_complete (dev->status_ep, resp);
+		rndis_control_ack_complete (dev->status_ep, resp);
 	}
 	
 	return 0;
@@ -2302,17 +2313,6 @@
 		UTS_SYSNAME " " UTS_RELEASE "/%s",
 		gadget->name);
 
-	/* CDC subset ... recognized by Linux since 2.4.10, but Windows
-	 * drivers aren't widely available.
-	 */
-	if (!cdc) {
-		device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC;
-		device_desc.idVendor =
-			__constant_cpu_to_le16(SIMPLE_VENDOR_NUM);
-		device_desc.idProduct =
-			__constant_cpu_to_le16(SIMPLE_PRODUCT_NUM);
-	}
-
 	/* If there's an RNDIS configuration, that's what Windows wants to
 	 * be using ... so use these product IDs here and in the "linux.inf"
 	 * needed to install MSFT drivers.  Current Linux kernels will use
@@ -2326,6 +2326,16 @@
 			__constant_cpu_to_le16(RNDIS_PRODUCT_NUM);
 		snprintf (product_desc, sizeof product_desc,
 			"RNDIS/%s", driver_desc);
+
+	/* CDC subset ... recognized by Linux since 2.4.10, but Windows
+	 * drivers aren't widely available.
+	 */
+	} else if (!cdc) {
+		device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC;
+		device_desc.idVendor =
+			__constant_cpu_to_le16(SIMPLE_VENDOR_NUM);
+		device_desc.idProduct =
+			__constant_cpu_to_le16(SIMPLE_PRODUCT_NUM);
 	}
 
 	/* support optional vendor/distro customization */
@@ -2554,6 +2564,26 @@
 
 /*-------------------------------------------------------------------------*/
 
+static void
+eth_suspend (struct usb_gadget *gadget)
+{
+	struct eth_dev		*dev = get_gadget_data (gadget);
+
+	DEBUG (dev, "suspend\n");
+	dev->suspended = 1;
+}
+
+static void
+eth_resume (struct usb_gadget *gadget)
+{
+	struct eth_dev		*dev = get_gadget_data (gadget);
+
+	DEBUG (dev, "resume\n");
+	dev->suspended = 0;
+}
+
+/*-------------------------------------------------------------------------*/
+
 static struct usb_gadget_driver eth_driver = {
 #ifdef CONFIG_USB_GADGET_DUALSPEED
 	.speed		= USB_SPEED_HIGH,
@@ -2566,6 +2596,9 @@
 
 	.setup		= eth_setup,
 	.disconnect	= eth_disconnect,
+
+	.suspend	= eth_suspend,
+	.resume		= eth_resume,
 
 	.driver 	= {
 		.name		= (char *) shortname,
diff -Nru a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
--- a/drivers/usb/gadget/file_storage.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/gadget/file_storage.c	2004-06-08 22:03:37 -07:00
@@ -3834,6 +3834,7 @@
 	}
 
 	/* Find all the endpoints we will use */
+	usb_ep_autoconfig_reset(gadget);
 	ep = usb_ep_autoconfig(gadget, &fs_bulk_in_desc);
 	if (!ep)
 		goto autoconf_fail;
diff -Nru a/drivers/usb/gadget/ndis.h b/drivers/usb/gadget/ndis.h
--- a/drivers/usb/gadget/ndis.h	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/gadget/ndis.h	2004-06-08 22:03:37 -07:00
@@ -26,10 +26,40 @@
 #define NDIS_STATUS_MULTICAST_EXISTS      0xC001000A
 #define NDIS_STATUS_MULTICAST_NOT_FOUND   0xC001000B
 
+enum NDIS_DEVICE_POWER_STATE {
+	NdisDeviceStateUnspecified = 0,
+	NdisDeviceStateD0,
+	NdisDeviceStateD1,
+	NdisDeviceStateD2,
+	NdisDeviceStateD3,
+	NdisDeviceStateMaximum
+};
+
+struct NDIS_PM_WAKE_UP_CAPABILITIES {
+	enum NDIS_DEVICE_POWER_STATE  MinMagicPacketWakeUp;
+	enum NDIS_DEVICE_POWER_STATE  MinPatternWakeUp;
+	enum NDIS_DEVICE_POWER_STATE  MinLinkChangeWakeUp;
+};
+
 /* NDIS_PNP_CAPABILITIES.Flags constants */
 #define NDIS_DEVICE_WAKE_UP_ENABLE                0x00000001
 #define NDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE  0x00000002
 #define NDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE   0x00000004
+
+struct NDIS_PNP_CAPABILITIES {
+	u32					Flags;
+	struct NDIS_PM_WAKE_UP_CAPABILITIES	WakeUpCapabilities;
+};
+
+struct NDIS_PM_PACKET_PATTERN {
+	u32	Priority;
+	u32	Reserved;
+	u32	MaskSize;
+	u32	PatternOffset;
+	u32	PatternSize;
+	u32	PatternFlags;
+};
+
 
 /* Required Object IDs (OIDs) */
 #define OID_GEN_SUPPORTED_LIST            0x00010101
diff -Nru a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
--- a/drivers/usb/gadget/net2280.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/gadget/net2280.c	2004-06-08 22:03:37 -07:00
@@ -1902,6 +1902,8 @@
 		, &dev->usb->stdrsp);
 	writel (  (1 << USB_ROOT_PORT_WAKEUP_ENABLE)
 		| (1 << SELF_POWERED_USB_DEVICE)
+		/* erratum 0102 workaround */
+		| ((dev->chiprev == 0100) ? 0 : 1) << SUSPEND_IMMEDIATELY
 		| (1 << REMOTE_WAKEUP_SUPPORT)
 		| (1 << USB_DETECT_ENABLE)
 		| (1 << SELF_POWERED_STATUS)
@@ -1917,6 +1919,7 @@
 		| (1 << PCI_RETRY_ABORT_INTERRUPT_ENABLE)
 		| (1 << VBUS_INTERRUPT_ENABLE)
 		| (1 << ROOT_PORT_RESET_INTERRUPT_ENABLE)
+		| (1 << SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE)
 		, &dev->regs->pciirqenb1);
 
 	/* don't leave any writes posted */
@@ -2513,19 +2516,24 @@
 			return;
 	}
 
-	/* NOTE: we don't actually suspend the hardware; that starts to
-	 * interact with PCI power management, and needs something like a
-	 * controller->suspend() call to clear SUSPEND_REQUEST_INTERRUPT.
-	 * we shouldn't see resume interrupts.
-	 * for rev 0100, this also avoids erratum 0102.
+	/* NOTE: chip stays in PCI D0 state for now, but it could
+	 * enter D1 to save more power
 	 */
 	tmp = (1 << SUSPEND_REQUEST_CHANGE_INTERRUPT);
 	if (stat & tmp) {
-		if (dev->driver->suspend)
-			dev->driver->suspend (&dev->gadget);
+		writel (tmp, &dev->regs->irqstat1);
+		if (stat & (1 << SUSPEND_REQUEST_INTERRUPT)) {
+			if (dev->driver->suspend)
+				dev->driver->suspend (&dev->gadget);
+			/* we use SUSPEND_IMMEDIATELY */
+			stat &= ~(1 << SUSPEND_REQUEST_INTERRUPT);
+		} else {
+			if (dev->driver->resume)
+				dev->driver->resume (&dev->gadget);
+			/* at high speed, note erratum 0133 */
+		}
 		stat &= ~tmp;
 	}
-	stat &= ~(1 << SUSPEND_REQUEST_INTERRUPT);
 
 	/* clear any other status/irqs */
 	if (stat)
@@ -2533,6 +2541,7 @@
 
 	/* some status we can just ignore */
 	stat &= ~((1 << CONTROL_STATUS_INTERRUPT)
+			| (1 << SUSPEND_REQUEST_INTERRUPT)
 			| (1 << RESUME_INTERRUPT)
 			| (1 << SOF_INTERRUPT));
 	if (!stat)
diff -Nru a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
--- a/drivers/usb/gadget/rndis.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/gadget/rndis.c	2004-06-08 22:03:37 -07:00
@@ -18,6 +18,9 @@
  * 
  * 03/25/2004 Kai-Uwe Bloem <linux-development@auerswald.de>
  * 		Fixed rndis_rm_hdr length bug.
+ *
+ * Copyright (C) 2004 by David Brownell
+ *		updates to merge with Linux 2.6, better match RNDIS spec
  */
 
 #include <linux/config.h>
@@ -35,28 +38,34 @@
 #include <asm/byteorder.h>
 #include <asm/system.h>
 
+
+#undef	RNDIS_PM
+#undef	VERBOSE
+
 #include "rndis.h"
 
 
 /* The driver for your USB chip needs to support ep0 OUT to work with
- * RNDIS, plus the same three descriptors as CDC Ethernet.
+ * RNDIS, plus all three CDC Ethernet endpoints (interrupt not optional).
  *
  * Windows hosts need an INF file like Documentation/usb/linux.inf
+ * and will be happier if you provide the host_addr module parameter.
  */
 
-#ifndef	__LITTLE_ENDIAN
-#warning this code is missing all cpu_to_leXX() calls ...
-#endif
-
 #if 0
-#define DEBUG if (rndis_debug) printk 
+#define DEBUG(str,args...) do { \
+	if (rndis_debug) \
+		printk(KERN_DEBUG str , ## args ); \
+	} while (0)
 static int rndis_debug = 0;
 
 module_param (rndis_debug, bool, 0);
 MODULE_PARM_DESC (rndis_debug, "enable debugging");
 
 #else
-#define DEBUG(str,args...) do{}while(0)
+
+#define rndis_debug		0
+#define DEBUG(str,args...)	do{}while(0)
 #endif
 
 #define RNDIS_MAX_CONFIGS	1
@@ -79,16 +88,14 @@
 
 static rndis_resp_t *rndis_add_response (int configNr, u32 length);
 
-/* FIXME OMITTED OIDs, that RNDIS-on-USB "must" support, include
- *  - power management (OID_PNP_CAPABILITIES, ...)
- *  - network wakeup (OID_PNP_ENABLE_WAKE_UP, ...)
- */
 
 /* NDIS Functions */
 static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r)
 {
 	int 			retval = -ENOTSUPP;
 	u32 			length = 0;
+	u32			*tmp;
+	int			i, count;
 	rndis_query_cmplt_type	*resp;
 
 	if (!r) return -ENOMEM;
@@ -97,11 +104,17 @@
 	if (!resp) return -ENOMEM;
 	
 	switch (OID) {
+
+	/* general oids (table 4-1) */
+
 	/* mandatory */
 	case OID_GEN_SUPPORTED_LIST:
 		DEBUG ("%s: OID_GEN_SUPPORTED_LIST\n", __FUNCTION__);
 		length = sizeof (oid_supported_list);
-		memcpy ((u8 *) resp + 24, oid_supported_list, length); 
+		count  = length / sizeof (u32);
+		tmp = (u32 *) ((u8 *)resp + 24);
+		for (i = 0; i < count; i++)
+			tmp[i] = cpu_to_le32 (oid_supported_list[i]);
 		retval = 0;
 		break;
 		
@@ -115,7 +128,7 @@
 		 * reddite ergo quae sunt Caesaris Caesari
 		 * et quae sunt Dei Deo!
 		 */
-		*((u32 *) resp + 6) = 0;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 		retval = 0;
 		break;
 		
@@ -123,7 +136,8 @@
 	case OID_GEN_MEDIA_SUPPORTED:
 		DEBUG("%s: OID_GEN_MEDIA_SUPPORTED\n", __FUNCTION__);
 		length = 4;
-		*((u32 *) resp + 6) = rndis_per_dev_params [configNr].medium;
+		*((u32 *) resp + 6) = cpu_to_le32 (
+					rndis_per_dev_params [configNr].medium);
 		retval = 0;
 		break;
 		
@@ -132,24 +146,21 @@
 		DEBUG("%s: OID_GEN_MEDIA_IN_USE\n", __FUNCTION__);
 		length = 4;
 		/* one medium, one transport... (maybe you do it better) */
-		*((u32 *) resp + 6) = rndis_per_dev_params [configNr].medium;
+		*((u32 *) resp + 6) = cpu_to_le32 (
+					rndis_per_dev_params [configNr].medium);
 		retval = 0;
 		break;
 		
-	case OID_GEN_MAXIMUM_LOOKAHEAD:
-		DEBUG("%s: OID_GEN_MAXIMUM_LOOKAHEAD\n", __FUNCTION__);
-		break;
-		
 	/* mandatory */
 	case OID_GEN_MAXIMUM_FRAME_SIZE:
 		DEBUG("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].dev) {
 			length = 4;
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr]
-						.dev->mtu;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr].dev->mtu);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -160,30 +171,20 @@
 		length = 4;
 		if (rndis_per_dev_params [configNr].media_state
 			== NDIS_MEDIA_STATE_DISCONNECTED)
-		    *((u32 *) resp + 6) = 0;
+		    *((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 		else
-		    *((u32 *) resp + 6) = rndis_per_dev_params [configNr].speed;
+		    *((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr].speed);
 		retval = 0;
 		break;
-		
-	case OID_GEN_TRANSMIT_BUFFER_SPACE:
-		DEBUG("%s: OID_GEN_TRANSMIT_BUFFER_SPACE\n", __FUNCTION__);
-		length = 4;
-		*((u32 *) resp + 6) = 0;
-		retval = 0;
-		break;
-		
-	case OID_GEN_RECEIVE_BUFFER_SPACE:
-		DEBUG("%s: OID_GEN_RECEIVE_BUFFER_SPACE\n", __FUNCTION__);
-		break;
-		
+
 	/* mandatory */
 	case OID_GEN_TRANSMIT_BLOCK_SIZE:
 		DEBUG("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].dev) {
 			length = 4;
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr]
-						.dev->mtu;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr].dev->mtu);
 			retval = 0;
 		}
 		break;
@@ -193,8 +194,8 @@
 		DEBUG("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].dev) {
 			length = 4;
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr]
-						.dev->mtu;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr].dev->mtu);
 			retval = 0;
 		}
 		break;
@@ -203,7 +204,8 @@
 	case OID_GEN_VENDOR_ID:
 		DEBUG("%s: OID_GEN_VENDOR_ID\n", __FUNCTION__);
 		length = 4;
-		*((u32 *) resp + 6) = rndis_per_dev_params [configNr].vendorID;
+		*((u32 *) resp + 6) = cpu_to_le32 (
+			rndis_per_dev_params [configNr].vendorID);
 		retval = 0;
 		break;
 		
@@ -216,129 +218,92 @@
 		retval = 0;
 		break;
 
+	case OID_GEN_VENDOR_DRIVER_VERSION:
+		DEBUG("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __FUNCTION__);
+		length = 4;
+		/* Created as LE */
+		*((u32 *) resp + 6) = rndis_driver_version;
+		retval = 0;
+		break;
+
 	/* mandatory */
 	case OID_GEN_CURRENT_PACKET_FILTER:
 		DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __FUNCTION__);
 		length = 4;
-		*((u32 *) resp + 6) = rndis_per_dev_params[configNr].filter;
+		*((u32 *) resp + 6) = cpu_to_le32 (
+					rndis_per_dev_params[configNr].filter);
 		retval = 0;
 		break;
-		
-	case OID_GEN_CURRENT_LOOKAHEAD:
-		DEBUG("%s: OID_GEN_CURRENT_LOOKAHEAD\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_DRIVER_VERSION:
-		DEBUG("%s: OID_GEN_DRIVER_VERSION\n", __FUNCTION__);
-		break;
-		
+
 	/* mandatory */
 	case OID_GEN_MAXIMUM_TOTAL_SIZE:
 		DEBUG("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __FUNCTION__);
 		length = 4;
-		*((u32 *) resp + 6) = RNDIS_MAX_TOTAL_SIZE;
-		retval = 0;
-		break;
-		
-	case OID_GEN_PROTOCOL_OPTIONS:
-		DEBUG("%s: OID_GEN_PROTOCOL_OPTIONS\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_MAC_OPTIONS:
-		DEBUG("%s: OID_GEN_MAC_OPTIONS\n", __FUNCTION__);
-		length = 4;
-		*((u32 *) resp + 6) = NDIS_MAC_OPTION_RECEIVE_SERIALIZED | 
-		    NDIS_MAC_OPTION_FULL_DUPLEX;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32(
+					RNDIS_MAX_TOTAL_SIZE);
 		retval = 0;
 		break;
-		
+
 	/* mandatory */
 	case OID_GEN_MEDIA_CONNECT_STATUS:
 		DEBUG("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __FUNCTION__);
 		length = 4;
-		*((u32 *) resp + 6) = rndis_per_dev_params [configNr]
-						.media_state;
+		*((u32 *) resp + 6) = cpu_to_le32 (
+					rndis_per_dev_params [configNr]
+						.media_state);
 		retval = 0;
 		break;
-		
-	case OID_GEN_MAXIMUM_SEND_PACKETS:
-		DEBUG("%s: OID_GEN_MAXIMUM_SEND_PACKETS\n", __FUNCTION__);
-		break;
-		
-	/* mandatory */
-	case OID_GEN_VENDOR_DRIVER_VERSION:
-		DEBUG("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __FUNCTION__);
-		length = 4;
-		*((u32 *) resp + 6) = rndis_driver_version;
-		retval = 0;
-		break;
-		
-	case OID_GEN_SUPPORTED_GUIDS:
-		DEBUG("%s: OID_GEN_SUPPORTED_GUIDS\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_NETWORK_LAYER_ADDRESSES:
-		DEBUG("%s: OID_GEN_NETWORK_LAYER_ADDRESSES\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_TRANSPORT_HEADER_OFFSET:
-		DEBUG("%s: OID_GEN_TRANSPORT_HEADER_OFFSET\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_MACHINE_NAME:
-		DEBUG("%s: OID_GEN_MACHINE_NAME\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_RNDIS_CONFIG_PARAMETER:
-		DEBUG("%s: OID_GEN_RNDIS_CONFIG_PARAMETER\n", __FUNCTION__);
+
+	case OID_GEN_PHYSICAL_MEDIUM:
+		DEBUG("%s: OID_GEN_PHYSICAL_MEDIUM\n", __FUNCTION__);
 		length = 4;
-		*((u32 *) resp + 6) = 0;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 		retval = 0;
 		break;
-		
-	case OID_GEN_VLAN_ID:
-		DEBUG("%s: OID_GEN_VLAN_ID\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_MEDIA_CAPABILITIES:
-		DEBUG("%s: OID_GEN_MEDIA_CAPABILITIES\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_PHYSICAL_MEDIUM:
-		DEBUG("%s: OID_GEN_PHYSICAL_MEDIUM\n", __FUNCTION__);
+
+	/* The RNDIS specification is incomplete/wrong.   Some versions
+	 * of MS-Windows expect OIDs that aren't specified there.  Other
+	 * versions emit undefined RNDIS messages. DOCUMENT ALL THESE!
+	 */
+	case OID_GEN_MAC_OPTIONS:		/* from WinME */
+		DEBUG("%s: OID_GEN_MAC_OPTIONS\n", __FUNCTION__);
 		length = 4;
-		*((u32 *) resp + 6) = 0;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32(
+			  NDIS_MAC_OPTION_RECEIVE_SERIALIZED
+			| NDIS_MAC_OPTION_FULL_DUPLEX);
 		retval = 0;
 		break;
-		
+
+	/* statistics OIDs (table 4-2) */
+
 	/* mandatory */
 	case OID_GEN_XMIT_OK:
 		DEBUG("%s: OID_GEN_XMIT_OK\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
 			length = 4;
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr]
-					.stats->tx_packets - 
+			*((u32 *) resp + 6) = cpu_to_le32 (
+			    rndis_per_dev_params [configNr].stats->tx_packets - 
 			    rndis_per_dev_params [configNr].stats->tx_errors -
-			    rndis_per_dev_params [configNr].stats->tx_dropped;
+			    rndis_per_dev_params [configNr].stats->tx_dropped);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
-		
+
 	/* mandatory */
 	case OID_GEN_RCV_OK:
 		DEBUG("%s: OID_GEN_RCV_OK\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
 			length = 4;
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->rx_packets - 
+			*((u32 *) resp + 6) = cpu_to_le32 (
+			    rndis_per_dev_params [configNr].stats->rx_packets - 
 			    rndis_per_dev_params [configNr].stats->rx_errors -
-			    rndis_per_dev_params [configNr].stats->rx_dropped;
+			    rndis_per_dev_params [configNr].stats->rx_dropped);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -348,11 +313,12 @@
 		DEBUG("%s: OID_GEN_XMIT_ERROR\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
 			length = 4;
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->tx_errors;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->tx_errors);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -361,11 +327,12 @@
 	case OID_GEN_RCV_ERROR:
 		DEBUG("%s: OID_GEN_RCV_ERROR\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->rx_errors;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->rx_errors);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -374,15 +341,17 @@
 	case OID_GEN_RCV_NO_BUFFER:
 		DEBUG("%s: OID_GEN_RCV_NO_BUFFER\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->rx_dropped;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->rx_dropped);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
-		
+
+#ifdef	RNDIS_OPTIONAL_STATS
 	case OID_GEN_DIRECTED_BYTES_XMIT:
 		DEBUG("%s: OID_GEN_DIRECTED_BYTES_XMIT\n", __FUNCTION__);
 		/* 
@@ -392,14 +361,17 @@
 		 */
 		if (rndis_per_dev_params [configNr].stats) {
 			length = 4;
-			*((u32 *) resp + 6) = (rndis_per_dev_params [configNr].
-					stats->tx_packets - 
-			    rndis_per_dev_params [configNr].stats->tx_errors -
-			    rndis_per_dev_params [configNr].stats->tx_dropped)
-					*123;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				(rndis_per_dev_params [configNr]
+					.stats->tx_packets - 
+				 rndis_per_dev_params [configNr]
+					 .stats->tx_errors -
+				 rndis_per_dev_params [configNr]
+					 .stats->tx_dropped)
+				* 123);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -409,14 +381,17 @@
 		/* dito */
 		if (rndis_per_dev_params [configNr].stats) {
 			length = 4;
-			*((u32 *) resp + 6) = (rndis_per_dev_params [configNr].
-					stats->tx_packets - 
-			    rndis_per_dev_params [configNr].stats->tx_errors -
-			    rndis_per_dev_params [configNr].stats->tx_dropped)
-			    		/123;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				(rndis_per_dev_params [configNr]
+					.stats->tx_packets - 
+				 rndis_per_dev_params [configNr]
+					 .stats->tx_errors -
+				 rndis_per_dev_params [configNr]
+					 .stats->tx_dropped)
+				/ 123);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -424,11 +399,12 @@
 	case OID_GEN_MULTICAST_BYTES_XMIT:
 		DEBUG("%s: OID_GEN_MULTICAST_BYTES_XMIT\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->multicast*1234;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->multicast*1234);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -436,11 +412,12 @@
 	case OID_GEN_MULTICAST_FRAMES_XMIT:
 		DEBUG("%s: OID_GEN_MULTICAST_FRAMES_XMIT\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->multicast;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->multicast);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -448,11 +425,12 @@
 	case OID_GEN_BROADCAST_BYTES_XMIT:
 		DEBUG("%s: OID_GEN_BROADCAST_BYTES_XMIT\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->tx_packets/42*255;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->tx_packets/42*255);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -460,35 +438,37 @@
 	case OID_GEN_BROADCAST_FRAMES_XMIT:
 		DEBUG("%s: OID_GEN_BROADCAST_FRAMES_XMIT\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->tx_packets/42;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->tx_packets/42);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
 		
 	case OID_GEN_DIRECTED_BYTES_RCV:
 		DEBUG("%s: OID_GEN_DIRECTED_BYTES_RCV\n", __FUNCTION__);
-		*((u32 *) resp + 6) = 0;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 		retval = 0;
 		break;
 		
 	case OID_GEN_DIRECTED_FRAMES_RCV:
 		DEBUG("%s: OID_GEN_DIRECTED_FRAMES_RCV\n", __FUNCTION__);
-		*((u32 *) resp + 6) = 0;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 		retval = 0;
 		break;
 		
 	case OID_GEN_MULTICAST_BYTES_RCV:
 		DEBUG("%s: OID_GEN_MULTICAST_BYTES_RCV\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->multicast*1111;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->multicast * 1111);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -496,11 +476,12 @@
 	case OID_GEN_MULTICAST_FRAMES_RCV:
 		DEBUG("%s: OID_GEN_MULTICAST_FRAMES_RCV\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->multicast;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->multicast);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -508,11 +489,12 @@
 	case OID_GEN_BROADCAST_BYTES_RCV:
 		DEBUG("%s: OID_GEN_BROADCAST_BYTES_RCV\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->rx_packets/42*255;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->rx_packets/42*255);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -520,11 +502,12 @@
 	case OID_GEN_BROADCAST_FRAMES_RCV:
 		DEBUG("%s: OID_GEN_BROADCAST_FRAMES_RCV\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->rx_packets/42;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->rx_packets/42);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -532,61 +515,25 @@
 	case OID_GEN_RCV_CRC_ERROR:
 		DEBUG("%s: OID_GEN_RCV_CRC_ERROR\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats) {
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr].
-					stats->rx_crc_errors;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->rx_crc_errors);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
 		
 	case OID_GEN_TRANSMIT_QUEUE_LENGTH:
 		DEBUG("%s: OID_GEN_TRANSMIT_QUEUE_LENGTH\n", __FUNCTION__);
-		*((u32 *) resp + 6) = 0;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 		retval = 0;
 		break;
-		
-	case OID_GEN_GET_TIME_CAPS:
-		DEBUG("%s: OID_GEN_GET_TIME_CAPS\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_GET_NETCARD_TIME:
-		DEBUG("%s: OID_GEN_GET_NETCARD_TIME\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_NETCARD_LOAD:
-		DEBUG("%s: OID_GEN_NETCARD_LOAD\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_DEVICE_PROFILE:
-		DEBUG("%s: OID_GEN_DEVICE_PROFILE\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_INIT_TIME_MS:
-		DEBUG("%s: OID_GEN_INIT_TIME_MS\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_RESET_COUNTS:
-		DEBUG("%s: OID_GEN_RESET_COUNTS\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_MEDIA_SENSE_COUNTS:
-		DEBUG("%s: OID_GEN_MEDIA_SENSE_COUNTS\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_FRIENDLY_NAME:
-		DEBUG("%s: OID_GEN_FRIENDLY_NAME\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_MINIPORT_INFO:
-		DEBUG("%s: OID_GEN_MINIPORT_INFO\n", __FUNCTION__);
-		break;
-		
-	case OID_GEN_RESET_VERIFY_PARAMETERS:
-		DEBUG("%s: OID_GEN_RESET_VERIFY_PARAMETERS\n", __FUNCTION__);
-		break;
-		
+#endif	/* RNDIS_OPTIONAL_STATS */
+
+	/* ieee802.3 OIDs (table 4-3) */
+
 	/* mandatory */
 	case OID_802_3_PERMANENT_ADDRESS:
 		DEBUG("%s: OID_802_3_PERMANENT_ADDRESS\n", __FUNCTION__);
@@ -597,7 +544,7 @@
 				length);
 			retval = 0;
 		} else {
-			*((u32 *) resp + 6) = 0;
+			*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 			retval = 0;
 		}
 		break;
@@ -619,7 +566,7 @@
 		DEBUG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__);
 		length = 4;
 		/* Multicast base address only */
-		*((u32 *) resp + 6) = 0xE0000000;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32 (0xE0000000);
 		retval = 0;
 		break;
 		
@@ -628,22 +575,25 @@
 		DEBUG("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __FUNCTION__);
 		 length = 4;
 		/* Multicast base address only */
-		*((u32 *) resp + 6) = 1;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32 (1);
 		retval = 0;
 		break;
 		
 	case OID_802_3_MAC_OPTIONS:
 		DEBUG("%s: OID_802_3_MAC_OPTIONS\n", __FUNCTION__);
 		break;
-		
+
+	/* ieee802.3 statistics OIDs (table 4-4) */
+
 	/* mandatory */
 	case OID_802_3_RCV_ERROR_ALIGNMENT:
 		DEBUG("%s: OID_802_3_RCV_ERROR_ALIGNMENT\n", __FUNCTION__);
 		if (rndis_per_dev_params [configNr].stats)
 		{
 			length = 4;
-			*((u32 *) resp + 6) = rndis_per_dev_params [configNr]
-					.stats->rx_frame_errors;
+			*((u32 *) resp + 6) = cpu_to_le32 (
+				rndis_per_dev_params [configNr]
+					.stats->rx_frame_errors);
 			retval = 0;
 		}
 		break;
@@ -652,7 +602,7 @@
 	case OID_802_3_XMIT_ONE_COLLISION:
 		DEBUG("%s: OID_802_3_XMIT_ONE_COLLISION\n", __FUNCTION__);
 		length = 4;
-		*((u32 *) resp + 6) = 0;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 		retval = 0;
 		break;
 		
@@ -660,10 +610,11 @@
 	case OID_802_3_XMIT_MORE_COLLISIONS:
 		DEBUG("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __FUNCTION__);
 		length = 4;
-		*((u32 *) resp + 6) = 0;
+		*((u32 *) resp + 6) = __constant_cpu_to_le32 (0);
 		retval = 0;
 		break;
 		
+#ifdef	RNDIS_OPTIONAL_STATS
 	case OID_802_3_XMIT_DEFERRED:
 		DEBUG("%s: OID_802_3_XMIT_DEFERRED\n", __FUNCTION__);
 		/* TODO */
@@ -698,14 +649,46 @@
 		DEBUG("%s: OID_802_3_XMIT_LATE_COLLISIONS\n", __FUNCTION__);
 		/* TODO */
 		break;		
-		
-	default: printk (KERN_ERR "%s: unknown OID 0x%08X\n", 
+#endif	/* RNDIS_OPTIONAL_STATS */
+
+#ifdef	RNDIS_PM
+	/* power management OIDs (table 4-5) */
+	case OID_PNP_CAPABILITIES:
+		DEBUG("%s: OID_PNP_CAPABILITIES\n", __FUNCTION__);
+
+		/* just PM, and remote wakeup on link status change
+		 * (not magic packet or pattern match)
+		 */
+		length = sizeof (struct NDIS_PNP_CAPABILITIES);
+		memset (resp, 0, length);
+		{
+			struct NDIS_PNP_CAPABILITIES *caps = (void *) resp;
+
+			caps->Flags = NDIS_DEVICE_WAKE_UP_ENABLE;
+			caps->WakeUpCapabilities.MinLinkChangeWakeUp 
+				 = NdisDeviceStateD3;
+
+			/* FIXME then use usb_gadget_wakeup(), and
+			 * set USB_CONFIG_ATT_WAKEUP in config desc
+			 */
+		}
+		retval = 0;
+		break;
+	case OID_PNP_QUERY_POWER:
+		DEBUG("%s: OID_PNP_QUERY_POWER\n", __FUNCTION__);
+		/* sure, handle any power state that maps to USB suspend */
+		retval = 0;
+		break;
+#endif
+
+	default:
+		printk (KERN_WARNING "%s: query unknown OID 0x%08X\n", 
 			 __FUNCTION__, OID);
 	}
 	
-	resp->InformationBufferOffset = 16;
-	resp->InformationBufferLength = length;
-	resp->MessageLength = 24 + length;
+	resp->InformationBufferOffset = __constant_cpu_to_le32 (16);
+	resp->InformationBufferLength = cpu_to_le32 (length);
+	resp->MessageLength = cpu_to_le32 (24 + length);
 	r->length = 24 + length;
 	return retval;
 }
@@ -715,9 +698,7 @@
 {
 	rndis_set_cmplt_type		*resp;
 	int 				i, retval = -ENOTSUPP;
-	struct rndis_config_parameter	*param;
 	struct rndis_params		*params;
-	u8 *cp;
 
 	if (!r)
 		return -ENOMEM;
@@ -725,20 +706,37 @@
 	if (!resp)
 		return -ENOMEM;
 
-	cp = (u8 *)resp;
+	DEBUG("set OID %08x value, len %d:\n", OID, buf_len);
+	for (i = 0; i < buf_len; i += 16) {
+		DEBUG ("%03d: "
+			" %02x %02x %02x %02x"
+			" %02x %02x %02x %02x"
+			" %02x %02x %02x %02x"
+			" %02x %02x %02x %02x"
+			"\n",
+			i,
+			buf[i], buf [i+1],
+				buf[i+2], buf[i+3],
+			buf[i+4], buf [i+5],
+				buf[i+6], buf[i+7],
+			buf[i+8], buf [i+9],
+				buf[i+10], buf[i+11],
+			buf[i+12], buf [i+13],
+				buf[i+14], buf[i+15]);
+	}
 
 	switch (OID) {
 	case OID_GEN_CURRENT_PACKET_FILTER:
 		params = &rndis_per_dev_params [configNr];
 		retval = 0;
 
-		/* FIXME use this NDIS_PACKET_TYPE_* bitflags to
+		/* FIXME use these NDIS_PACKET_TYPE_* bitflags to
 		 * filter packets in hard_start_xmit()
 		 * NDIS_PACKET_TYPE_x == CDC_PACKET_TYPE_x for x in:
 		 *	PROMISCUOUS, DIRECTED,
 		 *	MULTICAST, ALL_MULTICAST, BROADCAST
 		 */
-		params->filter = *(u32 *)buf;
+		params->filter = cpu_to_le32p((u32 *)buf);
 		DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n",
 			__FUNCTION__, params->filter);
 
@@ -763,23 +761,40 @@
 		DEBUG("%s: OID_802_3_MULTICAST_LIST\n", __FUNCTION__);
 		retval = 0;
 		break;
-		
+#if 0
 	case OID_GEN_RNDIS_CONFIG_PARAMETER:
-		DEBUG("%s: OID_GEN_RNDIS_CONFIG_PARAMETER\n", __FUNCTION__);
+		{
+		struct rndis_config_parameter	*param;
 		param = (struct rndis_config_parameter *) buf;
-		if (param) {
-			for (i = 0; i < param->ParameterNameLength; i++) {
-				DEBUG ("%c", 
-				       *(buf + param->ParameterNameOffset + i));
-			}
-			DEBUG ("\n");
+		DEBUG("%s: OID_GEN_RNDIS_CONFIG_PARAMETER '%*s'\n",
+			__FUNCTION__,
+			min(cpu_to_le32(param->ParameterNameLength),80),
+			buf + param->ParameterNameOffset);
+		retval = 0;
 		}
-		
+		break;
+#endif
+
+#ifdef	RNDIS_PM
+	case OID_PNP_SET_POWER:
+		DEBUG ("OID_PNP_SET_POWER\n");
+		/* sure, handle any power state that maps to USB suspend */
 		retval = 0;
 		break;
-		
-	default: printk (KERN_ERR "%s: unknown OID 0x%08X\n", 
-			 __FUNCTION__, OID);
+
+	case OID_PNP_ENABLE_WAKE_UP:
+		/* always-connected ... */
+		DEBUG ("OID_PNP_ENABLE_WAKE_UP\n");
+		retval = 0;
+		break;
+
+	// no PM resume patterns supported (specified where?)
+	// so OID_PNP_{ADD,REMOVE}_WAKE_UP_PATTERN always fails
+#endif
+
+	default:
+		printk (KERN_WARNING "%s: set unknown OID 0x%08X, size %d\n", 
+			 __FUNCTION__, OID, buf_len);
 	}
 	
 	return retval;
@@ -804,22 +819,24 @@
 	
 	if (!resp) return -ENOMEM;
 	
-	resp->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT;
-	resp->MessageLength = 52;
-	resp->RequestID = buf->RequestID;
-	resp->Status = RNDIS_STATUS_SUCCESS;
-	resp->MajorVersion = RNDIS_MAJOR_VERSION;
-	resp->MinorVersion = RNDIS_MINOR_VERSION;
-	resp->DeviceFlags = RNDIS_DF_CONNECTIONLESS;
-	resp->Medium = RNDIS_MEDIUM_802_3;
-	resp->MaxPacketsPerTransfer = 1;
-	resp->MaxTransferSize = rndis_per_dev_params [configNr].dev->mtu
+	resp->MessageType = __constant_cpu_to_le32 (
+			REMOTE_NDIS_INITIALIZE_CMPLT);
+	resp->MessageLength = __constant_cpu_to_le32 (52);
+	resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
+	resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
+	resp->MajorVersion = __constant_cpu_to_le32 (RNDIS_MAJOR_VERSION);
+	resp->MinorVersion = __constant_cpu_to_le32 (RNDIS_MINOR_VERSION);
+	resp->DeviceFlags = __constant_cpu_to_le32 (RNDIS_DF_CONNECTIONLESS);
+	resp->Medium = __constant_cpu_to_le32 (RNDIS_MEDIUM_802_3);
+	resp->MaxPacketsPerTransfer = __constant_cpu_to_le32 (1);
+	resp->MaxTransferSize = cpu_to_le32 (
+		  rndis_per_dev_params [configNr].dev->mtu
 		+ sizeof (struct ethhdr)
 		+ sizeof (struct rndis_packet_msg_type)
-		+ 22;
-	resp->PacketAlignmentFactor = 0;
-	resp->AFListOffset = 0;
-	resp->AFListSize = 0;
+		+ 22);
+	resp->PacketAlignmentFactor = __constant_cpu_to_le32 (0);
+	resp->AFListOffset = __constant_cpu_to_le32 (0);
+	resp->AFListSize = __constant_cpu_to_le32 (0);
 	
 	if (rndis_per_dev_params [configNr].ack)
 	    rndis_per_dev_params [configNr].ack (
@@ -833,7 +850,7 @@
 	rndis_query_cmplt_type *resp;
 	rndis_resp_t            *r;
 	
-	DEBUG("%s: OID = %08X\n", __FUNCTION__, buf->OID);
+	// DEBUG("%s: OID = %08X\n", __FUNCTION__, cpu_to_le32(buf->OID));
 	if (!rndis_per_dev_params [configNr].dev) return -ENOTSUPP;
 	
 	/* 
@@ -847,17 +864,18 @@
 	
 	if (!resp) return -ENOMEM;
 	
-	resp->MessageType = REMOTE_NDIS_QUERY_CMPLT;
-	resp->MessageLength = 24;
-	resp->RequestID = buf->RequestID;
+	resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_QUERY_CMPLT);
+	resp->MessageLength = __constant_cpu_to_le32 (24);
+	resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
 	
-	if (gen_ndis_query_resp (configNr, buf->OID, r)) {
+	if (gen_ndis_query_resp (configNr, cpu_to_le32 (buf->OID), r)) {
 		/* OID not supported */
-		resp->Status = RNDIS_STATUS_NOT_SUPPORTED;
-		resp->InformationBufferLength = 0;
-		resp->InformationBufferOffset = 0;
+		resp->Status = __constant_cpu_to_le32 (
+				RNDIS_STATUS_NOT_SUPPORTED);
+		resp->InformationBufferLength = __constant_cpu_to_le32 (0);
+		resp->InformationBufferOffset = __constant_cpu_to_le32 (0);
 	} else
-		resp->Status = RNDIS_STATUS_SUCCESS;
+		resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
 	
 	if (rndis_per_dev_params [configNr].ack)
 	    rndis_per_dev_params [configNr].ack (
@@ -867,38 +885,42 @@
 
 static int rndis_set_response (int configNr, rndis_set_msg_type *buf)
 {
+	u32			BufLength, BufOffset;
 	rndis_set_cmplt_type	*resp;
 	rndis_resp_t		*r;
-	int			i;
 	
 	r = rndis_add_response (configNr, sizeof (rndis_set_cmplt_type));
 	
 	if (!r) return -ENOMEM;
 	resp = (rndis_set_cmplt_type *) r->buf;
 	if (!resp) return -ENOMEM;
-	
-	DEBUG("%s: Length: %d\n", __FUNCTION__, buf->InformationBufferLength);
-	DEBUG("%s: Offset: %d\n", __FUNCTION__, buf->InformationBufferOffset);
+
+	BufLength = cpu_to_le32 (buf->InformationBufferLength);
+	BufOffset = cpu_to_le32 (buf->InformationBufferOffset);
+
+#ifdef	VERBOSE
+	DEBUG("%s: Length: %d\n", __FUNCTION__, BufLength);
+	DEBUG("%s: Offset: %d\n", __FUNCTION__, BufOffset);
 	DEBUG("%s: InfoBuffer: ", __FUNCTION__);
 	
-	for (i = 0; i < buf->InformationBufferLength; i++) {
-		DEBUG ("%02x ", *(((u8 *) buf) + i + 12 +
-		       buf->InformationBufferOffset));
+	for (i = 0; i < BufLength; i++) {
+		DEBUG ("%02x ", *(((u8 *) buf) + i + 8 + BufOffset));
 	}
 	
 	DEBUG ("\n");
+#endif
 	
-	resp->MessageType = REMOTE_NDIS_SET_CMPLT;
-	resp->MessageLength = 16;
-	resp->RequestID = buf->RequestID;
-	if (gen_ndis_set_resp (configNr, buf->OID, 
-			       ((u8 *) buf) + 28, 
-			       buf->InformationBufferLength, r))
-	    resp->Status = RNDIS_STATUS_NOT_SUPPORTED;
-	else resp->Status = RNDIS_STATUS_SUCCESS;
+	resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT);
+	resp->MessageLength = __constant_cpu_to_le32 (16);
+	resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
+	if (gen_ndis_set_resp (configNr, cpu_to_le32 (buf->OID), 
+			       ((u8 *) buf) + 8 + BufOffset, BufLength, r))
+	    resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_NOT_SUPPORTED);
+	else resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
 	
 	if (rndis_per_dev_params [configNr].ack)
-	    rndis_per_dev_params [configNr].ack (rndis_per_dev_params [configNr].dev);
+	    rndis_per_dev_params [configNr].ack (
+	    		rndis_per_dev_params [configNr].dev);
 	
 	return 0;
 }
@@ -914,10 +936,11 @@
 	resp = (rndis_reset_cmplt_type *) r->buf;
 	if (!resp) return -ENOMEM;
 	
-	resp->MessageType = REMOTE_NDIS_RESET_CMPLT;
-	resp->MessageLength = 16;
-	resp->Status = RNDIS_STATUS_SUCCESS;
-	resp->AddressingReset = 1; /* resent information */
+	resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_RESET_CMPLT);
+	resp->MessageLength = __constant_cpu_to_le32 (16);
+	resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
+	/* resent information */
+	resp->AddressingReset = __constant_cpu_to_le32 (1);
 	
 	if (rndis_per_dev_params [configNr].ack)
 	    rndis_per_dev_params [configNr].ack (
@@ -938,10 +961,11 @@
 	resp = (rndis_keepalive_cmplt_type *) r->buf;
 	if (!resp) return -ENOMEM;
 		
-	resp->MessageType = REMOTE_NDIS_KEEPALIVE_CMPLT;
-	resp->MessageLength = 16;
-	resp->RequestID = buf->RequestID;
-	resp->Status = RNDIS_STATUS_SUCCESS;
+	resp->MessageType = __constant_cpu_to_le32 (
+			REMOTE_NDIS_KEEPALIVE_CMPLT);
+	resp->MessageLength = __constant_cpu_to_le32 (16);
+	resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
+	resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
 	
 	if (rndis_per_dev_params [configNr].ack)
 	    rndis_per_dev_params [configNr].ack (
@@ -969,11 +993,12 @@
 	resp = (rndis_indicate_status_msg_type *) r->buf;
 	if (!resp) return -ENOMEM;
 	
-	resp->MessageType = REMOTE_NDIS_INDICATE_STATUS_MSG;
-	resp->MessageLength = 20;
-	resp->Status = status;
-	resp->StatusBufferLength = 0;
-	resp->StatusBufferOffset = 0;
+	resp->MessageType = __constant_cpu_to_le32 (
+			REMOTE_NDIS_INDICATE_STATUS_MSG);
+	resp->MessageLength = __constant_cpu_to_le32 (20);
+	resp->Status = cpu_to_le32 (status);
+	resp->StatusBufferLength = __constant_cpu_to_le32 (0);
+	resp->StatusBufferOffset = __constant_cpu_to_le32 (0);
 	
 	if (rndis_per_dev_params [configNr].ack) 
 	    rndis_per_dev_params [configNr].ack (
@@ -1014,8 +1039,8 @@
 		return -ENOMEM;
 	
 	tmp = (u32 *) buf; 
-	MsgType = *tmp;
-	MsgLength = *(tmp + 1);
+	MsgType   = cpu_to_le32p(tmp++);
+	MsgLength = cpu_to_le32p(tmp++);
 	
 	if (configNr >= RNDIS_MAX_CONFIGS)
 		return -ENOTSUPP;
@@ -1025,14 +1050,14 @@
 	switch (MsgType)
 	{
 	case REMOTE_NDIS_INITIALIZE_MSG:
-		DEBUG(KERN_INFO "%s: REMOTE_NDIS_INITIALIZE_MSG\n", 
+		DEBUG("%s: REMOTE_NDIS_INITIALIZE_MSG\n", 
 			__FUNCTION__ );
 		params->state = RNDIS_INITIALIZED;
 		return  rndis_init_response (configNr,
 					     (rndis_init_msg_type *) buf);
 		
 	case REMOTE_NDIS_HALT_MSG:
-		DEBUG(KERN_INFO "%s: REMOTE_NDIS_HALT_MSG\n",
+		DEBUG("%s: REMOTE_NDIS_HALT_MSG\n",
 			__FUNCTION__ );
 		params->state = RNDIS_UNINITIALIZED;
 		if (params->dev) {
@@ -1042,34 +1067,57 @@
 		return 0;
 		
 	case REMOTE_NDIS_QUERY_MSG:
-		DEBUG(KERN_INFO "%s: REMOTE_NDIS_QUERY_MSG\n", 
-			__FUNCTION__ );
 		return rndis_query_response (configNr, 
 					     (rndis_query_msg_type *) buf);
 		
 	case REMOTE_NDIS_SET_MSG:
-		DEBUG(KERN_INFO "%s: REMOTE_NDIS_SET_MSG\n", 
-			__FUNCTION__ );
 		return rndis_set_response (configNr, 
 					   (rndis_set_msg_type *) buf);
 		
 	case REMOTE_NDIS_RESET_MSG:
-		DEBUG(KERN_INFO "%s: REMOTE_NDIS_RESET_MSG\n", 
+		DEBUG("%s: REMOTE_NDIS_RESET_MSG\n", 
 			__FUNCTION__ );
 		return rndis_reset_response (configNr,
 					     (rndis_reset_msg_type *) buf);
 
 	case REMOTE_NDIS_KEEPALIVE_MSG:
 		/* For USB: host does this every 5 seconds */
-		DEBUG(KERN_INFO "%s: REMOTE_NDIS_KEEPALIVE_MSG\n", 
+#ifdef	VERBOSE
+		DEBUG("%s: REMOTE_NDIS_KEEPALIVE_MSG\n", 
 			__FUNCTION__ );
+#endif
 		return rndis_keepalive_response (configNr,
 						 (rndis_keepalive_msg_type *) 
 						 buf);
 		
 	default: 
-		printk (KERN_ERR "%s: unknown RNDIS Message Type 0x%08X\n", 
-			__FUNCTION__ , MsgType);
+		/* At least Windows XP emits some undefined RNDIS messages.
+		 * In one case those messages seemed to relate to the host
+		 * suspending itself.
+		 */
+		printk (KERN_WARNING
+			"%s: unknown RNDIS message 0x%08X len %d\n", 
+			__FUNCTION__ , MsgType, MsgLength);
+		{
+			unsigned i;
+			for (i = 0; i < MsgLength; i += 16) {
+				DEBUG ("%03d: "
+					" %02x %02x %02x %02x"
+					" %02x %02x %02x %02x"
+					" %02x %02x %02x %02x"
+					" %02x %02x %02x %02x"
+					"\n",
+					i,
+					buf[i], buf [i+1],
+						buf[i+2], buf[i+3],
+					buf[i+4], buf [i+5],
+						buf[i+6], buf[i+7],
+					buf[i+8], buf [i+9],
+						buf[i+10], buf[i+11],
+					buf[i+12], buf [i+13],
+						buf[i+14], buf[i+15]);
+			}
+		}
 		break;
 	}
 	
@@ -1079,13 +1127,12 @@
 int rndis_register (int (* rndis_control_ack) (struct net_device *))
 {
 	u8 i;
-	DEBUG("%s: ", __FUNCTION__ );
 	
 	for (i = 0; i < RNDIS_MAX_CONFIGS; i++) {
 		if (!rndis_per_dev_params [i].used) {
 			rndis_per_dev_params [i].used = 1;
 			rndis_per_dev_params [i].ack = rndis_control_ack;
-			DEBUG("configNr = %d\n", i);
+			DEBUG("%s: configNr = %d\n", __FUNCTION__, i);
 			return i;
 		}
 	}
@@ -1145,10 +1192,10 @@
 	if (!skb) return;
 	skb_push (skb, sizeof (struct rndis_packet_msg_type));
 	memset (skb->data, 0, sizeof (struct rndis_packet_msg_type));
-	*((u32 *) skb->data) = 1;
-	*((u32 *) skb->data + 1) = skb->len;
-	*((u32 *) skb->data + 2) = 36;
-	*((u32 *) skb->data + 3) = skb->len - 44;
+	*((u32 *) skb->data) = __constant_cpu_to_le32 (1);
+	*((u32 *) skb->data + 1) = cpu_to_le32(skb->len);
+	*((u32 *) skb->data + 2) = __constant_cpu_to_le32 (36);
+	*((u32 *) skb->data + 3) = cpu_to_le32(skb->len - 44);
 	
 	return;
 }
@@ -1208,14 +1255,16 @@
 
 int rndis_rm_hdr (u8 *buf, u32 *length)
 {
-	u32 i, messageLen, dataOffset;
+	u32 i, messageLen, dataOffset, *tmp;
 	
+	tmp = (u32 *) buf; 
+
 	if (!buf || !length) return -1;
-	if (*((u32 *) buf) != 1) return -1;
+	if (cpu_to_le32p(tmp++) != 1) return -1;
 	
-	messageLen = *((u32 *) buf + 1);
-	
-	dataOffset = *((u32 *) buf + 2) + 8;
+	messageLen = cpu_to_le32p(tmp++);
+	dataOffset = cpu_to_le32p(tmp++) + 8;
+
 	if (messageLen < dataOffset || messageLen > *length) return -1;
 	
 	for (i = dataOffset; i < messageLen; i++)
diff -Nru a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h
--- a/drivers/usb/gadget/rndis.h	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/gadget/rndis.h	2004-06-08 22:03:37 -07:00
@@ -59,10 +59,18 @@
 
 #define RNDIS_MEDIUM_802_3		0x00000000U
 
+/* from drivers/net/sk98lin/h/skgepnmi.h */
+#define OID_PNP_CAPABILITIES			0xFD010100
+#define OID_PNP_SET_POWER			0xFD010101
+#define OID_PNP_QUERY_POWER			0xFD010102
+#define OID_PNP_ADD_WAKE_UP_PATTERN		0xFD010103
+#define OID_PNP_REMOVE_WAKE_UP_PATTERN		0xFD010104
+#define OID_PNP_ENABLE_WAKE_UP			0xFD010106
+
+
 /* supported OIDs */
 static const u32 oid_supported_list [] = 
 {
-	/* mandatory general */
 	/* the general stuff */
 	OID_GEN_SUPPORTED_LIST,
 	OID_GEN_HARDWARE_STATUS,
@@ -70,7 +78,6 @@
 	OID_GEN_MEDIA_IN_USE,
 	OID_GEN_MAXIMUM_FRAME_SIZE,
 	OID_GEN_LINK_SPEED,
-	OID_GEN_TRANSMIT_BUFFER_SPACE,
 	OID_GEN_TRANSMIT_BLOCK_SIZE,
 	OID_GEN_RECEIVE_BLOCK_SIZE,
 	OID_GEN_VENDOR_ID,
@@ -78,10 +85,11 @@
 	OID_GEN_VENDOR_DRIVER_VERSION,
 	OID_GEN_CURRENT_PACKET_FILTER,
 	OID_GEN_MAXIMUM_TOTAL_SIZE,
-	OID_GEN_MAC_OPTIONS,
 	OID_GEN_MEDIA_CONNECT_STATUS,
 	OID_GEN_PHYSICAL_MEDIUM,
+#if 0
 	OID_GEN_RNDIS_CONFIG_PARAMETER,
+#endif
 	
 	/* the statistical stuff */
 	OID_GEN_XMIT_OK,
@@ -89,6 +97,7 @@
 	OID_GEN_XMIT_ERROR,
 	OID_GEN_RCV_ERROR,
 	OID_GEN_RCV_NO_BUFFER,
+#ifdef	RNDIS_OPTIONAL_STATS
 	OID_GEN_DIRECTED_BYTES_XMIT,
 	OID_GEN_DIRECTED_FRAMES_XMIT,
 	OID_GEN_MULTICAST_BYTES_XMIT,
@@ -103,6 +112,7 @@
 	OID_GEN_BROADCAST_FRAMES_RCV,
 	OID_GEN_RCV_CRC_ERROR,
 	OID_GEN_TRANSMIT_QUEUE_LENGTH,
+#endif	/* RNDIS_OPTIONAL_STATS */
 
     	/* mandatory 802.3 */
 	/* the general stuff */
@@ -115,7 +125,30 @@
 	/* the statistical stuff */
 	OID_802_3_RCV_ERROR_ALIGNMENT,
 	OID_802_3_XMIT_ONE_COLLISION,
-	OID_802_3_XMIT_MORE_COLLISIONS
+	OID_802_3_XMIT_MORE_COLLISIONS,
+#ifdef	RNDIS_OPTIONAL_STATS
+	OID_802_3_XMIT_DEFERRED,
+	OID_802_3_XMIT_MAX_COLLISIONS,
+	OID_802_3_RCV_OVERRUN,
+	OID_802_3_XMIT_UNDERRUN,
+	OID_802_3_XMIT_HEARTBEAT_FAILURE,
+	OID_802_3_XMIT_TIMES_CRS_LOST,
+	OID_802_3_XMIT_LATE_COLLISIONS,
+#endif	/* RNDIS_OPTIONAL_STATS */
+
+#ifdef	RNDIS_PM
+	/* PM and wakeup are mandatory for USB: */
+
+	/* power management */
+	OID_PNP_CAPABILITIES,
+	OID_PNP_QUERY_POWER,
+	OID_PNP_SET_POWER,
+
+	/* wake up host */
+	OID_PNP_ENABLE_WAKE_UP,
+	OID_PNP_ADD_WAKE_UP_PATTERN,
+	OID_PNP_REMOVE_WAKE_UP_PATTERN,
+#endif
 };
 
 
diff -Nru a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
--- a/drivers/usb/host/ohci-dbg.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/host/ohci-dbg.c	2004-06-08 22:03:37 -07:00
@@ -134,13 +134,13 @@
 	struct ohci_regs	*regs = controller->regs;
 	u32			temp;
 
-	temp = readl (&regs->revision) & 0xff;
+	temp = ohci_readl (&regs->revision) & 0xff;
 	ohci_dbg_sw (controller, next, size,
 		"OHCI %d.%d, %s legacy support registers\n",
 		0x03 & (temp >> 4), (temp & 0x0f),
 		(temp & 0x10) ? "with" : "NO");
 
-	temp = readl (&regs->control);
+	temp = ohci_readl (&regs->control);
 	ohci_dbg_sw (controller, next, size,
 		"control 0x%03x%s%s%s HCFS=%s%s%s%s%s CBSR=%d\n",
 		temp,
@@ -155,7 +155,7 @@
 		temp & OHCI_CTRL_CBSR
 		);
 
-	temp = readl (&regs->cmdstatus);
+	temp = ohci_readl (&regs->cmdstatus);
 	ohci_dbg_sw (controller, next, size,
 		"cmdstatus 0x%05x SOC=%d%s%s%s%s\n", temp,
 		(temp & OHCI_SOC) >> 16,
@@ -166,26 +166,26 @@
 		);
 
 	ohci_dump_intr_mask (controller, "intrstatus",
-			readl (&regs->intrstatus), next, size);
+			ohci_readl (&regs->intrstatus), next, size);
 	ohci_dump_intr_mask (controller, "intrenable",
-			readl (&regs->intrenable), next, size);
+			ohci_readl (&regs->intrenable), next, size);
 	// intrdisable always same as intrenable
 
 	maybe_print_eds (controller, "ed_periodcurrent",
-			readl (&regs->ed_periodcurrent), next, size);
+			ohci_readl (&regs->ed_periodcurrent), next, size);
 
 	maybe_print_eds (controller, "ed_controlhead",
-			readl (&regs->ed_controlhead), next, size);
+			ohci_readl (&regs->ed_controlhead), next, size);
 	maybe_print_eds (controller, "ed_controlcurrent",
-			readl (&regs->ed_controlcurrent), next, size);
+			ohci_readl (&regs->ed_controlcurrent), next, size);
 
 	maybe_print_eds (controller, "ed_bulkhead",
-			readl (&regs->ed_bulkhead), next, size);
+			ohci_readl (&regs->ed_bulkhead), next, size);
 	maybe_print_eds (controller, "ed_bulkcurrent",
-			readl (&regs->ed_bulkcurrent), next, size);
+			ohci_readl (&regs->ed_bulkcurrent), next, size);
 
 	maybe_print_eds (controller, "donehead",
-			readl (&regs->donehead), next, size);
+			ohci_readl (&regs->donehead), next, size);
 }
 
 #define dbg_port_sw(hc,num,value,next,size) \
@@ -637,7 +637,7 @@
 			"hcca frame 0x%04x\n", OHCI_FRAME_NO(ohci->hcca));
 
 	/* other registers mostly affect frame timings */
-	rdata = readl (&regs->fminterval);
+	rdata = ohci_readl (&regs->fminterval);
 	temp = scnprintf (next, size,
 			"fmintvl 0x%08x %sFSMPS=0x%04x FI=0x%04x\n",
 			rdata, (rdata >> 31) ? " FIT" : "",
@@ -645,20 +645,20 @@
 	size -= temp;
 	next += temp;
 
-	rdata = readl (&regs->fmremaining);
+	rdata = ohci_readl (&regs->fmremaining);
 	temp = scnprintf (next, size, "fmremaining 0x%08x %sFR=0x%04x\n",
 			rdata, (rdata >> 31) ? " FRT" : "",
 			rdata & 0x3fff);
 	size -= temp;
 	next += temp;
 
-	rdata = readl (&regs->periodicstart);
+	rdata = ohci_readl (&regs->periodicstart);
 	temp = scnprintf (next, size, "periodicstart 0x%04x\n",
 			rdata & 0x3fff);
 	size -= temp;
 	next += temp;
 
-	rdata = readl (&regs->lsthresh);
+	rdata = ohci_readl (&regs->lsthresh);
 	temp = scnprintf (next, size, "lsthresh 0x%04x\n",
 			rdata & 0x3fff);
 	size -= temp;
diff -Nru a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
--- a/drivers/usb/host/ohci-hcd.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/host/ohci-hcd.c	2004-06-08 22:03:37 -07:00
@@ -17,6 +17,7 @@
  *
  * History:
  * 
+ * 2004/03/24 LH7A404 support (Durgesh Pattamatta & Marc Singer)
  * 2004/02/04 use generic dma_* functions instead of pci_* (dsaxena@plexity.net)
  * 2003/02/24 show registers in sysfs (Kevin Brosius)
  *
@@ -393,7 +394,7 @@
 
 	/* boot firmware should have set this up (5.1.1.3.1) */
 	if (!ohci->fminterval) {
-		temp = readl (&ohci->regs->fminterval);
+		temp = ohci_readl (&ohci->regs->fminterval);
 		if (temp & 0x3fff0000)
 			ohci->fminterval = temp;
 		else
@@ -405,7 +406,7 @@
 	 * On PA-RISC, PDC can leave IR set incorrectly; ignore it there.
 	 */
 #ifndef __hppa__
-	if (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
+	if (ohci_readl (&ohci->regs->control) & OHCI_CTRL_IR) {
 		ohci_dbg (ohci, "USB HC TakeOver from BIOS/SMM\n");
 
 		/* this timeout is arbitrary.  we make it long, so systems
@@ -416,7 +417,7 @@
 
 		writel (OHCI_INTR_OC, &ohci->regs->intrenable);
 		writel (OHCI_OCR, &ohci->regs->cmdstatus);
-		while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
+		while (ohci_readl (&ohci->regs->control) & OHCI_CTRL_IR) {
 			msleep (10);
 			if (--temp == 0) {
 				ohci_err (ohci, "USB HC TakeOver failed!\n");
@@ -430,13 +431,13 @@
 	writel (OHCI_INTR_MIE, &ohci->regs->intrdisable);
 
 	ohci_dbg (ohci, "reset, control = 0x%x\n",
-		readl (&ohci->regs->control));
+		  ohci_readl (&ohci->regs->control));
 
   	/* Reset USB (needed by some controllers); RemoteWakeupConnected
 	 * saved if boot firmware (BIOS/SMM/...) told us it's connected
 	 * (for OHCI integrated on mainboard, it normally is)
 	 */
-	ohci->hc_control = readl (&ohci->regs->control);
+	ohci->hc_control = ohci_readl (&ohci->regs->control);
 	ohci->hc_control &= OHCI_CTRL_RWC;	/* hcfs 0 = RESET */
 	if (ohci->hc_control)
 		ohci->hcd.can_wakeup = 1;
@@ -450,13 +451,13 @@
 				&ohci->regs->roothub.portstatus [temp]);
 	}
 	// flush those pci writes
-	(void) readl (&ohci->regs->control);
+	(void) ohci_readl (&ohci->regs->control);
 	msleep (50);
 
 	/* HC Reset requires max 10 us delay */
 	writel (OHCI_HCR,  &ohci->regs->cmdstatus);
 	temp = 30;	/* ... allow extra time */
-	while ((readl (&ohci->regs->cmdstatus) & OHCI_HCR) != 0) {
+	while ((ohci_readl (&ohci->regs->cmdstatus) & OHCI_HCR) != 0) {
 		if (--temp == 0) {
 			ohci_err (ohci, "USB HC reset timed out!\n");
 			return -1;
@@ -473,7 +474,7 @@
 	 */
 	writel (ohci->hc_control, &ohci->regs->control);
 	// flush those pci writes
-	(void) readl (&ohci->regs->control);
+	(void) ohci_readl (&ohci->regs->control);
 
 	return 0;
 }
@@ -505,8 +506,8 @@
 	/* some OHCI implementations are finicky about how they init.
 	 * bogus values here mean not even enumeration could work.
 	 */
-	if ((readl (&ohci->regs->fminterval) & 0x3fff0000) == 0
-			|| !readl (&ohci->regs->periodicstart)) {
+	if ((ohci_readl (&ohci->regs->fminterval) & 0x3fff0000) == 0
+			|| !ohci_readl (&ohci->regs->periodicstart)) {
 		ohci_err (ohci, "init err\n");
 		return -EOVERFLOW;
 	}
@@ -548,7 +549,7 @@
 	writel (RH_HS_LPSC, &ohci->regs->roothub.status);
 	writel (power_switching ? RH_B_PPCM : 0, &ohci->regs->roothub.b);
 	// flush those pci writes
-	(void) readl (&ohci->regs->control);
+	(void) ohci_readl (&ohci->regs->control);
 
 	// POTPGT delay is bits 24-31, in 2 ms units.
 	mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
@@ -592,19 +593,20 @@
 	struct ohci_regs	*regs = ohci->regs;
  	int			ints; 
 
-	/* we can eliminate a (slow) readl() if _only_ WDH caused this irq */
+	/* we can eliminate a (slow) ohci_readl()
+	   if _only_ WDH caused this irq */
 	if ((ohci->hcca->done_head != 0)
 			&& ! (le32_to_cpup (&ohci->hcca->done_head) & 0x01)) {
 		ints =  OHCI_INTR_WDH;
 
 	/* cardbus/... hardware gone before remove() */
-	} else if ((ints = readl (&regs->intrstatus)) == ~(u32)0) {
+	} else if ((ints = ohci_readl (&regs->intrstatus)) == ~(u32)0) {
 		disable (ohci);
 		ohci_dbg (ohci, "device removed!\n");
 		return IRQ_HANDLED;
 
 	/* interrupt for some other device? */
-	} else if ((ints &= readl (&regs->intrenable)) == 0) {
+	} else if ((ints &= ohci_readl (&regs->intrenable)) == 0) {
 		return IRQ_NONE;
 	} 
 
@@ -650,7 +652,7 @@
 		writel (ints, &regs->intrstatus);
 		writel (OHCI_INTR_MIE, &regs->intrenable);	
 		// flush those pci writes
-		(void) readl (&ohci->regs->control);
+		(void) ohci_readl (&ohci->regs->control);
 	}
 
 	return IRQ_HANDLED;
@@ -798,6 +800,14 @@
 #include "ohci-omap.c"
 #endif
 
-#if !(defined(CONFIG_PCI) || defined(CONFIG_SA1111) || defined(CONFIG_ARCH_OMAP))
+#ifdef CONFIG_ARCH_LH7A404
+#include "ohci-lh7a404.c"
+#endif
+
+#if !(defined(CONFIG_PCI) \
+      || defined(CONFIG_SA1111) \
+      || defined(CONFIG_ARCH_OMAP) \
+      || defined (CONFIG_ARCH_LH7A404) \
+	)
 #error "missing bus glue for ohci-hcd"
 #endif
diff -Nru a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
--- a/drivers/usb/host/ohci-hub.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/host/ohci-hub.c	2004-06-08 22:03:37 -07:00
@@ -20,20 +20,20 @@
  * till some bits (mostly reserved) are clear; ok for all revs.
  */
 #define read_roothub(hc, register, mask) ({ \
-	u32 temp = readl (&hc->regs->roothub.register); \
+	u32 temp = ohci_readl (&hc->regs->roothub.register); \
 	if (temp == -1) \
 		disable (hc); \
 	else if (hc->flags & OHCI_QUIRK_AMD756) \
 		while (temp & mask) \
-			temp = readl (&hc->regs->roothub.register); \
+			temp = ohci_readl (&hc->regs->roothub.register); \
 	temp; })
 
 static u32 roothub_a (struct ohci_hcd *hc)
 	{ return read_roothub (hc, a, 0xfc0fe000); }
 static inline u32 roothub_b (struct ohci_hcd *hc)
-	{ return readl (&hc->regs->roothub.b); }
+	{ return ohci_readl (&hc->regs->roothub.b); }
 static inline u32 roothub_status (struct ohci_hcd *hc)
-	{ return readl (&hc->regs->roothub.status); }
+	{ return ohci_readl (&hc->regs->roothub.status); }
 static u32 roothub_portstatus (struct ohci_hcd *hc, int i)
 	{ return read_roothub (hc, portstatus [i], 0xffe0fce0); }
 
@@ -83,14 +83,14 @@
 
 	spin_lock_irq (&ohci->lock);
 
-	ohci->hc_control = readl (&ohci->regs->control);
+	ohci->hc_control = ohci_readl (&ohci->regs->control);
 	switch (ohci->hc_control & OHCI_CTRL_HCFS) {
 	case OHCI_USB_RESUME:
 		ohci_dbg (ohci, "resume/suspend?\n");
 		ohci->hc_control &= ~OHCI_CTRL_HCFS;
 		ohci->hc_control |= OHCI_USB_RESET;
 		writel (ohci->hc_control, &ohci->regs->control);
-		(void) readl (&ohci->regs->control);
+		(void) ohci_readl (&ohci->regs->control);
 		/* FALL THROUGH */
 	case OHCI_USB_RESET:
 		status = -EBUSY;
@@ -109,7 +109,7 @@
 
 		ohci->hc_control &= ~OHCI_SCHED_ENABLES;
 		writel (ohci->hc_control, &ohci->regs->control);
-		ohci->hc_control = readl (&ohci->regs->control);
+		ohci->hc_control = ohci_readl (&ohci->regs->control);
 		writel (OHCI_INTR_SF, &ohci->regs->intrstatus);
 
 		/* sched disables take effect on the next frame,
@@ -120,7 +120,7 @@
 		while (limit > 0) {
 			udelay (250);
 			limit =- 250;
-			if (readl (&ohci->regs->intrstatus) & OHCI_INTR_SF)
+			if (ohci_readl (&ohci->regs->intrstatus) & OHCI_INTR_SF)
 				break;
 		}
 		dl_done_list (ohci, 0);
@@ -128,7 +128,7 @@
 	}
 	dl_done_list (ohci, 0);
 	finish_unlinks (ohci, OHCI_FRAME_NO(ohci->hcca), 0);
-	writel (readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus);
+	writel (ohci_readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus);
 
 	/* maybe resume can wake root hub */
 	if (ohci->hcd.remote_wakeup)
@@ -140,7 +140,7 @@
 	ohci->hc_control &= ~OHCI_CTRL_HCFS;
 	ohci->hc_control |= OHCI_USB_SUSPEND;
 	writel (ohci->hc_control, &ohci->regs->control);
-	(void) readl (&ohci->regs->control);
+	(void) ohci_readl (&ohci->regs->control);
 
 	/* no resumes until devices finish suspending */
 	ohci->next_statechange = jiffies + msecs_to_jiffies (5);
@@ -179,13 +179,13 @@
 		return -EAGAIN;
 
 	spin_lock_irq (&ohci->lock);
-	ohci->hc_control = readl (&ohci->regs->control);
+	ohci->hc_control = ohci_readl (&ohci->regs->control);
 	switch (ohci->hc_control & OHCI_CTRL_HCFS) {
 	case OHCI_USB_SUSPEND:
 		ohci->hc_control &= ~(OHCI_CTRL_HCFS|OHCI_SCHED_ENABLES);
 		ohci->hc_control |= OHCI_USB_RESUME;
 		writel (ohci->hc_control, &ohci->regs->control);
-		(void) readl (&ohci->regs->control);
+		(void) ohci_readl (&ohci->regs->control);
 		ohci_dbg (ohci, "resume root hub\n");
 		break;
 	case OHCI_USB_RESUME:
@@ -210,7 +210,7 @@
 	temp = roothub_a (ohci) & RH_A_NDP;
 	enables = 0;
 	while (temp--) {
-		u32 stat = readl (&ohci->regs->roothub.portstatus [temp]);
+		u32 stat = ohci_readl (&ohci->regs->roothub.portstatus [temp]);
 
 		/* force global, not selective, resume */
 		if (!(stat & RH_PS_PSS))
@@ -222,7 +222,7 @@
 	ohci->hcd.state = USB_STATE_RESUMING;
 	mdelay (20 /* usb 11.5.1.10 */ + 15);
 
-	temp = readl (&ohci->regs->control);
+	temp = ohci_readl (&ohci->regs->control);
 	temp &= OHCI_CTRL_HCFS;
 	if (temp != OHCI_USB_RESUME) {
 		ohci_err (ohci, "controller won't resume\n");
@@ -243,11 +243,11 @@
 	writel (OHCI_INTR_INIT, &ohci->regs->intrenable);
 	if (ohci->ed_rm_list)
 		writel (OHCI_INTR_SF, &ohci->regs->intrenable);
-	writel (readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus);
+	writel (ohci_readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus);
 
 	/* Then re-enable operations */
 	writel (OHCI_USB_OPER, &ohci->regs->control);
-	(void) readl (&ohci->regs->control);
+	(void) ohci_readl (&ohci->regs->control);
 	msleep (3);
 
 	temp = OHCI_CONTROL_INIT | OHCI_USB_OPER;
@@ -255,7 +255,7 @@
 		temp |= OHCI_CTRL_RWC;
 	ohci->hc_control = temp;
 	writel (temp, &ohci->regs->control);
-	(void) readl (&ohci->regs->control);
+	(void) ohci_readl (&ohci->regs->control);
 
 	/* TRSMRCY */
 	msleep (10);
@@ -290,7 +290,7 @@
 		writel (ohci->hc_control, &ohci->regs->control);
 		if (temp)
 			writel (status, &ohci->regs->cmdstatus);
-		(void) readl (&ohci->regs->control);
+		(void) ohci_readl (&ohci->regs->control);
 	}
 
 	ohci->hcd.state = USB_STATE_RUNNING;
@@ -332,7 +332,7 @@
 		if (!HCD_IS_RUNNING(ohci->hcd.state))
 			return -ESHUTDOWN;
 		ohci_err (ohci, "bogus NDP=%d, rereads as NDP=%d\n",
-			ports, readl (&ohci->regs->roothub.a) & RH_A_NDP);
+			ports, ohci_readl (&ohci->regs->roothub.a) & RH_A_NDP);
 		/* retry later; "should not happen" */
 		return 0;
 	}
@@ -496,7 +496,7 @@
 			goto error;
 		}
 		writel (temp, &ohci->regs->roothub.portstatus [wIndex]);
-		// readl (&ohci->regs->roothub.portstatus [wIndex]);
+		// ohci_readl (&ohci->regs->roothub.portstatus [wIndex]);
 		break;
 	case GetHubDescriptor:
 		ohci_hub_descriptor (ohci, (struct usb_hub_descriptor *) buf);
@@ -541,7 +541,7 @@
 				&ohci->regs->roothub.portstatus [wIndex]);
 			break;
 		case USB_PORT_FEAT_RESET:
-			temp = readl (&ohci->regs->roothub.portstatus [wIndex]);
+			temp = ohci_readl (&ohci->regs->roothub.portstatus [wIndex]);
 			if (temp & RH_PS_CCS)
 				writel (RH_PS_PRS,
 				    &ohci->regs->roothub.portstatus [wIndex]);
diff -Nru a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
--- a/drivers/usb/host/ohci-q.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/host/ohci-q.c	2004-06-08 22:03:37 -07:00
@@ -321,7 +321,7 @@
 			if (!ed->hwNextED) {
 				ohci->hc_control &= ~OHCI_CTRL_CLE;
 				writel (ohci->hc_control, &ohci->regs->control);
-				// a readl() later syncs CLE with the HC
+				// a ohci_readl() later syncs CLE with the HC
 			} else
 				writel (le32_to_cpup (&ed->hwNextED),
 					&ohci->regs->ed_controlhead);
@@ -345,7 +345,7 @@
 			if (!ed->hwNextED) {
 				ohci->hc_control &= ~OHCI_CTRL_BLE;
 				writel (ohci->hc_control, &ohci->regs->control);
-				// a readl() later syncs BLE with the HC
+				// a ohci_readl() later syncs BLE with the HC
 			} else
 				writel (le32_to_cpup (&ed->hwNextED),
 					&ohci->regs->ed_bulkhead);
@@ -481,7 +481,7 @@
 	writel (OHCI_INTR_SF, &ohci->regs->intrstatus);
 	writel (OHCI_INTR_SF, &ohci->regs->intrenable);
 	// flush those writes, and get latest HCCA contents
-	(void) readl (&ohci->regs->control);
+	(void) ohci_readl (&ohci->regs->control);
 
 	/* SF interrupt might get delayed; record the frame counter value that
 	 * indicates when the HC isn't looking at it, so concurrent unlinks
diff -Nru a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
--- a/drivers/usb/host/ohci.h	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/host/ohci.h	2004-06-08 22:03:37 -07:00
@@ -429,3 +429,22 @@
 #	define ohci_vdbg(ohci, fmt, args...) do { } while (0)
 #endif
 
+#ifdef CONFIG_ARCH_LH7A404
+	/* Marc Singer: at the time this code was written, the LH7A404
+	 * had a problem reading the USB host registers.  This
+	 * implementation of the ohci_readl function performs the read
+	 * twice as a work-around.
+	 */
+static inline unsigned int ohci_readl (void* regs)
+{
+	*(volatile unsigned int*) regs;
+	return *(volatile unsigned int*) regs;
+}
+#else
+	/* Standard version of ohci_readl uses standard, platform
+	 * specific implementation. */
+static inline unsigned int ohci_readl (void* regs)
+{
+	return readl (regs);
+}
+#endif
diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
--- a/drivers/usb/host/uhci-hcd.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/host/uhci-hcd.c	2004-06-08 22:03:37 -07:00
@@ -103,8 +103,8 @@
 static void hc_state_transitions(struct uhci_hcd *uhci);
 
 /* If a transfer is still active after this much time, turn off FSBR */
-#define IDLE_TIMEOUT	(HZ / 20)	/* 50 ms */
-#define FSBR_DELAY	(HZ / 20)	/* 50 ms */
+#define IDLE_TIMEOUT	msecs_to_jiffies(50)
+#define FSBR_DELAY	msecs_to_jiffies(50)
 
 /* When we timeout an idle transfer for FSBR, we'll switch it over to */
 /* depth first traversal. We'll do it in groups of this number of TD's */
@@ -1611,6 +1611,7 @@
 	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
 	struct list_head list, *tmp, *head;
 	unsigned long flags;
+	int called_uhci_finish_completion = 0;
 
 	INIT_LIST_HEAD(&list);
 
@@ -1619,6 +1620,7 @@
 	    uhci_get_current_frame_number(uhci) != uhci->urb_remove_age) {
 		uhci_remove_pending_urbps(uhci);
 		uhci_finish_completion(hcd, NULL);
+		called_uhci_finish_completion = 1;
 	}
 
 	head = &uhci->urb_list;
@@ -1646,6 +1648,10 @@
 	}
 	spin_unlock_irqrestore(&uhci->schedule_lock, flags);
 
+	/* Wake up anyone waiting for an URB to complete */
+	if (called_uhci_finish_completion)
+		wake_up_all(&uhci->waitqh);
+
 	head = &list;
 	tmp = head->next;
 	while (tmp != head) {
@@ -1676,7 +1682,7 @@
 	init_timer(&uhci->stall_timer);
 	uhci->stall_timer.function = stall_callback;
 	uhci->stall_timer.data = (unsigned long)hcd;
-	uhci->stall_timer.expires = jiffies + (HZ / 10);
+	uhci->stall_timer.expires = jiffies + msecs_to_jiffies(100);
 	add_timer(&uhci->stall_timer);
 
 	return 0;
@@ -1831,16 +1837,20 @@
 {
 	unsigned int io_addr = uhci->io_addr;
 
+	/* Turn off PIRQ, SMI, and all interrupts.  This also turns off
+	 * the BIOS's USB Legacy Support.
+	 */
+	pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
+	outw(0, uhci->io_addr + USBINTR);
+
 	/* Global reset for 50ms */
 	uhci->state = UHCI_RESET;
 	outw(USBCMD_GRESET, io_addr + USBCMD);
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout((HZ*50+999) / 1000);
+	msleep(50);
 	outw(0, io_addr + USBCMD);
 
 	/* Another 10ms delay */
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout((HZ*10+999) / 1000);
+	msleep(10);
 	uhci->resume_detect = 0;
 }
 
@@ -1865,7 +1875,7 @@
 			/* Global resume for >= 20ms */
 			outw(USBCMD_FGR | USBCMD_EGSM, io_addr + USBCMD);
 			uhci->state = UHCI_RESUMING_1;
-			uhci->state_end = jiffies + (20*HZ+999) / 1000;
+			uhci->state_end = jiffies + msecs_to_jiffies(20);
 			break;
 
 		case UHCI_RESUMING_1:		/* End global resume */
@@ -1990,7 +2000,9 @@
 		}
 	}
 
-	/* Turn on all interrupts */
+	/* Turn on PIRQ and all interrupts */
+	pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP,
+			USBLEGSUP_DEFAULT);
 	outw(USBINTR_TIMEOUT | USBINTR_RESUME | USBINTR_IOC | USBINTR_SP,
 		io_addr + USBINTR);
 
@@ -2054,15 +2066,10 @@
 
 	uhci->io_addr = (unsigned long) hcd->regs;
 
-	/* Turn off all interrupts */
-	outw(0, uhci->io_addr + USBINTR);
-
-	/* Maybe kick BIOS off this hardware.  Then reset, so we won't get
+	/* Kick BIOS off this hardware and reset, so we won't get
 	 * interrupts from any previous setup.
 	 */
 	reset_hc(uhci);
-	pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP,
-			USBLEGSUP_DEFAULT);
 	return 0;
 }
 
@@ -2369,14 +2376,18 @@
 		/*
 		 * Some systems don't maintain the UHCI register values
 		 * during a PM suspend/resume cycle, so reinitialize
-		 * the Frame Number, the Framelist Base Address, and the
-		 * Interrupt Enable registers.
+		 * the Frame Number, Framelist Base Address, Interrupt
+		 * Enable, and Legacy Support registers.
 		 */
+		pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP,
+				0);
 		outw(uhci->saved_framenumber, uhci->io_addr + USBFRNUM);
 		outl(uhci->fl->dma_handle, uhci->io_addr + USBFLBASEADD);
 		outw(USBINTR_TIMEOUT | USBINTR_RESUME | USBINTR_IOC |
 				USBINTR_SP, uhci->io_addr + USBINTR);
 		uhci->resume_detect = 1;
+		pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP,
+				USBLEGSUP_DEFAULT);
 	} else {
 		reset_hc(uhci);
 		start_hc(uhci);
diff -Nru a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h
--- a/drivers/usb/net/pegasus.h	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/net/pegasus.h	2004-06-08 22:03:37 -07:00
@@ -121,6 +121,7 @@
 #define	VENDOR_ADMTEK		0x07a6
 #define	VENDOR_AEILAB		0x3334
 #define	VENDOR_ALLIEDTEL	0x07c9
+#define	VENDOR_ATEN		0x0557
 #define	VENDOR_BELKIN		0x050d
 #define	VENDOR_BILLIONTON	0x08dd
 #define	VENDOR_COMPAQ		0x049f
@@ -149,6 +150,8 @@
 #else	/* PEGASUS_DEV */
 
 PEGASUS_DEV( "3Com USB Ethernet 3C460B", VENDOR_3COM, 0x4601,
+		DEFAULT_GPIO_RESET | PEGASUS_II )
+PEGASUS_DEV( "ATEN USB Ethernet UC-110T", VENDOR_ATEN, 0x2007,
 		DEFAULT_GPIO_RESET | PEGASUS_II )
 PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x110c,
 		DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA )
diff -Nru a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
--- a/drivers/usb/serial/bus.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/serial/bus.c	2004-06-08 22:03:37 -07:00
@@ -78,8 +78,8 @@
 	minor = port->number;
 	tty_register_device (usb_serial_tty_driver, minor, dev);
 	dev_info(&port->serial->dev->dev, 
-		 "%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n",
-		 driver->name, minor, minor);
+		 "%s converter now attached to ttyUSB%d\n",
+		 driver->name, minor);
 
 exit:
 	return retval;
diff -Nru a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
--- a/drivers/usb/serial/ftdi_sio.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/serial/ftdi_sio.c	2004-06-08 22:03:37 -07:00
@@ -1504,6 +1504,7 @@
 	if (status) {
 		err("%s - failed submitting write urb, error %d", __FUNCTION__, status);
 		count = status;
+		kfree (buffer);
 	}
 
 	/* we are done with this urb, so let the host driver
diff -Nru a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
--- a/drivers/usb/serial/visor.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/serial/visor.c	2004-06-08 22:03:37 -07:00
@@ -247,6 +247,8 @@
 		.driver_info = (kernel_ulong_t)&palm_os_4_probe },
 	{ USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID),
 		.driver_info = (kernel_ulong_t)&palm_os_4_probe },
+	{ USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID),
+		.driver_info = (kernel_ulong_t)&palm_os_4_probe },
 	{ },					/* optional parameter entry */
 	{ }					/* Terminating entry */
 };
@@ -290,6 +292,7 @@
 	{ USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID) },
 	{ USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID) },
 	{ USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) },
+	{ USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) },
 	{ },					/* optional parameter entry */
 	{ }					/* Terminating entry */
 };
@@ -515,6 +518,7 @@
 		dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n",
 			__FUNCTION__, status);
 		count = status;
+		kfree (buffer);
 	} else {
 		bytes_out += count;
 	}
@@ -795,7 +799,7 @@
 		dev_err(dev, "%s - error %d getting connection info\n",
 			__FUNCTION__, retval);
 	else
-		usb_serial_debug_data (__FILE__, __FUNCTION__, 0x14, transfer_buffer);
+		usb_serial_debug_data (__FILE__, __FUNCTION__, retval, transfer_buffer);
 
 	kfree (transfer_buffer);
 	return 0;
@@ -881,18 +885,19 @@
 
 	/* Only do this endpoint hack for the Handspring devices with
 	 * interrupt in endpoints, which for now are the Treo devices. */
-	if ((serial->dev->descriptor.idVendor != HANDSPRING_VENDOR_ID) ||
+	if (!((serial->dev->descriptor.idVendor == HANDSPRING_VENDOR_ID) ||
+	      (serial->dev->descriptor.idVendor == KYOCERA_VENDOR_ID)) ||
 	    (serial->num_interrupt_in == 0))
 		return 0;
 
 	dbg("%s", __FUNCTION__);
 
 	/*
-	* It appears that Treos want to use the 1st interrupt endpoint to
-	* communicate with the 2nd bulk out endpoint, so let's swap the 1st
-	* and 2nd bulk in and interrupt endpoints.  Note that swapping the
-	* bulk out endpoints would break lots of apps that want to communicate
-	* on the second port.
+	* It appears that Treos and Kyoceras want to use the 
+	* 1st bulk in endpoint to communicate with the 2nd bulk out endpoint, 
+	* so let's swap the 1st and 2nd bulk in and interrupt endpoints.  
+	* Note that swapping the bulk out endpoints would break lots of 
+	* apps that want to communicate on the second port.
 	*/
 #define COPY_PORT(dest, src)						\
 	dest->read_urb = src->read_urb;					\
diff -Nru a/drivers/usb/serial/visor.h b/drivers/usb/serial/visor.h
--- a/drivers/usb/serial/visor.h	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/serial/visor.h	2004-06-08 22:03:37 -07:00
@@ -55,6 +55,9 @@
 #define ACEECA_VENDOR_ID		0x4766
 #define ACEECA_MEZ1000_ID		0x0001
 
+#define KYOCERA_VENDOR_ID		0x0C88
+#define KYOCERA_7135_ID			0x0021 
+
 /****************************************************************************
  * Handspring Visor Vendor specific request codes (bRequest values)
  * A big thank you to Handspring for providing the following information.
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/storage/transport.c	2004-06-08 22:03:37 -07:00
@@ -908,26 +908,29 @@
 				 USB_RECIP_INTERFACE,
 				 0, us->ifnum, us->iobuf, 1, HZ);
 
+	US_DEBUGP("GetMaxLUN command result is %d, data is %d\n", 
+		  result, us->iobuf[0]);
+
+	/* if we have a successful request, return the result */
+	if (result == 1)
+		return us->iobuf[0];
+
 	/* 
 	 * Some devices (i.e. Iomega Zip100) need this -- apparently
 	 * the bulk pipes get STALLed when the GetMaxLUN request is
 	 * processed.   This is, in theory, harmless to all other devices
 	 * (regardless of if they stall or not).
 	 */
-	if (result < 0) {
+	if (result == -EPIPE) {
 		usb_stor_clear_halt(us, us->recv_bulk_pipe);
 		usb_stor_clear_halt(us, us->send_bulk_pipe);
+		/* return the default -- no LUNs */
+		return 0;
 	}
 
-	US_DEBUGP("GetMaxLUN command result is %d, data is %d\n", 
-		  result, us->iobuf[0]);
-
-	/* if we have a successful request, return the result */
-	if (result == 1)
-		return us->iobuf[0];
-
-	/* return the default -- no LUNs */
-	return 0;
+	/* An answer or a STALL are the only valid responses.  If we get
+	 * something else, return an indication of error */
+	return -1;
 }
 
 int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us)
diff -Nru a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
--- a/drivers/usb/storage/unusual_devs.h	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/storage/unusual_devs.h	2004-06-08 22:03:37 -07:00
@@ -359,13 +359,19 @@
 UNUSUAL_DEV(  0x0595, 0x4343, 0x0000, 0x2210,
 		"Fujifilm",
 		"Digital Camera EX-20 DSC",
-		US_SC_8070, US_PR_CBI, NULL, 0 ),
+		US_SC_8070, US_PR_DEVICE, NULL, 0 ),
 
 UNUSUAL_DEV(  0x059f, 0xa601, 0x0200, 0x0200, 
 		"LaCie",
 		"USB Hard Disk",
 		US_SC_RBC, US_PR_CB, NULL, 0 ), 
 
+/* Submitted by Jol Bourquard <numlock@freesurf.ch> */
+UNUSUAL_DEV(  0x05ab, 0x0060, 0x1104, 0x1110,
+		"In-System",
+		"PyroGate External CD-ROM Enclosure (FCD-523)",
+		US_SC_SCSI, US_PR_BULK, NULL, 0 ),
+
 #ifdef CONFIG_USB_STORAGE_ISD200
 UNUSUAL_DEV(  0x05ab, 0x0031, 0x0100, 0x0110,
 		"In-System",
@@ -628,19 +634,13 @@
  * - Some cameras with idProduct=0x1001 and bcdDevice=0x1000 have
  *   bInterfaceProtocol=0x00 (US_PR_CBI) while others have 0x01 (US_PR_CB).
  *   So don't remove the US_PR_CB override!
+ * - Cameras with bcdDevice=0x9009 require the US_SC_8070 override.
  */
-UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9009,
+UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9999,
 		"Casio",
 		"QV DigitalCamera",
-		US_SC_DEVICE, US_PR_CB, NULL,
+		US_SC_8070, US_PR_CB, NULL,
 		US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ),
-
-/* Later Casio cameras apparently tell the truth */
-UNUSUAL_DEV( 0x07cf, 0x1001, 0x9010, 0x9999,
-		"Casio",
-		"QV DigitalCamera",
-		US_SC_DEVICE, US_PR_DEVICE, NULL,
-		US_FL_FIX_INQUIRY ),
 
 /* Submitted by Hartmut Wahl <hwahl@hwahl.de>*/
 UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001,
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c	2004-06-08 22:03:37 -07:00
+++ b/drivers/usb/storage/usb.c	2004-06-08 22:03:37 -07:00
@@ -754,8 +754,14 @@
 	down(&us->dev_semaphore);
 
 	/* For bulk-only devices, determine the max LUN value */
-	if (us->protocol == US_PR_BULK)
-		us->max_lun = usb_stor_Bulk_max_lun(us);
+	if (us->protocol == US_PR_BULK) {
+		p = usb_stor_Bulk_max_lun(us);
+		if (p < 0) {
+			up(&us->dev_semaphore);
+			return p;
+		}
+		us->max_lun = p;
+	}
 
 	/* Just before we start our control thread, initialize
 	 * the device if it needs initialization */
diff -Nru a/usb/host/ohci-lh7a404.c b/usb/host/ohci-lh7a404.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/usb/host/ohci-lh7a404.c	2004-06-08 22:03:37 -07:00
@@ -0,0 +1,387 @@
+/*
+ * OHCI HCD (Host Controller Driver) for USB.
+ *
+ * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
+ * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
+ * (C) Copyright 2002 Hewlett-Packard Company
+ *
+ * Bus Glue for Sharp LH7A404
+ *
+ * Written by Christopher Hoover <ch@hpl.hp.com>
+ * Based on fragments of previous driver by Rusell King et al.
+ *
+ * Modified for LH7A404 from ohci-sa1111.c
+ *  by Durgesh Pattamatta <pattamattad@sharpsec.com>
+ *
+ * This file is licenced under the GPL.
+ */
+
+#include <asm/hardware.h>
+#include <asm/mach-types.h>
+#include <asm/arch/hardware.h>
+
+
+extern int usb_disabled(void);
+
+/*-------------------------------------------------------------------------*/
+
+static void lh7a404_start_hc(struct platform_device *dev)
+{
+	printk(KERN_DEBUG __FILE__
+	       ": starting LH7A404 OHCI USB Controller\n");
+
+	/*
+	 * Now, carefully enable the USB clock, and take
+	 * the USB host controller out of reset.
+	 */
+	CSC_PWRCNT |= CSC_PWRCNT_USBH_EN; /* Enable clock */
+	udelay(1000);
+	USBH_CMDSTATUS = OHCI_HCR;
+	
+	printk(KERN_DEBUG __FILE__
+		   ": Clock to USB host has been enabled \n");
+}
+
+static void lh7a404_stop_hc(struct platform_device *dev)
+{
+	printk(KERN_DEBUG __FILE__
+	       ": stopping LH7A404 OHCI USB Controller\n");
+
+	CSC_PWRCNT &= ~CSC_PWRCNT_USBH_EN; /* Disable clock */
+}
+
+
+/*-------------------------------------------------------------------------*/
+
+
+static irqreturn_t usb_hcd_lh7a404_hcim_irq (int irq, void *__hcd,
+					     struct pt_regs * r)
+{
+	struct usb_hcd *hcd = __hcd;
+
+	return usb_hcd_irq(irq, hcd, r);
+}
+
+/*-------------------------------------------------------------------------*/
+
+void usb_hcd_lh7a404_remove (struct usb_hcd *, struct platform_device *);
+
+/* configure so an HC device and id are always provided */
+/* always called with process context; sleeping is OK */
+
+
+/**
+ * usb_hcd_lh7a404_probe - initialize LH7A404-based HCDs
+ * Context: !in_interrupt()
+ *
+ * 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.
+ *
+ */
+int usb_hcd_lh7a404_probe (const struct hc_driver *driver,
+			  struct usb_hcd **hcd_out,
+			  struct platform_device *dev)
+{
+	int retval;
+	struct usb_hcd *hcd = 0;
+
+	unsigned int *addr = NULL;
+
+	if (!request_mem_region(dev->resource[0].start,
+				dev->resource[0].end
+				- dev->resource[0].start + 1, hcd_name)) {
+		pr_debug("request_mem_region failed");
+		return -EBUSY;
+	}
+	
+	
+	lh7a404_start_hc(dev);
+	
+	addr = ioremap(dev->resource[0].start,
+		       dev->resource[0].end
+		       - dev->resource[0].start + 1);
+	if (!addr) {
+		pr_debug("ioremap failed");
+		retval = -ENOMEM;
+		goto err1;
+	}
+	
+
+	hcd = driver->hcd_alloc ();
+	if (hcd == NULL){
+		pr_debug ("hcd_alloc failed");
+		retval = -ENOMEM;
+		goto err1;
+	}
+
+	if(dev->resource[1].flags != IORESOURCE_IRQ){
+		pr_debug ("resource[1] is not IORESOURCE_IRQ");
+		retval = -ENOMEM;
+		goto err1;
+	}
+
+	hcd->driver = (struct hc_driver *) driver;
+	hcd->description = driver->description;
+	hcd->irq = dev->resource[1].start;
+	hcd->regs = addr;
+	hcd->self.controller = &dev->dev;
+
+	retval = hcd_buffer_create (hcd);
+	if (retval != 0) {
+		pr_debug ("pool alloc fail");
+		goto err1;
+	}
+
+	retval = request_irq (hcd->irq, usb_hcd_lh7a404_hcim_irq, SA_INTERRUPT,
+			      hcd->description, hcd);
+	if (retval != 0) {
+		pr_debug("request_irq failed");
+		retval = -EBUSY;
+		goto err2;
+	}
+
+	pr_debug ("%s (LH7A404) at 0x%p, irq %d",
+	     hcd->description, hcd->regs, hcd->irq);
+
+	usb_bus_init (&hcd->self);
+	hcd->self.op = &usb_hcd_operations;
+	hcd->self.hcpriv = (void *) hcd;
+	hcd->self.bus_name = "lh7a404";
+	hcd->product_desc = "LH7A404 OHCI";
+
+	INIT_LIST_HEAD (&hcd->dev_list);
+
+	usb_register_bus (&hcd->self);
+
+	if ((retval = driver->start (hcd)) < 0)
+	{
+		usb_hcd_lh7a404_remove(hcd, dev);
+		return retval;
+	}
+
+	*hcd_out = hcd;
+	return 0;
+
+ err2:
+	hcd_buffer_destroy (hcd);
+	if (hcd)
+		driver->hcd_free(hcd);
+ err1:
+	lh7a404_stop_hc(dev);
+	release_mem_region(dev->resource[0].start,
+				dev->resource[0].end
+			   - dev->resource[0].start + 1);
+	return retval;
+}
+
+
+/* may be called without controller electrically present */
+/* may be called with controller, bus, and devices active */
+
+/**
+ * usb_hcd_lh7a404_remove - shutdown processing for LH7A404-based HCDs
+ * @dev: USB Host Controller being removed
+ * Context: !in_interrupt()
+ *
+ * Reverses the effect of usb_hcd_lh7a404_probe(), first invoking
+ * the HCD's stop() method.  It is always called from a thread
+ * context, normally "rmmod", "apmd", or something similar.
+ *
+ */
+void usb_hcd_lh7a404_remove (struct usb_hcd *hcd, struct platform_device *dev)
+{
+	struct usb_device	*hub;
+	void *base;
+
+	pr_debug ("remove: %s, state %x", hcd->self.bus_name, hcd->state);
+
+	if (in_interrupt ())
+		BUG ();
+
+	hub = hcd->self.root_hub;
+	hcd->state = USB_STATE_QUIESCING;
+
+	pr_debug ("%s: roothub graceful disconnect", hcd->self.bus_name);
+	usb_disconnect (&hub);
+
+	hcd->driver->stop (hcd);
+	hcd->state = USB_STATE_HALT;
+
+	free_irq (hcd->irq, hcd);
+	hcd_buffer_destroy (hcd);
+
+	usb_deregister_bus (&hcd->self);
+
+	base = hcd->regs;
+	hcd->driver->hcd_free (hcd);
+
+	lh7a404_stop_hc(dev);
+	release_mem_region(dev->resource[0].start,
+			   dev->resource[0].end
+			   - dev->resource[0].start + 1);
+}
+
+/*-------------------------------------------------------------------------*/
+
+static int __devinit
+ohci_lh7a404_start (struct usb_hcd *hcd)
+{
+	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
+	int		ret;
+
+	ohci_dbg (ohci, "ohci_lh7a404_start, ohci:%p", ohci);
+			
+	ohci->hcca = dma_alloc_coherent (hcd->self.controller,
+			sizeof *ohci->hcca, &ohci->hcca_dma, 0);
+	if (!ohci->hcca)
+		return -ENOMEM;
+
+	ohci_dbg (ohci, "ohci_lh7a404_start, ohci->hcca:%p",
+			ohci->hcca);
+
+	memset (ohci->hcca, 0, sizeof (struct ohci_hcca));
+
+	if ((ret = ohci_mem_init (ohci)) < 0) {
+		ohci_stop (hcd);
+		return ret;
+	}
+	ohci->regs = hcd->regs;
+
+	if (hc_reset (ohci) < 0) {
+		ohci_stop (hcd);
+		return -ENODEV;
+	}
+
+	if (hc_start (ohci) < 0) {
+		err ("can't start %s", ohci->hcd.self.bus_name);
+		ohci_stop (hcd);
+		return -EBUSY;
+	}
+	create_debug_files (ohci);
+
+#ifdef	DEBUG
+	ohci_dump (ohci, 1);
+#endif /*DEBUG*/
+	return 0;
+}
+
+/*-------------------------------------------------------------------------*/
+
+static const struct hc_driver ohci_lh7a404_hc_driver = {
+	.description =		hcd_name,
+
+	/*
+	 * generic hardware linkage
+	 */
+	.irq =			ohci_irq,
+	.flags =		HCD_USB11,
+
+	/*
+	 * basic lifecycle operations
+	 */
+	.start =		ohci_lh7a404_start,
+#ifdef	CONFIG_PM
+	/* suspend:		ohci_lh7a404_suspend,  -- tbd */
+	/* resume:		ohci_lh7a404_resume,   -- tbd */
+#endif /*CONFIG_PM*/
+	.stop =			ohci_stop,
+
+	/*
+	 * memory lifecycle (except per-request)
+	 */
+	.hcd_alloc =		ohci_hcd_alloc,
+	.hcd_free =		ohci_hcd_free,
+
+	/*
+	 * managing i/o requests and associated device resources
+	 */
+	.urb_enqueue =		ohci_urb_enqueue,
+	.urb_dequeue =		ohci_urb_dequeue,
+	.endpoint_disable =	ohci_endpoint_disable,
+
+	/*
+	 * scheduling support
+	 */
+	.get_frame_number =	ohci_get_frame,
+
+	/*
+	 * root hub support
+	 */
+	.hub_status_data =	ohci_hub_status_data,
+	.hub_control =		ohci_hub_control,
+};
+
+/*-------------------------------------------------------------------------*/
+
+static int ohci_hcd_lh7a404_drv_probe(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct usb_hcd *hcd = NULL;
+	int ret;
+
+	pr_debug ("In ohci_hcd_lh7a404_drv_probe");
+
+	if (usb_disabled())
+		return -ENODEV;
+
+	ret = usb_hcd_lh7a404_probe(&ohci_lh7a404_hc_driver, &hcd, pdev);
+
+	if (ret == 0)
+		dev_set_drvdata(dev, hcd);
+
+	return ret;
+}
+
+static int ohci_hcd_lh7a404_drv_remove(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct usb_hcd *hcd = dev_get_drvdata(dev);
+
+	usb_hcd_lh7a404_remove(hcd, pdev);
+	dev_set_drvdata(dev, NULL);
+	return 0;
+}
+	/*TBD*/
+/*static int ohci_hcd_lh7a404_drv_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct usb_hcd *hcd = dev_get_drvdata(dev);
+
+	return 0;
+}
+static int ohci_hcd_lh7a404_drv_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct usb_hcd *hcd = dev_get_drvdata(dev);
+
+
+	return 0;
+}
+*/
+
+static struct device_driver ohci_hcd_lh7a404_driver = {
+	.name		= "lh7a404-ohci",
+	.bus		= &platform_bus_type,
+	.probe		= ohci_hcd_lh7a404_drv_probe,
+	.remove		= ohci_hcd_lh7a404_drv_remove,
+	/*.suspend	= ohci_hcd_lh7a404_drv_suspend, */
+	/*.resume	= ohci_hcd_lh7a404_drv_resume, */
+};
+
+static int __init ohci_hcd_lh7a404_init (void)
+{
+	pr_debug (DRIVER_INFO " (LH7A404)");
+	pr_debug ("block sizes: ed %d td %d\n",
+		sizeof (struct ed), sizeof (struct td));
+
+	return driver_register(&ohci_hcd_lh7a404_driver);
+}
+
+static void __exit ohci_hcd_lh7a404_cleanup (void)
+{
+	driver_unregister(&ohci_hcd_lh7a404_driver);
+}
+
+module_init (ohci_hcd_lh7a404_init);
+module_exit (ohci_hcd_lh7a404_cleanup);
