portusbehci.h 4.7 KB

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