Skip to contentSkip to conversation

usb/host/ehci-hub: Fix the issue EG20T USB host controller has long resuming time, when pen drive is attached.

PATCH Superseded Tomoya MORINAGA 2 participants 6 messages Jul 11, 2012 – Jul 13, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb/host/ehci-hub: Fix the issue EG20T USB host controller has long resuming time, when pen drive is attached.

---
 drivers/usb/host/ehci-hub.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hub.c +4 -0
index fc9e7cc..d596d0f 100644
@@ -207,6 +207,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
 	int			port;
 	int			mask;
 	int			changed;
+	int			temp;
 
 	ehci_dbg(ehci, "suspend root hub\n");
 
@@ -324,6 +325,9 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
 	 * want, and so we must delete any pending watchdog timer events.
 	 */
 	del_timer_sync(&ehci->watchdog);
+	temp = ehci_readl(ehci, &ehci->regs->status);
+	if (temp & STS_FLR)
+		ehci_writel(ehci, STS_FLR, &ehci->regs->status);
 	return 0;
 }
 
Signature · 1 line
1.7.4.4
maintainer
#1 lore raw
Quoted 2 lines · Tomoya MORINAGA

There's no patch description. What is the cause of the problem and how does the patch fix it?

Quoted 17 lines
---
 drivers/usb/host/ehci-hub.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hub.c +1 -0
index fc9e7cc..d596d0f 100644
@@ -207,6 +207,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
 	int			port;
 	int			mask;
 	int			changed;
+	int			temp;
 
 	ehci_dbg(ehci, "suspend root hub\n");
 

drivers/usb/host/ehci-hub.c static int ehci_bus_suspend (struct usb_hcd *hcd) · line 331

Quoted 7 lines
drivers/usb/host/ehci-hub.c +3 -0
@@ -324,6 +325,9 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
 	 * want, and so we must delete any pending watchdog timer events.
 	 */
 	del_timer_sync(&ehci->watchdog);
+	temp = ehci_readl(ehci, &ehci->regs->status);
+	if (temp & STS_FLR)
+		ehci_writel(ehci, STS_FLR, &ehci->regs->status);
 	return 0;

Operations like this should be done while holding the spinlock.

Also, why do you need the ehci_readl and the test? You could always clear the STS_FLR flag.

Alan Stern

#2 lore raw

PATCH v2 1/1 usb/host/ehci-hub: Fix the issue EG20T USB host controller has long resuming time, when pen drive is attached.

In reply to Tomoya MORINAGA

Intel EG20T USB host controller does not send SOF in resuming time after suspending, if the FLR bit was not cleared. When pen drive is attached, the controller has a long resuming time to try re-connect it. This patch clear the FLR bit in suspending time for fixing the issue.

---
v2: Update comments from Alan Stern
Add patch description
Always clear the STS_FLR flag.

---
 drivers/usb/host/ehci-hub.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hub.c +1 -0
index fc9e7cc..818a2f1 100644
@@ -318,6 +318,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
 	ehci_readl(ehci, &ehci->regs->intr_enable);
 
 	ehci->next_statechange = jiffies + msecs_to_jiffies(10);
+	ehci_writel(ehci, STS_FLR, &ehci->regs->status);
 	spin_unlock_irq (&ehci->lock);
 
 	/* ehci_work() may have re-enabled the watchdog timer, which we do not
Signature · 1 line
1.7.4.4
maintainer
#3 lore raw
Quoted 20 lines · Tomoya MORINAGA

Intel EG20T USB host controller does not send SOF in resuming time after suspending, if the FLR bit was not cleared. When pen drive is attached, the controller has a long resuming time to try re-connect it. This patch clear the FLR bit in suspending time for fixing the issue.

---
v2: Update comments from Alan Stern
Add patch description
Always clear the STS_FLR flag.

---
 drivers/usb/host/ehci-hub.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hub.c +0 -0
index fc9e7cc..818a2f1 100644

drivers/usb/host/ehci-hub.c static int ehci_bus_suspend (struct usb_hcd *hcd) · line 322

Quoted 5 lines
drivers/usb/host/ehci-hub.c +1 -0
@@ -318,6 +318,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
 	ehci_readl(ehci, &ehci->regs->intr_enable);
 
 	ehci->next_statechange = jiffies + msecs_to_jiffies(10);
+	ehci_writel(ehci, STS_FLR, &ehci->regs->status);
 	spin_unlock_irq (&ehci->lock);

You need to add a comment to the code also. Otherwise, a few years from now somebody will see that line, realize it doesn't do anything important, and get rid of it.

Alan Stern

#4 lore raw

PATCH v3 1/1 usb/host/ehci-hub: Fix the issue EG20T USB host controller has long resuming time, when pen drive is attached.

In reply to Tomoya MORINAGA

Intel EG20T USB host controller does not send SOF in resuming time after suspending, if the FLR bit was not cleared. When pen drive is attached, the controller has a long resuming time to try re-connect it. This patch clear the FLR bit in suspending time for fixing the issue.

---
v3: Update comments from Alan Stern
Add comment in the source code.

v2: Update comments from Alan Stern
Add patch description
Always clear the STS_FLR flag.

---
 drivers/usb/host/ehci-hub.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hub.c +7 -0
index fc9e7cc..278b589 100644
@@ -318,6 +318,13 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
 	ehci_readl(ehci, &ehci->regs->intr_enable);
 
 	ehci->next_statechange = jiffies + msecs_to_jiffies(10);
+
+	/* Intel EG20T USB host controller does not send SOF
+	 * in resuming time after suspending, if the FLR bit was not cleared.
+	 * Therefore clear the FLR bit in here.
+	 */
+	ehci_writel(ehci, STS_FLR, &ehci->regs->status);
+
 	spin_unlock_irq (&ehci->lock);
 
 	/* ehci_work() may have re-enabled the watchdog timer, which we do not
Signature · 1 line
1.7.4.4
maintainer Acked-by on v3 1/1
#5 lore raw
Quoted 5 lines · Tomoya MORINAGA

Intel EG20T USB host controller does not send SOF in resuming time after suspending, if the FLR bit was not cleared. When pen drive is attached, the controller has a long resuming time to try re-connect it. This patch clear the FLR bit in suspending time for fixing the issue.

Quoted 8 lines

---
v3: Update comments from Alan Stern
Add comment in the source code.

v2: Update comments from Alan Stern
Add patch description
Always clear the STS_FLR flag.