This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / usb / host / ohci-sa1111.c
index 5bb7fe4..c3cd76a 100644 (file)
@@ -194,7 +194,6 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver,
 
        usb_bus_init (&hcd->self);
        hcd->self.op = &usb_hcd_operations;
-       hcd->self.release = &usb_hcd_release;
        hcd->self.hcpriv = (void *) hcd;
        hcd->self.bus_name = "sa1111";
        hcd->product_desc = "SA-1111 OHCI";
@@ -214,8 +213,9 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver,
 
  err2:
        hcd_buffer_destroy (hcd);
+       if (hcd)
+               driver->hcd_free(hcd);
  err1:
-       kfree(hcd);
        sa1111_stop_hc(dev);
        release_mem_region(dev->res.start, dev->res.end - dev->res.start + 1);
        return retval;
@@ -237,6 +237,8 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver,
  */
 void usb_hcd_sa1111_remove (struct usb_hcd *hcd, struct sa1111_dev *dev)
 {
+       void *base;
+
        info ("remove: %s, state %x", hcd->self.bus_name, hcd->state);
 
        if (in_interrupt ())
@@ -255,6 +257,9 @@ void usb_hcd_sa1111_remove (struct usb_hcd *hcd, struct sa1111_dev *dev)
 
        usb_deregister_bus (&hcd->self);
 
+       base = hcd->regs;
+       hcd->driver->hcd_free (hcd);
+
        sa1111_stop_hc(dev);
        release_mem_region(dev->res.start, dev->res.end - dev->res.start + 1);
 }
@@ -267,14 +272,33 @@ ohci_sa1111_start (struct usb_hcd *hcd)
        struct ohci_hcd *ohci = hcd_to_ohci (hcd);
        int             ret;
 
-       if ((ret = ohci_init(ohci)) < 0)
+       ohci->hcca = dma_alloc_coherent (hcd->self.controller,
+                       sizeof *ohci->hcca, &ohci->hcca_dma, 0);
+       if (!ohci->hcca)
+               return -ENOMEM;
+        
+       memset (ohci->hcca, 0, sizeof (struct ohci_hcca));
+       if ((ret = ohci_mem_init (ohci)) < 0) {
+               ohci_stop (hcd);
                return ret;
+       }
+       ohci->regs = hcd->regs;
+
+       if (hc_reset (ohci) < 0) {
+               ohci_stop (hcd);
+               return -ENODEV;
+       }
 
-       if ((ret = ohci_run (ohci)) < 0) {
+       if (hc_start (ohci) < 0) {
                err ("can't start %s", ohci->hcd.self.bus_name);
                ohci_stop (hcd);
-               return ret;
+               return -EBUSY;
        }
+       create_debug_files (ohci);
+
+#ifdef DEBUG
+       ohci_dump (ohci, 1);
+#endif
        return 0;
 }
 
@@ -303,6 +327,7 @@ static const struct hc_driver ohci_sa1111_hc_driver = {
         * memory lifecycle (except per-request)
         */
        .hcd_alloc =            ohci_hcd_alloc,
+       .hcd_free =             ohci_hcd_free,
 
        /*
         * managing i/o requests and associated device resources