1
0
Fork 0
Commit Graph

11285 Commits (67e51ec4ed09482b53a81fb33df81a2d5a15aa2f)

Author SHA1 Message Date
Johan Hovold 3b716caf19 USB: mos7720: fix big-endian control requests
Fix endianess bugs in parallel-port code which caused corrupt
control-requests to be issued on big-endian machines.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-19 17:02:11 -07:00
Dan Carpenter d0bd9a4118 USB: mos7720: use GFP_ATOMIC under spinlock
The write_parport_reg_nonblock() function shouldn't sleep because it's
called with spinlocks held.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable@vger.kernel.org
Acked-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-19 17:02:11 -07:00
Philippe De Swert 9c1d696251 usb:gadget Fix comment for pointer to configfs
The documentation for the USB gadget fs is actually in
Documentation/usb/gadget_configfs.txt.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-19 17:02:11 -07:00
Greg Kroah-Hartman 4c4e15966d xhci: Step 2 to fix usb-linus and usb-next.
Hi Greg,
 
 This is the first of two steps to fix your usb-linus and usb-next trees.
 As I mentioned, commit 4fae6f0fa8 "USB:
 handle LPM errors during device suspend correctly" was incorrectly added
 to usb-next when it should have been added to usb-linus and marked for
 stable.
 
 Two port power off bug fixes touch the same code that patch touches, but
 it's not easy to simply move commit 4fae6f0f patch to usb-linus because
 commit 28e861658e "USB: refactor code for
 enabling/disabling remote wakeup" also touched those code sections.
 
 I propose a two step process to fix this:
 
 1. Pull these four patches into usb-linus.
 
 2. Revert commit 28e861658e from usb-next.
    Merge usb-linus into usb-next, and resolve the conflicts.
 
 I will be sending pull requests for these steps.
 
 This pull request is step two.
 
 Sarah Sharp
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSDXrSAAoJEBMGWMLi1Gc5ZCQP/0zPv79GEqz0sgRzZGu+WJbr
 GNGIq9FAeEh+2ssIo1/F5q7gul9wL/Vu0DntM8IH9u/T6AVF01OlXAhzfGR9Iqlb
 dT36SNVe7G1/wG90c7szfcH3SvAYiwQEFv4bhSeLdDzfgRwV8NHtMUTv+Fc6qsmz
 +YcVOo5gTJOmOQqfzblVEQWx+XhjacvcM4AYfPjWPar4orMOIzGiPPiHSOv+6N10
 /kSgcGyXF/qNdkaxRKhCK8USAxADI7UyAgiuBC9LGkOUwNYEZ85/UA5XFhor9kk9
 03gSBmes8IS547jVkEYlDKfeoL0j4Z04OxOJ+OG1aOg4K8IVHpIpYBCBz9fklsfx
 ym0HPKOjYBAF+9dc6sO4CpAkLVS1tbUuxAoxJt5MD5WTLNZ7jdJAtCDEJoD43Yq/
 sPkJdBoq1JJxTiEzUT+KUTQfOB7d22spBpaWdSKvduAnJKy89ZPi/Mnk9jLSklGa
 SFMzx86pbJL/4aAYxiEHDnbRm8utvco817EcCbO+DtEVK1Y54gY5Wi+eW9aweQnh
 XV51Q4dp5rMGh2llHjobrISnbWR//Zk1lRvXMg0gHh/9skNqUCYaYQXxhXtilb8Q
 5PVEZb/fFsZxHQWYpdWHwMXlHRjcsvguLeZgVHhtzfQqIxZH6jHV+lSIp3Si5jQo
 zQCP+sYuAs9prVtqETXc
 =qfOL
 -----END PGP SIGNATURE-----

Merge tag 'for-usb-2013-08-15-step-2' of ra.kernel.org:/pub/scm/linux/kernel/git/sarah/xhci into work-next

Sarah writes:

xhci: Step 2 to fix usb-linus and usb-next.

Hi Greg,

This is the first of two steps to fix your usb-linus and usb-next trees.
As I mentioned, commit 4fae6f0fa8 "USB:
handle LPM errors during device suspend correctly" was incorrectly added
to usb-next when it should have been added to usb-linus and marked for
stable.

Two port power off bug fixes touch the same code that patch touches, but
it's not easy to simply move commit 4fae6f0f patch to usb-linus because
commit 28e861658e "USB: refactor code for
enabling/disabling remote wakeup" also touched those code sections.

I propose a two step process to fix this:

1. Pull these four patches into usb-linus.

2. Revert commit 28e861658e from usb-next.
   Merge usb-linus into usb-next, and resolve the conflicts.

I will be sending pull requests for these steps.

This pull request is step two.

Sarah Sharp
2013-08-19 16:57:51 -07:00
Greg Kroah-Hartman bd479f2933 Merge 3.11-rc6 into usb-next
We want these USB fixes in this branch as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-18 20:33:01 -07:00
Yann Droneaud 68c91d377c USB: serial: fix stringify operator in usb-serial-simple
usb-serial-simple uses an unknown stringify macro that make
all drivers being named "stringify(vendor)".

This can be a problem when two drivers have the same (wrong) name:

    kernel: usbcore: registered new interface driver usb_serial_simple
    kernel: usbserial: USB Serial support registered for stringify(vendor)
    kernel Error: Driver 'stringify(vendor)' is already registered, aborting...
    kernel: usbserial: problem -16 when registering driver stringify(vendor)
    kernel: usbserial: USB Serial deregistering driver stringify(vendor)
    kernel: usbcore: deregistering interface driver usb_serial_simple

Before the fix:

    $ strings drivers/usb/serial/usb-serial-simple.o
    usb_serial_simple
    stringify(vendor)

After the fix:

    $ strings drivers/usb/serial/usb-serial-simple.o
    usb_serial_simple
    funsoft
    flashloader
    vivopay
    moto_modem
    hp4x
    suunto
    siemens_mpi

This patch makes usb-serial-simple use the correct stringify operator.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-18 13:11:06 -07:00
Sarah Sharp 5845c13a70 xhci: Step 1 to fix usb-linus and usb-next.
Hi Greg,
 
 This is the first of three steps to fix your usb-linus and usb-next
 trees.  As I mentioned, commit 4fae6f0fa8
 "USB: handle LPM errors during device suspend correctly" was incorrectly
 added to usb-next when it should have been added to usb-linus and marked
 for stable.
 
 Two port power off bug fixes touch the same code that patch touches, but
 it's not easy to simply move commit 4fae6f0f patch to usb-linus because
 commit 28e861658e "USB: refactor code for
 enabling/disabling remote wakeup" also touched those code sections.
 
 I propose a two step process to fix this:
 
 1. Pull these four patches into usb-linus.
 
 2. Revert commit 28e861658e from usb-next.
    Merge usb-linus into usb-next, and resolve the conflicts.
 
 I will be sending pull requests for these steps.
 
 This pull request is step one, and contains the backported version of
 commit 4fae6f0fa8, the two port power off
 fixes, and an unrelated xhci-plat bug fix.
 
 Sarah Sharp
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSDXUgAAoJEBMGWMLi1Gc5KrcP/jVYFI7CRS9sRWaBxtMdAbi7
 Ve0q7479ZmPA9o+SwGKVzO8cM8XJ6mb6CmNww6rByxneUFKvcnq0dwWBc31mZltP
 +zYzgOKk0GwAYZ644QvpcZfh8lh/ex52qdPb+RKZIfcsmKJzPJwHJSaYUh+LJrTC
 NxW4NqWYSMbroh3X0nsvM4bw/vEP2D8BhMjXrBDcDDC9gkj+YGE3eIeW08Hq47x1
 Hil6rA0/BERWvKP5SJdgWdRld6z5NzrOMdOea9LJtHTzrhi9Gyvc2hul4cvKfj4P
 VMUslkxw2x13oqeY0xp/uCZkIMYGmvHf50BOGjIoRW8JARe92Vh3mb6xE+ywu4LQ
 pHWDDH+ANUtrtNEF1/3xu+8mYNgg5prdhKRztkUlzJ/FTvNPjbYAN+t4p0s3O8bh
 VRo6iH9G0pydjVpo1YERX1S69noyUHsguXkrZnMPVMfMC7reOAb5mev56hcSjh9Y
 S24RYVHYhJNz9A4L8Y7yDu7Z1MorcIvviTI0xa0AS7n2r40vnEQJtQyP2GbK7KZH
 iHIUNh2E6GHyCsvDBMuYgIELJM0OswCiF+SKtMiGgwlbOcVvXMXcgNdCSuMJhuo9
 PjNT9bs6RsgSEqYemYruFkhomhPBJHPwTr8dy4YsThx2GOTm0AsZ0FCbVmNPqOvI
 1NYgwzvX3fr94iNt3xdg
 =0/wL
 -----END PGP SIGNATURE-----

Merge tag 'for-usb-2013-08-15-step-1' into for-usb-next

xhci: Step 1 to fix usb-linus and usb-next.

Hi Greg,

This is the first of three steps to fix your usb-linus and usb-next
trees.  As I mentioned, commit 4fae6f0fa8
"USB: handle LPM errors during device suspend correctly" was incorrectly
added to usb-next when it should have been added to usb-linus and marked
for stable.

Two port power off bug fixes touch the same code that patch touches, but
it's not easy to simply move commit 4fae6f0f patch to usb-linus because
commit 28e861658e "USB: refactor code for
enabling/disabling remote wakeup" also touched those code sections.

I propose a two step process to fix this:

1. Pull these four patches into usb-linus.

2. Revert commit 28e861658e from usb-next.
   Merge usb-linus into usb-next, and resolve the conflicts.

I will be sending pull requests for these steps.

This pull request is step one, and contains the backported version of
commit 4fae6f0fa8, the two port power off
fixes, and an unrelated xhci-plat bug fix.

Sarah Sharp

Resolved conflicts:
	drivers/usb/core/hub.c
2013-08-15 18:00:46 -07:00
Thomas Pugliese 66591015d8 USB: WUSBCORE: Use usb_init_urb instead of creating the URB manually
In wa_seg_init, use usb_init_urb to init the URB object contained in the
transfer segment instead of initializing it manually.  Use kmalloc to
allocate the memory for segment instead of kzalloc and then use memset
to set the non-URB portion of the transfer segment struct to 0 since
that was already done by usb_init_urb.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-15 17:36:27 -07:00
Thomas Pugliese 79731cbd78 USB: WUSBCORE: fix leak of urb in wa_xfer_destroy.
The check to free the URB was the opposite of the correct case.  This
patch removes the check altogether since the ptr will be NULL if the URB
was not allocated.  Also use usb_free_urb instead of usb_put_urb.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-15 17:36:27 -07:00
Thomas Pugliese 11b1bf81bf USB: WUSBCORE: fix resource cleanup in error path in __wa_xfer_setup_segs
Use usb_free_urb instead of kfree in error path and point to the correct
URB.  Also remember to clean up the sg list for the URB if it was allocated.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-15 17:36:27 -07:00
Thomas Pugliese 6d33f7bb8c USB: WUSBCORE: clear RPIPE stall for control endpoints
When the HWA encounters a STALL on a control endpoint, it should clear the
RPIPE_STALL feature on the RPIPE before processing the next transfer
request.  Otherwise, all transfer requests on that endpoint after the
first STALL will fail because the RPIPE is still in the halted state.
This also removes the unneccessary call to spin_lock_irqsave for a nested
lock that was present in the first patch.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-15 17:35:31 -07:00
Greg Kroah-Hartman 224563b6ce xhci: Platform updates, 64-bit DMA, and trace events for 3.12.
Hi Greg,
 
 This pull request includes one new feature for the xhci-plat driver (device
 tree support).  Felipe was fine with the patch last I checked, but hadn't
 provided an official Acked-by line.
 
 This pull request also includes 13 patches from my FOSS Outreach Program for
 Women (OPW) intern, Xenia.  She fixed a bug in the xHCI driver so that the
 driver can allocate 64-bit consistent DMA, converted the driver to use dynamic
 debugging, and added a bunch of new trace events for the xHCI driver.  The
 python plugin for trace-cmd should be up on git hub shortly, although the trace
 events are usable without it.
 
 I'm very happy with the progress that Xenia has made, and I look forward to her
 future contributions to the Linux kernel.
 
 Sarah Sharp
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSDPhXAAoJEBMGWMLi1Gc5gyIP/iH1gkiwWT4LapgmwKyG3kH5
 YS+NKBC/E1a2kXlvP6yb5SzZd9eYcQ0oatGB1Tg/ek+HctDEmDr2XBBhRuR2XszW
 6mkGbP4NjnRrW8s+5IgF3bbk5GGHY50ogegHIYiTHCo+lHvX+zCFSv/fNtHli3FU
 HhyR/cxOJUouFmPQHgnjc3yFGthYO9sfq0YTDKQ00dYna2q44zm+TTwJSvg8XjW5
 oTFyJeER0yQQ4b9gKUz4JJDmYUmr2ZiAmXIZD9C8fouD5PGdFjBquH9lCY5rRjPi
 UZB/HKtSTntT3K1yWCdiT/wqAGcY/MF9FVg44LtQom7c7ozwPUnQV1Y/7kPU2KrM
 etKBqR5z1x4Sob8c1YnSiARGUAzwKxxXjlcZA3WWJJahI/tR70PSslesoxi+phQs
 mPTYOX+f5UIF3ieiREJWf6tvL5hWVYVv4y9WqzF6gUydVjpxHgRZ0oikiRFUPBtz
 DEjhlsNjDE56M88aVVJCUiPDQFZpJZccykqZr6uNt/T9KQyS0NvH5eKY/U3AUJXC
 N/8EB/eFTbMIgDWBQRusV2+08oMVZrFXXGvDin/qmWP8eRsaJHCILymWrwq1dkTW
 Cd7F8CgT1uDbu5Kyxq/p4lVWwgpUTkN99aW2cqgfY7IhuWtatn1SdL7SD+0OBHne
 jFDdl5LQuKE4otg4+KKv
 =n45I
 -----END PGP SIGNATURE-----

Merge tag 'for-usb-next-2013-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-next

Sarah writes:

xhci: Platform updates, 64-bit DMA, and trace events for 3.12.

Hi Greg,

This pull request includes one new feature for the xhci-plat driver (device
tree support).  Felipe was fine with the patch last I checked, but hadn't
provided an official Acked-by line.

This pull request also includes 13 patches from my FOSS Outreach Program for
Women (OPW) intern, Xenia.  She fixed a bug in the xHCI driver so that the
driver can allocate 64-bit consistent DMA, converted the driver to use dynamic
debugging, and added a bunch of new trace events for the xHCI driver.  The
python plugin for trace-cmd should be up on git hub shortly, although the trace
events are usable without it.

I'm very happy with the progress that Xenia has made, and I look forward to her
future contributions to the Linux kernel.

Sarah Sharp
2013-08-15 17:33:16 -07:00
Sarah Sharp 52fb61250a xhci-plat: Don't enable legacy PCI interrupts.
The xHCI platform driver calls into usb_add_hcd to register the irq for
its platform device.  It does not want the xHCI generic driver to
register an interrupt for it at all.  The original code did that by
setting the XHCI_BROKEN_MSI quirk, which tells the xHCI driver to not
enable MSI or MSI-X for a PCI host.

Unfortunately, if CONFIG_PCI is enabled, and CONFIG_USB_DW3 is enabled,
the xHCI generic driver will attempt to register a legacy PCI interrupt
for the xHCI platform device in xhci_try_enable_msi().  This will result
in a bogus irq being registered, since the underlying device is a
platform_device, not a pci_device, and thus the pci_device->irq pointer
will be bogus.

Add a new quirk, XHCI_PLAT, so that the xHCI generic driver can
distinguish between a PCI device that can't handle MSI or MSI-X, and a
platform device that should not have its interrupts touched at all.
This quirk may be useful in the future, in case other corner cases like
this arise.

This patch should be backported to kernels as old as 3.9, that
contain the commit 00eed9c814 "USB: xhci:
correctly enable interrupts".

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: Yu Y Wang <yu.y.wang@intel.com>
Tested-by: Yu Y Wang <yu.y.wang@intel.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Cc: stable@vger.kernel.org
2013-08-15 10:52:36 -07:00
Sarah Sharp d49dad3e11 usb: Don't fail port power resume on device disconnect.
Userspace can tell the kernel to power off any USB port, including ones
that are visible and connectible to users.  When an attached USB device
goes into suspend, the port will be powered off if the
pm_qos_no_port_poweroff file for its port is set to 0, the device does
not have remote wakeup enabled, and the device is marked as persistent.

If the user disconnects the USB device while the port is powered off,
the current code does not handle that properly.  If you disconnect a
device, and then run `lsusb -v -s` for the device, the device disconnect
does not get handled by the USB core.  The runtime resume of the port
fails, because hub_port_debounce_be_connected() returns -ETIMEDOUT.

This means the port resume fails and khubd doesn't handle the USB device
disconnect.  This leaves the device listed in lsusb, and the port's
runtime_status will be permanently marked as "error".

Fix this by ignoring the return value of hub_port_debounce_be_connected.
Users can disconnect USB devices while the ports are powered off, and we
must be able to handle that.

This patch should be backported to kernels as old as 3.9, that
contain the commit ad493e5e58 "usb: add
usb port auto power off mechanism"

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Lan Tianyu <tianyu.lan@intel.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-08-15 10:52:35 -07:00
Lan Tianyu 98a4f1ff7b usb: don't check pm qos NO_POWER_OFF flag in usb_port_suspend()
The pm qos NO_POWER_OFF flag is checked twice during usb device suspend
to see if the usb port power off condition is met. This is redundant and
also will prevent the port from being powered off if the NO_POWER_OFF
flag is changed to 1 from 0 after the device was already suspended.

More detail in the following link.
	http://marc.info/?l=linux-usb&m=136543949130865&w=2

This patch should be backported to kernels as old as 3.7, that
contain the commit f7ac7787ad "usb/acpi:
Use ACPI methods to power off ports."

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-08-15 10:52:33 -07:00
Alan Stern aa5ceae24b USB: handle LPM errors during device suspend correctly
The hub driver's usb_port_suspend() routine doesn't handle errors
related to Link Power Management properly.  It always returns failure,
it doesn't try to clean up the wakeup setting, (in the case of system
sleep) it doesn't try to go ahead with the port suspend regardless,
and it doesn't try to apply the new power-off mechanism.

This patch fixes these problems.

