On Wednesday 02 February 2005 12:30 pm, David Brownell wrote:

>  - The OMAP patch doesn't apply against the latest omap-ohci; here's
>    a version I sanity-tested.  (Applies against Greg's BK or against
>    the current linux-omap tree.)

Erm, _here_ is that version.

- Dave
--- 1.47/drivers/usb/host/ohci-omap.c	2005-01-20 02:30:19 -08:00
+++ edited/drivers/usb/host/ohci-omap.c	2005-02-02 12:16:08 -08:00
@@ -285,8 +285,6 @@
 
 /*-------------------------------------------------------------------------*/
 
-void usb_hcd_omap_remove (struct usb_hcd *, struct platform_device *);
-
 /* configure so an HC device and id are always provided */
 /* always called with process context; sleeping is OK */
 
@@ -303,7 +301,7 @@
 			  struct platform_device *pdev)
 {
 	int retval;
-	struct usb_hcd *hcd = 0;
+	struct usb_hcd *hcd;
 	struct ohci_hcd *ohci;
 
 	if (pdev->num_resources != 2) {
@@ -325,7 +323,9 @@
 		return -EBUSY;
 	}
 
-	hcd = usb_create_hcd (driver);
+	hcd = usb_create_hcd (driver, &pdev->dev,
+			(void __iomem *) pdev->resource[0].start,
+			pdev->dev.bus_id);
 	if (hcd == NULL){
 		dev_dbg(&pdev->dev, "hcd_alloc failed\n");
 		retval = -ENOMEM;
@@ -335,57 +335,30 @@
 	ohci = hcd_to_ohci(hcd);
 	ohci_hcd_init(ohci);
 
-	hcd->irq = pdev->resource[1].start;
 	hcd->regs = (void *)pdev->resource[0].start;
-	hcd->self.controller = &pdev->dev;
-
-	retval = hcd_buffer_create (hcd);
-	if (retval != 0) {
-		dev_dbg(&pdev->dev, "pool alloc fail\n");
-		goto err2;
-	}
-
 	retval = omap_start_hc(ohci, pdev);
 	if (retval < 0)
 		goto err2;
 
-	retval = request_irq (hcd->irq, usb_hcd_irq, 
-	 SA_INTERRUPT, hcd_name, hcd);
-	if (retval != 0) {
-		dev_dbg(&pdev->dev, "request_irq failed\n");
-		retval = -EBUSY;
-		goto err3;
-	}
-
-	dev_info(&pdev->dev, "%s at 0x%p, irq %d\n",
-		hcd->product_desc, hcd->regs, hcd->irq);
-
-	hcd->self.bus_name = pdev->dev.bus_id;
-	usb_register_bus (&hcd->self);
-
-	if ((retval = driver->start (hcd)) < 0) {
-		usb_hcd_omap_remove(hcd, pdev);
+	retval = usb_add_hcd(hcd, pdev->resource[1].start,
+			usb_hcd_irq, SA_INTERRUPT,
+			(unsigned long) hcd->regs);
+	if (retval == 0)
 		return retval;
-	}
-
-	return 0;
 
- err3:
-	hcd_buffer_destroy (hcd);
+	omap_stop_hc(pdev);
  err2:
 	dev_set_drvdata(&pdev->dev, NULL);
 	usb_put_hcd(hcd);
  err1:
-	omap_stop_hc(pdev);
 
 	release_mem_region(pdev->resource[0].start, 
-			   pdev->resource[0].end - pdev->resource[0].start + 1);
+		pdev->resource[0].end - pdev->resource[0].start + 1);
 
 	return retval;
 }
 
 
-/* may be called without controller electrically present */
 /* may be called with controller, bus, and devices active */
 
 /**
@@ -400,31 +373,15 @@
  */
 void usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev)
 {
-	dev_info(&pdev->dev, "remove: state %x\n", hcd->state);
-
-	if (in_interrupt ())
-		BUG ();
-
-	hcd->state = USB_STATE_QUIESCING;
-
-	dev_dbg(&pdev->dev, "roothub graceful disconnect\n");
-	usb_disconnect (&hcd->self.root_hub);
-
-	hcd->driver->stop (hcd);
-	hcd_buffer_destroy (hcd);
-	hcd->state = USB_STATE_HALT;
-
+	usb_remove_hcd(hcd);
 	if (machine_is_omap_osk())
 		omap_free_gpio(9);
-
-	free_irq (hcd->irq, hcd);
-
-	usb_deregister_bus (&hcd->self);
-
 	omap_stop_hc(pdev);
 
+	dev_set_drvdata(&pdev->dev, NULL);
+	usb_put_hcd(hcd);
 	release_mem_region(pdev->resource[0].start, 
-			   pdev->resource[0].end - pdev->resource[0].start + 1);
+			pdev->resource[0].end - pdev->resource[0].start + 1);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -459,7 +416,7 @@
 	 * generic hardware linkage
 	 */
 	.irq =			ohci_irq,
-	.flags =		HCD_USB11,
+	.flags =		HCD_MEMORY | HCD_USB11,
 
 	/*
 	 * basic lifecycle operations

Reply via email to