usbehci.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. typedef struct Ecapio Ecapio;
  2. typedef struct Eopio Eopio;
  3. typedef struct Edbgio Edbgio;
  4. /*
  5. * EHCI interface registers and bits
  6. */
  7. enum
  8. {
  9. Cnports = 0xF, /* nport bits in Ecapio parms. */
  10. Cdbgportshift = 20,, /* debug port in Ecapio parms. */
  11. Cdbgportmask = 0xF,
  12. C64 = 1, /* 64-bits, in Ecapio capparms. */
  13. Ceecpshift = 8, /* extended capabilities ptr. in */
  14. Ceecpmask = 8, /* the Ecapio capparms reg. */
  15. Clegacy = 1, /* legacy support cap. id */
  16. CLbiossem = 2, /* legacy cap. bios sem. */
  17. CLossem = 3, /* legacy cap. os sem */
  18. /* typed links */
  19. Lterm = 1,
  20. Litd = 0<<1,
  21. Lqh = 1<<1,
  22. Lsitd = 2<<1,
  23. Lfstn = 3<<1, /* we don't use these */
  24. /* Cmd reg. */
  25. Cstop = 0x00000, /* stop running */
  26. Crun = 0x00001, /* start operation */
  27. Chcreset = 0x00002, /* host controller reset */
  28. Cflsmask = 0x0000C, /* frame list size bits */
  29. Cfls1024 = 0x00000, /* frame list size 1024 */
  30. Cfls512 = 0x00004, /* frame list size 512 frames */
  31. Cfls256 = 0x00008, /* frame list size 256 frames */
  32. Cpse = 0x00010, /* periodic sched. enable */
  33. Case = 0x00020, /* async sched. enable */
  34. Ciasync = 0x00040, /* interrupt on async advance doorbell */
  35. Citc1 = 0x10000, /* interrupt threshold ctl. 1 µframe */
  36. Citc4 = 0x40000, /* same. 2 µframes */
  37. /* ... */
  38. Citc8 = 0x80000, /* same. 8 µframes (can go up to 64) */
  39. /* Sts reg. */
  40. Sasyncss = 0x08000, /* aync schedule status */
  41. Speriodss = 0x04000, /* periodic schedule status */
  42. Srecl = 0x02000, /* reclamnation (empty async sched.) */
  43. Shalted = 0x01000, /* h.c. is halted */
  44. Sasync = 0x00020, /* interrupt on async advance */
  45. Sherr = 0x00010, /* host system error */
  46. Sfrroll = 0x00008, /* frame list roll over */
  47. Sportchg = 0x00004, /* port change detect */
  48. Serrintr = 0x00002, /* error interrupt */
  49. Sintr = 0x00001, /* interrupt */
  50. Sintrs = 0x0003F, /* interrupts status */
  51. /* Intr reg. */
  52. Iusb = 0x01, /* intr. on usb */
  53. Ierr = 0x02, /* intr. on usb error */
  54. Iportchg = 0x04, /* intr. on port change */
  55. Ifrroll = 0x08, /* intr. on frlist roll over */
  56. Ihcerr = 0x10, /* intr. on host error */
  57. Iasync = 0x20, /* intr. on async advance enable */
  58. Iall = 0x3F, /* all interrupts */
  59. /* Config reg. */
  60. Callmine = 1, /* route all ports to us */
  61. /* Portsc reg. */
  62. Pspresent = 0x00000001, /* device present */
  63. Psstatuschg = 0x00000002, /* Pspresent changed */
  64. Psenable = 0x00000004, /* device enabled */
  65. Pschange = 0x00000008, /* Psenable changed */
  66. Psresume = 0x00000040, /* resume detected */
  67. Pssuspend = 0x00000080, /* port suspended */
  68. Psreset = 0x00000100, /* port reset */
  69. Pspower = 0x00001000, /* port power on */
  70. Psowner = 0x00002000, /* port owned by companion */
  71. Pslinemask = 0x00000C00, /* line status bits */
  72. Pslow = 0x00000400, /* low speed device */
  73. /* Debug port csw reg. */
  74. Cowner = 0x40000000, /* port owned by ehci */
  75. Cenable = 0x10000000, /* debug port enabled */
  76. Cdone = 0x00010000, /* request is done */
  77. Cbusy = 0x00000400, /* port in use by a driver */
  78. Cerrmask= 0x00000380, /* error code bits */
  79. Chwerr = 0x00000100, /* hardware error */
  80. Cterr = 0x00000080, /* transaction error */
  81. Cfailed = 0x00000040, /* transaction did fail */
  82. Cgo = 0x00000020, /* execute the transaction */
  83. Cwrite = 0x00000010, /* request is a write */
  84. Clen = 0x0000000F, /* data len */
  85. /* Debug port pid reg. */
  86. Prpidshift = 16, /* received pid */
  87. Prpidmask = 0xFF,
  88. Pspidshift = 8, /* sent pid */
  89. Pspidmask = 0xFF,
  90. Ptokshift = 0, /* token pid */
  91. Ptokmask = 0xFF,
  92. Ptoggle = 0x00008800, /* to update toggles */
  93. Ptogglemask = 0x0000FF00,
  94. /* Debug port addr reg. */
  95. Adevshift = 8, /* device address */
  96. Adevmask = 0x7F,
  97. Aepshift = 0, /* endpoint number */
  98. Aepmask = 0xF,
  99. };
  100. /*
  101. * Capability registers (hw)
  102. */
  103. struct Ecapio
  104. {
  105. ulong cap; /* 00 controller capability register */
  106. ulong parms; /* 04 structural parameters register */
  107. ulong capparms; /* 08 capability parameters */
  108. ulong portroute; /* 0c not on the CS5536 */
  109. };
  110. /*
  111. * Operational registers (hw)
  112. */
  113. struct Eopio
  114. {
  115. ulong cmd; /* 00 command */
  116. ulong sts; /* 04 status */
  117. ulong intr; /* 08 interrupt enable */
  118. ulong frno; /* 0c frame index */
  119. ulong seg; /* 10 bits 63:32 of EHCI datastructs (unused) */
  120. ulong frbase; /* 14 frame list base addr, 4096-byte boundary */
  121. ulong link; /* 18 link for async list */
  122. uchar d2c[0x40-0x1c]; /* 1c dummy */
  123. ulong config; /* 40 1: all ports default-routed to this HC */
  124. ulong portsc[1]; /* 44 Port status and control, one per port */
  125. };
  126. /*
  127. * Debug port registers (hw)
  128. */
  129. struct Edbgio
  130. {
  131. ulong csw; /* control and status */
  132. ulong pid; /* USB pid */
  133. uchar data[8]; /* data buffer */
  134. ulong addr; /* device and endpoint addresses */
  135. };