diff options
author | Victor Ryabukhin <vryabukhin@nvidia.com> | 2011-07-11 11:29:43 +0900 |
---|---|---|
committer | Manish Tuteja <mtuteja@nvidia.com> | 2011-08-02 06:26:54 -0700 |
commit | 26b2ed2f2b220cd483ac0c68f5ff8c9f1f744f88 (patch) | |
tree | fd289d38f7429f6b08dc12ef3c6df7c8bae6b25a | |
parent | ff4babd883b8eb2028ebfabbf68a65d7b0d7f107 (diff) |
arm: tegra: otg Recheck connected usb devices on resume
A device might be connected while CPU is in sleep mode.
In this case no interrupt will be triggered.
Force irq_work to recheck connected devices.
Reviewed-on: http://git-master/r/40331
(cherry picked from commit 749e994e1e0010843e4a2d54e27a7f19274661a7)
Change-Id: I8e42593a113ce00108a629474bfa9dcc4b4d09b5
Reviewed-on: http://git-master/r/43414
Reviewed-by: David Schalig <dschalig@nvidia.com>
Tested-by: David Schalig <dschalig@nvidia.com>
Reviewed-by: Hanumanth Venkateswa Moganty <vmoganty@nvidia.com>
-rw-r--r-- | drivers/usb/otg/tegra-otg.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/usb/otg/tegra-otg.c b/drivers/usb/otg/tegra-otg.c index ed02dea8e4f9..ffcb4b3e46b4 100644 --- a/drivers/usb/otg/tegra-otg.c +++ b/drivers/usb/otg/tegra-otg.c @@ -400,6 +400,8 @@ static int tegra_otg_suspend(struct platform_device *pdev, pm_message_t state) static int tegra_otg_resume(struct platform_device * pdev) { struct tegra_otg_data *tegra_otg = platform_get_drvdata(pdev); + int val; + unsigned long flags; tegra_otg_enable_clk(); @@ -411,8 +413,20 @@ static int tegra_otg_resume(struct platform_device * pdev) /* restore the interupt enable for cable ID and VBUS */ clk_enable(tegra_otg->clk); writel(tegra_otg->intr_reg_data, (tegra_otg->regs + USB_PHY_WAKEUP)); + val = readl(tegra_otg->regs + USB_PHY_WAKEUP); clk_disable(tegra_otg->clk); + /* A device might be connected while CPU is in sleep mode. In this case no interrupt + * will be triggered + * force irq_work to recheck connected devices + */ + if (!(val & USB_ID_STATUS)) { + spin_lock_irqsave(&tegra_otg->lock, flags); + tegra_otg->int_status = (val | USB_ID_INT_STATUS); + schedule_work(&tegra_otg->work); + spin_unlock_irqrestore(&tegra_otg->lock, flags); + } + return 0; } #endif |