aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/xhci.h')
-rw-r--r--drivers/usb/host/xhci.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 4ef6b9e88504..fc8dcd2aa770 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -448,6 +448,9 @@ struct xhci_doorbell_array {
448#define DB_STREAM_ID_HOST 0x0 448#define DB_STREAM_ID_HOST 0x0
449#define DB_MASK (0xff << 8) 449#define DB_MASK (0xff << 8)
450 450
451/* Endpoint Target - bits 0:7 */
452#define EPI_TO_DB(p) (((p) + 1) & 0xff)
453
451 454
452/** 455/**
453 * struct xhci_slot_ctx 456 * struct xhci_slot_ctx
@@ -552,13 +555,18 @@ struct xhci_ep_ctx {
552 * 4 - TRB error 555 * 4 - TRB error
553 * 5-7 - reserved 556 * 5-7 - reserved
554 */ 557 */
555#define EP_STATE (0xf) 558#define EP_STATE_MASK (0xf)
559#define EP_STATE_DISABLED 0
560#define EP_STATE_RUNNING 1
561#define EP_STATE_HALTED 2
562#define EP_STATE_STOPPED 3
563#define EP_STATE_ERROR 4
556/* Mult - Max number of burtst within an interval, in EP companion desc. */ 564/* Mult - Max number of burtst within an interval, in EP companion desc. */
557#define EP_MULT(p) ((p & 0x3) << 8) 565#define EP_MULT(p) ((p & 0x3) << 8)
558/* bits 10:14 are Max Primary Streams */ 566/* bits 10:14 are Max Primary Streams */
559/* bit 15 is Linear Stream Array */ 567/* bit 15 is Linear Stream Array */
560/* Interval - period between requests to an endpoint - 125u increments. */ 568/* Interval - period between requests to an endpoint - 125u increments. */
561#define EP_INTERVAL (0xff << 16) 569#define EP_INTERVAL (0xff << 16)
562 570
563/* ep_info2 bitmasks */ 571/* ep_info2 bitmasks */
564/* 572/*
@@ -618,7 +626,6 @@ struct xhci_virt_device {
618 dma_addr_t in_ctx_dma; 626 dma_addr_t in_ctx_dma;
619 /* FIXME when stream support is added */ 627 /* FIXME when stream support is added */
620 struct xhci_ring *ep_rings[31]; 628 struct xhci_ring *ep_rings[31];
621 dma_addr_t ep_dma[31];
622 /* Status of the last command issued for this device */ 629 /* Status of the last command issued for this device */
623 u32 cmd_status; 630 u32 cmd_status;
624}; 631};
@@ -657,6 +664,9 @@ struct xhci_transfer_event {
657 u32 flags; 664 u32 flags;
658} __attribute__ ((packed)); 665} __attribute__ ((packed));
659 666
667/** Transfer Event bit fields **/
668#define TRB_TO_EP_ID(p) (((p) >> 16) & 0x1f)
669
660/* Completion Code - only applicable for some types of TRBs */ 670/* Completion Code - only applicable for some types of TRBs */
661#define COMP_CODE_MASK (0xff << 24) 671#define COMP_CODE_MASK (0xff << 24)
662#define GET_COMP_CODE(p) (((p) & COMP_CODE_MASK) >> 24) 672#define GET_COMP_CODE(p) (((p) & COMP_CODE_MASK) >> 24)
@@ -877,6 +887,12 @@ union xhci_trb {
877#define TRBS_PER_SEGMENT 64 887#define TRBS_PER_SEGMENT 64
878#define SEGMENT_SIZE (TRBS_PER_SEGMENT*16) 888#define SEGMENT_SIZE (TRBS_PER_SEGMENT*16)
879 889
890struct xhci_td {
891 struct list_head td_list;
892 struct urb *urb;
893 union xhci_trb *last_trb;
894};
895
880struct xhci_segment { 896struct xhci_segment {
881 union xhci_trb *trbs; 897 union xhci_trb *trbs;
882 /* private to HCD */ 898 /* private to HCD */
@@ -892,6 +908,7 @@ struct xhci_ring {
892 union xhci_trb *dequeue; 908 union xhci_trb *dequeue;
893 struct xhci_segment *deq_seg; 909 struct xhci_segment *deq_seg;
894 unsigned int deq_updates; 910 unsigned int deq_updates;
911 struct list_head td_list;
895 /* 912 /*
896 * Write the cycle state into the TRB cycle field to give ownership of 913 * Write the cycle state into the TRB cycle field to give ownership of
897 * the TRB to the host controller (if we are the producer), or to check 914 * the TRB to the host controller (if we are the producer), or to check
@@ -1042,6 +1059,8 @@ void xhci_print_ir_set(struct xhci_hcd *xhci, struct intr_reg *ir_set, int set_n
1042void xhci_print_registers(struct xhci_hcd *xhci); 1059void xhci_print_registers(struct xhci_hcd *xhci);
1043void xhci_dbg_regs(struct xhci_hcd *xhci); 1060void xhci_dbg_regs(struct xhci_hcd *xhci);
1044void xhci_print_run_regs(struct xhci_hcd *xhci); 1061void xhci_print_run_regs(struct xhci_hcd *xhci);
1062void xhci_print_trb_offsets(struct xhci_hcd *xhci, union xhci_trb *trb);
1063void xhci_debug_trb(struct xhci_hcd *xhci, union xhci_trb *trb);
1045void xhci_debug_segment(struct xhci_hcd *xhci, struct xhci_segment *seg); 1064void xhci_debug_segment(struct xhci_hcd *xhci, struct xhci_segment *seg);
1046void xhci_debug_ring(struct xhci_hcd *xhci, struct xhci_ring *ring); 1065void xhci_debug_ring(struct xhci_hcd *xhci, struct xhci_ring *ring);
1047void xhci_dbg_erst(struct xhci_hcd *xhci, struct xhci_erst *erst); 1066void xhci_dbg_erst(struct xhci_hcd *xhci, struct xhci_erst *erst);
@@ -1055,6 +1074,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags);
1055void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id); 1074void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id);
1056int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags); 1075int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags);
1057int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev); 1076int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev);
1077unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc);
1058 1078
1059#ifdef CONFIG_PCI 1079#ifdef CONFIG_PCI
1060/* xHCI PCI glue */ 1080/* xHCI PCI glue */
@@ -1074,6 +1094,8 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd);
1074int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev); 1094int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev);
1075void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev); 1095void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev);
1076int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev); 1096int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev);
1097int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags);
1098int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status);
1077 1099
1078/* xHCI ring, segment, TRB, and TD functions */ 1100/* xHCI ring, segment, TRB, and TD functions */
1079dma_addr_t trb_virt_to_dma(struct xhci_segment *seg, union xhci_trb *trb); 1101dma_addr_t trb_virt_to_dma(struct xhci_segment *seg, union xhci_trb *trb);
@@ -1083,6 +1105,7 @@ void handle_event(struct xhci_hcd *xhci);
1083void set_hc_event_deq(struct xhci_hcd *xhci); 1105void set_hc_event_deq(struct xhci_hcd *xhci);
1084int queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id); 1106int queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id);
1085int queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, u32 slot_id); 1107int queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, u32 slot_id);
1108int queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index);
1086 1109
1087/* xHCI roothub code */ 1110/* xHCI roothub code */
1088int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, 1111int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,