From 78999d600733297c4d17cc7662ecc87f2e422346 Mon Sep 17 00:00:00 2001 From: Jianwei Zheng Date: Tue, 23 Jul 2024 18:07:40 +0800 Subject: [PATCH] usb: dwc2: fix USB bus repeatedly suspending and resuming When system wakeup, It will call _dwc2_hcd_resume function and the port_suspend_change flag will be set to 1 in _dwc2_hcd_resume function. But in current code, the autosuspend delay for hub is set to zero and this will cause a strange phenomenon where the USB bus will repeatedly suspending and resuming. Considering that setting the port_suspend_change to 1 is only applicable for partial power mode, there is no need to set port_suspend_change to 1 when DWC2 IP not support partial power mode. Fixes: c74c26f6e398 ("usb: dwc2: Fix partial power down exiting by system resume") Change-Id: Ia57bfb8502cb55a5d9375a5ad609ac4104ff8acb Signed-off-by: William Wu Signed-off-by: Jianwei Zheng --- drivers/usb/dwc2/hcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 1538ebcd29e2..50a606cbfaba 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4503,7 +4503,8 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd) } /* Change Root port status, as port status change occurred after resume.*/ - hsotg->flags.b.port_suspend_change = 1; + if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_PARTIAL) + hsotg->flags.b.port_suspend_change = 1; /* * Enable power if not already done.