Skip to content

Commit 9d5333c

Browse files
Junlisuzhougregkh
authored andcommitted
usb: cdns3: host: fix endless superspeed hub port reset
When usb 3.0 hub connect with one USB 2.0 device and NO USB 3.0 device, some usb hub reports endless port reset message. [ 190.324169] usb 2-1: new SuperSpeed USB device number 88 using xhci-hcd [ 190.352834] hub 2-1:1.0: USB hub found [ 190.356995] hub 2-1:1.0: 4 ports detected [ 190.700056] usb 2-1: USB disconnect, device number 88 [ 192.472139] usb 2-1: new SuperSpeed USB device number 89 using xhci-hcd [ 192.500820] hub 2-1:1.0: USB hub found [ 192.504977] hub 2-1:1.0: 4 ports detected [ 192.852066] usb 2-1: USB disconnect, device number 89 The reason is the runtime pm state of USB2.0 port is active and USB 3.0 port is suspend, so parent device is active state. cat /sys/bus/platform/devices/5b110000.usb/5b130000.usb/xhci-hcd.1.auto/usb2/power/runtime_status suspended cat /sys/bus/platform/devices/5b110000.usb/5b130000.usb/xhci-hcd.1.auto/usb1/power/runtime_status active cat /sys/bus/platform/devices/5b110000.usb/5b130000.usb/xhci-hcd.1.auto/power/runtime_status active cat /sys/bus/platform/devices/5b110000.usb/5b130000.usb/power/runtime_status active So xhci_cdns3_suspend_quirk() have not called. U3 configure is not applied. move U3 configure into host start. Reinit again in resume function in case controller power lost during suspend. Cc: [email protected] 5.10 Signed-off-by: Li Jun <[email protected]> Signed-off-by: Frank Li <[email protected]> Reviewed-by: Peter Chen <[email protected]> Acked-by: Alexander Stein <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7a58b8d commit 9d5333c

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

drivers/usb/cdns3/host.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,37 @@
2424
#define CFG_RXDET_P3_EN BIT(15)
2525
#define LPM_2_STB_SWITCH_EN BIT(25)
2626

27-
static int xhci_cdns3_suspend_quirk(struct usb_hcd *hcd);
27+
static void xhci_cdns3_plat_start(struct usb_hcd *hcd)
28+
{
29+
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
30+
u32 value;
31+
32+
/* set usbcmd.EU3S */
33+
value = readl(&xhci->op_regs->command);
34+
value |= CMD_PM_INDEX;
35+
writel(value, &xhci->op_regs->command);
36+
37+
if (hcd->regs) {
38+
value = readl(hcd->regs + XECP_AUX_CTRL_REG1);
39+
value |= CFG_RXDET_P3_EN;
40+
writel(value, hcd->regs + XECP_AUX_CTRL_REG1);
41+
42+
value = readl(hcd->regs + XECP_PORT_CAP_REG);
43+
value |= LPM_2_STB_SWITCH_EN;
44+
writel(value, hcd->regs + XECP_PORT_CAP_REG);
45+
}
46+
}
47+
48+
static int xhci_cdns3_resume_quirk(struct usb_hcd *hcd)
49+
{
50+
xhci_cdns3_plat_start(hcd);
51+
return 0;
52+
}
2853

2954
static const struct xhci_plat_priv xhci_plat_cdns3_xhci = {
3055
.quirks = XHCI_SKIP_PHY_INIT | XHCI_AVOID_BEI,
31-
.suspend_quirk = xhci_cdns3_suspend_quirk,
56+
.plat_start = xhci_cdns3_plat_start,
57+
.resume_quirk = xhci_cdns3_resume_quirk,
3258
};
3359

3460
static int __cdns_host_init(struct cdns *cdns)
@@ -90,32 +116,6 @@ static int __cdns_host_init(struct cdns *cdns)
90116
return ret;
91117
}
92118

93-
static int xhci_cdns3_suspend_quirk(struct usb_hcd *hcd)
94-
{
95-
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
96-
u32 value;
97-
98-
if (pm_runtime_status_suspended(hcd->self.controller))
99-
return 0;
100-
101-
/* set usbcmd.EU3S */
102-
value = readl(&xhci->op_regs->command);
103-
value |= CMD_PM_INDEX;
104-
writel(value, &xhci->op_regs->command);
105-
106-
if (hcd->regs) {
107-
value = readl(hcd->regs + XECP_AUX_CTRL_REG1);
108-
value |= CFG_RXDET_P3_EN;
109-
writel(value, hcd->regs + XECP_AUX_CTRL_REG1);
110-
111-
value = readl(hcd->regs + XECP_PORT_CAP_REG);
112-
value |= LPM_2_STB_SWITCH_EN;
113-
writel(value, hcd->regs + XECP_PORT_CAP_REG);
114-
}
115-
116-
return 0;
117-
}
118-
119119
static void cdns_host_exit(struct cdns *cdns)
120120
{
121121
kfree(cdns->xhci_plat_data);

0 commit comments

Comments
 (0)