EHCI : introduce a common ehci_setup
authorMatthieu CASTET <castet.matthieu@free.fr>
Sat, 2 Jul 2011 17:47:33 +0000 (19:47 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 26 Sep 2011 22:48:41 +0000 (15:48 -0700)
This allow to clean duplicated code in most of SOC driver.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org> # fixes 3.1 build error
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/ehci-hcd.c

index 2f0cf863b379f6ad21ed22e0450bf2597a8c924a..05abbcd93cf443d338ca19f5dff84b5fe489b061 100644 (file)
@@ -768,6 +768,35 @@ static int ehci_run (struct usb_hcd *hcd)
        return 0;
 }
 
+static int __maybe_unused ehci_setup (struct usb_hcd *hcd)
+{
+       struct ehci_hcd *ehci = hcd_to_ehci(hcd);
+       int retval;
+
+       ehci->regs = (void __iomem *)ehci->caps +
+           HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
+       dbg_hcs_params(ehci, "reset");
+       dbg_hcc_params(ehci, "reset");
+
+       /* cache this readonly data; minimize chip reads */
+       ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
+
+       ehci->sbrn = HCD_USB2;
+
+       retval = ehci_halt(ehci);
+       if (retval)
+               return retval;
+
+       /* data structure init */
+       retval = ehci_init(hcd);
+       if (retval)
+               return retval;
+
+       ehci_reset(ehci);
+
+       return 0;
+}
+
 /*-------------------------------------------------------------------------*/
 
 static irqreturn_t ehci_irq (struct usb_hcd *hcd)