ChangeSet 1.1043.1.19, 2003/02/17 10:40:43-08:00, [EMAIL PROTECTED]

[PATCH] USB: USB keyboard works after reboot (ehci-hcd)

This resolves a problem caused by "reboot" not actually
doing a clean shutdown of drivers.  It uses a reboot
notifier to make sure that typical BIOS code (using the
USB 1.1 companion controllers) will see keyboards even
without an EHCI driver being active.


diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
--- a/drivers/usb/host/ehci-hcd.c       Tue Feb 18 16:38:44 2003
+++ b/drivers/usb/host/ehci-hcd.c       Tue Feb 18 16:38:44 2003
@@ -37,7 +37,7 @@
 #include <linux/timer.h>
 #include <linux/list.h>
 #include <linux/interrupt.h>
-
+#include <linux/reboot.h>
 #include <linux/usb.h>
 
 #include <linux/version.h>
@@ -306,6 +306,19 @@
        return 0;
 }
 
+static int
+ehci_reboot (struct notifier_block *self, unsigned long code, void *null)
+{
+       struct ehci_hcd         *ehci;
+
+       ehci = container_of (self, struct ehci_hcd, reboot_notifier);
+
+       /* make BIOS/etc use companion controller during reboot */
+       writel (0, &ehci->regs->configured_flag);
+       return 0;
+}
+
+
 /* called by khubd or root hub init threads */
 
 static int ehci_start (struct usb_hcd *hcd)
@@ -464,6 +477,9 @@
         * are explicitly handed to companion controller(s), so no TT is
         * involved with the root hub.
         */
+       ehci->reboot_notifier.notifier_call = ehci_reboot;
+       register_reboot_notifier (&ehci->reboot_notifier);
+
        ehci->hcd.state = USB_STATE_READY;
        writel (FLAG_CF, &ehci->regs->configured_flag);
        readl (&ehci->regs->command);   /* unblock posted write */
@@ -520,6 +536,7 @@
 
        /* let companion controllers work when we aren't */
        writel (0, &ehci->regs->configured_flag);
+       unregister_reboot_notifier (&ehci->reboot_notifier);
 
        remove_debug_files (ehci);
 
diff -Nru a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
--- a/drivers/usb/host/ehci.h   Tue Feb 18 16:38:44 2003
+++ b/drivers/usb/host/ehci.h   Tue Feb 18 16:38:44 2003
@@ -81,8 +81,10 @@
        struct pci_pool         *sitd_pool;     /* sitd per split iso urb */
 
        struct timer_list       watchdog;
+       struct notifier_block   reboot_notifier;
        unsigned                stamp;
 
+       /* irq statistics */
 #ifdef EHCI_STATS
        struct ehci_stats       stats;
 #      define COUNT(x) do { (x)++; } while (0)



-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to