Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[pandora-kernel.git] / drivers / usb / host / ehci.h
index 2c68a04..90245fd 100644 (file)
@@ -71,16 +71,9 @@ struct ehci_hcd {                    /* one per controller */
        __u32                   hcs_params;     /* cached register copy */
        spinlock_t              lock;
 
-#ifdef CONFIG_CPU_FREQ
-       struct notifier_block   cpufreq_transition;
-       int                     cpufreq_changing;
-       struct list_head        split_intr_qhs;
-#endif
-
        /* async schedule support */
        struct ehci_qh          *async;
        struct ehci_qh          *reclaim;
-       unsigned                reclaim_ready : 1;
        unsigned                scanning : 1;
 
        /* periodic schedule support */
@@ -104,6 +97,8 @@ struct ehci_hcd {                    /* one per controller */
                        dedicated to the companion controller */
        unsigned long           owned_ports;            /* which ports are
                        owned by the companion during a bus suspend */
+       unsigned long           port_c_suspend;         /* which ports have
+                       the change-suspend feature turned on */
 
        /* per-HC memory pools (could be per-bus, but ...) */
        struct dma_pool         *qh_pool;       /* qh per active urb */
@@ -111,6 +106,7 @@ struct ehci_hcd {                   /* one per controller */
        struct dma_pool         *itd_pool;      /* itd per iso urb */
        struct dma_pool         *sitd_pool;     /* sitd per split iso urb */
 
+       struct timer_list       iaa_watchdog;
        struct timer_list       watchdog;
        unsigned long           actions;
        unsigned                stamp;
@@ -118,7 +114,6 @@ struct ehci_hcd {                   /* one per controller */
        u32                     command;
 
        /* SILICON QUIRKS */
-       unsigned                is_tdi_rh_tt:1; /* TDI roothub with TT */
        unsigned                no_selective_suspend:1;
        unsigned                has_fsl_port_bug:1; /* FreeScale */
        unsigned                big_endian_mmio:1;
@@ -132,6 +127,14 @@ struct ehci_hcd {                  /* one per controller */
 #      define COUNT(x) do { (x)++; } while (0)
 #else
 #      define COUNT(x) do {} while (0)
+#endif
+
+       /* debug files */
+#ifdef DEBUG
+       struct dentry           *debug_dir;
+       struct dentry           *debug_async;
+       struct dentry           *debug_periodic;
+       struct dentry           *debug_registers;
 #endif
 };
 
@@ -146,9 +149,21 @@ static inline struct usb_hcd *ehci_to_hcd (struct ehci_hcd *ehci)
 }
 
 
+static inline void
+iaa_watchdog_start(struct ehci_hcd *ehci)
+{
+       WARN_ON(timer_pending(&ehci->iaa_watchdog));
+       mod_timer(&ehci->iaa_watchdog,
+                       jiffies + msecs_to_jiffies(EHCI_IAA_MSECS));
+}
+
+static inline void iaa_watchdog_done(struct ehci_hcd *ehci)
+{
+       del_timer(&ehci->iaa_watchdog);
+}
+
 enum ehci_timer_action {
        TIMER_IO_WATCHDOG,
-       TIMER_IAA_WATCHDOG,
        TIMER_ASYNC_SHRINK,
        TIMER_ASYNC_OFF,
 };
@@ -162,13 +177,19 @@ timer_action_done (struct ehci_hcd *ehci, enum ehci_timer_action action)
 static inline void
 timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
 {
+       /* Don't override timeouts which shrink or (later) disable
+        * the async ring; just the I/O watchdog.  Note that if a
+        * SHRINK were pending, OFF would never be requested.
+        */
+       if (timer_pending(&ehci->watchdog)
+                       && ((BIT(TIMER_ASYNC_SHRINK) | BIT(TIMER_ASYNC_OFF))
+                               & ehci->actions))
+               return;
+
        if (!test_and_set_bit (action, &ehci->actions)) {
                unsigned long t;
 
                switch (action) {
-               case TIMER_IAA_WATCHDOG:
-                       t = EHCI_IAA_JIFFIES;
-                       break;
                case TIMER_IO_WATCHDOG:
                        t = EHCI_IO_JIFFIES;
                        break;
@@ -180,16 +201,7 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
                        t = EHCI_SHRINK_JIFFIES;
                        break;
                }
-               t += jiffies;
-               // all timings except IAA watchdog can be overridden.
-               // async queue SHRINK often precedes IAA.  while it's ready
-               // to go OFF neither can matter, and afterwards the IO
-               // watchdog stops unless there's still periodic traffic.
-               if (action != TIMER_IAA_WATCHDOG
-                               && t > ehci->watchdog.expires
-                               && timer_pending (&ehci->watchdog))
-                       return;
-               mod_timer (&ehci->watchdog, t);
+               mod_timer(&ehci->watchdog, t + jiffies);
        }
 }
 
@@ -439,10 +451,6 @@ struct ehci_qh {
        __hc32                  hw_next;        /* see EHCI 3.6.1 */
        __hc32                  hw_info1;       /* see EHCI 3.6.2 */
 #define        QH_HEAD         0x00008000
-#define        QH_INACTIVATE   0x00000080
-
-#define INACTIVATE_BIT(ehci)   cpu_to_hc32(ehci, QH_INACTIVATE)
-
        __hc32                  hw_info2;        /* see EHCI 3.6.2 */
 #define        QH_SMASK        0x000000ff
 #define        QH_CMASK        0x0000ff00
@@ -492,10 +500,6 @@ struct ehci_qh {
        unsigned short          start;          /* where polling starts */
 #define NO_FRAME ((unsigned short)~0)                  /* pick new start */
        struct usb_device       *dev;           /* access to TT */
-#ifdef CONFIG_CPU_FREQ
-       struct list_head        split_intr_qhs; /* list of split qhs */
-       __le32                  was_active;     /* active bit before "i" set */
-#endif
 } __attribute__ ((aligned (32)));
 
 /*-------------------------------------------------------------------------*/
@@ -548,8 +552,8 @@ struct ehci_iso_stream {
         * trusting urb->interval == f(epdesc->bInterval) and
         * including the extra info for hw_bufp[0..2]
         */
-       u8                      interval;
        u8                      usecs, c_usecs;
+       u16                     interval;
        u16                     tt_usecs;
        u16                     maxp;
        u16                     raw_mask;
@@ -600,7 +604,6 @@ struct ehci_itd {
        unsigned                frame;          /* where scheduled */
        unsigned                pg;
        unsigned                index[8];       /* in urb->iso_frame_desc */
-       u8                      usecs[8];
 } __attribute__ ((aligned (32)));
 
 /*-------------------------------------------------------------------------*/
@@ -677,7 +680,7 @@ struct ehci_fstn {
  * needed (mostly in root hub code).
  */
 
-#define        ehci_is_TDI(e)                  ((e)->is_tdi_rh_tt)
+#define        ehci_is_TDI(e)                  (ehci_to_hcd(e)->has_tt)
 
 /* Returns the speed of a device attached to a port on the root hub. */
 static inline unsigned int
@@ -739,11 +742,16 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
  * definition below can die once the 4xx support is
  * finally ported over.
  */
-#if defined(CONFIG_PPC)
+#if defined(CONFIG_PPC) && !defined(CONFIG_PPC_MERGE)
 #define readl_be(addr)         in_be32((__force unsigned *)addr)
 #define writel_be(val, addr)   out_be32((__force unsigned *)addr, val)
 #endif
 
+#if defined(CONFIG_ARM) && defined(CONFIG_ARCH_IXP4XX)
+#define readl_be(addr)         __raw_readl((__force unsigned *)addr)
+#define writel_be(val, addr)   __raw_writel(val, (__force unsigned *)addr)
+#endif
+
 static inline unsigned int ehci_readl(const struct ehci_hcd *ehci,
                __u32 __iomem * regs)
 {