Skip to contentSkip to conversation

usb: dwc2: do not gate off the hardware if it does not support clock gating

PATCH Superseded Dinh Nguyen 3 participants 4 messages Jan 4, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc2: do not gate off the hardware if it does not support clock gating

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")

---
 drivers/usb/dwc2/hcd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/dwc2/hcd.c +4 -3
index 13c779a28e94..f63a27d11fac 100644
@@ -4399,11 +4399,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;
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dinh Nguyen

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")

Quoted 24 lines
---
  drivers/usb/dwc2/hcd.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/dwc2/hcd.c +4 -3
index 13c779a28e94..f63a27d11fac 100644
@@ -4399,11 +4399,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;
#2 lore raw
In reply to Dinh Nguyen

Hello!

Quoted 5 lines · Dinh Nguyen

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")

Don't break up this line (perhaps could be fixed while applying).

Quoted 1 line

[...]

MBR, Sergey

#3 lore raw
Quoted 4 lines · Sergey Shtylyov

Hello!

On 1/4/22 5:22 AM, Dinh Nguyen wrote:

Quoted 8 lines
Quoted 5 lines

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")

Don't break up this line (perhaps could be fixed while applying).

My bad! Let me re-send.

Dinh