usb: dwc2: do not gate off the hardware if it does not support clock gating
authorDinh Nguyen <dinguyen@kernel.org>
Tue, 4 Jan 2022 13:59:22 +0000 (07:59 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:03:54 +0000 (11:03 +0100)
[ Upstream commit 34146c68083f1aef6709196b3dc888c1ceffd357 ]

We should not be clearing the HCD_FLAG_HW_ACCESSIBLE bit if the hardware
does not support clock gating.

Fixes: 50fb0c128b6e ("usb: dwc2: Add clock gating entering flow by system suspend")
Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/20220104135922.734776-1-dinguyen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/dwc2/hcd.c

index a215ec9e172e69747e5d7c099def5a363b172431..657dbd50faf11bccecec50874af9c3a9f77dc310 100644 (file)
@@ -4403,11 +4403,12 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
                 * If not hibernation nor partial power down are supported,
                 * clock gating is used to save power.
                 */
-               if (!hsotg->params.no_clock_gating)
+               if (!hsotg->params.no_clock_gating) {
                        dwc2_host_enter_clock_gating(hsotg);
 
-               /* After entering suspend, hardware is not accessible */
-               clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+                       /* After entering suspend, hardware is not accessible */
+                       clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+               }
                break;
        default:
                goto skip_power_saving;