RE: A question about ohci_irq()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 30 Dec 2009, Huang, FrankR wrote:

> Alan,
> 
> 	The mouse is still hang with this patch.
> 	The done_head is also 0 after the udelay(10).
> 	I suspect when the done_head is 0 , this interrupt is not
> belonging the ohci controller.

I guess you are right.  The controller appears to set the WDH bit 
_before_ setting ohci->hcca->done_head, which is a violation of section 
6.5.2 in the OHCI specification.

> Based on my modification, I omit this
> interrupt when done_head is 0. Is that ok?

The idea is okay, but your modification can be improved.  Does this 
patch solve the problem?

Alan Stern


Index: usb-2.6/drivers/usb/host/ohci-hcd.c
===================================================================
--- usb-2.6.orig/drivers/usb/host/ohci-hcd.c
+++ usb-2.6/drivers/usb/host/ohci-hcd.c
@@ -831,10 +831,19 @@ static irqreturn_t ohci_irq (struct usb_
 			usb_hcd_resume_root_hub(hcd);
 	}
 
+	/* Some controllers violate the OHCI spec by setting OHCI_INTR_WDH
+	 * before writing ohci->hcca->done_head.  They don't generate an
+	 * early interrupt, but if the IRQ line is shared then we might see
+	 * the status bit prematurely.
+	 */
 	if (ints & OHCI_INTR_WDH) {
-		spin_lock (&ohci->lock);
-		dl_done_list (ohci);
-		spin_unlock (&ohci->lock);
+		if (unlikely((ohci->hcca->done_head == 0)) {
+			ints &= ~OHCI_INTR_WDH;
+		} else {
+			spin_lock(&ohci->lock);
+			dl_done_list(ohci);
+			spin_unlock(&ohci->lock);
+		}
 	}
 
 	if (quirk_zfmicro(ohci) && (ints & OHCI_INTR_SF)) {

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux