scc2698.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*
  2. * scc2698.h
  3. *
  4. * driver for the IPOCTAL boards
  5. *
  6. * Copyright (C) 2009-2012 CERN (www.cern.ch)
  7. * Author: Nicolas Serafini, EIC2 SA
  8. * Author: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the Free
  12. * Software Foundation; version 2 of the License.
  13. */
  14. #ifndef SCC2698_H_
  15. #define SCC2698_H_
  16. /*
  17. * union scc2698_channel - Channel access to scc2698 IO
  18. *
  19. * dn value are only spacer.
  20. *
  21. */
  22. union scc2698_channel {
  23. struct {
  24. u8 d0, mr; /* Mode register 1/2*/
  25. u8 d1, sr; /* Status register */
  26. u8 d2, r1; /* reserved */
  27. u8 d3, rhr; /* Receive holding register (R) */
  28. u8 junk[8]; /* other crap for block control */
  29. } __packed r; /* Read access */
  30. struct {
  31. u8 d0, mr; /* Mode register 1/2 */
  32. u8 d1, csr; /* Clock select register */
  33. u8 d2, cr; /* Command register */
  34. u8 d3, thr; /* Transmit holding register */
  35. u8 junk[8]; /* other crap for block control */
  36. } __packed w; /* Write access */
  37. };
  38. /*
  39. * union scc2698_block - Block access to scc2698 IO
  40. *
  41. * The scc2698 contain 4 block.
  42. * Each block containt two channel a and b.
  43. * dn value are only spacer.
  44. *
  45. */
  46. union scc2698_block {
  47. struct {
  48. u8 d0, mra; /* Mode register 1/2 (a) */
  49. u8 d1, sra; /* Status register (a) */
  50. u8 d2, r1; /* reserved */
  51. u8 d3, rhra; /* Receive holding register (a) */
  52. u8 d4, ipcr; /* Input port change register of block */
  53. u8 d5, isr; /* Interrupt status register of block */
  54. u8 d6, ctur; /* Counter timer upper register of block */
  55. u8 d7, ctlr; /* Counter timer lower register of block */
  56. u8 d8, mrb; /* Mode register 1/2 (b) */
  57. u8 d9, srb; /* Status register (b) */
  58. u8 da, r2; /* reserved */
  59. u8 db, rhrb; /* Receive holding register (b) */
  60. u8 dc, r3; /* reserved */
  61. u8 dd, ip; /* Input port register of block */
  62. u8 de, ctg; /* Start counter timer of block */
  63. u8 df, cts; /* Stop counter timer of block */
  64. } __packed r; /* Read access */
  65. struct {
  66. u8 d0, mra; /* Mode register 1/2 (a) */
  67. u8 d1, csra; /* Clock select register (a) */
  68. u8 d2, cra; /* Command register (a) */
  69. u8 d3, thra; /* Transmit holding register (a) */
  70. u8 d4, acr; /* Auxiliary control register of block */
  71. u8 d5, imr; /* Interrupt mask register of block */
  72. u8 d6, ctu; /* Counter timer upper register of block */
  73. u8 d7, ctl; /* Counter timer lower register of block */
  74. u8 d8, mrb; /* Mode register 1/2 (b) */
  75. u8 d9, csrb; /* Clock select register (a) */
  76. u8 da, crb; /* Command register (b) */
  77. u8 db, thrb; /* Transmit holding register (b) */
  78. u8 dc, r1; /* reserved */
  79. u8 dd, opcr; /* Output port configuration register of block */
  80. u8 de, r2; /* reserved */
  81. u8 df, r3; /* reserved */
  82. } __packed w; /* Write access */
  83. };
  84. #define MR1_CHRL_5_BITS (0x0 << 0)
  85. #define MR1_CHRL_6_BITS (0x1 << 0)
  86. #define MR1_CHRL_7_BITS (0x2 << 0)
  87. #define MR1_CHRL_8_BITS (0x3 << 0)
  88. #define MR1_PARITY_EVEN (0x1 << 2)
  89. #define MR1_PARITY_ODD (0x0 << 2)
  90. #define MR1_PARITY_ON (0x0 << 3)
  91. #define MR1_PARITY_FORCE (0x1 << 3)
  92. #define MR1_PARITY_OFF (0x2 << 3)
  93. #define MR1_PARITY_SPECIAL (0x3 << 3)
  94. #define MR1_ERROR_CHAR (0x0 << 5)
  95. #define MR1_ERROR_BLOCK (0x1 << 5)
  96. #define MR1_RxINT_RxRDY (0x0 << 6)
  97. #define MR1_RxINT_FFULL (0x1 << 6)
  98. #define MR1_RxRTS_CONTROL_ON (0x1 << 7)
  99. #define MR1_RxRTS_CONTROL_OFF (0x0 << 7)
  100. #define MR2_STOP_BITS_LENGTH_1 (0x7 << 0)
  101. #define MR2_STOP_BITS_LENGTH_2 (0xF << 0)
  102. #define MR2_CTS_ENABLE_TX_ON (0x1 << 4)
  103. #define MR2_CTS_ENABLE_TX_OFF (0x0 << 4)
  104. #define MR2_TxRTS_CONTROL_ON (0x1 << 5)
  105. #define MR2_TxRTS_CONTROL_OFF (0x0 << 5)
  106. #define MR2_CH_MODE_NORMAL (0x0 << 6)
  107. #define MR2_CH_MODE_ECHO (0x1 << 6)
  108. #define MR2_CH_MODE_LOCAL (0x2 << 6)
  109. #define MR2_CH_MODE_REMOTE (0x3 << 6)
  110. #define CR_ENABLE_RX (0x1 << 0)
  111. #define CR_DISABLE_RX (0x1 << 1)
  112. #define CR_ENABLE_TX (0x1 << 2)
  113. #define CR_DISABLE_TX (0x1 << 3)
  114. #define CR_CMD_RESET_MR (0x1 << 4)
  115. #define CR_CMD_RESET_RX (0x2 << 4)
  116. #define CR_CMD_RESET_TX (0x3 << 4)
  117. #define CR_CMD_RESET_ERR_STATUS (0x4 << 4)
  118. #define CR_CMD_RESET_BREAK_CHANGE (0x5 << 4)
  119. #define CR_CMD_START_BREAK (0x6 << 4)
  120. #define CR_CMD_STOP_BREAK (0x7 << 4)
  121. #define CR_CMD_ASSERT_RTSN (0x8 << 4)
  122. #define CR_CMD_NEGATE_RTSN (0x9 << 4)
  123. #define CR_CMD_SET_TIMEOUT_MODE (0xA << 4)
  124. #define CR_CMD_DISABLE_TIMEOUT_MODE (0xC << 4)
  125. #define SR_RX_READY (0x1 << 0)
  126. #define SR_FIFO_FULL (0x1 << 1)
  127. #define SR_TX_READY (0x1 << 2)
  128. #define SR_TX_EMPTY (0x1 << 3)
  129. #define SR_OVERRUN_ERROR (0x1 << 4)
  130. #define SR_PARITY_ERROR (0x1 << 5)
  131. #define SR_FRAMING_ERROR (0x1 << 6)
  132. #define SR_RECEIVED_BREAK (0x1 << 7)
  133. #define SR_ERROR (0xF0)
  134. #define ACR_DELTA_IP0_IRQ_EN (0x1 << 0)
  135. #define ACR_DELTA_IP1_IRQ_EN (0x1 << 1)
  136. #define ACR_DELTA_IP2_IRQ_EN (0x1 << 2)
  137. #define ACR_DELTA_IP3_IRQ_EN (0x1 << 3)
  138. #define ACR_CT_Mask (0x7 << 4)
  139. #define ACR_CExt (0x0 << 4)
  140. #define ACR_CTxCA (0x1 << 4)
  141. #define ACR_CTxCB (0x2 << 4)
  142. #define ACR_CClk16 (0x3 << 4)
  143. #define ACR_TExt (0x4 << 4)
  144. #define ACR_TExt16 (0x5 << 4)
  145. #define ACR_TClk (0x6 << 4)
  146. #define ACR_TClk16 (0x7 << 4)
  147. #define ACR_BRG_SET1 (0x0 << 7)
  148. #define ACR_BRG_SET2 (0x1 << 7)
  149. #define TX_CLK_75 (0x0 << 0)
  150. #define TX_CLK_110 (0x1 << 0)
  151. #define TX_CLK_38400 (0x2 << 0)
  152. #define TX_CLK_150 (0x3 << 0)
  153. #define TX_CLK_300 (0x4 << 0)
  154. #define TX_CLK_600 (0x5 << 0)
  155. #define TX_CLK_1200 (0x6 << 0)
  156. #define TX_CLK_2000 (0x7 << 0)
  157. #define TX_CLK_2400 (0x8 << 0)
  158. #define TX_CLK_4800 (0x9 << 0)
  159. #define TX_CLK_1800 (0xA << 0)
  160. #define TX_CLK_9600 (0xB << 0)
  161. #define TX_CLK_19200 (0xC << 0)
  162. #define RX_CLK_75 (0x0 << 4)
  163. #define RX_CLK_110 (0x1 << 4)
  164. #define RX_CLK_38400 (0x2 << 4)
  165. #define RX_CLK_150 (0x3 << 4)
  166. #define RX_CLK_300 (0x4 << 4)
  167. #define RX_CLK_600 (0x5 << 4)
  168. #define RX_CLK_1200 (0x6 << 4)
  169. #define RX_CLK_2000 (0x7 << 4)
  170. #define RX_CLK_2400 (0x8 << 4)
  171. #define RX_CLK_4800 (0x9 << 4)
  172. #define RX_CLK_1800 (0xA << 4)
  173. #define RX_CLK_9600 (0xB << 4)
  174. #define RX_CLK_19200 (0xC << 4)
  175. #define OPCR_MPOa_RTSN (0x0 << 0)
  176. #define OPCR_MPOa_C_TO (0x1 << 0)
  177. #define OPCR_MPOa_TxC1X (0x2 << 0)
  178. #define OPCR_MPOa_TxC16X (0x3 << 0)
  179. #define OPCR_MPOa_RxC1X (0x4 << 0)
  180. #define OPCR_MPOa_RxC16X (0x5 << 0)
  181. #define OPCR_MPOa_TxRDY (0x6 << 0)
  182. #define OPCR_MPOa_RxRDY_FF (0x7 << 0)
  183. #define OPCR_MPOb_RTSN (0x0 << 4)
  184. #define OPCR_MPOb_C_TO (0x1 << 4)
  185. #define OPCR_MPOb_TxC1X (0x2 << 4)
  186. #define OPCR_MPOb_TxC16X (0x3 << 4)
  187. #define OPCR_MPOb_RxC1X (0x4 << 4)
  188. #define OPCR_MPOb_RxC16X (0x5 << 4)
  189. #define OPCR_MPOb_TxRDY (0x6 << 4)
  190. #define OPCR_MPOb_RxRDY_FF (0x7 << 4)
  191. #define OPCR_MPP_INPUT (0x0 << 7)
  192. #define OPCR_MPP_OUTPUT (0x1 << 7)
  193. #define IMR_TxRDY_A (0x1 << 0)
  194. #define IMR_RxRDY_FFULL_A (0x1 << 1)
  195. #define IMR_DELTA_BREAK_A (0x1 << 2)
  196. #define IMR_COUNTER_READY (0x1 << 3)
  197. #define IMR_TxRDY_B (0x1 << 4)
  198. #define IMR_RxRDY_FFULL_B (0x1 << 5)
  199. #define IMR_DELTA_BREAK_B (0x1 << 6)
  200. #define IMR_INPUT_PORT_CHANGE (0x1 << 7)
  201. #define ISR_TxRDY_A (0x1 << 0)
  202. #define ISR_RxRDY_FFULL_A (0x1 << 1)
  203. #define ISR_DELTA_BREAK_A (0x1 << 2)
  204. #define ISR_COUNTER_READY (0x1 << 3)
  205. #define ISR_TxRDY_B (0x1 << 4)
  206. #define ISR_RxRDY_FFULL_B (0x1 << 5)
  207. #define ISR_DELTA_BREAK_B (0x1 << 6)
  208. #define ISR_INPUT_PORT_CHANGE (0x1 << 7)
  209. #define ACK_INT_REQ0 0
  210. #define ACK_INT_REQ1 2
  211. #endif /* SCC2698_H_ */