isp1760-regs.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*
  2. * Driver for the NXP ISP1760 chip
  3. *
  4. * Copyright 2014 Laurent Pinchart
  5. * Copyright 2007 Sebastian Siewior
  6. *
  7. * Contacts:
  8. * Sebastian Siewior <bigeasy@linutronix.de>
  9. * Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * version 2 as published by the Free Software Foundation.
  14. */
  15. #ifndef _ISP1760_REGS_H_
  16. #define _ISP1760_REGS_H_
  17. /* -----------------------------------------------------------------------------
  18. * Host Controller
  19. */
  20. /* EHCI capability registers */
  21. #define HC_CAPLENGTH 0x000
  22. #define HC_LENGTH(p) (((p) >> 00) & 0x00ff) /* bits 7:0 */
  23. #define HC_VERSION(p) (((p) >> 16) & 0xffff) /* bits 31:16 */
  24. #define HC_HCSPARAMS 0x004
  25. #define HCS_INDICATOR(p) ((p) & (1 << 16)) /* true: has port indicators */
  26. #define HCS_PPC(p) ((p) & (1 << 4)) /* true: port power control */
  27. #define HCS_N_PORTS(p) (((p) >> 0) & 0xf) /* bits 3:0, ports on HC */
  28. #define HC_HCCPARAMS 0x008
  29. #define HCC_ISOC_CACHE(p) ((p) & (1 << 7)) /* true: can cache isoc frame */
  30. #define HCC_ISOC_THRES(p) (((p) >> 4) & 0x7) /* bits 6:4, uframes cached */
  31. /* EHCI operational registers */
  32. #define HC_USBCMD 0x020
  33. #define CMD_LRESET (1 << 7) /* partial reset (no ports, etc) */
  34. #define CMD_RESET (1 << 1) /* reset HC not bus */
  35. #define CMD_RUN (1 << 0) /* start/stop HC */
  36. #define HC_USBSTS 0x024
  37. #define STS_PCD (1 << 2) /* port change detect */
  38. #define HC_FRINDEX 0x02c
  39. #define HC_CONFIGFLAG 0x060
  40. #define FLAG_CF (1 << 0) /* true: we'll support "high speed" */
  41. #define HC_PORTSC1 0x064
  42. #define PORT_OWNER (1 << 13) /* true: companion hc owns this port */
  43. #define PORT_POWER (1 << 12) /* true: has power (see PPC) */
  44. #define PORT_USB11(x) (((x) & (3 << 10)) == (1 << 10)) /* USB 1.1 device */
  45. #define PORT_RESET (1 << 8) /* reset port */
  46. #define PORT_SUSPEND (1 << 7) /* suspend port */
  47. #define PORT_RESUME (1 << 6) /* resume it */
  48. #define PORT_PE (1 << 2) /* port enable */
  49. #define PORT_CSC (1 << 1) /* connect status change */
  50. #define PORT_CONNECT (1 << 0) /* device connected */
  51. #define PORT_RWC_BITS (PORT_CSC)
  52. #define HC_ISO_PTD_DONEMAP_REG 0x130
  53. #define HC_ISO_PTD_SKIPMAP_REG 0x134
  54. #define HC_ISO_PTD_LASTPTD_REG 0x138
  55. #define HC_INT_PTD_DONEMAP_REG 0x140
  56. #define HC_INT_PTD_SKIPMAP_REG 0x144
  57. #define HC_INT_PTD_LASTPTD_REG 0x148
  58. #define HC_ATL_PTD_DONEMAP_REG 0x150
  59. #define HC_ATL_PTD_SKIPMAP_REG 0x154
  60. #define HC_ATL_PTD_LASTPTD_REG 0x158
  61. /* Configuration Register */
  62. #define HC_HW_MODE_CTRL 0x300
  63. #define ALL_ATX_RESET (1 << 31)
  64. #define HW_ANA_DIGI_OC (1 << 15)
  65. #define HW_DEV_DMA (1 << 11)
  66. #define HW_COMN_IRQ (1 << 10)
  67. #define HW_COMN_DMA (1 << 9)
  68. #define HW_DATA_BUS_32BIT (1 << 8)
  69. #define HW_DACK_POL_HIGH (1 << 6)
  70. #define HW_DREQ_POL_HIGH (1 << 5)
  71. #define HW_INTR_HIGH_ACT (1 << 2)
  72. #define HW_INTR_EDGE_TRIG (1 << 1)
  73. #define HW_GLOBAL_INTR_EN (1 << 0)
  74. #define HC_CHIP_ID_REG 0x304
  75. #define HC_SCRATCH_REG 0x308
  76. #define HC_RESET_REG 0x30c
  77. #define SW_RESET_RESET_HC (1 << 1)
  78. #define SW_RESET_RESET_ALL (1 << 0)
  79. #define HC_BUFFER_STATUS_REG 0x334
  80. #define ISO_BUF_FILL (1 << 2)
  81. #define INT_BUF_FILL (1 << 1)
  82. #define ATL_BUF_FILL (1 << 0)
  83. #define HC_MEMORY_REG 0x33c
  84. #define ISP_BANK(x) ((x) << 16)
  85. #define HC_PORT1_CTRL 0x374
  86. #define PORT1_POWER (3 << 3)
  87. #define PORT1_INIT1 (1 << 7)
  88. #define PORT1_INIT2 (1 << 23)
  89. #define HW_OTG_CTRL_SET 0x374
  90. #define HW_OTG_CTRL_CLR 0x376
  91. #define HW_OTG_DISABLE (1 << 10)
  92. #define HW_OTG_SE0_EN (1 << 9)
  93. #define HW_BDIS_ACON_EN (1 << 8)
  94. #define HW_SW_SEL_HC_DC (1 << 7)
  95. #define HW_VBUS_CHRG (1 << 6)
  96. #define HW_VBUS_DISCHRG (1 << 5)
  97. #define HW_VBUS_DRV (1 << 4)
  98. #define HW_SEL_CP_EXT (1 << 3)
  99. #define HW_DM_PULLDOWN (1 << 2)
  100. #define HW_DP_PULLDOWN (1 << 1)
  101. #define HW_DP_PULLUP (1 << 0)
  102. /* Interrupt Register */
  103. #define HC_INTERRUPT_REG 0x310
  104. #define HC_INTERRUPT_ENABLE 0x314
  105. #define HC_ISO_INT (1 << 9)
  106. #define HC_ATL_INT (1 << 8)
  107. #define HC_INTL_INT (1 << 7)
  108. #define HC_EOT_INT (1 << 3)
  109. #define HC_SOT_INT (1 << 1)
  110. #define INTERRUPT_ENABLE_MASK (HC_INTL_INT | HC_ATL_INT)
  111. #define HC_ISO_IRQ_MASK_OR_REG 0x318
  112. #define HC_INT_IRQ_MASK_OR_REG 0x31c
  113. #define HC_ATL_IRQ_MASK_OR_REG 0x320
  114. #define HC_ISO_IRQ_MASK_AND_REG 0x324
  115. #define HC_INT_IRQ_MASK_AND_REG 0x328
  116. #define HC_ATL_IRQ_MASK_AND_REG 0x32c
  117. /* -----------------------------------------------------------------------------
  118. * Peripheral Controller
  119. */
  120. /* Initialization Registers */
  121. #define DC_ADDRESS 0x0200
  122. #define DC_DEVEN (1 << 7)
  123. #define DC_MODE 0x020c
  124. #define DC_DMACLKON (1 << 9)
  125. #define DC_VBUSSTAT (1 << 8)
  126. #define DC_CLKAON (1 << 7)
  127. #define DC_SNDRSU (1 << 6)
  128. #define DC_GOSUSP (1 << 5)
  129. #define DC_SFRESET (1 << 4)
  130. #define DC_GLINTENA (1 << 3)
  131. #define DC_WKUPCS (1 << 2)
  132. #define DC_INTCONF 0x0210
  133. #define DC_CDBGMOD_ACK_NAK (0 << 6)
  134. #define DC_CDBGMOD_ACK (1 << 6)
  135. #define DC_CDBGMOD_ACK_1NAK (2 << 6)
  136. #define DC_DDBGMODIN_ACK_NAK (0 << 4)
  137. #define DC_DDBGMODIN_ACK (1 << 4)
  138. #define DC_DDBGMODIN_ACK_1NAK (2 << 4)
  139. #define DC_DDBGMODOUT_ACK_NYET_NAK (0 << 2)
  140. #define DC_DDBGMODOUT_ACK_NYET (1 << 2)
  141. #define DC_DDBGMODOUT_ACK_NYET_1NAK (2 << 2)
  142. #define DC_INTLVL (1 << 1)
  143. #define DC_INTPOL (1 << 0)
  144. #define DC_DEBUG 0x0212
  145. #define DC_INTENABLE 0x0214
  146. #define DC_IEPTX(n) (1 << (11 + 2 * (n)))
  147. #define DC_IEPRX(n) (1 << (10 + 2 * (n)))
  148. #define DC_IEPRXTX(n) (3 << (10 + 2 * (n)))
  149. #define DC_IEP0SETUP (1 << 8)
  150. #define DC_IEVBUS (1 << 7)
  151. #define DC_IEDMA (1 << 6)
  152. #define DC_IEHS_STA (1 << 5)
  153. #define DC_IERESM (1 << 4)
  154. #define DC_IESUSP (1 << 3)
  155. #define DC_IEPSOF (1 << 2)
  156. #define DC_IESOF (1 << 1)
  157. #define DC_IEBRST (1 << 0)
  158. /* Data Flow Registers */
  159. #define DC_EPINDEX 0x022c
  160. #define DC_EP0SETUP (1 << 5)
  161. #define DC_ENDPIDX(n) ((n) << 1)
  162. #define DC_EPDIR (1 << 0)
  163. #define DC_CTRLFUNC 0x0228
  164. #define DC_CLBUF (1 << 4)
  165. #define DC_VENDP (1 << 3)
  166. #define DC_DSEN (1 << 2)
  167. #define DC_STATUS (1 << 1)
  168. #define DC_STALL (1 << 0)
  169. #define DC_DATAPORT 0x0220
  170. #define DC_BUFLEN 0x021c
  171. #define DC_DATACOUNT_MASK 0xffff
  172. #define DC_BUFSTAT 0x021e
  173. #define DC_EPMAXPKTSZ 0x0204
  174. #define DC_EPTYPE 0x0208
  175. #define DC_NOEMPKT (1 << 4)
  176. #define DC_EPENABLE (1 << 3)
  177. #define DC_DBLBUF (1 << 2)
  178. #define DC_ENDPTYP_ISOC (1 << 0)
  179. #define DC_ENDPTYP_BULK (2 << 0)
  180. #define DC_ENDPTYP_INTERRUPT (3 << 0)
  181. /* DMA Registers */
  182. #define DC_DMACMD 0x0230
  183. #define DC_DMATXCOUNT 0x0234
  184. #define DC_DMACONF 0x0238
  185. #define DC_DMAHW 0x023c
  186. #define DC_DMAINTREASON 0x0250
  187. #define DC_DMAINTEN 0x0254
  188. #define DC_DMAEP 0x0258
  189. #define DC_DMABURSTCOUNT 0x0264
  190. /* General Registers */
  191. #define DC_INTERRUPT 0x0218
  192. #define DC_CHIPID 0x0270
  193. #define DC_FRAMENUM 0x0274
  194. #define DC_SCRATCH 0x0278
  195. #define DC_UNLOCKDEV 0x027c
  196. #define DC_INTPULSEWIDTH 0x0280
  197. #define DC_TESTMODE 0x0284
  198. #endif