Note: Sarah fixed this patch to apply against 3.11, since the original
commit (4fae6f0fa8 "USB: handle LPM errors
during device suspend correctly") called usb_disable_remote_wakeup,
which won't be added until 3.12.

This patch should be backported to kernels as old as 3.5, that
contain the commit 8306095fd2 "USB:
Disable USB 3.0 LPM in critical sections.".  There will be merge
conflicts, since LTM wasn't added until 3.6.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-08-15 10:52:32 -07:00
Johan Hovold 9821aa9de9 USB: uss720: fix DMA-buffer allocation
Make sure the USB control request is allocated separately from
containing structure to prevent potential memory corruption on
non-cache-coherent systems.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 13:51:02 -07:00
Johan Hovold cbf30a914e USB: quatech2: fix port DMA-buffer allocations
Make sure serial DMA-buffers are allocated separately from containing
structure to prevent potential memory corruption on non-cache-coherent
systems.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 13:51:02 -07:00
Johan Hovold 0448067150 USB: quatech2: fix serial DMA-buffer allocations
Make sure serial DMA-buffers are allocated separately from containing
structure to prevent potential memory corruption on non-cache-coherent
systems.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 13:51:02 -07:00
Johan Hovold bad41a5bf1 USB: keyspan: fix port DMA-buffer allocations
Make sure port DMA-buffers are allocated separately from containing
structure to prevent potential memory corruption on non-cache-coherent
systems.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 13:51:02 -07:00
Johan Hovold 2fcd1c9b32 USB: keyspan: fix serial DMA-buffer allocations
Make sure serial DMA-buffers are allocated separately from containing
structure to prevent potential memory corruption on non-cache-coherent
systems.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 13:51:01 -07:00
Johan Hovold ff8a43c10f USB: keyspan: fix null-deref at disconnect and release
Make sure to fail properly if the device is not accepted during attach
in order to avoid null-pointer derefs (of missing interface private
data) at disconnect or release.

Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:49:27 -07:00
Johan Hovold ef6c8c1d73 USB: mos7720: fix broken control requests
The parallel-port code of the drivers used a stack allocated
control-request buffer for asynchronous (and possibly deferred) control
requests. This not only violates the no-DMA-from-stack requirement but
could also lead to corrupt control requests being submitted.

Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:49:27 -07:00
Oliver Neukum 304ab4ab07 usb: add two quirky touchscreen
These devices tend to become unresponsive after S3

Signed-off-by: Oliver Neukum <oneukum@suse.de>
CC: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:49:27 -07:00
Sascha Hauer 05986ba9b0 USB: chipidea: i.MX: simplify usbmisc
The chipidea i.MX driver is split into two drivers. The ci_hdrc_imx driver
handles the chipidea cores and the usbmisc_imx driver handles the noncore
registers common to all chipidea cores (but SoC specific). Current flow is:

- usbmisc sets an ops pointer in the ci_hdrc_imx driver during probe
- ci_hdrc_imx checks if the pointer is valid during probe, if yes calls
  the functions in the ops pointer.
- usbmisc_imx calls back into the ci_hdrc_imx driver to get additional
  data

This is overly complicated and has problems if the drivers are compiled
as modules. In this case the usbmisc_imx driver can be unloaded even if
the ci_hdrc_imx driver still needs usbmisc functionality.

This patch changes this by letting the ci_hdrc_imx driver calling functions
from the usbmisc_imx driver. This way the symbol resolving during module
load makes sure the ci_hdrc_imx driver depends on the usbmisc_imx driver.

Also instead of letting the usbmisc_imx driver call back into the ci_hdrc_imx
driver, pass the needed data in the first place.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:20 -07:00
Peter Chen 4a64783b66 usb: chipidea: udc: .pullup is valid only when vbus is there
For chipidea, the IP must know vbus before the controller
begins to run. So the .pullup should only be called when
the vbus is there.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:20 -07:00
Peter Chen d268e9bc23 usb: chipidea: retire flag CI_HDRC_PULLUP_ON_VBUS
Currently, the controller only runs when the ci->vbus_active is true.
So the flag CI_HDRC_PULLUP_ON_VBUS is useless no longer.
If the user doesn't have otgsc, he/she needs to change ci_handle_vbus_change
to update ci->vbus_active.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:20 -07:00
Peter Chen e7e621eb84 usb: chipidea: udc: fix misuse of REGS_SHARED and PULLUP_ON_VBUS flags
CI_HDRC_REGS_SHARED stands for the controller registers is shared
with other USB drivers, if all USB drivers are at chipidea/, it doesn't
needed to be set.
CI_HDRC_PULLUP_ON_VBUS stands for pullup dp when the vbus is on. This
flag doesn't need to be set if the vbus is always on for gadget
since dp has always pulled up after the gadget has initialized.

So, the current code seems to misuse this two flags.
- When the gadget initializes, the controller doesn't need to run if
it depends on vbus (CI_HDRC_PULLUP_ON_VBUS), it does not relate to
shared register.
- When the gadget starts (load one gadget module), the controller
can run if vbus is on (CI_HDRC_PULLUP_ON_VBUS), it also does not
relate to shared register.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:20 -07:00
Peter Chen 22fa84455a usb: chipidea: add wait vbus lower than OTGSC_BSV before role starts
When the gadget role starts, we need to make sure the vbus is lower
than OTGSC_BSV, or there will be an vbus interrupt since we use
B_SESSION_VALID as vbus interrupt to indicate connect and disconnect.
When the host role starts, it may not be useful to wait vbus to lower
than OTGSC_BSV, but it can indicate some hardware problems like the
vbus is still higher than OTGSC_BSV after we disconnect to host some
time later (5000 milliseconds currently), which is obvious not correct.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:20 -07:00
Peter Chen a107f8c505 usb: chipidea: add vbus interrupt handler
We add vbus interrupt handler at ci_otg_work, it uses OTGSC_BSV(at otgsc)
to know it is connect or disconnet event.
Meanwhile, we introduce two flags id_event and b_sess_valid_event to
indicate it is an id interrupt or a vbus interrupt.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:20 -07:00
Peter Chen cbec6bd55a usb: chipidea: move otg related things to otg file
Move otg related things to otg file.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:19 -07:00
Peter Chen c344b51800 usb: chipidea: disable all interrupts and clear all interrupts status
During the initialization, it needs to disable all interrupts
enable bit as well as clear all interrupts status bits to avoid
exceptional interrupt.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:19 -07:00
Peter Chen 577b232fc9 usb: chipidea: add flag CI_HDRC_DUAL_ROLE_NOT_OTG
Since we need otgsc to know vbus's status at some chipidea
controllers even it is peripheral-only mode. Besides, some
SoCs (eg, AR9331 SoC) don't have otgsc register even
the DCCPARAMS_DC and DCCPARAMS_HC are both 1 at CAP_DCCPARAMS.

We inroduce flag CI_HDRC_DUAL_ROLE_NOT_OTG to indicate if the
controller is dual role, but not supports OTG. If this flag is
not set, we follow the rule that if DCCPARAMS_DC and DCCPARAMS_HC
are both 1 at CAP_DCCPARAMS, then this controller is otg capable.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:19 -07:00
Peter Chen 3f124d233e usb: chipidea: add role init and destroy APIs
- The role's init will be called at probe procedure.
- The role's destroy will be called at fail patch
at probe and driver's removal.
- The role's start/stop will be called when specific
role has started.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:19 -07:00
Peter Chen c10b4f033e usb: chipidea: otg: add otg file used to access otgsc
This file is mainly used to access otgsc currently, it may
add otg related things in the future.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:19 -07:00
Peter Chen d66895f9df usb: chipidea: udc: otg_set_peripheral is useless for some chipidea users
It is useless at below cases:
- If we implement both usb host and device at chipidea driver.
- If we don't need phy->otg.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:37:19 -07:00
Peter Chen 40ed51a4b8 usb: chipidea: host: add vbus regulator control
For boards which have board level vbus control (eg, through gpio), we
need to vbus operation according to below rules:
- For host, we need open vbus before start hcd, and close it
after remove hcd.
- For otg, the vbus needs to be on/off when usb role switches.
When the host roles begins, it opens vbus; when the host role
finishes, it closes vbus.

We put vbus operation to host as host is the only vbus user,
When we are at host mode, the vbus is on, when we are not at
host mode, vbus should be off.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:34:17 -07:00
Peter Chen 1542d9c35d usb: chipidea: move vbus regulator operation to core
The vbus regulator is a common element for USB vbus operation,
So, move it from glue layer to core.

Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:34:17 -07:00
Fabio Estevam 6a6243b164 usb: chipidea: remove previous MODULE_ALIAS
After the rename to ci_hdrc we ended up with two MODULE_ALIAS entries, so
remove the old one.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:34:16 -07:00
Lothar Waßmann e98b44e90b usb: chipidea: prevent endless loop registering platform_devices when probe fails
Commit 40dcd0e ("usb: chipidea: add PTW, PTS and STS handling") introduced
the following code to the ci_hdrc_probe() function:

+       if (!dev->of_node && dev->parent)
+               dev->of_node = dev->parent->of_node;

This inadvertently associates the ci_hdrc device with the ci_hdrc_imx
driver (which created the ci_hdrc device in the first place).

This results in ci_hdrc_imx_probe() being run for the ci_hdrc device
if ci_hdrc_probe() fails for some reason.
ci_hdrc_imx_probe() will happily create a new ci_hdrc platform_device
whose probing will likewise fail and trigger a new invocation of
ci_hdrc_imx_probe() ... ad nauseam.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Reviewed-and-tested-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:34:16 -07:00
Lothar Waßmann 3b1280ca4b usb: chipidea: don't clobber return value of ci_role_start()
If a role fails to start, propagate the error code up the call stack
from probe.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:34:16 -07:00
Lothar Waßmann 769d92c411 usb: chipidea: ci_hdrc_imx: remove an unsolicited module_put() call from ci_hdrc_imx_remove()
This prevents the USB PHY refcount to be decremented below zero upon
unloading the ci-hdrc-imx module.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:34:16 -07:00
Lothar Waßmann a0cfdc6bc7 usb: chipidea: improve kconfig 2.0
This patch provides a cleaner solution to the problem described in
commit 20a677fd ("usb: chipidea: improve kconfig").

The goal to be achieved is to force USB_CHIPIDEA=m if either
USB_EHCI_HCD=m or USB_GADGET=m.
If both are 'y' USB_CHIPIDEA may be selected to be 'm' or 'y'.

The old patch had the drawback, that USB_CHIPIDEA could be chosen as
'y' though USB_EHCI_HCD or USB_GADGET (or both) were 'm' leading to a
situation where USB_CHIPIDEA_HOST or USB_CHIPIDEA_UDC vanished from
the config options producing a compilable but dysfunctional driver.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Reviewed-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:34:16 -07:00
Peter Chen 9d84d55116 usb: chipidea: imx: delete the dead code
Remove an unused macro leftover from the old initialization code.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:34:15 -07:00
Fabio Estevam 03779f05be usb: chipidea: move hw_phymode_configure() into probe
Currently hw_phymode_configure() is located inside hw_device_reset(), which is
only called by chipidea udc driver.

When operating in host mode, we also need to call hw_phymode_configure() in
order to properly configure the PHY mode, so move this function into probe.

After this change, USB Host1 port on mx53qsb board is functional.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Reviewed-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:34:15 -07:00
Fabio Estevam 5bb3da0ec0 usb: chipidea: ci_hdrc_imx: remove unused variable 'res'
'res' is not used anywhere, so let's get rid of it.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:34:15 -07:00
Felipe Balbi bb67490711 usb: dwc3: core: cope with NULL pdata
if pdata is a NULL pointer we could cause a
kernel oops when probing the driver. Make sure
to cope with systems which won't pass pdata
to the driver.

Tested-by: Paul Zimmerman <paulz@synopsys.com>
Reported-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:23:09 -07:00
Sean O. Stalley e57e780b34 usb: rh_call_control tbuf overflow fix
rh_call_control() contains a buffer, tbuf, which it uses to hold
USB descriptors. These discriptors are eventually copied into the
transfer_buffer in the URB. The buffer in the URB is dynamically
defined and is always large enough to hold the amount of data it
requests.

tbuf is currently statically allocated on the stack with a size
of 15 bytes, regardless of the size specified in the URB.
This patch dynamically allocates tbuf, and ensures that tbuf is
at least as big as the buffer in the URB.

If an hcd attempts to write a descriptor containing more than
15 bytes ( such as the Standard BOS Descriptor for hubs, defined
in the USB3.0 Spec, section 10.13.1 ) the write would overflow
the buffer and corrupt the stack. This patch addresses this
behavior.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sean O. Stalley <sean.stalley@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:18:26 -07:00
Jack Pham 726a85caa3 usb: host: add Kconfig option for EHSET
commit 9841f37a1c ("usb: ehci: Add support for SINGLE_STEP_SET_FEATURE
test of EHSET") added additional code to the EHCI hub driver but it is
anticipated to only have a limited audience (e.g. embedded silicon
vendors and integrators). Avoid subjecting all EHCI (and in the future
maybe xHCI/OHCI, etc.) HCD users to code bloat by conditionally
compiling the EHSET-specific additions with a new Kconfig option,
CONFIG_USB_HCD_TEST_MODE.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:18:26 -07:00
Frank Schäfer 034d1527ad pl2303: improve the chip type detection/distinction
The driver currently knows about 3 different PL2303 chip types:
The two legacy chip types type_0 and type_1 (PL2303H ?) and the HX
type.
The device distinction is currently completely based on the examination
of the USB descriptors.
During the last years, Prolific has introduced further PL2303 chips,
such as the HXD (HX rev. D), TA (which replaced the X/HX chips), SA,
RA, EA and TB variants.
Unfortunately, all these new chips are currently detected as HX chips,
because they are all using the same bMaxPacketSize0 = 0x40 value in the
USB device descriptor.

At this point it is not clear if these chips are really working with
the driver, there are just some positive indicators (like device
manufacturers claiming Linux support for these devices or commit
8d48fdf689 "correctly handle baudrates above 115200" which should only
be necessary for newer devices, ...)

For a complete support of all devices, we need to distinguish between
them, because they differ in several functional aspects, such  as the
maximum supported baud rate (HXD, TB, EA: 12Mbps, HX, TA: 6Mbps,
RA: 1Mbps, SA: 115.2kbps), handshaking line support, RS422/485 and
GPIO ports support (currently not supported by the driver).
And there might be further differences that we don't know yet.

This patch improves the chip type detection by evaluating the bcdDevice
value of the device descriptor. The values are taken from the
datasheets and are safe to use because manufacturers can't change them:

3.00: X/HX, TA
4.00: HXD, EA, RA, SA
5.00: TB

The rest of the device descriptors is completely identical, so no
further distinction is possible this way.
Anyway, Prolifics "checkChipVersion.exe"-tool is definitely able to
distinguish for example between the X/HX and the TA chips, so there
must be a possibility to improve the distinction further...

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14 12:12:43 -07:00