Merge branch 'sh-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / drivers / usb / host / xhci.h
index 7f236fd..07e2630 100644 (file)
@@ -644,6 +644,9 @@ struct xhci_ep_ctx {
 #define AVG_TRB_LENGTH_FOR_EP(p)       ((p) & 0xffff)
 #define MAX_ESIT_PAYLOAD_FOR_EP(p)     (((p) & 0xffff) << 16)
 
+/* deq bitmasks */
+#define EP_CTX_CYCLE_MASK              (1 << 0)
+
 
 /**
  * struct xhci_input_control_context
@@ -746,6 +749,12 @@ struct xhci_virt_ep {
        struct timer_list       stop_cmd_timer;
        int                     stop_cmds_pending;
        struct xhci_hcd         *xhci;
+       /* Dequeue pointer and dequeue segment for a submitted Set TR Dequeue
+        * command.  We'll need to update the ring's dequeue segment and dequeue
+        * pointer after the command completes.
+        */
+       struct xhci_segment     *queued_deq_seg;
+       union xhci_trb          *queued_deq_ptr;
        /*
         * Sometimes the xHC can not process isochronous endpoint ring quickly
         * enough, and it will miss some isoc tds on the ring and generate
@@ -864,7 +873,7 @@ struct xhci_transfer_event {
 #define COMP_CMD_ABORT 25
 /* Stopped - transfer was terminated by a stop endpoint command */
 #define COMP_STOP      26
-/* Same as COMP_EP_STOPPED, but the transfered length in the event is invalid */
+/* Same as COMP_EP_STOPPED, but the transferred length in the event is invalid */
 #define COMP_STOP_INVAL        27
 /* Control Abort Error - Debug Capability - control pipe aborted */
 #define COMP_DBG_ABORT 28
@@ -1161,8 +1170,29 @@ struct s3_save {
        u64     erst_dequeue;
 };
 
+struct xhci_bus_state {
+       unsigned long           bus_suspended;
+       unsigned long           next_statechange;
+
+       /* Port suspend arrays are indexed by the portnum of the fake roothub */
+       /* ports suspend status arrays - max 31 ports for USB2, 15 for USB3 */
+       u32                     port_c_suspend;
+       u32                     suspended_ports;
+       unsigned long           resume_done[USB_MAXCHILDREN];
+};
+
+static inline unsigned int hcd_index(struct usb_hcd *hcd)
+{
+       if (hcd->speed == HCD_USB3)
+               return 0;
+       else
+               return 1;
+}
+
 /* There is one ehci_hci structure per controller */
 struct xhci_hcd {
+       struct usb_hcd *main_hcd;
+       struct usb_hcd *shared_hcd;
        /* glue to PCI and HCD framework */
        struct xhci_cap_regs __iomem *cap_regs;
        struct xhci_op_regs __iomem *op_regs;
@@ -1224,9 +1254,6 @@ struct xhci_hcd {
        /* Host controller watchdog timer structures */
        unsigned int            xhc_state;
 
-       unsigned long           bus_suspended;
-       unsigned long           next_statechange;
-
        u32                     command;
        struct s3_save          s3;
 /* Host controller is dying - not responding to commands. "I'm not dead yet!"
@@ -1242,18 +1269,15 @@ struct xhci_hcd {
  * There are no reports of xHCI host controllers that display this issue.
  */
 #define XHCI_STATE_DYING       (1 << 0)
+#define XHCI_STATE_HALTED      (1 << 1)
        /* Statistics */
-       int                     noops_submitted;
-       int                     noops_handled;
        int                     error_bitmask;
        unsigned int            quirks;
 #define        XHCI_LINK_TRB_QUIRK     (1 << 0)
 #define XHCI_RESET_EP_QUIRK    (1 << 1)
 #define XHCI_NEC_HOST          (1 << 2)
-       u32                     port_c_suspend[8];      /* port suspend change*/
-       u32                     suspended_ports[8];     /* which ports are
-                                                          suspended */
-       unsigned long           resume_done[MAX_HC_PORTS];
+       /* There are two roothubs to keep track of bus suspend info for */
+       struct xhci_bus_state   bus_state[2];
        /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */
        u8                      *port_array;
        /* Array of pointers to USB 3.0 PORTSC registers */
@@ -1264,18 +1288,15 @@ struct xhci_hcd {
        unsigned int            num_usb2_ports;
 };
 
-/* For testing purposes */
-#define NUM_TEST_NOOPS 0
-
 /* convert between an HCD pointer and the corresponding EHCI_HCD */
 static inline struct xhci_hcd *hcd_to_xhci(struct usb_hcd *hcd)
 {
-       return (struct xhci_hcd *) (hcd->hcd_priv);
+       return *((struct xhci_hcd **) (hcd->hcd_priv));
 }
 
 static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci)
 {
-       return container_of((void *) xhci, struct usb_hcd, hcd_priv);
+       return xhci->main_hcd;
 }
 
 #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING
@@ -1348,7 +1369,7 @@ static inline int xhci_link_trb_quirk(struct xhci_hcd *xhci)
 }
 
 /* xHCI debugging */
-void xhci_print_ir_set(struct xhci_hcd *xhci, struct xhci_intr_reg *ir_set, int set_num);
+void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num);
 void xhci_print_registers(struct xhci_hcd *xhci);
 void xhci_dbg_regs(struct xhci_hcd *xhci);
 void xhci_print_run_regs(struct xhci_hcd *xhci);
@@ -1471,7 +1492,6 @@ struct xhci_segment *trb_in_td(struct xhci_segment *start_seg,
                dma_addr_t suspect_dma);
 int xhci_is_vendor_info_code(struct xhci_hcd *xhci, unsigned int trb_comp_code);
 void xhci_ring_cmd_db(struct xhci_hcd *xhci);
-void *xhci_setup_one_noop(struct xhci_hcd *xhci);
 int xhci_queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id);
 int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr,
                u32 slot_id);
@@ -1525,7 +1545,8 @@ int xhci_bus_resume(struct usb_hcd *hcd);
 #endif /* CONFIG_PM */
 
 u32 xhci_port_state_to_neutral(u32 state);
-int xhci_find_slot_id_by_port(struct xhci_hcd *xhci, u16 port);
+int xhci_find_slot_id_by_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
+               u16 port);
 void xhci_ring_device(struct xhci_hcd *xhci, int slot_id);
 
 /* xHCI contexts */