1. 23 3月, 2021 1 次提交
  2. 10 3月, 2021 2 次提交
  3. 06 2月, 2021 1 次提交
  4. 05 2月, 2021 1 次提交
  5. 12 1月, 2021 2 次提交
  6. 28 10月, 2020 1 次提交
  7. 02 10月, 2020 4 次提交
    • Y
      usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc · f580170f
      Yu Chen 提交于
      SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core
      of Hisilicon Kirin Soc when dwc3 core act as host.
      
      [mchehab: dropped a dev_dbg() as only traces are now allowwed on this driver]
      Signed-off-by: NYu Chen <chenyu56@huawei.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      f580170f
    • L
      usb: dwc3: core: add phy cleanup for probe error handling · 03c1fd62
      Li Jun 提交于
      Add the phy cleanup if dwc3 mode init fail, which is the missing part of
      de-init for dwc3 core init.
      
      Fixes: c499ff71 ("usb: dwc3: core: re-factor init and exit paths")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NLi Jun <jun.li@nxp.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      03c1fd62
    • L
      usb: dwc3: core: don't trigger runtime pm when remove driver · 266d0493
      Li Jun 提交于
      No need to trigger runtime pm in driver removal, otherwise if user
      disable auto suspend via sys file, runtime suspend may be entered,
      which will call dwc3_core_exit() again and there will be clock disable
      not balance warning:
      
      [ 2026.820154] xhci-hcd xhci-hcd.0.auto: remove, state 4
      [ 2026.825268] usb usb2: USB disconnect, device number 1
      [ 2026.831017] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
      [ 2026.836806] xhci-hcd xhci-hcd.0.auto: remove, state 4
      [ 2026.842029] usb usb1: USB disconnect, device number 1
      [ 2026.848029] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
      [ 2026.865889] ------------[ cut here ]------------
      [ 2026.870506] usb2_ctrl_root_clk already disabled
      [ 2026.875082] WARNING: CPU: 0 PID: 731 at drivers/clk/clk.c:958
      clk_core_disable+0xa0/0xa8
      [ 2026.883170] Modules linked in: dwc3(-) phy_fsl_imx8mq_usb [last
      unloaded: dwc3]
      [ 2026.890488] CPU: 0 PID: 731 Comm: rmmod Not tainted
      5.8.0-rc7-00280-g9d08cca-dirty #245
      [ 2026.898489] Hardware name: NXP i.MX8MQ EVK (DT)
      [ 2026.903020] pstate: 20000085 (nzCv daIf -PAN -UAO BTYPE=--)
      [ 2026.908594] pc : clk_core_disable+0xa0/0xa8
      [ 2026.912777] lr : clk_core_disable+0xa0/0xa8
      [ 2026.916958] sp : ffff8000121b39a0
      [ 2026.920271] x29: ffff8000121b39a0 x28: ffff0000b11f3700
      [ 2026.925583] x27: 0000000000000000 x26: ffff0000b539c700
      [ 2026.930895] x25: 000001d7e44e1232 x24: ffff0000b76fa800
      [ 2026.936208] x23: ffff0000b76fa6f8 x22: ffff800008d01040
      [ 2026.941520] x21: ffff0000b539ce00 x20: ffff0000b7105000
      [ 2026.946832] x19: ffff0000b7105000 x18: 0000000000000010
      [ 2026.952144] x17: 0000000000000001 x16: 0000000000000000
      [ 2026.957456] x15: ffff0000b11f3b70 x14: ffffffffffffffff
      [ 2026.962768] x13: ffff8000921b36f7 x12: ffff8000121b36ff
      [ 2026.968080] x11: ffff8000119e1000 x10: ffff800011bf26d0
      [ 2026.973392] x9 : 0000000000000000 x8 : ffff800011bf3000
      [ 2026.978704] x7 : ffff800010695d68 x6 : 0000000000000252
      [ 2026.984016] x5 : ffff0000bb9881f0 x4 : 0000000000000000
      [ 2026.989327] x3 : 0000000000000027 x2 : 0000000000000023
      [ 2026.994639] x1 : ac2fa471aa7cab00 x0 : 0000000000000000
      [ 2026.999951] Call trace:
      [ 2027.002401]  clk_core_disable+0xa0/0xa8
      [ 2027.006238]  clk_core_disable_lock+0x20/0x38
      [ 2027.010508]  clk_disable+0x1c/0x28
      [ 2027.013911]  clk_bulk_disable+0x34/0x50
      [ 2027.017758]  dwc3_core_exit+0xec/0x110 [dwc3]
      [ 2027.022122]  dwc3_suspend_common+0x84/0x188 [dwc3]
      [ 2027.026919]  dwc3_runtime_suspend+0x74/0x9c [dwc3]
      [ 2027.031712]  pm_generic_runtime_suspend+0x28/0x40
      [ 2027.036419]  genpd_runtime_suspend+0xa0/0x258
      [ 2027.040777]  __rpm_callback+0x88/0x140
      [ 2027.044526]  rpm_callback+0x20/0x80
      [ 2027.048015]  rpm_suspend+0xd0/0x418
      [ 2027.051503]  __pm_runtime_suspend+0x58/0xa0
      [ 2027.055693]  dwc3_runtime_idle+0x7c/0x90 [dwc3]
      [ 2027.060224]  __rpm_callback+0x88/0x140
      [ 2027.063973]  rpm_idle+0x78/0x150
      [ 2027.067201]  __pm_runtime_idle+0x58/0xa0
      [ 2027.071130]  dwc3_remove+0x64/0xc0 [dwc3]
      [ 2027.075140]  platform_drv_remove+0x28/0x48
      [ 2027.079239]  device_release_driver_internal+0xf4/0x1c0
      [ 2027.084377]  driver_detach+0x4c/0xd8
      [ 2027.087954]  bus_remove_driver+0x54/0xa8
      [ 2027.091877]  driver_unregister+0x2c/0x58
      [ 2027.095799]  platform_driver_unregister+0x10/0x18
      [ 2027.100509]  dwc3_driver_exit+0x14/0x1408 [dwc3]
      [ 2027.105129]  __arm64_sys_delete_module+0x178/0x218
      [ 2027.109922]  el0_svc_common.constprop.0+0x68/0x160
      [ 2027.114714]  do_el0_svc+0x20/0x80
      [ 2027.118031]  el0_sync_handler+0x88/0x190
      [ 2027.121953]  el0_sync+0x140/0x180
      [ 2027.125267] ---[ end trace 027f4f8189958f1f ]---
      [ 2027.129976] ------------[ cut here ]------------
      
      Fixes: fc8bb91b ("usb: dwc3: implement runtime PM")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NLi Jun <jun.li@nxp.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      266d0493
    • L
      usb: dwc3: core: do not queue work if dr_mode is not USB_DR_MODE_OTG · dc336b19
      Li Jun 提交于
      Do not try to queue a drd work if dr_mode is not USB_DR_MODE_OTG
      because the work is not inited, this may be triggered by user try
      to change mode file of debugfs on a single role port, which will
      cause below kernel dump:
      [   60.115529] ------------[ cut here ]------------
      [   60.120166] WARNING: CPU: 1 PID: 627 at kernel/workqueue.c:1473
      __queue_work+0x46c/0x520
      [   60.128254] Modules linked in:
      [   60.131313] CPU: 1 PID: 627 Comm: sh Not tainted
      5.7.0-rc4-00022-g914a586-dirty #135
      [   60.139054] Hardware name: NXP i.MX8MQ EVK (DT)
      [   60.143585] pstate: a0000085 (NzCv daIf -PAN -UAO)
      [   60.148376] pc : __queue_work+0x46c/0x520
      [   60.152385] lr : __queue_work+0x314/0x520
      [   60.156393] sp : ffff8000124ebc40
      [   60.159705] x29: ffff8000124ebc40 x28: ffff800011808018
      [   60.165018] x27: ffff800011819ef8 x26: ffff800011d39980
      [   60.170331] x25: ffff800011808018 x24: 0000000000000100
      [   60.175643] x23: 0000000000000013 x22: 0000000000000001
      [   60.180955] x21: ffff0000b7c08e00 x20: ffff0000b6c31080
      [   60.186267] x19: ffff0000bb99bc00 x18: 0000000000000000
      [   60.191579] x17: 0000000000000000 x16: 0000000000000000
      [   60.196891] x15: 0000000000000000 x14: 0000000000000000
      [   60.202202] x13: 0000000000000000 x12: 0000000000000000
      [   60.207515] x11: 0000000000000000 x10: 0000000000000040
      [   60.212827] x9 : ffff800011d55460 x8 : ffff800011d55458
      [   60.218138] x7 : ffff0000b7800028 x6 : 0000000000000000
      [   60.223450] x5 : ffff0000b7800000 x4 : 0000000000000000
      [   60.228762] x3 : ffff0000bb997cc0 x2 : 0000000000000001
      [   60.234074] x1 : 0000000000000000 x0 : ffff0000b6c31088
      [   60.239386] Call trace:
      [   60.241834]  __queue_work+0x46c/0x520
      [   60.245496]  queue_work_on+0x6c/0x90
      [   60.249075]  dwc3_set_mode+0x48/0x58
      [   60.252651]  dwc3_mode_write+0xf8/0x150
      [   60.256489]  full_proxy_write+0x5c/0xa8
      [   60.260327]  __vfs_write+0x18/0x40
      [   60.263729]  vfs_write+0xdc/0x1c8
      [   60.267045]  ksys_write+0x68/0xf0
      [   60.270360]  __arm64_sys_write+0x18/0x20
      [   60.274286]  el0_svc_common.constprop.0+0x68/0x160
      [   60.279077]  do_el0_svc+0x20/0x80
      [   60.282394]  el0_sync_handler+0x10c/0x178
      [   60.286403]  el0_sync+0x140/0x180
      [   60.289716] ---[ end trace 70b155582e2b7988 ]---
      Signed-off-by: NLi Jun <jun.li@nxp.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      dc336b19
  8. 24 9月, 2020 2 次提交
  9. 24 8月, 2020 1 次提交
  10. 15 7月, 2020 1 次提交
  11. 25 5月, 2020 1 次提交
    • 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
  12. 05 5月, 2020 2 次提交
  13. 15 3月, 2020 4 次提交
    • L
      usb: dwc3: core: don't do suspend for device mode if already suspended · 0227cc84
      Li Jun 提交于
      If dwc->dev in device mode already runtime suspended, don't do it again
      for system suspend.
      Signed-off-by: NLi Jun <jun.li@nxp.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      0227cc84
    • J
      usb: dwc3: Rework resets initialization to be more flexible · 4a1d042a
      John Stultz 提交于
      The dwc3 core binding specifies one reset.
      
      However some variants of the hardware may have more. Previously
      this was handled by using the dwc3-of-simple glue driver, but
      that resulted in a proliferation of bindings for for every
      variant, when the only difference was the clocks and resets
      lists.
      
      So this patch reworks the reading of the resets to fetch all the
      resets specified in the dts together.
      
      This patch was recommended by Rob Herring <robh@kernel.org>
      as an alternative to creating multiple bindings for each variant
      of hardware.
      
      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: linux-usb@vger.kernel.org
      Cc: devicetree@vger.kernel.org
      Suggested-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      4a1d042a
    • J
      usb: dwc3: Rework clock initialization to be more flexible · 0d3a9708
      John Stultz 提交于
      The dwc3 core binding specifies three clocks:
        ref, bus_early, and suspend
      
      which are all controlled in the driver together.
      
      However some variants of the hardware my not have all three
      clks, or some may have more. Usually this was handled by using
      the dwc3-of-simple glue driver, but that resulted in a
      proliferation of bindings for for every variant, when the only
      difference was the clocks and resets lists.
      
      So this patch reworks the reading of the clks from the dts to
      use devm_clk_bulk_get_all() will will fetch all the clocks
      specified in the dts together.
      
      This patch was recommended by Rob Herring <robh@kernel.org>
      as an alternative to creating multiple bindings for each variant
      of hardware.
      
      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: linux-usb@vger.kernel.org
      Cc: devicetree@vger.kernel.org
      Suggested-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      0d3a9708
    • 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
  14. 15 1月, 2020 1 次提交
  15. 27 10月, 2019 1 次提交
    • Y
      usb: dwc3: remove the call trace of USBx_GFLADJ · a7d9874c
      Yinbo Zhu 提交于
      layerscape board sometimes reported some usb call trace, that is due to
      kernel sent LPM tokerns automatically when it has no pending transfers
      and think that the link is idle enough to enter L1, which procedure will
      ask usb register has a recovery,then kernel will compare USBx_GFLADJ and
      set GFLADJ_30MHZ, GFLADJ_30MHZ_REG until GFLADJ_30MHZ is equal 0x20, if
      the conditions were met then issue occur, but whatever the conditions
      whether were met that usb is all need keep GFLADJ_30MHZ of value is 0x20
      (xhci spec ask use GFLADJ_30MHZ to adjust any offset from clock source
      that generates the clock that drives the SOF counter, 0x20 is default
      value of it)That is normal logic, so need remove the call trace.
      Signed-off-by: NYinbo Zhu <yinbo.zhu@nxp.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      a7d9874c
  16. 22 10月, 2019 1 次提交
    • T
      usb: dwc3: Disable phy suspend after power-on reset · 9ba3aca8
      Thinh Nguyen 提交于
      For DRD controllers, the programming guide recommended that
      GUSB3PIPECTL.SUSPENDABLE and GUSB2PHYCFG.SUSPHY to be cleared after
      power-on reset and only set after the controller initialization is
      completed. This can be done after device soft-reset in dwc3_core_init().
      This patch makes sure to clear GUSB3PIPECTL.SUSPENDABLE and
      GUSB2PHYCFG.SUSPHY before core initialization and only set them after
      the device soft-reset is completed.
      
      Reference: DWC_usb3 3.30a and DWC_usb31 1.90a programming guide section
      1.2.49 and 1.2.45
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      9ba3aca8
  17. 03 9月, 2019 1 次提交
  18. 28 8月, 2019 1 次提交
  19. 09 8月, 2019 4 次提交
  20. 25 7月, 2019 1 次提交
  21. 18 6月, 2019 2 次提交
    • 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
    • E
      usb: dwc3: Fix core validation in probe, move after clocks are enabled · dc1b5d9a
      Enric Balletbo i Serra 提交于
      The required clocks needs to be enabled before the first register
      access. After commit fe8abf33 ("usb: dwc3: support clocks and resets
      for DWC3 core"), this happens when the dwc3_core_is_valid function is
      called, but the mentioned commit adds that call in the wrong place,
      before the clocks are enabled. So, move that call after the
      clk_bulk_enable() to ensure the clocks are enabled and the reset
      deasserted.
      
      I detected this while, as experiment, I tried to move the clocks and resets
      from the glue layer to the DWC3 core on a Samsung Chromebook Plus.
      
      That was not detected before because, in most cases, the glue layer
      initializes SoC-specific things and then populates the child "snps,dwc3"
      with those clocks already enabled.
      
      Fixes: b873e2d0 ("usb: dwc3: Do core validation early on probe")
      Signed-off-by: NEnric Balletbo i Serra <enric.balletbo@collabora.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      dc1b5d9a
  22. 03 5月, 2019 4 次提交
    • T
      usb: dwc3: Fix default lpm_nyet_threshold value · 8d791929
      Thinh Nguyen 提交于
      The max possible value for DCTL.LPM_NYET_THRES is 15 and not 255. Change
      the default value to 15.
      
      Cc: stable@vger.kernel.org
      Fixes: 80caf7d2 ("usb: dwc3: add lpm erratum support")
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      8d791929
    • T
      usb: dwc3: Do core validation early on probe · b873e2d0
      Thinh Nguyen 提交于
      The setting of the dr_mode may need to check the controller's revision.
      The revision is set in the dwc3_core_is_valid(), which comes after
      dr_mode setting. Let's move it closer to the start of the dwc3_probe()
      function and before calling dwc3_get_dr_mode().
      Signed-off-by: NThinh Nguyen <thinhn@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      b873e2d0
    • M
      usb: dwc3: move synchronize_irq() out of the spinlock protected block · 41a91c60
      Marek Szyprowski 提交于
      dwc3_gadget_suspend() is called under dwc->lock spinlock. In such context
      calling synchronize_irq() is not allowed. Move the problematic call out
      of the protected block to fix the following kernel BUG during system
      suspend:
      
      BUG: sleeping function called from invalid context at kernel/irq/manage.c:112
      in_atomic(): 1, irqs_disabled(): 128, pid: 1601, name: rtcwake
      6 locks held by rtcwake/1601:
       #0: f70ac2a2 (sb_writers#7){.+.+}, at: vfs_write+0x130/0x16c
       #1: b5fe1270 (&of->mutex){+.+.}, at: kernfs_fop_write+0xc0/0x1e4
       #2: 7e597705 (kn->count#60){.+.+}, at: kernfs_fop_write+0xc8/0x1e4
       #3: 8b3527d0 (system_transition_mutex){+.+.}, at: pm_suspend+0xc4/0xc04
       #4: fc7f1c42 (&dev->mutex){....}, at: __device_suspend+0xd8/0x74c
       #5: 4b36507e (&(&dwc->lock)->rlock){....}, at: dwc3_gadget_suspend+0x24/0x3c
      irq event stamp: 11252
      hardirqs last  enabled at (11251): [<c09c54a4>] _raw_spin_unlock_irqrestore+0x6c/0x74
      hardirqs last disabled at (11252): [<c09c4d44>] _raw_spin_lock_irqsave+0x1c/0x5c
      softirqs last  enabled at (9744): [<c0102564>] __do_softirq+0x3a4/0x66c
      softirqs last disabled at (9737): [<c0128528>] irq_exit+0x140/0x168
      Preemption disabled at:
      [<00000000>]   (null)
      CPU: 7 PID: 1601 Comm: rtcwake Not tainted
      5.0.0-rc3-next-20190122-00039-ga3f4ee4f8a52 #5252
      Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [<c01110f0>] (unwind_backtrace) from [<c010d120>] (show_stack+0x10/0x14)
      [<c010d120>] (show_stack) from [<c09a4d04>] (dump_stack+0x90/0xc8)
      [<c09a4d04>] (dump_stack) from [<c014c700>] (___might_sleep+0x22c/0x2c8)
      [<c014c700>] (___might_sleep) from [<c0189d68>] (synchronize_irq+0x28/0x84)
      [<c0189d68>] (synchronize_irq) from [<c05cbbf8>] (dwc3_gadget_suspend+0x34/0x3c)
      [<c05cbbf8>] (dwc3_gadget_suspend) from [<c05bd020>] (dwc3_suspend_common+0x154/0x410)
      [<c05bd020>] (dwc3_suspend_common) from [<c05bd34c>] (dwc3_suspend+0x14/0x2c)
      [<c05bd34c>] (dwc3_suspend) from [<c051c730>] (platform_pm_suspend+0x2c/0x54)
      [<c051c730>] (platform_pm_suspend) from [<c05285d4>] (dpm_run_callback+0xa4/0x3dc)
      [<c05285d4>] (dpm_run_callback) from [<c0528a40>] (__device_suspend+0x134/0x74c)
      [<c0528a40>] (__device_suspend) from [<c052c508>] (dpm_suspend+0x174/0x588)
      [<c052c508>] (dpm_suspend) from [<c0182134>] (suspend_devices_and_enter+0xc0/0xe74)
      [<c0182134>] (suspend_devices_and_enter) from [<c0183658>] (pm_suspend+0x770/0xc04)
      [<c0183658>] (pm_suspend) from [<c0180ddc>] (state_store+0x6c/0xcc)
      [<c0180ddc>] (state_store) from [<c09a9a70>] (kobj_attr_store+0x14/0x20)
      [<c09a9a70>] (kobj_attr_store) from [<c02d6800>] (sysfs_kf_write+0x4c/0x50)
      [<c02d6800>] (sysfs_kf_write) from [<c02d594c>] (kernfs_fop_write+0xfc/0x1e4)
      [<c02d594c>] (kernfs_fop_write) from [<c02593d8>] (__vfs_write+0x2c/0x160)
      [<c02593d8>] (__vfs_write) from [<c0259694>] (vfs_write+0xa4/0x16c)
      [<c0259694>] (vfs_write) from [<c0259870>] (ksys_write+0x40/0x8c)
      [<c0259870>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
      Exception stack(0xed55ffa8 to 0xed55fff0)
      ...
      
      Fixes: 01c10880 ("usb: dwc3: gadget: synchronize_irq dwc irq in suspend")
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      41a91c60
    • A
      usb: dwc3: Free resource immediately after use · 75ecb9dd
      Andy Shevchenko 提交于
      When we read an array of integers from device properties,
      the temporary buffer is allocated.
      
      However, in case of dwc3_set_incr_burst_type() it's not freed.
      Free allocated buffer immediately after use.
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      75ecb9dd
  23. 26 11月, 2018 1 次提交
    • 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