xhci: Add infrastructure for host-specific LPM policies.
[firefly-linux-kernel-4.4.55.git] / drivers / usb / host / xhci.h
index 3d69c4b2b54277d57e6cb15cbf403127d70aeb1f..d55b3678c8b884a3b4e76f0b746a5c889cd6fa41 100644 (file)
@@ -362,8 +362,10 @@ struct xhci_op_regs {
  * Timeout can be up to 127us.  0xFF means an infinite timeout.
  */
 #define PORT_U1_TIMEOUT(p)     ((p) & 0xff)
+#define PORT_U1_TIMEOUT_MASK   0xff
 /* Inactivity timer value for transitions into U2 */
 #define PORT_U2_TIMEOUT(p)     (((p) & 0xff) << 8)
+#define PORT_U2_TIMEOUT_MASK   (0xff << 8)
 /* Bits 24:31 for port testing */
 
 /* USB2 Protocol PORTSPMSC */
@@ -914,6 +916,8 @@ struct xhci_virt_device {
        u8                              real_port;
        struct xhci_interval_bw_table   *bw_table;
        struct xhci_tt_bw_info          *tt_info;
+       /* The current max exit latency for the enabled USB3 link states. */
+       u16                             current_mel;
 };
 
 /*
@@ -1362,6 +1366,8 @@ struct xhci_bus_state {
        u32                     suspended_ports;
        u32                     port_remote_wakeup;
        unsigned long           resume_done[USB_MAXCHILDREN];
+       /* which ports have started to resume */
+       unsigned long           resuming_ports;
 };
 
 static inline unsigned int hcd_index(struct usb_hcd *hcd)
@@ -1422,6 +1428,8 @@ struct xhci_hcd {
        /* slot enabling and address device helpers */
        struct completion       addr_dev;
        int slot_id;
+       /* For USB 3.0 LPM enable/disable. */
+       struct xhci_command             *lpm_command;
        /* Internal mirror of the HW's dcbaa */
        struct xhci_virt_device *devs[MAX_HC_SLOTS];
        /* For keeping track of bandwidth domains per roothub. */
@@ -1479,6 +1487,8 @@ struct xhci_hcd {
 #define XHCI_RESET_ON_RESUME   (1 << 7)
 #define        XHCI_SW_BW_CHECKING     (1 << 8)
 #define XHCI_AMD_0x96_HOST     (1 << 9)
+#define XHCI_TRUST_TX_LENGTH   (1 << 10)
+#define XHCI_LPM_SUPPORT       (1 << 11)
        unsigned int            num_active_eps;
        unsigned int            limit_active_eps;
        /* There are two roothubs to keep track of bus suspend info for */
@@ -1752,7 +1762,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags,
 int xhci_queue_configure_endpoint(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr,
                u32 slot_id, bool command_must_succeed);
 int xhci_queue_evaluate_context(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr,
-               u32 slot_id);
+               u32 slot_id, bool command_must_succeed);
 int xhci_queue_reset_ep(struct xhci_hcd *xhci, int slot_id,
                unsigned int ep_index);
 int xhci_queue_reset_device(struct xhci_hcd *xhci, u32 slot_id);
@@ -1776,6 +1786,10 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id,
 /* xHCI roothub code */
 void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array,
                                int port_id, u32 link_state);
+int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd,
+                       struct usb_device *udev, enum usb3_link_state state);
+int xhci_disable_usb3_lpm_timeout(struct usb_hcd *hcd,
+                       struct usb_device *udev, enum usb3_link_state state);
 void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array,
                                int port_id, u32 port_bit);
 int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,