ehci-omap.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * OMAP EHCI port support
  4. * Based on LINUX KERNEL
  5. * drivers/usb/host/ehci-omap.c and drivers/mfd/omap-usb-host.c
  6. *
  7. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com*
  8. * Author: Govindraj R <govindraj.raja@ti.com>
  9. */
  10. #ifndef _OMAP_COMMON_EHCI_H_
  11. #define _OMAP_COMMON_EHCI_H_
  12. enum usbhs_omap_port_mode {
  13. OMAP_USBHS_PORT_MODE_UNUSED,
  14. OMAP_EHCI_PORT_MODE_PHY,
  15. OMAP_EHCI_PORT_MODE_TLL,
  16. OMAP_EHCI_PORT_MODE_HSIC,
  17. };
  18. #define OMAP_HS_USB_PORTS 3
  19. #define is_ehci_phy_mode(x) ((x) == OMAP_EHCI_PORT_MODE_PHY)
  20. #define is_ehci_tll_mode(x) ((x) == OMAP_EHCI_PORT_MODE_TLL)
  21. #define is_ehci_hsic_mode(x) ((x) == OMAP_EHCI_PORT_MODE_HSIC)
  22. /* Values of UHH_REVISION - Note: these are not given in the TRM */
  23. #define OMAP_USBHS_REV1 0x00000010 /* OMAP3 */
  24. #define OMAP_USBHS_REV2 0x50700100 /* OMAP4 */
  25. #define OMAP_USBHS_REV2_1 0x50700101 /* OMAP5 */
  26. /* UHH Register Set */
  27. #define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN (1 << 2)
  28. #define OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN (1 << 3)
  29. #define OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN (1 << 4)
  30. #define OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN (1 << 5)
  31. #define OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS 1
  32. #define OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS (1 << 11)
  33. #define OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS (1 << 12)
  34. #define OMAP4_UHH_HOSTCONFIG_APP_START_CLK (1 << 31)
  35. #define OMAP_P1_MODE_CLEAR (3 << 16)
  36. #define OMAP_P1_MODE_TLL (1 << 16)
  37. #define OMAP_P1_MODE_HSIC (3 << 16)
  38. #define OMAP_P2_MODE_CLEAR (3 << 18)
  39. #define OMAP_P2_MODE_TLL (1 << 18)
  40. #define OMAP_P2_MODE_HSIC (3 << 18)
  41. #define OMAP_P3_MODE_CLEAR (3 << 20)
  42. #define OMAP_P3_MODE_HSIC (3 << 20)
  43. /* EHCI Register Set */
  44. #define EHCI_INSNREG04_DISABLE_UNSUSPEND (1 << 5)
  45. #define EHCI_INSNREG05_ULPI_CONTROL_SHIFT 31
  46. #define EHCI_INSNREG05_ULPI_PORTSEL_SHIFT 24
  47. #define EHCI_INSNREG05_ULPI_OPSEL_SHIFT 22
  48. #define EHCI_INSNREG05_ULPI_REGADD_SHIFT 16
  49. #define OMAP_REV1_TLL_CHANNEL_COUNT 3
  50. #define OMAP_REV2_TLL_CHANNEL_COUNT 2
  51. /* TLL Register Set */
  52. #define OMAP_TLL_CHANNEL_CONF(num) (0x004 * num)
  53. #define OMAP_TLL_CHANNEL_CONF_DRVVBUS (1 << 16)
  54. #define OMAP_TLL_CHANNEL_CONF_CHRGVBUS (1 << 15)
  55. #define OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF (1 << 11)
  56. #define OMAP_TLL_CHANNEL_CONF_CHANMODE_TRANSPARENT_UTMI (2 << 1)
  57. #define OMAP_TLL_CHANNEL_CONF_CHANEN 1
  58. struct omap_usbhs_board_data {
  59. enum usbhs_omap_port_mode port_mode[OMAP_HS_USB_PORTS];
  60. };
  61. struct omap_usbtll {
  62. u32 rev; /* 0x00 */
  63. u32 hwinfo; /* 0x04 */
  64. u8 reserved1[0x8];
  65. u32 sysc; /* 0x10 */
  66. u32 syss; /* 0x14 */
  67. u32 irqst; /* 0x18 */
  68. u32 irqen; /* 0x1c */
  69. u8 reserved2[0x10];
  70. u32 shared_conf; /* 0x30 */
  71. u8 reserved3[0xc];
  72. u32 channel_conf; /* 0x40 */
  73. };
  74. struct omap_uhh {
  75. u32 rev; /* 0x00 */
  76. u32 hwinfo; /* 0x04 */
  77. u8 reserved1[0x8];
  78. u32 sysc; /* 0x10 */
  79. u32 syss; /* 0x14 */
  80. u8 reserved2[0x28];
  81. u32 hostconfig; /* 0x40 */
  82. u32 debugcsr; /* 0x44 */
  83. };
  84. struct omap_ehci {
  85. u32 hccapbase; /* 0x00 */
  86. u32 hcsparams; /* 0x04 */
  87. u32 hccparams; /* 0x08 */
  88. u8 reserved1[0x04];
  89. u32 usbcmd; /* 0x10 */
  90. u32 usbsts; /* 0x14 */
  91. u32 usbintr; /* 0x18 */
  92. u32 frindex; /* 0x1c */
  93. u32 ctrldssegment; /* 0x20 */
  94. u32 periodiclistbase; /* 0x24 */
  95. u32 asysnclistaddr; /* 0x28 */
  96. u8 reserved2[0x24];
  97. u32 configflag; /* 0x50 */
  98. u32 portsc_i; /* 0x54 */
  99. u8 reserved3[0x38];
  100. u32 insreg00; /* 0x90 */
  101. u32 insreg01; /* 0x94 */
  102. u32 insreg02; /* 0x98 */
  103. u32 insreg03; /* 0x9c */
  104. u32 insreg04; /* 0xa0 */
  105. u32 insreg05_utmi_ulpi; /* 0xa4 */
  106. u32 insreg06; /* 0xa8 */
  107. u32 insreg07; /* 0xac */
  108. u32 insreg08; /* 0xb0 */
  109. };
  110. #if !CONFIG_IS_ENABLED(DM_USB) || !CONFIG_IS_ENABLED(OF_CONTROL)
  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
  121. #endif /* _OMAP_COMMON_EHCI_H_ */