[linux-cirrus] 2.6.12 USB patch

  • From: Jean-Philippe Francois <jp.francois@xxxxxxxxxx>
  • To: linux-cirrus@xxxxxxxxxxxxx
  • Date: Mon, 04 Jul 2005 16:49:59 +0200

Hi,

Here is a patch to enable USB host.
It is against a 2.6.12.1 kernel + last patch from Michael.

It should be applied with -p2 and not -p1 as usual (if any know how to
turn a patch from -p2 to -p1 ...)

I include it inline, I think this mailing list is not attachement
friendly.

JP Francois.

x-------------------------------------------------------------------------------------x

diff -x '*.c~' -urN
Unofficial/linux-2.6.12.1/drivers/usb/host/ohci-ep93xx.c
Cynove/linux-2.6.12-ep93xx-vanilla/drivers/usb/host/ohci-ep93xx.c
--- Unofficial/linux-2.6.12.1/drivers/usb/host/ohci-ep93xx.c    2005-07-04
16:07:26.000000000 +0200
+++
Cynove/linux-2.6.12-ep93xx-vanilla/drivers/usb/host/ohci-ep93xx.c       
2005-07-04 15:58:59.000000000 +0200
@@ -96,7 +96,7 @@
 
        ep93xx_start_hc(dev);
 
-       hcd = usb_create_hcd(driver);
+       hcd = usb_create_hcd(driver, &dev->dev, "amba" );
        if (hcd == NULL) {
                dbg("hcd_alloc failed");
                retval = -ENOMEM;
@@ -106,41 +106,23 @@
 
        hcd->irq = dev->irq[0];
        hcd->regs = (void __iomem *)dev->res.start;
-       hcd->self.controller = &dev->dev;
+       
+       retval = usb_add_hcd(hcd, dev->irq[0], SA_INTERRUPT);
 
-       retval = hcd_buffer_create(hcd);
        if (retval != 0) {
-               dbg("pool alloc fail");
+               dbg("usb add hcd fail");
                goto err2;
        }
 
-       retval = request_irq(hcd->irq, usb_hcd_irq, SA_INTERRUPT,
-                            hcd->driver->description, hcd);
-       if (retval != 0) {
-               dbg("request_irq failed");
-               retval = -EBUSY;
-               goto err3;
-       }
-
        info("%s (EP93xx) at 0x%p, irq %d\n",
             hcd->driver->description, hcd->regs, hcd->irq);
-
-       hcd->self.bus_name = "amba";
-       usb_register_bus(&hcd->self);
-
-       if ((retval = driver->start(hcd)) < 0) {
-               usb_hcd_ep93xx_remove(hcd, dev);
-               return retval;
-       }
-
+            
        *hcd_out = hcd;
        return 0;
 
-      err3:
-       hcd_buffer_destroy(hcd);
-      err2:
+err2:
        usb_put_hcd(hcd);
-      err1:
+err1:
        ep93xx_stop_hc(dev);
 #if 0
        release_mem_region(dev->res.start, dev->res.end - dev->res.start + 1);
@@ -148,44 +130,6 @@
        return retval;
 }
 
-/* may be called without controller electrically present */
-/* may be called with controller, bus, and devices active */
-
-/**
- * usb_hcd_ep93xx_remove - shutdown processing for SA-1111-based HCDs
- * @dev: USB Host Controller being removed
- * Context: !in_interrupt()
- *
- * Reverses the effect of usb_hcd_ep93xx_probe(), first invoking
- * the HCD's stop() method.  It is always called from a thread
- * context, normally "rmmod", "apmd", or something similar.
- *
- */
-void usb_hcd_ep93xx_remove(struct usb_hcd *hcd, struct amba_device
*dev)
-{
-       info("remove: %s, state %x", hcd->self.bus_name, hcd->state);
-
-       if (in_interrupt())
-               BUG();
-
-       hcd->state = USB_STATE_QUIESCING;
-
-       dbg("%s: roothub graceful disconnect", hcd->self.bus_name);
-       usb_disconnect(&hcd->self.root_hub);
-
-       hcd->driver->stop(hcd);
-       hcd->state = USB_STATE_HALT;
-
-       free_irq(hcd->irq, hcd);
-       hcd_buffer_destroy(hcd);
-
-       usb_deregister_bus(&hcd->self);
-
-       ep93xx_stop_hc(dev);
-#if 0
-       release_mem_region(dev->res.start, dev->res.end - dev->res.start + 1);
-#endif
-}
 

/*-------------------------------------------------------------------------*/
 
@@ -272,7 +216,7 @@
 {
        struct usb_hcd *hcd = amba_get_drvdata(dev);
 
-       usb_hcd_ep93xx_remove(hcd, dev);
+       usb_remove_hcd(hcd);
 
        amba_set_drvdata(dev, NULL);
 
diff -x '*.c~' -urN Unofficial/linux-2.6.12.1/drivers/usb/Kconfig
Cynove/linux-2.6.12-ep93xx-vanilla/drivers/usb/Kconfig
--- Unofficial/linux-2.6.12.1/drivers/usb/Kconfig       2005-06-22
21:33:05.000000000 +0200
+++ Cynove/linux-2.6.12-ep93xx-vanilla/drivers/usb/Kconfig      2005-07-04
14:17:42.000000000 +0200
@@ -21,6 +21,7 @@
        default y if ARCH_OMAP
        default y if ARCH_LH7A404
        default y if PXA27x
+       default y if ARCH_EP93XX
        # PPC:
        default y if STB03xxx
        default y if PPC_MPC52xx




Other related posts: