mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] EHCI : introduce a common ehci_setup
@ 2011-07-02 18:59 Matthieu CASTET
  2011-07-02 18:59 ` [PATCH 2/2] ehci-msm : use ehci_setup Matthieu CASTET
  2011-07-02 20:35 ` [PATCH 1/2] EHCI : introduce a common ehci_setup Alan Stern
  0 siblings, 2 replies; 5+ messages in thread
From: Matthieu CASTET @ 2011-07-02 18:59 UTC (permalink / raw)
  To: Linux Kernel list, linux-usb; +Cc: Matthieu CASTET

This allow to clean duplicated code in most of SOC driver.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
---
 drivers/usb/host/ehci-hcd.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index f8030ee..f990b0f 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -763,6 +763,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)
-- 
1.7.5.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-04 15:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-02 18:59 [PATCH 1/2] EHCI : introduce a common ehci_setup Matthieu CASTET
2011-07-02 18:59 ` [PATCH 2/2] ehci-msm : use ehci_setup Matthieu CASTET
2011-07-02 20:35 ` [PATCH 1/2] EHCI : introduce a common ehci_setup Alan Stern
2011-07-03 21:02   ` matthieu castet
2011-07-04 15:47     ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®