ehci-omap.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. * SPDX-License-Identifier: GPL-2.0
  10. */
  11. #ifndef _OMAP_COMMON_EHCI_H_
  12. #define _OMAP_COMMON_EHCI_H_
  13. enum usbhs_omap_port_mode {
  14. OMAP_USBHS_PORT_MODE_UNUSED,
  15. OMAP_EHCI_PORT_MODE_PHY,
  16. OMAP_EHCI_PORT_MODE_TLL,
  17. OMAP_EHCI_PORT_MODE_HSIC,
  18. };
  19. #define OMAP_HS_USB_PORTS 3
  20. #define is_ehci_phy_mode(x) ((x) == OMAP_EHCI_PORT_MODE_PHY)
  21. #define is_ehci_tll_mode(x) ((x) == OMAP_EHCI_PORT_MODE_TLL)
  22. #define is_ehci_hsic_mode(x) ((x) == OMAP_EHCI_PORT_MODE_HSIC)
  23. /* Values of UHH_REVISION - Note: these are not given in the TRM */
  24. #define OMAP_USBHS_REV1 0x00000010 /* OMAP3 */
  25. #define OMAP_USBHS_REV2 0x50700100 /* OMAP4 */
  26. #define OMAP_USBHS_REV2_1 0x50700101 /* OMAP5 */
  27. /* UHH Register Set */
  28. #define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN (1 << 2)
  29. #define OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN (1 << 3)
  30. #define OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN (1 << 4)
  31. #define OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN (1 << 5)
  32. #define OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS 1
  33. #define OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS (1 << 11)
  34. #define OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS (1 << 12)
  35. #define OMAP4_UHH_HOSTCONFIG_APP_START_CLK (1 << 31)
  36. #define OMAP_P1_MODE_CLEAR (3 << 16)
  37. #define OMAP_P1_MODE_TLL (1 << 16)
  38. #define OMAP_P1_MODE_HSIC (3 << 16)
  39. #define OMAP_P2_MODE_CLEAR (3 << 18)
  40. #define OMAP_P2_MODE_TLL (1 << 18)
  41. #define OMAP_P2_MODE_HSIC (3 << 18)
  42. #define OMAP_P3_MODE_CLEAR (3 << 20)
  43. #define OMAP_P3_MODE_HSIC (3 << 20)
  44. /* EHCI Register Set */
  45. #define EHCI_INSNREG04_DISABLE_UNSUSPEND (1 << 5)
  46. #define EHCI_INSNREG05_ULPI_CONTROL_SHIFT 31
  47. #define EHCI_INSNREG05_ULPI_PORTSEL_SHIFT 24
  48. #define EHCI_INSNREG05_ULPI_OPSEL_SHIFT 22
  49. #define EHCI_INSNREG05_ULPI_REGADD_SHIFT 16
  50. #define OMAP_REV1_TLL_CHANNEL_COUNT 3
  51. #define OMAP_REV2_TLL_CHANNEL_COUNT 2
  52. /* TLL Register Set */
  53. #define OMAP_TLL_CHANNEL_CONF(num) (0x004 * num)
  54. #define OMAP_TLL_CHANNEL_CONF_DRVVBUS (1 << 16)
  55. #define OMAP_TLL_CHANNEL_CONF_CHRGVBUS (1 << 15)
  56. #define OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF (1 << 11)
  57. #define OMAP_TLL_CHANNEL_CONF_CHANMODE_TRANSPARENT_UTMI (2 << 1)
  58. #define OMAP_TLL_CHANNEL_CONF_CHANEN 1
  59. struct omap_usbhs_board_data {
  60. enum usbhs_omap_port_mode port_mode[OMAP_HS_USB_PORTS];
  61. };
  62. struct omap_usbtll {
  63. u32 rev; /* 0x00 */
  64. u32 hwinfo; /* 0x04 */
  65. u8 reserved1[0x8];
  66. u32 sysc; /* 0x10 */
  67. u32 syss; /* 0x14 */
  68. u32 irqst; /* 0x18 */
  69. u32 irqen; /* 0x1c */
  70. u8 reserved2[0x10];
  71. u32 shared_conf; /* 0x30 */
  72. u8 reserved3[0xc];
  73. u32 channel_conf; /* 0x40 */
  74. };
  75. struct omap_uhh {
  76. u32 rev; /* 0x00 */
  77. u32 hwinfo; /* 0x04 */
  78. u8 reserved1[0x8];
  79. u32 sysc; /* 0x10 */
  80. u32 syss; /* 0x14 */
  81. u8 reserved2[0x28];
  82. u32 hostconfig; /* 0x40 */
  83. u32 debugcsr; /* 0x44 */
  84. };
  85. struct omap_ehci {
  86. u32 hccapbase; /* 0x00 */
  87. u32 hcsparams; /* 0x04 */
  88. u32 hccparams; /* 0x08 */
  89. u8 reserved1[0x04];
  90. u32 usbcmd; /* 0x10 */
  91. u32 usbsts; /* 0x14 */
  92. u32 usbintr; /* 0x18 */
  93. u32 frindex; /* 0x1c */
  94. u32 ctrldssegment; /* 0x20 */
  95. u32 periodiclistbase; /* 0x24 */
  96. u32 asysnclistaddr; /* 0x28 */
  97. u8 reserved2[0x24];
  98. u32 configflag; /* 0x50 */
  99. u32 portsc_i; /* 0x54 */
  100. u8 reserved3[0x38];
  101. u32 insreg00; /* 0x90 */
  102. u32 insreg01; /* 0x94 */
  103. u32 insreg02; /* 0x98 */
  104. u32 insreg03; /* 0x9c */
  105. u32 insreg04; /* 0xa0 */
  106. u32 insreg05_utmi_ulpi; /* 0xa4 */
  107. u32 insreg06; /* 0xa8 */
  108. u32 insreg07; /* 0xac */
  109. u32 insreg08; /* 0xb0 */
  110. };
  111. /*
  112. * FIXME: forward declaration of this structs needed because omap got the
  113. * ehci implementation backwards. move out ehci_hcd_x from board files
  114. */
  115. struct ehci_hccr;
  116. struct ehci_hcor;
  117. int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata,
  118. struct ehci_hccr **hccr, struct ehci_hcor **hcor);
  119. int omap_ehci_hcd_stop(void);
  120. #endif /* _OMAP_COMMON_EHCI_H_ */