pandora-kernel.git
14 years agoUSB: Move hcd free_dev call into usb_disconnect to fix oops
Herbert Xu [Sun, 10 Jan 2010 09:15:03 +0000 (20:15 +1100)]
USB: Move hcd free_dev call into usb_disconnect to fix oops

USB: Move hcd free_dev call into usb_disconnect

I found a way to oops the kernel:

1. Open a USB device through devio.
2. Remove the hcd module in the host kernel.
3. Close the devio file descriptor.

The problem is that closing the file descriptor does usb_release_dev
as it is the last reference.  usb_release_dev then tries to invoke
the hcd free_dev function (or rather dereferencing the hcd driver
struct).  This causes an oops as the hcd driver has already been
unloaded so the struct is gone.

This patch tries to fix this by bringing the free_dev call earlier
and into usb_disconnect.  I have verified that repeating the
above steps no longer crashes with this patch applied.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: fix crash in uhci_scan_schedule
Pete Zaitcev [Fri, 8 Jan 2010 22:39:22 +0000 (15:39 -0700)]
USB: fix crash in uhci_scan_schedule

When hardware is removed on a Stratus, the system may crash like this:

ACPI: PCI interrupt for device 0000:7c:00.1 disabled
Trying to free nonexistent resource <00000000a8000000-00000000afffffff>
Trying to free nonexistent resource <00000000a4800000-00000000a480ffff>
uhci_hcd 0000:7e:1d.0: remove, state 1
usb usb2: USB disconnect, address 1
usb 2-1: USB disconnect, address 2
Unable to handle kernel paging request at 0000000000100100 RIP:
 [<ffffffff88021950>] :uhci_hcd:uhci_scan_schedule+0xa2/0x89c

 #4 [ffff81011de17e50] uhci_scan_schedule at ffffffff88021918
 #5 [ffff81011de17ed0] uhci_irq at ffffffff88023cb8
 #6 [ffff81011de17f10] usb_hcd_irq at ffffffff801f1c1f
 #7 [ffff81011de17f20] handle_IRQ_event at ffffffff8001123b
 #8 [ffff81011de17f50] __do_IRQ at ffffffff800ba749

This occurs because an interrupt scans uhci->skelqh, which is
being freed. We do the right thing: disable the interrupts in the
device, and do not do any processing if the interrupt is shared
with other source, but it's possible that another CPU gets
delayed somewhere (e.g. loops) until we started freeing.

The agreed-upon solution is to wait for interrupts to play out
before proceeding. No other bareers are neceesary.

A backport of this patch was tested on a 2.6.18 based kernel.
Testing of 2.6.32-based kernels is under way, but it takes us
forever (months) to turn this around. So I think it's a good
patch and we should keep it.

Tracked in RH bz#516851

Signed-Off-By: Pete Zaitcev <zaitcev@redhat.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: convert to the runtime PM framework
Alan Stern [Fri, 8 Jan 2010 17:57:28 +0000 (12:57 -0500)]
USB: convert to the runtime PM framework

This patch (as1329) converts the USB stack over to the PM core's
runtime PM framework.  This involves numerous changes throughout
usbcore, especially to hub.c and driver.c.  Perhaps the most notable
change is that CONFIG_USB_SUSPEND now depends on CONFIG_PM_RUNTIME
instead of CONFIG_PM.

Several fields in the usb_device and usb_interface structures are no
longer needed.  Some code which used to depend on CONFIG_USB_PM now
depends on CONFIG_USB_SUSPEND (requiring some rearrangement of header
files).

The only visible change in behavior should be that following a system
sleep (resume from RAM or resume from hibernation), autosuspended USB
devices will be resumed just like everything else.  They won't remain
suspended.  But if they aren't in use then they will naturally
autosuspend again in a few seconds.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: rearrange functions in driver.c
Alan Stern [Fri, 8 Jan 2010 17:57:14 +0000 (12:57 -0500)]
USB: rearrange functions in driver.c

This patch (as1328) reorders the functions in drivers/usb/core/driver.c
so as to put all the routines dependent on CONFIG_PM in one place.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: change handling of negative autosuspend delays
Alan Stern [Fri, 8 Jan 2010 17:57:02 +0000 (12:57 -0500)]
USB: change handling of negative autosuspend delays

This patch (as1327) changes the way negative autosuspend delays
prevent device from autosuspending.  The current code checks for
negative values explicitly in the autosuspend_check() routine.  The
updated code keeps things from getting that far by using
usb_autoresume_device() to increment the usage counter when a negative
delay is set, and by using usb_autosuspend_device() to decrement the
usage counter when a non-negative delay is set.

This complicates the set_autosuspend() attribute method code slightly,
but it will reduce the overall power management overhead.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: implement usb_enable_autosuspend
Alan Stern [Fri, 8 Jan 2010 17:56:54 +0000 (12:56 -0500)]
USB: implement usb_enable_autosuspend

This patch (as1326) adds usb_enable_autosuspend() and
usb_disable_autosuspend() routines for use by drivers.  If a driver
knows that its device can handle suspends and resumes correctly, it
can enable autosuspend all by itself.  This is equivalent to the user
writing "auto" to the device's power/level attribute.

The implementation differs slightly from what it used to be.  Now
autosuspend is disabled simply by doing usb_autoresume_device() (to
increment the usage counter) and enabled by doing
usb_autosuspend_device() (to decrement the usage counter).

