Commit graph

3001 commits

Author SHA1 Message Date
Sarah Sharp 1386ff7579 Revert "xhci: Set scatter-gather limit to avoid failed block writes."
This reverts commit f2d9b991c5.

We are ripping out commit 35773dac5f "usb:
xhci: Link TRB must not occur within a USB payload burst" because it's a
hack that caused regressions in the usb-storage and userspace USB
drivers that use usbfs and libusb.  This commit attempted to fix the
issues with that patch.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org #3.12
2014-02-07 14:30:02 -08:00
Sarah Sharp 247bf55727 xhci 1.0: Limit arbitrarily-aligned scatter gather.
xHCI 1.0 hosts have a set of requirements on how to align transfer
buffers on the endpoint rings called "TD fragment" rules.  When the
ax88179_178a driver added support for scatter gather in 3.12, with
commit 804fad45411b48233b48003e33a78f290d227c8 "USBNET: ax88179_178a:
enable tso if usb host supports sg dma", it broke the device under xHCI
1.0 hosts.  Under certain network loads, the device would see an
unexpected short packet from the host, which would cause the device to
stop sending ethernet packets, even through USB packets would still be
sent.

Commit 35773dac5f "usb: xhci: Link TRB must not occur within a USB
payload burst" attempted to fix this.  It was a quick hack to partially
implement the TD fragment rules.  However, it caused regressions in the
usb-storage layer and userspace USB drivers using libusb.  The patches
to attempt to fix this are too far reaching into the USB core, and we
really need to implement the TD fragment rules correctly in the xHCI
driver, instead of continuing to wallpaper over the issues.

Disable arbitrarily-aligned scatter-gather in the xHCI driver for 1.0
hosts.  Only the ax88179_178a driver checks the no_sg_constraint flag,
so don't set it for 1.0 hosts.  This should not impact usb-storage or
usbfs behavior, since they pass down max packet sized aligned sg-list
entries (512 for USB 2.0 and 1024 for USB 3.0).

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: Mark Lord <mlord@pobox.com>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Bjørn Mork <bjorn@mork.no>
Cc: Freddy Xin <freddy@asix.com.tw>
Cc: Ming Lei <ming.lei@canonical.com>
Cc: stable@vger.kernel.org # 3.12
2014-02-07 14:30:02 -08:00
Hans de Goede ad3db5daba ehci-platform: Add support for controllers with big-endian regs / descriptors
This uses the already documented devicetree booleans for this, see:
Documentation/devicetree/bindings/usb/usb-ehci.txt

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-07 14:24:24 -08:00
Hans de Goede b103441257 ohci-platform: Add support for controllers with big-endian regs / descriptors
Note this commit uses the same devicetree booleans for this as the ones
already existing in the usb-ehci bindings, see:
Documentation/devicetree/bindings/usb/usb-ehci.txt

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-07 14:24:24 -08:00
Hans de Goede a4aeb21175 ehci-platform: Add support for clks and phy passed through devicetree
Currently ehci-platform is only used in combination with devicetree when used
with some Via socs. By extending it to (optionally) get clks and a phy from
devicetree, and enabling / disabling those on power_on / off, it can be used
more generically. Specifically after this commit it can be used for the
ehci controller on Allwinner sunxi SoCs.

Since ehci-platform is intended to handle any generic enough non pci ehci
device, add a "usb-ehci" compatibility string.

There already is a usb-ehci device-tree bindings document, update this
with clks and phy bindings info.

Although actually quite generic so far the via,vt8500 compatibilty string
had its own bindings document. Somehow we even ended up with 2 of them. Since
these provide no extra information over the generic usb-ehci documentation,
this patch removes them.

The ehci-ppc-of.c driver also claims the usb-ehci compatibility string,
even though it mostly is ibm,usb-ehci-440epx specific. ehci-platform.c is
not needed on ppc platforms, so add a !PPC_OF dependency to it to avoid
2 drivers claiming the same compatibility string getting build on ppc.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-07 14:24:24 -08:00
Hans de Goede ca52a17ba9 ohci-platform: Add support for devicetree instantiation
Add support for ohci-platform instantiation from devicetree, including
optionally getting clks and a phy from devicetree, and enabling / disabling
those on power_on / off.

This should allow using ohci-platform from devicetree in various cases.
Specifically after this commit it can be used for the ohci controller found
on Allwinner sunxi SoCs.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-07 14:24:24 -08:00
Greg Kroah-Hartman 5c2740280f xhci: Fix some regressions introduced in 3.14.
Hi Greg,
 
 Here's four patches for 3.14.
 
 One of them adds an xHCI host quirk, and the other three of them fix
 regressions introduced in 3.14.  One regression causes USB 3.0 Link PM to
 be enabled on all xHCI hosts (even those that may not support it), which
 causes some USB 3.0 devices to not enumerate.  A second regression causes
 some xHCI hosts that don't support 64-bit addressing to stop responding to
 commands and die.
 
 Note, these patches don't fix the recent usbfs regression that was caused
 by commit 35773dac5f "usb: xhci: Link TRB
 must not occur within a USB payload burst".  I'm waiting for those patches
 to be tested.
 
 Please pull usb-linus into usb-next, as I have feature patches that rely on
 140e3026a5 Revert "usbcore: set lpm_capable field for LPM capable root
 hubs"
 
 Sarah Sharp
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJS8UyYAAoJEBMGWMLi1Gc5G9AP/jTLQoh/9ILE3fPN9UeXHr7x
 TR3sWrB2JB6HzO53FJqoIWdnyei+GQRHRYKFZbJRMIXSdfI7EiJ9ZaFvGKYkOjyg
 FblD2WqYn5jY2yiW8roxOebDzDadxxqafwtrqIGx88sV9o9yKInhBq5NqxD1ZC/X
 QM9Dbgxed4TX6OVVE8hvUbzr1gldYiUr8rKfvN8X6RDBEi6wh6HV0B/7T96vw6Hp
 hFDIgIdwgVYsnah2QjS007tpNFfWQtoi3sq+Jcq0S6QVpCrTPjPB6MqHJM/MQtG+
 8JkmZRPA8jjwaPvow8Kx3bmt89H5Q/hWKlUPZmaShOO4OKN3xOQNh+FNbvqs1pPZ
 XpL3/dv/w/zzQ7sqD2IaT9HiDfzeYfspdiv9QsSJg7XlfiulgdCggrhIGvta6p51
 bR0JEHMxSuI/Aqe/fr5Prf4YyeWS+fDKIwRsaNXG143pd7hFJxoyT91QE3FCxAdD
 qmw/YdeDT7J+3TB55OCPIxuaOTEjJQ9GyKXP/TKaSrTVWcH8/N0wNMa7IPSplysN
 fgeNNDtZ0A7P4XyyMNxaQpbRcM39eV/yGaVR6yDqjJ4RlEZTTTOMfNSaVoCXIb74
 3km6DVSqEQ0xPq08nrIcWbPqor+hShbw/bbUJCQBITKJp6oDeImacCvZw7RaYhfs
 cx7UuQPKmv7iYaG1Vmcm
 =sPwW
 -----END PGP SIGNATURE-----

Merge tag 'for-usb-linus-2014-02-04' of git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-linus

Sarah writes:

xhci: Fix some regressions introduced in 3.14.

Hi Greg,

Here's four patches for 3.14.

One of them adds an xHCI host quirk, and the other three of them fix
regressions introduced in 3.14.  One regression causes USB 3.0 Link PM to
be enabled on all xHCI hosts (even those that may not support it), which
causes some USB 3.0 devices to not enumerate.  A second regression causes
some xHCI hosts that don't support 64-bit addressing to stop responding to
commands and die.

Note, these patches don't fix the recent usbfs regression that was caused
by commit 35773dac5f "usb: xhci: Link TRB
must not occur within a USB payload burst".  I'm waiting for those patches
to be tested.

Please pull usb-linus into usb-next, as I have feature patches that rely on
140e3026a5 Revert "usbcore: set lpm_capable field for LPM capable root
hubs"

Sarah Sharp
2014-02-04 12:46:33 -08:00
Sarah Sharp f7b2e4032d Revert "xhci: replace xhci_read_64() with readq()"
This reverts commit e8b373326d.  Many xHCI
host controllers can only handle 32-bit addresses, and writing 64-bits
at a time causes them to fail.  Reading 64-bits at a time may also cause
them to return 0xffffffff, so revert this commit as well.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2014-01-30 13:27:49 -08:00
Sarah Sharp 477632dff5 Revert "xhci: replace xhci_write_64() with writeq()"
This reverts commit 7dd09a1af2.

Many xHCI host controllers can only handle 32-bit addresses, and writing
64-bits at a time causes them to fail.  Rafał reports that USB devices
simply do not enumerate, and reverting this patch helps.  Branimir
reports that his host controller doesn't respond to an Enable Slot
command and dies:

[   75.576160] xhci_hcd 0000:03:00.0: Timeout while waiting for a slot
[   88.991634] xhci_hcd 0000:03:00.0: Stopped the command ring failed, maybe the host is dead
[   88.991748] xhci_hcd 0000:03:00.0: Abort command ring failed
[   88.991845] xhci_hcd 0000:03:00.0: HC died; cleaning up
[   93.985489] xhci_hcd 0000:03:00.0: Timeout while waiting for a slot
[   93.985494] xhci_hcd 0000:03:00.0: Abort the command ring, but the xHCI is dead.
[   98.982586] xhci_hcd 0000:03:00.0: Timeout while waiting for a slot
[   98.982591] xhci_hcd 0000:03:00.0: Abort the command ring, but the xHCI is dead.
[  103.979696] xhci_hcd 0000:03:00.0: Timeout while waiting for a slot
[  103.979702] xhci_hcd 0000:03:00.0: Abort the command ring, but the xHCI is dead

Signed-off-by: Sarah Sharp <sarah.a.sharp@intel.com>
Reported-by: Rafał Miłecki <zajec5@gmail.com>
Reported-by: Branimir Maksimovic <branimir.maksimovic@gmail.com>
Cc: Xenia Ragiadakou <burzalodowa@gmail.com>
2014-01-29 17:20:41 -08:00
Benjamin Herrenschmidt e9a371100d Merge remote-tracking branch 'agust/next' into next
<<
Switch mpc512x to the common clock framework and adapt mpc512x
drivers to use the new clock driver. Old PPC_CLOCK code is
removed entirely since there are no users any more.
>>
2014-01-29 16:53:55 +11:00
Linus Torvalds 0ba3307a8e ARM: driver updates for 3.14
Updates of SoC-near drivers and other driver updates that makes more sense to
 take through our tree.
 
 The largest part of this is a conversion of device registration for some
 renesas shmobile/sh devices over to use resources. This has required
 coordination with the corresponding arch/sh changes, and we've agreed
 to merge the arch/sh changes through our tree.
 
 Added in this branch is support for Trusted Foundations secure firmware,
 which is what is used on many of the commercial Nvidia Tegra products
 that are in the market, including the Nvidia Shield. The code is local
 to arch/arm at this time since it's uncertain whether it will be shared
 with arm64 longer-term, if needed we will refactor later.
 
 A couple of new RTC drivers used on ARM boards, merged through our tree
 on request by the RTC maintainer.
 
 ... plus a bunch of smaller updates across the board, gpio conversions
 for davinci, etc.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJS4ViqAAoJEIwa5zzehBx3m4QP/07VXVE77RFRyly5Bky5AaMY
 zo7ZpoJyg/IT9lxtSAQDhbQq49tKZQVS16oJ7LWXzjAyCY9XrVDX2IkcuqudmYSy
 Xtx+R0jZGK4czqljgjwdHgNCSwugCmO/kgNY3h8ar53dTmGIFiq5boPeMDizRTGD
 g3sgYuQbIqepcHd2jUjJSBXNyvZIlwBJ4wDyZgxRfzyM7unS8T46BpYNJz0esAL+
 0DwIk0nv1eJ6LI0aEL+7bgFaitjUNLpcrroToi1IiIEJuTvZY4AuBjAKt5/181zL
 i1ugimsHahmbwNclAmUimc0rtW4Nn+YHGa8WpYiQ9O7+kPFsYkfLRplHPOjaUBPz
 r76ucgBMGH6i04tvstwlONznO4NhkACWmb4wrfJfRoDTglELLoOd6QGAYKyRublH
 SnrKKmuXzBvtmj2zgUU+S0ka9LdYrjzxoSYprrXQpDr89pUs/AZrlAm9yRjQ3hGw
 0eL9UsDFtYAQwCQtPvin2bjKRgNNDbgdwNYNbA7n8jvE/uZ4rlYr3Ot+oxdfs75e
 K4fY6JwtbZxQVcOU25M3WBYXLl0V61ZISFa16XhYC2hjzgMZ3bfmFUn+TW9C8V4V
 03QqtFyT3FP+VfA3QUS3PuBxALT0HWXmDqp0VJc6UCiXX2InWR+uZQp7a30EawOZ
 WHLqgf+nT3bD3kfagCZN
 =JJlw
 -----END PGP SIGNATURE-----

Merge tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM driver updates from Olof Johansson:
 "Updates of SoC-near drivers and other driver updates that makes more
  sense to take through our tree.

  The largest part of this is a conversion of device registration for
  some renesas shmobile/sh devices over to use resources.  This has
  required coordination with the corresponding arch/sh changes, and
  we've agreed to merge the arch/sh changes through our tree.

  Added in this branch is support for Trusted Foundations secure
  firmware, which is what is used on many of the commercial Nvidia Tegra
  products that are in the market, including the Nvidia Shield.  The
  code is local to arch/arm at this time since it's uncertain whether it
  will be shared with arm64 longer-term, if needed we will refactor
  later.

  A couple of new RTC drivers used on ARM boards, merged through our
  tree on request by the RTC maintainer.

  ... plus a bunch of smaller updates across the board, gpio conversions
  for davinci, etc"

* tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (45 commits)
  watchdog: davinci: rename platform driver to davinci-wdt
  tty: serial: Limit msm_serial_hs driver to platforms that use it
  mmc: msm_sdcc: Limit driver to platforms that use it
  usb: phy: msm: Move mach dependent code to platform data
  clk: versatile: fixup IM-PD1 clock implementation
  clk: versatile: pass a name to ICST clock provider
  ARM: integrator: pass parent IRQ to the SIC
  irqchip: versatile FPGA: support cascaded interrupts from DT
  gpio: davinci: don't create irq_domain in case of unbanked irqs
  gpio: davinci: use chained_irq_enter/chained_irq_exit API
  gpio: davinci: add OF support
  gpio: davinci: remove unused variable intc_irq_num
  gpio: davinci: convert to use irqdomain support.
  gpio: introduce GPIO_DAVINCI kconfig option
  gpio: davinci: get rid of DAVINCI_N_GPIO
  gpio: davinci: use {readl|writel}_relaxed() instead of __raw_*
  serial: sh-sci: Add OF support
  serial: sh-sci: Add device tree bindings documentation
  serial: sh-sci: Remove platform data mapbase and irqs fields
  serial: sh-sci: Remove platform data scbrr_algo_id field
  ...
2014-01-23 18:49:36 -08:00
Linus Torvalds f2c73464d7 ARM: SoC cleanups for 3.14
This is the branch where we usually queue up cleanup efforts, moving
 drivers out of the architecture directory, header file restructuring,
 etc. Sometimes they tangle with new development so it's hard to keep it
 strictly to cleanups.
 
 Some of the things included in this branch are:
 
 * Atmel SAMA5 conversion to common clock
 * Reset framework conversion for tegra platforms
  - Some of this depends on tegra clock driver reworks that are shared with Mike
    Turquette's clk tree.
 * Tegra DMA refactoring, which are shared branches with the DMA tree.
 * Removal of some header files on exynos to prepare for multiplatform
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJS4Vf7AAoJEIwa5zzehBx3f9UP/jwMlbfbSZHfNQ/QG0SqZ9RD
 zvddyDMHY/qXnzgF3Dax+JR9BDDVy8AlQe713FCoiHJZggWRAbbavkx8gxITDrZQ
 6NYaEkkuVxqyM8APl3PwMqYm8UZ8MUf4lCltlOA4jkesY9vue91AFnfyKh2CvHrn
 Leg4XT6mFzf/vYDL6RbvTz/Qr253uv3KvYBxkeiRNa0Y7OXRemEXSOfgxh0YGxUl
 LZ2IWQFOh/DH4kaeQI8V4G67X3ceHiFyhCnl0CPwfxaZaNBVaxvIFgIUTdetS6Sb
 zcXa029tE/Dfsr55vZAv9LUHEipCSOeE5rn2EJWehTWyM7vJ42Eozqgh+zfCjXS7
 Ib6g2npsvIluQit/RdITu44h5yZlrQsLgKTGJ8jjXqbT4HQ/746W8b/TP0YLtbw7
 N8oqr7k4vsZyF0dAYZQtfQUZeGISz67UbFcdzl9tmYOR7HFuAYkAQYst77zkVJf8
 om59BAYYTG5FNjQ4I9AKUfJzxXYveI6AKpXSCCZiahpFM2D1CJIzp9Wi0GwK1HRR
 sFVWhS0dajvz63pVVC2tw5Sq4J7onRRNGIXFPoE5fkmlelm0/q0zzGjw3Z0nTqbZ
 8zxuwuy2FfPJK11GbUAIhAgn1sCLYyAhl6IE+FsanGeMOSGIMrH0v5/HphAxoCXt
 BvqMDogyLoGPce1Gm3pJ
 =3CcT
 -----END PGP SIGNATURE-----

Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC cleanups from Olof Johansson:
 "This is the branch where we usually queue up cleanup efforts, moving
  drivers out of the architecture directory, header file restructuring,
  etc.  Sometimes they tangle with new development so it's hard to keep
  it strictly to cleanups.

  Some of the things included in this branch are:

   * Atmel SAMA5 conversion to common clock
   * Reset framework conversion for tegra platforms
    - Some of this depends on tegra clock driver reworks that are shared
      with Mike Turquette's clk tree.
   * Tegra DMA refactoring, which are shared branches with the DMA tree.
   * Removal of some header files on exynos to prepare for
     multiplatform"

* tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (169 commits)
  ARM: mvebu: move Armada 370/XP specific definitions to armada-370-xp.h
  ARM: mvebu: remove prototypes of non-existing functions from common.h
  ARM: mvebu: move ARMADA_XP_MAX_CPUS to armada-370-xp.h
  serial: sh-sci: Rework baud rate calculation
  serial: sh-sci: Compute overrun_bit without using baud rate algo
  serial: sh-sci: Remove unused GPIO request code
  serial: sh-sci: Move overrun_bit and error_mask fields out of pdata
  serial: sh-sci: Support resources passed through platform resources
  serial: sh-sci: Don't check IRQ in verify port operation
  serial: sh-sci: Set the UPF_FIXED_PORT flag
  serial: sh-sci: Remove duplicate interrupt check in verify port op
  serial: sh-sci: Simplify baud rate calculation algorithms
  serial: sh-sci: Remove baud rate calculation algorithm 5
  serial: sh-sci: Sort headers alphabetically
  ARM: EXYNOS: Kill exynos_pm_late_initcall()
  ARM: EXYNOS: Consolidate selection of PM_GENERIC_DOMAINS for Exynos4
  ARM: at91: switch Calao QIL-A9260 board to DT
  clk: at91: fix pmc_clk_ids data type attriubte
  PM / devfreq: use inclusion <mach/map.h> instead of <plat/map-s5p.h>
  ARM: EXYNOS: remove <mach/regs-clock.h> for exynos
  ...
2014-01-23 18:36:55 -08:00
Sarah Sharp 1aa9578c1a xhci: Fix resume issues on Renesas chips in Samsung laptops
Don Zickus <dzickus@redhat.com> writes:

Some co-workers of mine bought Samsung laptops that had mostly usb3 ports.
Those ports did not resume correctly (the driver would timeout communicating
and fail).  This led to frustration as suspend/resume is a common use for
laptops.

