ARM: tegra: phy: avoid illegal access to registers
Rakesh Bodla [Fri, 20 Jul 2012 06:11:09 +0000 (11:11 +0530)]
Adding the conditions to prevent illegal register access.

Bug 993380
Bug 1006579

Reviewed-on: http://git-master/r/113138
(cherry picked from commit a3c026a229bbce614d7f40319bada1d7bf42942d)

Change-Id: I0d8e6c20aab04aa43ae484dc8ceb6fcb2c27d151
Reviewed-on: http://git-master/r/117256
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rakesh Bodla <rbodla@nvidia.com>
Tested-by: Rakesh Bodla <rbodla@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

arch/arm/mach-tegra/tegra2_usb_phy.c
arch/arm/mach-tegra/tegra3_usb_phy.c

index 0ef3d4f..39e2899 100644 (file)
@@ -615,6 +615,8 @@ static int utmi_phy_irq(struct tegra_usb_phy *phy)
                        val = readl(base + USB_PORTSC);
                        val &= ~(USB_PORTSC_WKCN | USB_PORTSC_RWC_BITS);
                        writel(val , (base + USB_PORTSC));
+               } else if (!phy->phy_clk_on) {
+                       return IRQ_NONE;
                }
        }
 
index f6284bc..b0e7b76 100644 (file)
@@ -1223,11 +1223,13 @@ static int utmi_phy_irq(struct tegra_usb_phy *phy)
        void __iomem *base = phy->regs;
        unsigned long val = 0;
 
-       DBG("%s(%d) inst:[%d]\n", __func__, __LINE__, phy->inst);
-       DBG("USB_USBSTS[0x%x] USB_PORTSC[0x%x]\n",
+       if (phy->phy_clk_on) {
+               DBG("%s(%d) inst:[%d]\n", __func__, __LINE__, phy->inst);
+               DBG("USB_USBSTS[0x%x] USB_PORTSC[0x%x]\n",
                        readl(base + USB_USBSTS), readl(base + USB_PORTSC));
-       DBG("USB_USBMODE[0x%x] USB_USBCMD[0x%x]\n",
+               DBG("USB_USBMODE[0x%x] USB_USBCMD[0x%x]\n",
                        readl(base + USB_USBMODE), readl(base + USB_USBCMD));
+       }
 
        usb_phy_fence_read(phy);
        /* check if there is any remote wake event */
@@ -1247,6 +1249,8 @@ static int utmi_phy_irq(struct tegra_usb_phy *phy)
                        val = readl(base + USB_PORTSC);
                        val &= ~(USB_PORTSC_WKCN | USB_PORTSC_RWC_BITS);
                        writel(val , (base + USB_PORTSC));
+               } else if (!phy->phy_clk_on) {
+                       return IRQ_NONE;
                }
        }