Skip to content

Commit 1792641

Browse files
Thinh Nguyengregkh
authored andcommitted
usb: dwc3: core: Check all ports when set phy suspend
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 <[email protected]> Link: https://lore.kernel.org/r/31e18192c607dff0a7e5ca139dd5737d2224122a.1719879346.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 62ce9ef commit 1792641

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

drivers/usb/dwc3/core.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,27 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
108108
void dwc3_enable_susphy(struct dwc3 *dwc, bool enable)
109109
{
110110
u32 reg;
111+
int i;
111112

112-
reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
113-
if (enable && !dwc->dis_u3_susphy_quirk)
114-
reg |= DWC3_GUSB3PIPECTL_SUSPHY;
115-
else
116-
reg &= ~DWC3_GUSB3PIPECTL_SUSPHY;
113+
for (i = 0; i < dwc->num_usb3_ports; i++) {
114+
reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(i));
115+
if (enable && !dwc->dis_u3_susphy_quirk)
116+
reg |= DWC3_GUSB3PIPECTL_SUSPHY;
117+
else
118+
reg &= ~DWC3_GUSB3PIPECTL_SUSPHY;
117119

118-
dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
120+
dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(i), reg);
121+
}
119122

120-
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
121-
if (enable && !dwc->dis_u2_susphy_quirk)
122-
reg |= DWC3_GUSB2PHYCFG_SUSPHY;
123-
else
124-
reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
123+
for (i = 0; i < dwc->num_usb2_ports; i++) {
124+
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(i));
125+
if (enable && !dwc->dis_u2_susphy_quirk)
126+
reg |= DWC3_GUSB2PHYCFG_SUSPHY;
127+
else
128+
reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
125129

126-
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
130+
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(i), reg);
131+
}
127132
}
128133

129134
void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode)

0 commit comments

Comments
 (0)