msm_serial_hs_hwreg.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. /* drivers/serial/msm_serial_hs_hwreg.h
  2. *
  3. * Copyright (c) 2007-2009, 2012-2014,The Linux Foundation. All rights reserved.
  4. *
  5. * All source code in this file is licensed under the following license
  6. * except where indicated.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you can find it at http://www.fsf.org
  19. */
  20. #ifndef MSM_SERIAL_HS_HWREG_H
  21. #define MSM_SERIAL_HS_HWREG_H
  22. #define GSBI_CONTROL_ADDR 0x0
  23. #define GSBI_PROTOCOL_CODE_MASK 0x30
  24. #define GSBI_PROTOCOL_I2C_UART 0x60
  25. #define GSBI_PROTOCOL_UART 0x40
  26. #define GSBI_PROTOCOL_IDLE 0x0
  27. #define TCSR_ADM_1_A_CRCI_MUX_SEL 0x78
  28. #define TCSR_ADM_1_B_CRCI_MUX_SEL 0x7C
  29. #define ADM1_CRCI_GSBI6_RX_SEL 0x800
  30. #define ADM1_CRCI_GSBI6_TX_SEL 0x400
  31. #define MSM_ENABLE_UART_CLOCK 13
  32. #define MSM_DISABLE_UART_CLOCK 14
  33. #define MSM_GET_UART_CLOCK_STATUS 15
  34. enum msm_hsl_regs {
  35. UARTDM_MR1,
  36. UARTDM_MR2,
  37. UARTDM_IMR,
  38. UARTDM_SR,
  39. UARTDM_CR,
  40. UARTDM_CSR,
  41. UARTDM_IPR,
  42. UARTDM_ISR,
  43. UARTDM_RX_TOTAL_SNAP,
  44. UARTDM_RFWR,
  45. UARTDM_TFWR,
  46. UARTDM_RF,
  47. UARTDM_TF,
  48. UARTDM_MISR,
  49. UARTDM_DMRX,
  50. UARTDM_NCF_TX,
  51. UARTDM_DMEN,
  52. UARTDM_BCR,
  53. UARTDM_TXFS,
  54. UARTDM_RXFS,
  55. UARTDM_LAST,
  56. };
  57. enum msm_hs_regs {
  58. UART_DM_MR1 = 0x0,
  59. UART_DM_MR2 = 0x4,
  60. UART_DM_IMR = 0xb0,
  61. UART_DM_SR = 0xa4,
  62. UART_DM_CR = 0xa8,
  63. UART_DM_CSR = 0xa0,
  64. UART_DM_IPR = 0x18,
  65. UART_DM_ISR = 0xb4,
  66. UART_DM_RX_TOTAL_SNAP = 0xbc,
  67. UART_DM_TFWR = 0x1c,
  68. UART_DM_RFWR = 0x20,
  69. UART_DM_RF = 0x140,
  70. UART_DM_TF = 0x100,
  71. UART_DM_MISR = 0xac,
  72. UART_DM_DMRX = 0x34,
  73. UART_DM_NCF_TX = 0x40,
  74. UART_DM_DMEN = 0x3c,
  75. UART_DM_TXFS = 0x4c,
  76. UART_DM_RXFS = 0x50,
  77. UART_DM_RX_TRANS_CTRL = 0xcc,
  78. UART_DM_BCR = 0xc8,
  79. };
  80. #define UARTDM_MR1_ADDR 0x0
  81. #define UARTDM_MR2_ADDR 0x4
  82. /* Backward Compatability Register for UARTDM Core v1.4 */
  83. #define UARTDM_BCR_ADDR 0xc8
  84. /*
  85. * UARTDM Core v1.4 STALE_IRQ_EMPTY bit defination
  86. * Stale interrupt will fire if bit is set when RX-FIFO is empty
  87. */
  88. #define UARTDM_BCR_TX_BREAK_DISABLE 0x1
  89. #define UARTDM_BCR_STALE_IRQ_EMPTY 0x2
  90. #define UARTDM_BCR_RX_DMRX_LOW_EN 0x4
  91. #define UARTDM_BCR_RX_STAL_IRQ_DMRX_EQL 0x10
  92. #define UARTDM_BCR_RX_DMRX_1BYTE_RES_EN 0x20
  93. /* TRANSFER_CONTROL Register for UARTDM Core v1.4 */
  94. #define UARTDM_RX_TRANS_CTRL_ADDR 0xcc
  95. /* TRANSFER_CONTROL Register bits */
  96. #define RX_STALE_AUTO_RE_EN 0x1
  97. #define RX_TRANS_AUTO_RE_ACTIVATE 0x2
  98. #define RX_DMRX_CYCLIC_EN 0x4
  99. /* write only register */
  100. #define UARTDM_CSR_115200 0xFF
  101. #define UARTDM_CSR_57600 0xEE
  102. #define UARTDM_CSR_38400 0xDD
  103. #define UARTDM_CSR_28800 0xCC
  104. #define UARTDM_CSR_19200 0xBB
  105. #define UARTDM_CSR_14400 0xAA
  106. #define UARTDM_CSR_9600 0x99
  107. #define UARTDM_CSR_7200 0x88
  108. #define UARTDM_CSR_4800 0x77
  109. #define UARTDM_CSR_3600 0x66
  110. #define UARTDM_CSR_2400 0x55
  111. #define UARTDM_CSR_1200 0x44
  112. #define UARTDM_CSR_600 0x33
  113. #define UARTDM_CSR_300 0x22
  114. #define UARTDM_CSR_150 0x11
  115. #define UARTDM_CSR_75 0x00
  116. /* write only register */
  117. #define UARTDM_IPR_ADDR 0x18
  118. #define UARTDM_TFWR_ADDR 0x1c
  119. #define UARTDM_RFWR_ADDR 0x20
  120. #define UARTDM_HCR_ADDR 0x24
  121. #define UARTDM_DMRX_ADDR 0x34
  122. #define UARTDM_DMEN_ADDR 0x3c
  123. /* UART_DM_NO_CHARS_FOR_TX */
  124. #define UARTDM_NCF_TX_ADDR 0x40
  125. #define UARTDM_BADR_ADDR 0x44
  126. #define UARTDM_SIM_CFG_ADDR 0x80
  127. /* Read Only register */
  128. #define UARTDM_TXFS_ADDR 0x4C
  129. #define UARTDM_RXFS_ADDR 0x50
  130. /* Register field Mask Mapping */
  131. #define UARTDM_SR_RX_BREAK_BMSK BIT(6)
  132. #define UARTDM_SR_PAR_FRAME_BMSK BIT(5)
  133. #define UARTDM_SR_OVERRUN_BMSK BIT(4)
  134. #define UARTDM_SR_TXEMT_BMSK BIT(3)
  135. #define UARTDM_SR_TXRDY_BMSK BIT(2)
  136. #define UARTDM_SR_RXRDY_BMSK BIT(0)
  137. #define UARTDM_CR_TX_DISABLE_BMSK BIT(3)
  138. #define UARTDM_CR_RX_DISABLE_BMSK BIT(1)
  139. #define UARTDM_CR_TX_EN_BMSK BIT(2)
  140. #define UARTDM_CR_RX_EN_BMSK BIT(0)
  141. /* UARTDM_CR channel_comman bit value (register field is bits 8:4) */
  142. #define RESET_RX 0x10
  143. #define RESET_TX 0x20
  144. #define RESET_ERROR_STATUS 0x30
  145. #define RESET_BREAK_INT 0x40
  146. #define START_BREAK 0x50
  147. #define STOP_BREAK 0x60
  148. #define RESET_CTS 0x70
  149. #define RESET_STALE_INT 0x80
  150. #define RFR_LOW 0xD0
  151. #define RFR_HIGH 0xE0
  152. #define CR_PROTECTION_EN 0x100
  153. #define STALE_EVENT_ENABLE 0x500
  154. #define STALE_EVENT_DISABLE 0x600
  155. #define FORCE_STALE_EVENT 0x400
  156. #define CLEAR_TX_READY 0x300
  157. #define RESET_TX_ERROR 0x800
  158. #define RESET_TX_DONE 0x810
  159. /*
  160. * UARTDM_CR BAM IFC comman bit value
  161. * for UARTDM Core v1.4
  162. */
  163. #define START_RX_BAM_IFC 0x850
  164. #define START_TX_BAM_IFC 0x860
  165. #define UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK 0xffffff00
  166. #define UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK 0x3f
  167. #define UARTDM_MR1_CTS_CTL_BMSK 0x40
  168. #define UARTDM_MR1_RX_RDY_CTL_BMSK 0x80
  169. /*
  170. * UARTDM Core v1.4 MR2_RFR_CTS_LOOP bitmask
  171. * Enables internal loopback between RFR_N of
  172. * RX channel and CTS_N of TX channel.
  173. */
  174. #define UARTDM_MR2_RFR_CTS_LOOP_MODE_BMSK 0x400
  175. #define UARTDM_MR2_LOOP_MODE_BMSK 0x80
  176. #define UARTDM_MR2_ERROR_MODE_BMSK 0x40
  177. #define UARTDM_MR2_BITS_PER_CHAR_BMSK 0x30
  178. #define UARTDM_MR2_RX_ZERO_CHAR_OFF 0x100
  179. #define UARTDM_MR2_RX_ERROR_CHAR_OFF 0x200
  180. #define UARTDM_MR2_RX_BREAK_ZERO_CHAR_OFF 0x100
  181. #define UARTDM_MR2_BITS_PER_CHAR_8 (0x3 << 4)
  182. /* bits per character configuration */
  183. #define FIVE_BPC (0 << 4)
  184. #define SIX_BPC (1 << 4)
  185. #define SEVEN_BPC (2 << 4)
  186. #define EIGHT_BPC (3 << 4)
  187. #define UARTDM_MR2_STOP_BIT_LEN_BMSK 0xc
  188. #define STOP_BIT_ONE (1 << 2)
  189. #define STOP_BIT_TWO (3 << 2)
  190. #define UARTDM_MR2_PARITY_MODE_BMSK 0x3
  191. /* Parity configuration */
  192. #define NO_PARITY 0x0
  193. #define EVEN_PARITY 0x2
  194. #define ODD_PARITY 0x1
  195. #define SPACE_PARITY 0x3
  196. #define UARTDM_IPR_STALE_TIMEOUT_MSB_BMSK 0xffffff80
  197. #define UARTDM_IPR_STALE_LSB_BMSK 0x1f
  198. /* These can be used for both ISR and IMR register */
  199. #define UARTDM_ISR_TX_READY_BMSK BIT(7)
  200. #define UARTDM_ISR_CURRENT_CTS_BMSK BIT(6)
  201. #define UARTDM_ISR_DELTA_CTS_BMSK BIT(5)
  202. #define UARTDM_ISR_RXLEV_BMSK BIT(4)
  203. #define UARTDM_ISR_RXSTALE_BMSK BIT(3)
  204. #define UARTDM_ISR_RXBREAK_BMSK BIT(2)
  205. #define UARTDM_ISR_RXHUNT_BMSK BIT(1)
  206. #define UARTDM_ISR_TXLEV_BMSK BIT(0)
  207. /* Field definitions for UART_DM_DMEN*/
  208. #define UARTDM_TX_DM_EN_BMSK 0x1
  209. #define UARTDM_RX_DM_EN_BMSK 0x2
  210. /*
  211. * UARTDM Core v1.4 bitmask
  212. * Bitmasks for enabling Rx and Tx BAM Interface
  213. */
  214. #define UARTDM_TX_BAM_ENABLE_BMSK 0x4
  215. #define UARTDM_RX_BAM_ENABLE_BMSK 0x8
  216. /* Register offsets for UART Core v13 */
  217. /* write only register */
  218. #define UARTDM_CSR_ADDR 0x8
  219. /* write only register */
  220. #define UARTDM_TF_ADDR 0x70
  221. #define UARTDM_TF2_ADDR 0x74
  222. #define UARTDM_TF3_ADDR 0x78
  223. #define UARTDM_TF4_ADDR 0x7c
  224. /* write only register */
  225. #define UARTDM_CR_ADDR 0x10
  226. /* write only register */
  227. #define UARTDM_IMR_ADDR 0x14
  228. #define UARTDM_IRDA_ADDR 0x38
  229. /* Read Only register */
  230. #define UARTDM_SR_ADDR 0x8
  231. /* Read Only register */
  232. #define UARTDM_RF_ADDR 0x70
  233. #define UARTDM_RF2_ADDR 0x74
  234. #define UARTDM_RF3_ADDR 0x78
  235. #define UARTDM_RF4_ADDR 0x7c
  236. /* Read Only register */
  237. #define UARTDM_MISR_ADDR 0x10
  238. /* Read Only register */
  239. #define UARTDM_ISR_ADDR 0x14
  240. #define UARTDM_RX_TOTAL_SNAP_ADDR 0x38
  241. #endif /* MSM_SERIAL_HS_HWREG_H */