Poking around, I applied the reset on resume quirk to this chipset and the
resume started working.  Reloading the xhci_hcd module had been the temporary
workaround.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: Don Zickus <dzickus@redhat.com>
Tested-by: Prarit Bhargava <prarit@redhat.com>
Cc: stable # 2.6.37
2014-01-22 13:33:48 -08:00
Peter Chen feffe09f51 usb: ehci: add freescale imx28 special write register method
According to Freescale imx28 Errata, "ENGR119653 USB: ARM to USB
register error issue", All USB register write operations must
use the ARM SWP instruction. So, we implement a special ehci_write
for imx28.

Discussion for it at below:
http://marc.info/?l=linux-usb&m=137996395529294&w=2

Without this patcheset, imx28 works unstable at high AHB bus loading.
If the bus loading is not high, the imx28 usb can work well at the most
of time. There is a IC errata for this problem, usually, we consider
IC errata is a problem not a new feature, and this workaround is needed
for that, so we need to add them to stable tree 3.11+.

Cc: stable@vger.kernel.org
Cc: robert.hodaszi@digi.com
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-13 15:54:03 -08:00
Gerhard Sittig d77276c432 USB: fsl-mph-dr-of: adjust for OF based clock lookup
after device tree based clock lookup became available, the peripheral
driver need no longer construct clock names which include the component
index -- remove the "usb%d_clk" template, always use "ipg" instead

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Gerhard Sittig <gsi@denx.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2014-01-12 18:53:05 +01:00
Paul Gortmaker 803a536243 usb: delete non-required instances of include <linux/init.h>
None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-08 15:01:39 -08:00
Sarah Sharp f2d9b991c5 xhci: Set scatter-gather limit to avoid failed block writes.
Commit 35773dac5f "usb: xhci: Link TRB
must not occur within a USB payload burst" attempted to fix an issue
found with USB ethernet adapters, and inadvertently broke USB storage
devices.  The patch attempts to ensure that transfers never span a
segment, and rejects transfers that have more than 63 entries (or
possibly less, if some entries cross 64KB boundaries).

usb-storage limits the maximum transfer size to 120K, and we had assumed
the block layer would pass a scatter-gather list of 4K entries,
resulting in no more than 31 sglist entries:

http://marc.info/?l=linux-usb&m=138498190419312&w=2

That assumption was wrong, since we've seen the driver reject a write
that was 218 sectors long (of probably 512 bytes each):

Jan  1 07:04:49 jidanni5 kernel: [  559.624704] xhci_hcd 0000:00:14.0: Too many fragments 79, max 63
...
Jan  1 07:04:58 jidanni5 kernel: [  568.622583] Write(10): 2a 00 00 06 85 0e 00 00 da 00

Limit the number of scatter-gather entries to half a ring segment.  That
should be margin enough in case some entries cross 64KB boundaries.
Increase the number of TRBs per segment from 64 to 256, which should
result in ring segments fitting on a 4K page.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: jidanni@jidanni.org
References: http://bugs.debian.org/733907
Fixes: 35773dac5f ('usb: xhci: Link TRB must not occur within a USB payload burst')
Cc: stable <stable@vger.kernel.org> # 3.12
2014-01-08 11:00:52 -08:00
Ben Hutchings d6c9ea9069 xhci: Avoid infinite loop when sg urb requires too many trbs
Currently prepare_ring() returns -ENOMEM if the urb won't fit into a
single ring segment.  usb_sg_wait() treats this error as a temporary
condition and will keep retrying until something else goes wrong.

The number of retries should be limited in usb_sg_wait(), but also
prepare_ring() should not return an error code that suggests it might
be worth retrying.  Change it to -EINVAL.

Reported-by: jidanni@jidanni.org
References: http://bugs.debian.org/733907
Fixes: 35773dac5f ('usb: xhci: Link TRB must not occur within a USB payload burst')
Cc: stable <stable@vger.kernel.org> # 3.12
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2014-01-08 11:00:10 -08:00
Arnd Bergmann 1f53b48529 USB: fix: ohci-at91 mismerge build error
After commit 99f14bd4d1 "Merge 3.13-rc5 into usb-next" (in linux-next as of
today), I'm getting this error building any at91 kernel:

drivers/usb/host/ohci-at91.c: In function 'usb_hcd_at91_probe':
drivers/usb/host/ohci-at91.c:190:4: error: label 'err' used but not defined
    goto err;
    ^
drivers/usb/host/ohci-at91.c: At top level:
drivers/usb/host/ohci-at91.c:206:2: warning: data definition has no type or storage class [enabled by default]
  at91_stop_hc(pdev);
  ^
...

The problem is obviously a mismerge between two unrelated changes that
resulted in missing opening braces.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Boris BREZILLON <b.brezillon@overkiz.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-07 09:30:48 -08:00
Olof Johansson a7dedb4fea DaVinci GPIO driver updates
---------------------------
 
 This pull request contains updates
 to DaVinci GPIO driver and the
 resultant platform code changes. The
 updates include DT-conversion and
 changes to make the driver cross-platform
 ready.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.10 (GNU/Linux)
 
 iQIcBAABAgAGBQJSuycQAAoJEGFBu2jqvgRNIdMP/jE7LW16dF2dGq79Gy26GWcM
 dNSSXzwEm2q5vT49H8ADzkbnsI2PlFpcH0mwn5BpPuVRl+RKHfNEZxwuAthqKduu
 BIKVGBkNECrliIIUecCwBjAYpQknynvLAGHRhYmibEnZCH45kZ8g7DLJMeBL4Huz
 smDkz2yWWoHjnIaCk/kIbQfeETKSx5GP+OwnnrU/4HPpndxqZ6KU/MXb8ZeMiLfa
 piMl10o/YIJcfZcKBbkI1I2PuHNgNAzjVnMMsCVF+B5vgLiYmj9P+6l1Sfau6y8A
 kimW34q4HNuQ07hkDAIALz0AH7y8bL9SoKprT4NX10DvGHwl21a/Ji5QS8N49krM
 +HAiSIUdsFwie5M8286owGAJ/TBFReStWY1a/sIghx9idU6ejuM/Pj8/bfTS+Vu+
 8wyos8hTYVBDOEwoRzw48S5x93U5W6dsjOacOJ+blHBtPmADlWSNG8HwzSfWxHEI
 PMaVhu2EKtgD1ZFgU5Zlt+f5h3E4ezAIEpiPIhdLcg/3hqNSpFRmNV3nJsx+KwE+
 JyZXcHkyq42i6wL5Sdf6W/Dpd5knPyqP3BBWBTeg+BDLnH8F2+Vtws95I4dlit0T
 RtQ9Ms6QmznPTs9fMaviURiVIUBK6XIG5UHDU10bhL0h8vOR/hXAVrAB+wZntvPU
 uIXAapK/78LTBX92opDz
 =DxLt
 -----END PGP SIGNATURE-----

Merge tag 'davinci-for-v3.14/gpio' of git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci into next/drivers

From Sekhar Nori:
DaVinci GPIO driver updates
---------------------------

This pull request contains updates to DaVinci GPIO driver and the
resultant platform code changes. The updates include DT-conversion and
changes to make the driver cross-platform ready.

* tag 'davinci-for-v3.14/gpio' of git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci:
  gpio: davinci: don't create irq_domain in case of unbanked irqs
  gpio: davinci: use chained_irq_enter/chained_irq_exit API
  gpio: davinci: add OF support
  gpio: davinci: remove unused variable intc_irq_num
  gpio: davinci: convert to use irqdomain support.
  gpio: introduce GPIO_DAVINCI kconfig option
  gpio: davinci: get rid of DAVINCI_N_GPIO
  gpio: davinci: use {readl|writel}_relaxed() instead of __raw_*

Signed-off-by: Olof Johansson <olof@lixom.net>
2014-01-02 11:45:27 -08:00
Olof Johansson e7d248f0e0 ARM: tegra: implement common DMA and resets DT bindings
This series converts the Tegra DTs and drivers to use the common/
 standard DMA and reset bindings, rather than custom bindings. It also
 adds complete documentation for the Tegra clock bindings without
 actually changing any binding definitions.
 
 This conversion relies on a few sets of patches in branches from outside
 the Tegra tree:
 
 1) A patch to add an DMA channel request API which allows deferred probe
    to be implemented.
 
 2) A patch to implement a common part of the of_xlate function for DMA
    controllers.
 
 3) Some ASoC patches (which in turn rely on (1) above), which support
    deferred probe during DMA channel allocation.
 
 4) The Tegra clock driver changes for 3.14.
 
 Consequently, this branch is based on a merge of all of those external
 branches.
 
 In turn, this branch is or will be pulled into a few places that either
 rely on features introduced here, or would otherwise conflict with the
 patches:
 
 a) Tegra's own for-3.14/powergate and for-4.14/dt branches, to avoid
    conflicts.
 
 b) The DRM tree, which introduces new code that relies on the reset
    controller framework introduced in this branch, and to avoid
    conflicts.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSr3AnAAoJEMzrak5tbycxfMwQAMeffTFreJqDiQ4Vj0XmuhSn
 RFlXiZQsWtQ6gGgNfKyDsXzDMaz1KDAabcUYRcZwrluxuSCPBcK1JirCj5R8uRY7
 LDZFX92CO8zRgiij0mhgokV4zzuEQ56q1uhPxqI3o+wG3v44jlMSMgFHQJUevdET
 aKr2Pss8Hb00XDztnpxprs6FUoU/W99NRH0i/5znbBwuHqYFP37zlKe2MRwbqDwR
 AMgkrnGoawe85Stz4p/iR9pCLpAMa0dH94V4JrAP4+IQrl0DEKWbrolpQHii4gzh
 NCGazMELTqkaZaorC/n1SmczH1kTj4vcjbbmeB8dwS8Vqhr+uf7W1oLlJ46TUOsp
 ESO0uD2GfpHKQQwLxEfgjfmwsIUMbdWHef8f2HUuvl6Js+LCpaPkxd52Pt/qL4sU
 0sKqTbldRZXzGhvwa0/MK32WhmH4v31s7IZAg5A2YxqDR6yWryl7legWyvrI96C0
 OlmVe1C/2NGk0QCfK0G/xTa9V7YzMfj8k4ICSZOgUoF4BeGGj6d3svWvLbKbbrU1
 0fVvR7aCm78pRXixI6kURpj9D0mEfqus9Hx7VoWcL0TS4QH2dSYlGI+jDCiliQmj
 +kWrZWHsASSvPmUZk4RBNaviCbnGU8/t5nNdJSdFIUM/PIswzZ4GaAu6gdVksIY8
 hcx410PyAzTZL2lENamE
 =8T7+
 -----END PGP SIGNATURE-----

Merge tag 'tegra-for-3.14-dmas-resets-rework' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into next/cleanup

From Stephen Warren:
ARM: tegra: implement common DMA and resets DT bindings

This series converts the Tegra DTs and drivers to use the common/
standard DMA and reset bindings, rather than custom bindings. It also
adds complete documentation for the Tegra clock bindings without
actually changing any binding definitions.

This conversion relies on a few sets of patches in branches from outside
the Tegra tree:

1) A patch to add an DMA channel request API which allows deferred probe
   to be implemented.

2) A patch to implement a common part of the of_xlate function for DMA
   controllers.

3) Some ASoC patches (which in turn rely on (1) above), which support
   deferred probe during DMA channel allocation.

4) The Tegra clock driver changes for 3.14.

Consequently, this branch is based on a merge of all of those external
branches.

In turn, this branch is or will be pulled into a few places that either
rely on features introduced here, or would otherwise conflict with the
patches:

a) Tegra's own for-3.14/powergate and for-4.14/dt branches, to avoid
   conflicts.

b) The DRM tree, which introduces new code that relies on the reset
   controller framework introduced in this branch, and to avoid
   conflicts.

* tag 'tegra-for-3.14-dmas-resets-rework' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux: (30 commits)
  spi: tegra: checking for ERR_PTR instead of NULL
  ASoC: tegra: update module reset list for Tegra124
  clk: tegra: remove bogus PCIE_XCLK
  clk: tegra: remove legacy reset APIs
  ARM: tegra: remove legacy DMA entries from DT
  ARM: tegra: remove legacy clock entries from DT
  USB: EHCI: tegra: use reset framework
  Input: tegra-kbc - use reset framework
  serial: tegra: convert to standard DMA DT bindings
  serial: tegra: use reset framework
  spi: tegra: convert to standard DMA DT bindings
  spi: tegra: use reset framework
  staging: nvec: use reset framework
  i2c: tegra: use reset framework
  ASoC: tegra: convert to standard DMA DT bindings
  ASoC: tegra: allocate AHUB FIFO during probe() not startup()
  ASoC: tegra: call pm_runtime APIs around register accesses
  ASoC: tegra: use reset framework
  dma: tegra: register as an OF DMA controller
  dma: tegra: use reset framework
  ...

Signed-off-by: Olof Johansson <olof@lixom.net>
2013-12-26 10:33:05 -08:00
Greg Kroah-Hartman 99f14bd4d1 Merge 3.13-rc5 into usb-next
This resolves the merge issue with drivers/usb/host/ohci-at91.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-24 10:18:03 -08:00
Greg Kroah-Hartman e2a3a64855 xhci: Cleanups, non-urgent fixes for 3.14.
Happy Holidays, Greg!
 
 Here's four patches to be queued to usb-next for 3.14.
 
 One adds a module parameter to the xHCI driver to allow users to enable
 xHCI quirks without recompiling their kernel, which you've already said
 is fine.  The second patch is a bug fix for new usbtest code that's only
 in usb-next.  The third patch is simple cleanup.
 
 The last patch is a non-urgent bug fix for xHCI platform devices.  The
 bug has been in the code since 3.9.  You've been asking me to hold off
 on non-urgent bug fixes after -rc4/-rc5, so it can go into usb-next, and
 be backported to stable once 3.14 is out.
 
 These have all been tested over the past week.  I did run across one
 oops, but it turned out to be a bug in 3.12, and therefore not related
 to any of these patches.
 
 Please queue these for usb-next and 3.14.
 
 Thanks,
 Sarah Sharp
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJStMtLAAoJEBMGWMLi1Gc5uxMQAIXOL38n53yfNETU+DJMLaWB
 +DY/RJjJ0zAZuRL9emOvR+BYEsQpd2q6aT3F2MryjJT/dhEKwJgHLTLOv0EQEWS7
 dfLXX/NKNI+iRNyJkSATriytWMmMwv13kTXkreu99ZAw2PWWt7mM4BPHaWJ6sz5G
 MjWS3v6LE59zjZatdzZyg4wlgUeNmO8cc4CV8YSqv0rFiVrKBL8IJsxwgQkWXI+2
 J19hZcEpgeVMPo7aPlkMGoS1Ze9SxTviALBVLBWwwR028UfWCELFWsSFGVfJ6RgJ
 /3DsE+jhQBn/1Y1o6hrlU/arDj7N/iJ3Gz5Ru5l+BtJw56fdaI/ToaHzzIDarONE
 DGLiziDIknlSPsuX6X81kqXqROz1Zt624aqLipvqGCk0FMrLZz5BMaPEslkmW4Wb
 /TQRX6KnTVzK4uMjv5yNVaGtnyoTStJeRE7dIF4/9e2YDLo4SCmm2Y9necr4C3Ls
 7FzT8t6m9F74ZHAkmPpKFlEkYTYOy3yv/KBlhHF/OVFo9FAxAwUEY69QVrvhaHVX
 GhLANc4NOuJb1eIwQarVkub2+lLI3N9zwEWliepKKUTQ8OTFDkDFM/+bwDHd4RzD
 PO23wuFHVLj9N2BZbIAV2OkDyJLU2FOl+ZiEG6NUDXssihiZj4AVfIRiOU1c3EMc
 g27X+N4FI2fnpqvAYq/a
 =PRbx
 -----END PGP SIGNATURE-----

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

Sarah writes:

xhci: Cleanups, non-urgent fixes for 3.14.

Happy Holidays, Greg!

Here's four patches to be queued to usb-next for 3.14.

One adds a module parameter to the xHCI driver to allow users to enable
xHCI quirks without recompiling their kernel, which you've already said
is fine.  The second patch is a bug fix for new usbtest code that's only
in usb-next.  The third patch is simple cleanup.

The last patch is a non-urgent bug fix for xHCI platform devices.  The
bug has been in the code since 3.9.  You've been asking me to hold off
on non-urgent bug fixes after -rc4/-rc5, so it can go into usb-next, and
be backported to stable once 3.14 is out.

These have all been tested over the past week.  I did run across one
oops, but it turned out to be a bug in 3.12, and therefore not related
to any of these patches.

Please queue these for usb-next and 3.14.

Thanks,
Sarah Sharp
2013-12-21 15:58:40 -08:00
Jack Pham 9005355af2 usb: xhci: Check for XHCI_PLAT in xhci_cleanup_msix()
If CONFIG_PCI is enabled, make sure xhci_cleanup_msix()
doesn't try to free a bogus PCI IRQ or dereference an invalid
pci_dev when the xHCI device is actually a platform_device.

This patch should be backported to kernels as old as 3.9, that
contain the commit 52fb61250a
"xhci-plat: Don't enable legacy PCI interrupts."

Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-12-19 13:23:56 -08:00
Jingoo Han 81574fc65f USB: ohci-octeon: Use devm_ioremap_resource()
Use devm_ioremap_resource() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: David Daney <david.daney@cavium.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:36:11 -08:00
Jingoo Han 09796be19a USB: ohci-spear: Use devm_ioremap_resource()
Use devm_ioremap_resource() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:36:11 -08:00
Jingoo Han 3e2e714e7d USB: ohci-ppc-of: Use devm_ioremap_resource()
Use devm_ioremap_resource() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:36:10 -08:00
Jingoo Han ac8d81f36c USB: ohci-nxp: Use devm_clk_get()
Use devm_clk_get() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:36:10 -08:00
Jingoo Han 849da2dce5 USB: ehci-w90x900: Use devm_ioremap_resource()
Use devm_ioremap_resource() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:35:11 -08:00
Jingoo Han 644db16636 USB: ohci-da8xx: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:35:11 -08:00
Jingoo Han c81c3b0115 USB: ohci-jz4740: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:35:11 -08:00
Jingoo Han f1080e4d90 USB: ohci-pxa27x:Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:35:10 -08:00
Jingoo Han 49aa57bda7 USB: ehci-octeon: Use devm_ioremap_resource()
Use devm_ioremap_resource() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: David Daney <david.daney@cavium.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:34:20 -08:00
Jingoo Han 7667fe69e7 USB: ehci-fsl: Use devm_ioremap_resource()
Use devm_ioremap_resource() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:33:47 -08:00
Jingoo Han 806f6e6b92 USB: ehci-orion: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:33:47 -08:00
Jingoo Han 63c9b9d3fe USB: ohci-ppc-of: use dev_err() instead of printk()
Use dev_err() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:32:41 -08:00
Jingoo Han 0a3aa0d311 USB: ohci-omap: use dev_err() instead of printk()
Use dev_err() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:32:41 -08:00
Jingoo Han a74cf5ccbd USB: ehci-xilinx-of: use dev_err() instead of printk()
Use dev_err() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:32:41 -08:00
Jingoo Han 346c8b241c USB: ehci-ppc-of: use dev_err() instead of printk()
Use dev_err() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:32:41 -08:00
Jingoo Han fb53e9467e USB: ehci-orion: use dev_warn() instead of printk()
Use dev_warn() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:32:41 -08:00
Jingoo Han fc32f116cb USB: ehci-grlib: use dev_err() instead of printk()
Use dev_err() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:32:41 -08:00
Jingoo Han f4fbb6d564 USB: ehci-fsl: use dev_warn() instead of printk()
Use dev_warn() instead of printk() to provide a better message
to userspace.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:32:41 -08:00
Boris BREZILLON fc7a3252f6 usb: ohci-at91: use device managed clk retrieval
Replace clk_get calls by devm_clk_get calls.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:31:39 -08:00
Boris BREZILLON 5b218a07f2 usb: ohci-at91: use dev variable instead of &pdev->dev
Make use of the dev variable instead of referencing the dev field of the
pdev struct.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:31:35 -08:00
Boris BREZILLON cca2bbb308 usb: ohci-at91: replace request_mem_region + ioremap by devm_ioremap_resource
Replace the request_mem_region + ioremap calls by the
devm_ioremap_resource call which does the same things but with device
managed resources.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-18 16:30:36 -08:00
Lin Wang 599459d823 xhci: Remove unused variable 'addr' in inc_deq() and inc_enq().
This patch remove unused variable 'addr' in inc_deq() and inc_enq().

