Merge branch 'linux-2.6'
[safe/jmp/linux-2.6] / drivers / usb / host / ohci-hcd.c
index 3f80003..e8bbe8b 100644 (file)
@@ -42,6 +42,9 @@
 #include <asm/system.h>
 #include <asm/unaligned.h>
 #include <asm/byteorder.h>
+#ifdef CONFIG_PPC_PS3
+#include <asm/firmware.h>
+#endif
 
 #include "../core/hcd.h"
 
@@ -483,9 +486,6 @@ static int ohci_run (struct ohci_hcd *ohci)
         * or if bus glue did the same (e.g. for PCI add-in cards with
         * PCI PM support).
         */
-       ohci_dbg (ohci, "resetting from state '%s', control = 0x%x\n",
-                       hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
-                       ohci_readl (ohci, &ohci->regs->control));
        if ((ohci->hc_control & OHCI_CTRL_RWC) != 0
                        && !device_may_wakeup(hcd->self.controller))
                device_init_wakeup(hcd->self.controller, 1);
@@ -741,9 +741,6 @@ static void ohci_stop (struct usb_hcd *hcd)
 {
        struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
 
-       ohci_dbg (ohci, "stop %s controller (state 0x%02x)\n",
-               hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
-               hcd->state);
        ohci_dump (ohci, 1);
 
        flush_scheduled_work();
@@ -914,16 +911,27 @@ MODULE_LICENSE ("GPL");
 #endif
 
 
+#ifdef CONFIG_USB_OHCI_HCD_PPC_OF
+#include "ohci-ppc-of.c"
+#define OF_PLATFORM_DRIVER     ohci_hcd_ppc_of_driver
+#endif
+
+#ifdef CONFIG_PPC_PS3
+#include "ohci-ps3.c"
+#define PS3_SYSTEM_BUS_DRIVER  ps3_ohci_sb_driver
+#endif
+
 #if    !defined(PCI_DRIVER) &&         \
        !defined(PLATFORM_DRIVER) &&    \
-       !defined(SA1111_DRIVER)
+       !defined(OF_PLATFORM_DRIVER) && \
+       !defined(SA1111_DRIVER) &&      \
+       !defined(PS3_SYSTEM_BUS_DRIVER)
 #error "missing bus glue for ohci-hcd"
 #endif
 
 static int __init ohci_hcd_mod_init(void)
 {
        int retval = 0;
-       int ls = 0;
 
        if (usb_disabled())
                return -ENODEV;
@@ -932,38 +940,61 @@ static int __init ohci_hcd_mod_init(void)
        pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
                sizeof (struct ed), sizeof (struct td));
 
+#ifdef PS3_SYSTEM_BUS_DRIVER
+       if (firmware_has_feature(FW_FEATURE_PS3_LV1)) {
+               retval = ps3_system_bus_driver_register(
+                               &PS3_SYSTEM_BUS_DRIVER);
+               if (retval < 0)
+                       goto error_ps3;
+       }
+#endif
+
 #ifdef PLATFORM_DRIVER
        retval = platform_driver_register(&PLATFORM_DRIVER);
        if (retval < 0)
-               return retval;
-       ls++;
+               goto error_platform;
+#endif
+
+#ifdef OF_PLATFORM_DRIVER
+       retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
+       if (retval < 0)
+               goto error_of_platform;
 #endif
 
 #ifdef SA1111_DRIVER
        retval = sa1111_driver_register(&SA1111_DRIVER);
        if (retval < 0)
-               goto error;
-       ls++;
+               goto error_sa1111;
 #endif
 
 #ifdef PCI_DRIVER
        retval = pci_register_driver(&PCI_DRIVER);
        if (retval < 0)
-               goto error;
-       ls++;
+               goto error_pci;
 #endif
 
        return retval;
 
        /* Error path */
-error:
-#ifdef PLATFORM_DRIVER
-       if (ls--)
-               platform_driver_unregister(&PLATFORM_DRIVER);
+#ifdef PCI_DRIVER
+ error_pci:
 #endif
 #ifdef SA1111_DRIVER
-       if (ls--)
-               sa1111_driver_unregister(&SA1111_DRIVER);
+       sa1111_driver_unregister(&SA1111_DRIVER);
+ error_sa1111:
+#endif
+#ifdef OF_PLATFORM_DRIVER
+       of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+ error_of_platform:
+#endif
+#ifdef PLATFORM_DRIVER
+       platform_driver_unregister(&PLATFORM_DRIVER);
+ error_platform:
+#endif
+#ifdef PS3_SYSTEM_BUS_DRIVER
+       if (firmware_has_feature(FW_FEATURE_PS3_LV1))
+               ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
+ error_ps3:
 #endif
        return retval;
 }
@@ -977,9 +1008,16 @@ static void __exit ohci_hcd_mod_exit(void)
 #ifdef SA1111_DRIVER
        sa1111_driver_unregister(&SA1111_DRIVER);
 #endif
+#ifdef OF_PLATFORM_DRIVER
+       of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+#endif
 #ifdef PLATFORM_DRIVER
        platform_driver_unregister(&PLATFORM_DRIVER);
 #endif
+#ifdef PS3_SYSTEM_BUS_DRIVER
+       if (firmware_has_feature(FW_FEATURE_PS3_LV1))
+               ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
+#endif
 }
 module_exit(ohci_hcd_mod_exit);