]> Gentwo Git Trees - linux/.git/commit
usb: dwc2: hcd: Fix GetPortStatus & SetPortFeature
authorStefan Wahren <wahrenst@gmx.net>
Mon, 2 Dec 2024 00:16:30 +0000 (01:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Dec 2024 15:30:05 +0000 (16:30 +0100)
commita8d3e4a734599c7d0f6735f8db8a812e503395dd
tree6297cc98f061213bab5801e4761067172620e9d6
parent336f72d3cbf5cc17df2947bbbd2ba6e2509f17e8
usb: dwc2: hcd: Fix GetPortStatus & SetPortFeature

On Rasperry Pis without onboard USB hub the power cycle during
power connect init only disable the port but never enabled it again:

  usb usb1-port1: attempt power cycle

The port relevant part in dwc2_hcd_hub_control() is skipped in case
port_connect_status = 0 under the assumption the core is or will be soon
in device mode. But this assumption is wrong, because after ClearPortFeature
USB_PORT_FEAT_POWER the port_connect_status will also be 0 and
SetPortFeature (incl. USB_PORT_FEAT_POWER) will be a no-op.

Fix the behavior of dwc2_hcd_hub_control() by replacing the
port_connect_status check with dwc2_is_device_mode().

Link: https://github.com/raspberrypi/linux/issues/6247
Fixes: 7359d482eb4d ("staging: HCD files for the DWC2 driver")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/r/20241202001631.75473-3-wahrenst@gmx.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc2/hcd.c