1. 06 2月, 2021 3 次提交
  2. 14 1月, 2021 1 次提交
  3. 04 1月, 2021 1 次提交
  4. 28 12月, 2020 1 次提交
  5. 28 10月, 2020 1 次提交
  6. 02 10月, 2020 3 次提交
  7. 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
  8. 15 7月, 2020 1 次提交
  9. 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
  10. 05 5月, 2020 1 次提交
  11. 16 4月, 2020 2 次提交
    • T
      usb: dwc3: gadget: Properly set maxpacket limit · d94ea531
      Thinh Nguyen 提交于
      Currently the calculation of max packet size limit for IN endpoints is
      too restrictive. This prevents a matching of a capable hardware endpoint
      during configuration. Below is the minimum recommended HW configuration
      to support a particular endpoint setup from the databook:
      
      For OUT endpoints, the databook recommended the minimum RxFIFO size to
      be at least 3x MaxPacketSize + 3x setup packets size (8 bytes each) +
      clock crossing margin (16 bytes).
      
      For IN endpoints, the databook recommended the minimum TxFIFO size to be
      at least 3x MaxPacketSize for endpoints that support burst. If the
      endpoint doesn't support burst or when the device is operating in USB
      2.0 mode, a minimum TxFIFO size of 2x MaxPacketSize is recommended.
      
      Base on these recommendations, we can calculate the MaxPacketSize limit
      of each endpoint. This patch revises the IN endpoint MaxPacketSize limit
      and also sets the MaxPacketSize limit for OUT endpoints.
      
      Reference: Databook 3.30a section 3.2.2 and 3.2.3
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      d94ea531
    • T
      usb: dwc3: Fix GTXFIFOSIZ.TXFDEP macro name · 586f4335
      Thinh Nguyen 提交于
      Change the macro name DWC3_GTXFIFOSIZ_TXFDEF to DWC3_GTXFIFOSIZ_TXFDEP
      to match with the register name GTXFIFOSIZ.TXFDEP.
      
      Fixes: 457e84b6 ("usb: dwc3: gadget: dynamically re-size TxFifos")
      Fixes: 0cab8d26 ("usb: dwc3: Update DWC_usb31 GTXFIFOSIZ reg fields")
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      586f4335
  12. 15 3月, 2020 3 次提交
    • J
      usb: dwc3: Add support for role-switch-default-mode binding · 98ed256a
      John Stultz 提交于
      Support the new role-switch-default-mode binding for configuring
      the default role the controller assumes as when the usb role is
      USB_ROLE_NONE
      
      This patch was split out from a larger patch originally by
      Yu Chen <chenyu56@huawei.com>
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      CC: ShuFan Lee <shufan_lee@richtek.com>
      Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
      Cc: Yu Chen <chenyu56@huawei.com>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Jun Li <lijun.kernel@gmail.com>
      Cc: Valentin Schneider <valentin.schneider@arm.com>
      Cc: Guillaume Gardet <Guillaume.Gardet@arm.com>
      Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
      Cc: Jack Pham <jackp@codeaurora.org>
      Cc: linux-usb@vger.kernel.org
      Cc: devicetree@vger.kernel.org
      Tested-by: NBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      98ed256a
    • Y
      usb: dwc3: Registering a role switch in the DRD code. · 8a0a1379
      Yu Chen 提交于
      The Type-C drivers use USB role switch API to inform the
      system about the negotiated data role, so registering a role
      switch in the DRD code in order to support platforms with
      USB Type-C connectors.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      CC: ShuFan Lee <shufan_lee@richtek.com>
      Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
      Cc: Yu Chen <chenyu56@huawei.com>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Jun Li <lijun.kernel@gmail.com>
      Cc: Valentin Schneider <valentin.schneider@arm.com>
      Cc: Guillaume Gardet <Guillaume.Gardet@arm.com>
      Cc: Jack Pham <jackp@codeaurora.org>
      Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
      Cc: linux-usb@vger.kernel.org
      Cc: devicetree@vger.kernel.org
      Suggested-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Tested-by: NBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Signed-off-by: NYu Chen <chenyu56@huawei.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      8a0a1379
    • N
      usb: dwc3: core: add support for disabling SS instances in park mode · 7ba6b09f
      Neil Armstrong 提交于
      In certain circumstances, the XHCI SuperSpeed instance in park mode
      can fail to recover, thus on Amlogic G12A/G12B/SM1 SoCs when there is high
      load on the single XHCI SuperSpeed instance, the controller can crash like:
       xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command.
       xhci-hcd xhci-hcd.0.auto: Host halt failed, -110
       xhci-hcd xhci-hcd.0.auto: xHCI host controller not responding, assume dead
       xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command.
       hub 2-1.1:1.0: hub_ext_port_status failed (err = -22)
       xhci-hcd xhci-hcd.0.auto: HC died; cleaning up
       usb 2-1.1-port1: cannot reset (err = -22)
      
      Setting the PARKMODE_DISABLE_SS bit in the DWC3_USB3_GUCTL1 mitigates
      the issue. The bit is described as :
      "When this bit is set to '1' all SS bus instances in park mode are disabled"
      
      Synopsys explains:
      The GUCTL1.PARKMODE_DISABLE_SS is only available in
      dwc_usb3 controller running in host mode.
      This should not be set for other IPs.
      This can be disabled by default based on IP, but I recommend to have a
      property to enable this feature for devices that need this.
      
      CC: Dongjin Kim <tobetter@gmail.com>
      Cc: Jianxin Pan <jianxin.pan@amlogic.com>
      Cc: Thinh Nguyen <thinhn@synopsys.com>
      Cc: Jun Li <lijun.kernel@gmail.com>
      Reported-by: NTim <elatllat@gmail.com>
      Signed-off-by: NNeil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      7ba6b09f
  13. 15 1月, 2020 2 次提交
  14. 09 8月, 2019 1 次提交
  15. 20 6月, 2019 1 次提交
  16. 18 6月, 2019 1 次提交
    • A
      usb: dwc3: gadget: Add support for disabling U1 and U2 entries · 729dcffd
      Anurag Kumar Vulisha 提交于
      Gadget applications may have a requirement to disable the U1 and U2
      entry based on the usecase. Below are few usecases where the disabling
      U1/U2 entries may be possible.
      
      Usecase 1:
      When combining dwc3 with an redriver for a USB Type-C device solution, it
      sometimes have problems with leaving U1/U2 for certain hosts, resulting in
      link training errors and reconnects. For this U1/U2 state entries may be
      avoided.
      
      Usecase 2:
      When performing performance benchmarking on mass storage gadget the
      U1 and U2 entries can be disabled.
      
      Usecase 3:
      When periodic transfers like ISOC transfers are used with bInterval
      of 1 which doesn't require the link to enter into U1 or U2 state entry
      (since ping is issued from host for every uframe interval). In this
      case the U1 and U2 entry can be disabled.
      
      Disablement of U1/U2 can be done by setting U1DevExitLat and U2DevExitLat
      values to 0 in the BOS descriptor. Host on seeing 0 value for U1DevExitLat
      and U2DevExitLat, it doesn't send SET_SEL requests to the gadget. There
      may be some hosts which may send SET_SEL requests even after seeing 0 in
      the UxDevExitLat of BOS descriptor. To aviod U1/U2 entries for these type
      of hosts, dwc3 controller can be programmed to reject those U1/U2 requests
      by not enabling ACCEPTUxENA bits in DCTL register.
      
      This patch updates the same.
      Signed-off-by: NAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
      Signed-off-by: NClaus H. Stovgaard <cst@phaseone.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      729dcffd
  17. 03 5月, 2019 1 次提交
  18. 04 2月, 2019 1 次提交
  19. 28 1月, 2019 2 次提交
  20. 05 12月, 2018 1 次提交
  21. 27 11月, 2018 1 次提交
    • F
      usb: dwc3: gadget: check if dep->frame_number is still valid · d5370106
      Felipe Balbi 提交于
      Gadget driver may take an unbounded amount of time to queue requests
      after XferNotReady. This is important for isochronous endpoints which
      need to be started for a specific (micro-)frame.
      
      If we fail to start a transfer for isochronous endpoint, let's try
      queueing to a future interval and see if that helps. We will stop trying
      if we fail a start transfer for 5 intervals in the future.
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      d5370106
  22. 26 11月, 2018 6 次提交
    • F
      usb: dwc3: gadget: remove wait_end_transfer · fec9095b
      Felipe Balbi 提交于
      Now that we have a list of cancelled requests, we can skip over TRBs
      when END_TRANSFER command completes.
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      fec9095b
    • F
      usb: dwc3: gadget: introduce cancelled_list · d5443bbf
      Felipe Balbi 提交于
      This list will host cancelled requests who still have TRBs being
      processed.
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      d5443bbf
    • F
      usb: dwc3: gadget: track number of TRBs per request · 09fe1f8d
      Felipe Balbi 提交于
      This will help us remove the wait_event() from our ->dequeue().
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      09fe1f8d
    • F
      usb: dwc3: gadget: combine unaligned and zero flags · 1a22ec64
      Felipe Balbi 提交于
      Both flags are used for the same purpose in dwc3: appending an extra
      TRB at the end to deal with controller requirements. By combining both
      flags into one, we make it clear that the situation is the same and
      that they should be treated equally.
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      1a22ec64
    • T
      usb: dwc3: Add workaround for isoc start transfer failure · d92021f6
      Thinh Nguyen 提交于
      In DWC_usb31 version 1.70a-ea06 and prior, for highspeed and fullspeed
      isochronous IN, BIT[15:14] of the 16-bit microframe number reported by
      the XferNotReady event are invalid. The driver uses this number to
      schedule the isochronous transfer and passes it to the START TRANSFER
      command. Because this number is invalid, the command may fail. If
      BIT[15:14] matches the internal 16-bit microframe, the START TRANSFER
      command will pass and the transfer will start at the scheduled time, if
      it is off by 1, the command will still pass, but the transfer will start
      2 seconds in the future. For all other conditions, the START TRANSFER
      command will fail with bus-expiry.
      
      In order to workaround this issue, we can test for the correct
      combination of BIT[15:14] by sending START TRANSFER commands with
      different values of BIT[15:14]: 'b00, 'b01, 'b10, and 'b11. Each
      combination is 2^14 uframe apart (or 2 seconds). 4 seconds into the
      future will result in a bus-expiry status. As the result, within the 4
      possible combinations for BIT[15:14], there will be 2 successful and 2
      failure START COMMAND status. One of the 2 successful command status
      will result in a 2-second delay start. The smaller BIT[15:14] value is
      the correct combination.
      
      Since there are only 4 outcomes and the results are ordered, we can
      simply test 2 START TRANSFER commands with BIT[15:14] combinations 'b00
      and 'b01 to deduce the smaller successful combination.
      
      Let test0 = test status for combination 'b00 and test1 = test status for
      'b01 of BIT[15:14]. The correct combination is as follow:
      
      if test0 fails and test1 passes, BIT[15:14] is 'b01
      if test0 fails and test1 fails, BIT[15:14] is 'b10
      if test0 passes and test1 fails, BIT[15:14] is 'b11
      if test0 passes and test1 passes, BIT[15:14] is 'b00
      
      Synopsys STAR 9001202023: Wrong microframe number for isochronous IN
      endpoints.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      d92021f6
    • T
      usb: dwc3: Track DWC_usb31 VERSIONTYPE · 475d8e01
      Thinh Nguyen 提交于
      Add a new field to dwc3 structure to track VERSIONTYPE. The VERSIONTYPE
      is represented in ASCII in the 32-bit VERSIONTYPE register. In
      DWC_usb31, sub releases for each version are tracked with VERSIONTYPE
      such as "ea01" and "ea02".
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      475d8e01