1. 17 1月, 2019 1 次提交
  2. 11 12月, 2018 1 次提交
    • M
      usb: dwc2: Fix disable all EP's on disconnect · 4fe4f9fe
      Minas Harutyunyan 提交于
      Disabling all EP's allow to reset EP's to initial state.
      Introduced new function dwc2_hsotg_ep_disable_lock() which
      before calling dwc2_hsotg_ep_disable() function acquire
      hsotg->lock and release on exiting.
      From dwc2_hsotg_ep_disable() function removed acquiring
      hsotg->lock.
      In dwc2_hsotg_core_init_disconnected() function when USB
      reset interrupt asserted disabling all ep’s by
      dwc2_hsotg_ep_disable() function.
      This updates eliminating sparse imbalance warnings.
      
      Reverted changes in dwc2_hostg_disconnect() function.
      Introduced new function dwc2_hsotg_ep_disable_lock().
      Changed dwc2_hsotg_ep_ops. Now disable point to
      dwc2_hsotg_ep_disable_lock() function.
      In functions dwc2_hsotg_udc_stop() and dwc2_hsotg_suspend()
      dwc2_hsotg_ep_disable() function replaced by
      dwc2_hsotg_ep_disable_lock() function.
      In dwc2_hsotg_ep_disable() function removed acquiring
      of hsotg->lock.
      
      Fixes: dccf1bad ("usb: dwc2: Disable all EP's on disconnect")
      Signed-off-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      4fe4f9fe
  3. 10 12月, 2018 1 次提交
  4. 05 12月, 2018 2 次提交
    • T
      usb: dwc2: host: use hrtimer for NAK retries · 6ed30a7d
      Terin Stock 提交于
      Modify the wait delay utilize the high resolution timer API to allow for
      more precisely scheduled callbacks.
      
      A previous commit added a 1ms retry delay after multiple consecutive
      NAKed transactions using jiffies. On systems with a low timer interrupt
      frequency, this delay may be significantly longer than specified,
      resulting in misbehavior with some USB devices.
      
      This scenario was reached on a Raspberry Pi 3B with a Macally FDD-USB
      floppy drive (identified as 0424:0fdc Standard Microsystems Corp.
      Floppy, based on the USB97CFDC USB FDC). With the relay delay, the drive
      would be unable to mount a disk, replying with NAKs until the device was
      reset.
      
      Using ktime, the delta between starting the timer (in dwc2_hcd_qh_add)
      and the callback function can be determined. With the original delay
      implementation, this value was consistently approximately 12ms. (output
      in us).
      
          <idle>-0     [000] ..s.  1600.559974: dwc2_wait_timer_fn: wait_timer delta: 11976
          <idle>-0     [000] ..s.  1600.571974: dwc2_wait_timer_fn: wait_timer delta: 11977
          <idle>-0     [000] ..s.  1600.583974: dwc2_wait_timer_fn: wait_timer delta: 11976
          <idle>-0     [000] ..s.  1600.595974: dwc2_wait_timer_fn: wait_timer delta: 11977
      
      After converting the relay delay to using a higher resolution timer, the
      delay was much closer to 1ms.
      
          <idle>-0     [000] d.h.  1956.553017: dwc2_wait_timer_fn: wait_timer delta: 1002
          <idle>-0     [000] d.h.  1956.554114: dwc2_wait_timer_fn: wait_timer delta: 1002
          <idle>-0     [000] d.h.  1957.542660: dwc2_wait_timer_fn: wait_timer delta: 1004
          <idle>-0     [000] d.h.  1957.543701: dwc2_wait_timer_fn: wait_timer delta: 1002
      
      The floppy drive operates properly with delays up to approximately 5ms,
      and sends NAKs for any delays that are longer.
      
      Fixes: 38d2b5fb ("usb: dwc2: host: Don't retry NAKed transactions right away")
      Cc: <stable@vger.kernel.org>
      Reviewed-by: NDouglas Anderson <dianders@chromium.org>
      Acked-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NTerin Stock <terin@terinstock.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      6ed30a7d
    • M
      usb: dwc2: Disable power down feature on Samsung SoCs · 35a60541
      Marek Szyprowski 提交于
      Power down feature of DWC2 module integrated in Samsung SoCs doesn't work
      properly or needs some additional handling in PHY or SoC glue layer, so
      disable it for now. Without disabling power down, DWC2 causes random memory
      trashes and fails enumeration if there is no USB link to host on driver
      probe.
      
      Fixes: 03ea6d6e ("usb: dwc2: Enable power down")
      Acked-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      35a60541
  5. 26 11月, 2018 2 次提交
  6. 14 11月, 2018 1 次提交
  7. 05 10月, 2018 1 次提交
    • S
      usb: dwc2: disable power_down on rockchip devices · c216765d
      SolidHal 提交于
       The bug would let the usb controller enter partial power down,
       which was formally known as hibernate, upon boot if nothing was plugged
       in to the port. Partial power down couldn't be exited properly, so any
       usb devices plugged in after boot would not be usable.
      
       Before the name change, params.hibernation was false by default, so
       _dwc2_hcd_suspend() would skip entering hibernation. With the
       rename, _dwc2_hcd_suspend() was changed to use  params.power_down
       to decide whether or not to enter partial power down.
      
       Since params.power_down is non-zero by default, it needs to be set
       to 0 for rockchip devices to restore functionality.
      
       This bug was reported in the linux-usb thread:
       REGRESSION: usb: dwc2: USB device not seen after boot
      
       The commit that caused this regression is:
      6d23ee9cSigned-off-by: NSolidHal <hal@halemmerich.com>
      Acked-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      c216765d
  8. 02 10月, 2018 15 次提交
  9. 05 9月, 2018 1 次提交
  10. 30 7月, 2018 8 次提交
  11. 26 7月, 2018 1 次提交
  12. 17 7月, 2018 4 次提交
    • A
      usb: dwc2: Fix inefficient copy of unaligned buffers · 1e111e88
      Antti Seppälä 提交于
      Make sure only to copy any actual data rather than the whole buffer,
      when releasing the temporary buffer used for unaligned non-isochronous
      transfers.
      
      Taken directly from commit 0efd937e ("USB: ehci-tegra: fix inefficient
      copy of unaligned buffers")
      
      Tested with Lantiq xRX200 (MIPS) and RPi Model B Rev 2 (ARM)
      Reviewed-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NAntti Seppälä <a.seppala@gmail.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      1e111e88
    • A
      usb: dwc2: Fix DMA alignment to start at allocated boundary · 56406e01
      Antti Seppälä 提交于
      The commit 3bc04e28 ("usb: dwc2: host: Get aligned DMA in a more
      supported way") introduced a common way to align DMA allocations.
      The code in the commit aligns the struct dma_aligned_buffer but the
      actual DMA address pointed by data[0] gets aligned to an offset from
      the allocated boundary by the kmalloc_ptr and the old_xfer_buffer
      pointers.
      
      This is against the recommendation in Documentation/DMA-API.txt which
      states:
      
        Therefore, it is recommended that driver writers who don't take
        special care to determine the cache line size at run time only map
        virtual regions that begin and end on page boundaries (which are
        guaranteed also to be cache line boundaries).
      
      The effect of this is that architectures with non-coherent DMA caches
      may run into memory corruption or kernel crashes with Unhandled
      kernel unaligned accesses exceptions.
      
      Fix the alignment by positioning the DMA area in front of the allocation
      and use memory at the end of the area for storing the orginal
      transfer_buffer pointer. This may have the added benefit of increased
      performance as the DMA area is now fully aligned on all architectures.
      
      Tested with Lantiq xRX200 (MIPS) and RPi Model B Rev 2 (ARM).
      
      Fixes: 3bc04e28 ("usb: dwc2: host: Get aligned DMA in a more supported way")
      Cc: <stable@vger.kernel.org>
      Reviewed-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NAntti Seppälä <a.seppala@gmail.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      56406e01
    • J
      usb: dwc2: avoid NULL dereferences · 89066b36
      John Keeping 提交于
      For unidirectional endpoints, the endpoint pointer will be NULL for the
      unused direction.  Check that the endpoint is active before
      dereferencing this pointer.
      
      Fixes: 1b4977c7 ("usb: dwc2: Update dwc2_handle_incomplete_isoc_in() function")
      Fixes: 689efb26 ("usb: dwc2: Update dwc2_handle_incomplete_isoc_out() function")
      Fixes: d8484552 ("usb: dwc2: Update GINTSTS_GOUTNAKEFF interrupt handling")
      Signed-off-by: NJohn Keeping <john@metanate.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      89066b36
    • D
      usb: dwc2: host: do not delay retries for CONTROL IN transfers · b3eb981b
      Dmitry Torokhov 提交于
      When handling split transactions we will try to delay retry after
      getting a NAK from the device. This works well for BULK transfers that
      can be polled for essentially forever. Unfortunately, on slower systems
      at boot time, when the kernel is busy enumerating all the devices (USB
      or not), we issue a bunch of control requests (reading device
      descriptors, etc). If we get a NAK for the IN part of the control
      request and delay retry for too long (because the system is busy), we
      may confuse the device when we finally get to reissue SSPLIT/CSPLIT IN
      and the device will respond with STALL. As a result we end up with
      failure to get device descriptor and will fail to enumerate the device:
      
      [    3.428801] usb 2-1.2.1: new full-speed USB device number 9 using dwc2
      [    3.508576] usb 2-1.2.1: device descriptor read/8, error -32
      [    3.699150] usb 2-1.2.1: device descriptor read/8, error -32
      [    3.891653] usb 2-1.2.1: new full-speed USB device number 10 using dwc2
      [    3.968859] usb 2-1.2.1: device descriptor read/8, error -32
      ...
      
      Let's not delay retries of split CONTROL IN transfers, as this allows us
      to reliably enumerate devices at boot time.
      
      Fixes: 38d2b5fb ("usb: dwc2: host: Don't retry NAKed transactions right away")
      Reviewed-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      b3eb981b
  13. 19 6月, 2018 2 次提交