The set_level() attribute method is updated to use the new routines,
and the USB Power-Management documentation is updated.

The patch adds a usb_enable_autosuspend() call to the hub driver's
probe routine, allowing the special-case code for hubs in quirks.c to
be removed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: use the device lock for persist_enabled
Alan Stern [Fri, 8 Jan 2010 17:56:42 +0000 (12:56 -0500)]
USB: use the device lock for persist_enabled

This patch (as1325) changes the locking for the persist_enabled flag
in struct usb_device.  Now it is protected by the device lock, along
with all its neighboring bit flags, instead of the PM lock (which is
about to vanish anyway).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: consolidate remote wakeup routines
Alan Stern [Fri, 8 Jan 2010 17:56:30 +0000 (12:56 -0500)]
USB: consolidate remote wakeup routines

This patch (as1324) makes a small change to the code used for remote
wakeup of root hubs.  hcd_resume_work() now calls the hub driver's
remote-wakeup routine instead of implementing its own version.

The patch is complicated by the need to rename remote_wakeup() to
usb_remote_wakeup(), make it non-static, and declare it in a header
file.  There's also the additional complication required to make
everything work when CONFIG_PM isn't set; the do-nothing inline
routine had to be moved into the header file.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: change locking for device-level autosuspend
Alan Stern [Fri, 8 Jan 2010 17:56:19 +0000 (12:56 -0500)]
USB: change locking for device-level autosuspend

This patch (as1323) changes the locking requirements for
usb_autosuspend_device(), usb_autoresume_device(), and
usb_try_autosuspend_device().  This isn't a very important change;
mainly it's meant to make the locking more uniform.

The most tricky part of the patch involves changes to usbdev_open().
To avoid an ABBA locking problem, it was necessary to reduce the
region protected by usbfs_mutex.  Since that mutex now protects only
against simultaneous open and remove, this posed no difficulty -- its
scope was larger than necessary.

And it turns out that usbfs_mutex is no longer needed in
usbdev_release() at all.  The list of usbfs "ps" structures is now
protected by the device lock instead of by usbfs_mutex.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: rearrange code in usb_probe_interface
Alan Stern [Fri, 8 Jan 2010 17:56:04 +0000 (12:56 -0500)]
USB: rearrange code in usb_probe_interface

This patch (as1322) reverses the two outcomes of an "if" statement in
usb_probe_interface(), to avoid an unnecessary level of indentation.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: Use bInterfaceNumber in bandwidth allocations.
Sarah Sharp [Tue, 5 Jan 2010 22:33:29 +0000 (14:33 -0800)]
USB: Use bInterfaceNumber in bandwidth allocations.

USB devices do not have to sort interfaces in their descriptors based on
the interface number, and they may choose to skip interface numbers.  The
USB bandwidth allocation code for installing a new configuration assumes
the for loop variable will match the interface number.  Make it use the
interface number (bInterfaceNumber) in the descriptor instead.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: unusual_devs: Add support for multiple Option 3G sticks
Jan Dumon [Tue, 5 Jan 2010 14:53:26 +0000 (15:53 +0100)]
USB: unusual_devs: Add support for multiple Option 3G sticks

Enable the SD-Card interface on multiple Option 3G sticks.
The unusual_devs.h entry is necessary because the device descriptor is
vendor-specific. That prevents usb-storage from binding to it as an interface
driver.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoarm: defconfig: rx51: enable phonet and g_nokia
Felipe Balbi [Tue, 5 Jan 2010 14:10:14 +0000 (16:10 +0200)]
arm: defconfig: rx51: enable phonet and g_nokia

trivial patch enabling g_nokia on rx51_defconfig.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: gadget: introduce g_nokia gadget driver
Felipe Balbi [Tue, 5 Jan 2010 14:10:13 +0000 (16:10 +0200)]
USB: gadget: introduce g_nokia gadget driver

g_nokia is the gadget driver implementing
WMCDC Wireless Handset Control Model for the N900
device.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: xhci: Fix compile issues with xhci_get_slot_state()
Sarah Sharp [Mon, 4 Jan 2010 20:20:17 +0000 (12:20 -0800)]
USB: xhci: Fix compile issues with xhci_get_slot_state()

Randy Dunlap reported this error when compiling the xHCI driver:

linux-next-20100104/drivers/usb/host/xhci.h:1214:
sorry, unimplemented: inlining failed in call to 'xhci_get_slot_state': function body not available

The xhci_get_slot_state() function belongs in xhci-dbg.c, since it
involves debugging internal xHCI structures.  However, it is only used in
xhci-hcd.c.  Some toolchains may have issues since the inlined function
body is not in the xhci.h header file.  Remove the inline keyword to avoid
this.

Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: c67x00: use resource_size().
Thiago Farina [Fri, 1 Jan 2010 21:42:34 +0000 (16:42 -0500)]
USB: c67x00: use resource_size().

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: FHCI: Correct the size argument to kzalloc
Julia Lawall [Wed, 30 Dec 2009 14:34:37 +0000 (15:34 +0100)]
USB: FHCI: Correct the size argument to kzalloc

urb_priv->tds has type struct td **, not struct td *, so the
elements of the array should have pointer type, not structure type.

Convert kzalloc to kcalloc as well.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@disable sizeof_type_expr@
type T;
T **x;
@@

  x =
  <+...sizeof(
- T
+ *x
  )...+>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: cypress_m8: use put_unaligned_le32() where necessary
