[Cbe-oss-dev] [PATCH 1/2 v2] usb: Remove ehci_reset call from ehci_run

Geoff Levand geoff at infradead.org
Thu Nov 24 12:43:53 EST 2011


Remove the ehci_reset() call done in the ehci_run() routine of the
USB EHCI host controller driver and add an ehci_reset() call to the
probe routine of all EHCI platform drivers that do not already call
ehci_reset().

The call to ehci_reset() from ehci_run() was problematic for several
platform drivers, and unnecessary for others.  This change moves the
decision to call ehci_reset() at driver startup to the platform
driver code.

Signed-off-by: Geoff Levand <geoff at infradead.org>
---

Hi Alan,

I went through and reduced the patch down to what I think is the minimum needed.  More review/checks are appreciated.

-Geoff

v2: - Remove redundant ehci_reset() calls of v1 patch.
     - Put ehci_reset() calls in .reset (setup) routine when possible.

 drivers/usb/host/ehci-au1xxx.c  |    1 +
 drivers/usb/host/ehci-hcd.c     |   11 +----------
 drivers/usb/host/ehci-omap.c    |    2 ++
 drivers/usb/host/ehci-s5p.c     |    2 ++
 drivers/usb/host/ehci-vt8500.c  |    1 +
 drivers/usb/host/ehci-w90x900.c |    2 ++
 6 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 18bafa9..bf7441a 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -23,6 +23,7 @@ static int au1xxx_ehci_setup(struct usb_hcd *hcd)
 	int ret = ehci_init(hcd);
 
 	ehci->need_io_watchdog = 0;
+	ehci_reset(ehci);
 	return ret;
 }
 
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 3ff9f82..46dccbf 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -677,22 +677,13 @@ static int ehci_init(struct usb_hcd *hcd)
 static int ehci_run (struct usb_hcd *hcd)
 {
 	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
-	int			retval;
 	u32			temp;
 	u32			hcc_params;
 
 	hcd->uses_new_polling = 1;
 
 	/* EHCI spec section 4.1 */
-	/*
-	 * TDI driver does the ehci_reset in their reset callback.
-	 * Don't reset here, because configuration settings will
-	 * vanish.
-	 */
-	if (!ehci_is_TDI(ehci) && (retval = ehci_reset(ehci)) != 0) {
-		ehci_mem_cleanup(ehci);
-		return retval;
-	}
+
 	ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list);
 	ehci_writel(ehci, (u32)ehci->async->qh_dma, &ehci->regs->async_next);
 
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index e39b029..59f4d5c 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -237,6 +237,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
 	/* root ports should always stay powered */
 	ehci_port_power(omap_ehci, 1);
 
+	ehci_reset(omap_ehci);
+
 	return 0;
 
 err_add_hcd:
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 024b65c..a8563b5 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -144,6 +144,8 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, s5p_ehci);
 
+	ehci_reset(ehci);
+
 	return 0;
 
 fail:
diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c
index 54d1ab8..768fd44 100644
--- a/drivers/usb/host/ehci-vt8500.c
+++ b/drivers/usb/host/ehci-vt8500.c
@@ -136,6 +136,7 @@ static int vt8500_ehci_drv_probe(struct platform_device *pdev)
 			  IRQF_SHARED);
 	if (ret == 0) {
 		platform_set_drvdata(pdev, hcd);
+		ehci_reset(ehci);
 		return ret;
 	}
 
diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c
index d661cf7..c6ce24c 100644
--- a/drivers/usb/host/ehci-w90x900.c
+++ b/drivers/usb/host/ehci-w90x900.c
@@ -84,6 +84,8 @@ static int __devinit usb_w90x900_probe(const struct hc_driver *driver,
 
 	ehci_writel(ehci, 1, &ehci->regs->configured_flag);
 
+	ehci_reset(ehci);
+
 	return retval;
 err4:
 	iounmap(hcd->regs);
-- 
1.7.0.4






More information about the cbe-oss-dev mailing list