Commit Graph

1105904 Commits

Author SHA1 Message Date
Prashant Malani
ddaf8d96f9 usb: typec: Add support for retimers
Introduce a retimer device class and associated functions that register
and use retimer "switch" devices. These operate in a manner similar to
the "mode-switch" and help configure retimers that exist between the
Type-C connector and host controller(s).

Type C ports can be linked to retimers using firmware node device
references (again, in a manner similar to "mode-switch").

There are no new sysfs files being created; there is the new retimer
class directory, but there are no class-specific files being created
there.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20220711072333.2064341-2-pmalani@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:24:05 +02:00
Johan Hovold
69bb3520db usb: dwc3: qcom: fix missing optional irq warnings
Not all platforms have all of the four currently supported wakeup
interrupts so use the optional irq helpers when looking up interrupts to
avoid printing error messages when an optional interrupt is not found:

	dwc3-qcom a6f8800.usb: error -ENXIO: IRQ hs_phy_irq not found

Fixes: a4333c3a6b ("usb: dwc3: Add Qualcomm DWC3 glue driver")
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20220713131340.29401-4-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:11:43 +02:00
Johan Hovold
dd566faebe dt-bindings: usb: qcom,dwc3: refine interrupt requirements
Not all platforms have all of the four wakeup interrupts currently
described by the bindings.

Specifically, MSM8953/6/8 and SDM660 do not use the DP/DM interrupts,
while the SS PHY interrupt is optional on SDM660 and SC7280.

Note that no devicetree in mainline specify any wakeup interrupts for

  - qcom,ipq4019-dwc3
  - qcom,ipq6018-dwc3
  - qcom,ipq8064-dwc3
  - qcom,ipq8074-dwc3
  - qcom,msm8994-dwc3
  - qcom,qcs404-dwc3

but let's keep the schema warnings about that for now.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20220713131340.29401-3-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:11:43 +02:00
Johan Hovold
a5c7592366 dt-bindings: usb: qcom,dwc3: add SC8280XP binding
Add SC8280XP to the DT schema.

Note that the SC8280XP controllers use the common set of five clocks and
an additional set of four interconnect clocks whose purpose is not
entirely clear at this point.

The set of wakeup interrupts is also different for SC8280XP.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20220713131340.29401-2-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:11:42 +02:00
Xin Ji
fe6d8a9c8e usb: typec: anx7411: Add Analogix PD ANX7411 support
Add driver for analogix ANX7411 USB Type-C DRP port controller.

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Xin Ji <xji@analogixsemi.com>
Link: https://lore.kernel.org/r/20220714081350.36447-2-xji@analogixsemi.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:10:57 +02:00
Xin Ji
4af3719113 dt-bindings: usb: Add analogix anx7411 PD binding
Add analogix PD chip anx7411 device binding

Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Xin Ji <xji@analogixsemi.com>
Link: https://lore.kernel.org/r/20220714081350.36447-1-xji@analogixsemi.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:10:57 +02:00
Rohith Kollalsi
07903626d9 usb: dwc3: core: Do not perform GCTL_CORE_SOFTRESET during bootup
According to the programming guide, it is recommended to
perform a GCTL_CORE_SOFTRESET only when switching the mode
from device to host or host to device. However, it is found
that during bootup when __dwc3_set_mode() is called for the
first time, GCTL_CORESOFTRESET is done with suspendable bit(BIT 17)
of DWC3_GUSB3PIPECTL set. This some times leads to issues
like controller going into bad state and controller registers
reading value zero. Until GCTL_CORESOFTRESET is done and
run/stop bit is set core initialization is not complete.
Setting suspendable bit of DWC3_GUSB3PIPECTL and then
performing GCTL_CORESOFTRESET is therefore not recommended.
Avoid this by only performing the reset if current_dr_role is set,
that is, when doing subsequent role switching.

Fixes: f88359e158 ("usb: dwc3: core: Do core softreset when switch mode")
Signed-off-by: Rohith Kollalsi <quic_rkollals@quicinc.com>
Link: https://lore.kernel.org/r/20220714045625.20377-1-quic_rkollals@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:10:30 +02:00
Liang He
220fafb4ed usb: aspeed-vhub: Fix refcount leak bug in ast_vhub_init_desc()
We should call of_node_put() for the reference returned by
of_get_child_by_name() which has increased the refcount.

Fixes: 30d2617fd7 ("usb: gadget: aspeed: allow to set usb strings in device tree")
Signed-off-by: Liang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220713120528.368168-1-windhl@126.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:10:12 +02:00
Jiangshan Yi
efa2bebf2a usb: ldusb: replace ternary operator with max_t()
Fix the following coccicheck warning:

drivers/usb/misc/ldusb.c:719: WARNING opportunity for max().
drivers/usb/misc/ldusb.c:721: WARNING opportunity for max().

max_t() macro is defined in include/linux/minmax.h. It avoids
multiple evaluations of the arguments when non-constant and performs
strict type-checking.

Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
Link: https://lore.kernel.org/r/20220713070205.3047256-1-13667453960@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:09:56 +02:00
Wesley Cheng
5e76ee96be usb: dwc3: ep0: Properly handle setup_packet_pending scenario in data stage
During a 3 stage SETUP transfer, if the host sends another SETUP token
before completing the status phase, it signifies that the host has aborted
the current control transfer.  Currently, if a setup_packet_pending is
received, there are no subsequent calls to dwc3_ep0_out_start() to fetch
the new SETUP packet.  This leads to a stall on EP0, as host does not
expect another STATUS phase as it has aborted the current transfer.

Fix this issue by explicitly stalling and restarting EP0, as well as
resetting the trb_enqueue indexes.  (without this, there is a chance the
SETUP TRB is set up on trb_endqueue == 1)

Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220712014403.2977-1-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:09:43 +02:00
Matthias Kaehlcke
2d937c64e8 usb: misc: onboard_hub: Fix 'missing prototype' warning
When building with 'W=1' the compiler complains about missing
prototypes for onboard_hub_create/destroy_pdevs(). Include the
header with the prototypes to fix this.

Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20220711092431.1.I4016c759fd7fe2b32dd482994a20661f36e2cae3@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:09:32 +02:00
Nícolas F. R. A. Prado
aae7948d56 Revert "dt-bindings: usb: mtk-xhci: Make all clocks required"
This reverts commit ebc4969ae1. That
commit was supposed to make the binding better reflect the MediaTek XHCI
hardware block by requiring all clocks to be present. But doing that
also causes too much noise in the devicetrees, since it requires
updating old MediaTek DTs to add clock handles for the fixed clocks, and
going forward every new clock added to the binding would require even
more updates.

The commit also didn't update the example to match the changes, causing
additional warnings.

Instead let's keep the clocks optional so that old devicetrees can keep
omitting the fixed clocks, and we'll just add the clocks as required on
new DTs.

Fixes: ebc4969ae1 ("dt-bindings: usb: mtk-xhci: Make all clocks required")
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Link: https://lore.kernel.org/r/20220708192605.43351-1-nfraprado@collabora.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:07:14 +02:00
Maxim Devaev
421c8d9a20 usb: gadget: f_mass_storage: forced_eject attribute
It allows to reset prevent_medium_removal flag and "eject" the image.
This can be useful to free the drive from a hunging host or if the host
continues to use the drive even after unmounting (Linux does this).
It's also a bit like using an unfolded paperclip on an optical drive.

Previously, the undocumented method of sending SIGUSR1 to a special
"file-storage" kernel thread could be used for these purposes,
but when using multiple storages there was no way to distinguish
one from the other, so we had to send a signal to everyone.

Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Maxim Devaev <mdevaev@gmail.com>
Link: https://lore.kernel.org/r/20220711102956.19642-1-mdevaev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:06:42 +02:00
Randy Dunlap
8097cf2fb3 usb: gadget: udc: amd5536 depends on HAS_DMA
USB_AMD5536UDC should depend on HAS_DMA since it selects USB_SNP_CORE,
which depends on HAS_DMA and since 'select' does not follow any
dependency chains.

Fixes this kconfig warning:

WARNING: unmet direct dependencies detected for USB_SNP_CORE
  Depends on [n]: USB_SUPPORT [=y] && USB_GADGET [=y] && (USB_AMD5536UDC [=y] || USB_SNP_UDC_PLAT [=n]) && HAS_DMA [=n]
  Selected by [y]:
  - USB_AMD5536UDC [=y] && USB_SUPPORT [=y] && USB_GADGET [=y] && USB_PCI [=y]

Fixes: 97b3ffa233 ("usb: gadget: udc: amd5536: split core and PCI layer")
Cc: Raviteja Garimella <raviteja.garimella@broadcom.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: linux-usb@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20220709013601.7536-1-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-14 16:06:24 +02:00
Michael Grzeschik
8affe37c52 usb: dwc3: gadget: fix high speed multiplier setting
For High-Speed Transfers the prepare_one_trb function is calculating the
multiplier setting for the trb based on the length parameter of the trb
currently prepared. This assumption is wrong. For trbs with a sg list,
the length of the actual request has to be taken instead.

