1. 02 6月, 2016 4 次提交
    • M
      xhci: fix platform quirks overwrite regression in 4.7-rc1 · 757de492
      Mathias Nyman 提交于
      commit b1c127ae ("usb: host: xhci: plat: make use of new methods in
      xhci_plat_priv") sets xhci->quirks before calling xhci_gen_setup(), which
      will overwrite them.
      
      Don't overwite the quirks, just add the new ones
      
      Fixes: b1c127ae ("usb: host: xhci: plat: make use of new methods in xhci_plat_priv")
      Reported-by: NYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      757de492
    • T
      usb: xhci-plat: properly handle probe deferral for devm_clk_get() · de95c40d
      Thomas Petazzoni 提交于
      On some platforms, the clocks might be registered by a platform
      driver. When this is the case, the clock platform driver may very well
      be probed after xhci-plat, in which case the first probe() invocation
      of xhci-plat will receive -EPROBE_DEFER as the return value of
      devm_clk_get().
      
      The current code handles that as a normal error, and simply assumes
      that this means that the system doesn't have a clock for the XHCI
      controller, and continues probing without calling
      clk_prepare_enable(). Unfortunately, this doesn't work on systems
      where the XHCI controller does have a clock, but that clock is
      provided by another platform driver. In order to fix this situation,
      we handle the -EPROBE_DEFER error condition specially, and abort the
      XHCI controller probe(). It will be retried later automatically, the
      clock will be available, devm_clk_get() will succeed, and the probe()
      will continue with the clock prepared and enabled as expected.
      
      In practice, such issue is seen on the ARM64 Marvell 7K/8K platform,
      where the clocks are registered by a platform driver.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      de95c40d
    • M
      xhci: Fix handling timeouted commands on hosts in weird states. · 3425aa03
      Mathias Nyman 提交于
      If commands timeout we mark them for abortion, then stop the command
      ring, and turn the commands to no-ops and finally restart the command
      ring.
      
      If the host is working properly the no-op commands will finish and
      pending completions are called.
      If we notice the host is failing, driver clears the command ring and
      completes, deletes and frees all pending commands.
      
      There are two separate cases reported where host is believed to work
      properly but is not. In the first case we successfully stop the ring
      but no abort or stop command ring event is ever sent and host locks up.
      
      The second case is if a host is removed, command times out and driver
      believes the ring is stopped, and assumes it will be restarted, but
      actually ends up timing out on the same command forever.
      If one of the pending commands has the xhci->mutex held it will block
      xhci_stop() in the remove codepath which otherwise would cleanup pending
      commands.
      
      Add a check that clears all pending commands in case host is removed,
      or we are stuck timing out on the same command. Also restart the
      command timeout timer when stopping the command ring to ensure we
      recive an ring stop/abort event.
      
      Cc: stable <stable@vger.kernel.org>
      Tested-by: NJoe Lawrence <joe.lawrence@stratus.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3425aa03
    • G
      xhci: Cleanup only when releasing primary hcd · 27a41a83
      Gabriel Krisman Bertazi 提交于
      Under stress occasions some TI devices might not return early when
      reading the status register during the quirk invocation of xhci_irq made
      by usb_hcd_pci_remove.  This means that instead of returning, we end up
      handling this interruption in the middle of a shutdown.  Since
      xhci->event_ring has already been freed in xhci_mem_cleanup, we end up
      accessing freed memory, causing the Oops below.
      
      commit 8c24d6d7 ("usb: xhci: stop everything on the first call to
      xhci_stop") is the one that changed the instant in which we clean up the
      event queue when stopping a device.  Before, we didn't call
      xhci_mem_cleanup at the first time xhci_stop is executed (for the shared
      HCD), instead, we only did it after the invocation for the primary HCD,
      much later at the removal path.  The code flow for this oops looks like
      this:
      
      xhci_pci_remove()
      	usb_remove_hcd(xhci->shared)
      	        xhci_stop(xhci->shared)
       			xhci_halt()
      			xhci_mem_cleanup(xhci);  // Free the event_queue
      	usb_hcd_pci_remove(primary)
      		xhci_irq()  // Access the event_queue if STS_EINT is set. Crash.
      		xhci_stop()
      			xhci_halt()
      			// return early
      
      The fix modifies xhci_stop to only cleanup the xhci data when releasing
      the primary HCD.  This way, we still have the event_queue configured
      when invoking xhci_irq.  We still halt the device on the first call to
      xhci_stop, though.
      
      I could reproduce this issue several times on the mainline kernel by
      doing a bind-unbind stress test with a specific storage gadget attached.
      I also ran the same test over-night with my patch applied and didn't
      observe the issue anymore.
      
      [  113.334124] Unable to handle kernel paging request for data at address 0x00000028
      [  113.335514] Faulting instruction address: 0xd00000000d4f767c
      [  113.336839] Oops: Kernel access of bad area, sig: 11 [#1]
      [  113.338214] SMP NR_CPUS=1024 NUMA PowerNV
      
      [c000000efe47ba90] c000000000720850 usb_hcd_irq+0x50/0x80
      [c000000efe47bac0] c00000000073d328 usb_hcd_pci_remove+0x68/0x1f0
      [c000000efe47bb00] d00000000daf0128 xhci_pci_remove+0x78/0xb0
      [xhci_pci]
      [c000000efe47bb30] c00000000055cf70 pci_device_remove+0x70/0x110
      [c000000efe47bb70] c00000000061c6bc __device_release_driver+0xbc/0x190
      [c000000efe47bba0] c00000000061c7d0 device_release_driver+0x40/0x70
      [c000000efe47bbd0] c000000000619510 unbind_store+0x120/0x150
      [c000000efe47bc20] c0000000006183c4 drv_attr_store+0x64/0xa0
      [c000000efe47bc60] c00000000039f1d0 sysfs_kf_write+0x80/0xb0
      [c000000efe47bca0] c00000000039e14c kernfs_fop_write+0x18c/0x1f0
      [c000000efe47bcf0] c0000000002e962c __vfs_write+0x6c/0x190
      [c000000efe47bd90] c0000000002eab40 vfs_write+0xc0/0x200
      [c000000efe47bde0] c0000000002ec85c SyS_write+0x6c/0x110
      [c000000efe47be30] c000000000009260 system_call+0x38/0x108
      Signed-off-by: NGabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
      Cc: Roger Quadros <rogerq@ti.com>
      Cc: joel@jms.id.au
      Cc: stable@vger.kernel.org
      Reviewed-by: NRoger Quadros <rogerq@ti.com>
      Cc: <stable@vger.kernel.org> #v4.3+
      Tested-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27a41a83
  2. 14 5月, 2016 1 次提交
  3. 09 5月, 2016 3 次提交
  4. 30 4月, 2016 1 次提交
  5. 29 4月, 2016 3 次提交
  6. 27 4月, 2016 11 次提交
  7. 19 4月, 2016 2 次提交
  8. 14 4月, 2016 7 次提交
  9. 04 3月, 2016 8 次提交
    • A
      usb: fsl: drop USB_FSL_MPH_DR_OF Kconfig symbol · d0fc35bc
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      d0fc35bc
    • V
      usb: ohci: nxp: remove USB PLL and USB OTG clock management · 83253b3b
      Vladimir Zapolskiy 提交于
      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: NVladimir Zapolskiy <vz@mleia.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      83253b3b
    • V
      usb: ohci: nxp: remove direct access to clock controller registers · fe54d9ba
      Vladimir Zapolskiy 提交于
      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: NVladimir Zapolskiy <vz@mleia.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fe54d9ba
    • A
      usb: ehci-atmel: use __maybe_unused to hide pm functions · 9fc7c85d
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fc7c85d
    • A
      usb: ohci-at91: use __maybe_unused to hide pm functions · d2905193
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d2905193
    • A
      usb: xhci-mtk: use __maybe_unused to hide pm functions · 8dac5300
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8dac5300
    • A
      usb: host: unhide suspend/resume declarations · c88d4df2
      Arnd Bergmann 提交于
      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: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c88d4df2
    • G
      usb: host: Host drivers relying on DMA should depend on HAS_DMA · cf34be7a
      Geert Uytterhoeven 提交于
      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: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cf34be7a