1. 11 4月, 2017 2 次提交
    • B
      usb: dwc3: refactor gadget endpoint count calculation · 47d3946e
      Bryan O'Donoghue 提交于
      - DWC_USB3_NUM indicates the number of Device mode single directional
        endpoints, including OUT and IN endpoint 0.
      
      - DWC_USB3_NUM_IN_EPS indicates the maximum number of Device mode IN
        endpoints active at any time, including control endpoint 0.
      
      It's possible to configure RTL such that DWC_USB3_NUM_EPS is equal to
      DWC_USB3_NUM_IN_EPS.
      
      dwc3-core calculates the number of OUT endpoints as DWC_USB3_NUM minus
      DWC_USB3_NUM_IN_EPS. If RTL has been configured with DWC_USB3_NUM_IN_EPS
      equal to DWC_USB3_NUM then dwc3-core will calculate the number of OUT
      endpoints as zero.
      
      For example a from dwc3_core_num_eps() shows:
      [    1.565000]  /usb0@f01d0000: found 8 IN and 0 OUT endpoints
      
      This patch refactors the endpoint calculation down to one variable
      dwc->num_eps taking care to maintain the current mapping of endpoints for
      fixed FPGA configurations as described in Table 4-7 of version 2.60a of the
      DWC USB3 databook.
      
      The endpoint mapping will then be EP-OUT, EP-IN etc, up to DWC_USB3_NUM.
      If DWC_USB3_NUM is odd then OUT will take the extra endpoint.
      Suggested-by: NFelipe Balbi <balbi@kernel.org>
      Signed-off-by: NBryan O'Donoghue <pure.logic@nexus-software.ie>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      47d3946e
    • R
      usb: dwc3: make macros safe to expression arguments · 8261bd4e
      Roger Quadros 提交于
      We must make sure that our macros are safe against expressions passed
      as arguments. We have seen one problem where GTXFIFOSIZ(n) was failing
      when passed the expression (epnum >> 1) as argument. The problem was
      caused by operator precedence between >> and *.
      
      To make sure macros are safe, we just wrap argument with () when using
      it.
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      8261bd4e
  2. 27 3月, 2017 2 次提交
  3. 22 3月, 2017 1 次提交
  4. 08 3月, 2017 1 次提交
  5. 06 3月, 2017 5 次提交
    • R
      usb: dwc3-omap: Fix missing break in dwc3_omap_set_mailbox() · 0913750f
      Roger Quadros 提交于
      We need to break from all cases if we want to treat
      each one of them separately.
      Reported-by: NGustavo A. R. Silva <garsilva@embeddedor.com>
      Fixes: d2728fb3 ("usb: dwc3: omap: Pass VBUS and ID events transparently")
      Cc: <stable@vger.kernel.org> #v4.8+
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      0913750f
    • R
      usb: dwc3: gadget: Fix system suspend/resume on TI platforms · 1551e35e
      Roger Quadros 提交于
      On TI platforms (dra7, am437x), the DWC3_DSTS_DEVCTRLHLT bit is not set
      after the device controller is stopped via DWC3_DCTL_RUN_STOP.
      
      If we don't disconnect and stop the gadget, it stops working after a
      system resume with the trace below.
      
      There is no point in preventing gadget disconnect and gadget stop during
      system suspend/resume as we're going to suspend in any case, whether
      DEVCTRLHLT timed out or not.
      
      [  141.727480] ------------[ cut here ]------------
      [  141.732349] WARNING: CPU: 1 PID: 2135 at drivers/usb/dwc3/gadget.c:2384 dwc3_stop_active_transfer.constprop.4+0xc4/0xe4 [dwc3]
      [  141.744299] Modules linked in: usb_f_ss_lb g_zero libcomposite xhci_plat_hcd xhci_hcd usbcore dwc3 evdev udc_core m25p80 usb_common spi_nor snd_soc_davinci_mcasp snd_soc_simple_card snd_soc_edma snd_soc_tlv3e
      [  141.792163] CPU: 1 PID: 2135 Comm: irq/456-dwc3 Not tainted 4.10.0-rc8 #1138
      [  141.799547] Hardware name: Generic DRA74X (Flattened Device Tree)
      [  141.805940] [<c01101b4>] (unwind_backtrace) from [<c010c31c>] (show_stack+0x10/0x14)
      [  141.814066] [<c010c31c>] (show_stack) from [<c04a0918>] (dump_stack+0xac/0xe0)
      [  141.821648] [<c04a0918>] (dump_stack) from [<c013708c>] (__warn+0xd8/0x104)
      [  141.828955] [<c013708c>] (__warn) from [<c0137164>] (warn_slowpath_null+0x20/0x28)
      [  141.836902] [<c0137164>] (warn_slowpath_null) from [<bf27784c>] (dwc3_stop_active_transfer.constprop.4+0xc4/0xe4 [dwc3])
      [  141.848329] [<bf27784c>] (dwc3_stop_active_transfer.constprop.4 [dwc3]) from [<bf27ab14>] (__dwc3_gadget_ep_disable+0x64/0x528 [dwc3])
      [  141.861034] [<bf27ab14>] (__dwc3_gadget_ep_disable [dwc3]) from [<bf27c27c>] (dwc3_gadget_ep_disable+0x3c/0xc8 [dwc3])
      [  141.872280] [<bf27c27c>] (dwc3_gadget_ep_disable [dwc3]) from [<bf23b428>] (usb_ep_disable+0x11c/0x18c [udc_core])
      [  141.883160] [<bf23b428>] (usb_ep_disable [udc_core]) from [<bf342774>] (disable_ep+0x18/0x54 [usb_f_ss_lb])
      [  141.893408] [<bf342774>] (disable_ep [usb_f_ss_lb]) from [<bf3437b0>] (disable_endpoints+0x18/0x50 [usb_f_ss_lb])
      [  141.904168] [<bf3437b0>] (disable_endpoints [usb_f_ss_lb]) from [<bf343814>] (disable_source_sink+0x2c/0x34 [usb_f_ss_lb])
      [  141.915771] [<bf343814>] (disable_source_sink [usb_f_ss_lb]) from [<bf329a9c>] (reset_config+0x48/0x7c [libcomposite])
      [  141.927012] [<bf329a9c>] (reset_config [libcomposite]) from [<bf329afc>] (composite_disconnect+0x2c/0x54 [libcomposite])
      [  141.938444] [<bf329afc>] (composite_disconnect [libcomposite]) from [<bf23d7dc>] (usb_gadget_udc_reset+0x10/0x34 [udc_core])
      [  141.950237] [<bf23d7dc>] (usb_gadget_udc_reset [udc_core]) from [<bf276d70>] (dwc3_gadget_reset_interrupt+0x64/0x698 [dwc3])
      [  141.962022] [<bf276d70>] (dwc3_gadget_reset_interrupt [dwc3]) from [<bf27952c>] (dwc3_thread_interrupt+0x618/0x1a3c [dwc3])
      [  141.973723] [<bf27952c>] (dwc3_thread_interrupt [dwc3]) from [<c01a7ce8>] (irq_thread_fn+0x1c/0x54)
      [  141.983215] [<c01a7ce8>] (irq_thread_fn) from [<c01a7fbc>] (irq_thread+0x120/0x1f0)
      [  141.991247] [<c01a7fbc>] (irq_thread) from [<c015ba14>] (kthread+0xf8/0x138)
      [  141.998641] [<c015ba14>] (kthread) from [<c01078f0>] (ret_from_fork+0x14/0x24)
      [  142.006213] ---[ end trace b4ecfe9f175b9a9c ]---
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      1551e35e
    • F
      usb: dwc3: Fix incorrect type for utmi mode · 73561128
      Franck Demathieu 提交于
      The utmi mode is unsigned according the dt-bindings.
      Fix sparse issue (-Wtypesign):
      
        drivers/usb/dwc3/dwc3-omap.c:391:50: warning: incorrect type in argument 3 (different signedness)
        drivers/usb/dwc3/dwc3-omap.c:391:50:    expected unsigned int [usertype] *out_value
        drivers/usb/dwc3/dwc3-omap.c:391:50:    got int *<noident>
      Signed-off-by: NFranck Demathieu <fdemathieu@gmail.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      73561128
    • F
      usb: dwc3: gadget: properly increment dequeue pointer on ep_dequeue · cf3113d8
      Felipe Balbi 提交于
      If request was already started, this means we had to
      stop the transfer. With that we also need to ignore
      all TRBs used by the request, however TRBs can only
      be modified after completion of END_TRANSFER
      command. So what we have to do here is wait for
      END_TRANSFER completion and only after that jump
      over TRBs by clearing HWO and incrementing dequeue
      pointer.
      
      Note that we have 2 possible types of transfers
      here:
      
      i) Linear buffer request
      ii) SG-list based request
      
      SG-list based requests will have r->num_pending_sgs
      set to a valid number (> 0). Linear requests,
      normally use a single TRB.
      
      For each of these two cases, if r->unaligned flag is
      set, one extra TRB has been used to align transfer
      size to wMaxPacketSize.
      
      All of these cases need to be taken into
      consideration so we don't mess up our TRB ring
      pointers.
      Tested-by: NJanusz Dziedzic <januszx.dziedzic@intel.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      cf3113d8
    • F
      usb: dwc3: gadget: make Set Endpoint Configuration macros safe · 7369090a
      Felipe Balbi 提交于
      Some gadget drivers are bad, bad boys. We notice
      that ADB was passing bad Burst Size which caused top
      bits of param0 to be overwritten which confused DWC3
      when running this command.
      
      In order to avoid future issues, we're going to make
      sure values passed by macros are always safe for the
      controller. Note that ADB still needs a fix to *not*
      pass bad values.
      
      Cc: <stable@vger.kernel.org> # v3.2+
      Reported-by: NMohamed Abbas <mohamed.abbas@intel.com>
      Sugested-by: NAdam Andruszak <adam.andruszak@intel.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      7369090a
  6. 26 1月, 2017 1 次提交
  7. 25 1月, 2017 1 次提交
  8. 24 1月, 2017 9 次提交
  9. 12 1月, 2017 1 次提交
  10. 03 1月, 2017 1 次提交
  11. 02 1月, 2017 9 次提交
  12. 14 12月, 2016 1 次提交
  13. 18 11月, 2016 6 次提交