Fixes: 40d829fb2e ("usb: dwc3: gadget: Correct ISOC DATA PIDs for short packets")
Cc: stable <stable@kernel.org>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220704141812.1532306-3-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 15:00:35 +02:00
Michael Grzeschik
23385cec5f usb: dwc3: gadget: refactor dwc3_repare_one_trb
The function __dwc3_prepare_one_trb has many parameters. Since it is
only used in dwc3_prepare_one_trb there is no point in keeping the
function. We merge both functions and get rid of the big list of
parameters.

Fixes: 40d829fb2e ("usb: dwc3: gadget: Correct ISOC DATA PIDs for short packets")
Cc: stable <stable@kernel.org>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220704141812.1532306-2-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 15:00:32 +02:00
Bryan O'Donoghue
5ea5746dfa tools: usb: testusb: Add super-plus speed reporting
Add the ability to detect and print the USB speed as "super-plus" if/when
the kernel reports that speed.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20220708115859.2095714-4-bryan.odonoghue@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:54:49 +02:00
Bryan O'Donoghue
7fbcd99ebc tools: usb: testusb: Add super speed reporting
Add the ability to detect and print the USB speed as "super" if/when the
kernel reports that speed.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20220708115859.2095714-3-bryan.odonoghue@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:54:49 +02:00
Bryan O'Donoghue
b067fc2846 tools: usb: testusb: Add wireless speed reporting
Add the ability to detect and print the USB speed as "wireless" if/when the
kernel reports that speed.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lore.kernel.org/r/20220708115859.2095714-2-bryan.odonoghue@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:54:49 +02:00
Matthias Kaehlcke
3a6bf4a081 usb: core: hub: Create platform devices for onboard hubs in hub_probe()
Call onboard_hub_create/destroy_pdevs() from hub_probe/disconnect()
to create/destroy platform devices for onboard USB hubs that may be
connected to the hub. The onboard hubs must have nodes in the
device tree.

onboard_hub_create/destroy_pdevs() are NOPs unless
CONFIG_USB_ONBOARD_HUB=y/m.

Also add a field to struct usb_hub to keep track of the onboard hub
platform devices that are owned by the hub.

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20220630123445.v24.4.Ic9dd36078f9d803de82ca01a6700c58b8e4de27e@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:53:50 +02:00
Matthias Kaehlcke
8bc063641c usb: misc: Add onboard_usb_hub driver
The main issue this driver addresses is that a USB hub needs to be
powered before it can be discovered. For discrete onboard hubs (an
example for such a hub is the Realtek RTS5411) this is often solved
by supplying the hub with an 'always-on' regulator, which is kind
of a hack. Some onboard hubs may require further initialization
steps, like changing the state of a GPIO or enabling a clock, which
requires even more hacks. This driver creates a platform device
representing the hub which performs the necessary initialization.
Currently it only supports switching on a single regulator, support
for multiple regulators or other actions can be added as needed.
Different initialization sequences can be supported based on the
compatible string.

Besides performing the initialization the driver can be configured
to power the hub off during system suspend. This can help to extend
battery life on battery powered devices which have no requirements
to keep the hub powered during suspend. The driver can also be
configured to leave the hub powered when a wakeup capable USB device
is connected when suspending, and power it off otherwise.

Technically the driver consists of two drivers, the platform driver
described above and a very thin USB driver that subclasses the
generic driver. The purpose of this driver is to provide the platform
driver with the USB devices corresponding to the hub(s) (a hub
controller may provide multiple 'logical' hubs, e.g. one to support
USB 2.0 and another for USB 3.x).

Co-developed-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20220630123445.v24.3.I7c9a1f1d6ced41dd8310e8a03da666a32364e790@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:53:50 +02:00
Matthias Kaehlcke
dee6719e88 dt-bindings: usb: rts5411: Rename property 'companion-hub' to 'peer-hub'
In the context of USB the term 'companion-hub' is misleading, change the
name of the property to 'peer-hub'.

There are no upstream users of the 'companion-hub' property, neither in
the device tree, nor on the driver side, so renaming it shouldn't cause
any compatibility issues with existing device trees.

