X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fhost%2Fohci-lh7a404.c;h=c00324861050bb943e7cd08d6760c38167b2f76b;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=4e11a8eae48179c698907dc53f2726ec9a669ce6;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index 4e11a8eae..c00324861 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c @@ -106,23 +106,22 @@ int usb_hcd_lh7a404_probe (const struct hc_driver *driver, retval = -ENOMEM; goto err1; } - - hcd = driver->hcd_alloc (); - if (hcd == NULL){ - pr_debug ("hcd_alloc failed"); + if(dev->resource[1].flags != IORESOURCE_IRQ){ + pr_debug ("resource[1] is not IORESOURCE_IRQ"); retval = -ENOMEM; goto err1; } + - if(dev->resource[1].flags != IORESOURCE_IRQ){ - pr_debug ("resource[1] is not IORESOURCE_IRQ"); + hcd = usb_create_hcd (driver); + if (hcd == NULL){ + pr_debug ("hcd_alloc failed"); retval = -ENOMEM; goto err1; } + ohci_hcd_init(hcd_to_ohci(hcd)); - hcd->driver = (struct hc_driver *) driver; - hcd->description = driver->description; hcd->irq = dev->resource[1].start; hcd->regs = addr; hcd->self.controller = &dev->dev; @@ -130,28 +129,21 @@ int usb_hcd_lh7a404_probe (const struct hc_driver *driver, retval = hcd_buffer_create (hcd); if (retval != 0) { pr_debug ("pool alloc fail"); - goto err1; + goto err2; } retval = request_irq (hcd->irq, usb_hcd_lh7a404_hcim_irq, SA_INTERRUPT, - hcd->description, hcd); + hcd->driver->description, hcd); if (retval != 0) { pr_debug("request_irq failed"); retval = -EBUSY; - goto err2; + goto err3; } pr_debug ("%s (LH7A404) at 0x%p, irq %d", - hcd->description, hcd->regs, hcd->irq); + hcd->driver->description, hcd->regs, hcd->irq); - usb_bus_init (&hcd->self); - hcd->self.op = &usb_hcd_operations; - hcd->self.hcpriv = (void *) hcd; hcd->self.bus_name = "lh7a404"; - hcd->product_desc = "LH7A404 OHCI"; - - INIT_LIST_HEAD (&hcd->dev_list); - usb_register_bus (&hcd->self); if ((retval = driver->start (hcd)) < 0) @@ -163,10 +155,10 @@ int usb_hcd_lh7a404_probe (const struct hc_driver *driver, *hcd_out = hcd; return 0; - err2: + err3: hcd_buffer_destroy (hcd); - if (hcd) - driver->hcd_free(hcd); + err2: + usb_put_hcd(hcd); err1: lh7a404_stop_hc(dev); release_mem_region(dev->resource[0].start, @@ -191,8 +183,6 @@ int usb_hcd_lh7a404_probe (const struct hc_driver *driver, */ void usb_hcd_lh7a404_remove (struct usb_hcd *hcd, struct platform_device *dev) { - void *base; - pr_debug ("remove: %s, state %x", hcd->self.bus_name, hcd->state); if (in_interrupt ()) @@ -211,9 +201,6 @@ void usb_hcd_lh7a404_remove (struct usb_hcd *hcd, struct platform_device *dev) usb_deregister_bus (&hcd->self); - base = hcd->regs; - hcd->driver->hcd_free (hcd); - lh7a404_stop_hc(dev); release_mem_region(dev->resource[0].start, dev->resource[0].end @@ -229,38 +216,14 @@ ohci_lh7a404_start (struct usb_hcd *hcd) int ret; ohci_dbg (ohci, "ohci_lh7a404_start, ohci:%p", ohci); - - ohci->hcca = dma_alloc_coherent (hcd->self.controller, - sizeof *ohci->hcca, &ohci->hcca_dma, 0); - if (!ohci->hcca) - return -ENOMEM; - - ohci_dbg (ohci, "ohci_lh7a404_start, ohci->hcca:%p", - ohci->hcca); - - memset (ohci->hcca, 0, sizeof (struct ohci_hcca)); - - if ((ret = ohci_mem_init (ohci)) < 0) { - ohci_stop (hcd); + if ((ret = ohci_init(ohci)) < 0) return ret; - } - ohci->regs = hcd->regs; - if (hc_reset (ohci) < 0) { + if ((ret = ohci_run (ohci)) < 0) { + err ("can't start %s", hcd->self.bus_name); ohci_stop (hcd); - return -ENODEV; - } - - if (hc_start (ohci) < 0) { - err ("can't start %s", ohci->hcd.self.bus_name); - ohci_stop (hcd); - return -EBUSY; + return ret; } - create_debug_files (ohci); - -#ifdef DEBUG - ohci_dump (ohci, 1); -#endif /*DEBUG*/ return 0; } @@ -268,6 +231,8 @@ ohci_lh7a404_start (struct usb_hcd *hcd) static const struct hc_driver ohci_lh7a404_hc_driver = { .description = hcd_name, + .product_desc = "LH7A404 OHCI", + .hcd_priv_size = sizeof(struct ohci_hcd), /* * generic hardware linkage @@ -285,12 +250,6 @@ static const struct hc_driver ohci_lh7a404_hc_driver = { #endif /*CONFIG_PM*/ .stop = ohci_stop, - /* - * memory lifecycle (except per-request) - */ - .hcd_alloc = ohci_hcd_alloc, - .hcd_free = ohci_hcd_free, - /* * managing i/o requests and associated device resources */