ehci-omap.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * OMAP EHCI port support
  3. * Based on LINUX KERNEL
  4. * drivers/usb/host/ehci-omap.c and drivers/mfd/omap-usb-host.c
  5. *
  6. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com*
  7. * Author: Govindraj R <govindraj.raja@ti.com>
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 of
  11. * the License as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef _OMAP_COMMON_EHCI_H_
  22. #define _OMAP_COMMON_EHCI_H_
  23. enum usbhs_omap_port_mode {
  24. OMAP_USBHS_PORT_MODE_UNUSED,
  25. OMAP_EHCI_PORT_MODE_PHY,
  26. OMAP_EHCI_PORT_MODE_TLL,
  27. OMAP_EHCI_PORT_MODE_HSIC,
  28. };
  29. #ifdef CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS
  30. #define OMAP_HS_USB_PORTS CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS
  31. #else
  32. #define OMAP_HS_USB_PORTS 3
  33. #endif
  34. #define is_ehci_phy_mode(x) ((x) == OMAP_EHCI_PORT_MODE_PHY)
  35. #define is_ehci_tll_mode(x) ((x) == OMAP_EHCI_PORT_MODE_TLL)
  36. #define is_ehci_hsic_mode(x) ((x) == OMAP_EHCI_PORT_MODE_HSIC)
  37. /* Values of UHH_REVISION - Note: these are not given in the TRM */
  38. #define OMAP_USBHS_REV1 0x00000010 /* OMAP3 */
  39. #define OMAP_USBHS_REV2 0x50700100 /* OMAP4 */
  40. /* UHH Register Set */
  41. #define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN (1 << 2)
  42. #define OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN (1 << 3)
  43. #define OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN (1 << 4)
  44. #define OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN (1 << 5)
  45. #define OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS 1
  46. #define OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS (1 << 11)
  47. #define OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS (1 << 12)
  48. #define OMAP4_UHH_HOSTCONFIG_APP_START_CLK (1 << 31)
  49. #define OMAP_P1_MODE_CLEAR (3 << 16)
  50. #define OMAP_P1_MODE_TLL (1 << 16)
  51. #define OMAP_P1_MODE_HSIC (3 << 16)
  52. #define OMAP_P2_MODE_CLEAR (3 << 18)
  53. #define OMAP_P2_MODE_TLL (1 << 18)
  54. #define OMAP_P2_MODE_HSIC (3 << 18)
  55. #define OMAP_P3_MODE_HSIC (3 << 20)
  56. /* EHCI Register Set */
  57. #define EHCI_INSNREG04_DISABLE_UNSUSPEND (1 << 5)
  58. #define EHCI_INSNREG05_ULPI_CONTROL_SHIFT 31
  59. #define EHCI_INSNREG05_ULPI_PORTSEL_SHIFT 24
  60. #define EHCI_INSNREG05_ULPI_OPSEL_SHIFT 22
  61. #define EHCI_INSNREG05_ULPI_REGADD_SHIFT 16
  62. #define OMAP_REV1_TLL_CHANNEL_COUNT 3
  63. #define OMAP_REV2_TLL_CHANNEL_COUNT 2
  64. /* TLL Register Set */
  65. #define OMAP_TLL_CHANNEL_CONF(num) (0x004 * num)
  66. #define OMAP_TLL_CHANNEL_CONF_DRVVBUS (1 << 16)
  67. #define OMAP_TLL_CHANNEL_CONF_CHRGVBUS (1 << 15)
  68. #define OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF (1 << 11)
  69. #define OMAP_TLL_CHANNEL_CONF_CHANMODE_TRANSPARENT_UTMI (2 << 1)
  70. #define OMAP_TLL_CHANNEL_CONF_CHANEN 1
  71. struct omap_usbhs_board_data {
  72. enum usbhs_omap_port_mode port_mode[OMAP_HS_USB_PORTS];
  73. };
  74. struct omap_usbtll {
  75. u32 rev; /* 0x00 */
  76. u32 hwinfo; /* 0x04 */
  77. u8 reserved1[0x8];
  78. u32 sysc; /* 0x10 */
  79. u32 syss; /* 0x14 */
  80. u32 irqst; /* 0x18 */
  81. u32 irqen; /* 0x1c */
  82. u8 reserved2[0x10];
  83. u32 shared_conf; /* 0x30 */
  84. u8 reserved3[0xc];
  85. u32 channel_conf; /* 0x40 */
  86. };
  87. struct omap_uhh {
  88. u32 rev; /* 0x00 */
  89. u32 hwinfo; /* 0x04 */
  90. u8 reserved1[0x8];
  91. u32 sysc; /* 0x10 */
  92. u32 syss; /* 0x14 */
  93. u8 reserved2[0x28];
  94. u32 hostconfig; /* 0x40 */
  95. u32 debugcsr; /* 0x44 */
  96. };
  97. struct omap_ehci {
  98. u32 hccapbase; /* 0x00 */
  99. u32 hcsparams; /* 0x04 */
  100. u32 hccparams; /* 0x08 */
  101. u8 reserved1[0x04];
  102. u32 usbcmd; /* 0x10 */
  103. u32 usbsts; /* 0x14 */
  104. u32 usbintr; /* 0x18 */
  105. u32 frindex; /* 0x1c */
  106. u32 ctrldssegment; /* 0x20 */
  107. u32 periodiclistbase; /* 0x24 */
  108. u32 asysnclistaddr; /* 0x28 */
  109. u8 reserved2[0x24];
  110. u32 configflag; /* 0x50 */
  111. u32 portsc_i; /* 0x54 */
  112. u8 reserved3[0x38];
  113. u32 insreg00; /* 0x90 */
  114. u32 insreg01; /* 0x94 */
  115. u32 insreg02; /* 0x98 */
  116. u32 insreg03; /* 0x9c */
  117. u32 insreg04; /* 0xa0 */
  118. u32 insreg05_utmi_ulpi; /* 0xa4 */
  119. u32 insreg06; /* 0xa8 */
  120. u32 insreg07; /* 0xac */
  121. u32 insreg08; /* 0xb0 */
  122. };
  123. /*
  124. * FIXME: forward declaration of this structs needed because omap got the
  125. * ehci implementation backwards. move out ehci_hcd_x from board files
  126. */
  127. struct ehci_hccr;
  128. struct ehci_hcor;
  129. int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata,
  130. struct ehci_hccr **hccr, struct ehci_hcor **hcor);
  131. int omap_ehci_hcd_stop(void);
  132. #endif /* _OMAP_COMMON_EHCI_H_ */