1. 02 Oct, 2020 40 commits
    • Peter Chen's avatar
      usb: cdns3: drd: call PHY .set_mode accordingly · 9f650135
      Peter Chen authored
      Some PHYs may need to enter related mode, and do some settings.
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      9f650135
    • Peter Chen's avatar
      usb: cdns3: gadget: clear the interrupt status when disconnect the host · 0eeda059
      Peter Chen authored
      It is meaningless to handle any interrupts after disconnecting
      with host
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      0eeda059
    • Peter Chen's avatar
      usb: cdns3: gadget: set fast access bit · b5148d94
      Peter Chen authored
      Below is the recommendation from Cadence designer:
      	Using this bit to be sure that PHY clock is keeping up in active
      	state. It's good to keep Fast Access bit enabled as long as there
      	is any access to USB register.
      
      It is used to fix the potential ARM core hang when visit controller
      register after DEVDS (.pullup is cleared) is set, the threaded irq
      may be scheduled at that time.
      
      Cc: Pawel Laszczak <pawell@cadence.com>
      Reviewed-by: default avatarJun Li <jun.li@nxp.com>
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      b5148d94
    • Peter Chen's avatar
      usb: cdns3: core: quit if it uses role switch class · 50642709
      Peter Chen authored
      If the board uses role switch class for switching the role, it should
      not depends on SoC OTG hardware siginal any more, so quit early.
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      50642709
    • Raymond Tan's avatar
      usb: dwc3: pci: Allow Elkhart Lake to utilize DSM method for PM functionality · a609ce2a
      Raymond Tan authored
      Similar to some other IA platforms, Elkhart Lake too depends on the
      PMU register write to request transition of Dx power state.
      
      Thus, we add the PCI_DEVICE_ID_INTEL_EHLLP to the list of devices that
      shall execute the ACPI _DSM method during D0/D3 sequence.
      
      [heikki.krogerus@linux.intel.com: included Fixes tag]
      
      Fixes: dbb0569d ("usb: dwc3: pci: Add Support for Intel Elkhart Lake Devices")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarRaymond Tan <raymond.tan@intel.com>
      Signed-off-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      a609ce2a
    • Marc Zyngier's avatar
      usb: dwc2: Always disable regulators on driver teardown · 54c19606
      Marc Zyngier authored
      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: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      54c19606
    • Pawel Laszczak's avatar
      usb: gadget: config_ep_by_speed_and_alt instead of config_ep_by_speed · 864bc7e7
      Pawel Laszczak authored
      This patch replace config_ep_by_speed with config_ep_by_speed_and_alt.
      This change allows to select proper usb_ss_ep_comp_descriptor for each
      stream capable endpoints.
      
      f_tcm function for SS use array of headers for both BOT/UAS alternate
      setting:
      
      static struct usb_descriptor_header *uasp_ss_function_desc[] = {
              (struct usb_descriptor_header *) &bot_intf_desc,
              (struct usb_descriptor_header *) &uasp_ss_bi_desc,
              (struct usb_descriptor_header *) &bot_bi_ep_comp_desc,
              (struct usb_descriptor_header *) &uasp_ss_bo_desc,
              (struct usb_descriptor_header *) &bot_bo_ep_comp_desc,
      
              (struct usb_descriptor_header *) &uasp_intf_desc,
              (struct usb_descriptor_header *) &uasp_ss_bi_desc,
              (struct usb_descriptor_header *) &uasp_bi_ep_comp_desc,
              (struct usb_descriptor_header *) &uasp_bi_pipe_desc,
              (struct usb_descriptor_header *) &uasp_ss_bo_desc,
              (struct usb_descriptor_header *) &uasp_bo_ep_comp_desc,
              (struct usb_descriptor_header *) &uasp_bo_pipe_desc,
              (struct usb_descriptor_header *) &uasp_ss_status_desc,
              (struct usb_descriptor_header *) &uasp_status_in_ep_comp_desc,
              (struct usb_descriptor_header *) &uasp_status_pipe_desc,
              (struct usb_descriptor_header *) &uasp_ss_cmd_desc,
              (struct usb_descriptor_header *) &uasp_cmd_comp_desc,
              (struct usb_descriptor_header *) &uasp_cmd_pipe_desc,
              NULL,
      };
      
      The first 5 descriptors are associated with BOT alternate setting,
      and others are associated with UAS.
      
      During handling UAS alternate setting f_tcm driver invokes
      config_ep_by_speed and this function sets incorrect companion endpoint
      descriptor in usb_ep object.
      
      Instead setting ep->comp_desc to uasp_bi_ep_comp_desc function in this
      case set ep->comp_desc to bot_uasp_ss_bi_desc.
      
      And in result it uses the descriptor from BOT alternate setting
      instead UAS.
      
      Finally, it causes that controller driver during enabling endpoints
      detect that just enabled endpoint for bot.
      Signed-off-by: default avatarJayshri Pawar <jpawar@cadence.com>
      Signed-off-by: default avatarPawel Laszczak <pawell@cadence.com>
      Reviewed-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      864bc7e7
    • Qinglang Miao's avatar
      usb: gadget: lpc32xx_udc: Convert to DEFINE_SHOW_ATTRIBUTE · 5bb1d119
      Qinglang Miao authored
      Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
      Acked-by: default avatarVladimir Zapolskiy <vz@mleia.com>
      Signed-off-by: default avatarQinglang Miao <miaoqinglang@huawei.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      5bb1d119
    • Christian Lamparter's avatar
      usb: dwc2: add support for APM82181 USB OTG · 0abe3863
      Christian Lamparter authored
      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: default avatarChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      0abe3863
    • Christian Lamparter's avatar
      dt-bindings: usb: dwc2: add support for APM82181 SoCs USB OTG HS and FS · 704c70fa
      Christian Lamparter authored
      adds the specific compatible string for the DWC2 IP found in the APM82181
      SoCs. The APM82181's USB-OTG seems like it was taken from its direct
      predecessor: the PPC460EX (canyonlands).
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      704c70fa
    • Bryan O'Donoghue's avatar
      USB: gadget: f_ncm: Fix NDP16 datagram validation · 028296e4
      Bryan O'Donoghue authored
      commit 2b74b0a0 ("USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb()")
      adds important bounds checking however it unfortunately also introduces  a
      bug with respect to section 3.3.1 of the NCM specification.
      
      wDatagramIndex[1] : "Byte index, in little endian, of the second datagram
      described by this NDP16. If zero, then this marks the end of the sequence
      of datagrams in this NDP16."
      
      wDatagramLength[1]: "Byte length, in little endian, of the second datagram
      described by this NDP16. If zero, then this marks the end of the sequence
      of datagrams in this NDP16."
      
      wDatagramIndex[1] and wDatagramLength[1] respectively then may be zero but
      that does not mean we should throw away the data referenced by
      wDatagramIndex[0] and wDatagramLength[0] as is currently the case.
      
      Breaking the loop on (index2 == 0 || dg_len2 == 0) should come at the end
      as was previously the case and checks for index2 and dg_len2 should be
      removed since zero is valid.
      
      I'm not sure how much testing the above patch received but for me right now
      after enumeration ping doesn't work. Reverting the commit restores ping,
      scp, etc.
      
      The extra validation associated with wDatagramIndex[0] and
      wDatagramLength[0] appears to be valid so, this change removes the incorrect
      restriction on wDatagramIndex[1] and wDatagramLength[1] restoring data
      processing between host and device.
      
      Fixes: 2b74b0a0 ("USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb()")
      Cc: Ilja Van Sprundel <ivansprundel@ioactive.com>
      Cc: Brooke Basile <brookebasile@gmail.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      028296e4
    • Pawel Laszczak's avatar
      usb: cdns3: Enable workaround for USB2.0 PHY Rx compliance test PHY lockup · 2eae2dfd
      Pawel Laszczak authored
      USB2.0 PHY hangs in Rx Compliance test when the incoming packet
      amplitude is varied below and above the Squelch Level of
      Receiver during the active packet multiple times.
      
      Version 1 of the controller allows PHY to be reset when RX fail condition
      is detected to work around the above issue. This feature is
      disabled by default and needs to be enabled using a bit from
      the newly added PHYRST_CFG register. This patch enables the workaround.
      
      There is no way to know controller version before device controller
      is started and the workaround needs to be applied for both host and
      device modes, so we rely on a DT property do decide when to
      apply the workaround.
      Signed-off-by: default avatarPawel Laszczak <pawell@cadence.com>
      Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      2eae2dfd
    • Roger Quadros's avatar
      dt-bindings: usb: cdns,usb3: Add cdns,phyrst-a-enable property · 5261e48f
      Roger Quadros authored
      Controller version 0x0002450D has USB2 PHY RX sensitivity issues
      that needs to be worked around by enabling phyrst-a-enable bit
      in PHYRST_CFG register.
      
      There is no way to know controller version before device controller
      is started and the workaround needs to be applied for both host and
      device modes, so we add this DT property.
      Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      5261e48f
    • Roger Quadros's avatar
      dt-bindings: usb: Convert cdns-usb3.txt to YAML schema · 68989fe1
      Roger Quadros authored
      Converts cdns-usb3.txt to YAML schema cdns,usb3.yaml
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      68989fe1
    • Neil Armstrong's avatar
      usb: dwc-meson-g12a: Add support for USB on AXG SoCs · 65f3d449
      Neil Armstrong authored
      The Amlogic AXG is close to the GXL Glue but with a single OTG PHY.
      
      It needs the same init sequence as GXL & GXM, but it seems it doesn't need
      the host disconnect bit.
      Reviewed-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Reviewed-by: default avatarKevin Hilman <khilman@baylibre.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      65f3d449
    • Neil Armstrong's avatar
      dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic AXG Families USB Glue Bindings · cdff2c94
      Neil Armstrong authored
      The Amlogic AXG is close to the GXL Glue but with a single OTG PHY.
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Reviewed-by: default avatarKevin Hilman <khilman@baylibre.com>
      Acked-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      cdff2c94
    • Lad Prabhakar's avatar
      dt-bindings: usb: renesas,usb-xhci: Document r8a774e1 support · 5d23af63
      Lad Prabhakar authored
      Document r8a774e1 xhci support. The driver will use the fallback
      compatible string "renesas,rcar-gen3-xhci", therefore no driver
      change is needed.
      Reviewed-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
      Reviewed-by: default avatarMarian-Cristian Rotariu <marian-cristian.rotariu.rb@bp.renesas.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      5d23af63
    • Linus Walleij's avatar
      usb: gadget: pch_udc: Convert to use GPIO descriptors · e20849a8
      Linus Walleij authored
      This switches the PCH UDC driver to use GPIO descriptors. The way
      this is supposed to be used is confusing. The code contains the
      following:
      
          /* GPIO port for VBUS detecting */
          static int vbus_gpio_port = -1; /* GPIO port number (-1:Not used) */
      
      So a hardcoded GPIO number in the code. Further the probe() path
      very clearly will exit if the GPIO is not found, so this driver
      can only be configured by editing the code, hard-coding a GPIO
      number into this variable.
      
      This is simply not how we do things. My guess is that this is
      used in products by patching a GPIO number into this variable and
      shipping a kernel that is compile-time tailored for the target
      system.
      
      I switched this mechanism to using a GPIO descriptor associated
      with the parent PCI device. This can be added by using the 16bit
      subsystem ID or similar to identify which exact machine we are
      running on and what GPIO is present on that machine, and then
      add a GPIO descriptor using gpiod_add_lookup_table() from
      <linux/gpio/machine.h>. Since I don't have any target systems
      I cannot add this but I'm happy to help. I put in a FIXME so
      the people actually using this driver knows what to do.
      
      Cc: Felipe Balbi <balbi@kernel.org>
      Tested-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      e20849a8
    • Peter Chen's avatar
      usb: cdns3: imx: add glue layer runtime pm implementation · ff6d6e6c
      Peter Chen authored
      Add imx glue layer runtime pm implementation, and the runtime
      pm is default off.
      Reviewed-by: default avatarPawel Laszczak <pawell@cadence.com>
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      ff6d6e6c
    • Peter Chen's avatar
      usb: cdns3: add runtime PM support · b1234e3b
      Peter Chen authored
      Introduce runtime PM and wakeup interrupt handler for cdns3,
      the runtime PM is default off since other cdns3 may not
      implement glue layer support for runtime PM.
      
      One typical wakeup event use case is xHCI runtime suspend will clear
      USBCMD.RS bit, after that the xHCI will not trigger any interrupts,
      so its parent (cdns core device) needs to resume xHCI device when
      any (wakeup) events occurs at host port.
      
      When the controller is in low power mode, the lpm flag will be set.
      The interrupt triggered later than lpm flag is set considers as
      wakeup interrupt and handled at cdns_wakeup_irq. Once the wakeup
      occurs, it first disables interrupt to avoid later interrupt
      occurrence since the controller is in low power mode at that
      time, and access registers may be invalid at that time. At wakeup
      handler, it will call pm_request_resume to wakeup xHCI device, and
      at runtime resume handler, it will enable interrupt again.
      
      The API platform_suspend is introduced for glue layer to implement
      platform specific PM sequence.
      Reviewed-by: default avatarPawel Laszczak <pawell@cadence.com>
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      b1234e3b
    • Peter Chen's avatar
      usb: cdns3: introduce set_phy_power_on{off} APIs · efe2fa08
      Peter Chen authored
      Since we have both USB2 and USB3 PHYs for cdns3 controller, it is
      better we have unity APIs to handle both USB2 and USB3's power, it
      could simplify code for error handling and further power management
      implementation.
      Reviewed-by: default avatarPawel Laszczak <pawell@cadence.com>
      Reviewed-by: default avatarJun Li <jun.li@nxp.com>
      Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      efe2fa08
    • YueHaibing's avatar
      usb: mtu3: Remove unsused inline function is_first_entry · 753a18c2
      YueHaibing authored
      It is never used, so can be removed.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      753a18c2
    • Li Jun's avatar
      usb: dwc3: core: do not queue work if dr_mode is not USB_DR_MODE_OTG · dc336b19
      Li Jun authored
      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: default avatarLi Jun <jun.li@nxp.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      dc336b19
    • Zqiang's avatar
      usb: gadget: function: printer: fix use-after-free in __lock_acquire · e8d5f92b
      Zqiang authored
      Fix this by increase object reference count.
      
      BUG: KASAN: use-after-free in __lock_acquire+0x3fd4/0x4180
      kernel/locking/lockdep.c:3831
      Read of size 8 at addr ffff8880683b0018 by task syz-executor.0/3377
      
      CPU: 1 PID: 3377 Comm: syz-executor.0 Not tainted 5.6.11 #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0xce/0x128 lib/dump_stack.c:118
       print_address_description.constprop.4+0x21/0x3c0 mm/kasan/report.c:374
       __kasan_report+0x131/0x1b0 mm/kasan/report.c:506
       kasan_report+0x12/0x20 mm/kasan/common.c:641
       __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
       __lock_acquire+0x3fd4/0x4180 kernel/locking/lockdep.c:3831
       lock_acquire+0x127/0x350 kernel/locking/lockdep.c:4488
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159
       printer_ioctl+0x4a/0x110 drivers/usb/gadget/function/f_printer.c:723
       vfs_ioctl fs/ioctl.c:47 [inline]
       ksys_ioctl+0xfb/0x130 fs/ioctl.c:763
       __do_sys_ioctl fs/ioctl.c:772 [inline]
       __se_sys_ioctl fs/ioctl.c:770 [inline]
       __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770
       do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x4531a9
      Code: ed 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48
      89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d
      01 f0 ff ff 0f 83 bb 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007fd14ad72c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
      RAX: ffffffffffffffda RBX: 000000000073bfa8 RCX: 00000000004531a9
      RDX: fffffffffffffff9 RSI: 000000000000009e RDI: 0000000000000003
      RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004bbd61
      R13: 00000000004d0a98 R14: 00007fd14ad736d4 R15: 00000000ffffffff
      
      Allocated by task 2393:
       save_stack+0x21/0x90 mm/kasan/common.c:72
       set_track mm/kasan/common.c:80 [inline]
       __kasan_kmalloc.constprop.3+0xa7/0xd0 mm/kasan/common.c:515
       kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529
       kmem_cache_alloc_trace+0xfa/0x2d0 mm/slub.c:2813
       kmalloc include/linux/slab.h:555 [inline]
       kzalloc include/linux/slab.h:669 [inline]
       gprinter_alloc+0xa1/0x870 drivers/usb/gadget/function/f_printer.c:1416
       usb_get_function+0x58/0xc0 drivers/usb/gadget/functions.c:61
       config_usb_cfg_link+0x1ed/0x3e0 drivers/usb/gadget/configfs.c:444
       configfs_symlink+0x527/0x11d0 fs/configfs/symlink.c:202
       vfs_symlink+0x33d/0x5b0 fs/namei.c:4201
       do_symlinkat+0x11b/0x1d0 fs/namei.c:4228
       __do_sys_symlinkat fs/namei.c:4242 [inline]
       __se_sys_symlinkat fs/namei.c:4239 [inline]
       __x64_sys_symlinkat+0x73/0xb0 fs/namei.c:4239
       do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Freed by task 3368:
       save_stack+0x21/0x90 mm/kasan/common.c:72
       set_track mm/kasan/common.c:80 [inline]
       kasan_set_free_info mm/kasan/common.c:337 [inline]
       __kasan_slab_free+0x135/0x190 mm/kasan/common.c:476
       kasan_slab_free+0xe/0x10 mm/kasan/common.c:485
       slab_free_hook mm/slub.c:1444 [inline]
       slab_free_freelist_hook mm/slub.c:1477 [inline]
       slab_free mm/slub.c:3034 [inline]
       kfree+0xf7/0x410 mm/slub.c:3995
       gprinter_free+0x49/0xd0 drivers/usb/gadget/function/f_printer.c:1353
       usb_put_function+0x38/0x50 drivers/usb/gadget/functions.c:87
       config_usb_cfg_unlink+0x2db/0x3b0 drivers/usb/gadget/configfs.c:485
       configfs_unlink+0x3b9/0x7f0 fs/configfs/symlink.c:250
       vfs_unlink+0x287/0x570 fs/namei.c:4073
       do_unlinkat+0x4f9/0x620 fs/namei.c:4137
       __do_sys_unlink fs/namei.c:4184 [inline]
       __se_sys_unlink fs/namei.c:4182 [inline]
       __x64_sys_unlink+0x42/0x50 fs/namei.c:4182
       do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      The buggy address belongs to the object at ffff8880683b0000
       which belongs to the cache kmalloc-1k of size 1024
      The buggy address is located 24 bytes inside of
       1024-byte region [ffff8880683b0000, ffff8880683b0400)
      The buggy address belongs to the page:
      page:ffffea0001a0ec00 refcount:1 mapcount:0 mapping:ffff88806c00e300
      index:0xffff8880683b1800 compound_mapcount: 0
      flags: 0x100000000010200(slab|head)
      raw: 0100000000010200 0000000000000000 0000000600000001 ffff88806c00e300
      raw: ffff8880683b1800 000000008010000a 00000001ffffffff 0000000000000000
      page dumped because: kasan: bad access detected
      Reported-by: default avatarKyungtae Kim <kt0755@gmail.com>
      Signed-off-by: default avatarZqiang <qiang.zhang@windriver.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      e8d5f92b
    • Florian Fainelli's avatar
      MAINTAINERS: Add entry for Broadcom BDC driver · aa8c16e4
      Florian Fainelli authored
      The Broadcom BDC driver did not have a MAINTAINERS entry which made it
      escape review from Al and myself, add an entry so the relevant mailing
      lists and people are copied.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      aa8c16e4
    • Michał Mirosław's avatar
      usb: gadget: f_acm: don't disable disabled EP · e7a0ed3f
      Michał Mirosław authored
      Make debugging real problems easier by not trying to disable an EP that
      was not yet enabled.
      Reviewed-by: default avatarPeter Chen <peter.chen@nxp.com>
      Signed-off-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      e7a0ed3f
    • Tao Ren's avatar
      usb: gadget: aspeed: fixup vhub port irq handling · a1c0169a
      Tao Ren authored
      This is a follow-on patch for commit a23be4ed ("usb: gadget: aspeed:
      improve vhub port irq handling"): for_each_set_bit() is replaced with
      simple for() loop because for() loop runs faster on ASPEED BMC.
      Signed-off-by: default avatarTao Ren <rentao.bupt@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      a1c0169a
    • Felipe Balbi's avatar
      usb: dwc3: gadget: fix checkpatch warnings · e319bd62
      Felipe Balbi authored
      no functional changes
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      e319bd62
    • Felipe Balbi's avatar
      usb: dwc3: core: fix checkpatch warnings · 87b923a2
      Felipe Balbi authored
      no functional changes
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      87b923a2
    • Felipe Balbi's avatar
      usb: dwc3: debugfs: fix checkpatch warnings · 9ae0eb45
      Felipe Balbi authored
      no functional changes
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      9ae0eb45
    • Felipe Balbi's avatar
      usb: dwc3: qcom: fix checkpatch warnings · 993ffc5b
      Felipe Balbi authored
      no functional changes
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      993ffc5b
    • Felipe Balbi's avatar
      usb: dwc3: ep0: fix checkpatch warnings · c64b475b
      Felipe Balbi authored
      no functional changes
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      c64b475b
    • Felipe Balbi's avatar
      usb: dwc3: debug: fix checkpatch warning · 035cbca1
      Felipe Balbi authored
      no functional changes
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      035cbca1
    • Felipe Balbi's avatar
      usb: dwc3: trace: fix checkpatch warnings · 159fdf29
      Felipe Balbi authored
      no functional changes
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      159fdf29
    • Felipe Balbi's avatar
      usb: dwc3: ulpi: fix checkpatch warning · 2a499b45
      Felipe Balbi authored
      no functional changes.
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      2a499b45
    • Felipe Balbi's avatar
      usb: dwc3: meson: fix checkpatch errors and warnings · e5ee93d4
      Felipe Balbi authored
      no functional changes.
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      e5ee93d4
    • Felipe Balbi's avatar
      usb: dwc3: debug: fix sparse warning · 27c7ab0f
      Felipe Balbi authored
      Fix the following sparse warning:
      
      drivers/usb/dwc3/trace.c: note: in included file (through drivers/usb/dwc3/trace.h):
      drivers/usb/dwc3/debug.h:374:39: warning: cast to non-scalar
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      27c7ab0f
    • Felipe Balbi's avatar
      usb: dwc3: meson: fix coccinelle WARNING · a793cf81
      Felipe Balbi authored
      Coccinelle suggests using PTR_ERR_OR_ZERO().
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      a793cf81
    • Sandeep Maheswaram's avatar
      usb: dwc3: qcom: Add interconnect support in dwc3 driver · bea46b98
      Sandeep Maheswaram authored
      Add interconnect support in dwc3-qcom driver to vote for bus
      bandwidth.
      
      This requires for two different paths - from USB to
      DDR. The other is from APPS to USB.
      Reviewed-by: default avatarMatthias Kaehlcke <mka@chromium.org>
      Signed-off-by: default avatarSandeep Maheswaram <sanm@codeaurora.org>
      Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      bea46b98
    • Linus Walleij's avatar
      usb: gadget: udc: Drop surplus include · 072f34c2
      Linus Walleij authored
      The UDC NET2272 driver includes <linux/gpio.h> but does not
      use any symbols from this file, so drop the include.
      
      Cc: Felipe Balbi <balbi@kernel.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
      072f34c2