USB: serial: visor: fix crash on detecting device without write_urbs
[pandora-kernel.git] / drivers / usb / host / ehci.h
index cc7d337..bd8adbb 100644 (file)
@@ -62,6 +62,12 @@ struct ehci_stats {
 
 #define        EHCI_MAX_ROOT_PORTS     15              /* see HCS_N_PORTS */
 
+enum ehci_rh_state {
+       EHCI_RH_HALTED,
+       EHCI_RH_SUSPENDED,
+       EHCI_RH_RUNNING
+};
+
 struct ehci_hcd {                      /* one per controller */
        /* glue to PCI and HCD framework */
        struct ehci_caps __iomem *caps;
@@ -70,6 +76,7 @@ struct ehci_hcd {                     /* one per controller */
 
        __u32                   hcs_params;     /* cached register copy */
        spinlock_t              lock;
+       enum ehci_rh_state      rh_state;
 
        /* async schedule support */
        struct ehci_qh          *async;
@@ -129,6 +136,7 @@ struct ehci_hcd {                   /* one per controller */
        /* SILICON QUIRKS */
        unsigned                no_selective_suspend:1;
        unsigned                has_fsl_port_bug:1; /* FreeScale */
+       unsigned                has_fsl_hs_errata:1;    /* Freescale HS quirk */
        unsigned                big_endian_mmio:1;
        unsigned                big_endian_desc:1;
        unsigned                big_endian_capbase:1;
@@ -139,6 +147,8 @@ struct ehci_hcd {                   /* one per controller */
        unsigned                fs_i_thresh:1;  /* Intel iso scheduling */
        unsigned                use_dummy_qh:1; /* AMD Frame List table quirk*/
        unsigned                has_synopsys_hc_bug:1; /* Synopsys HC */
+       unsigned                frame_index_bug:1; /* MosChip (AKA NetMos) */
+       unsigned                imx28_write_fix:1; /* For Freescale i.MX28 */
 
        /* required for usb32 quirk */
        #define OHCI_CTRL_HCFS          (3 << 6)
@@ -603,6 +613,17 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
 #define        ehci_has_fsl_portno_bug(e)              (0)
 #endif
 
+#define PORTSC_FSL_PFSC        24      /* Port Force Full-Speed Connect */
+
+#if defined(CONFIG_PPC_85xx)
+/* Some Freescale processors have an erratum (USB A-005275) in which
+ * incoming packets get corrupted in HS mode
+ */
+#define ehci_has_fsl_hs_errata(e)      ((e)->has_fsl_hs_errata)
+#else
+#define ehci_has_fsl_hs_errata(e)      (0)
+#endif
+
 /*
  * While most USB host controllers implement their registers in
  * little-endian format, a minority (celleb companion chip) implement
@@ -646,6 +667,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)
 {
@@ -654,7 +687,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
 }
 
@@ -740,6 +776,22 @@ static inline u32 hc32_to_cpup (const struct ehci_hcd *ehci, const __hc32 *x)
 
 /*-------------------------------------------------------------------------*/
 
+#ifdef CONFIG_PCI
+
+/* For working around the MosChip frame-index-register bug */
+static unsigned ehci_read_frame_index(struct ehci_hcd *ehci);
+
+#else
+
+static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci)
+{
+       return ehci_readl(ehci, &ehci->regs->frame_index);
+}
+
+#endif
+
+/*-------------------------------------------------------------------------*/
+
 #ifndef DEBUG
 #define STUB_DEBUG_FILES
 #endif /* DEBUG */