Signed-off-by: Lin Wang <lin.x.wang@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-17 13:40:45 -08:00
Boris BREZILLON fb5f1834c3 usb: ohci-at91: fix irq and iomem resource retrieval
When using dt resources retrieval (interrupts and reg properties) there is
no predefined order for these resources in the platform dev resources
table.

Retrieve resources using platform_get_resource and platform_get_irq
functions instead of direct resource table entries to avoid resource type
mismatch.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17 13:22:36 -08:00
Greg Kroah-Hartman d59abb9325 Merge branch 3.13-rc4 into usb-next 2013-12-16 08:46:03 -08:00
Takashi Iwai 4e6a1ee72b xhci: Add quirks module option
It makes easier for debugging some hardware specific issues.

Note that this option won't override the value to be set.  That is,
you can turn quirks on by this option but cannot turn them off if set
by the driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-13 12:04:52 -08:00
Stephen Warren 75606f5d32 USB: EHCI: tegra: use reset framework
Tegra's clock driver now provides an implementation of the common
reset API (include/linux/reset.h). Use this instead of the old Tegra-
specific API; that will soon be removed.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Thierry Reding <treding@nvidia.com>
2013-12-11 16:44:48 -07:00
Dan Williams 6f8ffc0b43 xhci: clarify logging in xhci_setup_device
Specify whether we are only performing the context setup portion of the
'address device' command, or the full operation issuing 'SetAddress'
on the wire.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-10 13:55:34 -08:00
Dan Williams 48fc7dbd52 usb: xhci: change enumeration scheme to 'new scheme' by default
Change the default enumeration scheme for xhci attached non-SuperSpeed
devices from:

   Reset
   SetAddress [xhci address-device BSR = 0]
   GetDescriptor(8)
   GetDescriptor(18)

...to:

   Reset
   [xhci address-device BSR = 1]
   GetDescriptor(64)
   Reset
   SetAddress [xhci address-device BSR = 0]
   GetDescriptor(18)

...as some devices misbehave when encountering a SetAddress command
prior to GetDescriptor.  There are known legacy devices that require
this scheme, but testing has found at least one USB3 device that fails
enumeration when presented with this ordering.  For now, follow the ehci
case and enable 'new scheme' by default for non-SuperSpeed devices.

To support this enumeration scheme on xhci the AddressDevice operation
needs to be performed twice.  The first instance of the command enables
the HC's device and slot context info for the device, but omits sending
the device a SetAddress command (BSR == block set address request).
Then, after GetDescriptor completes, follow up with the full
AddressDevice+SetAddress operation.

As mentioned before, this ordering of events with USB3 devices causes an
extra state transition to be exposed to xhci.  Previously USB3 devices
would transition directly from 'enabled' to 'addressed' and never need
to underrun responses to 'get descriptor'. We do see the 64-byte
descriptor fetch the correct data, but the following 18-byte descriptor
read after the reset gets:

bLength            = 0
bDescriptorType    = 0
bcdUSB             = 0
bDeviceClass       = 0
bDeviceSubClass    = 0
bDeviceProtocol    = 0
bMaxPacketSize0    = 9

instead of:

bLength            = 12
bDescriptorType    = 1
bcdUSB             = 300
bDeviceClass       = 0
bDeviceSubClass    = 0
bDeviceProtocol    = 0
bMaxPacketSize0    = 9

which results in the discovery process looping until falling back to
'old scheme' enumeration.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: David Moore <david.moore@gmail.com>
Suggested-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-10 13:54:37 -08:00
Takashi Iwai 6962d914f3 xhci: Limit the spurious wakeup fix only to HP machines
We've got regression reports that my previous fix for spurious wakeups
after S5 on HP Haswell machines leads to the automatic reboot at
shutdown on some machines.  It turned out that the fix for one side
triggers another BIOS bug in other side.  So, it's exclusive.

Since the original S5 wakeups have been confirmed only on HP machines,
it'd be safer to apply it only to limited machines.  As a wild guess,
limiting to machines with HP PCI SSID should suffice.

This patch should be backported to kernels as old as 3.12, that
contain the commit 638298dc66 "xhci: Fix
spurious wakeups after S5 on Haswell".

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=66171
Cc: stable@vger.kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: <dashing.meng@gmail.com>
Reported-by: Niklas Schnelle <niklas@komani.de>
Reported-by: Giorgos <ganastasiouGR@gmail.com>
Reported-by: <art1@vhex.net>
2013-12-10 11:44:39 -08:00
Thomas Pugliese 7b3e3740f2 usb: wusbcore: use USB_CTRL_SET_TIMEOUT and USB_CTRL_GET_TIMEOUT
Use USB_CTRL_SET_TIMEOUT and USB_CTRL_GET_TIMEOUT for USB control
messages instead of an arbitrary 1s timeout value.  This is particularly
useful for WUSB since in the worst case RF scanario, a WUSB device can
be unresponsive for up to 4s and still be connected.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-09 13:28:48 -08:00
Peter Chen 3c9740a117 usb: hcd: move controller wakeup setting initialization to individual driver
Individual controller driver has different requirement for wakeup
setting, so move it from core to itself. In order to align with
current etting the default wakeup setting is enabled (except for
chipidea host).

Pass compile test with below commands:
	make O=outout/all allmodconfig
	make -j$CPU_NUM O=outout/all drivers/usb

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 18:06:46 -08:00
Yijing Wang e10e6f433f usb: Use dev_is_pci() to check whether it is pci device
Use PCI standard marco dev_is_pci() instead of directly compare
pci_bus_type to check whether it is pci device.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 18:01:56 -08:00
Thomas Pugliese b374487ebe usb: wusbcore: add calls to usb_hcd_link_urb_to_ep, usb_hcd_unlink_urb_from_ep, and
Add calls to usb_hcd_link_urb_to_ep, usb_hcd_unlink_urb_from_ep, and
usb_hcd_check_unlink_urb in the appropriate locations.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 17:54:15 -08:00
Majunath Goudar d2e3d2b348 USB: OHCI: Properly handle ohci-spear suspend
Suspend scenario in case of ohci-spear glue was not
properly handled as it was not suspending generic part
of ohci controller.  Alan Stern suggested, properly handle
ohci-spear suspend scenario.

Calling explicitly the ohci_suspend() routine in
spear_ohci_hcd_drv_suspend() will ensure proper
handling of suspend scenario.

Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 17:53:18 -08:00
Majunath Goudar 14982e31da USB: OHCI: Properly handle ohci-exynos suspend
Suspend scenario in case of ohci-exynos glue was not
properly handled as it was not suspending generic part
of ohci controller. Alan Stern suggested, properly handle
ohci-exynos suspend scenario.

Calling explicitly the ohci_suspend() routine in
exynos_ohci_suspend() will ensure proper handling of suspend
scenario.

Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 17:53:18 -08:00
Majunath Goudar 933bb1f044 USB: OHCI: Properly handle ohci-da8xx suspend
Suspend scenario in case of ohci-da8xx glue was not
properly handled as it was not suspending generic part
of ohci controller. Alan Stern suggested, properly handle
ohci-da8xx suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_da8xx_suspend() will ensure proper
handling of suspend scenario.

Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-usb@vger.kernel.or
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 17:53:17 -08:00
Majunath Goudar 0ded36d918 USB: OHCI: Properly handle ohci-s3c2410 suspend
Suspend scenario in case of ohci-s3c2410 glue was not
properly handled as it was not suspending generic part
of ohci controller. Alan Stern suggested, properly handle
ohci-s3c2410 suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_hcd_s3c2410_drv_suspend() will ensure
proper handling of suspend scenario.

Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 17:53:17 -08:00
Majunath Goudar a9d3840ed3 USB: OHCI: Properly handle ohci-at91 suspend
Suspend scenario in case of ohci-at91 glue was not properly handled
as it was not suspending generic part of ohci controller. Alan Stern
suggested, properly handle ohci-at91 suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_at91_drv_suspend()
will ensure proper handling of suspend scenario. This task is sugested
by Alan Stern.

Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 17:53:17 -08:00
Majunath Goudar e1bffbf622 USB: OHCI: Properly handle OHCI controller suspend
Suspend scenario in case of OHCI was not properly
handled in ochi_suspend()routine. Alan Stern
suggested, properly handle OHCI suspend scenario.

This does generic proper handling of suspend
scenario to all OHCI SOC.

Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by:  Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 17:53:17 -08:00
Fengguang Wu 2e30d14f12 USB: fix coccinelle warnings
drivers/usb/host/ehci-mv.c:181:26-27: WARNING comparing pointer to 0, suggest !E
/c/kernel-tests/src/cocci/drivers/usb/host/ehci-mv.c:181:26-27: WARNING comparing pointer to 0

 Compare pointer-typed values to NULL rather than 0

Semantic patch information:
 This makes an effort to choose between !x and x == NULL.  !x is used
 if it has previously been used with the function used to initialize x.
 This relies on type information.  More type information can be obtained
 using the option -all_includes and the option -I to specify an
 include path.

Generated by: coccinelle/null/badzero.cocci

CC: Jingoo Han <jg1.han@samsung.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
2013-12-04 20:36:31 -08:00
Jingoo Han 2fd3f65132 USB: remove DEFINE_PCI_DEVICE_TABLE macro
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
is not preferred.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-04 16:58:47 -08:00
Daniel Mack 9876388edf usb: ohci-pxa27x: include linux/dma-mapping.h
Include linux/dma-mapping.h to make the new functions available that are
used since 22d9d8e83 ("DMA-API: usb: use dma_set_coherent_mask()").

drivers/usb/host/ohci-pxa27x.c: In function ‘ohci_pxa_of_init’:
drivers/usb/host/ohci-pxa27x.c:310:2: error: implicit declaration of function ‘dma_coerce_mask_and_coherent’ [-Werror=implicit-function-declaration]
drivers/usb/host/ohci-pxa27x.c:310:2: error: implicit declaration of function ‘DMA_BIT_MASK’ [-Werror=implicit-function-declaration]

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-04 16:57:46 -08:00
Geert Uytterhoeven a458677db6 usb: host: Remove superfluous name casts
device_driver.name is "const char *"

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 11:17:28 -08:00
Oliver Neukum c793d08ecd USB: kill #undef VERBOSE_DEBUG
It is useless now. Straight removal.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:34:33 -08:00
Oliver Neukum 1c20163d30 usb: kill DEBUG compile option
In the drivers that no longer need it, it is removed.
It is removed from the Makefile. Drivers not fully converted
to dynamic debug have it shifted down into the individual
drivers.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:34:33 -08:00
Oliver Neukum 0b5fa3b21f fusbh200: kill fusbh200_vdbg
With dynamic debugging this log level is no longer supported.
The decision which messages are interesting is done in user space.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:31:21 -08:00
Oliver Neukum c9472a2912 fusb200h: always compile in debugfs support
This allows removal of much conditional compilation.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:31:21 -08:00
Oliver Neukum 514fbbf663 fusbh200: always compile debugfs support
This is a step in the conversion to only use dynamic
debugging.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:31:21 -08:00
Oliver Neukum cb0badad02 fusb200h: don't log on every interrupt
That logging is overkill. Simply remove it.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:31:21 -08:00
Oliver Neukum 8f3fd9df26 fusbh200: unconditionally compile debugging helpers
These helpers are used only during setup of a HCD.
A small overhead is no problem.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:31:20 -08:00
Oliver Neukum 9bab24afba uhci: compile debugfs conditional on CONFIG_DYNAMIC_DEBUG || DEBUG
This makes sure the header files are all there

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:31:20 -08:00
Oliver Neukum cadb375698 uhci: change dependency for debug parameter
To allow a full switch to dynamic debugging make the
debug parameter conditional on defined(DEBUF) || defined(CONFIG_DYNAMIC_DEBUG)

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:31:20 -08:00
Oliver Neukum 0ada24a497 fusbh200: always build debugfs support
This gets rid of conditional compilation.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:28:40 -08:00
Oliver Neukum be5ac4c43d fotg210: kill fotg210_vdbg()
The decision what is interesting is shifted to user space by
dynamic debugging.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:28:40 -08:00
Oliver Neukum 3b707ece5b fotg210: remove conditional compilation
The decision what is interesting is made in user space.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:28:39 -08:00
Oliver Neukum f848a88d22 fotg210: change dbg_port() to evaluate parameters only if needed
For dynamic debug the overhead for evaluating parameters must
be sacrificed only if the message is actually printed

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:28:39 -08:00
Oliver Neukum 063635ec3a fotg210: always compile the support for debugfs
Simply remove the conditional compilation and remove
the empty stubs.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:28:39 -08:00
Oliver Neukum a90b8fc6f4 fotg210: remove conditional compilation
Always compile in the debugfs support

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:28:39 -08:00
Oliver Neukum 991fb3daac ehci: Remove debugging at every interrupt
This is overkill. Just removeit.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:25:22 -08:00
Oliver Neukum bbcd5cab03 ehci: no conditional compilation for interestingness
Simple elemination of the conditional compilation

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:25:22 -08:00
Oliver Neukum 00b033bb90 ohci: no conditional debugging in root hub hadling
With dynamic debugging the selection is done in user space

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:25:22 -08:00
Oliver Neukum 1714ba0e8e ohci:always register debug files
Just remove the conditional compilation.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:25:22 -08:00
Oliver Neukum d2c4254ff9 ohci: kill ohci_vdbg
With the introduction of dynamic debugging it has become redundant.
Collapse it with ohci_dbg()

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:25:22 -08:00
Oliver Neukum 5c2a18014f ohci: remove conditional compilation
Conditional compilation for debugging is removed in favor of
dynamic debugging. To do so

1. the support for debugfs is always compiled
2. the support for the ancient print_urb debugging aid is removed

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 10:25:22 -08:00
Xenia Ragiadakou 7dd09a1af2 xhci: replace xhci_write_64() with writeq()
Function xhci_write_64() is used to write 64bit xHC registers residing in MMIO.
On 32bit systems, xHC registers need to be written with 32bit accesses by
writing first the lower 32bits and then the higher 32bits. The header file
asm-generic/io-64-nonatomic-lo-hi.h ensures that on 32bit systems writeq() will
will write 64bit registers in 32bit chunks with low-high order.

Replace all calls to xhci_write_64() with calls to writeq().

This is done to reduce code duplication since 64bit low-high write logic
is already implemented and to take advantage of inherent "atomic" 64bit
write operations on 64bit systems.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:50 -08:00
Xenia Ragiadakou e8b373326d xhci: replace xhci_read_64() with readq()
Function xhci_read_64() is used to read 64bit xHC registers residing in MMIO.
On 32bit systems, xHC registers need to be read with 32bit accesses by
reading first the lower 32bits and then the higher 32bits.

Replace all calls to xhci_read_64() with calls to readq() and include
asm-generic/io-64-nonatomic-lo-hi.h header file, so that if the system
is not 64bit, readq() will read registers in 32bit chunks with low-high order.

This is done to reduce code duplication since 64bit low-high read logic
is already implemented and to take advantage of inherent "atomic" 64bit
read operations on 64bit systems.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:49 -08:00
Xenia Ragiadakou 204b7793f2 xhci: replace xhci_writel() with writel()
Function xhci_writel() is used to write a 32bit value in xHC registers residing
in MMIO address space. It takes as first argument a pointer to the xhci_hcd
although it does not use it. xhci_writel() internally simply calls writel().
This creates an illusion that xhci_writel() is an xhci specific function that
has to be called in a context where a pointer to xhci_hcd is available.

Remove xhci_writel() wrapper function and replace its calls with calls to
writel() to make the code more straight-forward.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:49 -08:00
Xenia Ragiadakou b0ba972084 xhci: replace xhci_readl() with readl()
Function xhci_readl() is used to read 32bit xHC registers residing in MMIO
address space. It takes as first argument a pointer to the xhci_hcd although
it does not use it. xhci_readl() internally simply calls readl(). This creates
an illusion that xhci_readl() is an xhci specific function that has to be
called in a context where a pointer to xhci_hcd is available.

Remove the unnecessary xhci_readl() wrapper function and replace its calls to
with calls to readl() to make the code more straightforward.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:48 -08:00
Xenia Ragiadakou 2a10004748 xhci: remove conversion from generic to pci device in xhci_mem.c
This patch removes the to_pci_dev() conversion performed to generic struct
device since it is not actually useful (the pointer to the generic device
can be used directly rather through a conversion to pci_dev) and it is pci
bus specific.

This isn't stable material because this code will produce harmless
behavior on non-PCI xHCI hosts.  The pci_device pointer is never
dereferenced, only used to re-calculate the underlying device pointer.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:48 -08:00
Xenia Ragiadakou 78d1ff0256 xhci: fix incorrect type in assignment in xhci_count_num_dropped_endpoints()
The fields 'add_flags' and 'drop_flags' in struct xhci_input_control_ctx
have type __le32 and need to be converted to CPU byteorder before being
used to derive the number of dropped endpoints.
This bug was found using sparse.

This patch is not suitable for stable, since the bug would only be
triggered on big endian systems, and the code only runs for Intel xHCI
host controllers, which are always integrated into little endian
systems.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:47 -08:00
Xenia Ragiadakou ef73400ca5 xhci: fix incorrect type in assignment in xhci_count_num_new_endpoints()
The fields 'add_flags' and 'drop_flags' in struct xhci_input_control_ctx
have type __le32 and need to be converted to CPU byteorder before being
used to derive the number of added endpoints.
This bug was found using sparse.

This patch is not suitable for stable, since the bug would only be
triggered on big endian systems, and the code only runs for Intel xHCI
host controllers, which are always integrated into little endian
systems.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:47 -08:00
Xenia Ragiadakou 0d3703be3a xhci: remove unnecessary check in xhci_free_stream_info()
This patch removes the unneccessary check 'if (stream_info)' because
there is already a check few lines above which ensures that stream_info
is not NULL.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:47 -08:00
Xenia Ragiadakou 63a67a72d6 xhci: fix SCT_FOR_CTX(p) macro
SCT_FOR_CTX(p) is defined as (((p) << 1) & 0x7) in which case if we want
to set the stream context type to SCT_SSA_256 i.e 0x7 (although secondary
stream arrays are not yet supported) using this macro definition we will
get actually 0x6 which is not what we want.

This patch fixes the above issue by defining the SCT_FOR_CTX(p) macro as
(((p) & 0x7) << 1)

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:46 -08:00
Xenia Ragiadakou 64ba419b7a xhci: replace USB_MAXINTERFACES with config->desc.bNumInterface
This patch replaces USB_MAXINTERFACES with config->desc.bNumInterface in
the termination condition for the loop that updates the LPM timeout of the
endpoints on the cofiguration's interfaces, in xhci_calculate_lpm_timeout(),
to avoid unnecessary loop cycles since most configurations come with 1-2
interfaces while USB_MAXINTERFACES is 32.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:46 -08:00
Xenia Ragiadakou 0c052aabe6 xhci: fix incorrect type in assignment in xhci_address_device()
The field 'dev_info' in struct xhci_slot_ctx has type __le32 and it needs
to be converted to CPU byteorder for the correct retrieval of its subfield
'Context Entries'. This field is used by the trace event 'xhci_address_ctx'
to trace only the contexts of valid endpoints.
This bug was found using sparse.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:45 -08:00
Xenia Ragiadakou d20c722567 xhci: fix sparse warning in xhci-trace.h
This patch fixes the following sparse warnings:
drivers/usb/host/./xhci-trace.h:116:1: warning: cast to restricted __le32
drivers/usb/host/./xhci-trace.h:116:1: warning: cast to restricted __le32
drivers/usb/host/./xhci-trace.h:116:1: warning: restricted __le32 degrades to
integer
drivers/usb/host/./xhci-trace.h:116:1: warning: restricted __le32 degrades to
integer

