]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: dwc3: gadget: only resume USB2 PHY in <=HIGHSPEED
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 12 Apr 2024 20:26:03 +0000 (22:26 +0200)
committerMattijs Korpershoek <mkorpershoek@baylibre.com>
Thu, 16 May 2024 06:38:24 +0000 (08:38 +0200)
Upstream Linux commit ab2a92e7a608.

As a micro-power optimization, let's only resume the
USB2 PHY if we're working on <=HIGHSPEED. If we're
gonna work on SUPERSPEED or SUPERSPEED+, there's no
point in resuming the USB2 PHY.

Fixes: 2b0f11df84bb ("usb: dwc3: gadget: clear SUSPHY bit before ep cmds")
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20240412202611.3565052-4-alexander.sverdlin@siemens.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
drivers/usb/dwc3/gadget.c

index 06a29ed8640d66ea37101f7a77f076a5e28495c4..bcd55a7d2746756526a4f31bcd1e70b1dfea20e6 100644 (file)
@@ -313,11 +313,13 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
         * We will also set SUSPHY bit to what it was before returning as stated
         * by the same section on Synopsys databook.
         */
-       reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
-       if (unlikely(reg & DWC3_GUSB2PHYCFG_SUSPHY)) {
-               susphy = true;
-               reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
-               dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
+       if (dwc->gadget.speed <= USB_SPEED_HIGH) {
+               reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
+               if (unlikely(reg & DWC3_GUSB2PHYCFG_SUSPHY)) {
+                       susphy = true;
+                       reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
+                       dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
+               }
        }
 
        dwc3_writel(dwc->regs, DWC3_DEPCMDPAR0(ep), params->param0);