Johan Hovold [Thu, 31 Dec 2009 15:48:01 +0000 (16:48 +0100)]
USB: cypress_m8: use put_unaligned_le32() where necessary

Cc: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ch341: use get_unaligned_le16 in break_ctl
Johan Hovold [Thu, 31 Dec 2009 15:47:59 +0000 (16:47 +0100)]
USB: ch341: use get_unaligned_le16 in break_ctl

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: serial: fix DMA buffers on stack for io_edgeport.c
Dan Carpenter [Thu, 31 Dec 2009 15:42:55 +0000 (17:42 +0200)]
USB: serial: fix DMA buffers on stack for io_edgeport.c

The original code was passing a stack variable as a dma buffer, so I
made it an allocated variable.  Instead of adding a bunch of kfree()
calls, I changed all the error return paths to gotos.

Also I noticed that the error checking wasn't correct because
usb_get_descriptor() can return negative values.

While I was at it, I made an unrelated white space change by moving
the unicode_to_ascii() on to one line.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: kobil_sct: clean up kobil_set_termios
Johan Hovold [Mon, 28 Dec 2009 22:01:58 +0000 (23:01 +0100)]
USB: kobil_sct: clean up kobil_set_termios

Kill string that is allocated and generated using speed and parity
settings but is never used (and never has been).

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: visor: fix DMA buffers on stack
Johan Hovold [Mon, 28 Dec 2009 22:01:57 +0000 (23:01 +0100)]
USB: visor: fix DMA buffers on stack

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: oti6858: fix DMA buffer on stack
Johan Hovold [Mon, 28 Dec 2009 22:01:56 +0000 (23:01 +0100)]
USB: oti6858: fix DMA buffer on stack

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: mos7840: fix DMA buffers on stack and endianess bugs
Johan Hovold [Mon, 28 Dec 2009 22:01:55 +0000 (23:01 +0100)]
USB: mos7840: fix DMA buffers on stack and endianess bugs

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: mos7720: fix DMA buffers on stack and clean up send_mos_cmd
Johan Hovold [Mon, 28 Dec 2009 22:01:54 +0000 (23:01 +0100)]
USB: mos7720: fix DMA buffers on stack and clean up send_mos_cmd

Change data-argument type from (void *) to (u8 *) to prevent endianess
problems.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: kl5kusb105: fix DMA buffers on stack
Johan Hovold [Mon, 28 Dec 2009 22:01:52 +0000 (23:01 +0100)]
USB: kl5kusb105: fix DMA buffers on stack

Cc: Oliver Neukum <oliver@neukum.name>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: keyspan_pda: fix DMA buffers on stack
Johan Hovold [Mon, 28 Dec 2009 22:01:51 +0000 (23:01 +0100)]
USB: keyspan_pda: fix DMA buffers on stack

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: io_ti: fix DMA buffers on stack
Johan Hovold [Mon, 28 Dec 2009 22:01:50 +0000 (23:01 +0100)]
USB: io_ti: fix DMA buffers on stack

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: cypress_m8: fix endianess bug
Johan Hovold [Mon, 28 Dec 2009 22:01:49 +0000 (23:01 +0100)]
USB: cypress_m8: fix endianess bug

Cc: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: cypress_m8: fix DMA buffer on stack
Johan Hovold [Mon, 28 Dec 2009 22:01:48 +0000 (23:01 +0100)]
USB: cypress_m8: fix DMA buffer on stack

Cc: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ch341: use le16_to_cpup to be explicit about endianess
Johan Hovold [Mon, 28 Dec 2009 22:01:47 +0000 (23:01 +0100)]
USB: ch341: use le16_to_cpup to be explicit about endianess

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ch341: fix DMA buffer on stack
Johan Hovold [Mon, 28 Dec 2009 22:01:46 +0000 (23:01 +0100)]
USB: ch341: fix DMA buffer on stack

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ch341: replace printk warnings with dev_err
Johan Hovold [Mon, 28 Dec 2009 22:01:45 +0000 (23:01 +0100)]
USB: ch341: replace printk warnings with dev_err

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: host: ehci: adding regulator framework in ehci-omap.c driver.
Ajay Kumar Gupta [Mon, 28 Dec 2009 11:40:46 +0000 (13:40 +0200)]
usb: host: ehci: adding regulator framework in ehci-omap.c driver.

OMAP3 has three HS USB ports so it can have three different regulator
for each PHY connected to each port.

Currently these regulators are assumed to be optional and driver doesn't
fail but continue with the initialization if it doesn't get any regulators.

Regulator supply names has to be mapped in board files as 'hsusbN' where
'N' is port number and can be {0, 1 ,2}.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: host: ehci: fix missing kfree in remove path also
Ajay Kumar Gupta [Mon, 28 Dec 2009 11:40:45 +0000 (13:40 +0200)]
usb: host: ehci: fix missing kfree in remove path also

Added missing kfree() in ehci_hcd_omap_remove().

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: musb: Add 'extvbus' in musb_hdrc_platform_data
Ajay Kumar Gupta [Mon, 28 Dec 2009 11:40:42 +0000 (13:40 +0200)]
usb: musb: Add 'extvbus' in musb_hdrc_platform_data

Some of the board might use external Vbus power supply on musb
interface which would require to program ULPI_BUSCONTROL register.

