bits.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * bits.h - register bits of the ChipIdea USB IP core
  4. *
  5. * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved.
  6. *
  7. * Author: David Lopo
  8. */
  9. #ifndef __DRIVERS_USB_CHIPIDEA_BITS_H
  10. #define __DRIVERS_USB_CHIPIDEA_BITS_H
  11. #include <linux/usb/ehci_def.h>
  12. /*
  13. * ID
  14. * For 1.x revision, bit24 - bit31 are reserved
  15. * For 2.x revision, bit25 - bit28 are 0x2
  16. */
  17. #define TAG (0x1F << 16)
  18. #define REVISION (0xF << 21)
  19. #define VERSION (0xF << 25)
  20. #define CIVERSION (0x7 << 29)
  21. /* SBUSCFG */
  22. #define AHBBRST_MASK 0x7
  23. /* HCCPARAMS */
  24. #define HCCPARAMS_LEN BIT(17)
  25. /* DCCPARAMS */
  26. #define DCCPARAMS_DEN (0x1F << 0)
  27. #define DCCPARAMS_DC BIT(7)
  28. #define DCCPARAMS_HC BIT(8)
  29. /* TESTMODE */
  30. #define TESTMODE_FORCE BIT(0)
  31. /* USBCMD */
  32. #define USBCMD_RS BIT(0)
  33. #define USBCMD_RST BIT(1)
  34. #define USBCMD_SUTW BIT(13)
  35. #define USBCMD_ATDTW BIT(14)
  36. /* USBSTS & USBINTR */
  37. #define USBi_UI BIT(0)
  38. #define USBi_UEI BIT(1)
  39. #define USBi_PCI BIT(2)
  40. #define USBi_URI BIT(6)
  41. #define USBi_SLI BIT(8)
  42. /* DEVICEADDR */
  43. #define DEVICEADDR_USBADRA BIT(24)
  44. #define DEVICEADDR_USBADR (0x7FUL << 25)
  45. /* TTCTRL */
  46. #define TTCTRL_TTHA_MASK (0x7fUL << 24)
  47. /* Set non-zero value for internal TT Hub address representation */
  48. #define TTCTRL_TTHA (0x7fUL << 24)
  49. /* BURSTSIZE */
  50. #define RX_BURST_MASK 0xff
  51. #define TX_BURST_MASK 0xff00
  52. /* PORTSC */
  53. #define PORTSC_CCS BIT(0)
  54. #define PORTSC_CSC BIT(1)
  55. #define PORTSC_PEC BIT(3)
  56. #define PORTSC_OCC BIT(5)
  57. #define PORTSC_FPR BIT(6)
  58. #define PORTSC_SUSP BIT(7)
  59. #define PORTSC_HSP BIT(9)
  60. #define PORTSC_PP BIT(12)
  61. #define PORTSC_PTC (0x0FUL << 16)
  62. #define PORTSC_WKCN BIT(20)
  63. #define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23))
  64. /* PTS and PTW for non lpm version only */
  65. #define PORTSC_PFSC BIT(24)
  66. #define PORTSC_PTS(d) \
  67. (u32)((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0))
  68. #define PORTSC_PTW BIT(28)
  69. #define PORTSC_STS BIT(29)
  70. #define PORTSC_W1C_BITS \
  71. (PORTSC_CSC | PORTSC_PEC | PORTSC_OCC)
  72. /* DEVLC */
  73. #define DEVLC_PFSC BIT(23)
  74. #define DEVLC_PSPD (0x03UL << 25)
  75. #define DEVLC_PSPD_HS (0x02UL << 25)
  76. #define DEVLC_PTW BIT(27)
  77. #define DEVLC_STS BIT(28)
  78. #define DEVLC_PTS(d) (u32)(((d) & 0x7) << 29)
  79. /* Encoding for DEVLC_PTS and PORTSC_PTS */
  80. #define PTS_UTMI 0
  81. #define PTS_ULPI 2
  82. #define PTS_SERIAL 3
  83. #define PTS_HSIC 4
  84. /* OTGSC */
  85. #define OTGSC_IDPU BIT(5)
  86. #define OTGSC_HADP BIT(6)
  87. #define OTGSC_HABA BIT(7)
  88. #define OTGSC_ID BIT(8)
  89. #define OTGSC_AVV BIT(9)
  90. #define OTGSC_ASV BIT(10)
  91. #define OTGSC_BSV BIT(11)
  92. #define OTGSC_BSE BIT(12)
  93. #define OTGSC_IDIS BIT(16)
  94. #define OTGSC_AVVIS BIT(17)
  95. #define OTGSC_ASVIS BIT(18)
  96. #define OTGSC_BSVIS BIT(19)
  97. #define OTGSC_BSEIS BIT(20)
  98. #define OTGSC_1MSIS BIT(21)
  99. #define OTGSC_DPIS BIT(22)
  100. #define OTGSC_IDIE BIT(24)
  101. #define OTGSC_AVVIE BIT(25)
  102. #define OTGSC_ASVIE BIT(26)
  103. #define OTGSC_BSVIE BIT(27)
  104. #define OTGSC_BSEIE BIT(28)
  105. #define OTGSC_1MSIE BIT(29)
  106. #define OTGSC_DPIE BIT(30)
  107. #define OTGSC_INT_EN_BITS (OTGSC_IDIE | OTGSC_AVVIE | OTGSC_ASVIE \
  108. | OTGSC_BSVIE | OTGSC_BSEIE | OTGSC_1MSIE \
  109. | OTGSC_DPIE)
  110. #define OTGSC_INT_STATUS_BITS (OTGSC_IDIS | OTGSC_AVVIS | OTGSC_ASVIS \
  111. | OTGSC_BSVIS | OTGSC_BSEIS | OTGSC_1MSIS \
  112. | OTGSC_DPIS)
  113. /* USBMODE */
  114. #define USBMODE_CM (0x03UL << 0)
  115. #define USBMODE_CM_DC (0x02UL << 0)
  116. #define USBMODE_SLOM BIT(3)
  117. #define USBMODE_CI_SDIS BIT(4)
  118. /* ENDPTCTRL */
  119. #define ENDPTCTRL_RXS BIT(0)
  120. #define ENDPTCTRL_RXT (0x03UL << 2)
  121. #define ENDPTCTRL_RXR BIT(6) /* reserved for port 0 */
  122. #define ENDPTCTRL_RXE BIT(7)
  123. #define ENDPTCTRL_TXS BIT(16)
  124. #define ENDPTCTRL_TXT (0x03UL << 18)
  125. #define ENDPTCTRL_TXR BIT(22) /* reserved for port 0 */
  126. #define ENDPTCTRL_TXE BIT(23)
  127. #endif /* __DRIVERS_USB_CHIPIDEA_BITS_H */