Changes in v24:
- patch added to the series

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20220630123445.v24.2.Ie2bbbd3f690826404b8f1059d24edcab33ed898f@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:53:50 +02:00
Matthias Kaehlcke
620e8e8ba6 of/platform: Add stubs for of_platform_device_create/destroy()
Code for platform_device_create() and of_platform_device_destroy() is
only generated if CONFIG_OF_ADDRESS=y. Add stubs to avoid unresolved
symbols when CONFIG_OF_ADDRESS is not set.

Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20220630123445.v24.1.I08fd2e1c775af04f663730e9fb4d00e6bbb38541@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:53:50 +02:00
Chunfeng Yun
1742b76598 usb: mtu3: support function remote wakeup
Add function wake notification to support function remote wakeup,
currently assume the composite device only enable function wake
for the first interface.

Forward request to function driver when the recipient is an interface,
including:
GetStatus() request to the first interface in a function returns the
information about 'function remote wakeup' and 'function remote wakeup
capalbe';
SetFeature request of FUNCTION_SUSPEND to an interface recipient, the
controller driver saves the suspend option;

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20220708071903.25752-5-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:53:30 +02:00
Chunfeng Yun
683ff6e485 usb: mtu3: check capability of usb3 dual role
It is capable of supporting usb3 dual role if there is at least one
usb3 port for device and xhci controller, we can check it from the
controller's capability, so no need the property "mediatek,usb3-drd"
anymore, but I find the property is not decribed in dt-binding.
Meanwhile, also take into account if the u3 port is disabled when the
u3 phy is shared with pcie.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20220708071903.25752-4-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:53:26 +02:00
Chunfeng Yun
269f49ff38 usb: mtu3: add feature to disable device's usb3 port
We may want to disable device's usb3 port when the combo phy is switched
from usb3 mode to pcie mode for some projects.
Meanwhile rename member @is_u3_ip to @u3_capable to avoid misleading, due
to the member's value may be changed when disable usb3 port, but the
controller is still a usb3 IP which also tells us how to manage the fifo.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20220708071903.25752-3-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:53:23 +02:00
Chunfeng Yun
3cb7982207 usb: mtu3: print endpoint type as string
Print endpoint type as string instead of decimal value to make
the log more readable.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20220708071903.25752-2-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:53:18 +02:00
Xin Ji
7963d4d710 usb: typec: tcpci: move tcpci.h to include/linux/usb/
USB PD controllers which consisting of a microcontroller (acting as the TCPM)
and a port controller (TCPC) - may require that the driver for the PD
controller accesses directly also the on-chip port controller in some cases.

Move tcpci.h to include/linux/usb/ is convenience access TCPC registers.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Xin Ji <xji@analogixsemi.com>

Link: https://lore.kernel.org/r/20220706083433.2415524-1-xji@analogixsemi.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:51:16 +02:00
Jozef Martiniak
04cb742d4d gadgetfs: ep_io - wait until IRQ finishes
after usb_ep_queue() if wait_for_completion_interruptible() is
interrupted we need to wait until IRQ gets finished.

Otherwise complete() from epio_complete() can corrupt stack.

Signed-off-by: Jozef Martiniak <jomajm@gmail.com>
Link: https://lore.kernel.org/r/20220708070645.6130-1-jomajm@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:50:43 +02:00
Chunfeng Yun
2e1421d6ce dt-bindings: usb: mtk-xhci: add compatible for mt8188
Add compatible for mt8188

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20220707015041.12264-1-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:50:14 +02:00
Michael Walle
1bd7181664 usb: gadget: udc: atmel: convert to platform driver
The driver won't probe on a LAN9668 because the pinctrl driver isn't
ready yet. Probe deferral is not supported because the init section
is already discarded. With fw_devlink enabled, the probe won't even
be called. Convert the driver to a proper platform driver.

Signed-off-by: Michael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/20220705131951.1388968-2-michael@walle.cc
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:49:33 +02:00
Michael Walle
e89676f65e usb: gadget: udc: atmel: check rc of devm_gpiod_get_optional()
devm_gpiod_get_optional() might still return an error code, esp.
EPROBE_DEFER. Return any errors.

Signed-off-by: Michael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/20220705131951.1388968-1-michael@walle.cc
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:49:33 +02:00
Steven Rostedt (Google)
14a6043379 USB: gadget: udc: tracing: Do not open code __string() with __dynamic_array()
The event classes udc_log_ep and udc_log_req both declare:

    __dynamic_array(char, name, UDC_TRACE_STR_MAX)

Which will reserve UDC_TRACE_STR_MAX bytes on the ring buffer for the
event to write in name. It then uses snprintf() to write into that space.

Assuming that the string being copied is nul terminated, it is better to
just use the __string() helper. That way only the size of the string is
saved into the ring buffer and not the max size (yes, the entire
UDC_TRACE_STR_MAX is used in the trace event, and anything not used is
just junk in the ring buffer). Worse, there's also meta data saved into
the event that denotes where the string is stored in the event and also
saves its size, which is always going to be UDC_TRACE_STR_MAX.

