1. 15 1月, 2015 2 次提交
    • A
      usb: dwc3: gadget: Stop TRB preparation after limit is reached · 39e60635
      Amit Virdi 提交于
      DWC3 gadget sets up a pool of 32 TRBs for each EP during initialization. This
      means, the max TRBs that can be submitted for an EP is fixed to 32. Since the
      request queue for an EP is a linked list, any number of requests can be queued
      to it by the gadget layer.  However, the dwc3 driver must not submit TRBs more
      than the pool it has created for. This limit wasn't respected when SG was used
      resulting in submitting more than the max TRBs, eventually leading to
      non-transfer of the TRBs submitted over the max limit.
      
      Root cause:
      When SG is used, there are two loops iterating to prepare TRBs:
       - Outer loop over the request_list
       - Inner loop over the SG list
      The code was missing break to get out of the outer loop.
      
      Fixes: eeb720fb (usb: dwc3: gadget: add support for SG lists)
      Cc: <stable@vger.kernel.org> # v3.9+
      Signed-off-by: NAmit Virdi <amit.virdi@st.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      39e60635
    • A
      usb: dwc3: gadget: Fix TRB preparation during SG · ec512fb8
      Amit Virdi 提交于
      When scatter gather (SG) is used, multiple TRBs are prepared from one DWC3
      request (dwc3_request). So while preparing TRBs, the 'last' flag should be set
      only when it is the last TRB being prepared from the last dwc3_request entry.
      
      The current implementation uses list_is_last to check if the dwc3_request is the
      last entry from the request_list. However, list_is_last returns false for the
      last entry too. This is because, while preparing the first TRB from a request,
      the function dwc3_prepare_one_trb modifies the request's next and prev pointers
      while moving the URB to req_queued. Hence, list_is_last always returns false no
      matter what.
      
      The correct way is not to access the modified pointers of dwc3_request but to
      use list_empty macro instead.
      
      Fixes: e5ba5ec8 (usb: dwc3: gadget: fix scatter gather implementation)
      Signed-off-by: NAmit Virdi <amit.virdi@st.com>
      Cc: <stable@vger.kernel.org> # v3.9+
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      ec512fb8
  2. 11 11月, 2014 1 次提交
  3. 04 11月, 2014 6 次提交
    • H
      usb: dwc3: make HIRD threshold configurable · 460d098c
      Huang Rui 提交于
      HIRD threshold should be configurable by different platforms.
      
      From DesignWare databook:
      When HIRD_Threshold[4] is set to 1b1 and HIRD value is greater than or
      equal to the value in HIRD_Threshold[3:0], dwc3 asserts output signals
      utmi_l1_suspend_n to put PHY into Deep Low-Power mode in L1.
      
      When HIRD_Threshold[4] is set to 1b0 or the HIRD value is less than
      HIRD_Threshold[3:0], dwc3 asserts output signals utmi_sleep_n on L1.
      Signed-off-by: NHuang Rui <ray.huang@amd.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      460d098c
    • H
      usb: dwc3: add lpm erratum support · 80caf7d2
      Huang Rui 提交于
      When parameter DWC_USB3_LPM_ERRATA_ENABLE is enabled in Andvanced
      Configuration of coreConsultant, it supports of xHCI BESL Errata Dated
      10/19/2011 is enabled in host mode. In device mode it adds the capability
      to send NYET response threshold based on the BESL value received in the LPM
      token, and the threhold is configurable for each soc platform.
      
      This patch adds an entry that soc platform is able to define the lpm
      capacity with their own device tree or bus glue layer.
      
      [ balbi@ti.com : added devicetree documentation, spelled threshold
      		completely, made sure threshold is only applied to
      		proper core revisions. ]
      Signed-off-by: NHuang Rui <ray.huang@amd.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      80caf7d2
    • F
      usb: gadget: remove unnecessary 'driver' argument · 22835b80
      Felipe Balbi 提交于
      now that no UDC driver relies on the extra
      'driver' argument to ->udc_stop(), we can
      safely remove it.
      
      This commit is based on previous work by
      Robert Baldyga <r.baldyga@samsung.com> which
      can be found at [1]; however that patch turned
      out to have a high probability of regressing
      many UDC drivers because of a blind search & replace
      s/driver/$udc->driver/ which caused the 'driver'
      argument to stop_activity() to be a valid non-NULL
      pointer when it should be NULL, thus causing UDCs
      to mistakenly call gadget driver's ->disconnect()
      callback.
      
      [1] http://markmail.org/message/x5zneg4xea4zntabAcked-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      22835b80
    • F
      usb: dwc3: gadget: WARN() on bogus usb_ep_queue() · 73359cef
      Felipe Balbi 提交于
      Some gadget/function drivers might want to do
      improper request recycling by allocating a single
      request from one particular endpoint and queueing
      it to another completely unrelated endpoint.
      
      One such case was found with f_loopback.c.
      
      To prevent such cases from happening again, let's
      WARN() so we get a loud enough failure and persuade
      users to report errors.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      73359cef
    • F
      usb: dwc3: gadget: set state to NOT_ATTACHED on disconnect_irq · 06a374ed
      Felipe Balbi 提交于
      whenever we get a Disconnect Interrupt, we should
      make sure to update out udc state to NOT_ATTACHED,
      otherwise sysfs will show wrong values.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      06a374ed
    • F
      usb: dwc3: get rid of ->prepare()/->complete() · 0b0231aa
      Felipe Balbi 提交于
      Using ->prepare()/->complete() to mask/unmask
      IRQs is wrong at least for dwc3. We need to
      make sure that by the end of ->resume(), IRQs
      are working and ready to fire because a child
      device may need working IRQs for its own ->resume()
      method.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      0b0231aa
  4. 24 10月, 2014 1 次提交
    • J
      usb: dwc3: gadget: Properly initialize LINK TRB · 1200a82a
      Jack Pham 提交于
      On ISOC endpoints the last trb_pool entry used as a
      LINK TRB is not getting zeroed out correctly due to
      memset being called incorrectly and in the wrong place.
      If pool allocated from DMA was not zero-initialized
      to begin with this will result in the size and ctrl
      values being random garbage. Call memset correctly after
      assignment of the trb_link pointer.
      
      Fixes: f6bafc6a ("usb: dwc3: convert TRBs into bitshifts")
      Cc: <stable@vger.kernel.org> # v3.4+
      Signed-off-by: NJack Pham <jackp@codeaurora.org>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      1200a82a
  5. 21 10月, 2014 3 次提交
  6. 25 9月, 2014 1 次提交
  7. 05 9月, 2014 4 次提交
  8. 04 9月, 2014 1 次提交
  9. 21 8月, 2014 1 次提交
  10. 10 7月, 2014 1 次提交
  11. 19 6月, 2014 1 次提交
  12. 15 5月, 2014 1 次提交
  13. 26 4月, 2014 3 次提交
  14. 16 4月, 2014 2 次提交
  15. 08 3月, 2014 2 次提交
  16. 06 3月, 2014 5 次提交
  17. 05 3月, 2014 4 次提交
  18. 18 12月, 2013 1 次提交
    • R
      usb: gadget: add "maxpacket_limit" field to struct usb_ep · e117e742
      Robert Baldyga 提交于
      This patch adds "maxpacket_limit" to struct usb_ep. This field contains
      maximum value of maxpacket supported by driver, and is set in driver probe.
      This value should be used by autoconfig() function, because value of field
      "maxpacket" is set to value from endpoint descriptor when endpoint becomes
      enabled. So when autoconfig() function will be called again for this endpoint,
      "maxpacket" value will contain wMaxPacketSize from descriptior instead of
      maximum packet size for this endpoint.
      
      For this reason this patch adds new field "maxpacket_limit" which contains
      value of maximum packet size (which defines maximum endpoint capabilities).
      This value is used in ep_matches() function used by autoconfig().
      
      Value of "maxpacket_limit" should be set in UDC driver probe function, using
      usb_ep_set_maxpacket_limit() function, defined in gadget.h. This function
      set choosen value to both "maxpacket_limit" and "maxpacket" fields.
      
      This patch modifies UDC drivers by adding support for maxpacket_limit.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      e117e742