by converting the field 'trb' of the trace buffer entry structure from array
with elements of type __le32 to an array with elements of type u8.
Into the trb array are copied the contents of the TRB that generated the event.
The trace-cmd tool with the help of plugin_xhci.py will use this field to
parse the TRB contents in a human readable way.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:45 -08:00
Xenia Ragiadakou f004669638 xhci: fix derivation of TRB's DMA address in xhci_log_event Trace Event Class
This patch fixes the retrieval of the DMA address of the TRB that generated
the event by converting the field[0] (low address bits) and field[1] (high
address bits) to CPU byteorder and then typecasting field[1] to u64 so that
the bitshift will not lead to overflow.
In the original code, the typecasting of le32 to u64 was incorrect and the
subsequent conversion to le64 reverts the low and high address parts.
This bug was found using sparse.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:45 -08:00
Xenia Ragiadakou 7e76ad4315 xhci: fix incorrect type in assignment in handle_device_notification()
This patch converts Event TRB's 3rd field, which has type le32, to CPU
byteorder before using it to retrieve the Slot ID with TRB_TO_SLOT_ID macro.
This bug was found using sparse.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:44 -08:00
Xenia Ragiadakou 5871948738 xhci: convert TRB_CYCLE to le32 before using it to set Link TRB's cycle bit
This patch converts TRB_CYCLE to le32 to update correctly the Cycle Bit in
'control' field of the link TRB.
This bug was found using sparse.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-12-02 12:59:44 -08:00
David Laight 35773dac5f usb: xhci: Link TRB must not occur within a USB payload burst
Section 4.11.7.1 of rev 1.0 of the xhci specification states that a link TRB
can only occur at a boundary between underlying USB frames (512 bytes for
high speed devices).

If this isn't done the USB frames aren't formatted correctly and, for example,
the USB3 ethernet ax88179_178a card will stop sending (while still receiving)
when running a netperf tcp transmit test with (say) and 8k buffer.

This should be a candidate for stable, the ax88179_178a driver defaults to
gso and tso enabled so it passes a lot of fragmented skb to the USB stack.

Notes from Sarah:

Discussion: http://marc.info/?l=linux-usb&m=138384509604981&w=2

This patch fixes a long-standing xHCI driver bug that was revealed by a
change in 3.12 in the usb-net driver.  Commit
638c5115a7 "USBNET: support DMA SG" added
support to use bulk endpoint scatter-gather (urb->sg).  Only the USB
ethernet drivers trigger this bug, because the mass storage driver sends
sg list entries in page-sized chunks.

This patch only fixes the issue for bulk endpoint scatter-gather.  The
problem will still occur for periodic endpoints, because hosts will
interpret no-op transfers as a request to skip a service interval, which
is not what we want.

Luckily, the USB core isn't set up for scatter-gather on isochronous
endpoints, and no USB drivers use scatter-gather for interrupt
endpoints.  Document this known limitation so that developers won't try
to use urb->sg for interrupt endpoints until this issue is fixed.  The
more comprehensive fix would be to allow link TRBs in the middle of the
endpoint ring and revert this patch, but that fix would touch too much
code to be allowed in for stable.

This patch should be backported to kernels as old as 3.12, that contain
the commit 638c5115a7 "USBNET: support DMA
SG".  Without this patch, the USB network device gets wedged, and stops
sending packets.  Mark Lord confirms this patch fixes the regression:

http://marc.info/?l=linux-netdev&m=138487107625966&w=2

Signed-off-by: David Laight <david.laight@aculab.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: Mark Lord <mlord@pobox.com>
Cc: stable@vger.kernel.org
2013-12-02 11:57:10 -08:00
Laurent Pinchart 9b547a882e usb: r8a66597-hcd: Convert to clk_prepare/unprepare
Turn clk_enable() and clk_disable() calls into clk_prepare_enable() and
clk_disable_unprepare() to get ready for the migration to the common
clock framework.

Cc: linux-usb@vger.kernel.org
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2013-11-28 17:19:11 +09:00
Linus Torvalds 8ceafbfa91 Merge branch 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm
Pull DMA mask updates from Russell King:
 "This series cleans up the handling of DMA masks in a lot of drivers,
  fixing some bugs as we go.

  Some of the more serious errors include:
   - drivers which only set their coherent DMA mask if the attempt to
     set the streaming mask fails.
   - drivers which test for a NULL dma mask pointer, and then set the
     dma mask pointer to a location in their module .data section -
     which will cause problems if the module is reloaded.

  To counter these, I have introduced two helper functions:
   - dma_set_mask_and_coherent() takes care of setting both the
     streaming and coherent masks at the same time, with the correct
     error handling as specified by the API.
   - dma_coerce_mask_and_coherent() which resolves the problem of
     drivers forcefully setting DMA masks.  This is more a marker for
     future work to further clean these locations up - the code which
     creates the devices really should be initialising these, but to fix
     that in one go along with this change could potentially be very
     disruptive.

  The last thing this series does is prise away some of Linux's addition
  to "DMA addresses are physical addresses and RAM always starts at
  zero".  We have ARM LPAE systems where all system memory is above 4GB
  physical, hence having DMA masks interpreted by (eg) the block layers
  as describing physical addresses in the range 0..DMAMASK fails on
  these platforms.  Santosh Shilimkar addresses this in this series; the
  patches were copied to the appropriate people multiple times but were
  ignored.

  Fixing this also gets rid of some ARM weirdness in the setup of the
  max*pfn variables, and brings ARM into line with every other Linux
  architecture as far as those go"

* 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm: (52 commits)
  ARM: 7805/1: mm: change max*pfn to include the physical offset of memory
  ARM: 7797/1: mmc: Use dma_max_pfn(dev) helper for bounce_limit calculations
  ARM: 7796/1: scsi: Use dma_max_pfn(dev) helper for bounce_limit calculations
  ARM: 7795/1: mm: dma-mapping: Add dma_max_pfn(dev) helper function
  ARM: 7794/1: block: Rename parameter dma_mask to max_addr for blk_queue_bounce_limit()
  ARM: DMA-API: better handing of DMA masks for coherent allocations
  ARM: 7857/1: dma: imx-sdma: setup dma mask
  DMA-API: firmware/google/gsmi.c: avoid direct access to DMA masks
  DMA-API: dcdbas: update DMA mask handing
  DMA-API: dma: edma.c: no need to explicitly initialize DMA masks
  DMA-API: usb: musb: use platform_device_register_full() to avoid directly messing with dma masks
  DMA-API: crypto: remove last references to 'static struct device *dev'
  DMA-API: crypto: fix ixp4xx crypto platform device support
  DMA-API: others: use dma_set_coherent_mask()
  DMA-API: staging: use dma_set_coherent_mask()
  DMA-API: usb: use new dma_coerce_mask_and_coherent()
  DMA-API: usb: use dma_set_coherent_mask()
  DMA-API: parport: parport_pc.c: use dma_coerce_mask_and_coherent()
  DMA-API: net: octeon: use dma_coerce_mask_and_coherent()
  DMA-API: net: nxp/lpc_eth: use dma_coerce_mask_and_coherent()
  ...
2013-11-14 07:55:21 +09:00
Linus Torvalds 10d0c9705e DeviceTree updates for 3.13. This is a bit larger pull request than
usual for this cycle with lots of clean-up.
 
 - Cross arch clean-up and consolidation of early DT scanning code.
 - Clean-up and removal of arch prom.h headers. Makes arch specific
   prom.h optional on all but Sparc.
 - Addition of interrupts-extended property for devices connected to
   multiple interrupt controllers.
 - Refactoring of DT interrupt parsing code in preparation for deferred
   probe of interrupts.
 - ARM cpu and cpu topology bindings documentation.
 - Various DT vendor binding documentation updates.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQEcBAABAgAGBQJSgPQ4AAoJEMhvYp4jgsXif28H/1WkrXq5+lCFQZF8nbYdE2h0
 R8PsfiJJmAl6/wFgQTsRel+ScMk2hiP08uTyqf2RLnB1v87gCF7MKVaLOdONfUDi
 huXbcQGWCmZv0tbBIklxJe3+X3FIJch4gnyUvPudD1m8a0R0LxWXH/NhdTSFyB20
 PNjhN/IzoN40X1PSAhfB5ndWnoxXBoehV/IVHVDU42vkPVbVTyGAw5qJzHW8CLyN
 2oGTOalOO4ffQ7dIkBEQfj0mrgGcODToPdDvUQyyGZjYK2FY2sGrjyquir6SDcNa
 Q4gwatHTu0ygXpyphjtQf5tc3ZCejJ/F0s3olOAS1ahKGfe01fehtwPRROQnCK8=
 =GCbY
 -----END PGP SIGNATURE-----

Merge tag 'devicetree-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull devicetree updates from Rob Herring:
 "DeviceTree updates for 3.13.  This is a bit larger pull request than
  usual for this cycle with lots of clean-up.

   - Cross arch clean-up and consolidation of early DT scanning code.
   - Clean-up and removal of arch prom.h headers.  Makes arch specific
     prom.h optional on all but Sparc.
   - Addition of interrupts-extended property for devices connected to
     multiple interrupt controllers.
   - Refactoring of DT interrupt parsing code in preparation for
     deferred probe of interrupts.
   - ARM cpu and cpu topology bindings documentation.
   - Various DT vendor binding documentation updates"

* tag 'devicetree-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (82 commits)
  powerpc: add missing explicit OF includes for ppc
  dt/irq: add empty of_irq_count for !OF_IRQ
  dt: disable self-tests for !OF_IRQ
  of: irq: Fix interrupt-map entry matching
  MIPS: Netlogic: replace early_init_devtree() call
  of: Add Panasonic Corporation vendor prefix
  of: Add Chunghwa Picture Tubes Ltd. vendor prefix
  of: Add AU Optronics Corporation vendor prefix
  of/irq: Fix potential buffer overflow
  of/irq: Fix bug in interrupt parsing refactor.
  of: set dma_mask to point to coherent_dma_mask
  of: add vendor prefix for PHYTEC Messtechnik GmbH
  DT: sort vendor-prefixes.txt
  of: Add vendor prefix for Cadence
  of: Add empty for_each_available_child_of_node() macro definition
  arm/versatile: Fix versatile irq specifications.
  of/irq: create interrupts-extended property
  microblaze/pci: Drop PowerPC-ism from irq parsing
  of/irq: Create of_irq_parse_and_map_pci() to consolidate arch code.
  of/irq: Use irq_of_parse_and_map()
  ...
2013-11-12 16:52:17 +09:00
Linus Torvalds aac59e3efc ARM: SoC platform changes for 3.13
New and updated SoC support. Among the things new for this release are:
 
 - More support for the AM33xx platforms from TI
 - Tegra 124 support, and some updates to older tegra families as well
 - imx cleanups and updates across the board
 - A rename of Broadcom's Mobile platforms which were introduced as ARCH_BCM,
   and turned out to be too broad a name. New name is ARCH_BCM_MOBILE.
 - A whole bunch of updates and fixes for integrator, making the platform code
   more modern and switches over to DT-only booting.
 - Support for two new Renesas shmobile chipsets. Next up for them is more work
   on consolidation instead of introduction of new non-multiplatform SoCs, we're
   all looking forward to that!
 - Misc cleanups for older Samsung platforms, some Allwinner updates, etc.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSgBrRAAoJEIwa5zzehBx3v+QP/1Z4DOzOckU7sb/IZZMXxVcS
 C9G68x1n2lwqQwmMrjDAnFm+qKGDlb2SzHnUNiVy4niaGXdGSDtVzSEzK01LhUuz
 BchWRy5Vb+pq0/bVLxtkqUPf0LEH/1as0uQVJNxwmV+SS9OvH+NpJHo2X6motYtX
 W0l/NHwD/NYxwkjZTHUgZW9si1a8ZaG41i/h05IOpkww7RNcmtubWmQQIbKwmadc
 z2QO3NsrcUvMgnoF9fOEJU2aurIx1s+6jpG6/fD1WWejCMuf0JulyfV7egREFgty
 yp8QhnSTDaOvV0Gjrpx+4ERkwpVjvESpZIJoYHXjbScZHTCzkVDBLwwpmgYB1Mrb
 KOKTt6+p8RAMFm43Rkf42SW8RXMM8nifed/H5Lwimi8qQT4+PuWM4i524P0Bb0Bj
 tANHU2twUbY1VFRycGwWbTwPWtwxD4B0c6xflon84IGsZC31mvcfRcGaqaMtwTH4
 J6CN0Bk3Tp0BUOveo0pdTPtrgOWm85MxWrzbjppKY7Lgl4A19iXqvSQjIt1sjJGz
 5d8hH7KX26jKT24FiFp0fttOCRVVmg5Ks6sn2BTjX83w9S1pUg4yjZTU9cdbFbyN
 zvi0d7YQYWOJTlSQlY5m5xqvRzeByAae4EDA6LKdh6JQsPyQEhHdxvMj7/ZURf8W
 4jPMsgi+GxP8AGhpb20/
 =WYJl
 -----END PGP SIGNATURE-----

Merge tag 'soc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC platform changes from Olof Johansson:
 "New and updated SoC support.  Among the things new for this release
  are:

   - More support for the AM33xx platforms from TI
   - Tegra 124 support, and some updates to older tegra families as well
   - imx cleanups and updates across the board
   - A rename of Broadcom's Mobile platforms which were introduced as
     ARCH_BCM, and turned out to be too broad a name.  New name is
     ARCH_BCM_MOBILE.
   - A whole bunch of updates and fixes for integrator, making the
     platform code more modern and switches over to DT-only booting.
   - Support for two new Renesas shmobile chipsets.  Next up for them is
     more work on consolidation instead of introduction of new
     non-multiplatform SoCs, we're all looking forward to that!
   - Misc cleanups for older Samsung platforms, some Allwinner updates,
     etc"

* tag 'soc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (159 commits)
  ARM: bcm281xx: Add ARCH_BCM_MOBILE to bcm config
  ARM: bcm_defconfig: Run "make savedefconfig"
  ARM: bcm281xx: Add ARCH Timers to config
  rename ARCH_BCM to ARCH_BCM_MOBILE (mach-bcm)
  ARM: vexpress: Enable platform-specific options in defconfig
  ARM: vexpress: Make defconfig work again
  ARM: sunxi: remove .init_time hooks
  ARM: imx: enable suspend for imx6sl
  ARM: imx: ensure dsm_request signal is not asserted when setting LPM
  ARM: imx6q: call WB and RBC configuration from imx6q_pm_enter()
  ARM: imx6q: move low-power code out of clock driver
  ARM: imx: drop extern with function prototypes in common.h
  ARM: imx: reset core along with enable/disable operation
  ARM: imx: do not return from imx_cpu_die() call
  ARM: imx_v6_v7_defconfig: Select CONFIG_PROVE_LOCKING
  ARM: imx_v6_v7_defconfig: Enable LEDS_GPIO related options
  ARM: mxs_defconfig: Turn off CONFIG_DEBUG_GPIO
  ARM: imx: replace imx6q_restart() with mxc_restart()
  ARM: mach-imx: mm-imx5: Retrieve iomuxc base address from dt
  ARM: mach-imx: mm-imx5: Retrieve tzic base address from dt
  ...
2013-11-11 16:49:45 +09:00
Russell King e1fd734183 DMA-API: usb: use new dma_coerce_mask_and_coherent()
Acked-by: Felipe Balbi <balbi@ti.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2013-10-31 14:49:04 +00:00
Russell King 22d9d8e831 DMA-API: usb: use dma_set_coherent_mask()
The correct way for a driver to specify the coherent DMA mask is
not to directly access the field in the struct device, but to use
dma_set_coherent_mask().  Only arch and bus code should access this
member directly.

Convert all direct write accesses to using the correct API.

Acked-by: Felipe Balbi <balbi@ti.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2013-10-31 14:49:01 +00:00
Russell King 4ffb4318b0 DMA-API: usb: ohci-sa1111: add a note about DMA masks
Add a comment to explain why this driver doesn't call any of the DMA
API dma_set_mask() functions.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2013-10-31 14:48:44 +00:00
Russell King 01edb5e12c DMA-API: usb: ssb-hcd: replace dma_set_mask()+dma_set_coherent_mask() with new helper
Replace the following sequence:

	dma_set_mask(dev, mask);
	dma_set_coherent_mask(dev, mask);

with a call to the new helper dma_set_mask_and_coherent().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2013-10-31 14:48:36 +00:00
Russell King d288059e0a DMA-API: usb: bcma: replace dma_set_mask()+dma_set_coherent_mask() with new helper
Replace the following sequence:

	dma_set_mask(dev, mask);
	dma_set_coherent_mask(dev, mask);

with a call to the new helper dma_set_mask_and_coherent().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2013-10-31 14:48:34 +00:00
Boris BREZILLON 0d768fcfc0 USB: ehci-atmel: add usb_clk for transition to CCF
The AT91 PMC (Power Management Controller) provides a USB clock used by
the different USB controllers (ehci, ohci and udc).
The atmel-ehci driver must configure the usb clock rate to 48Mhz in order
to get a fully functionnal USB host controller.
This configuration was formely done in mach-at91/clock.c, but will be
bypassed when moving to common clk framework.

This patch adds support for usb clock retrieval and configuration only if
CCF is enabled (CONFIG_COMMON_CLK).

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-30 09:41:49 -07:00
Thomas Pugliese f07ddb9ef5 usb: wusbcore: add a quirk for Alereon HWA device isoc behavior
Add a quirk for Alereon HWA devices to concatenate the frames of isoc
transfer requests.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-29 16:44:49 -07:00
H Hartley Sweeten e55f7cd246 usb: ohci: remove ep93xx bus glue platform driver
Convert ep93xx to use the OHCI platform driver and remove the
ohci-ep93xx bus glue driver.

Enable CONFIG_OHCI_HCD_PLATFORM in the ep93xx_defconfig so that USB
is still enabled by default on the EP93xx platform.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Ryan Mallon <rmallon@gmail.com>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Olof Johansson <olof@lixom.net>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-29 16:43:37 -07:00
Alan Stern 1c124c9962 USB: UHCI: check for wakeup/suspend race
hcd-pci.c in usbcore contains a check for wakeup requests racing with
controller suspend.  This check is going to be moved out of usbcore
and into the individual controller drivers, where it can apply to all
platforms, not just PCI.

This patch adds the check to uhci-hcd.  Ironically, none of the
non-PCI platform drivers for uhci-hcd implement suspend/resume.
Nevertheless, this change is needed to accomodate the upcoming change
to usbcore.

The patch also removes an outdated check of the root hub state.  For
one thing, the PM layer has long been quite reliable about suspending
root hubs before controllers.  For another, virtually the same check
is also made in hcd-pci.c; there's no point in repeating it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19 14:12:14 -07:00
Alan Stern b8efdafb40 USB: EHCI: add check for wakeup/suspend race
hcd-pci.c in usbcore contains a check for wakeup requests racing with
controller suspend.  This check is going to be moved out of usbcore
and into the individual controller drivers, where it can apply to all
platforms, not just PCI.

