usb: musb: Fix wrong config for am33xx and ti81xx

Commit "bb6abcf: ARM: OMAP2+: Kconfig: convert SOC_OMAPAM33XX to
SOC_AM33XX" and "3395955: ARM: OMAP2+: Kconfig: convert
SOC_OMAPTI81XX to SOC_TI81XX" has changed the SOC config for AM33XX
and TI81XX as shown below

CONFIG_SOC_OMAPAM33XX --> CONFIG_SOC_AM33XX
CONFIG_SOC_OMAPTI81XX --> CONFIG_SOC_TI81XX

So updating the same at musb driver for AM33XX and TI81XX platforms.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: musb: am335x: fix pdev resource bug

We are overwriting the resource->name to "mc" so that musb_core.c
can understand it but this is also changing the platform device's
resource->name as the "name" address remains same.

Fixing the same by changing the resource->name field of local
structure only.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: musb: reorder runtime pm call

The clock need to be enabled before the musb_core platform device is
created and registered.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
xhci: Increase reset timeout for Renesas 720201 host.

The NEC/Renesas 720201 xHCI host controller does not complete its reset
within 250 milliseconds.  In fact, it takes about 9 seconds to reset the
host controller, and 1 second for the host to be ready for doorbell
rings.  Extend the reset and CNR polling timeout to 10 seconds each.

This patch should be backported to kernels as old as 2.6.31, that
contain the commit 66d4eadd8d067269ea8fead1a50fe87c2979a80d "USB: xhci:
BIOS handoff and HW initialization."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: Edwin Klein Mentink <e.kleinmentink@zonnet.nl>
Cc: stable@vger.kernel.org
xhci: Add Etron XHCI_TRUST_TX_LENGTH quirk.

Gary reports that with recent kernels, he notices more xHCI driver
warnings:

xhci_hcd 0000:03:00.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?

We think his Etron xHCI host controller may have the same buggy behavior
as the Fresco Logic xHCI host.  When a short transfer is received, the
host will mark the transfer as successfully completed when it should be
marking it with a short completion.

Fix this by turning on the XHCI_TRUST_TX_LENGTH quirk when the Etron
host is discovered.  Note that Gary has revision 1, but if Etron fixes
this bug in future revisions, the quirk will have no effect.

This patch should be backported to kernels as old as 2.6.36, that
contain a backported version of commit
1530bbc6272d9da1e39ef8e06190d42c13a02733 "xhci: Add new short TX quirk
for Fresco Logic host."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: Gary E. Miller <gem@rellim.com>
Cc: stable@vger.kernel.org
xhci: Rate-limit XHCI_TRUST_TX_LENGTH quirk warning.

When we encounter an xHCI host that needs the XHCI_TRUST_TX_LENGTH
quirk, the xHCI driver ends up spewing messages about the quirk into
dmesg every time a short packet occurs.  Change the xHCI driver to
rate-limit such warnings.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: Matthew Hall <mhall@mhcomputing.net>
Reported-by: Gary E. Miller <gem@rellim.com>
Merge tag 'fixes-for-v3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

usb: fixes for v3.6-rc1

Here are three fixes for v3.6-rc1. All on the MUSB driver and
quite obvious. First there's a Kconfig change which was missed
earlier, then there is a fix for the usage of the resource name
and lastly a fix for pm_runtime usage and device initialization.

The last fix is rather critical as it can end up in situations
where we try to access device's register with clocks disabled,
which will cause a Data Abort exception (on ARM).
staging: comedi: remove pci_is_enabled() tests

As mentioned by Ian Abbott, the comedi pci drivers that try to
locate an unused pci device with the pci_is_enabled() test
might actually skip over a perfectly good unused device. This
test is also not consistent with the other comedi pci drivers.

Remove the test from all the comedi pci drivers.

Reported-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: daqboard2000: add back subsystem_device check

As mentioned by Ian Abbott, this driver originally checked
the pci_dev subsystem_device in order to make sure that the
pci_dev was compatible with this driver. The cleanup of the
"find pci device" code removed this check. Add it back.

Reported-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: daqboard2000: ioremap'ed addresses are resource_size_t

As mentioned by Ian Abbott, the pci address passed to ioremap
should be a resource_size_t not an unsigned long. Use a local
variable of that type to hold the pci_resource_start() that is
passed to ioremp().

Set the dev->iobase to a dummy non-zero value so that the "detach"
can use it as a flag to know that comedi_pci_disable() needs to
be called.

Reported-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: dt3000: ioremap'ed addresses are resource_size_t

As mentioned by Ian Abbott, the pci address passed to ioremap
should be a resource_size_t not an unsigned long. Use a local
variable of that type to hold the pci_resource_start() that is
passed to ioremp().

Set the dev->iobase to a dummy non-zero value so that the "detach"
can use it as a flag to know that comedi_pci_disable() needs to
be called.

Reported-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: rtd520: ioremap'ed addresses are resource_size_t

As mentioned by Ian Abbott, the pci address passed to ioremap
should be a resource_size_t not an unsigned long. Use a local
variable of that type to hold the pci_resource_start() that is
passed to ioremp().

Set the dev->iobase to a dummy non-zero value so that the "detach"
can use it as a flag to know that comedi_pci_disable() needs to
be called.

Reported-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
xhci: Fix bug after deq ptr set to link TRB.

This patch fixes a particularly nasty bug that was revealed by the ring
expansion patches.  The bug has been present since the very beginning of
the xHCI driver history, and could have caused general protection faults
from bad memory accesses.

The first thing to note is that a Set TR Dequeue Pointer command can
move the dequeue pointer to a link TRB, if the canceled or stalled
transfer TD ended just before a link TRB.  The function to increment the
dequeue pointer, inc_deq, was written before cancellation and stall
support was added.  It assumed that the dequeue pointer could never
point to a link TRB.  It would unconditionally increment the dequeue
pointer at the start of the function, check if the pointer was now on a
link TRB, and move it to the top of the next segment if so.

This means that if a Set TR Dequeue Point command moved the dequeue
pointer to a link TRB, a subsequent call to inc_deq() would move the
pointer off the segment and into la-la-land.  It would then read from
that memory to determine if it was a link TRB.  Other functions would
often call inc_deq() until the dequeue pointer matched some other
pointer, which means this function would quite happily read all of
system memory before wrapping around to the right pointer value.

Often, there would be another endpoint segment from a different ring
allocated from the same DMA pool, which would be contiguous to the
segment inc_deq just stepped off of.  inc_deq would eventually find the
link TRB in that segment, and blindly move the dequeue pointer back to
the top of the correct ring segment.

The only reason the original code worked at all is because there was
only one ring segment.  With the ring expansion patches, the dequeue
pointer would eventually wrap into place, but the dequeue segment would
be out-of-sync.  On the second TD after the dequeue pointer was moved to
a link TRB, trb_in_td() would fail (because the dequeue pointer and
dequeue segment were out-of-sync), and this message would appear:

ERROR Transfer event TRB DMA ptr not part of current TD

