1. 18 3月, 2013 4 次提交
  2. 18 1月, 2013 5 次提交
    • V
      usb: dwc3: remove dwc3 dependency on host AND gadget. · 388e5c51
      Vivek Gautam 提交于
      DWC3 controller curretly depends on USB && USB_GADGET.
      Some hardware may like to use only host feature on dwc3,
      or only gadget feature.
      
      So, removing this dependency of USB_DWC3 on USB and USB_GADGET.
      Adding the mode of operaiton of DWC3 also here
      HOST/GADGET/DUAL_ROLE based on which features are enabled.
      
      [ balbi@ti.com :
      	. make sure we have default modes for all possible Kernel
      		configurations.
      	. Remove the config -> menuconfig change as it's unnecessary
      	. switch over to IS_ENABLED() ]
      
      CC: Doug Anderson <dianders@chromium.org>
      Signed-off-by: NVivek Gautam <gautam.vivek@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      388e5c51
    • P
      usb: dwc3: gadget: fix scatter gather implementation · e5ba5ec8
      Pratyush Anand 提交于
      To work with scatter gather properly, fixes have been done in number of
      functions. I will explain requirement of each fixes one by one.
      
      start_slot: used to retrieve all request of SG during cleanup
      
      dwc3_gadget_giveback: We need to skip link TRB if it was one of the
      intermediate TRB of SG.
      
      dwc3_prepare_one_trb: We need to track all submitted TRBs during
      cleanup. Since, all TRBs would be serially allocated, so we can just
      keep starting slot info and we can always find rest of them. We need to
      pass sg node number, so that we cab appropriately program ISOC_FIRST/ISOC,
      Chain etc.
      
      dwc3_prepare_trbs: last_one should be set when it is last node
      of SG as well as last node of request_list.
      
      __dwc3_cleanup_done_trbs: It has been prepared after re-factorization of
      dwc3_cleanup_done_reqs. It is called for each TRB of SG.
      Signed-off-by: NPratyush Anand <pratyush.anand@st.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      e5ba5ec8
    • P
      usb: dwc3: gadget: fix missed isoc · 7efea86c
      Pratyush Anand 提交于
      There are two reasons to generate missed isoc.
      
      1. when the host does not poll for all the data.
      2. because of application-side delays that prevent all the data from
      being transferred in programmed microframe.
      
      Current code was able to handle first case only.  This patch handles
      scenario 2 as well.Scenario 2 sometime may occur with complex gadget
      application, however it can be easily reproduced for testing purpose as
      follows:
      
      a. use isoc binterval as 1 in f_sourcesink.
      b. use pattern=0
      c. introduce a delay of 150us deliberately in source_sink_complete, so
      that after few frames it lands into scenario 2.
      d. now run testusb 16 (isoc in  test). You will notice that if this
      patch is not applied then isoc transfer is not able to recover after
      first missed.
      
      Current patch's approach is as under:
      
      If missed isoc occurs and there is no request queued then issue END
      TRANSFER, so that core generates next xfernotready and we will issue a
      fresh START TRANSFER.
      If there are still queued request then wait, do not issue either END or
      UPDATE TRANSFER, just attach next request in request_list during giveback.
      If any future queued request is successfully transferred then we will issue
      UPDATE TRANSFER for all request in the request_list.
      
      Cc: <stable@vger.kernel.org> # v3.6 v3.7 v3.8
      Signed-off-by: NPratyush Anand <pratyush.anand@st.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      7efea86c
    • F
      usb: dwc3: debugfs: convert our regdump to use regsets · d7668024
      Felipe Balbi 提交于
      regset is a generic implementation of regdump
      utility through debugfs.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      d7668024
    • F
      usb: dwc3: decrease event buffer size · 5da93478
      Felipe Balbi 提交于
      Currently we're allocating an entire page to
      serve as our event buffer. Provided our events
      are 4 bytes long, it's very unlikely we will
      even trigger 1k events at once.
      
      Even in the worst case scenario where every
      endpoint triggers one event and we still have
      a couple of error events, that would still
      be less than 40 events.
      
      In order to cope with future versions of the
      IP which could (or could not) increase the
      amount of possible events to trigger
      simultaneously, we're using an arbitrary size
      of 64 events for our event buffer.
      
      We're saving 3840 bytes by doing so.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      5da93478
  3. 31 10月, 2012 1 次提交
  4. 11 9月, 2012 1 次提交
  5. 03 8月, 2012 1 次提交
  6. 25 6月, 2012 1 次提交
  7. 06 6月, 2012 1 次提交
  8. 04 6月, 2012 4 次提交
  9. 04 5月, 2012 2 次提交
  10. 02 5月, 2012 3 次提交
  11. 30 4月, 2012 1 次提交
  12. 24 4月, 2012 1 次提交
  13. 11 4月, 2012 1 次提交
  14. 02 3月, 2012 2 次提交
  15. 28 2月, 2012 1 次提交
    • F
      usb: dwc3: gadget: use generic map/unmap routines · 0fc9a1be
      Felipe Balbi 提交于
      those routines have everything we need to map/unmap
      USB requests and it's better to use them.
      
      In order to achieve that, we had to add a simple
      change on how we allocate and use our setup buffer;
      we cannot allocate it from coherent anymore otherwise
      the generic map/unmap routines won't be able to easily
      know that the GetStatus request already has a DMA
      address.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      0fc9a1be
  16. 13 2月, 2012 1 次提交
    • F
      usb: dwc3: convert TRBs into bitshifts · f6bafc6a
      Felipe Balbi 提交于
      this will get rid of a useless memcpy on
      IRQ handling, thus improving driver performance.
      
      Tested with OMAP5430 running g_mass_storage on
      SuperSpeed and HighSpeed.
      
      Note that we are removing the little endian access
      of the TRB and all accesses will be in System endianness,
      if there happens to be a system in BE, bit 12 of GSBUSCFG0
      should be set so that HW does byte invariant BE accesses
      when fetching TRBs.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      f6bafc6a
  17. 10 2月, 2012 1 次提交
    • G
      usb: dwc3: ep0: fix SetFeature(TEST) · 3b637367
      Gerard Cauvy 提交于
      When host requests us to enter a test mode,
      we cannot directly enter the test mode before
      Status Phase is completed, otherwise the core
      will never be able to deliver the Status ZLP
      to host, because it has already entered the
      requested Test Mode.
      
      In order to fix the error, we move the actual
      start of Test Mode right after we receive
      Transfer Complete event of the status phase.
      Signed-off-by: NGerard Cauvy <g-cauvy1@ti.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      3b637367
  18. 06 2月, 2012 3 次提交
  19. 12 12月, 2011 6 次提交
    • F
      usb: dwc3: gadget: fix stream enable bit · c90bfaec
      Felipe Balbi 提交于
      ep->max_streams is a mere hint to the gadget
      driver that 'ep' supports stream handling. Using
      that as a decision variable for enabling streams
      was my worst brain-fart to date.
      
      Instead, we should check from the Superspeed
      Endpoint Companion Descriptor if the endpoint
      has requested streams. For that we need a little
      re-factoring but it is now correct.
      Debugged-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      c90bfaec
    • S
      usb: dwc3: ep0: use dwc3_request for ep0 requsts instead of usb_request · e0ce0b0a
      Sebastian Andrzej Siewior 提交于
      Instead of special functions and shortcuts for sending our internal
      answers to the host we started doing what the gadget does and used the
      public API for this. Since we only were using a few fields the
      usb_request was enough. Later added the list handling in order to
      synchronize the host / gadget events and now we require to have the
      dwc3_request struct around our usb_request or else we touch memory that
      does not belong to us. So this patch does this.
      Reported-by: NPartha Basak <p-basak2@ti.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      e0ce0b0a
    • F
      usb: dwc3: workaround: missing disconnect event · df62df56
      Felipe Balbi 提交于
      DWC3 revisions <1.88a have an issue which would
      case a missing Disconnect event if cable is
      disconnected while there's a Setup packet
      pending the FIFO.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      df62df56
    • F
      usb: dwc3: workaround: U1/U2 -> U0 transiton · fae2b904
      Felipe Balbi 提交于
      RTL revisions <1.83a have an issue where, depending
      on the link partner, the USB link might do multiple
      entry/exit of low power states before a transfer
      takes place causing degraded throughput.
      
      The suggested workaround is to clear bits
      12:9 of DCTL register if we see a transition
      from U1|U2 to U0 and only re-enable that on
      a transfer complete IRQ and we have no pending
      transfers on any of the enabled endpoints.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      fae2b904
    • S
      usb: dwc3: ep0: handle delayed_status again · 5bdb1dcc
      Sebastian Andrzej Siewior 提交于
      Since the re-worked ep0 handling (which uses HW's hints to recognize the ep0
      status) we lost the delayed status handling. This is used by the file and mass
      storage gadget to gain some extra time so setup its internal status before it
      can proceed further requests.
      In particular the storage gadget does nothing on USB_REQ_SET_CONFIGURATION but
      wakes up a thread which handles the request. If the udc driver continues ep0
      handling before the thread did its work then then endpoint is not yet
      configured and further requests will fail. Once the gadget is ready, it will
      enqueue an empty packet which is used for synchronization.
      In order to fix this issue, the patch does the following:
      Set ->delayed_status once the delayed_status has been notices and do not
      continue on the next XferNotReady event. We will continues ep0 processing once
      the gadget enqueued the zero packet for synchronization.
      
      A cleaner approach would be to enforce the gadget to enqueue an empty
      (zero) request even for the status phase but this would do for now.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      5bdb1dcc
    • S
      usb: dwc3: use a helper function for operation mode setting · 3140e8cb
      Sebastian Andrzej Siewior 提交于
      There are two where need to set operational mode:
      - during initialization while we decide to run in host,device or DRD
        mode
      - at runtime via the debugfs interface.
      
      This patch provides a new function which sets the operational mode and
      moves its initialiation to the mode switch instead in the gadget code
      itself.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      3140e8cb