Convert both to use the __string() and __assign_str() helpers that are for
this kind of use case.

Cc: Felipe Balbi <balbi@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20220703091449.317f94b1@rorschach.local.home
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:48:50 +02:00
Herve Codina
90557fa89d dt-bindings: usb: atmel: Add Microchip LAN9662 compatible string
The USB device controller available in the Microchip LAN9662 SOC
is the same IP as the one present in the SAMA5D3 SOC.

Add the LAN9662 compatible string and set the SAMA5D3 compatible
string as a fallback for the LAN9662.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220701070928.459135-3-herve.codina@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-01 10:03:10 +02:00
Sergey Shtylyov
1ce69c35b8 usb: host: xhci: use snprintf() in xhci_decode_trb()
Commit cbf286e8ef ("xhci: fix unsafe memory usage in xhci tracing")
apparently missed one sprintf() call in xhci_decode_trb() -- replace
it with the snprintf() call as well...

Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.

Fixes: cbf286e8ef ("xhci: fix unsafe memory usage in xhci tracing")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20220630124645.1805902-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-30 15:42:31 +02:00
Neal Liu
3b91edd624 usb: gadget: f_mass_storage: Make CD-ROM emulation works with Windows OS
Add read TOC with format 1 to support CD-ROM emulation with
Windows OS.
This patch is tested on Windows OS Server 2019.

Fixes: 89ada0fe66 ("usb: gadget: f_mass_storage: Make CD-ROM emulation work with Mac OS-X")
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Neal Liu <neal_liu@aspeedtech.com>
Link: https://lore.kernel.org/r/20220628021436.3252262-1-neal_liu@aspeedtech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-29 21:02:52 +02:00
Oliver Neukum
df574080fa USB: cdc-acm: use define for timeout
We have a symbolic name for the standard timeout.
Use it. No functional change intended.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20220629132638.31810-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-29 21:02:28 +02:00
Yang Yingliang
98ceba7559 usb: musb: mpfs: add missing clk_disable_unprepare() in mpfs_remove()
clock source is prepared and enabled by clk_prepare_enable()
in probe function, but no disable or unprepare in remove.

Fixes: 7a96b6ea90 ("usb: musb: Add support for PolarFire SoC's musb controller")
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220628140527.1404439-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-29 21:02:05 +02:00
Dan Carpenter
70cdb930f7 usb: gadget: aspeed_udc: fix handling of tx_len == 0
The bug is that we should still enter this loop if "tx_len" is zero.

After adding the "last" variable, then the "chunk >= 0" condition is no
longer required but I left it for readability.

