usbehci.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* override default macros from ../port/usb.h */
  2. #undef dprint
  3. #undef ddprint
  4. #undef deprint
  5. #undef ddeprint
  6. #define dprint if(ehcidebug)print
  7. #define ddprint if(ehcidebug>1)print
  8. #define deprint if(ehcidebug || ep->debug)print
  9. #define ddeprint if(ehcidebug>1 || ep->debug>1)print
  10. typedef struct Ctlr Ctlr;
  11. typedef struct Eopio Eopio;
  12. typedef struct Isoio Isoio;
  13. typedef struct Poll Poll;
  14. typedef struct Qh Qh;
  15. typedef struct Qtree Qtree;
  16. #pragma incomplete Ctlr;
  17. #pragma incomplete Eopio;
  18. #pragma incomplete Isoio;
  19. #pragma incomplete Poll;
  20. #pragma incomplete Qh;
  21. #pragma incomplete Qtree;
  22. struct Poll
  23. {
  24. Lock;
  25. Rendez;
  26. int must;
  27. int does;
  28. };
  29. struct Ctlr
  30. {
  31. Rendez; /* for waiting to async advance doorbell */
  32. Lock; /* for ilock. qh lists and basic ctlr I/O */
  33. QLock portlck; /* for port resets/enable... (and doorbell) */
  34. int active; /* in use or not */
  35. Ecapio* capio; /* Capability i/o regs */
  36. Eopio* opio; /* Operational i/o regs */
  37. int nframes; /* 1024, 512, or 256 frames in the list */
  38. ulong* frames; /* periodic frame list (hw) */
  39. Qh* qhs; /* async Qh circular list for bulk/ctl */
  40. Qtree* tree; /* tree of Qhs for the periodic list */
  41. int ntree; /* number of dummy qhs in tree */
  42. Qh* intrqhs; /* list of (not dummy) qhs in tree */
  43. Isoio* iso; /* list of active Iso I/O */
  44. ulong load;
  45. ulong isoload;
  46. int nintr; /* number of interrupts attended */
  47. int ntdintr; /* number of intrs. with something to do */
  48. int nqhintr; /* number of async td intrs. */
  49. int nisointr; /* number of periodic td intrs. */
  50. int nreqs;
  51. Poll poll;
  52. };
  53. /*
  54. * Operational registers (hw)
  55. */
  56. struct Eopio
  57. {
  58. ulong cmd; /* 00 command */
  59. ulong sts; /* 04 status */
  60. ulong intr; /* 08 interrupt enable */
  61. ulong frno; /* 0c frame index */
  62. ulong seg; /* 10 bits 63:32 of EHCI datastructs (unused) */
  63. ulong frbase; /* 14 frame list base addr, 4096-byte boundary */
  64. ulong link; /* 18 link for async list */
  65. uchar d2c[0x40-0x1c]; /* 1c dummy */
  66. ulong config; /* 40 1: all ports default-routed to this HC */
  67. ulong portsc[3]; /* 44 Port status and control, one per port */
  68. /* defined for omap35 ehci at least */
  69. uchar _pad0[0x80 - 0x50];
  70. ulong insn[6]; /* implementation-specific */
  71. };
  72. typedef struct Uhh Uhh;
  73. struct Uhh {
  74. ulong revision; /* ro */
  75. uchar _pad0[0x10-0x4];
  76. ulong sysconfig;
  77. ulong sysstatus; /* ro */
  78. uchar _pad1[0x40-0x18];
  79. ulong hostconfig;
  80. ulong debug_csr;
  81. };
  82. enum {
  83. /* hostconfig bits */
  84. P1ulpi_bypass = 1<<0, /* utmi if set; else ulpi */
  85. };
  86. extern Ecapio *ehcidebugcapio;
  87. extern int ehcidebugport;
  88. extern int ehcidebug;
  89. void ehcilinkage(Hci *hp);
  90. void ehcimeminit(Ctlr *ctlr);
  91. void ehcirun(Ctlr *ctlr, int on);