arm: tegra: usb_phy: add fence read for T114
Suresh Mangipudi [Fri, 5 Oct 2012 14:42:05 +0000 (19:42 +0530)]
Fence read will be needed by T114 as the h/w issue is not resolved.

Bug 1056145

Reviewed-on: http://git-master/r/142177
(cherry picked from commit 1fcb62e55e4e558887fa98aa3c3c72b06087f9f4)

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

arch/arm/mach-tegra/tegra11x_usb_phy.c

index 6596e00..43e42ea 100644 (file)
@@ -606,6 +606,19 @@ static int _usb_phy_init(struct tegra_usb_phy *phy)
 
        return 0;
 }
+
+static void usb_phy_fence_read(struct tegra_usb_phy *phy)
+{
+       /* Fence read for coherency of AHB master intiated writes */
+       if (phy->inst == 0)
+               readb(IO_ADDRESS(IO_PPCS_PHYS + USB1_PREFETCH_ID));
+       else if (phy->inst == 1)
+               readb(IO_ADDRESS(IO_PPCS_PHYS + USB2_PREFETCH_ID));
+       else if (phy->inst == 2)
+               readb(IO_ADDRESS(IO_PPCS_PHYS + USB3_PREFETCH_ID));
+       return;
+}
+
 static int usb_phy_reset(struct tegra_usb_phy *phy)
 {
        unsigned long val;
@@ -1224,6 +1237,7 @@ static int utmi_phy_irq(struct tegra_usb_phy *phy)
                        readl(base + USB_USBMODE), readl(base + USB_USBCMD));
        }
 
+       usb_phy_fence_read(phy);
        /* check if there is any remote wake event */
        if (utmi_phy_remotewake_detected(phy)) {
                pr_info("%s: utmip remote wake detected\n", __func__);
@@ -2123,6 +2137,7 @@ static void uhsic_phy_close(struct tegra_usb_phy *phy)
 static int uhsic_phy_irq(struct tegra_usb_phy *phy)
 {
        /* check if there is any remote wake event */
+       usb_phy_fence_read(phy);
        if (uhsic_phy_remotewake_detected(phy))
                pr_info("%s: uhsic remote wake detected\n", __func__);
        return IRQ_HANDLED;