summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRakesh Bodla <rbodla@nvidia.com>2011-08-23 11:19:52 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:48:32 -0800
commit3acee8dd88ec37b2b5dc09e2a70470631a9f2ddd (patch)
treeb956d9085c775af3459d22e7a4504bbb9a17c6eb /drivers
parentc0f3ebafb74e967615e8167c285717b8f8168a7b (diff)
usb: ehci: tegra: correct sequence for 2LS bit time
Corrected the sequence for 2LS bit time to all the USB controller for proper suspend and resume. Bug 860452 Original-Change-Id: Ia656893e1e9f54ea149a4039d2933867d95093f3 Reviewed-on: http://git-master/r/48472 Reviewed-by: Rakesh Bodla <rbodla@nvidia.com> Tested-by: Rakesh Bodla <rbodla@nvidia.com> Reviewed-by: Hanumanth Venkateswa Moganty <vmoganty@nvidia.com> Rebase-Id: Ra58611e2110d90601a6b2a051657e3bb4427f76f
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/host/ehci-tegra.c45
1 files changed, 40 insertions, 5 deletions
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 4b7f9719b673..a63a06f9793f 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -50,6 +50,9 @@
#define TEGRA_HSIC_CONNECTION_MAX_RETRIES 5
#define HOSTPC_REG_OFFSET 0x1b4
+#define HOSTPC1_DEVLC_STS (1 << 28)
+#define HOSTPC1_DEVLC_PTS(x) (((x) & 0x7) << 29)
+
struct tegra_ehci_hcd {
struct ehci_hcd *ehci;
struct tegra_usb_phy *phy;
@@ -164,8 +167,12 @@ static void irq_work(struct work_struct *irq_work)
struct tegra_ehci_hcd *tegra =
container_of(irq_work, struct tegra_ehci_hcd, irq_work);
hcd = ehci_to_hcd(tegra->ehci);
- if (!tegra->host_resumed)
+ if (!tegra->host_resumed) {
+#ifdef CONFIG_USB_HOTPLUG
+ clk_enable(tegra->clk);
+#endif
tegra_ehci_power_up(hcd, false);
+ }
}
static irqreturn_t tegra_ehci_irq (struct usb_hcd *hcd)
@@ -219,7 +226,9 @@ static int tegra_ehci_hub_control(
int ports = HCS_N_PORTS(ehci->hcs_params);
u32 temp, status;
u32 __iomem *status_reg;
+#ifdef CONFIG_ARCH_TEGRA_2x_SOC
u32 usbsts_reg;
+#endif
unsigned long flags;
int retval = 0;
unsigned selector;
@@ -511,9 +520,19 @@ static int tegra_usb_resume(struct usb_hcd *hcd, bool is_dpd)
/* Force the phy to keep data lines in suspend state */
tegra_ehci_phy_restore_start(tegra->phy, tegra->port_speed);
+ if (tegra->ehci->has_hostpc)
+ ehci_reset(ehci);
+
/* Enable host mode */
tdi_reset(ehci);
+ if (tegra->ehci->has_hostpc) {
+ val = readl(hcd->regs + HOSTPC_REG_OFFSET);
+ val &= ~HOSTPC1_DEVLC_PTS(~0);
+ val |= HOSTPC1_DEVLC_STS;
+ writel(val, hcd->regs + HOSTPC_REG_OFFSET);
+ }
+
/* Enable Port Power */
val = readl(&hw->port_status[0]);
val |= PORT_POWER;
@@ -919,9 +938,9 @@ static int tegra_ehci_urb_enqueue (
struct tegra_ehci_hcd *pdata;
int xfertype;
int transfer_buffer_length;
- pdata = dev_get_drvdata(hcd->self.controller);
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
unsigned long flags;
+ pdata = dev_get_drvdata(hcd->self.controller);
xfertype = usb_endpoint_type(&urb->ep->desc);
transfer_buffer_length = urb->transfer_buffer_length;
@@ -1157,9 +1176,16 @@ static int tegra_ehci_resume(struct platform_device *pdev)
struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci);
- if ((tegra->bus_suspended) && (tegra->power_down_on_bus_suspend))
+ if ((tegra->bus_suspended) && (tegra->power_down_on_bus_suspend)) {
+#ifdef CONFIG_USB_HOTPLUG
+ clk_enable(tegra->clk);
+#endif
return 0;
+ }
+#ifdef CONFIG_USB_HOTPLUG
+ clk_enable(tegra->clk);
+#endif
return tegra_usb_resume(hcd, true);
}
@@ -1167,14 +1193,23 @@ static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state)
{
struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci);
+ int ret;
- if ((tegra->bus_suspended) && (tegra->power_down_on_bus_suspend))
+ if ((tegra->bus_suspended) && (tegra->power_down_on_bus_suspend)) {
+#ifdef CONFIG_USB_HOTPLUG
+ clk_disable(tegra->clk);
+#endif
return 0;
+ }
if (time_before(jiffies, tegra->ehci->next_statechange))
msleep(10);
- return tegra_usb_suspend(hcd, true);
+ ret = tegra_usb_suspend(hcd, true);
+#ifdef CONFIG_USB_HOTPLUG
+ clk_disable(tegra->clk);
+#endif
+ return ret;
}
#endif