Fixes: c09b1f372e ("usb: gadget: aspeed_udc: cleanup loop in ast_dma_descriptor_setup()")
Reported-by: Neal Liu <neal_liu@aspeedtech.com>
Reviewed-by: Neal Liu <neal_liu@aspeedtech.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/Yrq6F5okoX1y05rT@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-29 21:01:54 +02:00
Mauro Carvalho Chehab
babfcd947e usb: dwc3: gadget: fix a kernel-doc warning
The multiplier parameter of dwc3_gadget_calc_tx_fifo_size() was
not documented:

	drivers/usb/dwc3/gadget.c:675: warning: Function parameter or member 'mult' not described in 'dwc3_gadget_calc_tx_fifo_size'

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/bd599a18cea45c57d91c69d3e30d8b1e8ea69dd1.1656409369.git.mchehab@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-29 21:00:33 +02:00
Mauro Carvalho Chehab
ad44cf4024 usb: dwc3: document async_callbacks field
Avoid a kernel-doc warning by documenting it:
	drivers/usb/dwc3/core.h:1328: warning: Function parameter or member 'async_callbacks' not described in 'dwc3'

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/2c3de5935934baec097286f525ce4beff0a31ec0.1656409369.git.mchehab@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-29 21:00:30 +02:00
Mauro Carvalho Chehab
ae92b1c843 usb: typec_altmode: add a missing "@" at a kernel-doc parameter
Without that, the parameter is not properly parsed:
	include/linux/usb/typec_altmode.h:132: warning: Function parameter or member 'altmode' not described in 'typec_altmode_get_orientation'

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/70dc4c5d744cf1fe9a0efe6b85deaa0489628282.1656409369.git.mchehab@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-29 21:00:16 +02:00
Greg Kroah-Hartman
849f354223 thunderbolt: Changes for v5.20 merge window
This includes following Thunderbolt/USB4 changes for the v5.20 merge
 window:
 
   * Enable CL1 low power link state
   * Add support for Intel Raptor Lake Thunderbolt/USB4 controller
   * A couple of typos fixed.
 
 All these have been in linux-next with no reported issues.
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAmK6z3kgHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKA3xA/9F5XqEGuS+Zs5
 +U2wKuzVBMtZFaqErcaHufd1DyG3EEKfjQ2Mxe/1XE36zK/4okZigeQP0Pm37FiN
 +/QX59cEWT2Ip5CQ3H36ilm7o/Qr3DNwss8t/vh1GMXAAyRKKEM8yVZAtaOQrXkN
 Q5SjJnR5wpV/U4d70RlylvR57s1mppyZv70iv554jwHxwt5y2oyv3nI+4hCZFEZk
 8F5+DtVUg65KoDd1N25cB9/JKeGZOaiea7VMDP6To4c+xPHHO2k/g8fXcHM4eZUJ
 KHmXHOU6vxH2tXsaQnSfs6vJboTzCkEPAtaQfoxLCB89Yr6gHY3WPQow6FBU+mET
 vzRCedhi493mqio5TzxxjDw5eEN4P/C7gB/WsrdEUlSqNuaR0EMZQfzUsi7y4sds
 x+S+8151Ckh+lTKWD1gqPqUFOb5U7ywWz3ln8mbv6IDYxUjLpDmspa+alyj9TjLD
 onWhNkgYd0R1IuIljNWm7eCPhDf9DTJaYuyDtnYDLgjOs2efOb+OkGG8MZiwWiry
 VEEQR22gGJQRRlMsKrDUcnn7UIhIVedveVfBGistoAev3RyH8eRjabsYHS68hNb7
 pU42PeRoIYKa4nUTrdM+jd8KNgumoXz/UZkkDmh8OJrAA16AUei1YhxJdgZKw6Qg
 f0fX55Hjy4HtcxpiexIoHhTtRlp9S5A=
 =0W/4
 -----END PGP SIGNATURE-----

Merge tag 'thunderbolt-for-v5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next

Mika writes:

thunderbolt: Changes for v5.20 merge window

This includes following Thunderbolt/USB4 changes for the v5.20 merge
window:

  * Enable CL1 low power link state
  * Add support for Intel Raptor Lake Thunderbolt/USB4 controller
  * A couple of typos fixed.

All these have been in linux-next with no reported issues.

* tag 'thunderbolt-for-v5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt:
  thunderbolt: Fix typo in comment
  thunderbolt: Add support for Intel Raptor Lake
  thunderbolt: Fix some kernel-doc comments
  thunderbolt: Change TMU mode to HiFi uni-directional once DisplayPort tunneled
  thunderbolt: Add CL1 support for USB4 and Titan Ridge routers
  thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode
  thunderbolt: Fix typos in CLx enabling
  thunderbolt: CLx disable before system suspend only if previously enabled
  thunderbolt: Silently ignore CLx enabling in case CLx is not supported
2022-06-28 16:02:17 +02:00
Nícolas F. R. A. Prado
ebc4969ae1 dt-bindings: usb: mtk-xhci: Make all clocks required
All of the clocks listed in the binding are always wired to the XHCI
controller hardware blocks on all SoCs. The reason some clocks were made
optional in the binding was to account for the fact that depending on
the SoC, some of the clocks might be fixed (ie not controlled by
software).

Given that the devicetree should represent the hardware, make all clocks
required in the binding. Subsequent patches will make the DTS changes to
specify fixed-clocks for the clocks that aren't controllable.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Link: https://lore.kernel.org/r/20220623193702.817996-3-nfraprado@collabora.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-27 14:59:01 +02:00
Nícolas F. R. A. Prado
b2c510ffe2 dt-bindings: usb: mtk-xhci: Allow wakeup interrupt-names to be optional
Add missing "minItems: 1" to the interrupt-names property to allow the
second interrupt-names, "wakeup", to be optional.

Fixes: fe8e488058 ("dt-bindings: usb: mtk-xhci: add wakeup interrupt")
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20220623193702.817996-2-nfraprado@collabora.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-27 14:58:47 +02:00
Xuezhi Zhang
6569689e78 usb: core: sysfs: convert sysfs snprintf to sysfs_emit
Fix up all sysfs show entries to use sysfs_emit

Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
Link: https://lore.kernel.org/r/20220624121238.134256-1-zhangxuezhi1@coolpad.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-27 14:58:26 +02:00
Greg Kroah-Hartman
e6aa42f937 Linux 5.19-rc4
-----BEGIN PGP SIGNATURE-----
 
 iQFRBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmK4zgIeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGrI8H+MeIYPff1m9vh1rZ
 u1eCCtw/A+NqJ5l0Cq3Zj090crMb8zVkxr5QrdPxxJuxAK8AI/XzOUQivnNayp6v
 bvWcbj9e95ZoIQjbPakozo3KYnaHXMFfrq6JNdGIBJ5yt5pVHtJ3iZk25wUZEghD
 8lxoz4Uiuo14ZbLnlLjbXr5OEVupOH1OoQPghkSoolD8JBe1coOIYbzzJ69HBwNg
 kCUyD0CsFCBpy0P7yBnPNrvQGOt+NVz9FLfEbYFj+ydQjzw3NNw7tyKTahqp7ScN
 BS5Ftt0kuHqOyWDO9OP6dG1kGmvIWQZkrEroz1TS4FfgrrPRr5r0N9+tGvr9+tpZ
 1tjaBA==
 =L7lN
 -----END PGP SIGNATURE-----

Merge 5.19-rc4 into usb-next

We need the USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-27 10:03:28 +02:00
Linus Torvalds
03c765b0e3 Linux 5.19-rc4 2022-06-26 14:22:10 -07:00
Linus Torvalds
1709b88739 ARM: SoC fixes for 5.19
A number of fixes have accumulated, but they are largely for
 harmless issues:
 
  - Several OF node leak fixes
 
  - A fix to the Exynos7885 UART clock description
 
  - DTS fixes to prevent boot failures on TI AM64 and J721s2
 
  - Bus probe error handling fixes for Baikal-T1
 
  - A fixup to the way STM32 SoCs use separate dts files for
    different firmware stacks
 
  - Multiple code fixes for Arm SCMI firmware, all dealing with
    robustness of the implementation
 
  - Multiple NXP i.MX devicetree fixes, addressing incorrect
    data in DT nodes
 
  - Three updates to the MAINTAINERS file, including Florian
    Fainelli taking over BCM283x/BCM2711 (Raspberry Pi)
    from Nicolas Saenz Julienne
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmK4yEMACgkQmmx57+YA
 GNlSIQ/+NY4ViA4IoBrpi1OWmW/1OW10MpI7EqCwh30np6swp5Oub01LncwC++b8
 Fc1zHX99teDj0xU3/zuwtwFZtQ9ZyEQ2vABvZRjh1ONthmpS13se2XZHDynt1/bT
 0LWUM/PQ8/9sHf0JWxUNH466qIP1I5MVxy0iTaTlUKOdk+cwq3fZ4oYEgWkpQIq5
 jtAMmg9Nsn21iTD2RyTC7/pNuJakPqo7YZ9lvxbRyLwg8a9ewJsszJg6ZUuoeeH+
 tJNrPuVesl2pohYE+R2EYdzMbf0blTgmydZtYGbCGeJTlZ015Y/IPxdAgjSKeHe8
 /n6hfolyiIyhc5El/88pYeaXPZi/3jzbJ9QEhwCdcgP8bcGCRPs/I8CuWccXWmUK
 tI7KTFfyNOYs3vL0Gd2/TGJm8NEe8hh2uUePQ9ssXoM0hukJEd3rAHEVR0xz7HwO
 wBzlutOORv3MLdAWOVG6jniE8OFAop2pqNp/IlZ/MiXwu5WvJX2w7DwbYj0a4R00
 A6DJqz8OJovMuN1XhT59NiaVwojM2zh1YoYEtfqppiw6AjTDHDxujdEKC+DOCtBo
 iQgHjH5+Xn3bWm2lXvBgcsjP+ivxjjhsMjhZ1fmN/RFcm7OQyG82S6Bs00keVzOD
 kcdYkW9WfLkLzFh3+H5uXQgSz4K7ox1TvTfCAupBCn8C5WFrFNY=
 =Js9H
 -----END PGP SIGNATURE-----

Merge tag 'soc-fixes-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull ARM SoC fixes from Arnd Bergmann:
 "A number of fixes have accumulated, but they are largely for harmless
  issues:

   - Several OF node leak fixes

   - A fix to the Exynos7885 UART clock description

   - DTS fixes to prevent boot failures on TI AM64 and J721s2

   - Bus probe error handling fixes for Baikal-T1

   - A fixup to the way STM32 SoCs use separate dts files for different
     firmware stacks

   - Multiple code fixes for Arm SCMI firmware, all dealing with
     robustness of the implementation

   - Multiple NXP i.MX devicetree fixes, addressing incorrect data in DT
     nodes

   - Three updates to the MAINTAINERS file, including Florian Fainelli
     taking over BCM283x/BCM2711 (Raspberry Pi) from Nicolas Saenz
     Julienne"

