1. 13 12月, 2021 1 次提交
    • T
      usb: dwc3: gadget: Support Multi-Stream Transfer · 666f3de7
      Thinh Nguyen 提交于
      Synopsys introduced a new enhancement to DWC_usb32 called Multi-Stream
      Transfer (MST) to improve bulk streams performance for SuperSpeed and
      SuperSpeed Plus. This enhancement allows the controller to look ahead
      and process multiple bulk streams.
      
      Previously, to initiate a bulk stream transfer, the driver has to issue
      Start Transfer command and wait for the stream to complete before
      initiating a new stream. As a result, the controller does not process
      TRBs beyond a single stream. With the enhancement, as long as there are
      new requests, the dwc3 driver can keep preparing new TRBs and the
      controller can keep caching and processing them without waiting for the
      transfer completion.
      
      The programming flow is similar to regular bulk endpoint with a few
      additional rules:
      
      1) Chained TRBs of the same stream must have a matching stream ID
      2) The last TRB of a stream must have CHN=0
      3) All the TRBs with LST=0 must have CSP=1
      
      Depends on the application and usage, internal tests show significant
      performance improvement in UASP transfers with this enhancement.
      Signed-off-by: NThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Link: https://lore.kernel.org/r/cd9c7a8bf11f790983ac546222dd114893f16b3a.1638242424.git.Thinh.Nguyen@synopsys.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      666f3de7
  2. 17 11月, 2021 1 次提交
  3. 22 10月, 2021 2 次提交
    • J
      usb: dwc3: Align DWC3_EP_* flag macros · d1a46837
      Jack Pham 提交于
      Fix the DWC3_EP_* flag macros so that the definitions are all
      lined up on the same tab column for consistent style.
      
      No functional change.
      Signed-off-by: NJack Pham <jackp@codeaurora.org>
      Link: https://lore.kernel.org/r/20211021180129.27938-2-jackp@codeaurora.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1a46837
    • J
      usb: dwc3: gadget: Skip resizing EP's TX FIFO if already resized · 876a75cb
      Jack Pham 提交于
      Some functions may dynamically enable and disable their endpoints
      regularly throughout their operation, particularly when Set Interface
      is employed to switch between Alternate Settings.  For instance the
      UAC2 function has its respective endpoints for playback & capture
      associated with AltSetting 1, in which case those endpoints would not
      get enabled until the host activates the AltSetting.  And they
      conversely become disabled when the interfaces' AltSetting 0 is
      chosen.
      
      With the DWC3 FIFO resizing algorithm recently added, every
      usb_ep_enable() call results in a call to resize that EP's TXFIFO,
      but if the same endpoint is enabled again and again, this incorrectly
      leads to FIFO RAM allocation exhaustion as the mechanism did not
      account for the possibility that endpoints can be re-enabled many
      times.
      
      Example log splat:
      
      	dwc3 a600000.dwc3: Fifosize(3717) > RAM size(3462) ep3in depth:217973127
      	configfs-gadget gadget: u_audio_start_capture:521 Error!
      	dwc3 a600000.dwc3: request 000000000be13e18 was not queued to ep3in
      
      Add another bit DWC3_EP_TXFIFO_RESIZED to dep->flags to keep track of
      whether an EP had already been resized in the current configuration.
      If so, bail out of dwc3_gadget_resize_tx_fifos() to avoid the
      calculation error resulting from accumulating the EP's FIFO depth
      repeatedly.  This flag is retained across multiple ep_disable() and
      ep_enable() calls and is cleared when GTXFIFOSIZn is reset in
      dwc3_gadget_clear_tx_fifos() upon receiving the next Set Config.
      
      Fixes: 9f607a30 ("usb: dwc3: Resize TX FIFOs to meet EP bursting requirements")
      Reviewed-by: NThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Signed-off-by: NJack Pham <jackp@codeaurora.org>
      Link: https://lore.kernel.org/r/20211021180129.27938-1-jackp@codeaurora.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      876a75cb
  4. 21 9月, 2021 1 次提交
  5. 14 9月, 2021 1 次提交
  6. 18 8月, 2021 1 次提交
  7. 21 7月, 2021 1 次提交
  8. 12 7月, 2021 1 次提交
  9. 11 6月, 2021 1 次提交
  10. 10 5月, 2021 2 次提交
  11. 23 4月, 2021 2 次提交
  12. 22 4月, 2021 1 次提交
  13. 14 4月, 2021 2 次提交
  14. 02 4月, 2021 1 次提交
  15. 28 3月, 2021 1 次提交
  16. 23 3月, 2021 1 次提交
  17. 10 3月, 2021 2 次提交
  18. 06 2月, 2021 3 次提交
  19. 14 1月, 2021 1 次提交
  20. 04 1月, 2021 1 次提交
  21. 28 12月, 2020 1 次提交
  22. 28 10月, 2020 1 次提交
  23. 02 10月, 2020 3 次提交
  24. 24 9月, 2020 1 次提交
    • T
      usb: dwc3: gadget: END_TRANSFER before CLEAR_STALL command · d97c78a1
      Thinh Nguyen 提交于
      According the programming guide (for all DWC3 IPs), when the driver
      handles ClearFeature(halt) request, it should issue CLEAR_STALL command
      _after_ the END_TRANSFER command completes. The END_TRANSFER command may
      take some time to complete. So, delay the ClearFeature(halt) request
      control status stage and wait for END_TRANSFER command completion
      interrupt. Only after END_TRANSFER command completes that the driver
      may issue CLEAR_STALL command.
      
      Cc: stable@vger.kernel.org
      Fixes: cb11ea56 ("usb: dwc3: gadget: Properly handle ClearFeature(halt)")
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      d97c78a1
  25. 15 7月, 2020 1 次提交
  26. 25 5月, 2020 5 次提交
    • T
      usb: dwc3: gadget: Use SET_EP_PRIME for NoStream · b10e1c25
      Thinh Nguyen 提交于
      DWC_usb32 v1.00a and later can use SET_EP_PRIME command to reinitiate a
      stream. Use the command to handle NoStream rejection instead of ending
      and restarting the endpoint.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      b10e1c25
    • T
      usb: dwc3: gadget: Handle stream transfers · 140ca4cf
      Thinh Nguyen 提交于
      Overview of stream transfer requirement:
       * A transfer will have a set of TRBs of the same stream ID.
       * A transfer is started with a stream ID in START_TRANSFER command.
       * A new stream will only start when the previous completes.
      
      Overview of stream events:
       * A "prime" from host indicates that its endpoints are active
         (buffers prepared and ready to receive/transmit data). The controller
         automatically initiates stream if it sees this.
       * A "NoStream" rejection event indicates that the host isn't ready.
         Host will put the endpoint back to idle state. Device may need to
         reinitiate the stream to start transfer again.
       * A Stream Found event means host accepted device initiated stream.
         Nothing needs to be done from driver.
      
      To initiate a stream, the driver will issue START_TRANSFER command with
      a stream ID. To reinitiate the stream, the driver must issue
      END_TRANSFER and restart the transfer with START_TRANSFER command with
      the same stream ID.
      
      This implementation handles device-initated streams (e.g. UASP driver).
      It also handles some hosts' quirky behavior where they only prime each
      endpoint once.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      140ca4cf
    • T
      usb: dwc3: gadget: Wait for transfer completion · e0d19563
      Thinh Nguyen 提交于
      If a transfer is in-progress, any new request should not kick off
      another transfer. The driver needs to wait for the current transfer to
      complete before starting off the next transfer. Introduce a new flag
      DWC3_EP_WAIT_TRANSFER_COMPLETE for this.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      e0d19563
    • T
      usb: dwc3: Get MDWIDTH for DWC_usb32 · 4244ba02
      Thinh Nguyen 提交于
      DWC_usb32 supports MDWIDTH value larger than 255 and up to 1023. The
      field HWPARAMS6[9:8] stores the upper 2-bit values of the DWC_usb32's
      MDWIDTH. Check that parameter and properly get the MDWIDTH for
      DWC_usb32.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      4244ba02
    • T
      usb: dwc3: Add support for DWC_usb32 IP · 9af21dd6
      Thinh Nguyen 提交于
      Synopsys introduces a new controller DWC_usb32. It supports dual-lane
      and speed up to 20 Gbps, and the DWC3 driver will drive this controller.
      Currently the driver uses a single field dwc->revision to ID both
      DWC_usb3 and DWC_usb31 and their version number. This was sufficient for
      two IPs, but this method doesn't work with additional IPs. As a result,
      let's separate the dwc->revision field to 2 separate fields: ip and
      revision. The ip field now stores the ID of the controller's IP while
      the revision field stores the controller's version number.
      
      This new scheme enforces DWC3 to compare the revision within the same IP
      only. As a result, we must update all the revision check of the
      controller to check its corresponding IP.
      
      To help with this enforcement, we create a few macros to help with
      the common version checks:
      
      DWC3_IP_IS(IP)
      DWC3_VER_IS(IP, VERSION)
      DWC3_VER_IS_PRIOR(IP, VERSION)
      DWC3_VER_IS_WITHIN(IP, LOWER_VERSION, UPPER_VERSION)
      DWC3_VER_TYPE_IS_WITHIN(IP, VERSION,
      			LOWER_VERSION_TYPE,
      			UPPER_VERSION_TYPE)
      
      The DWC_usb32 controller operates using the same programming model and
      with very similar configurations as its previous controllers. Please
      note that the various IP and revision checks in this patch match the
      current checks for DWC_usb31 version 1.90a. Additional configurations
      that are unique to DWC_usb32 are applied separately.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      9af21dd6
  27. 05 5月, 2020 1 次提交