This is a note to let you know that I've just added the patch titled

     Subject: USB: OHCI: disable RHSC inside interrupt handler

to my gregkh-2.6 tree.  Its filename is

     usb-ohci-disable-rhsc-inside-interrupt-handler.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


>From [EMAIL PROTECTED] Fri Oct 27 07:33:25 2006
Date: Fri, 27 Oct 2006 10:33:11 -0400 (EDT)
From: Alan Stern <[EMAIL PROTECTED]>
To: Greg KH <[EMAIL PROTECTED]>
cc: David Brownell <[EMAIL PROTECTED]>, USB development list 
<linux-usb-devel@lists.sourceforge.net>
Subject: USB: OHCI: disable RHSC inside interrupt handler
Message-ID: <[EMAIL PROTECTED]>

This patch (as808b) moves the Root Hub Status Change interrupt-disable
code in ohci-hcd back into the interrupt handler proper, to avoid the
chance of adverse interactions with mediocre hardware implementations.

It also deletes the root-hub status timer from within the interrupt-enable
routine.  There's no need to poll for status any more once interrupts are
re-enabled.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/usb/host/ohci-hcd.c |   10 ++++++++++
 drivers/usb/host/ohci-hub.c |   24 ++++++++----------------
 2 files changed, 18 insertions(+), 16 deletions(-)

--- gregkh-2.6.orig/drivers/usb/host/ohci-hcd.c
+++ gregkh-2.6/drivers/usb/host/ohci-hcd.c
@@ -729,6 +729,16 @@ static irqreturn_t ohci_irq (struct usb_
                ohci->next_statechange = jiffies + STATECHANGE_DELAY;
                ohci_writel(ohci, OHCI_INTR_RD | OHCI_INTR_RHSC,
                                &regs->intrstatus);
+
+               /* NOTE: Vendors didn't always make the same implementation
+                * choices for RHSC.  Many followed the spec; RHSC triggers
+                * on an edge, like setting and maybe clearing a port status
+                * change bit.  With others it's level-triggered, active
+                * until khubd clears all the port status change bits.  We'll
+                * always disable it here and rely on polling until khubd
+                * re-enables it.
+                */
+               ohci_writel(ohci, OHCI_INTR_RHSC, &regs->intrdisable);
                usb_hcd_poll_rh_status(hcd);
        }
 
--- gregkh-2.6.orig/drivers/usb/host/ohci-hub.c
+++ gregkh-2.6/drivers/usb/host/ohci-hub.c
@@ -41,7 +41,11 @@ static void ohci_rhsc_enable (struct usb
 {
        struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
 
-       ohci_writel (ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
+       spin_lock_irq(&ohci->lock);
+       if (!ohci->autostop)
+               del_timer(&hcd->rh_timer);      /* Prevent next poll */
+       ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
+       spin_unlock_irq(&ohci->lock);
 }
 
 #define OHCI_SCHED_ENABLES \
@@ -348,7 +352,7 @@ ohci_hub_status_data (struct usb_hcd *hc
 {
        struct ohci_hcd *ohci = hcd_to_ohci (hcd);
        int             i, changed = 0, length = 1;
-       int             any_connected = 0, rhsc_enabled = 1;
+       int             any_connected = 0;
        unsigned long   flags;
 
        spin_lock_irqsave (&ohci->lock, flags);
@@ -389,19 +393,6 @@ ohci_hub_status_data (struct usb_hcd *hc
                }
        }
 
-       /* NOTE:  vendors didn't always make the same implementation
-        * choices for RHSC.  Sometimes it triggers on an edge (like
-        * setting and maybe clearing a port status change bit); and
-        * it's level-triggered on other silicon, active until khubd
-        * clears all active port status change bits.  If it's still
-        * set (level-triggered) we must disable it and rely on
-        * polling until khubd re-enables it.
-        */
-       if (ohci_readl (ohci, &ohci->regs->intrstatus) & OHCI_INTR_RHSC) {
-               ohci_writel (ohci, OHCI_INTR_RHSC, &ohci->regs->intrdisable);
-               (void) ohci_readl (ohci, &ohci->regs->intrdisable);
-               rhsc_enabled = 0;
-       }
        hcd->poll_rh = 1;
 
        /* carry out appropriate state changes */
@@ -412,7 +403,8 @@ ohci_hub_status_data (struct usb_hcd *hc
                 * and RHSC is enabled */
                if (!ohci->autostop) {
                        if (any_connected) {
-                               if (rhsc_enabled)
+                               if (ohci_readl(ohci, &ohci->regs->intrenable) &
+                                               OHCI_INTR_RHSC)
                                        hcd->poll_rh = 0;
                        } else {
                                ohci->autostop = 1;


Patches currently in gregkh-2.6 which might be from [EMAIL PROTECTED] are

usb/ehci-hcd-fix-budget_pool-allocation-for-machines-with-multiple-ehci-controllers.patch
usb/usb-core-don-t-match-interface-descriptors-for-vendor-specific-devices.patch
usb/usb-hid-handle-stall-on-interrupt-endpoint.patch
usb/usb-takes-31-devices-per-hub.patch
usb/usb-hub-root-hub-code-takes-more-than-15-devices.patch
usb/usb-ohci-disable-rhsc-inside-interrupt-handler.patch
usb/usb-ohci-fix-root-hub-resume-bug.patch
usb/usb-ohci-hcd-fix-compiler-warning.patch
usb/usb-ohci-remove-stale-testing-code-from-root-hub-resume.patch
g-usb-hub-autosuspend-autoresume.patch
g-ehci-repair-remote-wakeup-support.patch

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to