* tag 'soc-fixes-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (29 commits)
  ARM: dts: aspeed: nuvia: rename vendor nuvia to qcom
  arm: mach-spear: Add missing of_node_put() in time.c
  ARM: cns3xxx: Fix refcount leak in cns3xxx_init
  MAINTAINERS: Update email address
  arm64: dts: ti: k3-am64-main: Remove support for HS400 speed mode
  arm64: dts: ti: k3-j721s2: Fix overlapping GICD memory region
  ARM: dts: bcm2711-rpi-400: Fix GPIO line names
  bus: bt1-axi: Don't print error on -EPROBE_DEFER
  bus: bt1-apb: Don't print error on -EPROBE_DEFER
  ARM: Fix refcount leak in axxia_boot_secondary
  ARM: dts: stm32: move SCMI related nodes in a dedicated file for stm32mp15
  soc: imx: imx8m-blk-ctrl: fix display clock for LCDIF2 power domain
  ARM: dts: imx6qdl-colibri: Fix capacitive touch reset polarity
  ARM: dts: imx6qdl: correct PU regulator ramp delay
  firmware: arm_scmi: Fix incorrect error propagation in scmi_voltage_descriptors_get
  firmware: arm_scmi: Avoid using extended string-buffers sizes if not necessary
  firmware: arm_scmi: Fix SENSOR_AXIS_NAME_GET behaviour when unsupported
  ARM: dts: imx7: Move hsic_phy power domain to HSIC PHY node
  soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe
  MAINTAINERS: Update BCM2711/BCM2835 maintainer
  ...
2022-06-26 14:12:56 -07:00
Linus Torvalds
413c1f1491 Minor things, mainly - mailmap updates, MAINTAINERS updates, etc.
Fixes for post-5.18 changes:
 
 - fix for a damon boot hang, from SeongJae
 
 - fix for a kfence warning splat, from Jason Donenfeld
 
 - fix for zero-pfn pinning, from Alex Williamson
 
 - fix for fallocate hole punch clearing, from Mike Kravetz
 
 Fixes pre-5.18 material:
 
 - fix for a performance regression, from Marcelo
 
 - fix for a hwpoisining BUG from zhenwei pi
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCYri4RgAKCRDdBJ7gKXxA
 jmhsAQDCvGqtIUhgkTwid8KBRNbowsg0LXd6k+gUjcxBhH403wEA0r0cxxkDAmgr
 QNXn/qZRzQP2ji+pdjH9NBOsd2g2XQA=
 =UGJ7
 -----END PGP SIGNATURE-----

Merge tag 'mm-hotfixes-stable-2022-06-26' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull hotfixes from Andrew Morton:
 "Minor things, mainly - mailmap updates, MAINTAINERS updates, etc.

  Fixes for this merge window:

   - fix for a damon boot hang, from SeongJae

   - fix for a kfence warning splat, from Jason Donenfeld

   - fix for zero-pfn pinning, from Alex Williamson

   - fix for fallocate hole punch clearing, from Mike Kravetz

  Fixes for previous releases:

   - fix for a performance regression, from Marcelo

   - fix for a hwpoisining BUG from zhenwei pi"

* tag 'mm-hotfixes-stable-2022-06-26' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
  mailmap: add entry for Christian Marangi
  mm/memory-failure: disable unpoison once hw error happens
  hugetlbfs: zero partial pages during fallocate hole punch
  mm: memcontrol: reference to tools/cgroup/memcg_slabinfo.py
  mm: re-allow pinning of zero pfns
  mm/kfence: select random number before taking raw lock
  MAINTAINERS: add maillist information for LoongArch
  MAINTAINERS: update MM tree references
  MAINTAINERS: update Abel Vesa's email
  MAINTAINERS: add MEMORY HOT(UN)PLUG section and add David as reviewer
  MAINTAINERS: add Miaohe Lin as a memory-failure reviewer
  mailmap: add alias for jarkko@profian.com
  mm/damon/reclaim: schedule 'damon_reclaim_timer' only after 'system_wq' is initialized
  kthread: make it clear that kthread_create_on_node() might be terminated by any fatal signal
  mm: lru_cache_disable: use synchronize_rcu_expedited
  mm/page_isolation.c: fix one kernel-doc comment
2022-06-26 14:00:55 -07:00