public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] driver,usb: Fix a warning in uhci-hcd driver
@ 2013-04-26  7:38 Li, Zhen-Hua
  2013-04-26  7:50 ` ZhenHua
  0 siblings, 1 reply; 22+ messages in thread
From: Li, Zhen-Hua @ 2013-04-26  7:38 UTC (permalink / raw)
  To: stern, gregkh, linux-usb, linux-kernel; +Cc: Li, Zhen-Hua

This patch is trying to fix this bug on SLES11 SP2:
    https://bugzilla.novell.com/show_bug.cgi?id=817035

On a large HP system with 64T memory and 60 logical cpus, when usb
driver inits the iLo Virtual USB Controller, there comes a warning
"Controller not stopped yet!". It is because the HP iLo virtual usb
device requires a longer delay.

Signed-off-by: Li, Zhen-Hua <zhen-hual@hp.com>
---
 drivers/usb/host/uhci-hcd.c |    5 +++++
 drivers/usb/host/uhci-hub.c |   12 +++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 4a86b63..af30517 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -355,6 +355,11 @@ __acquires(uhci->lock)
 		if (uhci->dead)
 			return;
 	}
+
+	/* HP's iLo Virtual USB Controller requires a longer delay. */
+	if (uhci->wait_for_hp)
+		wait_for_HP(uhci, USBSTS, USBSTS_HCH, 1000);
+
 	if (!(uhci_readw(uhci, USBSTS) & USBSTS_HCH))
 		dev_warn(uhci_dev(uhci), "Controller not stopped yet!\n");
 
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index f87bee6..c3f772c 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -120,14 +120,15 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
 }
 
 /* Wait for the UHCI controller in HP's iLO2 server management chip.
- * It can take up to 250 us to finish a reset and set the CSC bit.
+ * It can take up to max_wait us to finish the operation.
  */
-static void wait_for_HP(struct uhci_hcd *uhci, unsigned long port_addr)
+static void wait_for_HP(struct uhci_hcd *uhci, unsigned long port_addr,
+		u16 status, int max_wait)
 {
 	int i;
 
-	for (i = 10; i < 250; i += 10) {
-		if (uhci_readw(uhci, port_addr) & USBPORTSC_CSC)
+	for (i = 10; i < max_wait; i += 10) {
+		if (uhci_readw(uhci, port_addr) & status)
 			return;
 		udelay(10);
 	}
@@ -151,7 +152,8 @@ static void uhci_check_ports(struct uhci_hcd *uhci)
 				/* HP's server management chip requires
 				 * a longer delay. */
 				if (uhci->wait_for_hp)
-					wait_for_HP(uhci, port_addr);
+					wait_for_HP(uhci, port_addr,
+						USBPORTSC_CSC, 250);
 
 				/* If the port was enabled before, turning
 				 * reset on caused a port enable change.
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 22+ messages in thread
* [PATCH 1/1] driver,usb: Fix a warning in uhci-hcd driver
@ 2013-04-25  7:11 Li, Zhen-Hua
  2013-04-25  7:12 ` ZhenHua
  0 siblings, 1 reply; 22+ messages in thread
From: Li, Zhen-Hua @ 2013-04-25  7:11 UTC (permalink / raw)
  To: stern, gregkh, linux-usb, linux-kernel; +Cc: tom.vaden, Li, Zhen-Hua

This patch is trying to fix this bug on SLES11 SP2:
    https://bugzilla.novell.com/show_bug.cgi?id=817035

On a large HP system with 64T memory and 60 logical cpus, when usb
driver inits the iLo Virtual USB Controller, there comes a warning
"Controller not stopped yet!". It is because driver does not wait
enough time. So driver should wait and retry if found controller 
 not stopped.

Signed-off-by: Li, Zhen-Hua <zhen-hual@hp.com>
Signed-off-by: Tom Vaden <tom.vaden@hp.com>
---
 drivers/usb/host/uhci-hcd.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 4a86b63..d592e22 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -277,6 +277,9 @@ static int global_suspend_mode_is_broken(struct uhci_hcd *uhci)
 		uhci->global_suspend_mode_is_broken(uhci) : 0;
 }
 
+#define UHCI_SUSPENDRH_RETRY_MAX      10
+#define UHCI_SUSPENDRH_RETRY_DELAY    100
+
 static void suspend_rh(struct uhci_hcd *uhci, enum uhci_rh_state new_state)
 __releases(uhci->lock)
 __acquires(uhci->lock)
@@ -284,6 +287,8 @@ __acquires(uhci->lock)
 	int auto_stop;
 	int int_enable, egsm_enable, wakeup_enable;
 	struct usb_device *rhdev = uhci_to_hcd(uhci)->self.root_hub;
+	int try;
+	u16 stopped;
 
 	auto_stop = (new_state == UHCI_RH_AUTO_STOPPED);
 	dev_dbg(&rhdev->dev, "%s%s\n", __func__,
@@ -355,7 +360,17 @@ __acquires(uhci->lock)
 		if (uhci->dead)
 			return;
 	}
