]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: dwc3: core: Check all ports when set phy suspend
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Tue, 2 Jul 2024 00:19:14 +0000 (00:19 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jul 2024 14:05:48 +0000 (16:05 +0200)
The dwc3_enable_susphy() applies to all available ports. After the
introduction of multi-port in dwc3, we now know the number of ports. Go
through the phy suspend registers of each port to enable/disable phy
suspend in dwc3_enable_susphy().

Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/31e18192c607dff0a7e5ca139dd5737d2224122a.1719879346.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/core.c

index cb82557678ddd4dfba6b0bfc96e35cafcf36d106..ea6b1613152f9884361bc85b6c9277ecba109bf0 100644 (file)
@@ -108,22 +108,27 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
 void dwc3_enable_susphy(struct dwc3 *dwc, bool enable)
 {
        u32 reg;
+       int i;
 
-       reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
-       if (enable && !dwc->dis_u3_susphy_quirk)
-               reg |= DWC3_GUSB3PIPECTL_SUSPHY;
-       else
-               reg &= ~DWC3_GUSB3PIPECTL_SUSPHY;
+       for (i = 0; i < dwc->num_usb3_ports; i++) {
+               reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(i));
+               if (enable && !dwc->dis_u3_susphy_quirk)
+                       reg |= DWC3_GUSB3PIPECTL_SUSPHY;
+               else
+                       reg &= ~DWC3_GUSB3PIPECTL_SUSPHY;
 
-       dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
+               dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(i), reg);
+       }
 
-       reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
-       if (enable && !dwc->dis_u2_susphy_quirk)
-               reg |= DWC3_GUSB2PHYCFG_SUSPHY;
-       else
-               reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
+       for (i = 0; i < dwc->num_usb2_ports; i++) {
+               reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(i));
+               if (enable && !dwc->dis_u2_susphy_quirk)
+                       reg |= DWC3_GUSB2PHYCFG_SUSPHY;
+               else
+                       reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
 
-       dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
+               dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(i), reg);
+       }
 }
 
 void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode)