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

Geoff Levand geoff at infradead.org
Fri Nov 18 13:28:44 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>
---
 drivers/usb/host/ehci-ath79.c     |    2 ++
 drivers/usb/host/ehci-au1xxx.c    |    1 +
 drivers/usb/host/ehci-cns3xxx.c   |    3 +++
 drivers/usb/host/ehci-fsl.c       |    2 ++
 drivers/usb/host/ehci-grlib.c     |    2 ++
 drivers/usb/host/ehci-hcd.c       |   11 +----------
 drivers/usb/host/ehci-ixp4xx.c    |    2 ++
 drivers/usb/host/ehci-msm.c       |    2 ++
 drivers/usb/host/ehci-mxc.c       |    2 ++
 drivers/usb/host/ehci-octeon.c    |    2 ++
 drivers/usb/host/ehci-omap.c      |    2 ++
 drivers/usb/host/ehci-orion.c     |    2 ++
 drivers/usb/host/ehci-pmcmsp.c    |    3 +++
 drivers/usb/host/ehci-ppc-of.c    |    2 ++
 drivers/usb/host/ehci-ps3.c       |    2 ++
 drivers/usb/host/ehci-pxa168.c    |    2 ++
 drivers/usb/host/ehci-s5p.c       |    2 ++
 drivers/usb/host/ehci-sh.c        |    2 ++
 drivers/usb/host/ehci-spear.c     |    2 ++
 drivers/usb/host/ehci-tegra.c     |    2 ++
 drivers/usb/host/ehci-vt8500.c    |    1 +
 drivers/usb/host/ehci-w90x900.c   |    2 ++
 drivers/usb/host/ehci-xilinx-of.c |    3 +++
 drivers/usb/host/ehci-xls.c       |    3 +++
 24 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ehci-ath79.c b/drivers/usb/host/ehci-ath79.c
index afb6743..ca7ffe9 100644
--- a/drivers/usb/host/ehci-ath79.c
+++ b/drivers/usb/host/ehci-ath79.c
@@ -167,6 +167,8 @@ static int ehci_ath79_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_iounmap;
 
+	ehci_reset(hcd_to_ehci(hcd));
+
 	return 0;
 
 err_iounmap:
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 18bafa9..e30dd43 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -126,6 +126,7 @@ static int ehci_hcd_au1xxx_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-cns3xxx.c b/drivers/usb/host/ehci-cns3xxx.c
index 6536abd..2ec7714 100644
--- a/drivers/usb/host/ehci-cns3xxx.c
+++ b/drivers/usb/host/ehci-cns3xxx.c
@@ -124,6 +124,9 @@ static int cns3xxx_ehci_probe(struct platform_device *pdev)
 	}
 
 	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
+
+	ehci_reset(hcd_to_ehci(hcd));
+
 	if (retval == 0)
 		return retval;
 
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index e90344a..9a13418 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -161,6 +161,8 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
 		}
 	}
 #endif
+	ehci_reset(hcd_to_ehci(hcd));
+
 	return retval;
 
       err4:
diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c
index fdfd8c5..cd081b0 100644
--- a/drivers/usb/host/ehci-grlib.c
+++ b/drivers/usb/host/ehci-grlib.c
@@ -174,6 +174,8 @@ static int __devinit ehci_hcd_grlib_probe(struct platform_device *op)
 	if (rv)
 		goto err_ehci;
 
+	ehci_reset(ehci);
+
 	return 0;
 
 err_ehci:
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-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c
index c4460f3..09912e3 100644
--- a/drivers/usb/host/ehci-ixp4xx.c
+++ b/drivers/usb/host/ehci-ixp4xx.c
@@ -120,6 +120,8 @@ static int ixp4xx_ehci_probe(struct platform_device *pdev)
 	if (retval)
 		goto fail_add_hcd;
 
+	ehci_reset(hcd_to_ehci(hcd));
+
 	return retval;
 
 fail_add_hcd:
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 592d5f7..ad6e804 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -166,6 +166,8 @@ static int ehci_msm_probe(struct platform_device *pdev)
 	pm_runtime_no_callbacks(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
 
+	ehci_reset(hcd_to_ehci(hcd));
+
 	return 0;
 
 put_transceiver:
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index 55978fc..760a8b6 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -257,6 +257,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
 		}
 	}
 
+	ehci_reset(ehci);
+
 	return 0;
 
 err_add:
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c
index ba1f513..ce6d1ad 100644
--- a/drivers/usb/host/ehci-octeon.c
+++ b/drivers/usb/host/ehci-octeon.c
@@ -166,6 +166,8 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev)
 	/* root ports should always stay powered */
 	ehci_port_power(ehci, 1);
 
+	ehci_reset(ehci);
+
 	return 0;
 err3:
 	ehci_octeon_stop();
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-orion.c b/drivers/usb/host/ehci-orion.c
index a68a2a5..7edd9e8 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -281,6 +281,8 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
 	if (err)
 		goto err4;
 
+	ehci_reset(ehci);
+
 	return 0;
 
 err4:
diff --git a/drivers/usb/host/ehci-pmcmsp.c b/drivers/usb/host/ehci-pmcmsp.c
index e8d54de..b31e31f 100644
--- a/drivers/usb/host/ehci-pmcmsp.c
+++ b/drivers/usb/host/ehci-pmcmsp.c
@@ -224,6 +224,9 @@ int usb_hcd_msp_probe(const struct hc_driver *driver,
 
 
 	retval = usb_add_hcd(hcd, res->start, IRQF_SHARED);
+
+	ehci_reset(ehci);
+
 	if (retval == 0)
 		return 0;
 
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index 41d11fe..5372e45 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -194,6 +194,8 @@ static int __devinit ehci_hcd_ppc_of_probe(struct platform_device *op)
 	if (rv)
 		goto err_ehci;
 
+	ehci_reset(ehci);
+
 	return 0;
 
 err_ehci:
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
index 2dc32da..0fab1ae 100644
--- a/drivers/usb/host/ehci-ps3.c
+++ b/drivers/usb/host/ehci-ps3.c
@@ -175,6 +175,8 @@ static int __devinit ps3_ehci_probe(struct ps3_system_bus_device *dev)
 		goto fail_add_hcd;
 	}
 
+	ehci_reset(hcd_to_ehci(hcd));
+
 	return result;
 
 fail_add_hcd:
diff --git a/drivers/usb/host/ehci-pxa168.c b/drivers/usb/host/ehci-pxa168.c
index ac0c16e..b4d2bf6 100644
--- a/drivers/usb/host/ehci-pxa168.c
+++ b/drivers/usb/host/ehci-pxa168.c
@@ -308,6 +308,8 @@ static int __devinit ehci_pxa168_drv_probe(struct platform_device *pdev)
 	if (err)
 		goto err5;
 
+	ehci_reset(ehci);
+
 	return 0;
 
 err5:
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-sh.c b/drivers/usb/host/ehci-sh.c
index 9d9cf47..ea8a6ea 100644
--- a/drivers/usb/host/ehci-sh.c
+++ b/drivers/usb/host/ehci-sh.c
@@ -177,6 +177,8 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
 	priv->hcd = hcd;
 	platform_set_drvdata(pdev, priv);
 
+	ehci_reset(hcd_to_ehci(hcd));
+
 	return ret;
 
 fail_add_hcd:
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index b115b0b..1aa5217 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -158,6 +158,8 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
 	if (retval)
 		goto fail_add_hcd;
 
+	ehci_reset(ehci);
+
 	return retval;
 
 fail_add_hcd:
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index db9d1b4..6e52884 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -680,6 +680,8 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 		goto fail;
 	}
 
+	ehci_reset(tegra->ehci);
+
 	return err;
 
 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);
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c
index 32793ce..55e0f80 100644
--- a/drivers/usb/host/ehci-xilinx-of.c
+++ b/drivers/usb/host/ehci-xilinx-of.c
@@ -226,6 +226,9 @@ static int __devinit ehci_hcd_xilinx_of_probe(struct platform_device *op)
 	ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
 
 	rv = usb_add_hcd(hcd, irq, 0);
+
+	ehci_reset(ehci);
+
 	if (rv == 0)
 		return 0;
 
diff --git a/drivers/usb/host/ehci-xls.c b/drivers/usb/host/ehci-xls.c
index fe74bd6..ac4b26e 100644
--- a/drivers/usb/host/ehci-xls.c
+++ b/drivers/usb/host/ehci-xls.c
@@ -88,6 +88,9 @@ int ehci_xls_probe_internal(const struct hc_driver *driver,
 	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
 	if (retval != 0)
 		goto err4;
+
+	ehci_reset(hcd_to_ehci(hcd));
+
 	return retval;
 
 err4:
-- 
1.7.0.4






More information about the cbe-oss-dev mailing list