This patch adds the check to ehci-hcd.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19 14:10:16 -07:00
Alan Stern 7c71c6e6be USB: OHCI: fix and explain sparse errors
This patch fixes an endian-related error in ohci-hcd (detected by
sparse) and clarifies a comment explaining a peculiar locking
arrangement that sparse warns about.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19 14:08:04 -07:00
Alan Stern 4a71f242e5 USB: EHCI: fix sparse errors
This patch fixes several sparse errors in ehci-hcd introduced by
commit 3d091a6f70 (USB: EHCI: AMD periodic frame list table quirk).
Although the problem fixed by that commit affects only little-endian
systems, the source code has to use types appropriate for big-endian
too.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19 14:08:04 -07:00
Alan Stern 5d8f681f3d USB: EHCI: fix type mismatch in check_intr_schedule
This patch fixes a type mismatch in ehci-hcd caused by commit
b35c5009bb (USB: EHCI: create per-TT bandwidth tables).  The c_maskp
parameter in check_intr_schedule() was changed to point to unsigned
int rather than __hc32, but the prototype declaration wasn't adjusted
accordingly.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19 14:06:00 -07:00
Greg Kroah-Hartman 9afcdb10ad xhci: Final patches for 3.13
Hi Greg,
 
 Here's my pull request for usb-next and 3.13.  My xHCI tree is closed
 after this point, since I won't be able to run my full tests while I'm in
 Scotland.  After Kernel Summit, I'll be on vacation with access to email
 from Oct 26th to Nov 6th.
 
 Here's what's in this request:
 
  - Patches to fix USB 2.0 Link PM issues that cause USB 3.0 devices to not
    enumerate or misbehave when plugged into a USB 2.0 port.  Those are
    marked for stable.
 
  - A msec vs jiffies bug fix by xiao jin, which results in fairly harmless
    behavior, and thus isn't marked for stable.
 
  - Xenia's patches to refactor the xHCI command handling code, which makes
    it much more readable and consistent.
 
  - Misc cleanup patches, one by Sachin Kamat and three from Dan Williams.
 
 Here's what's not in this request:
 
  - Dan's two patches to allow the xHCI host to use the "Windows" or "new"
    enumeration scheme.  I did not have time to test those, and I want to
    run them with as many USB devices as I can get a hold of.  That will
    have to wait for 3.14.
 
  - Xenia's patches to remove xhci_readl in favor of readl.  I'll queue
    those for 3.14 after I test them.
 
  - The xHCI streams update, UAS fixes, and usbfs streams support.  I'm not
    comfortable with changes and fixes to that patchset coming in this late.
    I would rather wait for 3.14 and be really sure the streams support is
    stable before we add new userspace API and remove CONFIG_BROKEN from the
    uas driver.
 
  - Julius' patch to clear the port reset bit on hub resume that came in
    a couple days ago.  It looks harmless, but I would rather take the time
    to test and queue it for usb-linus and the stable trees once 3.13-rc1
    is out.
 
 Sarah Sharp
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSYH+2AAoJEBMGWMLi1Gc5XnkP/RN7Npl576unFyKV9alGn+yw
 imimJBKXpzoWomnSQWO/AcPyFxYA2sm22WFVNIyz/qMq2koo5xk9dM1atxr1lAmJ
 NaLnyf0yCKmyTWW+EGlIUa+FBM29WyXnSwMF2UAIN35ZVwqfpJmunLs8kLxW3Sie
 ZJoz2MMZNrgNW83Bj1e3HaRFez4goYx1pslM4MpLuno8pHumrWFu5ySk8naxjRyk
 Yz6DRBHaa8fYLA36Pk+KkmtE9a5JO+ZCe6yMljmj0T6wiawjtzgukO2pUdxjC+b7
 nb/4dsR3nxlpf6O3wR7BRDLcY3zrQM2RjjOuvpyoZ1/kPgtl83RfwkuSWzQ2o+bT
 3tV4K5mIdfwHU+oUqlvzjjGHmjN62bO5g3b0HFRKxcMQL4QxmjuEW9mymXzLx/BT
 9UG9vta6mW6F/dwL2olLIha64a+vTvV3U4Jn4DDAYUtFtEmH0EYLgzBwSLHKm/ZE
 YuroUT7CK6JgLsQHohXQ5jw3sUgsqF4zBL4SvtZrCHSp4agOi+WocMfnPWkETqAo
 mOyw7F9ZouG04hsRs3kbCAwaXiBreSgElVeJXcDtZ8W/zbumLChR9jenM52UxFgk
 TAJ6ymRP7BKdVree9u3i+usQkxLGvf6imtbAiYveR+1EReDxCV7+NRJz/uEdxTDX
 5rLqvhV+1WllJhzRnbao
 =H4xp
 -----END PGP SIGNATURE-----

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

Sarah writes:

xhci: Final patches for 3.13

Hi Greg,

Here's my pull request for usb-next and 3.13.  My xHCI tree is closed
after this point, since I won't be able to run my full tests while I'm in
Scotland.  After Kernel Summit, I'll be on vacation with access to email
from Oct 26th to Nov 6th.

Here's what's in this request:

 - Patches to fix USB 2.0 Link PM issues that cause USB 3.0 devices to not
   enumerate or misbehave when plugged into a USB 2.0 port.  Those are
   marked for stable.

 - A msec vs jiffies bug fix by xiao jin, which results in fairly harmless
   behavior, and thus isn't marked for stable.

 - Xenia's patches to refactor the xHCI command handling code, which makes
   it much more readable and consistent.

 - Misc cleanup patches, one by Sachin Kamat and three from Dan Williams.

Here's what's not in this request:

 - Dan's two patches to allow the xHCI host to use the "Windows" or "new"
   enumeration scheme.  I did not have time to test those, and I want to
   run them with as many USB devices as I can get a hold of.  That will
   have to wait for 3.14.

 - Xenia's patches to remove xhci_readl in favor of readl.  I'll queue
   those for 3.14 after I test them.

 - The xHCI streams update, UAS fixes, and usbfs streams support.  I'm not
   comfortable with changes and fixes to that patchset coming in this late.
   I would rather wait for 3.14 and be really sure the streams support is
   stable before we add new userspace API and remove CONFIG_BROKEN from the
   uas driver.

 - Julius' patch to clear the port reset bit on hub resume that came in
   a couple days ago.  It looks harmless, but I would rather take the time
   to test and queue it for usb-linus and the stable trees once 3.13-rc1
   is out.

Sarah Sharp
2013-10-19 14:03:44 -07:00
Greg Kroah-Hartman 5584cfbafc Merge 3.12-rc6 into usb-next.
We want those USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19 13:19:07 -07:00
Thomas Pugliese 1653d2f88f usb: wusbcore: preserve endianness of cached descriptors
Do not overwrite the multi-byte fields of usb_wa_descriptor with their
cpu format values after reading the descriptor.  Leave the values as
__le16 and swap on use.  This is more consistent with other uses of USB
descriptors.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19 05:19:21 -07:00
Dan Williams a2cdc3432c usb: xhci: remove the unused ->address field
Only used for debug output, so we don't need to save it.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 15:49:49 -07:00
Dan Williams 4e341818ee usb: xhci: kill a conditional when toggling cycle
Perform an unconditional toggle of the cycle bit with 'xor'.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 15:48:31 -07:00
Xenia Ragiadakou c69a059783 xhci: replace 'event' with 'cmd_comp_code' in set_deq and reset_ep handlers
This patch replaces the 'event' argument of xhci_handle_cmd_set_deq() and
xhci_handle_cmd_reset_ep(), which is used to retrieve the command completion
status code, with the cmd_comp_code directly, since it is available.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:41 -07:00
Xenia Ragiadakou b8200c9479 xhci: add argument 'slot_id' in stop_ep, set_deq and reset_ep cmd handlers
Since the Slot ID field in the command completion event matches the Slot ID
field in the associated command TRB for the Stop Endpoint, Set Dequeue Pointer
and Reset Endpoint commands, this patch adds in the handlers of their
completion events a 'slot_id' argument and removes the slot id calculation
in each of them.
Also, a WARN_ON() was added in case the slot ids reported by command TRB and
event TRB differ (although according to xhci spec rev1.0 that should not happen)

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:40 -07:00
Xenia Ragiadakou bc752bde10 xhci: replace 'xhci->cmd_ring->dequeue' with 'trb' in stop_ep cmd handler
This patch replaces 'xhci->cmd_ring->dequeue' with 'trb', the address of
the command TRB, since it is available to reduce line length.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:39 -07:00
Xenia Ragiadakou b54fc46dce xhci: add variable 'cmd_type' in handle_cmd_completion()
This patch adds a new variable 'cmd_type' to hold the command type so that
switch cases can be simplified by removing TRB_TYPE() macro improving
code readability.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:39 -07:00
Xenia Ragiadakou 9124b121e3 xhci: add variable 'cmd_trb' in handle_cmd_completion()
This patch adds a new variable 'cmd_trb' to hold the address of the
command TRB, that is associated with the command completion event,
and to replace repetitions of xhci->cmd_ring->dequeue into the code.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:36 -07:00
Xenia Ragiadakou e7a79a1d6a xhci: add variable 'cmd_comp_code' in handle_cmd_completion()
This patch adds a new variable 'cmd_comp_code' to hold the command completion
status code aiming to reduce code duplication and to improve code readability.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:34 -07:00
Xenia Ragiadakou 6ed46d3337 xhci: refactor TRB_CONFIG_EP case into function
The function that handles xHCI command completion is much too long and
there is need to be broken up into individual functions for each command
completion to improve code readablity.
This patch refactors the code in TRB_CONFIG_EP switch case, in
handle_cmd_completion(), into a fuction named xhci_handle_cmd_config_ep().

There were added two additional variables, 'add_flags' and 'drop_flags',
to reduce line length below 80 chars and improve code readability.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:33 -07:00
Xenia Ragiadakou fd54498733 xhci: remove unused 'ep_ring' variable in handle_cmd_completion()
This patch removes the variable 'ep_ring' that is assigned in
TRB_CONFIG_EP switch case but never used.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:32 -07:00
Xenia Ragiadakou 07948a8da6 xhci: refactor TRB_EVAL_CONTEXT case into function
The function that handles xHCI command completion is much too long and
there is need to be broken up into individual functions for each command
completion to improve code readablity.
This patch refactors the code in TRB_EVAL_CONTEXT switch case in
handle_cmd_completion() into a fuction named xhci_handle_cmd_eval_ctx().

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:31 -07:00
Xenia Ragiadakou 2c070821e2 xhci: refactor TRB_NEC_GET_FW case into function
The function that handles xHCI command completion is much too long and
there is need to be broken up into individual functions for each command
completion to improve code readablity.
This patch refactors the code in TRB_NEC_GET_FW switch case in
handle_cmd_completion() into a fuction named xhci_handle_cmd_nec_get_fw().

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:30 -07:00
Xenia Ragiadakou f681321b40 xhci: refactor TRB_RESET_DEV case into function
The function that handles xHCI command completion is much too long and
there is need to be broken up into individual functions for each command
completion to improve code readablity.
This patch refactors the code in TRB_RESET_DEV switch case in
handle_cmd_completion() into a fuction named xhci_handle_cmd_reset_dev().

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:29 -07:00
Xenia Ragiadakou 20e7acb13f xhci: use completion event's slot id rather than dig it out of command
Since the slot id retrieved from the Reset Device TRB matches the slot id in
the command completion event, which is available, there is no need to determine
it again.
This patch removes the uneccessary reassignment to slot id and adds a WARN_ON
in case the two Slot ID fields differ (although according xhci spec rev1.0
they should not differ).

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:28 -07:00
Xenia Ragiadakou 9b3103ac9d xhci: refactor TRB_ADDR_DEV case into function
The function that handles xHCI command completion is much too long and
there is need to be broken up into individual functions for each command
completion to improve code readablity.
This patch refactors the code in TRB_ADDR_DEV switch case in
handle_cmd_completion() into a fuction named xhci_handle_cmd_addr_dev().

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:27 -07:00
Xenia Ragiadakou 6c02dd147a xhci: refactor TRB_DISABLE_SLOT case into function
The function that handles xHCI command completion is much too long and
there is need to be broken up into individual functions for each command
completion to improve code readablity.
This patch refactors the code in TRB_DISABLE_SLOT switch case in
handle_cmd_completion() into a fuction named xhci_handle_cmd_disable_slot().

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:26 -07:00
Xenia Ragiadakou b244b431f8 xhci: refactor TRB_ENABLE_SLOT case into function
The function that handles xHCI command completion is much too long and
there is need to be broken up into individual functions for each command
completion to improve code readablity.
This patch refactors the code in TRB_ENABLE_SLOT switch case in
handle_cmd_completion() into a fuction named xhci_handle_cmd_enable_slot().

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:25 -07:00
Xenia Ragiadakou 60b9593cf2 xhci: rename existing Command Completion Event handlers
This patch renames the function handlers of a triggered Command Completion
Event that correspond to each command type into 'xhci_handle_cmd_<type>'.
That is done to give a consistent naming space to all the functions that
handle Command Completion Events and that will permit the code reader to
reference to them more easily.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:24 -07:00
Xenia Ragiadakou 07a37e9e42 xhci: remove unused argument from xhci_giveback_urb_in_irq()
This patch removes the "adjective" argument from xhci_giveback_urb_in_irq(),
since it is not used in the function anymore.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:24 -07:00
xiao jin d194c03199 xhci: correct the usage of USB_CTRL_SET_TIMEOUT
The usage of USB_CTRL_SET_TIMEOUT in xhci is incorrect.
The definition of USB_CTRL_SET_TIMEOUT is 5000ms. The
input timeout to wait_for_completion_interruptible_timeout
is jiffies. That makes the timeout be longer than what
we want, such as 50s in some platform.

The patch is to use XHCI_CMD_DEFAULT_TIMEOUT instead of
USB_CTRL_SET_TIMEOUT as command completion event timeout.

Signed-off-by: xiao jin <jin.xiao@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:23 -07:00
Sachin Kamat 5f20cf12a6 usb: xhci: Staticize xhci_del_comp_mod_timer
'xhci_del_comp_mod_timer' is local to this file.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:22 -07:00
Sarah Sharp f468f7b946 usb: Push USB2 LPM disable on disconnect into USB core.
The USB core currently handles enabling and disabling optional USB power
management features during device transitions (device suspend/resume,
driver bind/unbind, device reset, and device disconnect).  Those
optional power features include Latency Tolerance Messaging (LTM),
USB 3.0 Link PM, and USB 2.0 Link PM.

The USB core currently enables LPM on device enumeration and disables
USB 2.0 Link PM when the device is reset.  However, the xHCI driver
disables LPM when the device is disconnected and the device context is
freed.  Push the call up into the USB core, in order to be consistent
with the core handling all power management enabling and disabling.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-16 12:24:21 -07:00
Sarah Sharp de68bab4fa usb: Don't enable USB 2.0 Link PM by default.
How it's supposed to work:
--------------------------

USB 2.0 Link PM is a lower power state that some newer USB 2.0 devices
support.  USB 3.0 devices certified by the USB-IF are required to
support it if they are plugged into a USB 2.0 only port, or a USB 2.0
cable is used.  USB 2.0 Link PM requires both a USB device and a host
controller that supports USB 2.0 hardware-enabled LPM.

USB 2.0 Link PM is designed to be enabled once by software, and the host
hardware handles transitions to the L1 state automatically.  The premise
of USB 2.0 Link PM is to be able to put the device into a lower power
link state when the bus is idle or the device NAKs USB IN transfers for
a specified amount of time.

...but hardware is broken:
--------------------------

It turns out many USB 3.0 devices claim to support USB 2.0 Link PM (by
setting the LPM bit in their USB 2.0 BOS descriptor), but they don't
actually implement it correctly.  This manifests as the USB device
refusing to respond to transfers when it is plugged into a USB 2.0 only
port under the Haswell-ULT/Lynx Point LP xHCI host.

These devices pass the xHCI driver's simple test to enable USB 2.0 Link
PM, wait for the port to enter L1, and then bring it back into L0.  They
only start to break when L1 entry is interleaved with transfers.

Some devices then fail to respond to the next control transfer (usually
a Set Configuration).  This results in devices never enumerating.

Other mass storage devices (such as a later model Western Digital My
Passport USB 3.0 hard drive) respond fine to going into L1 between
control transfers.  They ACK the entry, come out of L1 when the host
needs to send a control transfer, and respond properly to those control
transfers.  However, when the first READ10 SCSI command is sent, the
device NAKs the data phase while it's reading from the spinning disk.
Eventually, the host requests to put the link into L1, and the device
ACKs that request.  Then it never responds to the data phase of the
READ10 command.  This results in not being able to read from the drive.

Some mass storage devices (like the Corsair Survivor USB 3.0 flash
drive) are well behaved.  They ACK the entry into L1 during control
transfers, and when SCSI commands start coming in, they NAK the requests
to go into L1, because they need to be at full power.

Not all USB 3.0 devices advertise USB 2.0 link PM support.  My Point
Grey USB 3.0 webcam advertises itself as a USB 2.1 device, but doesn't
have a USB 2.0 BOS descriptor, so we don't enable USB 2.0 Link PM.  I
suspect that means the device isn't certified.

What do we do about it?
-----------------------

There's really no good way for the kernel to test these devices.
Therefore, the kernel needs to disable USB 2.0 Link PM by default, and
distros will have to enable it by writing 1 to the sysfs file
/sys/bus/usb/devices/../power/usb2_hardware_lpm.  Rip out the xHCI Link
PM test, since it's not sufficient to detect these buggy devices, and
don't automatically enable LPM after the device is addressed.

This patch should be backported to kernels as old as 3.11, that
contain the commit a558ccdcc7 "usb: xhci:
add USB2 Link power management BESL support".  Without this fix, some
USB 3.0 devices will not enumerate or work properly under USB 2.0 ports
on Haswell-ULT systems.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-10-16 12:24:19 -07:00
Sarah Sharp 58e21f7397 xhci: Set L1 device slot on USB2 LPM enable/disable.
To enable USB 2.0 Link Power Management (LPM), the xHCI host controller
needs the device slot ID to generate the device address used in L1 entry
tokens.  That information is set in the L1 device slot ID field of the
USB 2.0 LPM registers.

Currently, the L1 device slot ID is overwritten when the xHCI driver
initiates the software test of USB 2.0 Link PM in
xhci_usb2_software_lpm_test.  It is never cleared when USB 2.0 Link PM
is disabled for the device.  That should be harmless, because the
Hardware LPM Enable (HLE) bit is cleared when USB 2.0 Link PM is
disabled, so the host should not pay attention to the slot ID.

This patch should have no effect on host behavior, but since
xhci_usb2_software_lpm_test is going away in an upcoming bug fix patch,
we need to move that code to the function that enables and disables USB
2.0 Link PM.

This patch should be backported to kernels as old as 3.11, that contain
the commit a558ccdcc7 "usb: xhci: add USB2
Link power management BESL support".  The upcoming bug fix patch is also
marked for that stable kernel.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-10-16 12:24:18 -07:00
Jingoo Han c00809d330 USB: ohci-exynos: Remove non-DT support
The non-DT for EXYNOS SoCs is not supported from v3.11.
Thus, there is no need to support non-DT for Exynos OHCI driver.

The 'include/linux/platform_data/usb-ohci-exynos.h' file has been
used for non-DT support. Thus, the 'usb-ohci-exynos.h' file can
be removed.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-14 11:09:13 -07:00
Alan Stern a393a807d0 USB: EHCI: start new isochronous streams ASAP
This patch changes the initial delay before the startup of a newly
scheduled isochronous stream.  Currently the stream doesn't start
for at least 5 ms (40 microframes).  This value is just an estimate;
it has no real justification.

Instead, we can start the stream as soon as possible after the
scheduling computations are complete.  Essentially this requires
nothing more than reading the frame counter after the stream is
scheduled, instead of before.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-14 11:04:38 -07:00
Alan Stern b35c5009bb USB: EHCI: create per-TT bandwidth tables
This patch continues the scheduling changes in ehci-hcd by adding a
table to store the bandwidth allocation below each TT.  This will
speed up the scheduling code, as it will no longer need to read
through the entire schedule to compute the bandwidth currently in use.

Properly speaking, the FS/LS budget calculations should be done in
terms of full-speed bytes per microframe, as described in the USB-2
spec.  However the driver currently uses microseconds per microframe,
and the scheduling code isn't robust enough at this point to change
over.  For the time being, we leave the calculations as they are.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-14 11:04:38 -07:00
Greg Kroah-Hartman ca1ad0ffca Revert "USB: OHCI: Properly handle OHCI controller suspend"
This reverts commit 476e4bf939.

Manjunath is no longer at Linaro, the email address bounces.  Given
that, and the fact that others have reported problems with these
patches, I'm reverting them until someone from Linaro who can SUPPORT
THEM submits them.

I will no longer accept patches from linaro.com developers unless a
senior Linaro developer has signed off on them, which did not happen
with this patch set.

Reported-by: Olof Johansson <olof@lixom.net>
Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
2013-10-14 10:19:10 -07:00
Greg Kroah-Hartman 118cb990cd Revert "USB: OHCI: Properly handle ohci-at91 suspend"
This reverts commit 056ca85dab.

Manjunath is no longer at Linaro, the email address bounces.  Given
that, and the fact that others have reported problems with these
patches, I'm reverting them until someone from Linaro who can SUPPORT
THEM submits them.

I will no longer accept patches from linaro.com developers unless a
senior Linaro developer has signed off on them, which did not happen
with this patch set.

Reported-by: Olof Johansson <olof@lixom.net>
Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
2013-10-14 10:18:55 -07:00
Greg Kroah-Hartman ba8d400ec8 Revert "USB: OHCI: Properly handle ohci-s3c2410 suspend"
This reverts commit 19d3394304.

