Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: dwc2: also exit clock_gating when stopping udc while suspended

It is possible that the gadget will be disabled, while the udc is
suspended. When enabling the udc in that case, the clock gating
will not be enabled again. Leaving the phy unclocked. Even when the
udc is not enabled, connecting this powered but not clocked phy leads
to enumeration errors on the host side.

To ensure that the clock gating will be in an valid state, we ensure
that the clock gating will be enabled before stopping the udc.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Link: https://lore.kernel.org/r/20250417-dwc2_clock_gating-v1-1-8ea7c4d53d73@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Michael Grzeschik and committed by
Greg Kroah-Hartman
af076a41 0bc3e641

+6
+6
drivers/usb/dwc2/gadget.c
··· 4604 4604 if (!hsotg) 4605 4605 return -ENODEV; 4606 4606 4607 + /* Exit clock gating when driver is stopped. */ 4608 + if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_NONE && 4609 + hsotg->bus_suspended && !hsotg->params.no_clock_gating) { 4610 + dwc2_gadget_exit_clock_gating(hsotg, 0); 4611 + } 4612 + 4607 4613 /* all endpoints should be shutdown */ 4608 4614 for (ep = 1; ep < hsotg->num_of_eps; ep++) { 4609 4615 if (hsotg->eps_in[ep])