1. 27 1月, 2021 1 次提交
  2. 12 1月, 2021 3 次提交
  3. 27 10月, 2020 1 次提交
  4. 02 10月, 2020 5 次提交
    • M
      usb: dwc2: Fix INTR OUT transfers in DDMA mode. · b2c586eb
      Minas Harutyunyan 提交于
      In DDMA mode if INTR OUT transfers mps not multiple of 4 then single packet
      corresponds to single descriptor.
      
      Descriptor limit set to mps and desc chain limit set to mps *
      MAX_DMA_DESC_NUM_GENERIC. On that descriptors complete, to calculate
      transfer size should be considered correction value for each descriptor.
      
      In start request function, if "continue" is true then dma buffer address
      should be incremmented by offset for all type of transfers, not only for
      Control DATA_OUT transfers.
      
      Fixes: cf77b5fb ("usb: dwc2: gadget: Transfer length limit checking for DDMA")
      Fixes: e02f9aa6 ("usb: dwc2: gadget: EP 0 specific DDMA programming")
      Fixes: aa3e8bc8 ("usb: dwc2: gadget: DDMA transfer start and complete")
      Signed-off-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      b2c586eb
    • A
      usb: dwc2: don't use ID/Vbus detection if usb-role-switch on STM32MP15 SoCs · d58ba480
      Amelie Delaunay 提交于
      If usb-role-switch is present in the device tree, it means that ID and Vbus
      signals are not connected to the OTG controller but to an external
      component (GPIOs, Type-C controller). In this configuration, usb role
      switch is used to force valid sessions on STM32MP15 SoCs.
      Acked-by: NMinas Harutyunyan <hminas@synopsys.com>
      Acked-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NAmelie Delaunay <amelie.delaunay@st.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      d58ba480
    • A
      usb: dwc2: override PHY input signals with usb role switch support · 17f93402
      Amelie Delaunay 提交于
      This patch adds support for usb role switch to dwc2, by using overriding
      control of the PHY voltage valid and ID input signals.
      
      iddig signal (ID) can be overridden:
      - when setting GUSBCFG_FORCEHOSTMODE, iddig input pin is overridden with 1;
      - when setting GUSBCFG_FORCEDEVMODE, iddig input pin is overridden with 0.
      
      avalid/bvalid/vbusvalid signals can be overridden respectively with:
      - GOTGCTL_AVALOEN + GOTGCTL_AVALOVAL
      - GOTGCTL_BVALOEN + GOTGCTL_BVALOVAL
      - GOTGCTL_VBVALEN + GOTGCTL_VBVALOVAL
      
      It is possible to determine valid sessions thanks to usb role switch:
      - if USB_ROLE_NONE then !avalid && !bvalid && !vbusvalid
      - if USB_ROLE_DEVICE then !avalid && bvalid && vbusvalid
      - if USB_ROLE_HOST then avalid && !bvalid && vbusvalid
      Acked-by: NMinas Harutyunyan <hminas@synopsys.com>
      Acked-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NAmelie Delaunay <amelie.delaunay@st.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      17f93402
    • M
      usb: dwc2: Always disable regulators on driver teardown · 54c19606
      Marc Zyngier 提交于
      If the dwc2 driver fails to probe after having enabled the regulators,
      it ends up being unregistered with regulators enabled, something the
      core regulator code is legitimately upset about:
      
         dwc2 ff400000.usb: supply vusb_d not found, using dummy regulator
         dwc2 ff400000.usb: supply vusb_a not found, using dummy regulator
         dwc2 ff400000.usb: dwc2_core_reset: HANG! AHB Idle timeout GRSTCTL GRSTCTL_AHBIDLE
         WARNING: CPU: 2 PID: 112 at drivers/regulator/core.c:2074 _regulator_put.part.0+0x16c/0x174
         Modules linked in: dwc2(E+) dwc3(E) udc_core(E) rtc_hym8563(E) dwmac_generic(E) ulpi(E) usbcore(E) dwc3_meson_g12a(E) roles(E) meson_gx_mmc(E+) i2c_meson(E) mdio_mux_meson_g12a(E) mdio_mux(E) dwmac_meson8b(E) stmmac_platform(E) stmmac(E) mdio_xpcs(E) phylink(E) of_mdio(E) fixed_phy(E) libphy(E) pwm_regulator(E) fixed(E)
         CPU: 2 PID: 112 Comm: systemd-udevd Tainted: G            E     5.9.0-rc4-00102-g423583bc8cf9 #1840
         Hardware name: amlogic w400/w400, BIOS 2020.04 05/22/2020
         pstate: 80400009 (Nzcv daif +PAN -UAO BTYPE=--)
         pc : _regulator_put.part.0+0x16c/0x174
         lr : regulator_bulk_free+0x6c/0x9c
         sp : ffffffc012353820
         x29: ffffffc012353820 x28: ffffff805a4b7000
         x27: ffffff8059c2eac0 x26: ffffff8059c2e810
         x25: ffffff805a4b7d00 x24: ffffffc008cf3028
         x23: ffffffc011729ef8 x22: ffffff807e2761d8
         x21: ffffffc01171df78 x20: ffffff805a4b7700
         x19: ffffff805a4b7700 x18: 0000000000000030
         x17: 0000000000000000 x16: 0000000000000000
         x15: ffffff807ea8d178 x14: 3935312820435455
         x13: 2038323a36313a37 x12: ffffffffffffffff
         x11: 0000000000000040 x10: 0000000000000007
         x9 : ffffffc0106f77d0 x8 : ffffffffffffffe0
         x7 : ffffffffffffffff x6 : 0000000000017702
         x5 : ffffff805a4b7400 x4 : 0000000000000000
         x3 : ffffffc01171df78 x2 : ffffff807ea8cc40
         x1 : 0000000000000000 x0 : 0000000000000001
         Call trace:
          _regulator_put.part.0+0x16c/0x174
          regulator_bulk_free+0x6c/0x9c
          devm_regulator_bulk_release+0x28/0x3c
          release_nodes+0x1c8/0x2c0
          devres_release_all+0x44/0x6c
          really_probe+0x1ec/0x504
          driver_probe_device+0x100/0x170
          device_driver_attach+0xcc/0xd4
          __driver_attach+0xb0/0x17c
          bus_for_each_dev+0x7c/0xd4
          driver_attach+0x30/0x3c
          bus_add_driver+0x154/0x250
          driver_register+0x84/0x140
          __platform_driver_register+0x54/0x60
          dwc2_platform_driver_init+0x2c/0x1000 [dwc2]
          do_one_initcall+0x54/0x2d0
          do_init_module+0x68/0x29c
      
      In order to fix this, tie the regulator disabling to the teardown
      process by registering a devm action callback. This makes sure that
      the regulators are disabled at the right time (just before they are
      released).
      
      Cc: Minas Harutyunyan <hminas@synopsys.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      54c19606
    • C
      usb: dwc2: add support for APM82181 USB OTG · 0abe3863
      Christian Lamparter 提交于
      adds the specific compatible string for the DWC2 IP found in the APM82181
      SoCs. The IP is setup correctly through the auto detection... With the
      exception of the AHB Burst Size. The default of GAHBCFG_HBSTLEN_INCR4 of
      the "snps,dwc2" can cause a system hang when the USB and SATA is used
      concurrently. Because the predecessor (PPC460EX (Canyonlands)) already
      had the same problem, this SoC can make use of the existing
      dwc2_set_amcc_params() function.
      Signed-off-by: NChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      0abe3863
  5. 24 9月, 2020 2 次提交
    • M
      usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails · e1c08cf2
      Martin Blumenstingl 提交于
      Call dwc2_debugfs_exit() and dwc2_hcd_remove() (if the HCD was enabled
      earlier) when usb_add_gadget_udc() has failed. This ensures that the
      debugfs entries created by dwc2_debugfs_init() as well as the HCD are
      cleaned up in the error path.
      
      Fixes: 207324a3 ("usb: dwc2: Postponed gadget registration to the udc class driver")
      Acked-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      e1c08cf2
    • N
      usb: dwc2: Fix parameter type in function pointer prototype · 362b9398
      Nathan Chancellor 提交于
      When booting up on a Raspberry Pi 4 with Control Flow Integrity checking
      enabled, the following warning/panic happens:
      
      [    1.626435] CFI failure (target: dwc2_set_bcm_params+0x0/0x4):
      [    1.632408] WARNING: CPU: 0 PID: 32 at kernel/cfi.c:30 __cfi_check_fail+0x54/0x5c
      [    1.640021] Modules linked in:
      [    1.643137] CPU: 0 PID: 32 Comm: kworker/0:1 Not tainted 5.8.0-rc6-next-20200724-00051-g89ba619726de #1
      [    1.652693] Hardware name: Raspberry Pi 4 Model B Rev 1.2 (DT)
      [    1.658637] Workqueue: events deferred_probe_work_func
      [    1.663870] pstate: 60000005 (nZCv daif -PAN -UAO BTYPE=--)
      [    1.669542] pc : __cfi_check_fail+0x54/0x5c
      [    1.673798] lr : __cfi_check_fail+0x54/0x5c
      [    1.678050] sp : ffff8000102bbaa0
      [    1.681419] x29: ffff8000102bbaa0 x28: ffffab09e21c7000
      [    1.686829] x27: 0000000000000402 x26: ffff0000f6e7c228
      [    1.692238] x25: 00000000fb7cdb0d x24: 0000000000000005
      [    1.697647] x23: ffffab09e2515000 x22: ffffab09e069a000
      [    1.703055] x21: 4c550309df1cf4c1 x20: ffffab09e2433c60
      [    1.708462] x19: ffffab09e160dc50 x18: ffff0000f6e8cc78
      [    1.713870] x17: 0000000000000041 x16: ffffab09e0bce6f8
      [    1.719278] x15: ffffab09e1c819b7 x14: 0000000000000003
      [    1.724686] x13: 00000000ffffefff x12: 0000000000000000
      [    1.730094] x11: 0000000000000000 x10: 00000000ffffffff
      [    1.735501] x9 : c932f7abfc4bc600 x8 : c932f7abfc4bc600
      [    1.740910] x7 : 077207610770075f x6 : ffff0000f6c38f00
      [    1.746317] x5 : 0000000000000000 x4 : 0000000000000000
      [    1.751723] x3 : 0000000000000000 x2 : 0000000000000000
      [    1.757129] x1 : ffff8000102bb7d8 x0 : 0000000000000032
      [    1.762539] Call trace:
      [    1.765030]  __cfi_check_fail+0x54/0x5c
      [    1.768938]  __cfi_check+0x5fa6c/0x66afc
      [    1.772932]  dwc2_init_params+0xd74/0xd78
      [    1.777012]  dwc2_driver_probe+0x484/0x6ec
      [    1.781180]  platform_drv_probe+0xb4/0x100
      [    1.785350]  really_probe+0x228/0x63c
      [    1.789076]  driver_probe_device+0x80/0xc0
      [    1.793247]  __device_attach_driver+0x114/0x160
      [    1.797857]  bus_for_each_drv+0xa8/0x128
      [    1.801851]  __device_attach.llvm.14901095709067289134+0xc0/0x170
      [    1.808050]  bus_probe_device+0x44/0x100
      [    1.812044]  deferred_probe_work_func+0x78/0xb8
      [    1.816656]  process_one_work+0x204/0x3c4
      [    1.820736]  worker_thread+0x2f0/0x4c4
      [    1.824552]  kthread+0x174/0x184
      [    1.827837]  ret_from_fork+0x10/0x18
      
      CFI validates that all indirect calls go to a function with the same
      exact function pointer prototype. In this case, dwc2_set_bcm_params
      is the target, which has a parameter of type 'struct dwc2_hsotg *',
      but it is being implicitly cast to have a parameter of type 'void *'
      because that is the set_params function pointer prototype. Make the
      function pointer protoype match the definitions so that there is no
      more violation.
      
      Fixes: 7de1debc ("usb: dwc2: Remove platform static params")
      Link: https://github.com/ClangBuiltLinux/linux/issues/1107Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      362b9398
  6. 16 9月, 2020 1 次提交
    • M
      usb: dwc2: Always disable regulators on driver teardown · 871e6496
      Marc Zyngier 提交于
      If the dwc2 driver fails to probe after having enabled the regulators,
      it ends up being unregistered with regulators enabled, something the
      core regulator code is legitimately upset about:
      
         dwc2 ff400000.usb: supply vusb_d not found, using dummy regulator
         dwc2 ff400000.usb: supply vusb_a not found, using dummy regulator
         dwc2 ff400000.usb: dwc2_core_reset: HANG! AHB Idle timeout GRSTCTL GRSTCTL_AHBIDLE
         WARNING: CPU: 2 PID: 112 at drivers/regulator/core.c:2074 _regulator_put.part.0+0x16c/0x174
         Modules linked in: dwc2(E+) dwc3(E) udc_core(E) rtc_hym8563(E) dwmac_generic(E) ulpi(E) usbcore(E) dwc3_meson_g12a(E) roles(E) meson_gx_mmc(E+) i2c_meson(E) mdio_mux_meson_g12a(E) mdio_mux(E) dwmac_meson8b(E) stmmac_platform(E) stmmac(E) mdio_xpcs(E) phylink(E) of_mdio(E) fixed_phy(E) libphy(E) pwm_regulator(E) fixed(E)
         CPU: 2 PID: 112 Comm: systemd-udevd Tainted: G            E     5.9.0-rc4-00102-g423583bc8cf9 #1840
         Hardware name: amlogic w400/w400, BIOS 2020.04 05/22/2020
         pstate: 80400009 (Nzcv daif +PAN -UAO BTYPE=--)
         pc : _regulator_put.part.0+0x16c/0x174
         lr : regulator_bulk_free+0x6c/0x9c
         sp : ffffffc012353820
         x29: ffffffc012353820 x28: ffffff805a4b7000
         x27: ffffff8059c2eac0 x26: ffffff8059c2e810
         x25: ffffff805a4b7d00 x24: ffffffc008cf3028
         x23: ffffffc011729ef8 x22: ffffff807e2761d8
         x21: ffffffc01171df78 x20: ffffff805a4b7700
         x19: ffffff805a4b7700 x18: 0000000000000030
         x17: 0000000000000000 x16: 0000000000000000
         x15: ffffff807ea8d178 x14: 3935312820435455
         x13: 2038323a36313a37 x12: ffffffffffffffff
         x11: 0000000000000040 x10: 0000000000000007
         x9 : ffffffc0106f77d0 x8 : ffffffffffffffe0
         x7 : ffffffffffffffff x6 : 0000000000017702
         x5 : ffffff805a4b7400 x4 : 0000000000000000
         x3 : ffffffc01171df78 x2 : ffffff807ea8cc40
         x1 : 0000000000000000 x0 : 0000000000000001
         Call trace:
          _regulator_put.part.0+0x16c/0x174
          regulator_bulk_free+0x6c/0x9c
          devm_regulator_bulk_release+0x28/0x3c
          release_nodes+0x1c8/0x2c0
          devres_release_all+0x44/0x6c
          really_probe+0x1ec/0x504
          driver_probe_device+0x100/0x170
          device_driver_attach+0xcc/0xd4
          __driver_attach+0xb0/0x17c
          bus_for_each_dev+0x7c/0xd4
          driver_attach+0x30/0x3c
          bus_add_driver+0x154/0x250
          driver_register+0x84/0x140
          __platform_driver_register+0x54/0x60
          dwc2_platform_driver_init+0x2c/0x1000 [dwc2]
          do_one_initcall+0x54/0x2d0
          do_init_module+0x68/0x29c
      
      In order to fix this, tie the regulator disabling to the teardown
      process by registering a devm action callback. This makes sure that
      the regulators are disabled at the right time (just before they are
      released).
      
      Cc: Minas Harutyunyan <hminas@synopsys.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20200914130634.2424496-1-maz@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      871e6496
  7. 27 7月, 2020 2 次提交
  8. 24 7月, 2020 1 次提交
    • M
      usb: dwc2: Fix error path in gadget registration · 33a06f13
      Marek Szyprowski 提交于
      When gadget registration fails, one should not call usb_del_gadget_udc().
      Ensure this by setting gadget->udc to NULL. Also in case of a failure
      there is no need to disable low-level hardware, so return immiedetly
      instead of jumping to error_init label.
      
      This fixes the following kernel NULL ptr dereference on gadget failure
      (can be easily triggered with g_mass_storage without any module
      parameters):
      
      dwc2 12480000.hsotg: dwc2_check_params: Invalid parameter besl=1
      dwc2 12480000.hsotg: dwc2_check_params: Invalid parameter g_np_tx_fifo_size=1024
      dwc2 12480000.hsotg: EPs: 16, dedicated fifos, 7808 entries in SPRAM
      Mass Storage Function, version: 2009/09/11
      LUN: removable file: (no medium)
      no file given for LUN0
      g_mass_storage 12480000.hsotg: failed to start g_mass_storage: -22
      8<--- cut here ---
      Unable to handle kernel NULL pointer dereference at virtual address 00000104
      pgd = (ptrval)
      [00000104] *pgd=00000000
      Internal error: Oops: 805 [#1] PREEMPT SMP ARM
      Modules linked in:
      CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.8.0-rc5 #3133
      Hardware name: Samsung Exynos (Flattened Device Tree)
      Workqueue: events deferred_probe_work_func
      PC is at usb_del_gadget_udc+0x38/0xc4
      LR is at __mutex_lock+0x31c/0xb18
      ...
      Process kworker/0:1 (pid: 12, stack limit = 0x(ptrval))
      Stack: (0xef121db0 to 0xef122000)
      ...
      [<c076bf3c>] (usb_del_gadget_udc) from [<c0726bec>] (dwc2_hsotg_remove+0x10/0x20)
      [<c0726bec>] (dwc2_hsotg_remove) from [<c0711208>] (dwc2_driver_probe+0x57c/0x69c)
      [<c0711208>] (dwc2_driver_probe) from [<c06247c0>] (platform_drv_probe+0x6c/0xa4)
      [<c06247c0>] (platform_drv_probe) from [<c0621df4>] (really_probe+0x200/0x48c)
      [<c0621df4>] (really_probe) from [<c06221e8>] (driver_probe_device+0x78/0x1fc)
      [<c06221e8>] (driver_probe_device) from [<c061fcd4>] (bus_for_each_drv+0x74/0xb8)
      [<c061fcd4>] (bus_for_each_drv) from [<c0621b54>] (__device_attach+0xd4/0x16c)
      [<c0621b54>] (__device_attach) from [<c0620c98>] (bus_probe_device+0x88/0x90)
      [<c0620c98>] (bus_probe_device) from [<c06211b0>] (deferred_probe_work_func+0x3c/0xd0)
      [<c06211b0>] (deferred_probe_work_func) from [<c0149280>] (process_one_work+0x234/0x7dc)
      [<c0149280>] (process_one_work) from [<c014986c>] (worker_thread+0x44/0x51c)
      [<c014986c>] (worker_thread) from [<c0150b1c>] (kthread+0x158/0x1a0)
      [<c0150b1c>] (kthread) from [<c0100114>] (ret_from_fork+0x14/0x20)
      Exception stack(0xef121fb0 to 0xef121ff8)
      ...
      ---[ end trace 9724c2fc7cc9c982 ]---
      
      While fixing this also fix the double call to dwc2_lowlevel_hw_disable()
      if dr_mode is set to USB_DR_MODE_PERIPHERAL. In such case low-level
      hardware is already disabled before calling usb_add_gadget_udc(). That
      function correctly preserves low-level hardware state, there is no need
      for the second unconditional dwc2_lowlevel_hw_disable() call.
      
      Fixes: 207324a3 ("usb: dwc2: Postponed gadget registration to the udc class driver")
      Acked-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      33a06f13
  9. 23 7月, 2020 2 次提交
  10. 15 7月, 2020 2 次提交
  11. 09 7月, 2020 1 次提交
  12. 03 7月, 2020 1 次提交
  13. 01 7月, 2020 1 次提交
  14. 24 6月, 2020 1 次提交
  15. 18 6月, 2020 2 次提交
  16. 25 5月, 2020 2 次提交
  17. 05 5月, 2020 1 次提交
  18. 16 4月, 2020 1 次提交
  19. 24 3月, 2020 1 次提交
  20. 15 3月, 2020 3 次提交
  21. 24 2月, 2020 1 次提交
  22. 11 2月, 2020 2 次提交
  23. 15 1月, 2020 3 次提交