Manjunath is no longer at Linaro, the email address bounces.  Given
that, and the fact that others have reported problems with these
patches, I'm reverting them until someone from Linaro who can SUPPORT
THEM submits them.

I will no longer accept patches from linaro.com developers unless a
senior Linaro developer has signed off on them, which did not happen
with this patch set.

Reported-by: Olof Johansson <olof@lixom.net>
Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
2013-10-14 10:18:39 -07:00
Greg Kroah-Hartman 5d931288af Revert "USB: OHCI: Properly handle ohci-da8xx suspend"
This reverts commit 86a63f1021.

Manjunath is no longer at Linaro, the email address bounces.  Given
that, and the fact that others have reported problems with these
patches, I'm reverting them until someone from Linaro who can SUPPORT
THEM submits them.

I will no longer accept patches from linaro.com developers unless a
senior Linaro developer has signed off on them, which did not happen
with this patch set.

Reported-by: Olof Johansson <olof@lixom.net>
Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
2013-10-14 10:18:25 -07:00
Greg Kroah-Hartman 848b5b5e06 Revert "USB: OHCI: Properly handle ohci-ep93xx suspend"
This reverts commit 018258b436.

Manjunath is no longer at Linaro, the email address bounces.  Given
that, and the fact that others have reported problems with these
patches, I'm reverting them until someone from Linaro who can SUPPORT
THEM submits them.

I will no longer accept patches from linaro.com developers unless a
senior Linaro developer has signed off on them, which did not happen
with this patch set.

Reported-by: Olof Johansson <olof@lixom.net>
Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
2013-10-14 10:18:10 -07:00
Greg Kroah-Hartman 066ba8e061 Revert "USB: OHCI: Properly handle ohci-exynos suspend"
This reverts commit fea0896fd3.

Manjunath is no longer at Linaro, the email address bounces.  Given
that, and the fact that others have reported problems with these
patches, I'm reverting them until someone from Linaro who can SUPPORT
THEM submits them.

I will no longer accept patches from linaro.com developers unless a
senior Linaro developer has signed off on them, which did not happen
with this patch set.

Reported-by: Olof Johansson <olof@lixom.net>
Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
2013-10-14 10:16:58 -07:00
Greg Kroah-Hartman 3de80bfc1c Revert "USB: OHCI: Properly handle ohci-spear suspend"
This reverts commit 36a8758736.

Manjunath is no longer at Linaro, the email address bounces.  Given
that, and the fact that others have reported problems with these
patches, I'm reverting them until someone from Linaro who can SUPPORT
THEM submits them.

I will no longer accept patches from linaro.com developers unless a
senior Linaro developer has signed off on them, which did not happen
with this patch set.

Reported-by: Olof Johansson <olof@lixom.net>
Cc: Manjunath Goudar <manjunath.goudar@linaro.org>
Cc: Manjunath Goudar <csmanjuvijay@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
2013-10-14 10:15:50 -07:00
Jingoo Han 29824c167b USB: host: Rename ehci-s5p to ehci-exynos
Currently, Samsung is using 'EXYNOS' as the name of Samsung SoCs.
Thus, ehci-exynos is preferred than ehci-s5p.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:56:00 -07:00
Jingoo Han 57ae1605c0 USB: ehci-s5p: Remove non-DT support
The non-DT for EXYNOS SoCs is not supported from v3.11.
Thus, there is no need to support non-DT for Exynos EHCI driver.

The 'include/linux/platform_data/usb-ehci-s5p.h' file has been
used for non-DT support. Thus, the 'usb-ehci-s5p.h' file can
be removed.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:53:42 -07:00
Alan Stern d0ce5c6b92 USB: EHCI: use a bandwidth-allocation table
This patch significantly changes the scheduling code in ehci-hcd.
Instead of calculating the current bandwidth utilization by trudging
through the schedule and adding up the times used by the existing
transfers, we will now maintain a table holding the time used for each
of 64 microframes.  This will drastically speed up the bandwidth
computations.

In addition, it eliminates a theoretical bug.  An isochronous endpoint
may have bandwidth reserved even at times when it has no transfers
listed in the schedule.  The table will keep track of the reserved
bandwidth, whereas adding up entries in the schedule would miss it.

As a corollary, we can keep bandwidth reserved for endpoints even
when they aren't in active use.  Eventually the bandwidth will be
reserved when a new alternate setting is installed; for now the
endpoint's reservation takes place when its first URB is submitted.

A drawback of this approach is that transfers with an interval larger
than 64 microframes will have to be charged for bandwidth as though
the interval was 64.  In practice this shouldn't matter much;
transfers with longer intervals tend to be rather short anyway (things
like hubs or HID devices).

Another minor drawback is that we will keep track of two different
period and phase values: the actual ones and the ones used for
bandwidth allocation (which are limited to 64).  This adds only a
small amount of overhead: 3 bytes for each endpoint.

The patch also adds a new debugfs file named "bandwidth" to display
the information stored in the new table.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:45:43 -07:00
Alan Stern ffa0248e64 USB: EHCI: create a "periodic schedule info" struct
This patch begins the process of unifying the scheduling parameters
that ehci-hcd uses for interrupt and isochronous transfers.  It
creates an ehci_per_sched structure, which will be stored in both
ehci_qh and ehci_iso_stream structures, and will contain the common
scheduling information needed for both.

Initially we merely create the new structure and move some existing
fields into it.  Later patches will add more fields and utilize these
structures in improved scheduling algorithms.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:40:27 -07:00
Alan Stern 91a99b5e78 USB: EHCI: use consistent NO_FRAME value
ehci-hcd is inconsistent in the sentinel values it uses to indicate
that no frame number has been assigned for a periodic transfer.  Some
places it uses NO_FRAME (defined as 65535), other places it uses -1,
and elsewhere it uses 9999.

