Skip to contentSkip to conversation

driver,usb: Fix a warning in uhci-hcd driver

PATCH In review Li, Zhen-Hua 2 participants 4 messages Apr 25, 2013

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

PATCH 1/1 driver,usb: Fix a warning in uhci-hcd driver

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.

---
 drivers/usb/host/uhci-hcd.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/usb/host/uhci-hcd.c +16 -1
index 4a86b63..d592e22 100644
@@ -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);
Signature · 1 line
1.7.10.4
author
#1 lore raw

I send out this patch for the second time.
Changed try to int. And modified the comment.

Quoted 57 lines · 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.

---
  drivers/usb/host/uhci-hcd.c |   17 ++++++++++++++++-
  1 file changed, 16 insertions(+), 1 deletion(-)
drivers/usb/host/uhci-hcd.c +16 -1
index 4a86b63..d592e22 100644
@@ -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);
maintainer
#2 lore raw
Quoted 2 lines · ZhenHua

I send out this patch for the second time.
Changed try to int. And modified the comment.

You did not answer my question: How long does it take for the iLo controller to go into suspend?

Alan Stern

maintainer
#3 lore raw
Quoted 7 lines · Alan Stern
Quoted 2 lines · ZhenHua

I send out this patch for the second time.
Changed try to int. And modified the comment.

You did not answer my question: How long does it take for the iLo controller to go into suspend?

Oops, sorry, I see now that you did answer the question in a different email message.

Alan Stern