diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/usb/host/xhci.h | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/usb/host/xhci.h')
-rw-r--r-- | drivers/usb/host/xhci.h | 332 |
1 files changed, 236 insertions, 96 deletions
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 34a60d9f056a..d8bbf5ccb10d 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | /* Code sharing between pci-quirks and xhci hcd */ | 31 | /* Code sharing between pci-quirks and xhci hcd */ |
32 | #include "xhci-ext-caps.h" | 32 | #include "xhci-ext-caps.h" |
33 | #include "pci-quirks.h" | ||
33 | 34 | ||
34 | /* xHCI PCI Configuration Registers */ | 35 | /* xHCI PCI Configuration Registers */ |
35 | #define XHCI_SBRN_OFFSET (0x60) | 36 | #define XHCI_SBRN_OFFSET (0x60) |
@@ -56,13 +57,13 @@ | |||
56 | * @run_regs_off: RTSOFF - Runtime register space offset | 57 | * @run_regs_off: RTSOFF - Runtime register space offset |
57 | */ | 58 | */ |
58 | struct xhci_cap_regs { | 59 | struct xhci_cap_regs { |
59 | u32 hc_capbase; | 60 | __le32 hc_capbase; |
60 | u32 hcs_params1; | 61 | __le32 hcs_params1; |
61 | u32 hcs_params2; | 62 | __le32 hcs_params2; |
62 | u32 hcs_params3; | 63 | __le32 hcs_params3; |
63 | u32 hcc_params; | 64 | __le32 hcc_params; |
64 | u32 db_off; | 65 | __le32 db_off; |
65 | u32 run_regs_off; | 66 | __le32 run_regs_off; |
66 | /* Reserved up to (CAPLENGTH - 0x1C) */ | 67 | /* Reserved up to (CAPLENGTH - 0x1C) */ |
67 | }; | 68 | }; |
68 | 69 | ||
@@ -154,26 +155,26 @@ struct xhci_cap_regs { | |||
154 | * devices. | 155 | * devices. |
155 | */ | 156 | */ |
156 | struct xhci_op_regs { | 157 | struct xhci_op_regs { |
157 | u32 command; | 158 | __le32 command; |
158 | u32 status; | 159 | __le32 status; |
159 | u32 page_size; | 160 | __le32 page_size; |
160 | u32 reserved1; | 161 | __le32 reserved1; |
161 | u32 reserved2; | 162 | __le32 reserved2; |
162 | u32 dev_notification; | 163 | __le32 dev_notification; |
163 | u64 cmd_ring; | 164 | __le64 cmd_ring; |
164 | /* rsvd: offset 0x20-2F */ | 165 | /* rsvd: offset 0x20-2F */ |
165 | u32 reserved3[4]; | 166 | __le32 reserved3[4]; |
166 | u64 dcbaa_ptr; | 167 | __le64 dcbaa_ptr; |
167 | u32 config_reg; | 168 | __le32 config_reg; |
168 | /* rsvd: offset 0x3C-3FF */ | 169 | /* rsvd: offset 0x3C-3FF */ |
169 | u32 reserved4[241]; | 170 | __le32 reserved4[241]; |
170 | /* port 1 registers, which serve as a base address for other ports */ | 171 | /* port 1 registers, which serve as a base address for other ports */ |
171 | u32 port_status_base; | 172 | __le32 port_status_base; |
172 | u32 port_power_base; | 173 | __le32 port_power_base; |
173 | u32 port_link_base; | 174 | __le32 port_link_base; |
174 | u32 reserved5; | 175 | __le32 reserved5; |
175 | /* registers for ports 2-255 */ | 176 | /* registers for ports 2-255 */ |
176 | u32 reserved6[NUM_PORT_REGS*254]; | 177 | __le32 reserved6[NUM_PORT_REGS*254]; |
177 | }; | 178 | }; |
178 | 179 | ||
179 | /* USBCMD - USB command - command bitmasks */ | 180 | /* USBCMD - USB command - command bitmasks */ |
@@ -191,7 +192,7 @@ struct xhci_op_regs { | |||
191 | /* bits 4:6 are reserved (and should be preserved on writes). */ | 192 | /* bits 4:6 are reserved (and should be preserved on writes). */ |
192 | /* light reset (port status stays unchanged) - reset completed when this is 0 */ | 193 | /* light reset (port status stays unchanged) - reset completed when this is 0 */ |
193 | #define CMD_LRESET (1 << 7) | 194 | #define CMD_LRESET (1 << 7) |
194 | /* FIXME: ignoring host controller save/restore state for now. */ | 195 | /* host controller save/restore state. */ |
195 | #define CMD_CSS (1 << 8) | 196 | #define CMD_CSS (1 << 8) |
196 | #define CMD_CRS (1 << 9) | 197 | #define CMD_CRS (1 << 9) |
197 | /* Enable Wrap Event - '1' means xHC generates an event when MFINDEX wraps. */ | 198 | /* Enable Wrap Event - '1' means xHC generates an event when MFINDEX wraps. */ |
@@ -232,7 +233,7 @@ struct xhci_op_regs { | |||
232 | * notification type that matches a bit set in this bit field. | 233 | * notification type that matches a bit set in this bit field. |
233 | */ | 234 | */ |
234 | #define DEV_NOTE_MASK (0xffff) | 235 | #define DEV_NOTE_MASK (0xffff) |
235 | #define ENABLE_DEV_NOTE(x) (1 << x) | 236 | #define ENABLE_DEV_NOTE(x) (1 << (x)) |
236 | /* Most of the device notification types should only be used for debug. | 237 | /* Most of the device notification types should only be used for debug. |
237 | * SW does need to pay attention to function wake notifications. | 238 | * SW does need to pay attention to function wake notifications. |
238 | */ | 239 | */ |
@@ -269,6 +270,10 @@ struct xhci_op_regs { | |||
269 | * A read gives the current link PM state of the port, | 270 | * A read gives the current link PM state of the port, |
270 | * a write with Link State Write Strobe set sets the link state. | 271 | * a write with Link State Write Strobe set sets the link state. |
271 | */ | 272 | */ |
273 | #define PORT_PLS_MASK (0xf << 5) | ||
274 | #define XDEV_U0 (0x0 << 5) | ||
275 | #define XDEV_U3 (0x3 << 5) | ||
276 | #define XDEV_RESUME (0xf << 5) | ||
272 | /* true: port has power (see HCC_PPC) */ | 277 | /* true: port has power (see HCC_PPC) */ |
273 | #define PORT_POWER (1 << 9) | 278 | #define PORT_POWER (1 << 9) |
274 | /* bits 10:13 indicate device speed: | 279 | /* bits 10:13 indicate device speed: |
@@ -344,6 +349,9 @@ struct xhci_op_regs { | |||
344 | /* Initiate a warm port reset - complete when PORT_WRC is '1' */ | 349 | /* Initiate a warm port reset - complete when PORT_WRC is '1' */ |
345 | #define PORT_WR (1 << 31) | 350 | #define PORT_WR (1 << 31) |
346 | 351 | ||
352 | /* We mark duplicate entries with -1 */ | ||
353 | #define DUPLICATE_ENTRY ((u8)(-1)) | ||
354 | |||
347 | /* Port Power Management Status and Control - port_power_base bitmasks */ | 355 | /* Port Power Management Status and Control - port_power_base bitmasks */ |
348 | /* Inactivity timer value for transitions into U1, in microseconds. | 356 | /* Inactivity timer value for transitions into U1, in microseconds. |
349 | * Timeout can be up to 127us. 0xFF means an infinite timeout. | 357 | * Timeout can be up to 127us. 0xFF means an infinite timeout. |
@@ -353,6 +361,8 @@ struct xhci_op_regs { | |||
353 | #define PORT_U2_TIMEOUT(p) (((p) & 0xff) << 8) | 361 | #define PORT_U2_TIMEOUT(p) (((p) & 0xff) << 8) |
354 | /* Bits 24:31 for port testing */ | 362 | /* Bits 24:31 for port testing */ |
355 | 363 | ||
364 | /* USB2 Protocol PORTSPMSC */ | ||
365 | #define PORT_RWE (1 << 0x3) | ||
356 | 366 | ||
357 | /** | 367 | /** |
358 | * struct xhci_intr_reg - Interrupt Register Set | 368 | * struct xhci_intr_reg - Interrupt Register Set |
@@ -372,12 +382,12 @@ struct xhci_op_regs { | |||
372 | * updates the dequeue pointer. | 382 | * updates the dequeue pointer. |
373 | */ | 383 | */ |
374 | struct xhci_intr_reg { | 384 | struct xhci_intr_reg { |
375 | u32 irq_pending; | 385 | __le32 irq_pending; |
376 | u32 irq_control; | 386 | __le32 irq_control; |
377 | u32 erst_size; | 387 | __le32 erst_size; |
378 | u32 rsvd; | 388 | __le32 rsvd; |
379 | u64 erst_base; | 389 | __le64 erst_base; |
380 | u64 erst_dequeue; | 390 | __le64 erst_dequeue; |
381 | }; | 391 | }; |
382 | 392 | ||
383 | /* irq_pending bitmasks */ | 393 | /* irq_pending bitmasks */ |
@@ -422,30 +432,44 @@ struct xhci_intr_reg { | |||
422 | * or larger accesses" | 432 | * or larger accesses" |
423 | */ | 433 | */ |
424 | struct xhci_run_regs { | 434 | struct xhci_run_regs { |
425 | u32 microframe_index; | 435 | __le32 microframe_index; |
426 | u32 rsvd[7]; | 436 | __le32 rsvd[7]; |
427 | struct xhci_intr_reg ir_set[128]; | 437 | struct xhci_intr_reg ir_set[128]; |
428 | }; | 438 | }; |
429 | 439 | ||
430 | /** | 440 | /** |
431 | * struct doorbell_array | 441 | * struct doorbell_array |
432 | * | 442 | * |
443 | * Bits 0 - 7: Endpoint target | ||
444 | * Bits 8 - 15: RsvdZ | ||
445 | * Bits 16 - 31: Stream ID | ||
446 | * | ||
433 | * Section 5.6 | 447 | * Section 5.6 |
434 | */ | 448 | */ |
435 | struct xhci_doorbell_array { | 449 | struct xhci_doorbell_array { |
436 | u32 doorbell[256]; | 450 | __le32 doorbell[256]; |
437 | }; | 451 | }; |
438 | 452 | ||
439 | #define DB_TARGET_MASK 0xFFFFFF00 | 453 | #define DB_VALUE(ep, stream) ((((ep) + 1) & 0xff) | ((stream) << 16)) |
440 | #define DB_STREAM_ID_MASK 0x0000FFFF | 454 | #define DB_VALUE_HOST 0x00000000 |
441 | #define DB_TARGET_HOST 0x0 | ||
442 | #define DB_STREAM_ID_HOST 0x0 | ||
443 | #define DB_MASK (0xff << 8) | ||
444 | 455 | ||
445 | /* Endpoint Target - bits 0:7 */ | 456 | /** |
446 | #define EPI_TO_DB(p) (((p) + 1) & 0xff) | 457 | * struct xhci_protocol_caps |
447 | #define STREAM_ID_TO_DB(p) (((p) & 0xffff) << 16) | 458 | * @revision: major revision, minor revision, capability ID, |
459 | * and next capability pointer. | ||
460 | * @name_string: Four ASCII characters to say which spec this xHC | ||
461 | * follows, typically "USB ". | ||
462 | * @port_info: Port offset, count, and protocol-defined information. | ||
463 | */ | ||
464 | struct xhci_protocol_caps { | ||
465 | u32 revision; | ||
466 | u32 name_string; | ||
467 | u32 port_info; | ||
468 | }; | ||
448 | 469 | ||
470 | #define XHCI_EXT_PORT_MAJOR(x) (((x) >> 24) & 0xff) | ||
471 | #define XHCI_EXT_PORT_OFF(x) ((x) & 0xff) | ||
472 | #define XHCI_EXT_PORT_COUNT(x) (((x) >> 8) & 0xff) | ||
449 | 473 | ||
450 | /** | 474 | /** |
451 | * struct xhci_container_ctx | 475 | * struct xhci_container_ctx |
@@ -480,12 +504,12 @@ struct xhci_container_ctx { | |||
480 | * reserved at the end of the slot context for HC internal use. | 504 | * reserved at the end of the slot context for HC internal use. |
481 | */ | 505 | */ |
482 | struct xhci_slot_ctx { | 506 | struct xhci_slot_ctx { |
483 | u32 dev_info; | 507 | __le32 dev_info; |
484 | u32 dev_info2; | 508 | __le32 dev_info2; |
485 | u32 tt_info; | 509 | __le32 tt_info; |
486 | u32 dev_state; | 510 | __le32 dev_state; |
487 | /* offset 0x10 to 0x1f reserved for HC internal use */ | 511 | /* offset 0x10 to 0x1f reserved for HC internal use */ |
488 | u32 reserved[4]; | 512 | __le32 reserved[4]; |
489 | }; | 513 | }; |
490 | 514 | ||
491 | /* dev_info bitmasks */ | 515 | /* dev_info bitmasks */ |
@@ -510,6 +534,7 @@ struct xhci_slot_ctx { | |||
510 | #define MAX_EXIT (0xffff) | 534 | #define MAX_EXIT (0xffff) |
511 | /* Root hub port number that is needed to access the USB device */ | 535 | /* Root hub port number that is needed to access the USB device */ |
512 | #define ROOT_HUB_PORT(p) (((p) & 0xff) << 16) | 536 | #define ROOT_HUB_PORT(p) (((p) & 0xff) << 16) |
537 | #define DEVINFO_TO_ROOT_HUB_PORT(p) (((p) >> 16) & 0xff) | ||
513 | /* Maximum number of ports under a hub device */ | 538 | /* Maximum number of ports under a hub device */ |
514 | #define XHCI_MAX_PORTS(p) (((p) & 0xff) << 24) | 539 | #define XHCI_MAX_PORTS(p) (((p) & 0xff) << 24) |
515 | 540 | ||
@@ -535,6 +560,11 @@ struct xhci_slot_ctx { | |||
535 | #define SLOT_STATE (0x1f << 27) | 560 | #define SLOT_STATE (0x1f << 27) |
536 | #define GET_SLOT_STATE(p) (((p) & (0x1f << 27)) >> 27) | 561 | #define GET_SLOT_STATE(p) (((p) & (0x1f << 27)) >> 27) |
537 | 562 | ||
563 | #define SLOT_STATE_DISABLED 0 | ||
564 | #define SLOT_STATE_ENABLED SLOT_STATE_DISABLED | ||
565 | #define SLOT_STATE_DEFAULT 1 | ||
566 | #define SLOT_STATE_ADDRESSED 2 | ||
567 | #define SLOT_STATE_CONFIGURED 3 | ||
538 | 568 | ||
539 | /** | 569 | /** |
540 | * struct xhci_ep_ctx | 570 | * struct xhci_ep_ctx |
@@ -555,12 +585,12 @@ struct xhci_slot_ctx { | |||
555 | * reserved at the end of the endpoint context for HC internal use. | 585 | * reserved at the end of the endpoint context for HC internal use. |
556 | */ | 586 | */ |
557 | struct xhci_ep_ctx { | 587 | struct xhci_ep_ctx { |
558 | u32 ep_info; | 588 | __le32 ep_info; |
559 | u32 ep_info2; | 589 | __le32 ep_info2; |
560 | u64 deq; | 590 | __le64 deq; |
561 | u32 tx_info; | 591 | __le32 tx_info; |
562 | /* offset 0x14 - 0x1f reserved for HC internal use */ | 592 | /* offset 0x14 - 0x1f reserved for HC internal use */ |
563 | u32 reserved[3]; | 593 | __le32 reserved[3]; |
564 | }; | 594 | }; |
565 | 595 | ||
566 | /* ep_info bitmasks */ | 596 | /* ep_info bitmasks */ |
@@ -580,11 +610,11 @@ struct xhci_ep_ctx { | |||
580 | #define EP_STATE_STOPPED 3 | 610 | #define EP_STATE_STOPPED 3 |
581 | #define EP_STATE_ERROR 4 | 611 | #define EP_STATE_ERROR 4 |
582 | /* Mult - Max number of burtst within an interval, in EP companion desc. */ | 612 | /* Mult - Max number of burtst within an interval, in EP companion desc. */ |
583 | #define EP_MULT(p) ((p & 0x3) << 8) | 613 | #define EP_MULT(p) (((p) & 0x3) << 8) |
584 | /* bits 10:14 are Max Primary Streams */ | 614 | /* bits 10:14 are Max Primary Streams */ |
585 | /* bit 15 is Linear Stream Array */ | 615 | /* bit 15 is Linear Stream Array */ |
586 | /* Interval - period between requests to an endpoint - 125u increments. */ | 616 | /* Interval - period between requests to an endpoint - 125u increments. */ |
587 | #define EP_INTERVAL(p) ((p & 0xff) << 16) | 617 | #define EP_INTERVAL(p) (((p) & 0xff) << 16) |
588 | #define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff)) | 618 | #define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff)) |
589 | #define EP_MAXPSTREAMS_MASK (0x1f << 10) | 619 | #define EP_MAXPSTREAMS_MASK (0x1f << 10) |
590 | #define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK) | 620 | #define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK) |
@@ -614,10 +644,18 @@ struct xhci_ep_ctx { | |||
614 | #define MAX_PACKET_MASK (0xffff << 16) | 644 | #define MAX_PACKET_MASK (0xffff << 16) |
615 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) | 645 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) |
616 | 646 | ||
647 | /* Get max packet size from ep desc. Bit 10..0 specify the max packet size. | ||
648 | * USB2.0 spec 9.6.6. | ||
649 | */ | ||
650 | #define GET_MAX_PACKET(p) ((p) & 0x7ff) | ||
651 | |||
617 | /* tx_info bitmasks */ | 652 | /* tx_info bitmasks */ |
618 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) | 653 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) |
619 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) | 654 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) |
620 | 655 | ||
656 | /* deq bitmasks */ | ||
657 | #define EP_CTX_CYCLE_MASK (1 << 0) | ||
658 | |||
621 | 659 | ||
622 | /** | 660 | /** |
623 | * struct xhci_input_control_context | 661 | * struct xhci_input_control_context |
@@ -627,9 +665,9 @@ struct xhci_ep_ctx { | |||
627 | * @add_context: set the bit of the endpoint context you want to enable | 665 | * @add_context: set the bit of the endpoint context you want to enable |
628 | */ | 666 | */ |
629 | struct xhci_input_control_ctx { | 667 | struct xhci_input_control_ctx { |
630 | u32 drop_flags; | 668 | __le32 drop_flags; |
631 | u32 add_flags; | 669 | __le32 add_flags; |
632 | u32 rsvd2[6]; | 670 | __le32 rsvd2[6]; |
633 | }; | 671 | }; |
634 | 672 | ||
635 | /* Represents everything that is needed to issue a command on the command ring. | 673 | /* Represents everything that is needed to issue a command on the command ring. |
@@ -655,9 +693,9 @@ struct xhci_command { | |||
655 | 693 | ||
656 | struct xhci_stream_ctx { | 694 | struct xhci_stream_ctx { |
657 | /* 64-bit stream ring address, cycle state, and stream type */ | 695 | /* 64-bit stream ring address, cycle state, and stream type */ |
658 | u64 stream_ring; | 696 | __le64 stream_ring; |
659 | /* offset 0x14 - 0x1f reserved for HC internal use */ | 697 | /* offset 0x14 - 0x1f reserved for HC internal use */ |
660 | u32 reserved[2]; | 698 | __le32 reserved[2]; |
661 | }; | 699 | }; |
662 | 700 | ||
663 | /* Stream Context Types (section 6.4.1) - bits 3:1 of stream ctx deq ptr */ | 701 | /* Stream Context Types (section 6.4.1) - bits 3:1 of stream ctx deq ptr */ |
@@ -720,6 +758,12 @@ struct xhci_virt_ep { | |||
720 | struct timer_list stop_cmd_timer; | 758 | struct timer_list stop_cmd_timer; |
721 | int stop_cmds_pending; | 759 | int stop_cmds_pending; |
722 | struct xhci_hcd *xhci; | 760 | struct xhci_hcd *xhci; |
761 | /* Dequeue pointer and dequeue segment for a submitted Set TR Dequeue | ||
762 | * command. We'll need to update the ring's dequeue segment and dequeue | ||
763 | * pointer after the command completes. | ||
764 | */ | ||
765 | struct xhci_segment *queued_deq_seg; | ||
766 | union xhci_trb *queued_deq_ptr; | ||
723 | /* | 767 | /* |
724 | * Sometimes the xHC can not process isochronous endpoint ring quickly | 768 | * Sometimes the xHC can not process isochronous endpoint ring quickly |
725 | * enough, and it will miss some isoc tds on the ring and generate | 769 | * enough, and it will miss some isoc tds on the ring and generate |
@@ -731,6 +775,7 @@ struct xhci_virt_ep { | |||
731 | }; | 775 | }; |
732 | 776 | ||
733 | struct xhci_virt_device { | 777 | struct xhci_virt_device { |
778 | struct usb_device *udev; | ||
734 | /* | 779 | /* |
735 | * Commands to the hardware are passed an "input context" that | 780 | * Commands to the hardware are passed an "input context" that |
736 | * tells the hardware what to change in its data structures. | 781 | * tells the hardware what to change in its data structures. |
@@ -745,12 +790,15 @@ struct xhci_virt_device { | |||
745 | /* Rings saved to ensure old alt settings can be re-instated */ | 790 | /* Rings saved to ensure old alt settings can be re-instated */ |
746 | struct xhci_ring **ring_cache; | 791 | struct xhci_ring **ring_cache; |
747 | int num_rings_cached; | 792 | int num_rings_cached; |
793 | /* Store xHC assigned device address */ | ||
794 | int address; | ||
748 | #define XHCI_MAX_RINGS_CACHED 31 | 795 | #define XHCI_MAX_RINGS_CACHED 31 |
749 | struct xhci_virt_ep eps[31]; | 796 | struct xhci_virt_ep eps[31]; |
750 | struct completion cmd_completion; | 797 | struct completion cmd_completion; |
751 | /* Status of the last command issued for this device */ | 798 | /* Status of the last command issued for this device */ |
752 | u32 cmd_status; | 799 | u32 cmd_status; |
753 | struct list_head cmd_list; | 800 | struct list_head cmd_list; |
801 | u8 port; | ||
754 | }; | 802 | }; |
755 | 803 | ||
756 | 804 | ||
@@ -760,7 +808,7 @@ struct xhci_virt_device { | |||
760 | */ | 808 | */ |
761 | struct xhci_device_context_array { | 809 | struct xhci_device_context_array { |
762 | /* 64-bit device addresses; we only write 32-bit addresses */ | 810 | /* 64-bit device addresses; we only write 32-bit addresses */ |
763 | u64 dev_context_ptrs[MAX_HC_SLOTS]; | 811 | __le64 dev_context_ptrs[MAX_HC_SLOTS]; |
764 | /* private xHCD pointers */ | 812 | /* private xHCD pointers */ |
765 | dma_addr_t dma; | 813 | dma_addr_t dma; |
766 | }; | 814 | }; |
@@ -773,10 +821,10 @@ struct xhci_device_context_array { | |||
773 | 821 | ||
774 | struct xhci_transfer_event { | 822 | struct xhci_transfer_event { |
775 | /* 64-bit buffer address, or immediate data */ | 823 | /* 64-bit buffer address, or immediate data */ |
776 | u64 buffer; | 824 | __le64 buffer; |
777 | u32 transfer_len; | 825 | __le32 transfer_len; |
778 | /* This field is interpreted differently based on the type of TRB */ | 826 | /* This field is interpreted differently based on the type of TRB */ |
779 | u32 flags; | 827 | __le32 flags; |
780 | }; | 828 | }; |
781 | 829 | ||
782 | /** Transfer Event bit fields **/ | 830 | /** Transfer Event bit fields **/ |
@@ -826,6 +874,8 @@ struct xhci_transfer_event { | |||
826 | #define COMP_PING_ERR 20 | 874 | #define COMP_PING_ERR 20 |
827 | /* Event Ring is full */ | 875 | /* Event Ring is full */ |
828 | #define COMP_ER_FULL 21 | 876 | #define COMP_ER_FULL 21 |
877 | /* Incompatible Device Error */ | ||
878 | #define COMP_DEV_ERR 22 | ||
829 | /* Missed Service Error - HC couldn't service an isoc ep within interval */ | 879 | /* Missed Service Error - HC couldn't service an isoc ep within interval */ |
830 | #define COMP_MISSED_INT 23 | 880 | #define COMP_MISSED_INT 23 |
831 | /* Successfully stopped command ring */ | 881 | /* Successfully stopped command ring */ |
@@ -834,11 +884,13 @@ struct xhci_transfer_event { | |||
834 | #define COMP_CMD_ABORT 25 | 884 | #define COMP_CMD_ABORT 25 |
835 | /* Stopped - transfer was terminated by a stop endpoint command */ | 885 | /* Stopped - transfer was terminated by a stop endpoint command */ |
836 | #define COMP_STOP 26 | 886 | #define COMP_STOP 26 |
837 | /* Same as COMP_EP_STOPPED, but the transfered length in the event is invalid */ | 887 | /* Same as COMP_EP_STOPPED, but the transferred length in the event is invalid */ |
838 | #define COMP_STOP_INVAL 27 | 888 | #define COMP_STOP_INVAL 27 |
839 | /* Control Abort Error - Debug Capability - control pipe aborted */ | 889 | /* Control Abort Error - Debug Capability - control pipe aborted */ |
840 | #define COMP_DBG_ABORT 28 | 890 | #define COMP_DBG_ABORT 28 |
841 | /* TRB type 29 and 30 reserved */ | 891 | /* Max Exit Latency Too Large Error */ |
892 | #define COMP_MEL_ERR 29 | ||
893 | /* TRB type 30 reserved */ | ||
842 | /* Isoc Buffer Overrun - an isoc IN ep sent more data than could fit in TD */ | 894 | /* Isoc Buffer Overrun - an isoc IN ep sent more data than could fit in TD */ |
843 | #define COMP_BUFF_OVER 31 | 895 | #define COMP_BUFF_OVER 31 |
844 | /* Event Lost Error - xHC has an "internal event overrun condition" */ | 896 | /* Event Lost Error - xHC has an "internal event overrun condition" */ |
@@ -855,9 +907,9 @@ struct xhci_transfer_event { | |||
855 | 907 | ||
856 | struct xhci_link_trb { | 908 | struct xhci_link_trb { |
857 | /* 64-bit segment pointer*/ | 909 | /* 64-bit segment pointer*/ |
858 | u64 segment_ptr; | 910 | __le64 segment_ptr; |
859 | u32 intr_target; | 911 | __le32 intr_target; |
860 | u32 control; | 912 | __le32 control; |
861 | }; | 913 | }; |
862 | 914 | ||
863 | /* control bitfields */ | 915 | /* control bitfields */ |
@@ -866,9 +918,9 @@ struct xhci_link_trb { | |||
866 | /* Command completion event TRB */ | 918 | /* Command completion event TRB */ |
867 | struct xhci_event_cmd { | 919 | struct xhci_event_cmd { |
868 | /* Pointer to command TRB, or the value passed by the event data trb */ | 920 | /* Pointer to command TRB, or the value passed by the event data trb */ |
869 | u64 cmd_trb; | 921 | __le64 cmd_trb; |
870 | u32 status; | 922 | __le32 status; |
871 | u32 flags; | 923 | __le32 flags; |
872 | }; | 924 | }; |
873 | 925 | ||
874 | /* flags bitmasks */ | 926 | /* flags bitmasks */ |
@@ -881,6 +933,10 @@ struct xhci_event_cmd { | |||
881 | #define TRB_TO_EP_INDEX(p) ((((p) & (0x1f << 16)) >> 16) - 1) | 933 | #define TRB_TO_EP_INDEX(p) ((((p) & (0x1f << 16)) >> 16) - 1) |
882 | #define EP_ID_FOR_TRB(p) ((((p) + 1) & 0x1f) << 16) | 934 | #define EP_ID_FOR_TRB(p) ((((p) + 1) & 0x1f) << 16) |
883 | 935 | ||
936 | #define SUSPEND_PORT_FOR_TRB(p) (((p) & 1) << 23) | ||
937 | #define TRB_TO_SUSPEND_PORT(p) (((p) & (1 << 23)) >> 23) | ||
938 | #define LAST_EP_INDEX 30 | ||
939 | |||
884 | /* Set TR Dequeue Pointer command TRB fields */ | 940 | /* Set TR Dequeue Pointer command TRB fields */ |
885 | #define TRB_TO_STREAM_ID(p) ((((p) & (0xffff << 16)) >> 16)) | 941 | #define TRB_TO_STREAM_ID(p) ((((p) & (0xffff << 16)) >> 16)) |
886 | #define STREAM_ID_FOR_TRB(p) ((((p)) & 0xffff) << 16) | 942 | #define STREAM_ID_FOR_TRB(p) ((((p)) & 0xffff) << 16) |
@@ -896,6 +952,8 @@ struct xhci_event_cmd { | |||
896 | /* Interrupter Target - which MSI-X vector to target the completion event at */ | 952 | /* Interrupter Target - which MSI-X vector to target the completion event at */ |
897 | #define TRB_INTR_TARGET(p) (((p) & 0x3ff) << 22) | 953 | #define TRB_INTR_TARGET(p) (((p) & 0x3ff) << 22) |
898 | #define GET_INTR_TARGET(p) (((p) >> 22) & 0x3ff) | 954 | #define GET_INTR_TARGET(p) (((p) >> 22) & 0x3ff) |
955 | #define TRB_TBC(p) (((p) & 0x3) << 7) | ||
956 | #define TRB_TLBPC(p) (((p) & 0xf) << 16) | ||
899 | 957 | ||
900 | /* Cycle bit - indicates TRB ownership by HC or HCD */ | 958 | /* Cycle bit - indicates TRB ownership by HC or HCD */ |
901 | #define TRB_CYCLE (1<<0) | 959 | #define TRB_CYCLE (1<<0) |
@@ -915,15 +973,20 @@ struct xhci_event_cmd { | |||
915 | /* The buffer pointer contains immediate data */ | 973 | /* The buffer pointer contains immediate data */ |
916 | #define TRB_IDT (1<<6) | 974 | #define TRB_IDT (1<<6) |
917 | 975 | ||
976 | /* Block Event Interrupt */ | ||
977 | #define TRB_BEI (1<<9) | ||
918 | 978 | ||
919 | /* Control transfer TRB specific fields */ | 979 | /* Control transfer TRB specific fields */ |
920 | #define TRB_DIR_IN (1<<16) | 980 | #define TRB_DIR_IN (1<<16) |
981 | #define TRB_TX_TYPE(p) ((p) << 16) | ||
982 | #define TRB_DATA_OUT 2 | ||
983 | #define TRB_DATA_IN 3 | ||
921 | 984 | ||
922 | /* Isochronous TRB specific fields */ | 985 | /* Isochronous TRB specific fields */ |
923 | #define TRB_SIA (1<<31) | 986 | #define TRB_SIA (1<<31) |
924 | 987 | ||
925 | struct xhci_generic_trb { | 988 | struct xhci_generic_trb { |
926 | u32 field[4]; | 989 | __le32 field[4]; |
927 | }; | 990 | }; |
928 | 991 | ||
929 | union xhci_trb { | 992 | union xhci_trb { |
@@ -1067,14 +1130,15 @@ struct xhci_ring { | |||
1067 | */ | 1130 | */ |
1068 | u32 cycle_state; | 1131 | u32 cycle_state; |
1069 | unsigned int stream_id; | 1132 | unsigned int stream_id; |
1133 | bool last_td_was_short; | ||
1070 | }; | 1134 | }; |
1071 | 1135 | ||
1072 | struct xhci_erst_entry { | 1136 | struct xhci_erst_entry { |
1073 | /* 64-bit event ring segment address */ | 1137 | /* 64-bit event ring segment address */ |
1074 | u64 seg_addr; | 1138 | __le64 seg_addr; |
1075 | u32 seg_size; | 1139 | __le32 seg_size; |
1076 | /* Set to zero */ | 1140 | /* Set to zero */ |
1077 | u32 rsvd; | 1141 | __le32 rsvd; |
1078 | }; | 1142 | }; |
1079 | 1143 | ||
1080 | struct xhci_erst { | 1144 | struct xhci_erst { |
@@ -1115,9 +1179,41 @@ struct urb_priv { | |||
1115 | #define XHCI_STOP_EP_CMD_TIMEOUT 5 | 1179 | #define XHCI_STOP_EP_CMD_TIMEOUT 5 |
1116 | /* XXX: Make these module parameters */ | 1180 | /* XXX: Make these module parameters */ |
1117 | 1181 | ||
1182 | struct s3_save { | ||
1183 | u32 command; | ||
1184 | u32 dev_nt; | ||
1185 | u64 dcbaa_ptr; | ||
1186 | u32 config_reg; | ||
1187 | u32 irq_pending; | ||
1188 | u32 irq_control; | ||
1189 | u32 erst_size; | ||
1190 | u64 erst_base; | ||
1191 | u64 erst_dequeue; | ||
1192 | }; | ||
1193 | |||
1194 | struct xhci_bus_state { | ||
1195 | unsigned long bus_suspended; | ||
1196 | unsigned long next_statechange; | ||
1197 | |||
1198 | /* Port suspend arrays are indexed by the portnum of the fake roothub */ | ||
1199 | /* ports suspend status arrays - max 31 ports for USB2, 15 for USB3 */ | ||
1200 | u32 port_c_suspend; | ||
1201 | u32 suspended_ports; | ||
1202 | unsigned long resume_done[USB_MAXCHILDREN]; | ||
1203 | }; | ||
1204 | |||
1205 | static inline unsigned int hcd_index(struct usb_hcd *hcd) | ||
1206 | { | ||
1207 | if (hcd->speed == HCD_USB3) | ||
1208 | return 0; | ||
1209 | else | ||
1210 | return 1; | ||
1211 | } | ||
1118 | 1212 | ||
1119 | /* There is one ehci_hci structure per controller */ | 1213 | /* There is one ehci_hci structure per controller */ |
1120 | struct xhci_hcd { | 1214 | struct xhci_hcd { |
1215 | struct usb_hcd *main_hcd; | ||
1216 | struct usb_hcd *shared_hcd; | ||
1121 | /* glue to PCI and HCD framework */ | 1217 | /* glue to PCI and HCD framework */ |
1122 | struct xhci_cap_regs __iomem *cap_regs; | 1218 | struct xhci_cap_regs __iomem *cap_regs; |
1123 | struct xhci_op_regs __iomem *op_regs; | 1219 | struct xhci_op_regs __iomem *op_regs; |
@@ -1178,6 +1274,9 @@ struct xhci_hcd { | |||
1178 | #endif | 1274 | #endif |
1179 | /* Host controller watchdog timer structures */ | 1275 | /* Host controller watchdog timer structures */ |
1180 | unsigned int xhc_state; | 1276 | unsigned int xhc_state; |
1277 | |||
1278 | u32 command; | ||
1279 | struct s3_save s3; | ||
1181 | /* Host controller is dying - not responding to commands. "I'm not dead yet!" | 1280 | /* Host controller is dying - not responding to commands. "I'm not dead yet!" |
1182 | * | 1281 | * |
1183 | * xHC interrupts have been disabled and a watchdog timer will (or has already) | 1282 | * xHC interrupts have been disabled and a watchdog timer will (or has already) |
@@ -1191,28 +1290,50 @@ struct xhci_hcd { | |||
1191 | * There are no reports of xHCI host controllers that display this issue. | 1290 | * There are no reports of xHCI host controllers that display this issue. |
1192 | */ | 1291 | */ |
1193 | #define XHCI_STATE_DYING (1 << 0) | 1292 | #define XHCI_STATE_DYING (1 << 0) |
1293 | #define XHCI_STATE_HALTED (1 << 1) | ||
1194 | /* Statistics */ | 1294 | /* Statistics */ |
1195 | int noops_submitted; | ||
1196 | int noops_handled; | ||
1197 | int error_bitmask; | 1295 | int error_bitmask; |
1198 | unsigned int quirks; | 1296 | unsigned int quirks; |
1199 | #define XHCI_LINK_TRB_QUIRK (1 << 0) | 1297 | #define XHCI_LINK_TRB_QUIRK (1 << 0) |
1200 | #define XHCI_RESET_EP_QUIRK (1 << 1) | 1298 | #define XHCI_RESET_EP_QUIRK (1 << 1) |
1201 | #define XHCI_NEC_HOST (1 << 2) | 1299 | #define XHCI_NEC_HOST (1 << 2) |
1300 | #define XHCI_AMD_PLL_FIX (1 << 3) | ||
1301 | #define XHCI_SPURIOUS_SUCCESS (1 << 4) | ||
1302 | /* | ||
1303 | * Certain Intel host controllers have a limit to the number of endpoint | ||
1304 | * contexts they can handle. Ideally, they would signal that they can't handle | ||
1305 | * anymore endpoint contexts by returning a Resource Error for the Configure | ||
1306 | * Endpoint command, but they don't. Instead they expect software to keep track | ||
1307 | * of the number of active endpoints for them, across configure endpoint | ||
1308 | * commands, reset device commands, disable slot commands, and address device | ||
1309 | * commands. | ||
1310 | */ | ||
1311 | #define XHCI_EP_LIMIT_QUIRK (1 << 5) | ||
1312 | #define XHCI_BROKEN_MSI (1 << 6) | ||
1313 | #define XHCI_RESET_ON_RESUME (1 << 7) | ||
1314 | unsigned int num_active_eps; | ||
1315 | unsigned int limit_active_eps; | ||
1316 | /* There are two roothubs to keep track of bus suspend info for */ | ||
1317 | struct xhci_bus_state bus_state[2]; | ||
1318 | /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ | ||
1319 | u8 *port_array; | ||
1320 | /* Array of pointers to USB 3.0 PORTSC registers */ | ||
1321 | __le32 __iomem **usb3_ports; | ||
1322 | unsigned int num_usb3_ports; | ||
1323 | /* Array of pointers to USB 2.0 PORTSC registers */ | ||
1324 | __le32 __iomem **usb2_ports; | ||
1325 | unsigned int num_usb2_ports; | ||
1202 | }; | 1326 | }; |
1203 | 1327 | ||
1204 | /* For testing purposes */ | ||
1205 | #define NUM_TEST_NOOPS 0 | ||
1206 | |||
1207 | /* convert between an HCD pointer and the corresponding EHCI_HCD */ | 1328 | /* convert between an HCD pointer and the corresponding EHCI_HCD */ |
1208 | static inline struct xhci_hcd *hcd_to_xhci(struct usb_hcd *hcd) | 1329 | static inline struct xhci_hcd *hcd_to_xhci(struct usb_hcd *hcd) |
1209 | { | 1330 | { |
1210 | return (struct xhci_hcd *) (hcd->hcd_priv); | 1331 | return *((struct xhci_hcd **) (hcd->hcd_priv)); |
1211 | } | 1332 | } |
1212 | 1333 | ||
1213 | static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci) | 1334 | static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci) |
1214 | { | 1335 | { |
1215 | return container_of((void *) xhci, struct usb_hcd, hcd_priv); | 1336 | return xhci->main_hcd; |
1216 | } | 1337 | } |
1217 | 1338 | ||
1218 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 1339 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
@@ -1233,16 +1354,13 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci) | |||
1233 | /* TODO: copied from ehci.h - can be refactored? */ | 1354 | /* TODO: copied from ehci.h - can be refactored? */ |
1234 | /* xHCI spec says all registers are little endian */ | 1355 | /* xHCI spec says all registers are little endian */ |
1235 | static inline unsigned int xhci_readl(const struct xhci_hcd *xhci, | 1356 | static inline unsigned int xhci_readl(const struct xhci_hcd *xhci, |
1236 | __u32 __iomem *regs) | 1357 | __le32 __iomem *regs) |
1237 | { | 1358 | { |
1238 | return readl(regs); | 1359 | return readl(regs); |
1239 | } | 1360 | } |
1240 | static inline void xhci_writel(struct xhci_hcd *xhci, | 1361 | static inline void xhci_writel(struct xhci_hcd *xhci, |
1241 | const unsigned int val, __u32 __iomem *regs) | 1362 | const unsigned int val, __le32 __iomem *regs) |
1242 | { | 1363 | { |
1243 | xhci_dbg(xhci, | ||
1244 | "`MEM_WRITE_DWORD(3'b000, 32'h%p, 32'h%0x, 4'hf);\n", | ||
1245 | regs, val); | ||
1246 | writel(val, regs); | 1364 | writel(val, regs); |
1247 | } | 1365 | } |
1248 | 1366 | ||
@@ -1256,7 +1374,7 @@ static inline void xhci_writel(struct xhci_hcd *xhci, | |||
1256 | * the high dword, and write order is irrelevant. | 1374 | * the high dword, and write order is irrelevant. |
1257 | */ | 1375 | */ |
1258 | static inline u64 xhci_read_64(const struct xhci_hcd *xhci, | 1376 | static inline u64 xhci_read_64(const struct xhci_hcd *xhci, |
1259 | __u64 __iomem *regs) | 1377 | __le64 __iomem *regs) |
1260 | { | 1378 | { |
1261 | __u32 __iomem *ptr = (__u32 __iomem *) regs; | 1379 | __u32 __iomem *ptr = (__u32 __iomem *) regs; |
1262 | u64 val_lo = readl(ptr); | 1380 | u64 val_lo = readl(ptr); |
@@ -1264,15 +1382,12 @@ static inline u64 xhci_read_64(const struct xhci_hcd *xhci, | |||
1264 | return val_lo + (val_hi << 32); | 1382 | return val_lo + (val_hi << 32); |
1265 | } | 1383 | } |
1266 | static inline void xhci_write_64(struct xhci_hcd *xhci, | 1384 | static inline void xhci_write_64(struct xhci_hcd *xhci, |
1267 | const u64 val, __u64 __iomem *regs) | 1385 | const u64 val, __le64 __iomem *regs) |
1268 | { | 1386 | { |
1269 | __u32 __iomem *ptr = (__u32 __iomem *) regs; | 1387 | __u32 __iomem *ptr = (__u32 __iomem *) regs; |
1270 | u32 val_lo = lower_32_bits(val); | 1388 | u32 val_lo = lower_32_bits(val); |
1271 | u32 val_hi = upper_32_bits(val); | 1389 | u32 val_hi = upper_32_bits(val); |
1272 | 1390 | ||
1273 | xhci_dbg(xhci, | ||
1274 | "`MEM_WRITE_DWORD(3'b000, 64'h%p, 64'h%0lx, 4'hf);\n", | ||
1275 | regs, (long unsigned int) val); | ||
1276 | writel(val_lo, ptr); | 1391 | writel(val_lo, ptr); |
1277 | writel(val_hi, ptr + 1); | 1392 | writel(val_hi, ptr + 1); |
1278 | } | 1393 | } |
@@ -1285,7 +1400,7 @@ static inline int xhci_link_trb_quirk(struct xhci_hcd *xhci) | |||
1285 | } | 1400 | } |
1286 | 1401 | ||
1287 | /* xHCI debugging */ | 1402 | /* xHCI debugging */ |
1288 | void xhci_print_ir_set(struct xhci_hcd *xhci, struct xhci_intr_reg *ir_set, int set_num); | 1403 | void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num); |
1289 | void xhci_print_registers(struct xhci_hcd *xhci); | 1404 | void xhci_print_registers(struct xhci_hcd *xhci); |
1290 | void xhci_dbg_regs(struct xhci_hcd *xhci); | 1405 | void xhci_dbg_regs(struct xhci_hcd *xhci); |
1291 | void xhci_print_run_regs(struct xhci_hcd *xhci); | 1406 | void xhci_print_run_regs(struct xhci_hcd *xhci); |
@@ -1341,6 +1456,8 @@ void xhci_setup_streams_ep_input_ctx(struct xhci_hcd *xhci, | |||
1341 | void xhci_setup_no_streams_ep_input_ctx(struct xhci_hcd *xhci, | 1456 | void xhci_setup_no_streams_ep_input_ctx(struct xhci_hcd *xhci, |
1342 | struct xhci_ep_ctx *ep_ctx, | 1457 | struct xhci_ep_ctx *ep_ctx, |
1343 | struct xhci_virt_ep *ep); | 1458 | struct xhci_virt_ep *ep); |
1459 | void xhci_free_device_endpoint_resources(struct xhci_hcd *xhci, | ||
1460 | struct xhci_virt_device *virt_dev, bool drop_control_ep); | ||
1344 | struct xhci_ring *xhci_dma_to_transfer_ring( | 1461 | struct xhci_ring *xhci_dma_to_transfer_ring( |
1345 | struct xhci_virt_ep *ep, | 1462 | struct xhci_virt_ep *ep, |
1346 | u64 address); | 1463 | u64 address); |
@@ -1369,6 +1486,15 @@ int xhci_init(struct usb_hcd *hcd); | |||
1369 | int xhci_run(struct usb_hcd *hcd); | 1486 | int xhci_run(struct usb_hcd *hcd); |
1370 | void xhci_stop(struct usb_hcd *hcd); | 1487 | void xhci_stop(struct usb_hcd *hcd); |
1371 | void xhci_shutdown(struct usb_hcd *hcd); | 1488 | void xhci_shutdown(struct usb_hcd *hcd); |
1489 | |||
1490 | #ifdef CONFIG_PM | ||
1491 | int xhci_suspend(struct xhci_hcd *xhci); | ||
1492 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated); | ||
1493 | #else | ||
1494 | #define xhci_suspend NULL | ||
1495 | #define xhci_resume NULL | ||
1496 | #endif | ||
1497 | |||
1372 | int xhci_get_frame(struct usb_hcd *hcd); | 1498 | int xhci_get_frame(struct usb_hcd *hcd); |
1373 | irqreturn_t xhci_irq(struct usb_hcd *hcd); | 1499 | irqreturn_t xhci_irq(struct usb_hcd *hcd); |
1374 | irqreturn_t xhci_msi_irq(int irq, struct usb_hcd *hcd); | 1500 | irqreturn_t xhci_msi_irq(int irq, struct usb_hcd *hcd); |
@@ -1388,7 +1514,7 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status); | |||
1388 | int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep); | 1514 | int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep); |
1389 | int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep); | 1515 | int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep); |
1390 | void xhci_endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep); | 1516 | void xhci_endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep); |
1391 | int xhci_reset_device(struct usb_hcd *hcd, struct usb_device *udev); | 1517 | int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev); |
1392 | int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev); | 1518 | int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev); |
1393 | void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev); | 1519 | void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev); |
1394 | 1520 | ||
@@ -1399,14 +1525,13 @@ struct xhci_segment *trb_in_td(struct xhci_segment *start_seg, | |||
1399 | dma_addr_t suspect_dma); | 1525 | dma_addr_t suspect_dma); |
1400 | int xhci_is_vendor_info_code(struct xhci_hcd *xhci, unsigned int trb_comp_code); | 1526 | int xhci_is_vendor_info_code(struct xhci_hcd *xhci, unsigned int trb_comp_code); |
1401 | void xhci_ring_cmd_db(struct xhci_hcd *xhci); | 1527 | void xhci_ring_cmd_db(struct xhci_hcd *xhci); |
1402 | void *xhci_setup_one_noop(struct xhci_hcd *xhci); | ||
1403 | int xhci_queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id); | 1528 | int xhci_queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id); |
1404 | int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, | 1529 | int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, |
1405 | u32 slot_id); | 1530 | u32 slot_id); |
1406 | int xhci_queue_vendor_command(struct xhci_hcd *xhci, | 1531 | int xhci_queue_vendor_command(struct xhci_hcd *xhci, |
1407 | u32 field1, u32 field2, u32 field3, u32 field4); | 1532 | u32 field1, u32 field2, u32 field3, u32 field4); |
1408 | int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, int slot_id, | 1533 | int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, int slot_id, |
1409 | unsigned int ep_index); | 1534 | unsigned int ep_index, int suspend); |
1410 | int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, | 1535 | int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, |
1411 | int slot_id, unsigned int ep_index); | 1536 | int slot_id, unsigned int ep_index); |
1412 | int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, | 1537 | int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, |
@@ -1436,12 +1561,27 @@ void xhci_queue_config_ep_quirk(struct xhci_hcd *xhci, | |||
1436 | unsigned int slot_id, unsigned int ep_index, | 1561 | unsigned int slot_id, unsigned int ep_index, |
1437 | struct xhci_dequeue_state *deq_state); | 1562 | struct xhci_dequeue_state *deq_state); |
1438 | void xhci_stop_endpoint_command_watchdog(unsigned long arg); | 1563 | void xhci_stop_endpoint_command_watchdog(unsigned long arg); |
1564 | void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id, | ||
1565 | unsigned int ep_index, unsigned int stream_id); | ||
1439 | 1566 | ||
1440 | /* xHCI roothub code */ | 1567 | /* xHCI roothub code */ |
1441 | int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, | 1568 | int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, |
1442 | char *buf, u16 wLength); | 1569 | char *buf, u16 wLength); |
1443 | int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); | 1570 | int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); |
1444 | 1571 | ||
1572 | #ifdef CONFIG_PM | ||
1573 | int xhci_bus_suspend(struct usb_hcd *hcd); | ||
1574 | int xhci_bus_resume(struct usb_hcd *hcd); | ||
1575 | #else | ||
1576 | #define xhci_bus_suspend NULL | ||
1577 | #define xhci_bus_resume NULL | ||
1578 | #endif /* CONFIG_PM */ | ||
1579 | |||
1580 | u32 xhci_port_state_to_neutral(u32 state); | ||
1581 | int xhci_find_slot_id_by_port(struct usb_hcd *hcd, struct xhci_hcd *xhci, | ||
1582 | u16 port); | ||
1583 | void xhci_ring_device(struct xhci_hcd *xhci, int slot_id); | ||
1584 | |||
1445 | /* xHCI contexts */ | 1585 | /* xHCI contexts */ |
1446 | struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); | 1586 | struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); |
1447 | struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); | 1587 | struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); |