This fixes bugzilla entry 4333 (option-based modem unhappy on USB 3.0
port: "Transfer event TRB DMA ptr not part of current TD", "rejecting
I/O to offline device"),

	https://bugzilla.kernel.org/show_bug.cgi?id=43333

and possibly other general protection fault bugs as well.

This patch should be backported to kernels as old as 2.6.31.  A separate
patch will be created for kernels older than 3.4, since inc_deq was
modified in 3.4 and this patch will not apply.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: James Ettle <theholyettlz@googlemail.com>
Tested-by: Matthew Hall <mhall@mhcomputing.net>
Cc: stable@vger.kernel.org
Merge tag 'for-usb-linus-2012-08-08' of git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-linus

xHCI bug fixes and host quirks.

Hi Greg,

Here's four patches for 3.6.  Most are marked for stable as well.

The first one makes the xHCI driver load properly on newer Rensas hosts.
The next two fix issues with the Etron host incorrectly marking short
transfers as successful, and avoiding log warning spam for hosts that
make the same mistake.

The last patch fixes a really nasty xHCI driver bug that could cause
general protection faults when devices stall transfers.

Sarah Sharp
xhci: Switch PPT ports to EHCI on shutdown.

The Intel desktop boards DH77EB and DH77DF have a hardware issue that
can be worked around by BIOS.  If the USB ports are switched to xHCI on
shutdown, the xHCI host will send a spurious interrupt, which will wake
the system.  Some BIOS will work around this, but not all.

The bug can be avoided if the USB ports are switched back to EHCI on
shutdown.  The Intel Windows driver switches the ports back to EHCI, so
change the Linux xHCI driver to do the same.

Unfortunately, we can't tell the two effected boards apart from other
working motherboards, because the vendors will change the DMI strings
for the DH77EB and DH77DF boards to their own custom names.  One example
is Compulab's mini-desktop, the Intense-PC.  Instead, key off the
Panther Point xHCI host PCI vendor and device ID, and switch the ports
over for all PPT xHCI hosts.

The only impact this will have on non-effected boards is to add a couple
hundred milliseconds delay on boot when the BIOS has to switch the ports
over from EHCI to xHCI.

This patch should be backported to kernels as old as 3.0, that contain
the commit 69e848c2090aebba5698a1620604c7dccb448684 "Intel xhci: Support
EHCI/xHCI port switching."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: Denis Turischev <denis@compulab.co.il>
Tested-by: Denis Turischev <denis@compulab.co.il>
Cc: stable@vger.kernel.org
Merge tag 'for-usb-linus-2012-08-09' of git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-linus

Intel xhci: Work around immediate reboot on shutdown.

Hi Greg,

I'm cleaning out my queue before I leave on vacation tomorrow, so here's
one more patch for 3.6.  It works around an issue on a couple Intel
Panther Point desktop systems that cause them to reboot about 10 seconds
after the user shutdowns the system.

Sarah Sharp
USB: ftdi_sio: Add VID/PID for Kondo Serial USB

This adds VID/PID for Kondo Kagaku Co. Ltd. Serial USB Adapter
interface:
http://www.kondo-robot.com/EN/wp/?cat=28

Tested by controlling an RCB3 board using libRCB3.

Signed-off-by: Ozan Çağlayan <ozancag@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB: support the new interfaces of Huawei Data Card devices in option driver

In this patch, we add new declarations into option.c to support the new
interfaces of Huawei Data Card devices. And at the same time, remove the
redundant declarations from option.c.

Signed-off-by: fangxiaozhi <huananhu@huawei.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
usb: chipidea: fix and improve dependencies if usb host or gadget support is built as module

Since commit "5e0aa49 usb: chipidea: use generic map/unmap routines",
the udc part of the chipidea driver needs the generic usb gadget helper
functions. If the chipidea driver with udc support is built into the
kernel and usb gadget is built a module, the linking of the kernel
fails with:

drivers/built-in.o: In function `_hardware_dequeue':
drivers/usb/chipidea/udc.c:527:
    undefined reference to `usb_gadget_unmap_request'
drivers/usb/chipidea/udc.c:1269:
    undefined reference to `usb_gadget_unmap_request'
drivers/usb/chipidea/udc.c:1821:
    undefined reference to `usb_del_gadget_udc'
drivers/usb/chipidea/udc.c:443:
    undefined reference to `usb_gadget_map_request'
drivers/usb/chipidea/udc.c:1774:
    undefined reference to `usb_add_gadget_udc'

This patch changes the dependencies, so that udc support can only be
activated if the linux gadget support (USB_GADGET) is builtin or both
chipidea driver and USB_GADGET are modular. Same dependencies for the
chipidea host support and the linux host side USB support (USB).

While there, fix the indention of chipidea the help text.

Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
OMAP: USB : Fix the EHCI enumeration and core retention issue

This commit 354ab8567ae3107a8cbe7228c3181990ba598aac titled
"Fix OMAP EHCI suspend/resume failure (i693)" is causing
the usb hub and device detection fails in beagle XM
causeing NFS not functional. This affects the core retention too.
The same commit logic needs to be revisted adhering to hwmod and
device tree framework.
for now, this commit id 354ab8567ae3107a8cbe7228c3181990ba598aac
titled "Fix OMAP EHCI suspend/resume failure (i693)" reverted.

This patch is validated on BeagleXM with NFS support over
usb ethernet and USB mass storage and other device detection.

Signed-off-by: Keshava Munegowda <keshava_mgowda@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Cc: stable <stable@vger.kernel.org> # 3.5
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>