This patch defines a value for NO_FRAME which can fit in a 16-bit
signed integer, and changes the code to use it everywhere.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:40:26 -07:00
Alan Stern 27c4a31d67 USB: EHCI: change toggle only upon successful reset
ehci-hcd uses a value of 0 in an endpoint's toggle flag to indicate
that the endpoint has been reset (and therefore the Data Toggle bit
needs to be cleared in the endpoint's QH overlay region).

The toggle flag should be set to 0 only when ehci_endpoint_reset()
succeeds.  This patch moves the usb_settoggle() call into the
appropriate branch of the "if" statement.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:37:46 -07:00
Alan Stern 8c05dc598e USB: EHCI: No SSPLIT allowed in uframe 7
The scheduling code in ehci-hcd contains an error.  For full-speed
isochronous-OUT transfers, the EHCI spec forbids scheduling
Start-Split transactions in H-microframe 7, but the driver allows it
anyway.  This patch adds a check to prevent it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:37:46 -07:00
Alan Stern 2b90f01b21 USB: EHCI: compute full-speed bandwidth usage correctly
Although the bandwidth statistics maintained by ehci-hcd show up only
in the /sys/kernel/debug/usb/devices file, they ought to be calculated
correctly.  The calculation for full-speed isochronous endpoints is
wrong; it mistakenly yields bytes per microframe instead of bytes per
frame.  The "interval" value, which is in frames, should not be
converted to microframes.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:37:46 -07:00
Alan Stern e24371a6be USB: EHCI: check the right uframes for CSPLIT
The check_intr_schedule() routine in ehci-hcd looks at the wrong
microframes when checking to see if a full-speed or low-speed
interrupt endpoint will fit in the periodic schedule.  If the
Start-Split transaction is scheduled for microframe N then the
Complete-Split transactions get scheduled for microframes N+2, N+3, and
N+4.  However the code considers N+1, N+2, and N+3 instead.

This patch fixes the limits on the "for" loop and also improves the
use of whitespace.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:37:46 -07:00
Jingoo Han a72e2e5cc2 USB: ohci-exynos: Add missing usb_put_hcd() to prevent memory leak
When devm_usb_get_phy() fails, usb_put_hcd() should be called
to prevent memory leak.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:31:15 -07:00
Ivan T. Ivanov 0fc924bd4e USB: ehci-msm: Add device tree support and binding information
Allows MSM EHCI controller to be specified via device tree.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Acked-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:31:15 -07:00
Ivan T. Ivanov e4f0da055e ehci-msm: Remove global struct usb_phy variable
Use struct usb_hcd::phy to hold USB PHY instance.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Acked-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:31:15 -07:00
Joe Perches 2b84f92b81 usb: Remove unnecessary semicolons
These aren't necessary after switch and if blocks.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:26:46 -07:00
Kevin Hilman f797bd4a02 SOC updates for Keystone II devices:
- Clock tree support
 - Clock management support using PM core
 - Keystone config update for EMDA with ack from Vinod
 - Enable SPI and I2C drivers
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSV0ACAAoJEHJsHOdBp5c/ExIP/1DYAcJoHnSx0MZwXIl0mmHu
 klHWr1QDH+kqwlbxnylAJ8LgsPFDmhdW0TD1vuvSBYjH19Yrm4HwWNLJ1V26F0uq
 kd3fVYTx8Zm5YNk6kI4SJDeWC3GPtB6QgSwenTv9LpRggM99vkw9iLLEouuVKK0C
 AzDNg4CI+8pHRZIqWoGS5o0e14+x1zCcORL3J4mpsgbT88Lu0lbuKuPLhGquuWRP
 FeCvL8CSc4iqP81eFm1vy5Gix6bOIPaXCkey8xeMCKUhx4po1kj5hdiPwDlm4w8R
 M8iMotbaeZazo8tZGy2++XA4viAaIWbioDi/AhvfVuoSdtsHK6X/7+bnhK77R7wh
 rpVyhlnHSewFHLMDd5IE+mVGpzBkp2neLFwY5xbS/Acqplwcdlpa9cbQk/lYXZ7k
 0esShfBgMf42h+bWMXpgxV8To4Qisy0bQ723AKEZwgVVM8YkKNNwIHO70rEqWp5+
 M7qtKJF6AfvH8IRWwTB9Ce99g6k3OAfidDEgC7BMLKv3zc6/bTR1N4xjobp109eq
 sSgVfZERdnBriNvjZWxICpCqoMVN8hqkL4IeLR16s3cXuU8H4rxq5HqnH5/AEDa5
 1agJYGnE0CzmurMCyMrsT9IQjd7C+zJftp7TrO2y48OzAQKW4wdbuK6xPH0chFR0
 dtMA3wY/nB+FOb51bmnf
 =d2uA
 -----END PGP SIGNATURE-----

Merge tag 'keystone-soc-for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone into next/soc

From Santosh Shilimkar:
SOC updates for Keystone II devices:

- Clock tree support
- Clock management support using PM core
- Keystone config update for EMDA with ack from Vinod
- Enable SPI and I2C drivers

* tag 'keystone-soc-for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone: (510 commits)
  ARM: keystone: Enable I2C and SPI bus support
  ARM: keystone: Select TI_EDMA to be able to enable SPI driver
  dma: Allow TI_EDMA selectable for ARCH_KEYSTONE
  ARM: dts: keystone: Add the SPI nodes
  ARM: dts: keystone: Add i2c device nodes
  ARM: keystone: add PM domain support for clock management
  ARM: keystone: Enable clock drivers
  ARM: dts: keystone: Add clock phandle to UART nodes
  ARM: dts: keystone: Add clock tree data to devicetree
  +Linux 3.12-rc4

Signed-off-by: Kevin Hilman <khilman@linaro.org>
2013-10-11 15:01:36 -07:00
Rob Herring 5af5073004 drivers: clean-up prom.h implicit includes
Powerpc is a mess of implicit includes by prom.h. Add the necessary
explicit includes to drivers in preparation of prom.h cleanup.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
2013-10-09 20:04:04 -05:00
Takashi Iwai 638298dc66 xhci: Fix spurious wakeups after S5 on Haswell
Haswell LynxPoint and LynxPoint-LP with the recent Intel BIOS show
mysterious wakeups after shutdown occasionally.  After discussing with
BIOS engineers, they explained that the new BIOS expects that the
wakeup sources are cleared and set to D3 for all wakeup devices when
the system is going to sleep or power off, but the current xhci driver
doesn't do this properly (partly intentionally).

This patch introduces a new quirk, XHCI_SPURIOUS_WAKEUP, for
fixing the spurious wakeups at S5 by calling xhci_reset() in the xhci
shutdown ops as done in xhci_stop(), and setting the device to PCI D3
at shutdown and remove ops.

The PCI D3 call is based on the initial fix patch by Oliver Neukum.

[Note: Sarah changed the quirk name from XHCI_HSW_SPURIOUS_WAKEUP to
XHCI_SPURIOUS_WAKEUP, since none of the other quirks have system names
in them.  Sarah also fixed a collision with a quirk submitted around the
same time, by changing the xhci->quirks bit from 17 to 18.]

This patch should be backported to kernels as old as 3.0, that
contain the commit 1c12443ab8 "xhci: Add
Lynx Point to list of Intel switchable hosts."

Cc: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-10-09 16:27:20 -07:00
Xenia Ragiadakou e459933967 xhci: fix write to USB3_PSSEN and XUSB2PRM pci config registers
The function pci_write_config_dword() sets the appropriate byteordering
internally so the value argument should not be converted to little-endian.
This bug was found by sparse.

This patch is not suitable for stable.  Since cpu_to_lei32 is a no-op on
little endian systems, this bug would only affect big endian Intel
systems with the EHCI to xHCI port switchover, which are non-existent,
AFAIK.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-10-09 16:27:13 -07:00
Oliver Neukum 455f589252 xhci: quirk for extra long delay for S4
It has been reported that this chipset really cannot
sleep without this extraordinary delay.

This patch should be backported, in order to ensure this host functions
under stable kernels.  The last quirk for Fresco Logic hosts (commit
bba18e33f2 "xhci: Extend Fresco Logic MSI
quirk.") was backported to stable kernels as old as 2.6.36.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-10-09 16:27:04 -07:00
Sarah Sharp f217c980ca xhci: Don't enable/disable RWE on bus suspend/resume.
The RWE bit of the USB 2.0 PORTPMSC register is supposed to enable
remote wakeup for devices in the lower power link state L1.  It has
nothing to do with the device suspend remote wakeup from L2.  The RWE
bit is designed to be set once (when USB 2.0 LPM is enabled for the
port) and cleared only when USB 2.0 LPM is disabled for the port.

The xHCI bus suspend method was setting the RWE bit erroneously, and the
bus resume method was clearing it.  The xHCI 1.0 specification with
errata up to Aug 12, 2012 says in section 4.23.5.1.1.1 "Hardware
Controlled LPM":

"While Hardware USB2 LPM is enabled, software shall not modify the
HIRDBESL or RWE fields of the USB2 PORTPMSC register..."

If we have previously enabled USB 2.0 LPM for a device, that means when
the USB 2.0 bus is resumed, we violate the xHCI specification by
clearing RWE.  It also means that after a bus resume, the host would
think remote wakeup is disabled from L1 for ports with USB 2.0 Link PM
enabled, which is not what we want.

This patch should be backported to kernels as old as 3.2, that
contain the commit 65580b4321 "xHCI: set
USB2 hardware LPM".  That was the first kernel that supported USB 2.0
Link PM.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-10-09 16:26:55 -07:00
Deng-Cheng Zhu 5a3e2055c5 USB/host: Bugfix: Return length of copied buffer in uhci_hub_control()
In addition to the error statuses -ETIMEDOUT and -EPIPE, uhci_hub_control()
needs to return the length of copied buffer when appropriate, so that the
returned status of ->hub_control() in rh_call_control() in the USB core
HCD can be properly handled.

This patch also removes the OK() macro to make the code more readable.

Reviewed-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-07 00:07:17 -07:00
Michael Opdenacker 2b4ef839d6 usb: host: uhci-platform: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag

It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-07 00:05:09 -07:00
Deng-Cheng Zhu f1125f81fe USB/host: Use existing macros instead of hard-coded values in uhci-debug.c
Now that UHCI IO registers have been defined in uhci-hcd.h, use them.

Reviewed-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:58:48 -07:00
Manjunath Goudar 36a8758736 USB: OHCI: Properly handle ohci-spear suspend
Suspend scenario in case of ohci-spear glue was not
properly handled as it was not suspending generic part
of ohci controller.  Alan Stern suggested, properly handle
ohci-spear suspend scenario.

Calling explicitly the ohci_suspend() routine in
spear_ohci_hcd_drv_suspend() will ensure proper
handling of suspend scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Manjunath Goudar f3c60599d6 USB: OHCI: Properly handle ohci-sm501 suspend
Suspend scenario in case of ohci-sm501 glue was not
properly handled as it was not suspending generic part
of ohci controller.  Alan Stern suggested, properly
handle ohci-sm501 suspend scenario.

Calling explicitly the ohci_suspend() routine in
ohci_sm501_suspend() will ensure proper handling of suspend
scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Manjunath Goudar 4ceaa893be USB: OHCI: Properly handle ohci-pxa27x suspend
Suspend scenario in case of ohci-pxa27x glue was not
properly handled as it was not suspending generic part
of ohci controller.  Alan Stern suggested, properly
handle ohci-pxa27x suspend scenario.

Calling explicitly the ohci_suspend() routine in
ohci_hcd_pxa27x_drv_suspend() will ensure proper
handling of suspend scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Manjunath Goudar 39dbd7df56 USB: OHCI: Properly handle ohci-platform suspend
Suspend scenario in case of ohci-platform glue was not
properly handled as it was not suspending generic part
of ohci controller.Alan Stern suggested, properly handle
ohci-platform suspend scenario.

Calling explicitly the ohci_suspend() routine in
ohci_platform_suspend() will ensure proper handling of
suspend scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Manjunath Goudar 10abfa13fd USB: OHCI: Properly handle ohci-omap suspend
Suspend scenario in case of ohci-omap glue was not
properly handled as it was not suspending generic part
of ohci controller. Alan Stern suggested, properly handle
ohci-omap suspend scenario.

Calling explicitly the ohci_suspend() routine in
ohci_omap_suspend() will ensure proper handling of suspend
scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Manjunath Goudar fea0896fd3 USB: OHCI: Properly handle ohci-exynos suspend
Suspend scenario in case of ohci-exynos glue was not
properly handled as it was not suspending generic part
of ohci controller. Alan Stern suggested, properly handle
ohci-exynos suspend scenario.

Calling explicitly the ohci_suspend() routine in
exynos_ohci_suspend() will ensure proper handling of suspend
scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Manjunath Goudar 018258b436 USB: OHCI: Properly handle ohci-ep93xx suspend
Suspend scenario in case of ohci-ep93xx glue was not
properly handled as it was not suspending generic part
of ohci controller. Alan Stern suggested, properly handle
ohci-ep93xx suspend scenario.

Calling explicitly the ohci_suspend() routine in
ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of
suspend scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Manjunath Goudar 86a63f1021 USB: OHCI: Properly handle ohci-da8xx suspend
Suspend scenario in case of ohci-da8xx glue was not
properly handled as it was not suspending generic part
of ohci controller. Alan Stern suggested, properly handle
ohci-da8xx suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_da8xx_suspend() will ensure proper
handling of suspend scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Manjunath Goudar 19d3394304 USB: OHCI: Properly handle ohci-s3c2410 suspend
Suspend scenario in case of ohci-s3c2410 glue was not
properly handled as it was not suspending generic part
of ohci controller. Alan Stern suggested, properly handle
ohci-s3c2410 suspend scenario.

Calling explicitly the ohci_suspend()
routine in ohci_hcd_s3c2410_drv_suspend() will ensure
proper handling of suspend scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Manjunath Goudar 056ca85dab USB: OHCI: Properly handle ohci-at91 suspend
Suspend scenario in case of ohci-at91 glue was not properly handled
as it was not suspending generic part of ohci controller. Alan Stern
suggested, properly handle ohci-at91 suspend scenario.

Calling explicitly the ohci_suspend() routine in ohci_hcd_at91_drv_suspend()
will ensure proper handling of suspend scenario. This task is sugested
by Alan Stern.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Manjunath Goudar 476e4bf939 USB: OHCI: Properly handle OHCI controller suspend
Suspend scenario in case of OHCI was not properly
handled in ochi_suspend()routine. Alan Stern
suggested, properly handle OHCI suspend scenario.

This does generic proper handling of suspend
scenario to all OHCI SOC.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-05 17:56:41 -07:00
Thomas Pugliese 7e176dcb03 usb: wusbcore: implement hwahc_op_get_frame_number
This patch adds an implementation for hwahc_op_get_frame_number.  The
request is fulfulled by forwarding it to the lower hcd.  This was done
because the GET_TIME request on the HWA requires sending an URB to the
HWA and waiting for the results which cannot be done in atomic context.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 15:46:26 -07:00
Huang Rui 02c123ee99 usb: ohci: use amd_chipset_type to filter for SB800 prefetch
Commit "usb: pci-quirks: refactor AMD quirk to abstract AMD chipset types"
introduced a new AMD chipset type to filter AMD platforms with different
chipsets.

According to a recent thread [1], this patch updates SB800 prefetch routine
in AMD PLL quirk. And make it use the new chipset type to represent SB800
generation.

[1] http://marc.info/?l=linux-usb&m=138012321616452&w=2

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 15:44:51 -07:00
Huang Rui 3ad145b62a usb: ehci: use amd_chipset_type to filter for usb subsystem hang bug
Commit "usb: pci-quirks: refactor AMD quirk to abstract AMD chipset types"
introduced a new AMD chipset type to filter AMD platforms with different
chipsets.

According to a recent thread [1], this patch updates USB subsystem hang
symptom quirk which is observed on AMD all SB600 and SB700 revision
0x3a/0x3b. And make it use the new chipset type to represent.

[1] http://marc.info/?l=linux-usb&m=138012321616452&w=2

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 15:44:50 -07:00
Wei Yongjun dafbe92edb USB: EHCI: tegra: drop clk_put for devm_clk_get in tegra_ehci_probe()
devm_clk_get() is used so there is no reason to explicitly
call clk_put() in probe or remove functions.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-30 18:58:42 -07:00
Kevin Hilman c80ad6d1cd USB: OHCI: ohci_init_driver(): sanity check overrides
Check for non-NULL overrides before dereferencing since platforms may
pass in NULL overrides.

Signed-off-by: Kevin Hilman <khilman@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-30 18:58:42 -07:00
Greg Kroah-Hartman df9b17f586 Merge 3.12-rc3 into usb-next
We want the USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-29 18:45:55 -07:00
Shengzhou Liu eee41b49b8 USB: fsl/ehci: fix failure of checking PHY_CLK_VALID during reinitialization
In case of usb phy reinitialization:
e.g. insmod usb-module(usb works well) -> rmmod usb-module -> insmod usb-module
It found the PHY_CLK_VALID bit didn't work if it's not with the power-on reset.
So we just check PHY_CLK_VALID bit during the stage with POR, this can be met
by the tricky of checking FSL_SOC_USB_PRICTRL register.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 16:22:29 -07:00
Ramneek Mehresh ad1260e9fb fsl/usb: Resolve PHY_CLK_VLD instability issue for ULPI phy
For controller versions greater than 1.6, setting ULPI_PHY_CLK_SEL
bit when USB_EN bit is already set causes instability issues with
PHY_CLK_VLD bit. So USB_EN is set only for IP controller version
below 1.6 before setting ULPI_PHY_CLK_SEL bit

Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 11:59:57 -07:00
Fengguang Wu 40b3dc6da0 usb: pci-quirks: amd_chipset_sb_type_init() can be static
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 11:56:44 -07:00
Manjunath Goudar b8ad5c3706 USB: OHCI: make ohci-pxa27x a separate driver
Separate the  OHCI pxa27x/pxa3xx host controller driver from
ohci-hcd host code so that it can be built as a separate driver
module. This work is part of enabling multi-platform kernels on
ARM.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 11:35:03 -07:00
Manjunath Goudar e2404434b6 USB: OHCI: make ohci-ep93xx a separate driver
Separate the OHCI EP93XX host controller driver from ohci-hcd
host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 11:35:03 -07:00
Manjunath Goudar 30330b8fed USB: OHCI: make ohci-nxp a separate driver
Separate the OHCI NXP host controller driver from ohci-hcd
host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM.

Many place function name and struct name started with usb,
current scenario replaced usb with ohci for proper naming.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 11:35:02 -07:00
Manjunath Goudar f23b71f3fe USB: OHCI: make ohci-s3c2410 a separate driver
Separate the Samsung OHCI S3C24xx/S3C64xx host controller driver
from ohci-hcd host code so that it can be built as a separate
driver module.This work is part of enabling multi-platform.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 11:35:02 -07:00
Manjunath Goudar e3825b48e2 USB: OHCI: make ohci-at91 a separate driver
Separate the  TI OHCI Atmel host controller driver from ohci-hcd
host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 11:35:02 -07:00
Manjunath Goudar 1cc6ac59ff USB: OHCI: make ohci-spear a separate driver
Separate the ST OHCI SPEAr host controller driver from ohci-hcd
host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 11:35:02 -07:00
Manjunath Goudar 3a48fef18d USB: OHCI: make ohci-omap3 a separate driver
Separate the  TI OHCI OMAP3 host controller driver from ohci-hcd
host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Anand Gadiyar <gadiyar@ti.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 09:53:46 -07:00
Manjunath Goudar de57a1547a USB: OHCI: make ohci-omap a separate driver
Separate the  TI OHCI OMAP1/2 host controller driver from ohci-hcd
host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 09:53:46 -07:00
Manjunath Goudar 50a97e059b USB: OHCI: make ohci-exynos a separate driver
Separate the  Samsung OHCI EXYNOS host controller driver from ohci-hcd
host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Cc: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 09:51:58 -07:00
Manjunath Goudar a60f4f81e4 USB: EHCI: make ehci-w90X900 a separate driver
Separate the W90X900(W90P910) on-chip host controller driver from
ehci-hcd host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM;
however, note that other changes are still needed before W90X900(W90P910)
can be booted with a multi-platform kernel

and an ehci driver that only works on one of them.

With the infrastructure added by Alan Stern in patch 3e0232039
"USB: EHCI: prepare to make ehci-hcd a library module", we can
avoid this problem by turning a bus glue into a separate
module, as we do here for the w90X900 bus glue.

This patch is rebased on greghk/usb-next 3.12 rc1.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Wan ZongShun <mcuos.com@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 09:47:22 -07:00
Olof Johansson fca9b5ea3e Common clk support for S3C64XX
- add PLL for S3C64XX
 - add s3c64xx clock driver
 - update drivers to use CCF of s3c64xx
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSQK8VAAoJEA0Cl+kVi2xql9IP/2ZdMukndE/gxZpsHCwKSFgm
 pme2TxM4weN3q8c/749+r8AzwLl+RKbJdiw5DN4XDZ4cTdSSLkDkASUy0A0/r6Rg
 147zoQSeI02HU9LgKzZP731x3wOOCAM+RdI3eT0idDSY14Z0cScNtp7tCU52BhEF
 OdZtQTDHdcnZuESUVGksRq2GM4V2KxlzBB/FNEtq28edEQa8gXmEdpfM7AkTtl1M
 e5JFmwY3xaL2qL/0A27trOyxsuyacx1K0GHWMaHeE6wpsVh3EzK2Bx/iHTcH1wre
 MIplDMUj18QEziuUgZ82M7sJ/VPYDugplZTI1tMKgln8ri5AA5Wtvn8e6intMntc
 f2VsZdOXlY0Uxz0SqGsLlxdMzi+rRy2HAlEuUKThQ8QMPxHB4uYKXjP1gZEskPwd
 BSIJ7vXXoPxIHlC7f2PIMPRyqcgLrPG8Y+/1Obcl5pQTyP8am1throJWPlyPKEuv
 yOqfuxfgZLXL1XJdcLDswgz+qRIPacbm7/1hM62wwGErjUo8m3wvmy88ZfR4Myo+
 jj1avbsPthfInBl2/OMp9vGlZm6544SV7RtKU1/wuDNGPQba8+tr9FOiv7tJ2kRG
 xnLRcop9lu4qNqykeJkxGsOfHmTvYjG4N7TSrHunKJpN6fuVOQR93V1RSRAEX5e9
 TvEuCjm3OJj4J1sARwke
 =bUyC
 -----END PGP SIGNATURE-----

Merge tag 'samsung-clk-s3c64xx' of http://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into next/soc

From Kukjin Kim:
Common clk support for S3C64XX
- add PLL for S3C64XX
- add s3c64xx clock driver
- update drivers to use CCF of s3c64xx

* tag 'samsung-clk-s3c64xx' of http://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung:
  ARM: S3C64XX: Remove old clock management code
  ARM: S3C64XX: Migrate clock handling to Common Clock Framework
  usb: ohci-s3c2410.c: Use clk_prepare_enable/clk_disable_unprepare
  ARM: S3C64XX: Use clk_prepare_enable/clk_disable_unprepare in dma.c
  ARM: SAMSUNG: Add soc_is_s3c6400/s3c6410 macros

Signed-off-by: Olof Johansson <olof@lixom.net>
2013-09-25 21:14:42 -07:00
Huang Rui 7868943db1 usb: core: implement AMD remote wakeup quirk
The following patch is required to resolve remote wake issues with
certain devices.

Issue description:
If the remote wake is issued from the device in a specific timing
condition while the system is entering sleep state then it may cause
system to auto wake on subsequent sleep cycle.

Root cause:
Host controller rebroadcasts the Resume signal > 100 µseconds after
receiving the original resume event from the device. For proper
function, some devices may require the rebroadcast of resume event
within the USB spec of 100µS.

Workaroud:
1. Filter the AMD platforms with Yangtze chipset, then judge of all the usb
devices are mouse or not. And get out the port id which attached a mouse
with Pixart controller.
2. Then reset the port which attached issue device during system resume
from S3.

[Q] Why the special devices are only mice? Would high speed devices
such as 3G modem or USB Bluetooth adapter trigger this issue?
- Current this sensitivity is only confined to devices that use Pixart
  controllers. This controller is designed for use with LS mouse
devices only. We have not observed any other devices failing. There
may be a small risk for other devices also but this patch (reset
device in resume phase) will cover the cases if required.

[Q] Shouldn’t the resume signal be sent within 100 us for every
device?
- The Host controller may not send the resume signal within 100us,
  this our host controller specification change. This is why we
require the patch to prevent side effects on certain known devices.

[Q] Why would clicking mouse INTENSELY to wake the system up trigger
this issue?
- This behavior is specific to the devices that use Pixart controller.
  It is timing dependent on when the resume event is triggered during
the sleep state.

[Q] Is it a host controller issue or mouse?
- It is the host controller behavior during resume that triggers the
  device incorrect behavior on the next resume.

This patch sets USB_QUIRK_RESET_RESUME flag for these Pixart-based mice
when they attached to platforms with AMD Yangtze chipset.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-25 17:24:37 -07:00
Huang Rui 22b4f0cd1d usb: pci-quirks: refactor AMD quirk to abstract AMD chipset types
This patch abstracts out a AMD chipset type which includes southbridge
generation and its revision. When os excutes usb_amd_find_chipset_info
routine to initialize AMD chipset type, driver will know which kind of
chipset is used.

This update has below benifits:
- Driver is able to confirm which southbridge generations and their
  revision are used, with chipset detection once.
- To describe chipset generations with enumeration types brings better
  readability.
- It's flexible to filter AMD platforms to implement new quirks in future.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Cc: Andiry Xu <andiry.xu@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-25 17:24:37 -07:00
Peter Chen a746c286f3 usb: host: delete chipidea dependency
Now, chipidea host has already depended on USB_EHCI_HCD

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-25 17:20:52 -07:00
Tom Gundersen 05c92da0c5 usb: ohci/uhci - add soft dependencies on ehci_pci
Support for specifying soft dependencies in the modules themselves was
introduced in commit 7cb14ba.

In Arch we have always been shipping a module.d(5) fragment ordering ohci/uhci
after ehci. If this ordering is really necessary, it would be great to move it
to the kernel and getting the correct fragment generated by depmod.

Signed-off-by: Tom Gundersen <teg@jklm.no>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-25 17:20:52 -07:00
Alan Stern f875fdbf34 USB: fix PM config symbol in uhci-hcd, ehci-hcd, and xhci-hcd
Since uhci-hcd, ehci-hcd, and xhci-hcd support runtime PM, the .pm
field in their pci_driver structures should be protected by CONFIG_PM
rather than CONFIG_PM_SLEEP.  The corresponding change has already
been made for ohci-hcd.

Without this change, controllers won't do runtime suspend if system
suspend or hibernation isn't enabled.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Sarah Sharp <sarah.a.sharp@linux.intel.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-25 17:05:35 -07:00
Alan Stern a8693424c7 USB: OHCI: accept very late isochronous URBs
Commit 24f531371d (USB: EHCI: accept very late isochronous URBs)
changed the isochronous API provided by ehci-hcd.  URBs submitted too
late, so that the time slots for all their packets have already
expired, are no longer rejected outright.  Instead the submission is
accepted, and the URB completes normally with a -EXDEV error for each
packet.  This is what client drivers expect.

This patch implements the same policy in ohci-hcd.  The change is more
complicated than it was in ehci-hcd, because ohci-hcd doesn't scan for
isochronous completions in the same way as ehci-hcd does.  Rather, it
depends on the hardware adding completed TDs to a "done queue".  Some
OHCI controller don't handle this properly when a TD's time slot has
already expired, so we have to avoid adding such TDs to the schedule
in the first place.  As a result, if the URB was submitted too late
then none of its TDs will get put on the schedule, so none of them
will end up on the done queue, so the driver will never realize that
the URB should be completed.

To solve this problem, the patch adds one to urb_priv->td_cnt for such
URBs, making it larger than urb_priv->length (td_cnt already gets set
to the number of TD's that had to be skipped because their slots have
expired).  Each time an URB is given back, the finish_urb() routine
looks to see if urb_priv->td_cnt for the next URB on the same endpoint
is marked in this way.  If so, it gives back the next URB right away.

This should be applied to all kernels containing commit 815fa7b917
(USB: OHCI: fix logic for scheduling isochronous URBs).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-25 17:05:35 -07:00
Alan Stern bef073b067 USB: UHCI: accept very late isochronous URBs
Commit 24f531371d (USB: EHCI: accept very late isochronous URBs)
changed the isochronous API provided by ehci-hcd.  URBs submitted too
late, so that the time slots for all their packets have already
expired, are no longer rejected outright.  Instead the submission is
accepted, and the URB completes normally with a -EXDEV error for each
packet.  This is what client drivers expect.

This patch implements the same policy in uhci-hcd.  It should be
applied to all kernels containing commit c44b225077 (UHCI: implement
new semantics for URB_ISO_ASAP).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-25 17:05:34 -07:00
Alan Stern 8937669fd6 USB: iMX21: accept very late isochronous URBs
Commit 24f531371d (USB: EHCI: accept very late isochronous URBs)
changed the isochronous API provided by ehci-hcd.  URBs submitted too
late, so that the time slots for all their packets have already
expired, are no longer rejected outright.  Instead the submission is
accepted, and the URB completes normally with a -EXDEV error for each
packet.  This is what client drivers expect.

The same policy should be implemented in imx21-hcd, but I don't know
enough about the hardware to do it.  As a second-best substitute, this
patch treats very late isochronous submissions as though the
URB_ISO_ASAP flag were set.  I don't have any way to test this change,
unfortunately.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Sascha Hauer <kernel@pengutronix.de>
CC: Martin Fuzzey <mfuzzey@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-25 17:05:34 -07:00
Florian Wolter 526867c3ca xhci: Fix race between ep halt and URB cancellation
The halted state of a endpoint cannot be cleared over CLEAR_HALT from a
user process, because the stopped_td variable was overwritten in the
handle_stopped_endpoint() function. So the xhci_endpoint_reset() function will
refuse the reset and communication with device can not run over this endpoint.
https://bugzilla.kernel.org/show_bug.cgi?id=60699

Signed-off-by: Florian Wolter <wolly84@web.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-09-23 15:43:31 -07:00
Sarah Sharp 8b3d45705e usb: Fix xHCI host issues on remote wakeup.
When a device signals remote wakeup on a roothub, and the suspend change
bit is set, the host controller driver must not give control back to the
USB core until the port goes back into the active state.

EHCI accomplishes this by waiting in the get port status function until
the PORT_RESUME bit is cleared:

                        /* stop resume signaling */
                        temp &= ~(PORT_RWC_BITS | PORT_SUSPEND | PORT_RESUME);
                        ehci_writel(ehci, temp, status_reg);
                        clear_bit(wIndex, &ehci->resuming_ports);
                        retval = ehci_handshake(ehci, status_reg,
                                        PORT_RESUME, 0, 2000 /* 2msec */);

Similarly, the xHCI host should wait until the port goes into U0, before
passing control up to the USB core.  When the port transitions from the
RExit state to U0, the xHCI driver will get a port status change event.
We need to wait for that event before passing control up to the USB
core.

After the port transitions to the active state, the USB core should time
a recovery interval before it talks to the device.  The length of that
recovery interval is TRSMRCY, 10 ms, mentioned in the USB 2.0 spec,
section 7.1.7.7.  The previous xHCI code (which did not wait for the
port to go into U0) would cause the USB core to violate that recovery
interval.

This bug caused numerous USB device disconnects on remote wakeup under
ChromeOS and a Lynx Point LP xHCI host that takes up to 20 ms to move
from RExit to U0.  ChromeOS is very aggressive about power savings, and
sets the autosuspend_delay to 100 ms, and disables USB persist.

I attempted to replicate this bug with Ubuntu 12.04, but could not.  I
used Ubuntu 12.04 on the same platform, with the same BIOS that the bug
was triggered on ChromeOS with.  I also changed the USB sysfs settings
as described above, but still could not reproduce the bug under Ubuntu.
It may be that ChromeOS userspace triggers this bug through additional
settings.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-09-23 15:43:31 -07:00
Mathias Nyman ec7e43e2d9 xhci: Ensure a command structure points to the correct trb on the command ring
If a command on the command ring needs to be cancelled before it is handled
it can be turned to a no-op operation when the ring is stopped.
We want to store the command ring enqueue pointer in the command structure
when the command in enqueued for the cancellation case.

Some commands used to store the command ring dequeue pointers instead of enqueue
(these often worked because enqueue happends to equal dequeue quite often)

Other commands correctly used the enqueue pointer but did not check if it pointed
to a valid trb or a link trb, this caused for example stop endpoint command to timeout in
xhci_stop_device() in about 2% of suspend/resume cases.

This should also solve some weird behavior happening in command cancellation cases.

This patch is based on a patch submitted by Sarah Sharp to linux-usb, but
then forgotten:
    http://marc.info/?l=linux-usb&m=136269803207465&w=2

This patch should be backported to kernels as old as 3.7, that contain
the commit b92cc66c04 "xHCI: add aborting
command ring function"

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-09-23 15:43:30 -07:00
Mathias Nyman 284d205524 xhci: Fix oops happening after address device timeout
When a command times out, the command ring is first aborted,
and then stopped. If the command ring is empty when it is stopped
the stop event will point to next command which is not yet set.
xHCI tries to handle this next event often causing an oops.

Don't handle command completion events on stopped cmd ring if ring is
empty.

This patch should be backported to kernels as old as 3.7, that contain
the commit b92cc66c04 "xHCI: add aborting
command ring function"

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Reported-by: Giovanni <giovanni.nervi@yahoo.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-09-23 15:43:30 -07:00
Greg Kroah-Hartman c04ee4b113 Revert "Revert "USB: EHCI: support running URB giveback in tasklet context""
This reverts commit 3b8d7321ed, which
brings back commit 428aac8a81 as it should
be working for the 3.13-rc1 merge window now that Alan's other fixes are
here in the tree already.

Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-23 13:32:51 -07:00
Greg Kroah-Hartman dc4fea795b Merge branch 'master' into usb-next
We have USB fixes now in Linus's tree that we need to properly sort out
with reverts and the like in the usb-next branch, so merge them together
and do it by hand.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-23 13:24:10 -07:00
Greg Kroah-Hartman 42f4891ca2 usb: fixes for v3.12-rc2
Here's first set of fixes for v3.12-rc series, patches have
 been soaking in linux-usb for a while now.
 
 We have the usual sparse and build warnings, a Kconfig fix
 to a mismerge on dwc3 Kconfig, fix for a possible memory leak
 in dwc3, s3c-hsotg won't disconnect when bus goes idle, locking
 fix in mv_u3d_core, endpoint disable fix in f_mass_storage.
 
 We also have one device ID added to dwc3's PCI glue layer in order
 to support Intel's BayTrail devices.
 
 Signed-of-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJSOH9nAAoJEIaOsuA1yqRElTcQALIZuTv00Lg4Sts4tHHVO3KB
 qvQEcv9cBZFtQkD053ufAkJ7uRMkl7Ew5jzJj3AFhLwQ8d0eOY6O9lARG2mZdJf1
 99mCw/BgLAs9q9xgAQvuVOnmXNsi/+A5LQrbcfUG5hoecVZZhfPKZydkUGRE4+be
 UG7T0D72saa3GfnvuHGv1Z5i4IEijx6amzPaFuDQzsRNjpdEn28lqvp5nN/amKuw
 Bda++9o5DPEu/I+MseTx8eSUfrvqR7khFOxJeNlhJxkgoDQiEXaOQEbgIj1bLcEx
 bs7RF28r0Rs75seImD+0TiXlGJVr/kv2EJ5RI4qgZ+MRxu8lrfeUWHNCdIiAI62d
 rqwqnxL0AZiHuQdN2AEle9VJsoBaDw2sB8GiDQ3ZHms3InEVaVtAIpd+E0gXdf0y
 W713iZqf/9zcfuoTA0y8G/foCaWuUXr89kpv5mpGejAJBLbHRk/0hEQzW4Y/eeMb
 RbKjWFseD2bEWGlRqIcd2E73AKM8TccjmEc+khj/9kZzbrF+uoUbUrULhkKHp190
 4fBKVT/0y4s63zadmkebN91vUBpLtnYIykXU4sDm79GlImMXJA/RLmkbfCtaDyAQ
 7rEknrLEpvMVe6VbSMiitgmZb8qwy2kemhGCGbJ6e4jU7BKThUTE1gt8SlJhQm1M
 W2SoxhxQRKxXtQT/xkxt
 =51X+
 -----END PGP SIGNATURE-----

Merge tag 'fixes-for-v3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

usb: fixes for v3.12-rc2

Here's first set of fixes for v3.12-rc series, patches have
been soaking in linux-usb for a while now.

We have the usual sparse and build warnings, a Kconfig fix
to a mismerge on dwc3 Kconfig, fix for a possible memory leak
in dwc3, s3c-hsotg won't disconnect when bus goes idle, locking
fix in mv_u3d_core, endpoint disable fix in f_mass_storage.

We also have one device ID added to dwc3's PCI glue layer in order
to support Intel's BayTrail devices.

Signed-of-by: Felipe Balbi <balbi@ti.com>
2013-09-17 13:00:43 -07:00
Jingoo Han 37c3a3c4ff USB: ehci-fsl: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17 09:49:24 -07:00
Alan Stern 46c73d1d3e USB: EHCI: handle isochronous underruns with tasklets
This patch updates the iso_stream_schedule() routine in ehci-sched.c
to handle cases where an underrun causes an isochronous endpoint's
queue to empty out, but the client driver wants to maintain
synchronization with the device (i.e., the URB_ISO_ASAP flag is not
set).  This could not happen until recently, when ehci-hcd switched
over to completing URBs in a tasklet.

(This may seem like an unlikely case to worry about, but underruns are
all too common with the snd-usb-audio driver, which doesn't use
URB_ISO_ASAP.)

As part of the fix, some URBs may need to be given back when they are
submitted.  This is necessary when the URB's scheduled slots all fall
before the current value of ehci->last_iso_frame, and as an
optimization we do it also when the slots all fall before the current
frame number.

As a second part of the fix, we may need to skip some but not all of
an URB's packets.  This is necessary when some of the URB's scheduled
slots fall before the current value of ehci->last_iso_frame and some
of them fall after the current frame number.  A new field
(first_packet) is added to struct ehci_iso_sched, to indicate how many
packets should be skipped.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17 09:49:24 -07:00
Alan Stern e4e18cbd52 USB: EHCI: code rearrangement in iso_stream_schedule()
This patch interchanges the "if" and "else" branches of the big "if"
statement in iso_stream_schedule(), in preparation for the next patch
in this series.  That is, it changes

	if (likely(!...)) {
		A
	} else {
		B
	}

to

	if (unlikely(...)) {
		B
	} else {
		A
	}

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17 09:49:24 -07:00
Greg Kroah-Hartman 3b8d7321ed Revert "USB: EHCI: support running URB giveback in tasklet context"
This reverts commit 428aac8a81.

This isn't quite ready for 3.12, we need some more EHCI driver changes
that are just now showing up.  So revert this for now, and queue it up
later for 3.13.

Reported-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17 09:36:10 -07:00
Sachin Kamat 660479aad1 usb: host: fsl-mph-dr-of: Staticize local symbols
Local symbols used in this file are made static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-17 11:06:57 -05:00
Tomasz Figa d0127f6fc1 usb: ohci-s3c2410.c: Use clk_prepare_enable/clk_disable_unprepare
This patch modifies the ohci-s3c2410 driver to prepare and unprepare
clocks in addition to enabling and disabling, since it is required
by common clock framework.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
2013-09-17 06:47:36 +09:00
Martin Schwidefsky 0244ad004a Remove GENERIC_HARDIRQ config option
After the last architecture switched to generic hard irqs the config
options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
for !CONFIG_GENERIC_HARDIRQS can be removed.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2013-09-13 15:09:52 +02:00
Linus Torvalds 39eda2aba6 Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull powerpc updates from Ben Herrenschmidt:
 "Here's the powerpc batch for this merge window.  Some of the
  highlights are:

   - A bunch of endian fixes ! We don't have full LE support yet in that
     release but this contains a lot of fixes all over arch/powerpc to
     use the proper accessors, call the firmware with the right endian
     mode, etc...

   - A few updates to our "powernv" platform (non-virtualized, the one
     to run KVM on), among other, support for bridging the P8 LPC bus
     for UARTs, support and some EEH fixes.

   - Some mpc51xx clock API cleanups in preparation for a clock API
     overhaul

   - A pile of cleanups of our old math emulation code, including better
     support for using it to emulate optional FP instructions on
     embedded chips that otherwise have a HW FPU.

   - Some infrastructure in selftest, for powerpc now, but could be
     generalized, initially used by some tests for our perf instruction
     counting code.

   - A pile of fixes for hotplug on pseries (that was seriously
     bitrotting)

   - The usual slew of freescale embedded updates, new boards, 64-bit
     hiberation support, e6500 core PMU support, etc..."

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (146 commits)
  powerpc: Correct FSCR bit definitions
  powerpc/xmon: Fix printing of set of CPUs in xmon
  powerpc/pseries: Move lparcfg.c to platforms/pseries
  powerpc/powernv: Return secondary CPUs to firmware on kexec
  powerpc/btext: Fix CONFIG_PPC_EARLY_DEBUG_BOOTX on ppc32
  powerpc: Cleanup handling of the DSCR bit in the FSCR register
  powerpc/pseries: Child nodes are not detached by dlpar_detach_node
  powerpc/pseries: Add mising of_node_put in delete_dt_node
  powerpc/pseries: Make dlpar_configure_connector parent node aware
  powerpc/pseries: Do all node initialization in dlpar_parse_cc_node
  powerpc/pseries: Fix parsing of initial node path in update_dt_node
  powerpc/pseries: Pack update_props_workarea to map correctly to rtas buffer header
  powerpc/pseries: Fix over writing of rtas return code in update_dt_node
  powerpc/pseries: Fix creation of loop in device node property list
  powerpc: Skip emulating & leave interrupts off for kernel program checks
  powerpc: Add more exception trampolines for hypervisor exceptions
  powerpc: Fix location and rename exception trampolines
  powerpc: Add more trap names to xmon
  powerpc/pseries: Add a warning in the case of cross-cpu VPA registration
  powerpc: Update the 00-Index in Documentation/powerpc
  ...
2013-09-06 10:49:42 -07:00
Linus Torvalds b3b49114c8 USB patches for 3.12-rc1
Here's the big USB driver pull request for 3.12-rc1
 
 Lots of USB driver fixes and updates.  Nothing major, just the normal
 xhci, gadget, and other driver changes.  Full details in the shortlog.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.21 (GNU/Linux)
 
 iEYEABECAAYFAlIlJJ8ACgkQMUfUDdst+ymBAwCgg8czTAuwpCCK7H8LHnC2BsMj
 dtUAnjDisrbw4qWSXaaA/sfgSZjKW5G4
 =Tman
 -----END PGP SIGNATURE-----

Merge tag 'usb-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB patches from Greg KH:
 "Here's the big USB driver pull request for 3.12-rc1

  Lots of USB driver fixes and updates.  Nothing major, just the normal
  xhci, gadget, and other driver changes.  Full details in the shortlog"

* tag 'usb-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (352 commits)
  usbcore: fix incorrect type in assignment in descriptors_changed()
  usbcore: compare and release one bos descriptor in usb_reset_and_verify_device()
  ehci: remove debugging statement with ehci statistics in ehci_stop()
  ehci: remove duplicate debug_async_open() prototype in ehci-dbg.c
  ehci: enable debugging code when CONFIG_DYNAMIC_DEBUG is set
  ehci: remove ehci_vdbg() verbose debugging statements
  Documentation sysfs-bus-usb: Document which files are used by libusb
  Documentation sysfs-bus-usb: Document the speed file used by libusb
  Documentation sysfs-bus-usb: Move files with known users to stable
  USB: fix build error when CONFIG_PM_SLEEP isn't enabled
  usb: r8a66597-hcd: use platform_{get,set}_drvdata()
  usb: phy-tegra-usb: use platform_{get,set}_drvdata()
  usb: acm gadget: Null termintate strings table
  dma: cppi41: off by one in desc_to_chan()
  xhci: Fix warning introduced by disabling runtime PM.
  dev-core: fix build break when DEBUG is enabled
  USB: OHCI: Allow runtime PM without system sleep
  usb: ohci-at91: remove unnecessary dev_set_drvdata()
  usb: renesas_usbhs: use platform_{get,set}_drvdata()
  usb: fotg210-udc: use platform_{get,set}_drvdata()
  ...
2013-09-03 11:35:32 -07:00
Xenia Ragiadakou eb5ea7300d ehci: remove debugging statement with ehci statistics in ehci_stop()
This patch removes the ehci statictics information output in ehci_stop()
because they do not provide interesting info. At any case, the current
statistics can be viewed by reading the 'registers' file in debugfs.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-30 12:02:08 -07:00
Xenia Ragiadakou 15532f4761 ehci: remove duplicate debug_async_open() prototype in ehci-dbg.c
This patch removes the duplicate of debug_async_open() prototype following
three lines below the debug_async_open() declaration.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-30 12:02:08 -07:00
Xenia Ragiadakou 1512c91f1c ehci: enable debugging code when CONFIG_DYNAMIC_DEBUG is set
The debugging code for ehci is enabled to run if the DEBUG flag is defined.
This patch enables the debugging code also when the kernel is configured
with dynamic debugging on.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-30 12:02:07 -07:00
Xenia Ragiadakou fea26ef095 ehci: remove ehci_vdbg() verbose debugging statements
This patch removes ehci_vdbg debugging statements from EHCI host controller
driver because they produce too much information, lowering the signal to noise
ratio when debugging, and because they are not used anymore.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-30 12:02:07 -07:00
Libo Chen 9b1b0162e9 usb: r8a66597-hcd: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &of->dev,
so we can directly pass a struct platform_device.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-30 11:11:35 -07:00
Greg Kroah-Hartman ff49896aa4 xhci: Fix build breakage and new warnings.
Hi Greg,
 
 This first patch should fix the build breakage Sedat Dilek reported.
 Apologizes for not including this patch before commit
 0730d52a86 "xhci:prevent "callbacks suppressed"
 when debug is not enabled"
 
 The second patch fixes a new build warning introduced by commit
 c8476fb855 "usb: xhci: Disable runtime PM suspend
 for quirky controllers", which was caught by the 0day build system.
 
 Sarah Sharp
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSHnXbAAoJEBMGWMLi1Gc5SkwP/26nJPZIrObcZJ2v2i70qAxz
 +HIkrEdqUbHvU+pFs1dFMb8616FhGyrc6HZXa/arzMwBtpVxdpaDr8Wjsmqd7yf/
 /GGkoLuPq43XEYW82csvon6dupF2aEJAK//7Xb5chngStlspEhA4ms7SmbW3DPgP
 NR5mK7joXyrmHdGfaYMu5Cv2VoU0rEsGBRpIrrQwex5ojyEBzLtYbaBSs1nDgdkF
 vley5IPseo4PSWVagXM2umfulT0+Rm2C2HoyAt7A4FtWjspnaRNf32UPFKbqLdpU
 LYkIVUfteaPhcBDjS3NyKdgGdHbf7eTgkFWfB1lJbT3UJl/2QYBFNVkDhYCtU08M
 RPNAAoCwNPbx+VYSC0JVo14fzWXvOo1MDeU/PdWegdVezZSfPL7KJ1+EswVDjCSB
 FQE68tOLsVsHLLxnZwzLGxoXSyimn3S2BZ4GqoEF3UvyQke3sENe+akNYRBxsXbZ
 KOnE0z866At0WCGu7YvTQU6My1P4poIN25DLOzbAEvql8m2SdqhWkow4HJpK7Sso
 V/STSptsKXHHzUxu1PVJMhDKeWOEmyKH4BVU/BUAhL5DROISh2sGHfIkSCrFgPxJ
 QeU8BVgbHLmXC3b+G6y1PJOQKocdEmyXRmUlvntKfGjKOROUz++Act8hfK0/wkhP
 Z11abHF4axzBmrAwTkQq
 =siJK
 -----END PGP SIGNATURE-----

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

Sarah writes:

xhci: Fix build breakage and new warnings.

Hi Greg,

This first patch should fix the build breakage Sedat Dilek reported.
Apologizes for not including this patch before commit
0730d52a86 "xhci:prevent "callbacks suppressed"
when debug is not enabled"

The second patch fixes a new build warning introduced by commit
c8476fb855 "usb: xhci: Disable runtime PM suspend
for quirky controllers", which was caught by the 0day build system.

Sarah Sharp
2013-08-28 15:30:03 -07:00
Sarah Sharp e7ecf069d4 xhci: Fix warning introduced by disabling runtime PM.
The 0day build server caught a new build warning that is triggered when
CONFIG_USB_DEFAULT_PERSIST is turned on:

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git for-usb-next
head:   0730d52a86
commit: c8476fb855 [1/3] usb: xhci: Disable runtime PM suspend for quirky controllers
config: i386-randconfig-r6-0826 (attached as .config)

All warnings:

   drivers/usb/host/xhci.c: In function 'xhci_free_dev':
>> drivers/usb/host/xhci.c:3560:17: warning: unused variable 'dev' [-Wunused-variable]
     struct device *dev = hcd->self.controller;
                    ^
   drivers/usb/host/xhci.c: In function 'xhci_alloc_dev':
>> drivers/usb/host/xhci.c:3648:17: warning: unused variable 'dev' [-Wunused-variable]
     struct device *dev = hcd->self.controller;
                    ^

vim +/dev +3560 drivers/usb/host/xhci.c

  3554   * disabled.  Free any HC data structures associated with that device.
  3555   */
  3556  void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
  3557  {
  3558          struct xhci_hcd *xhci = hcd_to_xhci(hcd);
  3559          struct xhci_virt_device *virt_dev;
> 3560          struct device *dev = hcd->self.controller;
  3561          unsigned long flags;
  3562          u32 state;
  3563          int i, ret;
  3564
  3565  #ifndef CONFIG_USB_DEFAULT_PERSIST
  3566          /*
  3567           * We called pm_runtime_get_noresume when the device was attached.
  3568           * Decrement the counter here to allow controller to runtime suspend
  3569           * if no devices remain.
  3570           */
  3571          if (xhci->quirks & XHCI_RESET_ON_RESUME)
  3572                  pm_runtime_put_noidle(dev);
  3573  #endif
  3574
...
  3641  /*
  3642   * Returns 0 if the xHC ran out of device slots, the Enable Slot command
  3643   * timed out, or allocating memory failed.  Returns 1 on success.
  3644   */
  3645  int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
  3646  {
  3647          struct xhci_hcd *xhci = hcd_to_xhci(hcd);
> 3648          struct device *dev = hcd->self.controller;
  3649          unsigned long flags;
  3650          int timeleft;
  3651          int ret;

Fix this.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Shawn Nematbakhsh <shawnn@chromium.org>
2013-08-28 10:55:47 -07:00
Alan Stern 69820e01aa USB: OHCI: Allow runtime PM without system sleep
Since ohci-hcd supports runtime PM, the .pm field in its pci_driver
structure should be protected by CONFIG_PM rather than
CONFIG_PM_SLEEP.

Without this change, OHCI controllers won't do runtime suspend if
system suspend or hibernation isn't enabled.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-27 21:36:46 -07:00
Libo Chen d143a8edcd usb: ohci-at91: remove unnecessary dev_set_drvdata()
Unnecessary dev_set_drvdata() is removed, because the driver core
clears the driver data to NULL after device_release or on probe failure.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-27 21:36:46 -07:00
Dmitry Kasatkin 0730d52a86 xhci:prevent "callbacks suppressed" when debug is not enabled
When debug is not enabled and dev_dbg() will expand to nothing,
log might be flooded with "callbacks suppressed". If it was not
done on purpose, better to use dev_dbg_ratelimited() instead.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2013-08-27 08:56:31 -07:00
Mathias Nyman dcf06a0368 xhci: fix port BESL LPM capability checking
Wrong capability bit was checked for best effort service latency.
bit 20 indicate port is BESL LPM capable (BLC),
bit 19 is hardware LPM capable (HLC)

This patch should be backported to kernels as old as 3.11, that
contain the commit a558ccdcc7 "usb: xhci:
add USB2 Link power management BESL support"

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: Steve Cotton <steve@s.cotton.clara.co.uk>
Cc: stable@vger.kernel.org
2013-08-27 08:54:42 -07:00
Shawn Nematbakhsh c8476fb855 usb: xhci: Disable runtime PM suspend for quirky controllers
If a USB controller with XHCI_RESET_ON_RESUME goes to runtime suspend,
a reset will be performed upon runtime resume. Any previously suspended
devices attached to the controller will be re-enumerated at this time.
This will cause problems, for example, if an open system call on the
device triggered the resume (the open call will fail).

Note that this change is only relevant when persist_enabled is not set
for USB devices.

This patch should be backported to kernels as old as 3.0, that
contain the commit c877b3b2ad "xhci: Add
reset on resume quirk for asrock p67 host".

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-08-27 08:50:37 -07:00
Alan Stern d3474049ab USB: OHCI: fix build error related to ohci_suspend/resume
Commit 9a11899c5e (USB: OHCI: add missing PCI PM callbacks to
ohci-pci.c) added missing ohci_suspend and ohci_resume callback
pointers, but forgot that these callbacks are declared and defined
only when CONFIG_PM is enabled.

This patch adds a preprocessor conditional to avoid build errors when
PM is disabled.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reported-by: Meelis Roos <mroos@linux.ee>,
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-26 15:22:15 -07:00
Daniel Mack f375fc520d usb: ehci-mxc: check for pdata before dereferencing
Commit 7e8d5cd93f ("USB: Add EHCI support for MX27 and MX31 based
boards") introduced code that could potentially lead to a NULL pointer
dereference on driver removal.

Fix this by checking for the value of pdata before dereferencing it.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org> # 2.6.33+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-23 10:46:03 -07:00
Alan Stern 9a11899c5e USB: OHCI: add missing PCI PM callbacks to ohci-pci.c
Commit c1117afb85 (USB: OHCI: make ohci-pci a separate driver)
neglected to preserve the entries for the pci_suspend and pci_resume
driver callbacks.  As a result, OHCI controllers don't work properly
during suspend and after hibernation.

This patch adds the missing callbacks to the driver.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: Steve Cotton <steve@s.cotton.clara.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-23 10:41:46 -07:00