]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: dwc2: drd: fix clock gating on USB role switch
authorTomas Marek <tomas.marek@elrest.cz>
Fri, 6 Sep 2024 05:50:25 +0000 (07:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:50 +0000 (16:29 +0200)
commit4f7908ebafd51f7eb3d2b0a8b058da2f983dc5f6
treecc1868c834609310a40cee199b261eddd3963882
parent19fb05d2e5c341be81f7a60fb404ef0d1d6ecab3
usb: dwc2: drd: fix clock gating on USB role switch

commit 2c6b6afa59e78bebcb65bbc8a76b3459f139547c upstream.

The dwc2_handle_usb_suspend_intr() function disables gadget clocks in USB
peripheral mode when no other power-down mode is available (introduced by
commit 0112b7ce68ea ("usb: dwc2: Update dwc2_handle_usb_suspend_intr function.")).
However, the dwc2_drd_role_sw_set() USB role update handler attempts to
read DWC2 registers if the USB role has changed while the USB is in suspend
mode (when the clocks are gated). This causes the system to hang.

Release the gadget clocks before handling the USB role update.

Fixes: 0112b7ce68ea ("usb: dwc2: Update dwc2_handle_usb_suspend_intr function.")
Cc: stable@vger.kernel.org
Signed-off-by: Tomas Marek <tomas.marek@elrest.cz>
Link: https://lore.kernel.org/r/20240906055025.25057-1-tomas.marek@elrest.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc2/drd.c