usb: ehci: tegra: Update RUN bit properly.
Suresh Mangipudi [Tue, 24 Jul 2012 07:22:00 +0000 (12:22 +0530)]
Read the RUN bit and update it properly.
Remove unused variable.

Change-Id: I1df5dc99ce40e2ca15f0ade28d156a7262467519
Signed-off-by: Suresh Mangipudi <smangipudi@nvidia.com>
Reviewed-on: http://git-master/r/117958
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

drivers/usb/host/ehci-tegra.c

index e41eecb..900f996 100644 (file)
@@ -231,6 +231,7 @@ static int tegra_ehci_hub_control(
        switch (typeReq) {
        case GetPortStatus:
                if (tegra->port_resuming) {
+                       u32 cmd;
                        int delay = ehci->reset_done[wIndex-1] - jiffies;
                        /* Sometimes it seems we get called too soon... In that case, wait.*/
                        if (delay > 0) {
@@ -245,9 +246,11 @@ static int tegra_ehci_hub_control(
                        tegra_usb_phy_post_resume(tegra->phy);
                        tegra->port_resuming = 0;
                        /* If run bit is not set by now enable it */
-                       if (ehci->command & CMD_RUN) {
+                       cmd = ehci_readl(ehci, &ehci->regs->command);
+                       if (!(cmd & CMD_RUN)) {
+                               cmd |= CMD_RUN;
                                ehci->command |= CMD_RUN;
-                               ehci_writel(ehci, ehci->command, &ehci->regs->command);
+                               ehci_writel(ehci, cmd, &ehci->regs->command);
                        }
                        /* Now we can safely re-enable irqs */
                        ehci_writel(ehci, INTR_MASK, &ehci->regs->intr_enable);