ehci-fsl.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /*
  2. * Copyright (c) 2005, 2009 Freescale Semiconductor, Inc
  3. * Copyright (c) 2005 MontaVista Software
  4. * Copyright (c) 2008 Excito Elektronik i Sk=E5ne AB
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 2 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  19. * MA 02111-1307 USA
  20. */
  21. #ifndef _EHCI_FSL_H
  22. #define _EHCI_FSL_H
  23. #include <asm/processor.h>
  24. /* Global offsets */
  25. #define FSL_SKIP_PCI 0x100
  26. /* offsets for the non-ehci registers in the FSL SOC USB controller */
  27. #define FSL_SOC_USB_ULPIVP 0x170
  28. #define FSL_SOC_USB_PORTSC1 0x184
  29. #define PORT_PTS_MSK (3 << 30)
  30. #define PORT_PTS_UTMI (0 << 30)
  31. #define PORT_PTS_ULPI (2 << 30)
  32. #define PORT_PTS_SERIAL (3 << 30)
  33. #define PORT_PTS_PTW (1 << 28)
  34. #define PORT_PFSC (1 << 24) /* Defined on Page 39-44 of the mpc5151 ERM */
  35. #define PORT_PTS_PHCD (1 << 23)
  36. #define PORT_PP (1 << 12)
  37. #define PORT_PR (1 << 8)
  38. /* USBMODE Register bits */
  39. #define CM_IDLE (0 << 0)
  40. #define CM_RESERVED (1 << 0)
  41. #define CM_DEVICE (2 << 0)
  42. #define CM_HOST (3 << 0)
  43. #define ES_BE (1 << 2) /* Big Endian Select, default is LE */
  44. #define USBMODE_RESERVED_2 (0 << 2)
  45. #define SLOM (1 << 3)
  46. #define SDIS (1 << 4)
  47. /* CONTROL Register bits */
  48. #define ULPI_INT_EN (1 << 0)
  49. #define WU_INT_EN (1 << 1)
  50. #define USB_EN (1 << 2)
  51. #define LSF_EN (1 << 3)
  52. #define KEEP_OTG_ON (1 << 4)
  53. #define OTG_PORT (1 << 5)
  54. #define REFSEL_12MHZ (0 << 6)
  55. #define REFSEL_16MHZ (1 << 6)
  56. #define REFSEL_48MHZ (2 << 6)
  57. #define PLL_RESET (1 << 8)
  58. #define UTMI_PHY_EN (1 << 9)
  59. #define PHY_CLK_SEL_UTMI (0 << 10)
  60. #define PHY_CLK_SEL_ULPI (1 << 10)
  61. #define CLKIN_SEL_USB_CLK (0 << 11)
  62. #define CLKIN_SEL_USB_CLK2 (1 << 11)
  63. #define CLKIN_SEL_SYS_CLK (2 << 11)
  64. #define CLKIN_SEL_SYS_CLK2 (3 << 11)
  65. #define RESERVED_18 (0 << 13)
  66. #define RESERVED_17 (0 << 14)
  67. #define RESERVED_16 (0 << 15)
  68. #define WU_INT (1 << 16)
  69. #define PHY_CLK_VALID (1 << 17)
  70. #define FSL_SOC_USB_PORTSC2 0x188
  71. /* OTG Status Control Register bits */
  72. #define FSL_SOC_USB_OTGSC 0x1a4
  73. #define CTRL_VBUS_DISCHARGE (0x1<<0)
  74. #define CTRL_VBUS_CHARGE (0x1<<1)
  75. #define CTRL_OTG_TERMINATION (0x1<<3)
  76. #define CTRL_DATA_PULSING (0x1<<4)
  77. #define CTRL_ID_PULL_EN (0x1<<5)
  78. #define HA_DATA_PULSE (0x1<<6)
  79. #define HA_BA (0x1<<7)
  80. #define STS_USB_ID (0x1<<8)
  81. #define STS_A_VBUS_VALID (0x1<<9)
  82. #define STS_A_SESSION_VALID (0x1<<10)
  83. #define STS_B_SESSION_VALID (0x1<<11)
  84. #define STS_B_SESSION_END (0x1<<12)
  85. #define STS_1MS_TOGGLE (0x1<<13)
  86. #define STS_DATA_PULSING (0x1<<14)
  87. #define INTSTS_USB_ID (0x1<<16)
  88. #define INTSTS_A_VBUS_VALID (0x1<<17)
  89. #define INTSTS_A_SESSION_VALID (0x1<<18)
  90. #define INTSTS_B_SESSION_VALID (0x1<<19)
  91. #define INTSTS_B_SESSION_END (0x1<<20)
  92. #define INTSTS_1MS (0x1<<21)
  93. #define INTSTS_DATA_PULSING (0x1<<22)
  94. #define INTR_USB_ID_EN (0x1<<24)
  95. #define INTR_A_VBUS_VALID_EN (0x1<<25)
  96. #define INTR_A_SESSION_VALID_EN (0x1<<26)
  97. #define INTR_B_SESSION_VALID_EN (0x1<<27)
  98. #define INTR_B_SESSION_END_EN (0x1<<28)
  99. #define INTR_1MS_TIMER_EN (0x1<<29)
  100. #define INTR_DATA_PULSING_EN (0x1<<30)
  101. #define INTSTS_MASK (0x00ff0000)
  102. /* USBCMD Bits of interest */
  103. #define EHCI_FSL_USBCMD_RST (1 << 1)
  104. #define EHCI_FSL_USBCMD_RS (1 << 0)
  105. #define INTERRUPT_ENABLE_BITS_MASK \
  106. (INTR_USB_ID_EN | \
  107. INTR_1MS_TIMER_EN | \
  108. INTR_A_VBUS_VALID_EN | \
  109. INTR_A_SESSION_VALID_EN | \
  110. INTR_B_SESSION_VALID_EN | \
  111. INTR_B_SESSION_END_EN | \
  112. INTR_DATA_PULSING_EN)
  113. #define INTERRUPT_STATUS_BITS_MASK \
  114. (INTSTS_USB_ID | \
  115. INTR_1MS_TIMER_EN | \
  116. INTSTS_A_VBUS_VALID | \
  117. INTSTS_A_SESSION_VALID | \
  118. INTSTS_B_SESSION_VALID | \
  119. INTSTS_B_SESSION_END | \
  120. INTSTS_DATA_PULSING)
  121. #define FSL_SOC_USB_USBMODE 0x1a8
  122. #define USBGENCTRL 0x200 /* NOTE: big endian */
  123. #define GC_WU_INT_CLR (1 << 5) /* Wakeup int clear */
  124. #define GC_ULPI_SEL (1 << 4) /* ULPI i/f select (usb0 only)*/
  125. #define GC_PPP (1 << 3) /* Port Power Polarity */
  126. #define GC_PFP (1 << 2) /* Power Fault Polarity */
  127. #define GC_WU_ULPI_EN (1 << 1) /* Wakeup on ULPI event */
  128. #define GC_WU_IE (1 << 1) /* Wakeup interrupt enable */
  129. #define ISIPHYCTRL 0x204 /* NOTE: big endian */
  130. #define PHYCTRL_PHYE (1 << 4) /* On-chip UTMI PHY enable */
  131. #define PHYCTRL_BSENH (1 << 3) /* Bit Stuff Enable High */
  132. #define PHYCTRL_BSEN (1 << 2) /* Bit Stuff Enable */
  133. #define PHYCTRL_LSFE (1 << 1) /* Line State Filter Enable */
  134. #define PHYCTRL_PXE (1 << 0) /* PHY oscillator enable */
  135. #define FSL_SOC_USB_SNOOP1 0x400 /* NOTE: big-endian */
  136. #define FSL_SOC_USB_SNOOP2 0x404 /* NOTE: big-endian */
  137. #define FSL_SOC_USB_AGECNTTHRSH 0x408 /* NOTE: big-endian */
  138. #define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */
  139. #define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */
  140. #define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */
  141. #define SNOOP_SIZE_2GB 0x1e
  142. /* System Clock Control Register */
  143. #define MPC83XX_SCCR_USB_MASK 0x00f00000
  144. #define MPC83XX_SCCR_USB_DRCM_11 0x00300000
  145. #define MPC83XX_SCCR_USB_DRCM_01 0x00100000
  146. #define MPC83XX_SCCR_USB_DRCM_10 0x00200000
  147. #if defined(CONFIG_MPC83XX)
  148. #define CONFIG_SYS_FSL_USB_ADDR CONFIG_SYS_MPC83xx_USB_ADDR
  149. #elif defined(CONFIG_MPC85xx)
  150. #define CONFIG_SYS_FSL_USB_ADDR CONFIG_SYS_MPC85xx_USB_ADDR
  151. #elif defined(CONFIG_MPC512X)
  152. #define CONFIG_SYS_FSL_USB_ADDR CONFIG_SYS_MPC512x_USB_ADDR
  153. #endif
  154. /*
  155. * USB Registers
  156. */
  157. struct usb_ehci {
  158. u32 id; /* 0x000 - Identification register */
  159. u32 hwgeneral; /* 0x004 - General hardware parameters */
  160. u32 hwhost; /* 0x008 - Host hardware parameters */
  161. u32 hwdevice; /* 0x00C - Device hardware parameters */
  162. u32 hwtxbuf; /* 0x010 - TX buffer hardware parameters */
  163. u32 hwrxbuf; /* 0x014 - RX buffer hardware parameters */
  164. u8 res1[0x68];
  165. u32 gptimer0_ld; /* 0x080 - General Purpose Timer 0 load value */
  166. u32 gptimer0_ctrl; /* 0x084 - General Purpose Timer 0 control */
  167. u32 gptimer1_ld; /* 0x088 - General Purpose Timer 1 load value */
  168. u32 gptimer1_ctrl; /* 0x08C - General Purpose Timer 1 control */
  169. u32 sbuscfg; /* 0x090 - System Bus Interface Control */
  170. u8 res2[0x6C];
  171. u16 caplength; /* 0x100 - Capability Register Length */
  172. u16 hciversion; /* 0x102 - Host Interface Version */
  173. u32 hcsparams; /* 0x104 - Host Structural Parameters */
  174. u32 hccparams; /* 0x108 - Host Capability Parameters */
  175. u8 res3[0x14];
  176. u32 dciversion; /* 0x120 - Device Interface Version */
  177. u32 dciparams; /* 0x124 - Device Controller Params */
  178. u8 res4[0x18];
  179. u32 usbcmd; /* 0x140 - USB Command */
  180. u32 usbsts; /* 0x144 - USB Status */
  181. u32 usbintr; /* 0x148 - USB Interrupt Enable */
  182. u32 frindex; /* 0x14C - USB Frame Index */
  183. u8 res5[0x4];
  184. u32 perlistbase; /* 0x154 - Periodic List Base
  185. - USB Device Address */
  186. u32 ep_list_addr; /* 0x158 - Next Asynchronous List
  187. - End Point Address */
  188. u8 res6[0x4];
  189. u32 burstsize; /* 0x160 - Programmable Burst Size */
  190. #define FSL_EHCI_TXPBURST(X) ((X) << 8)
  191. #define FSL_EHCI_RXPBURST(X) (X)
  192. u32 txfilltuning; /* 0x164 - Host TT Transmit
  193. pre-buffer packet tuning */
  194. u8 res7[0x8];
  195. u32 ulpi_viewpoint; /* 0x170 - ULPI Reister Access */
  196. u8 res8[0xc];
  197. u32 config_flag; /* 0x180 - Configured Flag Register */
  198. u32 portsc; /* 0x184 - Port status/control */
  199. u8 res9[0x1C];
  200. u32 otgsc; /* 0x1a4 - Oo-The-Go status and control */
  201. u32 usbmode; /* 0x1a8 - USB Device Mode */
  202. u32 epsetupstat; /* 0x1ac - End Point Setup Status */
  203. u32 epprime; /* 0x1b0 - End Point Init Status */
  204. u32 epflush; /* 0x1b4 - End Point De-initlialize */
  205. u32 epstatus; /* 0x1b8 - End Point Status */
  206. u32 epcomplete; /* 0x1bc - End Point Complete */
  207. u32 epctrl0; /* 0x1c0 - End Point Control 0 */
  208. u32 epctrl1; /* 0x1c4 - End Point Control 1 */
  209. u32 epctrl2; /* 0x1c8 - End Point Control 2 */
  210. u32 epctrl3; /* 0x1cc - End Point Control 3 */
  211. u32 epctrl4; /* 0x1d0 - End Point Control 4 */
  212. u32 epctrl5; /* 0x1d4 - End Point Control 5 */
  213. u8 res10[0x28];
  214. u32 usbgenctrl; /* 0x200 - USB General Control */
  215. u32 isiphyctrl; /* 0x204 - On-Chip PHY Control */
  216. u8 res11[0x1F8];
  217. u32 snoop1; /* 0x400 - Snoop 1 */
  218. u32 snoop2; /* 0x404 - Snoop 2 */
  219. u32 age_cnt_limit; /* 0x408 - Age Count Threshold */
  220. u32 prictrl; /* 0x40c - Priority Control */
  221. u32 sictrl; /* 0x410 - System Interface Control */
  222. u8 res12[0xEC];
  223. u32 control; /* 0x500 - Control */
  224. u8 res13[0xafc];
  225. };
  226. #endif /* _EHCI_FSL_H */