usb: otg: tegra: Enable ID_WAKEUP in otg suspend
Rakesh Bodla [Mon, 4 Jun 2012 11:45:35 +0000 (16:45 +0530)]
Disabling the ID_WAKEUP in the suspend causing the
otg state to change to host, so disabling it in otg
suspend. Also, renaming the readl calls to otg_readl
call.

Bug 993390

Change-Id: I2789ea31fefe4425eb63b6be3e70d794bddcfd83
Signed-off-by: Rakesh Bodla <rbodla@nvidia.com>
Reviewed-on: http://git-master/r/106177
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

drivers/usb/otg/tegra-otg.c

index 2719a62..3bb43c6 100644 (file)
@@ -507,9 +507,9 @@ static int tegra_otg_suspend(struct device *dev)
                                        tegra_state_name(otg->state));
 
        clk_enable(tegra->clk);
-       val = readl(tegra->regs + USB_PHY_WAKEUP);
-       val &= ~USB_INT_EN;
-       writel(val, tegra->regs + USB_PHY_WAKEUP);
+       val = otg_readl(tegra, USB_PHY_WAKEUP);
+       val &= ~(USB_ID_INT_EN | USB_VBUS_INT_EN);
+       otg_writel(tegra, val, USB_PHY_WAKEUP);
        clk_disable(tegra->clk);
 
        /* Suspend peripheral mode, host mode is taken care by host driver */
@@ -531,8 +531,8 @@ static void tegra_otg_resume(struct device *dev)
 
        /* Clear pending interrupts */
        clk_enable(tegra->clk);
-       val = readl(tegra->regs + USB_PHY_WAKEUP);
-       writel(val, tegra->regs + USB_PHY_WAKEUP);
+       val = otg_readl(tegra, USB_PHY_WAKEUP);
+       otg_writel(tegra, val, USB_PHY_WAKEUP);
        DBG("%s(%d) PHY WAKEUP register : 0x%x\n", __func__, __LINE__, val);
        clk_disable(tegra->clk);
 
@@ -546,11 +546,7 @@ static void tegra_otg_resume(struct device *dev)
        spin_unlock_irqrestore(&tegra->lock, flags);
        irq_work(&tegra->work);
 
-       clk_enable(tegra->clk);
-       val = readl(tegra->regs + USB_PHY_WAKEUP);
-       val |= USB_INT_EN;
-       writel(val, tegra->regs + USB_PHY_WAKEUP);
-       clk_disable(tegra->clk);
+       enable_interrupt(tegra, true);
        DBG("%s(%d) END\n", __func__, __LINE__);
 }