usb_ehci.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*-
  2. * Copyright (c) 2007-2008, Juniper Networks, Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation version 2 of
  8. * the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. */
  20. #ifndef USB_EHCI_H
  21. #define USB_EHCI_H
  22. /* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
  23. #define DeviceRequest \
  24. ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8)
  25. #define DeviceOutRequest \
  26. ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8)
  27. #define InterfaceRequest \
  28. ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
  29. #define EndpointRequest \
  30. ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
  31. #define EndpointOutRequest \
  32. ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
  33. /*
  34. * Register Space.
  35. */
  36. struct ehci_hccr {
  37. uint8_t cr_caplength;
  38. uint16_t cr_hciversion;
  39. uint32_t cr_hcsparams;
  40. uint32_t cr_hccparams;
  41. uint8_t cr_hcsp_portrt[8];
  42. };
  43. struct ehci_hcor {
  44. uint32_t or_usbcmd;
  45. uint32_t or_usbsts;
  46. uint32_t or_usbintr;
  47. uint32_t or_frindex;
  48. uint32_t or_ctrldssegment;
  49. uint32_t or_periodiclistbase;
  50. uint32_t or_asynclistaddr;
  51. uint32_t _reserved_[9];
  52. uint32_t or_configflag;
  53. uint32_t or_portsc[2];
  54. uint32_t or_systune;
  55. };
  56. #define EHCI_PS_WKOC_E 0x00400000 /* RW wake on over current */
  57. #define EHCI_PS_WKDSCNNT_E 0x00200000 /* RW wake on disconnect */
  58. #define EHCI_PS_WKCNNT_E 0x00100000 /* RW wake on connect */
  59. #define EHCI_PS_PTC 0x000f0000 /* RW port test control */
  60. #define EHCI_PS_PIC 0x0000c000 /* RW port indicator control */
  61. #define EHCI_PS_PO 0x00002000 /* RW port owner */
  62. #define EHCI_PS_PP 0x00001000 /* RW,RO port power */
  63. #define EHCI_PS_LS 0x00000c00 /* RO line status */
  64. #define EHCI_PS_PR 0x00000100 /* RW port reset */
  65. #define EHCI_PS_SUSP 0x00000080 /* RW suspend */
  66. #define EHCI_PS_FPR 0x00000040 /* RW force port resume */
  67. #define EHCI_PS_OCC 0x00000020 /* RWC over current change */
  68. #define EHCI_PS_OCA 0x00000010 /* RO over current active */
  69. #define EHCI_PS_PEC 0x00000008 /* RWC port enable change */
  70. #define EHCI_PS_PE 0x00000004 /* RW port enable */
  71. #define EHCI_PS_CSC 0x00000002 /* RWC connect status change */
  72. #define EHCI_PS_CS 0x00000001 /* RO connect status */
  73. #define EHCI_PS_CLEAR (EHCI_PS_OCC | EHCI_PS_PEC | EHCI_PS_CSC)
  74. #define EHCI_PS_IS_LOWSPEED(x) (((x) & EHCI_PS_LS) == 0x00000400)
  75. /*
  76. * Schedule Interface Space.
  77. *
  78. * IMPORTANT: Software must ensure that no interface data structure
  79. * reachable by the EHCI host controller spans a 4K page boundary!
  80. *
  81. * Periodic transfers (i.e. isochronous and interrupt transfers) are
  82. * not supported.
  83. */
  84. /* Queue Element Transfer Descriptor (qTD). */
  85. struct qTD {
  86. uint32_t qt_next;
  87. #define QT_NEXT_TERMINATE 1
  88. uint32_t qt_altnext;
  89. uint32_t qt_token;
  90. uint32_t qt_buffer[5];
  91. };
  92. /* Queue Head (QH). */
  93. struct QH {
  94. uint32_t qh_link;
  95. #define QH_LINK_TERMINATE 1
  96. #define QH_LINK_TYPE_ITD 0
  97. #define QH_LINK_TYPE_QH 2
  98. #define QH_LINK_TYPE_SITD 4
  99. #define QH_LINK_TYPE_FSTN 6
  100. uint32_t qh_endpt1;
  101. uint32_t qh_endpt2;
  102. uint32_t qh_curtd;
  103. struct qTD qh_overlay;
  104. };
  105. /* Low level intit functions */
  106. int ehci_hcd_init(void);
  107. int ehci_hcd_stop(void);
  108. #endif /* USB_EHCI_H */