Merge remote-tracking branch 'lsk/v3.10/topic/gator' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / drivers / usb / host / ehci.h
index 7c978b23520d07a871396db9626293fd352944ca..03322d9c70dc4c72dce8ea1ffb55e808ed3d7b63 100644 (file)
@@ -200,6 +200,7 @@ struct ehci_hcd {                   /* one per controller */
        unsigned                has_synopsys_hc_bug:1; /* Synopsys HC */
        unsigned                frame_index_bug:1; /* MosChip (AKA NetMos) */
        unsigned                need_oc_pp_cycle:1; /* MPC834X port power */
+       unsigned                imx28_write_fix:1; /* For Freescale i.MX28 */
 
        /* required for usb32 quirk */
        #define OHCI_CTRL_HCFS          (3 << 6)
@@ -675,6 +676,18 @@ static inline unsigned int ehci_readl(const struct ehci_hcd *ehci,
 #endif
 }
 
+#ifdef CONFIG_SOC_IMX28
+static inline void imx28_ehci_writel(const unsigned int val,
+               volatile __u32 __iomem *addr)
+{
+       __asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr));
+}
+#else
+static inline void imx28_ehci_writel(const unsigned int val,
+               volatile __u32 __iomem *addr)
+{
+}
+#endif
 static inline void ehci_writel(const struct ehci_hcd *ehci,
                const unsigned int val, __u32 __iomem *regs)
 {
@@ -683,7 +696,10 @@ static inline void ehci_writel(const struct ehci_hcd *ehci,
                writel_be(val, regs) :
                writel(val, regs);
 #else
-       writel(val, regs);
+       if (ehci->imx28_write_fix)
+               imx28_ehci_writel(val, regs);
+       else
+               writel(val, regs);
 #endif
 }