summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Lin <stlin@nvidia.com>2011-05-24 18:44:11 -0700
committerNiket Sirsi <nsirsi@nvidia.com>2011-05-26 19:00:40 -0700
commit6f0578d704fa1f2326dfd73b18d39332f56268fb (patch)
treebb49db16360c33c1a80e9dce62f0b228d03eebae
parent92af6df195d083a1b78ae8098026c7841db5531f (diff)
usb: tegra: fix tegra ehci setup sequence for UTMI/ULPI/HSIC
This is a WAR to fix tegra ehci setup sequence for USB2 UTMI/ULPI/HSIC mode. - Calling ehci_reset according to proper phy type instead of hard coded value. - Adding CONFIG_USB_EHCI_TEGRA in the common ehci-hcd code. Bug 830978, 812716 Change-Id: Ib66acf758792ef4076c5d2ec6a2e5d565389596f Reviewed-on: http://git-master/r/32664 Tested-by: Szming Lin <stlin@nvidia.com> Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com> Reviewed-by: Michael Hsu <mhsu@nvidia.com> Tested-by: Michael Hsu <mhsu@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Reviewed-by: Alex Courbot <acourbot@nvidia.com> Tested-by: Alex Courbot <acourbot@nvidia.com>
-rw-r--r--drivers/usb/host/ehci-hcd.c2
-rw-r--r--drivers/usb/host/ehci-tegra.c29
-rw-r--r--drivers/usb/host/ehci.h2
3 files changed, 23 insertions, 10 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index f590e815df57..1a902e00b365 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -259,7 +259,9 @@ static int ehci_reset (struct ehci_hcd *ehci)
command |= CMD_RESET;
dbg_cmd (ehci, "reset", command);
+#ifdef CONFIG_USB_EHCI_TEGRA
if (!ehci->controller_resets_phy)
+#endif
ehci_writel(ehci, command, &ehci->regs->command);
ehci_to_hcd(ehci)->state = HC_STATE_HALT;
ehci->next_statechange = jiffies;
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 6a7045408e6d..74c0737a1357 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -306,9 +306,13 @@ static void tegra_ehci_restart(struct usb_hcd *hcd)
struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
unsigned int temp;
+ ehci->controller_resets_phy = 0;
ehci_reset(ehci);
tegra_ehci_post_reset(tegra->phy, false);
+ if (tegra->phy->usb_phy_type == TEGRA_USB_PHY_TYPE_NULL_ULPI)
+ ehci->controller_resets_phy = 1;
+
/* setup the frame list and Async q heads */
ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list);
ehci_writel(ehci, (u32)ehci->async->qh_dma, &ehci->regs->async_next);
@@ -503,8 +507,13 @@ static int tegra_ehci_setup(struct usb_hcd *hcd)
#ifndef CONFIG_ARCH_TEGRA_2x_SOC
ehci->has_hostpc = 1;
#endif
- if (tegra->phy->instance == 0)
+ hcd->has_tt = 1;
+
+ if (tegra->phy->usb_phy_type != TEGRA_USB_PHY_TYPE_NULL_ULPI) {
ehci_reset(ehci);
+ tegra_ehci_post_reset(tegra->phy, false);
+ }
+
retval = ehci_halt(ehci);
if (retval)
return retval;
@@ -514,19 +523,19 @@ static int tegra_ehci_setup(struct usb_hcd *hcd)
if (retval)
return retval;
- hcd->has_tt = 1;
ehci->sbrn = 0x20;
- if (!tegra->phy->instance == 0)
+ if (tegra->phy->usb_phy_type == TEGRA_USB_PHY_TYPE_NULL_ULPI) {
ehci_reset(ehci);
- tegra_ehci_post_reset(tegra->phy, false);
+ tegra_ehci_post_reset(tegra->phy, false);
- /*
- * Resetting the controller has the side effect of resetting the PHY.
- * So, never reset the controller after the calling
- * tegra_ehci_reinit API.
- */
- ehci->controller_resets_phy = 1;
+ /*
+ * Resetting the controller has the side effect of resetting the PHY.
+ * So, never reset the controller after the calling
+ * tegra_ehci_reinit API.
+ */
+ ehci->controller_resets_phy = 1;
+ }
ehci_port_power(ehci, 1);
return retval;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 530540a4bdd4..e22e7dfb5dc2 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -132,7 +132,9 @@ struct ehci_hcd { /* one per controller */
unsigned need_io_watchdog:1;
unsigned broken_periodic:1;
unsigned fs_i_thresh:1; /* Intel iso scheduling */
+#ifdef CONFIG_USB_EHCI_TEGRA
unsigned controller_resets_phy:1;
+#endif
unsigned port_reset_no_wait:1;
/* required for usb32 quirk */