Adding 'extvbus' flag which can be set from such boards which will
be checked at musb driver files before programming ULPI_BUSCONTROL.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: musb: save dynfifo in musb struct
Ajay Kumar Gupta [Mon, 28 Dec 2009 11:40:41 +0000 (13:40 +0200)]
usb: musb: save dynfifo in musb struct

Save dynamic FIFO read only information for later uses during
musb_save/restore_context functions.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: musb: handle irqs in the order dictated by programming guide
Arnaud Mandy [Mon, 28 Dec 2009 11:40:40 +0000 (13:40 +0200)]
usb: musb: handle irqs in the order dictated by programming guide

MUSB's programming guide dictates how we should handle its
irqs and in which order. Follow that.

Signed-off-by: Arnaud Mandy <ext-arnaud.2.mandy@nokia.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: musb: clean up commit 'workaround Blackfin FIFO anomalies'
Bryan Wu [Mon, 28 Dec 2009 11:40:39 +0000 (13:40 +0200)]
usb: musb: clean up commit 'workaround Blackfin FIFO anomalies'

The version applied had a few comments which are now
done.

Thanks to Sergei for pointing out.

Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: musb: Fix cppi_channel_abort() function to handle Tx abort correctly
Swaminathan S [Mon, 28 Dec 2009 11:40:38 +0000 (13:40 +0200)]
usb: musb: Fix cppi_channel_abort() function to handle Tx abort correctly

This patch fixes the Tx abort/teardown logic. We now wait for the teardown
completion interrupt and acknowledge the same by setting the tx_complete
register to 0.

This change is needed to ensure that abort processing works on DM365 platform.
Without this change after completion of abort processing the system is
overwhelmed with continuous stream of abort interrupts.

This change has been tested on all CPPI3.x platforms (DM644x, DM646x, DM35x,
DM36x).

Signed-off-by: Swaminathan S <swami.iyer@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: musb: workaround toggle bug when doing bulk transfer after isoc
Swaminathan S [Mon, 28 Dec 2009 11:40:37 +0000 (13:40 +0200)]
usb: musb: workaround toggle bug when doing bulk transfer after isoc

This patch implements the work around for a Mentor controller related
bug where it's observed a BULK Tx toggle error on the bus when a
BULK IO gets scheduled on an endpoint that was earlier used for
handling ISOC transaction and needed to start on 1 toggle.  When such
a situation arises even if the TXCSR toggle bits are programmed
correctly by the musb driver the data gets transmitted with 0 toggle
which leads to toggle error on the bus and the BULK transaction fails.
In case of MSC write, the device gets reset by the Host.

This Mentor bug is observed on almost all Mentor versions (1.3, 1.5,
1.8).  Confirmed on DM644x, DM355, DM365, OMAPL13x platforms.

Signed-off-by: Swaminathan S <swami.iyer@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: musb: workaround MUSB DMA_INTR sometimes reads zero
Anand Gadiyar [Mon, 28 Dec 2009 11:40:36 +0000 (13:40 +0200)]
usb: musb: workaround MUSB DMA_INTR sometimes reads zero

MUSB DMA_INTR register may sometimes read zero when infact there
was a pending interrupt. Workaround this by reading the DMA_COUNT
values for all enabled channels when this condition occurs.
Flag these channels as the ones needing to be serviced.

Additionally, the absence of a debug print meant we would never
catch a spurious DMA interrupt in MUSB. So this patch adds a
debug print in the IRQ handler.

Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Cc: Ajay Kumar Gupta <ajay.gupta@ti.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Vikram Pandita <vikram.pandita@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: musb: hsdma: add wrapper for reading DMA count
Anand Gadiyar [Mon, 28 Dec 2009 11:40:35 +0000 (13:40 +0200)]
usb: musb: hsdma: add wrapper for reading DMA count

Add a wrapper for reading the DMA count register, analogous
to the one for writing to this register.

Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Cc: Vikram Pandita <vikram.pandita@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: musb: Add new fifo table for a OMAP3 errata
Ajay Kumar Gupta [Mon, 28 Dec 2009 11:40:34 +0000 (13:40 +0200)]
USB: musb: Add new fifo table for a OMAP3 errata

We have observed MSC data read corruption when USB LAN device is
also connected and it's interface is up.

Silicon team has confirmed an errata where in all the active
transfers should use FIFO space either in first 8K or next 8K.
So far we have observed the issue in above use case scenario.

As a workaround to it, adding a new FIFO config (5) fitting well
within first 8K which can be used for such use cases.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Acked-by: Anand Gadiyar <gadiyar@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousb: otg: twl4030: move to request_threaded_irq
Felipe Balbi [Mon, 28 Dec 2009 11:02:48 +0000 (13:02 +0200)]
usb: otg: twl4030: move to request_threaded_irq

move to request_threaded_irq() on twl4030 children.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: Correct CONFIG variable typo.
Robert P. J. Day [Mon, 28 Dec 2009 11:31:08 +0000 (06:31 -0500)]
USB: Correct CONFIG variable typo.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: usblp: Remove checks no longer needed with the new runtime PM system
Oliver Neukum [Sun, 27 Dec 2009 23:52:17 +0000 (00:52 +0100)]
USB: usblp: Remove checks no longer needed with the new runtime PM system

Under the new system a device cannot be suspended against
the driver's wish. Therefore this condition no longer needs
to be checked for.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ftdi_sio: remove unnecessary initialisations
Johan Hovold [Thu, 24 Dec 2009 11:42:11 +0000 (12:42 +0100)]
USB: ftdi_sio: remove unnecessary initialisations

Return values are being initialised to zero only to be unconditionally
assigned to a few instructions later. This may give the impression that
zero is returned on success, which is not the case.

Note also that ftdi_NDI_device_setup never reports errors.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ftdi_sio: clean up modem status handling
Johan Hovold [Thu, 24 Dec 2009 11:42:10 +0000 (12:42 +0100)]
USB: ftdi_sio: clean up modem status handling

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ftdi_sio: fix DMA buffers on stack
Johan Hovold [Thu, 24 Dec 2009 11:42:09 +0000 (12:42 +0100)]
USB: ftdi_sio: fix DMA buffers on stack

Also remove unnecessary buffer allocations for zero-length transfers.

Reported-by: Matti Aarnio <matti.aarnio@zmailer.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ftdi_sio: fix latency-timeout endianess bug
Johan Hovold [Thu, 24 Dec 2009 11:42:08 +0000 (12:42 +0100)]
USB: ftdi_sio: fix latency-timeout endianess bug

Also fixes DMA transfer to stack for latency buffer.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ftdi_sio: use error code from usb stack in read_latency_timer
Johan Hovold [Thu, 24 Dec 2009 11:42:07 +0000 (12:42 +0100)]
USB: ftdi_sio: use error code from usb stack in read_latency_timer

Use same semantics as for write_latency_timer.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS
Greg Kroah-Hartman [Thu, 14 Jan 2010 19:08:04 +0000 (11:08 -0800)]
USB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS

It's really the wireless speed, so rename the thing to make
more sense.  Based on a recommendation from David Vrabel

Cc: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: retain USB device power/wakeup setting across reconfiguration
Dan Streetman [Wed, 6 Jan 2010 14:56:53 +0000 (09:56 -0500)]
USB: retain USB device power/wakeup setting across reconfiguration

Currently a non-root-hub USB device's wakeup settings are initialized when the
device is set to a configured state using device_init_wakeup(), but this is not
correct as wakeup is split into "capable" (can_wakeup) and "enabled"
(should_wakeup).  The settings should be initialized instead in the device
initialization (usb_new_device) with the "capable" setting disabled and the
"enabled" setting enabled.  The "capable" setting should be set based on the
device being configured or unconfigured, and "enabled" setting set based on
the sysfs power/wakeup control.

This patch retains the sysfs power/wakeup setting of a non-root-hub USB device
over a USB device re-configuration, which can happen (for example) after a
suspend/resume cycle.

Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: cdc_acm: Silence "It is not a modem." error for pbLua devices
Julian Calaby [Tue, 5 Jan 2010 12:58:20 +0000 (23:58 +1100)]
USB: cdc_acm: Silence "It is not a modem." error for pbLua devices

The pbLua console port is known to not be a modem, so it is
unnecessary to be told this when it is plugged in.

Add NOT_A_MODEM quirk to tell the driver that we know this already
and hence not to warn us, and mark the pbLua console port.

Signed-off-by: Julian Calaby <julian.calaby@gmail.com>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: cdc_acm: Add support for pbLua console port
Julian Calaby [Tue, 5 Jan 2010 12:57:46 +0000 (23:57 +1100)]
USB: cdc_acm: Add support for pbLua console port

The pbLua firmware (http://pblua.com/) for the Lego Mindstorms NXT
provides a CDC ACM port for it's serial console.

This used to be detected automatically, but this support has been
dropped, probably for sensible reasons.

Explicitly add support for this device by adding an item to the
device ID table.

Signed-off-by: Julian Calaby <julian.calaby@gmail.com>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agousbmon: add bus number to text API
Pete Zaitcev [Tue, 5 Jan 2010 18:50:07 +0000 (11:50 -0700)]
usbmon: add bus number to text API

Due to a simple oversight when bus zero was added, the text API fails to
deliver the bus number in 'E' messages (which are equivalent of 'C'
messages, only for error case). This makes it harder, for instance,
use a search-and-highlight in a text editor. So fix it.

Also, Alan Stern requested adding timestamps to 'E' messages. This is
purely cosmetic, but makes it easier to read the trace. This is done
for both text and binary APIs.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: musb: remove some of the never defined defines
Felipe Balbi [Tue, 15 Dec 2009 09:08:39 +0000 (11:08 +0200)]
USB: musb: remove some of the never defined defines

just makes the musb init code a bit cleaner.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: musb: move to sysfs_groups
Felipe Balbi [Tue, 15 Dec 2009 09:08:38 +0000 (11:08 +0200)]
USB: musb: move to sysfs_groups

it's easier to keep up and add more sysfs entries
as necessary.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: musb: move two printk to dev_err
Felipe Balbi [Tue, 15 Dec 2009 09:08:43 +0000 (11:08 +0200)]
USB: musb: move two printk to dev_err

trivial cleanup, no functional changes.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: musb: use resource_size()
Felipe Balbi [Tue, 15 Dec 2009 09:08:42 +0000 (11:08 +0200)]
USB: musb: use resource_size()

it makes ioremap() usage looks cleaner.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: gadget: add INT support for Blackfin musb
Cliff Cai [Mon, 21 Dec 2009 15:42:39 +0000 (10:42 -0500)]
USB: gadget: add INT support for Blackfin musb

Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: gadget: use ep5 for bulk-in and ep6 for bulk-out for Blackfin MUSB
Bryan Wu [Mon, 21 Dec 2009 15:43:06 +0000 (10:43 -0500)]
USB: gadget: use ep5 for bulk-in and ep6 for bulk-out for Blackfin MUSB

Normally, the musb uses ep1 as the bidirectional bulk endpoint.  This won't
work on the Blackfin musb as all endpoints (except ep0) are unidirectional.
Further, ep1-ep4 have a small 128 byte FIFO which makes them undesirable
for bulk endpoints (which need more like a 512 byte FIFO).  This leaves us
with ep5-ep7 which have 1024 byte FIFOs and can be configured as either
in/out and bulk/interrupt/iso on the fly.

Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: host: SL811: allow the hcd on Blackfin systems
Michael Hennerich [Mon, 21 Dec 2009 16:16:00 +0000 (11:16 -0500)]
USB: host: SL811: allow the hcd on Blackfin systems

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: host: SL811: fix unaligned accesses
Michael Hennerich [Mon, 21 Dec 2009 17:53:24 +0000 (12:53 -0500)]
USB: host: SL811: fix unaligned accesses

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: isp1362: Use kzalloc for allocating only one thing
Julia Lawall [Sat, 19 Dec 2009 07:17:44 +0000 (08:17 +0100)]
USB: isp1362: Use kzalloc for allocating only one thing

Use kzalloc rather than kcalloc(1,...)

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
@@

- kcalloc(1,
+ kzalloc(
          ...)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: cypress_m8: allow unstable baud rates
Mike Frysinger [Fri, 18 Dec 2009 21:33:03 +0000 (16:33 -0500)]
USB: cypress_m8: allow unstable baud rates

I've got a crappy cypress converter here, and while running at higher
baud rates craps out on throughput, it works fine with lower ones.
While it'd be nice to simply use a lower baud rate, not all devices
can be configured this way, and it is possible to (slowly) interact
at higher rates by sending a byte at a time.  So let people force
higher rates when they need it via a module parameter.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: cypress_m8: unify confusing new baudrate check
Mike Frysinger [Fri, 18 Dec 2009 21:33:02 +0000 (16:33 -0500)]
USB: cypress_m8: unify confusing new baudrate check

The current code has a confusing duplicate new_baudrate init when setting
the serial parameters.  So just combine the if statement checks to avoid
this.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: cypress_m8: stop using USB debug driver config
Mike Frysinger [Fri, 18 Dec 2009 21:33:01 +0000 (16:33 -0500)]
USB: cypress_m8: stop using USB debug driver config

The USB_SERIAL_DEBUG Kconfig is for the USB serial debug driver, not for
generically enabling debug output in random USB serial drivers.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: Export QUIRK_RESET_MORPHS through sysfs
Oliver Neukum [Sat, 16 Jan 2010 00:33:03 +0000 (01:33 +0100)]
USB: Export QUIRK_RESET_MORPHS through sysfs

Some devices which use mode switching revert to their
primary mode as they are reset. They must not be reset for
error handling. As user spaces makes the switch it also
has to tell the kernel that a device is quirky.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: storage: Never reset devices that will morph to an old mode
Oliver Neukum [Fri, 18 Dec 2009 11:14:21 +0000 (12:14 +0100)]
USB: storage: Never reset devices that will morph to an old mode

Some devices must be switched to a new mode to fully use them.
A reset would make them revert to the old mode. Therefore a reset
must not be used for error handling with such devices.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: otg: twl4030: add support for notifier
Felipe Balbi [Thu, 17 Dec 2009 11:01:37 +0000 (13:01 +0200)]
USB: otg: twl4030: add support for notifier

it's expected that the transceiver driver will
initialize and call the notifier chain when
necessary. Implement that for twl4030-usb driver.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: otg: add notifier support
Felipe Balbi [Thu, 17 Dec 2009 11:01:36 +0000 (13:01 +0200)]
USB: otg: add notifier support

The notifier will be used to communicate usb events
to other drivers like the charger chip.

This can be used as source of information to kick
usb charger detection as described by the USB
Battery Charging Specification 1.1 and/or to
pass bMaxPower field of selected usb_configuration
to charger chip in order to use that information
as input current on the charging profile
setup.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: wusb: check CHID is all zeros before stopping the host
Julia Lawall [Thu, 17 Dec 2009 13:57:33 +0000 (13:57 +0000)]
USB: wusb: check CHID is all zeros before stopping the host

An incorrect sizeof() resulted in only 4 (or 8) octets of the CHID being
checked instead of all 16 octets.  A randomly generated CHID had a
probability of being unable to start a WUSB host of less than 1 in
2 billion.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: xhci: No GFP_KERNEL in block error handling
Oliver Neukum [Wed, 16 Dec 2009 18:43:59 +0000 (19:43 +0100)]
USB: xhci: No GFP_KERNEL in block error handling

xhci_add_endpoint() is used in the reset path. It must
use GFP_NOIO to avoid a possible deadlock.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Acked-by: Sarah Sharp <sarah.a.sharp@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: cdc-acm: Update to new autopm API
Oliver Neukum [Wed, 16 Dec 2009 16:05:57 +0000 (17:05 +0100)]
USB: cdc-acm: Update to new autopm API

Update cdc-acm to the async methods eliminating the workqueue

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ehci-au1xxx.c: use platform_get_resource() and resource_size()
H Hartley Sweeten [Mon, 14 Dec 2009 23:22:42 +0000 (18:22 -0500)]
USB: ehci-au1xxx.c: use platform_get_resource() and resource_size()

Use platform_get_resource() to fetch the memory resource and
resource_size() for calculate the length.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ehci-atmel.c: use resource_size()
H Hartley Sweeten [Mon, 14 Dec 2009 23:15:35 +0000 (18:15 -0500)]
USB: ehci-atmel.c: use resource_size()

Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ehci-orion.c: use resource_size()
H Hartley Sweeten [Mon, 14 Dec 2009 23:13:00 +0000 (18:13 -0500)]
USB: ehci-orion.c: use resource_size()

Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: at91_udc.c: use resource_size()
H Hartley Sweeten [Mon, 14 Dec 2009 22:59:22 +0000 (17:59 -0500)]
USB: at91_udc.c: use resource_size()

Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: atmel_usba_udc.c: use resource_size()
H Hartley Sweeten [Mon, 14 Dec 2009 23:04:49 +0000 (18:04 -0500)]
USB: atmel_usba_udc.c: use resource_size()

Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: pxa27x_udc.c: use resource_size()
H Hartley Sweeten [Mon, 14 Dec 2009 23:05:02 +0000 (18:05 -0500)]
USB: pxa27x_udc.c: use resource_size()

Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ehci-fsl: Add power management support
Anton Vorontsov [Mon, 14 Dec 2009 15:41:12 +0000 (18:41 +0300)]
USB: ehci-fsl: Add power management support

EHCI FSL controller preserve its state during sleep mode, so nothing
fancy needs to be done.

Though, during 'deep sleep' mode (as found in MPC831x CPUs) the
controller turns off and needs to be reinitialized upon resume.

This patch adds support for hibernation and resuming after deep sleep.
Based on Dave Liu and Jerry Huang's work[1].

[1] http://www.bitshrine.org/gpp/linux-fsl-2.6.24.3-MPC8315ERDB-usb-power-mangement.patch

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ehci-fsl: Fix sparse warnings
Anton Vorontsov [Mon, 14 Dec 2009 15:41:05 +0000 (18:41 +0300)]
USB: ehci-fsl: Fix sparse warnings

This patch fixes following warnings:

ehci-fsl.c:43:5: warning: symbol 'usb_hcd_fsl_probe' was not declared. Should it be static?
ehci-fsl.c:150:6: warning: symbol 'usb_hcd_fsl_remove' was not declared. Should it be static?

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ehci: fix audio record functionality for some Full speed sound blaster devices
Dmitri Epshtein [Mon, 14 Dec 2009 15:17:34 +0000 (17:17 +0200)]
USB: ehci: fix audio record functionality for some Full speed sound blaster devices

This patch fix audio record functionality for some Full speed sound blaster devices.
Issue: Sometimes transaction complete indication is coming from HW one frame later.
Solution: If scan_periodic process now frame or previous frame now-1 and sitd transaction
is not finished yet, exit scan_periodic function and check the same transaction in the next frame.

Signed-off-by: Dimitry Epshtein <dima@marvell.com>
Signed-off-by: Saeed Bishara <saeed@marvell.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ehci: add call of free_cached_itd_list() function in disable_periodic()
Dmitri Epshtein [Mon, 14 Dec 2009 15:17:33 +0000 (17:17 +0200)]
USB: ehci: add call of free_cached_itd_list() function in disable_periodic()

Sometimes disable_periodic() stop scan_periodic before than free_cached_itd_list() was called.
In such case USB Host stacked during disconnect operation
Solution: add call of free_cached_itd_list() function in disable_periodic()

Signed-off-by: Dimitry Epshtein <dima@marvell.com>
Signed-off-by: Saeed Bishara <saeed@marvell.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: Add call to notify xHC of a device reset.
Sarah Sharp [Wed, 9 Dec 2009 23:59:17 +0000 (15:59 -0800)]
USB: Add call to notify xHC of a device reset.

Add a new host controller driver method, reset_device(), that the USB core
will use to notify the host of a successful device reset.  The call may
fail due to out-of-memory errors; attempt the port reset sequence again if
that happens.  Update hub_port_init() to allow resetting a configured
device.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: xhci: Notify the xHC when a device is reset.
Sarah Sharp [Wed, 9 Dec 2009 23:59:13 +0000 (15:59 -0800)]
USB: xhci: Notify the xHC when a device is reset.

When a USB device is reset, the xHCI hardware must know, in order to match
the device state and disable all endpoints except control endpoint 0.
Issue a Reset Device command after a USB device is successfully reset.
Wait on the command to finish, and then cache or free the disabled
endpoint rings.

There are four different USB device states that the xHCI hardware tracks:
 - disabled/enabled - device connection has just been detected,
 - default - the device has been reset and has an address of 0,
 - addressed - the device has a non-zero address but no configuration has
   been set,
 - configured - a set configuration succeeded.

The USB core may issue a port reset when a device is in any state, but the
Reset Device command will fail for a 0.96 xHC if the device is not in the
addressed or configured state.  Don't consider this failure as an error,
but don't free any endpoint rings if this command fails.

A storage driver may request that the USB device be reset during error
handling, so use GPF_NOIO instead of GPF_KERNEL while allocating memory
for the Reset Device command.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: xhci: Allow roothub ports to be disabled.
Sarah Sharp [Wed, 9 Dec 2009 23:59:11 +0000 (15:59 -0800)]
USB: xhci: Allow roothub ports to be disabled.

Add the hub emulation code to allow ports on an xHCI root hub to be
disabled.  Add the code to clear the port enabled/disabled bit, and clear
the port enabled/disabled change bit.  Like EHCI, the port cannot be
enabled by setting the port enabled/disabled bit.  Instead, a port is
enabled by the host controller after a reset.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: xhci: Refactor code to clear port change bits.
Sarah Sharp [Wed, 9 Dec 2009 23:59:08 +0000 (15:59 -0800)]
USB: xhci: Refactor code to clear port change bits.

Refactor the code to clear the port change bits in the port status
register.  All port status change bits are write one to clear.

Remove a redundant port status read that was supposed to unblock any
posted writes.  We read the port after the write to get the updated status
for debugging, so the port read after that is unnecessary.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: xhci: Refactor test for vendor-specific completion codes.
Sarah Sharp [Wed, 9 Dec 2009 23:59:06 +0000 (15:59 -0800)]
USB: xhci: Refactor test for vendor-specific completion codes.

All commands that can be issued to the xHCI hardware can come back with
vendor-specific "informational" completion codes.  These are to be treated
like a successful completion code.  Refactor out the code to test for the
range of these codes and print debugging messages.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: xhci: Allow allocation of commands without input contexts.
Sarah Sharp [Wed, 9 Dec 2009 23:59:03 +0000 (15:59 -0800)]
USB: xhci: Allow allocation of commands without input contexts.

The xhci_command structure is the basic structure for issuing commands to
the xHCI hardware.  It contains a struct completion (so that the issuing
function can wait on the command), command status, and a input context
that is used to pass information to the hardware.  Not all commands need
the input context, so make it optional to allocate.  Allow
xhci_free_container_ctx() to be passed a NULL input context, to make
freeing the xhci_command structure simple.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: xhci: Refactor code to free or cache endpoint rings.
Sarah Sharp [Wed, 9 Dec 2009 23:59:01 +0000 (15:59 -0800)]
USB: xhci: Refactor code to free or cache endpoint rings.

Refactor out the code to cache or free endpoint rings from recently
dropped or disabled endpoints.  This code will be used by a new function
to reset a device and disable all endpoints except control endpoint 0.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: xhci: Fix error path when configuring endpoints.
Sarah Sharp [Wed, 9 Dec 2009 23:58:58 +0000 (15:58 -0800)]
USB: xhci: Fix error path when configuring endpoints.

If we fail to queue an evaluate context command or a configure endpoint
command to the command ring in xhci_configure_endpoint(), we need to
remove the xhci_command structure from the device's command list before
returning.  If the command is left on the command list, it will sit there
indefinitely, blocking commands submitted after this fails.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: check the endpoint type against the pipe type
Alan Stern [Fri, 11 Dec 2009 21:20:20 +0000 (16:20 -0500)]
USB: check the endpoint type against the pipe type

This patch (as1316) adds some error checking to usb_submit_urb().
It's conditional on CONFIG_USB_DEBUG, so it won't affect normal users.
The new check makes sure that the actual type of the endpoint
described by urb->pipe agrees with the type encoded in the pipe value.

The USB error code documentation is updated to include the code
returned by the new check, and the usbfs SUBMITURB handler is updated
to use the correct pipe type when legacy user code tries to submit a
bulk transfer to an interrupt endpoint.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agocdc_acm: add reset_resume method
Francesco Lavra [Tue, 8 Dec 2009 08:54:11 +0000 (09:54 +0100)]
cdc_acm: add reset_resume method

Add reset resume logic to the cdc acm driver

Signed-off-by: Francesco Lavra <francescolavra@interfree.it>
Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: serial mct_usb232: move DMA buffers to heap
Pete Zaitcev [Tue, 8 Dec 2009 03:29:05 +0000 (20:29 -0700)]
USB: serial mct_usb232: move DMA buffers to heap

My distro kernel (Fedora Rawhide) started throwing warnings from DMA API
checker, so I have no choice but band-aid it quick. There's no attempt
to reuse DMA buffers. Control messages are only sent rarely anyway.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: pxa27x_udc: avoid compiler warnings and misbehavior on buggy hardware
Enrico Scholz [Sun, 11 Oct 2009 09:52:48 +0000 (11:52 +0200)]
USB: pxa27x_udc: avoid compiler warnings and misbehavior on buggy hardware

hardware reports wrong interrupt.  Although such a situation should not
happen, the compiler complains about this access.

This patch adds a sanity check and generates warning to detect such
issues.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: fix occasional ULPI timeouts with ehci-mxc
Valentin Longchamp [Wed, 20 Jan 2010 18:43:23 +0000 (19:43 +0100)]
USB: fix occasional ULPI timeouts with ehci-mxc

On various mxc boards, the intial ULPI reads resulted in a timeout
which prevented the transceiver to be identified and thus the ehci
device to be probed.

Initializing the hardware lines connected to the transceiver (through
pdata->init call) before actually enabling clocks and configuring
registers in the devices fixes this problem.

Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: ftdi_sio: remove support for 5 and 6 data bits
Mark Adamson [Tue, 24 Nov 2009 09:39:10 +0000 (09:39 +0000)]
USB: ftdi_sio: remove support for 5 and 6 data bits

Removed CS5 and CS6 from data bits since these are not supported
in FTDI hardware.

Signed-off-by: Mark J. Adamson <mark.adamson@ftdichip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>