-	if (!(uhci_readw(uhci, USBSTS) & USBSTS_HCH))
+
+	for (try = 0; try < UHCI_SUSPENDRH_RETRY_MAX; try++) {
+		/* For some devices, for example, HP iLo usb controller,
+		 * we need to wait for more time and retry. 
+		 */
+		stopped = uhci_readw(uhci, USBSTS) & USBSTS_HCH;
+		if (stopped)
+			break;
+		udelay(UHCI_SUSPENDRH_RETRY_DELAY);
+	}
+	if (!stopped)
 		dev_warn(uhci_dev(uhci), "Controller not stopped yet!\n");
 
 	uhci_get_current_frame_number(uhci);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 22+ messages in thread
* [PATCH 1/1] driver,usb: Fix a warning in uhci-hcd driver
@ 2013-04-23  7:15 Li, Zhen-Hua
  2013-04-23 14:07 ` Greg KH
  0 siblings, 1 reply; 22+ messages in thread
From: Li, Zhen-Hua @ 2013-04-23  7:15 UTC (permalink / raw)
  To: stern, gregkh, linux-usb, linux-kernel; +Cc: tom.vaden, Li, Zhen-Hua

From: "Li, Zhen-Hua" <zhen-hual@hp.com>

This patch is trying to fix bug QXCR1001261767.
On some HP platform, when usb driver inits the iLo Virtual USB Controller, there may be a warning "Controller not stopped yet!". It is because driver does not wait enough time.
This patch adds more time waiting and retries.

Signed-off-by: Li, Zhen-Hua <zhen-hual@hp.com>
---
 drivers/usb/host/uhci-hcd.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 4a86b63..514e9d7 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -277,6 +277,9 @@ static int global_suspend_mode_is_broken(struct uhci_hcd *uhci)
 		uhci->global_suspend_mode_is_broken(uhci) : 0;
 }
 
+#define UHCI_SUSPENDRH_RETRY_MAX      10
+#define UHCI_SUSPENDRH_RETRY_DELAY    100
+
 static void suspend_rh(struct uhci_hcd *uhci, enum uhci_rh_state new_state)
 __releases(uhci->lock)
 __acquires(uhci->lock)
@@ -284,6 +287,7 @@ __acquires(uhci->lock)
 	int auto_stop;
 	int int_enable, egsm_enable, wakeup_enable;
 	struct usb_device *rhdev = uhci_to_hcd(uhci)->self.root_hub;
+	u16 try, stopped;
 
 	auto_stop = (new_state == UHCI_RH_AUTO_STOPPED);
 	dev_dbg(&rhdev->dev, "%s%s\n", __func__,
@@ -355,7 +359,17 @@ __acquires(uhci->lock)
 		if (uhci->dead)
 			return;
 	}
-	if (!(uhci_readw(uhci, USBSTS) & USBSTS_HCH))
+
+	for (try = 0; try < UHCI_SUSPENDRH_RETRY_MAX; try++) {
+		/*
+		 * Sometimes we may need to wait more time and try again.
+		 */
+		stopped = uhci_readw(uhci, USBSTS) & USBSTS_HCH;
+		if (stopped)
+			break;
+		udelay(UHCI_SUSPENDRH_RETRY_DELAY);
+	}
+	if (!stopped)
 		dev_warn(uhci_dev(uhci), "Controller not stopped yet!\n");
 
 	uhci_get_current_frame_number(uhci);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2013-05-06  1:43 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26  7:38 [PATCH 1/1] driver,usb: Fix a warning in uhci-hcd driver Li, Zhen-Hua
2013-04-26  7:50 ` ZhenHua
2013-04-26  8:10   ` ZhenHua
2013-04-26 16:51   ` Alan Stern
2013-04-27  0:16     ` ZhenHua
2013-04-27 15:14       ` Alan Stern
2013-04-28  1:51         ` ZhenHua
2013-04-28 18:55           ` Alan Stern
2013-05-06  1:43             ` Li, Zhen-Hua (USL-China)
  -- strict thread matches above, loose matches on Subject: below --
2013-04-25  7:11 Li, Zhen-Hua
2013-04-25  7:12 ` ZhenHua
2013-04-25 14:33   ` Alan Stern
2013-04-25 14:56     ` Alan Stern
2013-04-23  7:15 Li, Zhen-Hua
2013-04-23 14:07 ` Greg KH
2013-04-23 15:10   ` Alan Stern
2013-04-25  1:22     ` ZhenHua
2013-04-25 14:54       ` Alan Stern
2013-04-26  1:10         ` ZhenHua
2013-04-23 23:55   ` ZhenHua
2013-04-24  1:57     ` Greg KH
2013-04-24  2:05       ` ZhenHua

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox