1. 26 11月, 2018 7 次提交
    • 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
    • T
      usb: dwc3: Set default mode for DWC_usb3 v3.30a and higher · 89a9cc47
      Thinh Nguyen 提交于
      DWC_usb31 and DWC_usb3 v3.30a and higher do not support OTG mode. If
      the controller supports DRD but the dr_mode is not specified or set to
      OTG, then set the mode to peripheral.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      89a9cc47
    • T
      usb: dwc3: Support option to disable USB2 LPM · 022a0208
      Thinh Nguyen 提交于
      Support the option to disable USB2 LPM. Set xhci "usb2-lpm-disable"
      property via "snps,usb2-lpm-disable" property.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      022a0208
    • T
      usb: dwc3: debugfs: Dump internal LSP and ep registers · 62ba09d6
      Thinh Nguyen 提交于
      To dump internal LSP and endpoint state debug registers, we must write
      to GDBGLSPMUX register. This patch correctly dump LSP and endpoint
      states from the debug registers.
      
      If the controller is in device mode, all LSP and endpoint state
      registers will be dumped via the debugfs attribute "lsp_dump". In host
      mode, the user has to write the LSP number to "lsp_dump" to dump a
      specific LSP selection.
      
      Fixes: 80b77634 ("usb: dwc3: Dump LSP and BMU debug info")
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      62ba09d6
    • T
      usb: dwc3: debugfs: Properly name Tx/RxFIFO · 2c85a181
      Thinh Nguyen 提交于
      The Tx/RxFIFO types in the GDBGFIFOSPACE.FIFO_QUEUE_SELECT are not
      queue. Properly rename them.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      2c85a181
  2. 30 7月, 2018 3 次提交
  3. 21 5月, 2018 6 次提交
  4. 16 5月, 2018 1 次提交
    • M
      usb: dwc3: support clocks and resets for DWC3 core · fe8abf33
      Masahiro Yamada 提交于
      Historically, the clocks and resets are handled on the glue layer
      side instead of the DWC3 core.  For simple cases, dwc3-of-simple.c
      takes care of arbitrary number of clocks and resets.  The DT node
      structure typically looks like as follows:
      
        dwc3-glue {
                compatible = "foo,dwc3";
                clocks = ...;
                resets = ...;
                ...
      
                dwc3 {
                        compatible = "snps,dwc3";
                        ...
                };
        }
      
      By supporting the clocks and the reset in the dwc3/core.c, it will
      be turned into a single node:
      
        dwc3 {
                compatible = "foo,dwc3", "snps,dwc3";
                clocks = ...;
                resets = ...;
                ...
        }
      
      This commit adds the binding of clocks and resets specific to this IP.
      The number of clocks should generally be the same across SoCs, it is
      just some SoCs either tie clocks together or do not provide software
      control of some of the clocks.
      
      I took the clock names from the Synopsys datasheet: "ref" (ref_clk),
      "bus_early" (bus_clk_early), and "suspend" (suspend_clk).
      
      I found only one reset line in the datasheet, hence the reset-names
      property is omitted.
      
      Those clocks are required for new platforms.  Enforcing the new
      binding breaks existing platforms since they specify clocks (and
      resets) in their glue layer node, but nothing in the core node.
      I listed such exceptional cases in the DT binding.  The driver
      code has been relaxed to accept no clock.  This change is based
      on the discussion [1].
      
      I inserted reset_control_deassert() and clk_bulk_enable() before the
      first register access, i.e. dwc3_cache_hwparams().
      
      [1] https://patchwork.kernel.org/patch/10284265/Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      fe8abf33
  5. 22 3月, 2018 5 次提交
    • T
      usb: dwc3: Dump LSP and BMU debug info · 80b77634
      Thinh Nguyen 提交于
      Dump LSP and BMU debug info.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      80b77634
    • T
      usb: dwc3: Check for ESS TX/RX threshold config · 938a5ad1
      Thinh Nguyen 提交于
      Check and configure TX/RX threshold for DWC_usb31. Update dwc3 structure
      with new fields to store these threshold configurations.
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      938a5ad1
    • T
      usb: dwc3: Add DWC_usb31 GTXTHRCFG reg fields · 6743e817
      Thinh Nguyen 提交于
      Add new GTXTHRCFG bit field macros for DWC_usb31. The GTXTHRCFG register
      fields for DWC_usb31 is as follows:
       +-------+--------------------------+-----------------------------------+
       | BITS  | Name                     | Description                       |
       +=======+==========================+===================================+
       | 31:27 | reserved                 |                                   |
       | 26    | UsbTxPktCntSel           | Async ESS transmit packet         |
       |       |                          | threshold enable                  |
       | 25:21 | UsbTxPktCnt              | Async ESS transmit packet         |
       |       |                          | threshold count                   |
       | 20:16 | UsbMaxTxBurstSize        | Async ESS Max transmit burst size |
       | 15    | UsbTxThrNumPktSel_HS_Prd | HS high bandwidth periodic        |
       |       |                          | transmit packet threshold enable  |
       | 14:13 | UsbTxThrNumPkt_HS_Prd    | HS high bandwidth periodic        |
       |       |                          | transmit packet threshold count   |
       | 12:11 | reserved                 |                                   |
       | 10    | UsbTxThrNumPktSel_Prd    | Periodic ESS transmit packet      |
       |       |                          | threshold enable                  |
       | 9:5   | UsbTxThrNumPkt_Prd       | Periodic ESS transmit packet      |
       |       |                          | threshold count                   |
       | 4:0   | UsbMaxTxBurstSize_Prd    | Max periodic ESS TX burst size    |
       +-------+--------------------------+-----------------------------------+
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      6743e817
    • T
      usb: dwc3: Add DWC_usb31 GRXTHRCFG bit fields · 2fbc5bdc
      Thinh Nguyen 提交于
      Add new GRXTHRCFG bit field macros for DWC_usb31. The GRXTHRCFG register
      fields for DWC_usb31 is as follows:
       +-------+--------------------------+----------------------------------+
       | BITS  | Name                     | Description                      |
       +=======+==========================+==================================+
       | 31:27 | reserved                 |                                  |
       | 26    | UsbRxPktCntSel           | Async ESS receive packet         |
       |       |                          | threshold enable                 |
       | 25:21 | UsbRxPktCnt              | Async ESS receive packet         |
       |       |                          | threshold count                  |
       | 20:16 | UsbMaxRxBurstSize        | Async ESS Max receive burst size |
       | 15    | UsbRxThrNumPktSel_HS_Prd | HS high bandwidth periodic       |
       |       |                          | receive packet threshold enable  |
       | 14:13 | UsbRxThrNumPkt_HS_Prd    | HS high bandwidth periodic       |
       |       |                          | receive packet threshold count   |
       | 12:11 | reserved                 |                                  |
       | 10    | UsbRxThrNumPktSel_Prd    | Periodic ESS receive packet      |
       |       |                          | threshold enable                 |
       | 9:5   | UsbRxThrNumPkt_Prd       | Periodic ESS receive packet      |
       |       |                          | threshold count                  |
       | 4:0   | UsbMaxRxBurstSize_Prd    | Max periodic ESS RX burst size   |
       +-------+--------------------------+----------------------------------+
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      2fbc5bdc
    • T
      usb: dwc3: Update DWC_usb31 GTXFIFOSIZ reg fields · 0cab8d26
      Thinh Nguyen 提交于
      Update two GTXFIFOSIZ bit fields for the DWC_usb31 controller. TXFDEP
      is a 15-bit value instead of 16-bit value, and bit 15 is TXFRAMNUM.
      
      The GTXFIFOSIZ register for DWC_usb31 is as follows:
       +-------+-----------+----------------------------------+
       | BITS  | Name      | Description                      |
       +=======+===========+==================================+
       | 31:16 | TXFSTADDR | Transmit FIFOn RAM Start Address |
       | 15    | TXFRAMNUM | Asynchronous/Periodic TXFIFO     |
       | 14:0  | TXFDEP    | TXFIFO Depth                     |
       +-------+-----------+----------------------------------+
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      0cab8d26
  6. 13 3月, 2018 2 次提交
  7. 15 2月, 2018 1 次提交
    • R
      usb: dwc3: core: Fix ULPI PHYs and prevent phy_get/ulpi_init during suspend/resume · 98112041
      Roger Quadros 提交于
      In order for ULPI PHYs to work, dwc3_phy_setup() and dwc3_ulpi_init()
      must be doene before dwc3_core_get_phy().
      
      commit 541768b0 ("usb: dwc3: core: Call dwc3_core_get_phy() before initializing phys")
      broke this.
      
      The other issue is that dwc3_core_get_phy() and dwc3_ulpi_init() should
      be called only once during the life cycle of the driver. However,
      as dwc3_core_init() is called during system suspend/resume it will
      result in multiple calls to dwc3_core_get_phy() and dwc3_ulpi_init()
      which is wrong.
      
      Fix this by moving dwc3_ulpi_init() out of dwc3_phy_setup()
      into dwc3_core_ulpi_init(). Use a flag 'ulpi_ready' to ensure that
      dwc3_core_ulpi_init() is called only once from dwc3_core_init().
      
      Use another flag 'phys_ready' to call dwc3_core_get_phy() only once from
      dwc3_core_init().
      
      Fixes: 541768b0 ("usb: dwc3: core: Call dwc3_core_get_phy() before initializing phys")
      Fixes: f54edb53 ("usb: dwc3: core: initialize ULPI before trying to get the PHY")
      Cc: linux-stable <stable@vger.kernel.org> # >= v4.13
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      98112041
  8. 12 2月, 2018 1 次提交
  9. 11 12月, 2017 2 次提交
    • R
      usb: dwc3: Allow disabling of metastability workaround · 42bf02ec
      Roger Quadros 提交于
      Some platforms (e.g. TI's DRA7 USB2 instance) have more trouble
      with the metastability workaround as it supports only
      a High-Speed PHY and the PHY can enter into an Erratic state [1]
      when the controller is set in SuperSpeed mode as part of
      the metastability workaround.
      
      This causes upto 2 seconds delay in enumeration on DRA7's USB2
      instance in gadget mode.
      
      If these platforms can be better off without the workaround,
      provide a device tree property to suggest that so the workaround
      is avoided.
      
      [1] Device mode enumeration trace showing PHY Erratic Error.
           irq/90-dwc3-969   [000] d...    52.323145: dwc3_event: event (00000901): Erratic Error [U0]
           irq/90-dwc3-969   [000] d...    52.560646: dwc3_event: event (00000901): Erratic Error [U0]
           irq/90-dwc3-969   [000] d...    52.798144: dwc3_event: event (00000901): Erratic Error [U0]
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      42bf02ec
    • F
      usb: dwc3: ep0: use gadget->isoch_delay for isoch_delay value · 19e0b203
      Felipe Balbi 提交于
      Instead of keeping our own isoch_delay, let's make use of the newly
      introduced isoch_delay member in struct usb_gadget. The benefit here
      is that we would be using a generic "API" which other UDCs can use,
      resulting in a common setup for gadget drivers who may be interested
      in Isoch Delay value.
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      19e0b203
  10. 07 11月, 2017 1 次提交
    • G
      USB: dwc3: Remove redundant license text · b5ea4757
      Greg Kroah-Hartman 提交于
      Now that the SPDX tag is in all USB files, that identifies the license
      in a specific and legally-defined manner.  So the extra GPL text wording
      can be removed as it is no longer needed at all.
      
      This is done on a quest to remove the 700+ different ways that files in
      the kernel describe the GPL license text.  And there's unneeded stuff
      like the address (sometimes incorrect) for the FSF which is never
      needed.
      
      No copyright headers or other non-license-description text was removed.
      
      Cc: Kukjin Kim <kgene@kernel.org>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: Patrice Chotard <patrice.chotard@st.com>
      Acked-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b5ea4757
  11. 04 11月, 2017 1 次提交
  12. 19 10月, 2017 1 次提交
  13. 02 6月, 2017 1 次提交
  14. 17 5月, 2017 1 次提交
    • W
      usb: dwc3: add disable u2mac linestate check quirk · 65db7a0c
      William Wu 提交于
      This patch adds a quirk to disable USB 2.0 MAC linestate check
      during HS transmit. Refer the dwc3 databook, we can use it for
      some special platforms if the linestate not reflect the expected
      line state(J) during transmission.
      
      When use this quirk, the controller implements a fixed 40-bit
      TxEndDelay after the packet is given on UTMI and ignores the
      linestate during the transmit of a token (during token-to-token
      and token-to-data IPGAP).
      
      On some rockchip platforms (e.g. rk3399), it requires to disable
      the u2mac linestate check to decrease the SSPLIT token to SETUP
      token inter-packet delay from 566ns to 466ns, and fix the issue
      that FS/LS devices not recognized if inserted through USB 3.0 HUB.
      Acked-by: NRob Herring <robh@kernel.org>
      Reviewed-by: NGuenter Roeck <groeck@chromium.org>
      Signed-off-by: NWilliam Wu <william.wu@rock-chips.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      65db7a0c
  15. 11 4月, 2017 7 次提交