Commit graph

3590 commits

Author SHA1 Message Date
Alexandr Ivanov d2510342fe usb: xhci: merge xhci_queue_bulk_tx and queue_bulk_sg_tx functions
In drivers/usb/host/xhci-ring.c there are two functions
(xhci_queue_bulk_tx and queue_bulk_sg_tx) that are very similar,
so a lot of code duplication.
This patch merges these functions into to one xhci_queue_bulk_tx.
Also counting the needed TRBs is merged and refactored.

Signed-off-by: Alexandr Ivanov <alexandr.sky@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-26 16:08:02 -07:00
Alexey Khoroshilov e352506e8a USB: whci-hcd: add more checks for dma mapping error
Fixing checks for dma mapping error in qset_fill_page_list(),
I have missed two similar problems in qset_add_urb_sg() and
in qset_add_urb_sg_linearize().

v2: check validity of dma_addr with dma_mapping_error()
in qset_free_std() as suggested by Vladimir Zapolskiy.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-19 04:33:15 +09:00
Rajesh Bhagat d4fc8bf597 xhci: fix typo in babble endpoint handling comment
The 0.95 xHCI spec says that non-control endpoints will be halted if a
babble is detected on a transfer.  The 0.96 xHCI spec says all types of
endpoints will be halted when a babble is detected.  Some hardware that
claims to be 0.95 compliant halts the control endpoint anyway.

Reference: http://www.spinics.net/lists/linux-usb/msg21755.html

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-19 04:33:15 +09:00
Peter Griffin f9a85f6e61 usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
Otherwise generic-xhci and xhci-platform which have no data get wrongly
detected as XHCI_PLAT_TYPE_MARVELL_ARMADA by xhci_plat_type_is().

This fixes a regression in v4.5 for STiH407 family SoC's which use the
synopsis dwc3 IP, whereby the disable_clk error path gets taken due to
wrongly being detected as XHCI_PLAT_TYPE_MARVELL_ARMADA and the hcd never
gets added.

I suspect this will also fix other dwc3 DT platforms such as Exynos,
although I've only tested on STih410 SoC.

Fixes: 4efb2f6941 ("usb: host: xhci-plat: add struct xhci_plat_priv")
Cc: stable@vger.kernel.org
Cc: gregory.clement@free-electrons.com
Cc: yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-13 11:58:02 -07:00
Mathias Nyman 98d74f9cea xhci: fix 10 second timeout on removal of PCI hotpluggable xhci controllers
PCI hotpluggable xhci controllers such as some Alpine Ridge solutions will
remove the xhci controller from the PCI bus when the last USB device is
disconnected.

Add a flag to indicate that the host is being removed to avoid queueing
configure_endpoint commands for the dropped endpoints.
For PCI hotplugged controllers this will prevent 5 second command timeouts
For static xhci controllers the configure_endpoint command is not needed
in the removal case as everything will be returned, freed, and the
controller is reset.

For now the flag is only set for PCI connected host controllers.

Cc: <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-13 11:55:56 -07:00
Lu Baolu 71504062a7 usb: xhci: fix wild pointers in xhci_mem_cleanup
This patch fixes some wild pointers produced by xhci_mem_cleanup.
These wild pointers will cause system crash if xhci_mem_cleanup()
is called twice.

Reported-and-tested-by: Pengcheng Li <lpc.li@hisilicon.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-13 11:55:56 -07:00
Yoshihiro Shimoda 5ad3b03e49 usb: host: xhci-plat: fix cannot work if R-Car Gen2/3 run on above 4GB phys
This patch fixes an issue that cannot work if R-Car Gen2/3 run on
above 4GB physical memory environment to use a quirk XHCI_NO_64BIT_SUPPORT.

Cc: <stable@vger.kernel.org>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-13 11:55:56 -07:00
Yoshihiro Shimoda 0a380be823 usb: host: xhci: add a new quirk XHCI_NO_64BIT_SUPPORT
On some xHCI controllers (e.g. R-Car SoCs), the AC64 bit (bit 0) of
HCCPARAMS1 is set to 1. However, the xHCs don't support 64-bit
address memory pointers actually. So, in this case, this driver should
call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in xhci_gen_setup().
Otherwise, the xHCI controller will be died after a usb device is
connected if it runs on above 4GB physical memory environment.

So, this patch adds a new quirk XHCI_NO_64BIT_SUPPORT to resolve
such an issue.

Cc: <stable@vger.kernel.org>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-13 11:55:56 -07:00
Mathias Nyman 671ffdff5b xhci: resume USB 3 roothub first
Give USB3 devices a better chance to enumerate at USB 3 speeds if
they are connected to a suspended host.
Solves an issue with NEC uPD720200 host hanging when partially
enumerating a USB3 device as USB2 after host controller runtime resume.

Cc: <stable@vger.kernel.org>
Tested-by: Mike Murdoch <main.haarp@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-13 11:55:56 -07:00
Rafal Redzimski 0d46faca6f usb: xhci: applying XHCI_PME_STUCK_QUIRK to Intel BXT B0 host
Broxton B0 also requires XHCI_PME_STUCK_QUIRK.
Adding PCI device ID for Broxton B and adding to quirk.

Cc: <stable@vger.kernel.org>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Signed-off-by: Robert Dobrowolski <robert.dobrowolski@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-13 11:55:56 -07:00
Linus Torvalds 1a46712aa9 This is the bulk of GPIO changes for kernel v4.6:
Core changes:
 
 - The gpio_chip is now a *real device*. Until now the gpio chips
   were just piggybacking the parent device or (gasp) floating in
   space outside of the device model. We now finally make GPIO chips
   devices. The gpio_chip will create a gpio_device which contains
   a struct device, and this gpio_device struct is kept private.
   Anything that needs to be kept private from the rest of the kernel
   will gradually be moved over to the gpio_device.
 
 - As a result of making the gpio_device a real device, we have added
   resource management, so devm_gpiochip_add_data() will cut down on
   overhead and reduce code lines. A huge slew of patches convert
   almost all drivers in the subsystem to use this.
 
 - Building on making the GPIO a real device, we add the first step
   of a new userspace ABI: the GPIO character device. We take small
   steps here, so we first add a pure *information* ABI and the tool
   "lsgpio" that will list all GPIO devices on the system and all
   lines on these devices. We can now discover GPIOs properly from
   userspace. We still have not come up with a way to actually *use*
   GPIOs from userspace.
 
 - To encourage people to use the character device for the future,
   we have it always-enabled when using GPIO. The old sysfs ABI is
   still opt-in (and can be used in parallel), but is marked as
   deprecated. We will keep it around for the foreseeable future,
   but it will not be extended to cover ever more use cases.
 
 Cleanup:
 
 - Bjorn Helgaas removed a whole slew of per-architecture <asm/gpio.h>
   includes. This dates back to when GPIO was an opt-in feature and
   no shared library even existed: just a header file with proper
   prototypes was provided and all semantics were up to the arch to
   implement. These patches make the GPIO chip even more a proper
   device and cleans out leftovers of the old in-kernel API here
   and there. Still some cruft is left but it's very little now.
 
 - There is still some clamping of return values for .get() going
   on, but we now return sane values in the vast majority of drivers
   and the errorpath is sanitized. Some patches for powerpc, blackfin
   and unicore still drop in.
 
 - We continue to switch the ARM, MIPS, blackfin, m68k local GPIO
   implementations to use gpiochip_add_data() and cut down on code
   lines.
 
 - MPC8xxx is converted to use the generic GPIO helpers.
 
 - ATH79 is converted to use the generic GPIO helpers.
 
 New drivers:
 
 - WinSystems WS16C48
 
 - Acces 104-DIO-48E
 
 - F81866 (a F7188x variant)
 
 - Qoric (a MPC8xxx variant)
 
 - TS-4800
 
 - SPI serializers (pisosr): simple 74xx shift registers connected
   to SPI to obtain a dirt-cheap output-only GPIO expander.
 
 - Texas Instruments TPIC2810
 
 - Texas Instruments TPS65218
 
 - Texas Instruments TPS65912
 
 - X-Gene (ARM64) standby GPIO controller
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJW6m24AAoJEEEQszewGV1zUasP/RpTrjRcNI5QFHjudd2oioDx
 R/IljC06Q072ZqVy/MR7QxwhoU8jUnCgKgv4rgMa1OcfHblxC2R1+YBKOUSij831
 E+SYmYDYmoMhN7j5Aslr66MXg1rLdFSdCZWemuyNruAK8bx6cTE1AWS8AELQzzTn
 Re/CPpCDbujLy0ZK2wJHgr9ZkdcBGICtDRCrOR3Kyjpwk/DSZcruK1PDN+VQMI3k
 bJlwgtGenOHINgCq/16edpwj/hzmoJXhTOZXJHI5XVR6czTwb3SvCYACvCkauI/a
 /N7b3quG88b5y0OPQPVxp5+VVl9GyVcv5oGzIfTNat/g5QinShZIT4kVV9r0xu6/
 TQHh1HlXleh+QI3yX0oRv9ztHreMf+vdpw1dhIwLqHqfJ7AWdOGk7BbKjwCrsOoq
 t/qUVFnyvooLpyr53Z5JY8+LqyynHF68G+jUQyHLgTZ0GCE+z+1jqNl1T501n3kv
 3CSlNYxSN/YUBN3cnroAIU/ZWcV4YRdxmOtEWP+7xgcdzTE6s/JHb2fuEfVHzWPf
 mHWtJGy8U0IR4VSSEln5RtjhRr0PAjTHeTOGAmivUnaIGDziTowyUVF+X5hwC77E
 DGTuLVx/Kniv173DK7xNAsUZNAETBa3fQZTgu+RfOpMiM1FZc7tI1rd7K7PjbyCc
 d2M0gcq+d11ITJTxC7OM
 =9AJ4
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v4.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO updates from Linus Walleij:
 "This is the bulk of GPIO changes for kernel v4.6.  There is quite a
  lot of interesting stuff going on.

  The patches to other subsystems and arch-wide are ACKed as far as
  possible, though I consider things like per-arch <asm/gpio.h> as
  essentially a part of the GPIO subsystem so it should not be needed.

  Core changes:

   - The gpio_chip is now a *real device*.  Until now the gpio chips
     were just piggybacking the parent device or (gasp) floating in
     space outside of the device model.

     We now finally make GPIO chips devices.  The gpio_chip will create
     a gpio_device which contains a struct device, and this gpio_device
     struct is kept private.  Anything that needs to be kept private
     from the rest of the kernel will gradually be moved over to the
     gpio_device.

   - As a result of making the gpio_device a real device, we have added
     resource management, so devm_gpiochip_add_data() will cut down on
     overhead and reduce code lines.  A huge slew of patches convert
     almost all drivers in the subsystem to use this.

   - Building on making the GPIO a real device, we add the first step of
     a new userspace ABI: the GPIO character device.  We take small
     steps here, so we first add a pure *information* ABI and the tool
     "lsgpio" that will list all GPIO devices on the system and all
     lines on these devices.

     We can now discover GPIOs properly from userspace.  We still have
     not come up with a way to actually *use* GPIOs from userspace.

   - To encourage people to use the character device for the future, we
     have it always-enabled when using GPIO.  The old sysfs ABI is still
     opt-in (and can be used in parallel), but is marked as deprecated.

     We will keep it around for the foreseeable future, but it will not
     be extended to cover ever more use cases.

  Cleanup:

   - Bjorn Helgaas removed a whole slew of per-architecture <asm/gpio.h>
     includes.

     This dates back to when GPIO was an opt-in feature and no shared
     library even existed: just a header file with proper prototypes was
     provided and all semantics were up to the arch to implement.  These
     patches make the GPIO chip even more a proper device and cleans out
     leftovers of the old in-kernel API here and there.

     Still some cruft is left but it's very little now.

   - There is still some clamping of return values for .get() going on,
     but we now return sane values in the vast majority of drivers and
     the errorpath is sanitized.  Some patches for powerpc, blackfin and
     unicore still drop in.

   - We continue to switch the ARM, MIPS, blackfin, m68k local GPIO
     implementations to use gpiochip_add_data() and cut down on code
     lines.

   - MPC8xxx is converted to use the generic GPIO helpers.

   - ATH79 is converted to use the generic GPIO helpers.

  New drivers:

   - WinSystems WS16C48

   - Acces 104-DIO-48E

   - F81866 (a F7188x variant)

   - Qoric (a MPC8xxx variant)

   - TS-4800

   - SPI serializers (pisosr): simple 74xx shift registers connected to
     SPI to obtain a dirt-cheap output-only GPIO expander.

   - Texas Instruments TPIC2810

   - Texas Instruments TPS65218

   - Texas Instruments TPS65912

   - X-Gene (ARM64) standby GPIO controller"

* tag 'gpio-v4.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (194 commits)
  Revert "Share upstreaming patches"
  gpio: mcp23s08: Fix clearing of interrupt.
  gpiolib: Fix comment referring to gpio_*() in gpiod_*()
  gpio: pca953x: Fix pca953x_gpio_set_multiple() on 64-bit
  gpio: xgene: Fix kconfig for standby GIPO contoller
  gpio: Add generic serializer DT binding
  gpio: uapi: use 0xB4 as ioctl() major
  gpio: tps65912: fix bad merge
  Revert "gpio: lp3943: Drop pin_used and lp3943_gpio_request/lp3943_gpio_free"
  gpio: omap: drop dev field from gpio_bank structure
  gpio: mpc8xxx: Slightly update the code for better readability
  gpio: mpc8xxx: Remove *read_reg and *write_reg from struct mpc8xxx_gpio_chip
  gpio: mpc8xxx: Fixup setting gpio direction output
  gpio: mcp23s08: Add support for mcp23s18
  dt-bindings: gpio: altera: Fix altr,interrupt-type property
  gpio: add driver for MEN 16Z127 GPIO controller
  gpio: lp3943: Drop pin_used and lp3943_gpio_request/lp3943_gpio_free
  gpio: timberdale: Switch to devm_ioremap_resource()
  gpio: ts4800: Add IMX51 dependency
  gpiolib: rewrite gpiodev_add_to_list
  ...
2016-03-17 21:05:32 -07:00
Greg Kroah-Hartman 3d0712deb0 usb changes for v4.6 merge window
This is almost all under drivers/usb/dwc2/. Many
 changes to the host side implementation of dwc2 have
 been done by Douglas Anderson.
 
 We also have USB 3.1 support added to the Gadget
 Framework and, because of that work, dwc3 got
 support to Synopsys new DWC_usb31 IP core.
 
 Other than these 2 important series, we also have
 the usual collection of non-critical fixes,
 Documentation updates, and minor changes all over
 the place.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJW2YqWAAoJEIaOsuA1yqREJEgP/11ETLS7iE+HgYMEWbJxo4Ri
 6H7XryMuqyiqNSUrmYlSeax2CQCLac3fXNN7iDGkT2Ot6E3CcnOzdq5/fTSoAEvN
 vgv0nr1MHQaYlYMlsFNZJjZ98h2ZsmtYFuY+RJAKivgjCKoIR6XHeU0ExjAjyWZJ
 5exPyfA8tGnHOJFGdZUe4bBQGCG5TO/cxVkc7xkX6bLnpJibuiRJfToxbwHjY0cK
 mQPba+Tw+3E72mhZw1qw8jwqjLCdgRZXlEvMl0ogaiQydEntDC4bIbY4xDJ8c4L2
 EsACyyx63XYTiaELScxJ2e0Oh0d2yOxLZnUvspsZDlTL0OF/9E2wrVO+1s+FzdQ+
 MmvU9lPcTm+SToIJMWPkmCxpwxtQ2+4HR6IwaU2CIC1YwIjMBzhEvhHV9uZDRx2Q
 7haTEQ5Hny3YvOElEYSAof3WiUCdjMoT4UKCpPFVTZ62mVpOrlcahZoS4UbyOobd
 YGJBx2GwNLpC/Hoa5anasGLeGlR2rtPciHyvYlVm+X9OvQXnHx5d6KqlaBlM+U/6
 vjFtwS7nbbX+ttM7EtdmrC/8i0bFJQqmqg48a7El+E4Os9VJ79+/h9xmoDWoSEWX
 uTUhro+gLs23P6DAd/A08UL/Get0pqM+QdB42Y+ac3CIyl0dviRQ/2JCKgijo52Z
 wK+nnmuJIgzt8ljSzu9G
 =vivP
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v4.6' of http://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb changes for v4.6 merge window

This is almost all under drivers/usb/dwc2/. Many
changes to the host side implementation of dwc2 have
been done by Douglas Anderson.

We also have USB 3.1 support added to the Gadget
Framework and, because of that work, dwc3 got
support to Synopsys new DWC_usb31 IP core.

Other than these 2 important series, we also have
the usual collection of non-critical fixes,
Documentation updates, and minor changes all over
the place.
2016-03-04 18:43:07 -08:00
Arnd Bergmann d0fc35bc08 usb: fsl: drop USB_FSL_MPH_DR_OF Kconfig symbol
The USB_FSL_MPH_DR_OF symbol is used to ensure the code that interprets
the DR device node is built whenever one of the two drivers (EHCI or
UDC) for the platform is enabled. However, if CONFIG_USB is disabled
and we only support gadget mode, this causes a Kconfig warning:

warning: (USB_FSL_USB2) selects USB_FSL_MPH_DR_OF which has unmet direct dependencies (USB_SUPPORT && USB)

We can avoid this warning by simply no longer using the symbol,
and making sure we enter the drivers/usb/host/ directory when
the UDC driver is enabled that needs the file, and then we use
Makefile syntax to ensure the file is built-in if needed.

There is currently a dependency on CONFIG_OF, but this is redundant,
as we already know that this is set unconditionally for the platforms
that use this driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
2016-03-04 15:14:29 +02:00
Vladimir Zapolskiy 83253b3b02 usb: ohci: nxp: remove USB PLL and USB OTG clock management
LPC32xx common clock framework driver correctly manages parent clocks
of USB OHCI clock, so there is no need to manually enable and
disable them from the driver, which now depends only on a single USB
host clock.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-03 20:38:53 -08:00
Vladimir Zapolskiy fe54d9ba44 usb: ohci: nxp: remove direct access to clock controller registers
Direct access to clock control registers can be safely removed, the
task of clock management is done by platform clock driver based on
common clock framework.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-03 20:38:53 -08:00
Arnd Bergmann 9fc7c85dc4 usb: ehci-atmel: use __maybe_unused to hide pm functions
The ehci-atmel driver uses #ifdef to check for CONFIG_PM, but then
uses SIMPLE_DEV_PM_OPS, which leaves the references out when
CONFIG_PM_SLEEP is not defined, so we get a warning with
PM=y && PM_SLEEP=n:

drivers/usb/host/ehci-atmel.c:189:12: error: 'ehci_atmel_drv_suspend' defined but not used [-Werror=unused-function]
drivers/usb/host/ehci-atmel.c:203:12: error: 'ehci_atmel_drv_resume' defined but not used [-Werror=unused-function]

This removes the incorrect #ifdef and instead uses a __maybe_unused
annotation to let the compiler know it can silently drop
the function definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-03 20:37:41 -08:00
Arnd Bergmann d29051930b usb: ohci-at91: use __maybe_unused to hide pm functions
The ohci-at91 driver uses #ifdef to check for CONFIG_PM, but then
uses SIMPLE_DEV_PM_OPS, which leaves the references out when
CONFIG_PM_SLEEP is not defined, so we get a warning with
PM=y && PM_SLEEP=n:

drivers/usb/host/ohci-at91.c:587:1: error: 'ohci_hcd_at91_drv_suspend' defined but not used [-Werror=unused-function]
drivers/usb/host/ohci-at91.c:631:12: error: 'ohci_hcd_at91_drv_resume' defined but not used [-Werror=unused-function]

This removes the incorrect #ifdef and instead uses a __maybe_unused
annotation to let the compiler know it can silently drop
the function definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-03 20:37:41 -08:00
Arnd Bergmann 8dac5300c2 usb: xhci-mtk: use __maybe_unused to hide pm functions
The mediatek XHCI glue driver uses SET_SYSTEM_SLEEP_PM_OPS() to
conditionally set the correct suspend/resume options, and
also puts both the dev_pm_ops and the functions inside of
an #ifdef testing for CONFIG_PM_SLEEP, but those functions
then call other code that becomes unused:

drivers/usb/host/xhci-mtk.c:135:12: error: 'xhci_mtk_host_disable' defined but not used [-Werror=unused-function]
drivers/usb/host/xhci-mtk.c:313:13: error: 'usb_wakeup_enable' defined but not used [-Werror=unused-function]
drivers/usb/host/xhci-mtk.c:321:13: error: 'usb_wakeup_disable' defined but not used [-Werror=unused-function]

This replaces the #ifdef with __maybe_unused annotations so the
compiler knows it can silently drop them instead of warning.

For the DEV_PM_OPS definition, we can use an IS_ENABLED() check
to avoid defining the structure when CONFIG_PM is not set without
the #ifdef.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-03 20:37:41 -08:00
Arnd Bergmann c88d4df217 usb: host: unhide suspend/resume declarations
There is no need to hide function declarations, and making
these visible to the SoC specific host drivers lets us
use __maybe_unused and IS_ENABLED() checks to control
their use, rather than having to use #ifdef to hide all
callers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-03 20:37:41 -08:00
Geert Uytterhoeven cf34be7a22 usb: host: Host drivers relying on DMA should depend on HAS_DMA
If NO_DMA=y:

    ERROR: "bad_dma_ops" [drivers/usb/host/xhci-plat-hcd.ko] undefined!
    ERROR: "bad_dma_ops" [drivers/usb/host/xhci-mtk.ko] undefined!
    ERROR: "dma_pool_destroy" [drivers/usb/host/xhci-hcd.ko] undefined!
    ERROR: "bad_dma_ops" [drivers/usb/host/xhci-hcd.ko] undefined!
    ERROR: "dma_pool_free" [drivers/usb/host/xhci-hcd.ko] undefined!
    ERROR: "dma_pool_alloc" [drivers/usb/host/xhci-hcd.ko] undefined!
    ERROR: "dma_pool_create" [drivers/usb/host/xhci-hcd.ko] undefined!
    ERROR: "bad_dma_ops" [drivers/usb/host/ohci-platform.ko] undefined!
    ERROR: "dma_pool_destroy" [drivers/usb/host/ohci-hcd.ko] undefined!
    ERROR: "bad_dma_ops" [drivers/usb/host/ohci-hcd.ko] undefined!
    ERROR: "dma_pool_free" [drivers/usb/host/ohci-hcd.ko] undefined!
    ERROR: "dma_pool_alloc" [drivers/usb/host/ohci-hcd.ko] undefined!
    ERROR: "dma_pool_create" [drivers/usb/host/ohci-hcd.ko] undefined!
    ERROR: "dma_pool_create" [drivers/usb/host/fotg210-hcd.ko] undefined!
    ERROR: "bad_dma_ops" [drivers/usb/host/fotg210-hcd.ko] undefined!
    ERROR: "dma_pool_destroy" [drivers/usb/host/fotg210-hcd.ko] undefined!
    ERROR: "dma_pool_alloc" [drivers/usb/host/fotg210-hcd.ko] undefined!
    ERROR: "dma_pool_free" [drivers/usb/host/fotg210-hcd.ko] undefined!
    ERROR: "bad_dma_ops" [drivers/usb/host/ehci-platform.ko] undefined!
    ERROR: "dma_pool_destroy" [drivers/usb/host/ehci-hcd.ko] undefined!
    ERROR: "bad_dma_ops" [drivers/usb/host/ehci-hcd.ko] undefined!
    ERROR: "dma_pool_free" [drivers/usb/host/ehci-hcd.ko] undefined!
    ERROR: "dma_pool_alloc" [drivers/usb/host/ehci-hcd.ko] undefined!
    ERROR: "dma_pool_create" [drivers/usb/host/ehci-hcd.ko] undefined!

Add dependencies on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-03 20:36:46 -08:00
Julia Lawall ff075d670c usb: host: xhci-plat: fix of_table.cocci warnings
Make sure (of/i2c/platform)_device_id tables are NULL terminated

Generated by: scripts/coccinelle/misc/of_table.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-03 19:44:06 -08:00
Simon Horman f1bbdc3b04 usb: host: xhci-plat: add R-Car Gen2 and Gen3 fallback compatibility strings
Add fallback compatibility strings for R-Car Gen2 and Gen3.

This is in keeping with the fallback scheme being adopted wherever
appropriate for drivers for Renesas SoCs.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-03 19:44:06 -08:00
Simon Horman 6edd87f589 usb: host: xhci-rcar: Use ARCH_RENESAS
Make use of ARCH_RENESAS in place of ARCH_SHMOBILE.

This is part of an ongoing process to migrate from ARCH_SHMOBILE to
ARCH_RENESAS the motivation for which being that RENESAS seems to be a more
appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 20:21:53 -08:00
Bjorn Helgaas 288e6eaa06 gpio: Include linux/gpio.h instead of asm/gpio.h
Most arches have an asm/gpio.h that merely includes linux/gpio.h.  The
others select ARCH_HAVE_CUSTOM_GPIO_H, and when that's selected,
linux/gpio.h includes asm/gpio.h.

Therefore, code should include linux/gpio.h instead of including asm/gpio.h
directly.

Remove includes of asm/gpio.h, adding an include of linux/gpio.h when
necessary.

This is a follow-on to 7563bbf89d ("gpiolib/arches: Centralise
bolierplate asm/gpio.h").

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-16 00:20:03 +01:00
Saurabh Sengar acc27b6aad usb: host: pci_quirks: fix memory leak, by adding iounmap
Added iounmap inorder to free memory mapped to pointer before returning

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:21:09 -08:00
Vegard Nossum 4a6d9f8720 usb: add HAS_IOMEM dependency to USB_ISP1362_HCD
drivers/built-in.o: In function `isp1362_probe':
/home/vegard/linux/drivers/usb/host/isp1362-hcd.c:2668: undefined reference to `devm_ioremap_resource'

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Vegard Nossum f4a5d7028a usb: add HAS_IOMEM dependency to USB_OXU210HP_HCD
drivers/built-in.o: In function `oxu_drv_probe':
/home/vegard/linux/drivers/usb/host/oxu210hp-hcd.c:3821: undefined reference to `devm_ioremap_resource'

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Vegard Nossum 1043960c98 usb: add HAS_IOMEM dependency to USB_OHCI_HCD
drivers/built-in.o: In function `ohci_platform_probe':
/home/vegard/linux/drivers/usb/host/ohci-platform.c:246: undefined reference to `devm_ioremap_resource'

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Vegard Nossum eaa86229ff usb: add HAS_IOMEM dependency to USB_FOTG210_HCD
drivers/built-in.o: In function `fotg210_hcd_probe':
/home/vegard/linux/drivers/usb/host/fotg210-hcd.c:5637: undefined reference to `devm_ioremap_resource'

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Vegard Nossum 8f2abe808d usb: add HAS_IOMEM dependency to USB_XHCI_HCD
drivers/built-in.o: In function `xhci_plat_probe':
/home/vegard/linux/drivers/usb/host/xhci-plat.c:160: undefined reference to `devm_ioremap_resource'

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Vegard Nossum aaa98db718 usb: add HAS_IOMEM dependency to USB_EHCI_HCD
drivers/built-in.o: In function `ehci_platform_probe':
/home/vegard/linux/drivers/usb/host/ehci-platform.c:282: undefined reference to `devm_ioremap_resource'
drivers/built-in.o: In function `oxu_drv_probe':
/home/vegard/linux/drivers/usb/host/oxu210hp-hcd.c:3821: undefined reference to `devm_ioremap_resource'
drivers/built-in.o: In function `isp1362_probe':
/home/vegard/linux/drivers/usb/host/isp1362-hcd.c:2668: undefined reference to `devm_ioremap_resource'

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Vegard Nossum cfa33eaeee usb: add HAS_IOMEM dependency to USB_SL811_HCD
CC      drivers/usb/host/xhci-mtk.o
drivers/usb/host/xhci-mtk.c:135:12: warning: ‘xhci_mtk_host_disable’ defined but not used [-Wunused-function]
 static int xhci_mtk_host_disable(struct xhci_hcd_mtk *mtk)
            ^
drivers/usb/host/xhci-mtk.c:313:13: warning: ‘usb_wakeup_enable’ defined but not used [-Wunused-function]
 static void usb_wakeup_enable(struct xhci_hcd_mtk *mtk)
             ^
drivers/usb/host/xhci-mtk.c:321:13: warning: ‘usb_wakeup_disable’ defined but not used [-Wunused-function]
 static void usb_wakeup_disable(struct xhci_hcd_mtk *mtk)
             ^
  CC      drivers/usb/host/sl811-hcd.o
drivers/usb/host/sl811-hcd.c: In function ‘sl811h_remove’:
drivers/usb/host/sl811-hcd.c:1607:3: error: implicit declaration of function ‘iounmap’ [-Werror=implicit-function-declaration]
   iounmap(sl811->data_reg);
   ^
drivers/usb/host/sl811-hcd.c: In function ‘sl811h_probe’:
drivers/usb/host/sl811-hcd.c:1669:3: error: implicit declaration of function ‘ioremap’ [-Werror=implicit-function-declaration]
   addr_reg = ioremap(addr->start, 1);
   ^
drivers/usb/host/sl811-hcd.c:1669:12: warning: assignment makes pointer from integer without a cast [enabled by default]
   addr_reg = ioremap(addr->start, 1);
            ^
drivers/usb/host/sl811-hcd.c:1675:12: warning: assignment makes pointer from integer without a cast [enabled by default]
   data_reg = ioremap(data->start, 1);
            ^

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Vegard Nossum 149737a787 usb: add HAS_IOMEM dependency to USB_C67X00_HCD
CC      drivers/usb/c67x00/c67x00-drv.o
drivers/usb/c67x00/c67x00-drv.c: In function ‘c67x00_drv_probe’:
drivers/usb/c67x00/c67x00-drv.c:148:2: error: implicit declaration of function ‘ioremap’ [-Werror=implicit-function-declaration]
  c67x00->hpi.base = ioremap(res->start, resource_size(res));
  ^
drivers/usb/c67x00/c67x00-drv.c:148:19: warning: assignment makes pointer from integer without a cast [enabled by default]
  c67x00->hpi.base = ioremap(res->start, resource_size(res));
                   ^
drivers/usb/c67x00/c67x00-drv.c:185:2: error: implicit declaration of function ‘iounmap’ [-Werror=implicit-function-declaration]
  iounmap(c67x00->hpi.base);
  ^

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Vegard Nossum e37a6c920a usb: add HAS_IOMEM dependency to USB_R8A66597_HCD
CC      drivers/usb/host/r8a66597-hcd.o
drivers/usb/host/r8a66597-hcd.c: In function ‘r8a66597_remove’:
drivers/usb/host/r8a66597-hcd.c:2401:2: error: implicit declaration of function ‘iounmap’ [-Werror=implicit-function-declaration]
  iounmap(r8a66597->reg);
  ^
drivers/usb/host/r8a66597-hcd.c: In function ‘r8a66597_probe’:
drivers/usb/host/r8a66597-hcd.c:2447:2: error: implicit declaration of function ‘ioremap’ [-Werror=implicit-function-declaration]
  reg = ioremap(res->start, resource_size(res));
  ^
drivers/usb/host/r8a66597-hcd.c:2447:6: warning: assignment makes pointer from integer without a cast [enabled by default]
  reg = ioremap(res->start, resource_size(res));
      ^

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Vegard Nossum 828638e919 usb: add HAS_IOMEM dependency to USB_XHCI_MVEBU
drivers/usb/host/xhci-mvebu.c: In function ‘xhci_mvebu_mbus_init_quirk’:
drivers/usb/host/xhci-mvebu.c:58:2: error: implicit declaration of function ‘ioremap’ [-Werror=implicit-function-declaration]
  base = ioremap(res->start, resource_size(res));
  ^
drivers/usb/host/xhci-mvebu.c:58:7: warning: assignment makes pointer from integer without a cast [enabled by default]
  base = ioremap(res->start, resource_size(res));
       ^
drivers/usb/host/xhci-mvebu.c:69:2: error: implicit declaration of function ‘iounmap’ [-Werror=implicit-function-declaration]
  iounmap(base);
  ^

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Vegard Nossum ca23d3b747 usb: add HAS_IOMEM dependency to USB_ISP116X_HCD
drivers/usb/host/isp116x-hcd.c: In function ‘isp116x_remove’:
drivers/usb/host/isp116x-hcd.c:1552:2: error: implicit declaration of function ‘iounmap’ [-Werror=implicit-function-declaration]
  iounmap(isp116x->data_reg);
  ^
drivers/usb/host/isp116x-hcd.c: In function ‘isp116x_probe’:
drivers/usb/host/isp116x-hcd.c:1604:2: error: implicit declaration of function ‘ioremap’ [-Werror=implicit-function-declaration]
  addr_reg = ioremap(addr->start, resource_size(addr));
  ^
drivers/usb/host/isp116x-hcd.c:1604:11: warning: assignment makes pointer from integer without a cast [enabled by default]
  addr_reg = ioremap(addr->start, resource_size(addr));
           ^
drivers/usb/host/isp116x-hcd.c:1613:11: warning: assignment makes pointer from integer without a cast [enabled by default]
  data_reg = ioremap(data->start, resource_size(data));
           ^

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:09:56 -08:00
Robert Jarzmik c3853d5a70 usb: host: ohci-pxa27x: propagate the irq error code
In several drivers in the pxa architecture, it was found that the
platform_get_irq() was not propagated. This breaks the the device-tree
probe deferral path, if -EPROBE_DEFER is returned. Unfortunately, the
error return in this case is transformed into -ENXIO, breaking the
deferral mechanism.

Even if in this specific case the driver was not broken, because the
interrupt controller is always probed before drivers, propagate the
proper return code.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:06:43 -08:00
Mathias Nyman 2f6d3b6537 xhci: Support extended burst isoc TRB structure used by xhci 1.1 for USB 3.1
The transfer burst count (TBC) field in the Isoc TRB does not fit the new
larger burst count available for USB 3.1 SSP Isoc tranfers.
xhci 1.1 solved this by reusing the TD size field for transfer burst count.
The Mult field was outgrown as well. xhci 1.1  controllers can calculate
Mult itself and is not set if the new layout is used.

xhci 1.1 controllers that support the new Isoc TRB format expose a
Extended TBC Capability (ETC). To take the new format into use the xhci
host controller driver needs to set a Extended TBC Enable (ETE) bit.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:03:23 -08:00
Mathias Nyman 09c352ed67 xhci: cleanup isoc tranfers queuing code
Clean up xhci_queue_isoc_tx() and helpers to prepare them for USB 3.1 and
xhci 1.1 isoc TRB changes.

Only functional change is adding xhci version 1.1 to the BEI flag check
toghether with xhci version 1.0. Both versions behave the same.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:03:23 -08:00
Mathias Nyman 8ef8a9f5c1 xhci: Add SuperSpeedPlus high bandwidth isoc support to xhci endpoints
SuperSpeedPlus doubled the number of transactions per service interval
the isoc endpoints supports.

To support this, xhci 1.1 added Large ESIT Capability (LEC), which
takes into use new bits in the endpoint context to fit the parameters.

If xhci supports LEC, and the device has a SuperSpeedPlus Isoc companion
descriptor then take into use the high bits of max esit payload, and
skip calculating the Mult field as it wouldn't fit. LEC capable
host will calculate the Mult based on other paramenters.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:03:23 -08:00
Mathias Nyman def4e6f7b4 xhci: refactor and cleanup endpoint initialization.
xhci_endpoint_init() and helper functions were a bit messy.
Adding the higher bandwidth SuperSpeedPlus Isoc support on
top of it would make it even harder to read.

No functional changes.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:03:23 -08:00
Greg Kroah-Hartman 172ad9af55 Merge 4.5-rc4 into usb-next
We want the USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 14:38:30 -08:00
Heiner Kallweit b1249ab513 usb: r8a66597: add locking to r8a66597_check_detect_child
Use mutex usb_bus_idr_lock to protect idr_find.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-06 21:55:57 -08:00
Joe Lawrence 89140fdaf1 xhci: harden xhci_find_next_ext_cap against device removal
xhci_find_next_ext_cap doesn't check for PCI hotplug removal and may use
the PCI master abort bit pattern (~0) to calculate a new PCI address
offset to read/write.  The has lead to reproducable crashes when testing
surprise removal during device initialization on a Stratus platform, at
least after commit d5ddcdf4d6 ("xhci: rework xhci extended capability
list parsing functions").

The crash is repeatable on a Stratus platform when injecting hardware
faults to induce xHCI host controller hotplug during driver
initialization.  If a PCI read in xhci_find_next_ext_cap returns the
master abort pattern, quirk_usb_handoff_xhci may start using a bogus
ext_cap_offset to start searching more bogus PCI addresses.

Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-04 17:00:10 -08:00
Alan Stern 1586ba0c21 USB: EHCI: fix compiler warning introduced by commit 2a40f32454
Fix the following compiler warning (found by the kbuild test robot):

drivers/usb/host/ehci-hcd.c:312:13: warning: 'unlink_empty_async_suspended' declared 'static' but never defined

Commit 2a40f32454 ("USB: EHCI: fix regression during bus resume")
protected the function definition with a "#ifdef CONFIG_PM" block, so
now the declaration needs to be similarly protected.  This patch moves
it to a better location.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-04 11:27:11 -08:00
Mathias Nyman 5c82171167 xhci: Fix list corruption in urb dequeue at host removal
xhci driver frees data for all devices, both usb2 and and usb3 the
first time usb_remove_hcd() is called, including td_list and and xhci_ring
structures.

When usb_remove_hcd() is called a second time for the second xhci bus it
will try to dequeue all pending urbs, and touches td_list which is already
freed for that endpoint.

Cc: <stable@vger.kernel.org>
Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
Tested-by: Joe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 14:01:47 -08:00
Gregory CLEMENT 2ad294d5f9 usb: host: xhci-plat: fix NULL pointer in probe for device tree case
During probe, in the device tree case, the data pointer associated to a
compatible is dereferenced. However, not all the compatibles are
associated to a private data pointer.

The generic-xhci and the xhci-platform don't need them, this patch adds a
test on the data pointer before accessing it, avoiding a kernel crash.

Fixes: 4efb2f6941 ("usb: host: xhci-plat: add struct xhci_plat_priv")
Cc: stable@vger.kernel.org
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 14:01:47 -08:00
Chunfeng Yun 882fa27f48 usb: xhci-mtk: fix AHB bus hang up caused by roothubs polling
when ip fails to enter sleep mode, register access protection will
be disabled, at the same time if all clocks are disabled, access
register will hang up AHB bus.
the common case causes ip sleep failure is that after all ports
enter U3 but before ip enters sleep mode, a port receives a resume
signal('K'). this will happens when such as clicks mouse to try to
do remote-wakeup to stop system enter suspend.
so stop polling root hubs to avoid access xHCI register on bus
suspend, and restart it when bus resumes.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 14:01:47 -08:00
Chunfeng Yun b765a16a11 usb: xhci-mtk: fix bpkts value of LS/HS periodic eps not behind TT
when a LS or FS device doesn't connect though a HS hub,
the @bPkts field of its periodic endpoint context should
be set to 1.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 14:01:47 -08:00
Lu Baolu ccc04afb72 usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Broxton-M platforms
Intel Broxton M was verifed to require XHCI_PME_STUCK_QUIRK quirk as well.

Cc: stable@vger.kernel.org
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 14:01:47 -08:00
Lu Baolu 92149c930c usb: xhci: set SSIC port unused only if xhci_suspend succeeds
XHCI_SSIC_PORT_UNUSED quirk was applied to the xHCI host controllers
in some Intel SoC chips.  With this quirk applied, SSIC port is set
to "unused" prior to xhci_suspend(). This may cause problem if host
fails to suspend.  In this case, the port is set to unused without
host further entering D3, and the port will not be usable anymore.

Cc: stable@vger.kernel.org
Signed-off-by: Zhuang Jin Can <jin.can.zhuang@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 14:01:47 -08:00
Lu Baolu 7e70cbffe2 usb: xhci: add a quirk bit for ssic port unused
Two workarounds introduced by commit b8cb91e058 ("xhci: Workaround
for PME stuck issues in Intel xhci") and commit abce329c27 ("xhci:
Workaround to get D3 working in Intel xHCI") share a single quirk bit
XHCI_PME_STUCK_QUIRK. These two workarounds actually are different and
might happen on different hardwares. Need to separate them by adding a
quirk bit for the later.

Cc: stable@vger.kernel.org
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 14:01:47 -08:00
Lu Baolu fa89537783 usb: xhci: handle both SSIC ports in PME stuck quirk
Commit abce329c27 ("xhci: Workaround to get D3 working in Intel xHCI")
adds a workaround for a limitation of PME storm caused by SSIC port in
some Intel SoCs. This commit only handled one SSIC port, while there
are actually two SSIC ports in the chips. This patch handles both SSIC
ports. Without this fix, users still see PME storm.

Cc: stable@vger.kernel.org # v4.2+
Signed-off-by: Zhuang Jin Can <jin.can.zhuang@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 14:01:47 -08:00
Mathias Nyman a683509071 Revert "xhci: don't finish a TD if we get a short-transfer event mid TD"
This reverts commit e210c422b6 ("xhci: don't finish a TD if we get a
short transfer event mid TD")

Turns out that most host controllers do not follow the xHCI specs and never
send the second event for the last TRB in the TD if there was a short event
mid-TD.

Returning the URB directly after the first short-transfer event is far
better than never returning the URB. (class drivers usually timeout
after 30sec). For the hosts that do send the second event we will go
back to treating it as misplaced event and print an error message for it.

The origial patch was sent to stable kernels and needs to be reverted from
there as well

Cc: stable@vger.kernel.org
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:55:42 -08:00
Geyslan G. Bem d078c6e4ea usb: host: ehci-sched: remove unnecessary braces
This patch removes unnecessary braces in single statement blocks at the
same time as replaces the if statement with a ternary conditional.

Tested by compilation only.
Caught by checkpatch.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem ee2a1d24b9 usb: host: ehci-sched: use sizeof operator with parens
This patch adds parens to sizeof operator uses.

Tested by compilation only.
Caught by checkpatch.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 6d0febcd27 usb: host: ehci-sched: add line after declarations
This patch adds a blank line after declarations.

Caught by checkpatch.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 1ec2780cd7 usb: host: ehci-sched: use C89-style comments
This patch changes comments conforming coding style.

Caught by checkpatch.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 2fee2fed78 usb: host: ehci-sched: remove useless else branch
This patch removes an useless else branch after a break, reducing one
indent block.

Tested by compilation only.
Caught by checkpatch.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem ee90647061 usb: host: ehci-sched: remove prohibited spaces
This patch removes prohibited spaces before open parenthesis and open
brackets.

It also removes an assignment inside condition and unnecessary braces in
single statement block.

Tested by compilation only.
Caught by checkpatch.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 189b8ff0da usb: host: ehci-sched: add spaces around operators
This patch adds spaces around operators.

Tested by compilation only.
Caught by checkpatch.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 77d6554d1b usb: host: ehci-sched: remove useless initializations
This patch removes useless initializations.

Tested by compilation only.
Caught by cppcheck.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 25d108696c usb: host: ehci-sched: move constants to right
This patch moves the constants to right.

Tested by compilation only.
Caught by coccinelle:
scripts/coccinelle/misc/compare_const_fl.cocci

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 3f122a997e usb: host: ehci-sched: refactor scan_isoc function
This patch removes an infinite 'for' loop and makes use of the already
existing 'restart' tag instead, reducing one leading tab.

The comments and code were corrected conforming file coding style.

Tested by compilation only.
Caught by checkpatch:
 WARNING: Too many leading tabs - consider code refactoring

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 93df42ba1b usb: ehci: remove old stub_debug_files definition
This patch removes the local STUB_DEBUG_FILES debugging
definition. STUB_DEBUG_FILES was used only in ehci-hcd, whereas
CONFIG_DYNAMIC_DEBUG is used all over the kernel.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 3fd29009f8 usb: host: ehci-dbg: add function output_buf_tds_dir()
This patch fixes a coding style issue reported by checkpatch related to
too many leading tabs.

This moves part of the fill_periodic_buffer() to the new function
output_buf_tds_dir().

Because it's inline, the file size has not changed.

Before:
  text	data  bss    dec   hex	filename
 36920    81   12  37013  9095  drivers/usb/host/ehci-hcd.o

After:
  text	data  bss    dec   hex	filename
 36920    81   12  37013  9095  drivers/usb/host/ehci-hcd.o

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem cb27252176 usb: host: ehci-dbg: prefer kmalloc_array over kmalloc times size
This patch fixes a coding style issue reported by checkpatch related to
kmalloc_array usage.

On the same line the sizeof operand was enclosed in parentheses.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 04b8ad4368 usb: host: ehci-dbg: enclose conditional blocks with braces
This patch fixes coding style issues reported by checkpatch concerning
to conditional blocks without braces.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 12ef7dd97c usb: host: ehci-dbg: replace sizeof operand
This patch fixes a coding style issue reported by checkpatch concerning
to usage of sizeof operand as a variable instead the type.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem e2432f06b5 usb: host: ehci-dbg: remove blank line before close brace
This patch fixes coding style issue reported by checkpatch concerning to
an unnecessary line before close brace.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 8d587d6495 usb: host: ehci-dbg: add blank line after declarations
This patch fixes coding style issues reported by checkpatch concerning
to missing line after variable declarations.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 1f8e5afdb2 usb: host: ehci-dbg: convert macro to inline function
This patch converts macros into inline functions since the usage of
second is encouraged by Coding Style instead of the first.

Macros converted to functions:
 - dbg_status
 - dbg_cmd
 - dbg_port
 - speed_char

The size after changes remains the same.

Before:
text  data bss dec   hex  filename
36920 81   12  37013 9095 drivers/usb/host/ehci-hcd.o

After:
text  data bss dec   hex  filename
36920 81   12  37013 9095 drivers/usb/host/ehci-hcd.o

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem e1666317d8 usb: host: ehci-dbg: use a blank line after struct declarations
This patch fixes coding style issues reported by checkpatch concerning
to missing line after struct declarations.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem c768ffb891 usb: host: ehci-dbg: fix up function definitions
This patch indents not empty functions to have the opening brace at the
beginning of the next line and body conforming coding style.

This also makes the function definition consistent with the file coding
style aligning parameters in sequential lines and indenting them with
two tabs.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem a535597794 usb: host: ehci-dbg: use scnprintf() in qh_lines()
This patch replaces two snprintf() calls with scnprintf() in qh_lines()
and hence removes the unneeded sequential truncation tests.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem c2fb017104 usb: host: ehci-dbg: put spaces around operators
This patch fixes coding style issues reported by checkpatch concerning
to missing spaces around operators.

There is an additional change on line 49 that removes unnecessary
parentheses around ternary operands.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 78698d66a1 usb: host: ehci-dbg: fix up closing parenthesis
This patch puts the closing parenthesis at the statement end removing
unnecessary "new line".

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 5bb95ec8d7 usb: host: ehci-dbg: move trailing statements to next line
This patch fixes coding style issues reported by checkpatch concerning
to switch case statements. There are few additional changes made to fix
other coding styles issues.

These additional changes are:

 - The compound statement "({...})" on line 474 is pulled out from
   snprintf parameters.

 - On line 723 the constant "0x03" is moved to right.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 0784b4d5a2 usb: host: ehci-dbg: use C89-style comments
This patch fixes coding style issues reported by checkpatch.

Coding style demands usage of C89-style comments and a specific format
when it's multiline.

This also removes the Free Software Foundation address because FSF can
change it again.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 1cb1d1c0d0 usb: host: ehci-dbg: remove space before open square bracket
This patch fixes coding style issues reported by checkpatch. The only
change in this patch that isn't just removing spaces before opening
square brackets is at line 213 where the initialization of fls_strings[]
is placed in same line.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 668ab0db27 usb: host: ehci-dbg: remove space before open parenthesis
This patch fixes coding style issues reported by checkpatch. The vast
majority of changes in this patch are removing spaces before opening
parenthesis, but in some cases, a few additional changes are made to fix
other coding style issues.

These additional changes are:

 - Spaces around >> on line 50.
 - On line 55 a call to ehci_dbg reduced to a single line.
 - sizeof operands surrounded with parenthesis on lines 877, 883, 889
   and 901.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 4510a072c6 usb: host: ehci.h: move constant to right
This patch moves the constant 0x3ff to right and put spaces
in the right shift.

Caught by coccinelle:
scripts/coccinelle/misc/compare_const_fl.cocci

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem c021170f1d usb: host: ehci.h: move pointer operator to name side
The pointer operator must be sticked to name.

Caught by checkpatch:
ERROR: "foo * bar" should be "foo *bar"

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 8af0219eea usb: host: ehci.h: remove macros trailing semicolon
Removes trailing semicolon from macros.

Caught by checkpatch:
"WARNING: macros should not use a trailing semicolon"

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 10f2b962e6 usb: host: ehci.h: use space after comma
Put space after comma.

This patch also changes QH_NEXT macro for better reading.

Caught by checkpatch: "ERROR: space required after that ','"

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 3a9e742f3c usb: host: ehci.h: remove direct use of __attribute__ keyword
Prefer to use __aligned(size) macro instead of
__attribute__((aligned(size))).

Caught by checkpatch.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem bc4beadabf usb: host: ehci.h: fix single statement macros
Don't use the 'do {} while (0)' wrapper in a single statement macro.

Caught by checkpatch: "WARNING: Single statement macros should not
use a do {} while (0) loop"

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem 9dc3af5ed2 usb: host: ehci.h: remove space before open square bracket
Get rid of space before open square bracket.

Caught by checkpatch: "ERROR: space prohibited before open square
bracket '['"

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem e06e2264a3 usb: host: ehci.h: remove space before function open parenthesis
Get rid of space between function name and open parenthesis.

Caught by checkpatch: "WARNING: space prohibited between function name
and open parenthesis '('"

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Geyslan G. Bem b5566d074d usb: host: ehci.h: remove space before comma
Get rid of spaces before comma.

Caught by checkpatch: "ERROR: space prohibited before that ','"

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:44:05 -08:00
Heiner Kallweit 5363de7530 usb: core: switch bus numbering to using idr
USB bus numbering is based on directly dealing with bitmaps and
defines a separate list of busses.
This can be simplified and unified by using existing idr functionality.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:26:30 -08:00
Mathias Nyman d785404198 xhci: set slot context speed field to SuperSpeedPlus for USB 3.1 SSP devices
The speed field of the input slot context should represent the speed the
device is working at.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:20:54 -08:00
Mathias Nyman 5da665fcec xhci: USB 3.1 add default Speed Attributes to SuperSpeedPlus device capability
If a xhci controller does not provide a protocol speed ID (PSI) table, a
default one should be used instead. Add the default values to the
SuperSpeedPlus device capability. Overwrite the default ones if a PSI table
exists. See xHCI 1.1 sectio 7.2.2.1.1 for more info

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:20:54 -08:00
Mathias Nyman 2c0e06f882 xhci: set roothub speed to USB_SPEED_SUPER_PLUS for USB3.1 capable controllers
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:20:54 -08:00
Mathias Nyman 0caf6b3345 xhci: Make sure xhci handles USB_SPEED_SUPER_PLUS devices.
In most cases the devices with the speed set to USB_SPEED_SUPER_PLUS
are handled like regular SuperSpeed devices.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:20:08 -08:00
Alan Stern 8df0d77d8c USB: EHCI: improvements to unlink_empty_async_suspended()
unlink_empty_async_suspended() is marked __maybe_unused.  This is
because its caller, ehci_bus_suspend(), is protected by "#ifdef
CONFIG_PM".  We should use the same protection here instead of
__maybe_unused.

unlink_empty_async_suspended() gets called only when the root hub is
suspended.  It's silly for it to call start_iaa_cycle() at such a
time; the IAA mechanism doesn't work when the root hub isn't running.
It should call end_unlink_async() instead.  But even this isn't
necessary, since there already is a call to end_iaa_cycle() right
before the call to unlink_empty_async_suspended().  All we have to do
is interchange the two subroutine calls.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:14:52 -08:00
Alan Stern 87d61912c2 USB: EHCI: add a delay when unlinking an active QH
Michael Reutman reports that an AMD/ATI EHCI host controller on one of
his computers does not stop transferring data when an active bulk QH
is unlinked from the async schedule.  Apparently that host controller
fails to implement the IAA mechanism correctly when an active QH is
unlinked.  This leads to data corruption, because the controller
continues to update the QH in memory when the driver doesn't expect
it.  As a result, the next URB submitted for that QH can hang, because
the link pointers for the TD queue have been messed up.  This
misbehavior is observed quite regularly.

To be fair, the EHCI spec (section 4.8.2) says that active QHs should
not be unlinked.  It goes on to recommend a procedure that involves
waiting for the QH to go inactive before unlinking it.  In the real
world this is impractical, not least because the QH may _never_ go
inactive.  (What were they thinking?)  Sometimes we have no choice but
to unlink an active QH.

In an attempt to avoid the problems that can ensue, this patch changes
how the driver decides when the unlink is complete.  In addition to
waiting through two IAA cycles, in cases where the QH was not known to
be inactive beforehand we now wait until a 2-ms period has elapsed
with the host controller making no change to the QH data structure
(the hw_current and hw_token fields in particular).  The intuition
here is that after such a long period, the endpoint must be NAKing and
hopefully the QH has been dropped from the host controller's internal
cache.  There's no way to know if this reasoning is really valid --
the spec is no help in this regard -- but at least this approach fixes
Michael's problem.

The test for whether the QH is already known to be inactive involves
the reason for unlinking the QH originally.  If it was unlinked
because it had halted, or it stopped in response to a short read, or
it overlaid a dummy TD (a silicon bug), then it certainly is inactive.
If it was unlinked because the TD queue was empty and no TDs have been
added to the queue in the meantime, then it must be inactive.  Or if
the hardware status indicates that the QH is currently halted (even if
that wasn't the reason for unlinking it), then it is inactive.
Otherwise, if none of those checks apply, we go through the 2-ms
delay.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Michael Reutman <mreutman@epiqsolutions.com>
Tested-by: Michael Reutman <mreutman@epiqsolutions.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:14:52 -08:00
Alan Stern f96fba0dbf USB: EHCI: improve handling of the ehci->iaa_in_progress flag
This patch improves the way ehci-hcd handles the iaa_in_progress flag.
The current code is somewhat careless in this regard:

	The flag is meaningless when the root hub isn't running, most
	particularly after the root hub has been suspended.  But in
	start_iaa_cycle(), the driver checks the flag before checking
	the root hub's state.  They should be checked in the opposite
	order.

	That routine also sets the flag too early, before it has
	definitely committed to starting an IAA cycle.

	The flag is turned off in end_unlink_async().  Upcoming
	changes will call that routine at other times, not just at the
	end of an IAA cycle.  The two actions are logically separate
	(although related), so we separate out a new routine to be
	called in place of end_unlink_async() whenever an IAA cycle
	ends: end_iaa_cycle().

	iaa_in_progress should be turned off when the root hub is
	suspended -- we certainly don't want it still to be set when
	the root hub resumes.  Therefore the call to
	end_unlink_async() in ehci_bus_suspend() should also be
	replaced with a call to end_iaa_cycle().

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:14:52 -08:00
Alan Stern fcc5184ec1 USB: EHCI: store reason for unlinking a QH
This patch replaces the "exception" bitflag in the ehci_qh structure
with a more explicit "unlink_reason" bitmask.  This is for use in the
following patch, where we will need to have a good idea of the
reason for unlinking a QH, not just "something exceptional happened".

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Michael Reutman <mreutman@epiqsolutions.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-03 13:14:52 -08:00
Geliang Tang 20db5513b4 USB: host: use to_platform_device
Use to_platform_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 21:00:33 -08:00
Geliang Tang 4e5d7a82d3 usb: host: u132-hcd: use list_for_each_entry
Use list_for_each_entry() instead of list_for_each() to simplify
the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:55:33 -08:00
Geliang Tang 7b1585f209 usb: host: oxu210hp-hcd: use list_for_each_entry_safe
Use list_for_each_entry_safe() instead of list_for_each_safe() to
simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:55:33 -08:00
Geliang Tang 553c236057 usb: host: max3421-hcd: use list_for_each_entry*
Use list_for_each_entry*() instead of list_for_each*() to simplify
the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:55:33 -08:00
Geliang Tang 2f4c8e554b usb: host: fotg210: use list_for_each_entry_safe
Use list_for_each_entry_safe() instead of list_for_each_safe() to
simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:55:33 -08:00
Jia-Ju Bai e3e2e36c10 ehci-hcd: Disable memory-write-invalidate when the driver is removed
The driver calls pci_set_mwi to enable memory-write-invalidate when it
is initialized, but does not call pci_clear_mwi when it is removed. Many
other drivers calls pci_clear_mwi when pci_set_mwi is called, such as
r8169, 8139cp and e1000.

This patch adds a function "ehci_pci_remove" to remove the pci driver.
This function calls pci_clear_mwi and usb_hcd_pci_remove, which can
fix the problem.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:51:34 -08:00
Jia-Ju Bai d8ff463a4e ehci-hcd: Cleanup memory resources when ehci_halt fails
The driver calls ehci_mem_init to allocate memory resources.
But these resources are not freed when ehci_halt fails.

This patch adds "ehci_mem_cleanup" in error handling code to fix this problem.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:51:34 -08:00
Azriel Samson 4bb3cad712 usb: host: ehci-msm: Register usb shutdown function
Registering usb_hcd_platform_shutdown to be called during
shutdown. This is a generic function that performs the
generic host stack's shutdown. It ensures that USB
operations do not continue while kexec boots a new kernel.

Signed-off-by: Azriel Samson <asamson@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Reviewed-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:51:18 -08:00
Jack Pham e8f55b9148 usb: host: ehci-msm: Fix register initialization
The default value for the 'transceiver select' field of
the PORTSC register may not always be correct. Previously
the phy-msm-usb driver would do this for us, but since
ehci-msm can now be instantiated standalone without any PHY
driver, the register needs to be explicitly initialized to
ULPI mode to properly communicate with the PHY.

This is not readily apparent, as firmware or bootloader code
also happen to pre-initialize this for us. However, it can
manifest when performing a driver unbind/rebind as follows:

 cd /sys/bus/platform/drivers/msm_hsusb_host
 echo QCOM8040:00 > unbind
 echo QCOM8040:00 > bind

The EHCI core executes a controller reset as part of this,
and as a result the register in question would revert to
its default state and must be re-initialized properly.
Furthermore this may be useful in the future when adding
PM suspend/resume support.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Reviewed-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:51:18 -08:00
Jack Pham f13f0e6560 usb: host: ehci-msm: Add support for ACPI probing
Allow the EHCI MSM driver to probe against an ACPI enumerated
device with ID QCOM8040.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Reviewed-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:51:18 -08:00
Jack Pham c4398ef609 usb: host: ehci-msm: Remove dependency on OTG PHY
Currently the EHCI MSM driver has a hard dependency to be created
by an OTG layer, namely the phy-msm-usb driver. In some cases or
board configurations we want to allow the EHCI host to be
instantiated without OTG capability. Instead, relax the dependency
on having an OTG PHY being present and call usb_add_hcd() directly.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Reviewed-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:51:18 -08:00
Jack Pham 132f5005ab usb: host: ehci-msm: Allow LS devices to work
Disable the silicon quirk which is normally enabled for HSIC
host mode. This would otherwise prevent low speed devices
from enumerating properly.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:51:18 -08:00
Rafał Miłecki adbff3a4f9 USB: bcma: separate code initializing USB 2.0 core
This splits one big probing function into two smaller ones. The main one
is now responsible for the generic stuff: allocating memory & enabling
power using GPIO. The new one contains code that is specific to the USB
2.0 bcma core.
This will allow adding support for the USB 3.0 bcma core (handling XHCI)
in the future.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:37:47 -08:00
Rafał Miłecki 352d9e2ee8 USB: bcma: make helper creating platform dev more generic
Having "bool ohci" argument in bcma_hcd_create_pdev function limited it
to support two cases only (OHCI and EHCI) and put too much logic in it.
Lets make caller pass all required data. This adds few extra arguments
to the function call but will allow us to reuse this code and handle
more cases in the future (e.g. add XHCI support).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:37:47 -08:00
Sriram Dash 6f5429d986 drivers/usb/host/fsl: Port USB EHCI host driver for LS102xA
Change Power architecture specific APIs such as in_be32/out_be32
for registers read/write. Instead using ioread/writebe32 which are
defined for power as well as arm architecture

Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
Signed-off-by: Sriram Dash <sriram.dash@freescale.com>
Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:37:47 -08:00
Sriram Dash cae0586104 drivers/usb/host: fsl: Set DMA_MASK of usb platform device
Set DMA_MASK of usb platform device properly.

Signed-off-by: Sriram Dash <sriram.dash@freescale.com>
Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 20:37:47 -08:00
Vladimir Zapolskiy 9c2863b53f usb: ohci: nxp: clean up included header files
Remove mach/irq.h from the list of included headers, there is no
compilation dependency on this include file, the change is needed
to prevent a compilation failure, when mach/irq.h is removed.

Additionally remove other unneeded includes.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-24 19:33:20 -08:00
Linus Torvalds 79d245327f ARM: SoC support for Tegra platforms for v4.5
Here's a single-SoC topic branch that we've staged separately. Mainly
 because it was hard to sort the branch contents in a way that fit our
 existing branches due to some refactorings.
 
 The code has been in -next for quite a while, but we staged it in arm-soc
 a bit late, which is why we've kept it separate from the other updates
 and are sending it separately here.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWoqsGAAoJEIwa5zzehBx3/F4QAJo4FEU+KTOhUggDV+KPn9ZD
 Re1SAKTpKo9elMdDdTZZObHYPf+RXqun50C4pQiSVfyDm9syZaxtWjjZvshwsATq
 178fNN+0C/7aenj8Zpq/NrLwBl1N51cSdc1ii3TcN/OA5XDgpmGJTdqMziDiXAkd
 Nt847qSEhIvAfOtcZR2drk2wBKGCTA/NpGU3HCryPAlO7RnAbJY4Ywj0bU01Lc9y
 bSJYh1SPaa1PdDCBJjtbk6L8iGl39K5oy0e6ehECEviLBVtWIL0zqh101XGbPVtv
 vtpVJ40NciiHknCBEiJkYiY9b7BNZYMeuwLarqk7TxyW4Vm5Rl5CFkEot0X/b70J
 XSxca6KGLzSgmCYDzJtLgtmyBUDoGqNwiPnNVIjrGIt9uOlWeHGb7TUKjBZaJr7G
 nXiKKU17zhb28hEo8JjIGcuFcOGlwlBhoOKhOYePiXX/iA03M8SEZg3XXyYMiaVz
 j9PcfOQptc7CyCAyiUQW36cZc1vQlnNxpiZstF0QsJ+Poe1kPlJIVpOarrfFdvh5
 wJrS4L5YoIzb5robsNLNJ6XXiRnqvxgO6dEdA3RoI1bMaFsXVRCb03EoxVYqS4RF
 o+4h0KYQ8gPmAhA/ii/IDHps51TCCDOolAyWLfmYlqXu76IjOlC1LTYxi8RAGZNL
 xExyC0A3YDfONv6mx07R
 =LG3u
 -----END PGP SIGNATURE-----

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

Pull ARM SoC support for Tegra platforms from Olof Johansson:
 "Here's a single-SoC topic branch that we've staged separately.  Mainly
  because it was hard to sort the branch contents in a way that fit our
  existing branches due to some refactorings.

  The code has been in -next for quite a while, but we staged it in
  arm-soc a bit late, which is why we've kept it separate from the other
  updates and are sending it separately here"

* tag 'armsoc-tegra' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
  arm64: tegra: Add NVIDIA Jetson TX1 Developer Kit support
  arm64: tegra: Add NVIDIA P2597 I/O board support
  arm64: tegra: Add NVIDIA Jetson TX1 support
  arm64: tegra: Add NVIDIA P2571 board support
  arm64: tegra: Add NVIDIA P2371 board support
  arm64: tegra: Add NVIDIA P2595 I/O board support
  arm64: tegra: Add NVIDIA P2530 main board support
  arm64: tegra: Add Tegra210 support
  arm64: tegra: Add NVIDIA Tegra132 Norrin support
  arm64: tegra: Add Tegra132 support
  ARM: tegra: select USB_ULPI from EHCI rather than platform
  ARM: tegra: Ensure entire dcache is flushed on entering LP0/1
  amba: Hide TEGRA_AHB symbol
  soc/tegra: Add Tegra210 support
  soc/tegra: Provide per-SoC Kconfig symbols
2016-01-22 17:30:52 -08:00
Linus Torvalds f689b742f2 powerpc updates for 4.5
- Ground work for the new Power9 MMU from Aneesh Kumar K.V
  - Optimise FP/VMX/VSX context switching from Anton Blanchard
 
  - Various cleanups from Krzysztof Kozlowski, John Ogness, Rashmica Gupta,
    Russell Currey, Gavin Shan, Daniel Axtens, Michael Neuling, Andrew Donnellan
  - Allow wrapper to work on non-english system from Laurent Vivier
  - Add rN aliases to the pt_regs_offset table from Rashmica Gupta
  - Fix module autoload for rackmeter & axonram drivers from Luis de Bethencourt
  - Include KVM guest test in all interrupt vectors from Paul Mackerras
  - Fix DSCR inheritance over fork() from Anton Blanchard
  - Make value-returning atomics & {cmp}xchg* & their atomic_ versions fully ordered from Boqun Feng
  - Print MSR TM bits in oops messages from Michael Neuling
  - Add TM signal return & invalid stack selftests from Michael Neuling
  - Limit EPOW reset event warnings from Vipin K Parashar
  - Remove the Cell QPACE code from Rashmica Gupta
  - Append linux_banner to exception information in xmon from Rashmica Gupta
  - Add selftest to check if VSRs are corrupted from Rashmica Gupta
  - Remove broken GregorianDay() from Daniel Axtens
  - Import Anton's context_switch2 benchmark into selftests from Michael Ellerman
  - Add selftest script to test HMI functionality from Daniel Axtens
  - Remove obsolete OPAL v2 support from Stewart Smith
  - Make enter_rtas() private from Michael Ellerman
  - PPR exception cleanups from Michael Ellerman
  - Add page soft dirty tracking from Laurent Dufour
  - Add support for Nvlink NPUs from Alistair Popple
  - Add support for kexec on 476fpe from Alistair Popple
  - Enable kernel CPU dlpar from sysfs from Nathan Fontenot
  - Copy only required pieces of the mm_context_t to the paca from Michael Neuling
  - Add a kmsg_dumper that flushes OPAL console output on panic from Russell Currey
  - Implement save_stack_trace_regs() to enable kprobe stack tracing from Steven Rostedt
  - Add HWCAP bits for Power9 from Michael Ellerman
  - Fix _PAGE_PTE breaking swapoff from Aneesh Kumar K.V
  - Fix _PAGE_SWP_SOFT_DIRTY breaking swapoff from Hugh Dickins
  - scripts/recordmcount.pl: support data in text section on powerpc from Ulrich Weigand
  - Handle R_PPC64_ENTRY relocations in modules from Ulrich Weigand
 
  - cxl: Fix possible idr warning when contexts are released from Vaibhav Jain
  - cxl: use correct operator when writing pcie config space values from Andrew Donnellan
  - cxl: Fix DSI misses when the context owning task exits from Vaibhav Jain
  - cxl: fix build for GCC 4.6.x from Brian Norris
  - cxl: use -Werror only with CONFIG_PPC_WERROR from Brian Norris
  - cxl: Enable PCI device ID for future IBM CXL adapter from Uma Krishnan
 
  - Freescale updates from Scott: Highlights include moving QE code out of
    arch/powerpc (to be shared with arm), device tree updates, and minor fixes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWmIxeAAoJEFHr6jzI4aWAA+cQAIXAw4WfVWJ2V4ZK+1eKfB57
 fdXG71PuXG+WYIWy71ly8keLHdzzD1NQ2OUB64bUVRq202nRgVc15ZYKRJ/FE/sP
 SkxaQ2AG/2kI2EflWshOi0Lu9qaZ+LMHJnszIqE/9lnGSB2kUI/cwsSXgziiMKXR
 XNci9v14SdDd40YV/6BSZXoxApwyq9cUbZ7rnzFLmz4hrFuKmB/L3LABDF8QcpH7
 sGt/YaHGOtqP0UX7h5KQTFLGe1OPvK6NWixSXeZKQ71ED6cho1iKUEOtBA9EZeIN
 QM5JdHFWgX8MMRA0OHAgidkSiqO38BXjmjkVYWoIbYz7Zax3ThmrDHB4IpFwWnk3
 l7WBykEXY7KEqpZzbh0GFGehZWzVZvLnNgDdvpmpk/GkPzeYKomBj7ZZfm3H1yGD
 BTHPwuWCTX+/K75yEVNO8aJO12wBg7DRl4IEwBgqhwU8ga4FvUOCJkm+SCxA1Dnn
 qlpS7qPwTXNIEfKMJcxp5X0KiwDY1EoOotd4glTN0jbeY5GEYcxe+7RQ302GrYxP
 zcc8EGLn8h6BtQvV3ypNHF5l6QeTW/0ZlO9c236tIuUQ5gQU39SQci7jQKsYjSzv
 BB1XdLHkbtIvYDkmbnr1elbeJCDbrWL9rAXRUTRyfuCzaFWTfZmfVNe8c8qwDMLk
 TUxMR/38aI7bLcIQjwj9
 =R5bX
 -----END PGP SIGNATURE-----

Merge tag 'powerpc-4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc updates from Michael Ellerman:
 "Core:
   - Ground work for the new Power9 MMU from Aneesh Kumar K.V
   - Optimise FP/VMX/VSX context switching from Anton Blanchard

  Misc:
   - Various cleanups from Krzysztof Kozlowski, John Ogness, Rashmica
     Gupta, Russell Currey, Gavin Shan, Daniel Axtens, Michael Neuling,
     Andrew Donnellan
   - Allow wrapper to work on non-english system from Laurent Vivier
   - Add rN aliases to the pt_regs_offset table from Rashmica Gupta
   - Fix module autoload for rackmeter & axonram drivers from Luis de
     Bethencourt
   - Include KVM guest test in all interrupt vectors from Paul Mackerras
   - Fix DSCR inheritance over fork() from Anton Blanchard
   - Make value-returning atomics & {cmp}xchg* & their atomic_ versions
     fully ordered from Boqun Feng
   - Print MSR TM bits in oops messages from Michael Neuling
   - Add TM signal return & invalid stack selftests from Michael Neuling
   - Limit EPOW reset event warnings from Vipin K Parashar
   - Remove the Cell QPACE code from Rashmica Gupta
   - Append linux_banner to exception information in xmon from Rashmica
     Gupta
   - Add selftest to check if VSRs are corrupted from Rashmica Gupta
   - Remove broken GregorianDay() from Daniel Axtens
   - Import Anton's context_switch2 benchmark into selftests from
     Michael Ellerman
   - Add selftest script to test HMI functionality from Daniel Axtens
   - Remove obsolete OPAL v2 support from Stewart Smith
   - Make enter_rtas() private from Michael Ellerman
   - PPR exception cleanups from Michael Ellerman
   - Add page soft dirty tracking from Laurent Dufour
   - Add support for Nvlink NPUs from Alistair Popple
   - Add support for kexec on 476fpe from Alistair Popple
   - Enable kernel CPU dlpar from sysfs from Nathan Fontenot
   - Copy only required pieces of the mm_context_t to the paca from
     Michael Neuling
   - Add a kmsg_dumper that flushes OPAL console output on panic from
     Russell Currey
   - Implement save_stack_trace_regs() to enable kprobe stack tracing
     from Steven Rostedt
   - Add HWCAP bits for Power9 from Michael Ellerman
   - Fix _PAGE_PTE breaking swapoff from Aneesh Kumar K.V
   - Fix _PAGE_SWP_SOFT_DIRTY breaking swapoff from Hugh Dickins
   - scripts/recordmcount.pl: support data in text section on powerpc
     from Ulrich Weigand
   - Handle R_PPC64_ENTRY relocations in modules from Ulrich Weigand

  cxl:
   - cxl: Fix possible idr warning when contexts are released from
     Vaibhav Jain
   - cxl: use correct operator when writing pcie config space values
     from Andrew Donnellan
   - cxl: Fix DSI misses when the context owning task exits from Vaibhav
     Jain
   - cxl: fix build for GCC 4.6.x from Brian Norris
   - cxl: use -Werror only with CONFIG_PPC_WERROR from Brian Norris
   - cxl: Enable PCI device ID for future IBM CXL adapter from Uma
     Krishnan

  Freescale:
   - Freescale updates from Scott: Highlights include moving QE code out
     of arch/powerpc (to be shared with arm), device tree updates, and
     minor fixes"

* tag 'powerpc-4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (149 commits)
  powerpc/module: Handle R_PPC64_ENTRY relocations
  scripts/recordmcount.pl: support data in text section on powerpc
  powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages
  powerpc/mm: fix _PAGE_SWP_SOFT_DIRTY breaking swapoff
  powerpc/mm: Fix _PAGE_PTE breaking swapoff
  cxl: Enable PCI device ID for future IBM CXL adapter
  cxl: use -Werror only with CONFIG_PPC_WERROR
  cxl: fix build for GCC 4.6.x
  powerpc: Add HWCAP bits for Power9
  powerpc/powernv: Reserve PE#0 on NPU
  powerpc/powernv: Change NPU PE# assignment
  powerpc/powernv: Fix update of NVLink DMA mask
  powerpc/powernv: Remove misleading comment in pci.c
  powerpc: Implement save_stack_trace_regs() to enable kprobe stack tracing
  powerpc: Fix build break due to paca mm_context_t changes
  cxl: Fix DSI misses when the context owning task exits
  MAINTAINERS: Update Scott Wood's e-mail address
  powerpc/powernv: Fix minor off-by-one error in opal_mce_check_early_recovery()
  powerpc: Fix style of self-test config prompts
  powerpc/powernv: Only delay opal_rtc_read() retry when necessary
  ...
2016-01-15 13:18:47 -08:00
Linus Torvalds 237f38c3b3 USB patches for 4.5-rc1
Here is the big USB drivers update for 4.5-rc1.  Lots of gadget driver
 updates and fixes, like usual, and a mix of other USB driver updates as
 well.  Full details in the shortlog.  All of these have been in
 linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlaV2rUACgkQMUfUDdst+ym2XQCgqdDOlyGX5B//9CZ2kH1DrDW9
 qLsAoLSBvw4hk+Aotv6tn8AayMpHwqV1
 =pFLC
 -----END PGP SIGNATURE-----

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

Pull USB updates from Greg KH:
 "Here is the big USB drivers update for 4.5-rc1.

  Lots of gadget driver updates and fixes, like usual, and a mix of
  other USB driver updates as well.  Full details in the shortlog.  All
  of these have been in linux-next for a while"

* tag 'usb-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (191 commits)
  MAINTAINERS: change my email address
  USB: usbmon: remove assignment from IS_ERR argument
  USB: mxu11x0: drop redundant function name from error messages
  USB: mxu11x0: fix debug-message typos
  USB: mxu11x0: rename usb-serial driver
  USB: mxu11x0: fix modem-control handling on B0-transitions
  USB: mxu11x0: fix memory leak on firmware download
  USB: mxu11x0: fix memory leak in port-probe error path
  USB: serial: add Moxa UPORT 11x0 driver
  USB: cp210x: add ID for ELV Marble Sound Board 1
  usb: chipidea: otg: use usb autosuspend to suspend bus for HNP
  usb: chipidea: host: set host to be null after hcd is freed
  usb: chipidea: removing of_find_property
  usb: chipidea: implement platform shutdown callback
  usb: chipidea: clean up CONFIG_USB_CHIPIDEA_DEBUG reference
  usb: chipidea: delete static debug support
  usb: chipidea: support debugfs without CONFIG_USB_CHIPIDEA_DEBUG
  usb: chipidea: udc: improve error handling on _hardware_enqueue
  usb: chipidea: udc: _ep_queue and _hw_queue cleanup
  usb: dwc3: of-simple: fix build warning on !PM
  ...
2016-01-13 09:26:40 -08:00
Olof Johansson d0ac6119aa ARM: tegra: Core SoC changes for v4.5-rc1
The big thing here is Tegra210 support, which is really only the Kconfig
 symbol. Other than that there's a few miscellaneous fixes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWcqt1AAoJEN0jrNd/PrOhylsQAI8Kg2TNG2e+vhHm6SWG5hW9
 jXzKDKl21vLWxP9s1Gmorn59+T8Lo79031sqCAPApYHCBm52M/vv2RYac2SJPvKm
 cD58O/dJM73/MZWFpMi8YS6fMsfAnAOa7DLIIEADkN7LzPRWJlWiylA9HxM0zm/1
 mc7dGtOmK1fnwgdJvi0Lu1BVBy7QIrQ5dVHblph6Zg+QGkjk7xSnCLikwxTdTQ44
 3GFKPWri4t/rMWrtHQzVc3jq5W1qSFeLp43ehev+uxPjGzRDGRTfWntvTbNZ0gs+
 qS64dGr6ptv195bOr85pkyTbx41wQ8yEooua/u3OdiSMri1pcXTT0fTFHQ5qhYaQ
 awyjLVSKJqMN0VRCrcioYWDnUHs98nWqQz8j/AY1ko5hAe3bf74VelBDAPhtCMVB
 sxM1GvcQDoBHNlgFEJpI8IaDLRNv3GmIZejl5vJd6olvWqIveY+XKtI8tEfnkH5E
 ibnFtNV26Eb5s/4M20ZbRLPyHFrF33SBo9yGHef9OI7k26aAnQSHfgmVRCvYTqYh
 GRAmg50iPNkzX84xPvaITXjNAa3w7MKY411//7eSP810m757Hliv6FlrtoMNnOJZ
 7hy+kcuFMRWfYykGfk1sVvfwpeq/dk7iiKvyrArRKtTYQjcjjCT8h1oUyfhSVuqZ
 +WohzBaSINH5sTWgaeef
 =zr7c
 -----END PGP SIGNATURE-----

Merge tag 'tegra-for-4.5-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into late/tegra

ARM: tegra: Core SoC changes for v4.5-rc1

The big thing here is Tegra210 support, which is really only the Kconfig
symbol. Other than that there's a few miscellaneous fixes.

* tag 'tegra-for-4.5-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  ARM: tegra: select USB_ULPI from EHCI rather than platform
  ARM: tegra: Ensure entire dcache is flushed on entering LP0/1
  amba: Hide TEGRA_AHB symbol
  soc/tegra: Add Tegra210 support
  soc/tegra: Provide per-SoC Kconfig symbols

Signed-off-by: Olof Johansson <olof@lixom.net>
2016-01-12 10:14:52 -08:00
Al Viro 7e935c7ca1 Merge branch 'memdup_user_nul' into work.misc 2016-01-04 10:25:34 -05:00
Al Viro b25472f9b9 new helpers: no_seek_end_llseek{,_size}()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-12-23 10:41:31 -05:00
Zhao Qiang 7aa1aa6ece QE: Move QE from arch/powerpc to drivers/soc
ls1 has qe and ls1 has arm cpu.
move qe from arch/powerpc to drivers/soc/fsl
to adapt to powerpc and arm

Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
2015-12-22 17:12:56 -06:00
Greg Kroah-Hartman 252ca494ac Merge 4.4-rc5 into usb-next as we want those fixes here for testing
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13 19:20:27 -08:00
Mathias Nyman f69115fdbc xhci: fix usb2 resume timing and races.
According to USB 2 specs ports need to signal resume for at least 20ms,
in practice even longer, before moving to U0 state.
Both host and devices can initiate resume.

On device initiated resume, a port status interrupt with the port in resume
state in issued. The interrupt handler tags a resume_done[port]
timestamp with current time + USB_RESUME_TIMEOUT, and kick roothub timer.
Root hub timer requests for port status, finds the port in resume state,
checks if resume_done[port] timestamp passed, and set port to U0 state.

On host initiated resume, current code sets the port to resume state,
sleep 20ms, and finally sets the port to U0 state. This should also
be changed to work in a similar way as the device initiated resume, with
timestamp tagging, but that is not yet tested and will be a separate
fix later.

There are a few issues with this approach

1. A host initiated resume will also generate a resume event. The event
   handler will find the port in resume state, believe it's a device
   initiated resume, and act accordingly.

2. A port status request might cut the resume signalling short if a
   get_port_status request is handled during the host resume signalling.
   The port will be found in resume state. The timestamp is not set leading
   to time_after_eq(jiffies, timestamp) returning true, as timestamp = 0.
   get_port_status will proceed with moving the port to U0.

3. If an error, or anything else happens to the port during device
   initiated resume signalling it will leave all the device resume
   parameters hanging uncleared, preventing further suspend, returning
   -EBUSY, and cause the pm thread to busyloop trying to enter suspend.

Fix this by using the existing resuming_ports bitfield to indicate that
resume signalling timing is taken care of.
Check if the resume_done[port] is set before using it for timestamp
comparison, and also clear out any resume signalling related variables
if port is not in U0 or Resume state

This issue was discovered when a PM thread busylooped, trying to runtime
suspend the xhci USB 2 roothub on a Dell XPS

Cc: stable <stable@vger.kernel.org>
Reported-by: Daniel J Blueman <daniel@quora.org>
Tested-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-11 15:40:51 -08:00
Geyslan G. Bem 900937c037 usb: ehci: ohci: fix bool assignments
When assigning bool use true instead of 1. If declaring it as static and
it's false there's no need to initialize it, since static variables are
zeroed by default.

Caught by coccinelle.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-04 08:29:54 -08:00
Oliver Neukum 1eaf35e4dd xhci: refuse loading if nousb is used
The module should fail to load.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
CC: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-04 08:29:54 -08:00
Geyslan G. Bem debe26af03 usb: use BUG_ON() instead of BUG()
Replace BUG() with BUG_ON().

Caught by coccinelle.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-04 08:25:58 -08:00
Geyslan G. Bem 2d80b52efe usb: whci: fhci: remove comparison to bool
Get rid of bool explicit comparisons.

Caught by Coccinelle.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-04 08:25:58 -08:00
Alexandre Belloni 4a0c4c3609 USB: host: ohci-at91: fix a crash in ohci_hcd_at91_overcurrent_irq
The interrupt handler, ohci_hcd_at91_overcurrent_irq may be called right
after registration. At that time, pdev->dev.platform_data is not yet set,
leading to a NULL pointer dereference.

Fixes: e4df92279f (USB: host: ohci-at91: merge loops in ohci_hcd_at91_drv_probe)
Reported-by: Peter Rosin <peda@axentia.se>
Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: stable@vger.kernel.org # 4.3+
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-04 08:19:55 -08:00
Chunfeng Yun 096b110a3d usb: xhci: fix config fail of FS hub behind a HS hub with MTT
if a full speed hub connects to a high speed hub which
supports MTT, the MTT field of its slot context will be set
to 1 when xHCI driver setups an xHCI virtual device in
xhci_setup_addressable_virt_dev(); once usb core fetch its
hub descriptor, and need to update the xHC's internal data
structures for the device, the HUB field of its slot context
will be set to 1 too, meanwhile MTT is also set before,
this will cause configure endpoint command fail, so in the
case, we should clear MTT to 0 for full speed hub according
to section 6.2.2

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-04 08:19:55 -08:00
Mika Westerberg 84ed91526f xhci: Fix memory leak in xhci_pme_acpi_rtd3_enable()
There is a memory leak because acpi_evaluate_dsm() actually returns an
object which the caller is supposed to release. Fix this by calling
ACPI_FREE() for the returned object (this expands to kfree() so passing
NULL there is fine as well).

While there correct indentation in !CONFIG_ACPI case.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: stable <stable@vger.kernel.org> # v4.2
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-04 08:19:55 -08:00
Andy Gross c56a2b2bc6 usb: host: ehci-msm: Use posted data writes on AHB
This patch sets the AHBMODE to allow for posted data writes.  This
results in higher performance.

Signed-off-by: Andy Gross <agross@codeaurora.org>
Tested-by: Georgi Djakov <georgi.djakov@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 14:57:12 -08:00
Rafał Miłecki 9faae5a37b USB: bcma: switch to GPIO descriptor for power control
So far we were using simple (legacy) GPIO functions & some poor logic to
control power. It got many drawbacks: we were ignoring OF flags
(GPIO_ACTIVE_LOW), we were not setting direction to output and we were
assuming gpio_request success all the time.
Fix it by switching to gpiod functions and adding appropriate checks.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 14:48:26 -08:00
Alexey Khoroshilov f9fa1887dc USB: whci-hcd: add check for dma mapping error
qset_fill_page_list() do not check for dma mapping errors.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 14:45:52 -08:00
Saurabh Sengar 144e38c6be usb: host: ohci-pxa27x: use of_property_read_bool()
for checking if a property is present or not,
of_property_read_bool is more appropriate than of_get_property()

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 14:36:29 -08:00
Markus Elfring a7a19d7ab6 USB-EHCI: Delete unnecessary checks before the function call "dma_pool_destroy"
The dma_pool_destroy() function tests whether its argument is NULL
and then returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 14:26:33 -08:00
Saurabh Sengar 84c1eeb023 usb : replace dma_pool_alloc and memset with dma_pool_zalloc
replace dma_pool_alloc and memset with a single call to dma_pool_zalloc

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 14:26:33 -08:00
Mathias Nyman d5ddcdf4d6 xhci: rework xhci extended capability list parsing functions
Replace the existing two extended capability parsing helper functions with
one called xhci_find_next_ext_cap().

The extended capabilities are read both in pci-quirks before xhci driver is
loaded, and inside the xhci driver when adding ports. The existing helpers
did not suit well for these cases and a lot of custom parsing code was
needed.

The new helper function simplifies these two cases a lot.

The motivation for this rework was that code to support xhci debug
capability needed to parse extended capabilities, and it included
yet another capability parsing helper specific for its needs. With
this solution it debug capability code can use this new  helper as well

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Mathias Nyman a5da9568c5 xhci: use debug level when printing out interval rounding messages
Don't use dev_warn() for intened behaviour, use dev_dbg()

Rounding down the interval to the nearest power of 2 is required
by xhci specs.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Chunfeng Yun 0cbd4b34cd xhci: mediatek: support MTK xHCI host controller
There some vendor quirks for MTK xhci host controller:
1. It defines some extra SW scheduling parameters for HW
  to minimize the scheduling effort for synchronous and
  interrupt endpoints. The parameters are put into reseved
  DWs of slot context and endpoint context.
2. Its IMODI unit for Interrupter Moderation register is
  8 times as much as that defined in xHCI spec.
3. Its TDS in  Normal TRB defines a number of packets that
  remains to be transferred for a TD after processing all
  Max packets in all previous TRBs.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Yoshihiro Shimoda 526a240f61 usb: host: xhci-plat: add support for the R-Car H3 xHCI controllers
The R-Car H3 has two xHCI controllers. This SoC is compatible with
R-Car Gen2 SoCs, however this SoC doesn't need some specific registers
setting, and need a new firmware.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Yoshihiro Shimoda 82487b7148 usb: host: xhci-plat: add support for the R-Car M2-N xHCI controller
This patch adds support for R-Car M2-N (r8a7793) xHCI controller.
This SoC is compatible with R-Car H2 (r8a7790) and R-Car M2-W (r8a7791).

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Yoshihiro Shimoda 9bf9d9d600 usb: host: xhci-rcar: Change code for new SoCs
This patch changes code to ease the addition of next generation SoCs.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Yoshihiro Shimoda e93272fe3c usb: host: xhci-plat: add firmware_name in xhci_plat_priv
This patch adds a member "firmware_name" in struct xhci_plat_priv
to simplify the code to match specific firmware name.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Yoshihiro Shimoda 4efb2f6941 usb: host: xhci-plat: add struct xhci_plat_priv
This patch adds struct xhci_plat_priv to simplify the code to match
platform specific variables. For now, this patch adds a member "type"
in the structure.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Yoshihiro Shimoda 79a17ddf89 usb: host: xhci: add a platform-private field
This patch adds an xhci->priv field for private use by
XHCI platform drivers. Until now none of the platform drivers
has used this private space.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Yoshihiro Shimoda 32479d4b92 usb: host: xhci: cleanup hcd private size
This patch cleanups the hcd private size to suitable size.
The previous code has "sizeof(struct xhci_hcd *)" in xhci_hc_driver
as hcd_priv_size and sizeof(struct xhci_hcd) in xhci_plat_overrides
or xhci_pci_overrides as extra_priv_size. However, the xhci driver
uses a "sizeof(struct xhcd_hcd)" memory space in each hcd
(main_hcd and shared_hcd) actually.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Mathias Nyman 5e6389fda0 xhci: use the correct define to indicate port status suspend change.
use the variables defined for populating the port status and
port chage bits retuend by GetPortStatus request intead of
the hub class feature selectors.

The defines for hub class feature selectors are used for other purposes,
they work as port status and feature selectors are in the same order, and
set the same bits, but it makes the code very hard to follow

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:45:51 -08:00
Alan Stern fc0855f274 USB: EHCI: warn on unexpectedly active QH
This patch adds a new warning message to ehci-hcd.  The warning is
triggered whenever the driver finds that the hardware has set the
Active bit in a QH at a time when the driver expects the QH to be
completely idle.  Such bugs have been observed by users in the past,
and since they can lead to serious problems (such as inability to
unlink an URB that never completes), it would be good to know about
them when they occur.

This won't fix these bugs; that's a bigger job for a later patch.  But
success isn't guaranteed, since this depends on aspects of the
hardware which are not documented in the EHCI spec or for which the
spec's recommendations are clearly unworkable.  It therefore seems
worthwhile to check for these bugs proactively.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Michael Reutman <mreutman@epiqsolutions.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-01 10:44:19 -08:00