mpc52xx_psc.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /*
  2. * include/asm-ppc/mpc52xx_psc.h
  3. *
  4. * Definitions of consts/structs to drive the Freescale MPC52xx OnChip
  5. * PSCs. Theses are shared between multiple drivers since a PSC can be
  6. * UART, AC97, IR, I2S, ... So this header is in asm-ppc.
  7. *
  8. *
  9. * Maintainer : Sylvain Munaut <tnt@246tNt.com>
  10. *
  11. * Based/Extracted from some header of the 2.4 originally written by
  12. * Dale Farnsworth <dfarnsworth@mvista.com>
  13. *
  14. * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
  15. * Copyright (C) 2003 MontaVista, Software, Inc.
  16. *
  17. * This file is licensed under the terms of the GNU General Public License
  18. * version 2. This program is licensed "as is" without any warranty of any
  19. * kind, whether express or implied.
  20. */
  21. #ifndef __ASM_MPC52xx_PSC_H__
  22. #define __ASM_MPC52xx_PSC_H__
  23. #include <asm/types.h>
  24. /* Max number of PSCs */
  25. #define MPC52xx_PSC_MAXNUM 6
  26. /* Programmable Serial Controller (PSC) status register bits */
  27. #define MPC52xx_PSC_SR_UNEX_RX 0x0001
  28. #define MPC52xx_PSC_SR_DATA_VAL 0x0002
  29. #define MPC52xx_PSC_SR_DATA_OVR 0x0004
  30. #define MPC52xx_PSC_SR_CMDSEND 0x0008
  31. #define MPC52xx_PSC_SR_CDE 0x0080
  32. #define MPC52xx_PSC_SR_RXRDY 0x0100
  33. #define MPC52xx_PSC_SR_RXFULL 0x0200
  34. #define MPC52xx_PSC_SR_TXRDY 0x0400
  35. #define MPC52xx_PSC_SR_TXEMP 0x0800
  36. #define MPC52xx_PSC_SR_OE 0x1000
  37. #define MPC52xx_PSC_SR_PE 0x2000
  38. #define MPC52xx_PSC_SR_FE 0x4000
  39. #define MPC52xx_PSC_SR_RB 0x8000
  40. /* PSC Command values */
  41. #define MPC52xx_PSC_RX_ENABLE 0x0001
  42. #define MPC52xx_PSC_RX_DISABLE 0x0002
  43. #define MPC52xx_PSC_TX_ENABLE 0x0004
  44. #define MPC52xx_PSC_TX_DISABLE 0x0008
  45. #define MPC52xx_PSC_SEL_MODE_REG_1 0x0010
  46. #define MPC52xx_PSC_RST_RX 0x0020
  47. #define MPC52xx_PSC_RST_TX 0x0030
  48. #define MPC52xx_PSC_RST_ERR_STAT 0x0040
  49. #define MPC52xx_PSC_RST_BRK_CHG_INT 0x0050
  50. #define MPC52xx_PSC_START_BRK 0x0060
  51. #define MPC52xx_PSC_STOP_BRK 0x0070
  52. /* PSC TxRx FIFO status bits */
  53. #define MPC52xx_PSC_RXTX_FIFO_ERR 0x0040
  54. #define MPC52xx_PSC_RXTX_FIFO_UF 0x0020
  55. #define MPC52xx_PSC_RXTX_FIFO_OF 0x0010
  56. #define MPC52xx_PSC_RXTX_FIFO_FR 0x0008
  57. #define MPC52xx_PSC_RXTX_FIFO_FULL 0x0004
  58. #define MPC52xx_PSC_RXTX_FIFO_ALARM 0x0002
  59. #define MPC52xx_PSC_RXTX_FIFO_EMPTY 0x0001
  60. /* PSC interrupt mask bits */
  61. #define MPC52xx_PSC_IMR_TXRDY 0x0100
  62. #define MPC52xx_PSC_IMR_RXRDY 0x0200
  63. #define MPC52xx_PSC_IMR_DB 0x0400
  64. #define MPC52xx_PSC_IMR_IPC 0x8000
  65. /* PSC input port change bit */
  66. #define MPC52xx_PSC_CTS 0x01
  67. #define MPC52xx_PSC_DCD 0x02
  68. #define MPC52xx_PSC_D_CTS 0x10
  69. #define MPC52xx_PSC_D_DCD 0x20
  70. /* PSC mode fields */
  71. #define MPC52xx_PSC_MODE_5_BITS 0x00
  72. #define MPC52xx_PSC_MODE_6_BITS 0x01
  73. #define MPC52xx_PSC_MODE_7_BITS 0x02
  74. #define MPC52xx_PSC_MODE_8_BITS 0x03
  75. #define MPC52xx_PSC_MODE_BITS_MASK 0x03
  76. #define MPC52xx_PSC_MODE_PAREVEN 0x00
  77. #define MPC52xx_PSC_MODE_PARODD 0x04
  78. #define MPC52xx_PSC_MODE_PARFORCE 0x08
  79. #define MPC52xx_PSC_MODE_PARNONE 0x10
  80. #define MPC52xx_PSC_MODE_ERR 0x20
  81. #define MPC52xx_PSC_MODE_FFULL 0x40
  82. #define MPC52xx_PSC_MODE_RXRTS 0x80
  83. #define MPC52xx_PSC_MODE_ONE_STOP_5_BITS 0x00
  84. #define MPC52xx_PSC_MODE_ONE_STOP 0x07
  85. #define MPC52xx_PSC_MODE_TWO_STOP 0x0f
  86. #define MPC52xx_PSC_RFNUM_MASK 0x01ff
  87. /* Structure of the hardware registers */
  88. struct mpc52xx_psc {
  89. u8 mode; /* PSC + 0x00 */
  90. u8 reserved0[3];
  91. union { /* PSC + 0x04 */
  92. u16 status;
  93. u16 clock_select;
  94. } sr_csr;
  95. #define mpc52xx_psc_status sr_csr.status
  96. #define mpc52xx_psc_clock_select sr_csr.clock_select
  97. u16 reserved1;
  98. u8 command; /* PSC + 0x08 */
  99. u8 reserved2[3];
  100. union { /* PSC + 0x0c */
  101. u8 buffer_8;
  102. u16 buffer_16;
  103. u32 buffer_32;
  104. } buffer;
  105. #define mpc52xx_psc_buffer_8 buffer.buffer_8
  106. #define mpc52xx_psc_buffer_16 buffer.buffer_16
  107. #define mpc52xx_psc_buffer_32 buffer.buffer_32
  108. union { /* PSC + 0x10 */
  109. u8 ipcr;
  110. u8 acr;
  111. } ipcr_acr;
  112. #define mpc52xx_psc_ipcr ipcr_acr.ipcr
  113. #define mpc52xx_psc_acr ipcr_acr.acr
  114. u8 reserved3[3];
  115. union { /* PSC + 0x14 */
  116. u16 isr;
  117. u16 imr;
  118. } isr_imr;
  119. #define mpc52xx_psc_isr isr_imr.isr
  120. #define mpc52xx_psc_imr isr_imr.imr
  121. u16 reserved4;
  122. u8 ctur; /* PSC + 0x18 */
  123. u8 reserved5[3];
  124. u8 ctlr; /* PSC + 0x1c */
  125. u8 reserved6[3];
  126. u32 ccr; /* PSC + 0x20 */
  127. u32 ac97_slots; /* PSC + 0x24 */
  128. u32 ac97_cmd; /* PSC + 0x28 */
  129. u32 ac97_data; /* PSC + 0x2c */
  130. u8 ivr; /* PSC + 0x30 */
  131. u8 reserved8[3];
  132. u8 ip; /* PSC + 0x34 */
  133. u8 reserved9[3];
  134. u8 op1; /* PSC + 0x38 */
  135. u8 reserved10[3];
  136. u8 op0; /* PSC + 0x3c */
  137. u8 reserved11[3];
  138. u32 sicr; /* PSC + 0x40 */
  139. u8 ircr1; /* PSC + 0x44 */
  140. u8 reserved13[3];
  141. u8 ircr2; /* PSC + 0x44 */
  142. u8 reserved14[3];
  143. u8 irsdr; /* PSC + 0x4c */
  144. u8 reserved15[3];
  145. u8 irmdr; /* PSC + 0x50 */
  146. u8 reserved16[3];
  147. u8 irfdr; /* PSC + 0x54 */
  148. u8 reserved17[3];
  149. u16 rfnum; /* PSC + 0x58 */
  150. u16 reserved18;
  151. u16 tfnum; /* PSC + 0x5c */
  152. u16 reserved19;
  153. u32 rfdata; /* PSC + 0x60 */
  154. u16 rfstat; /* PSC + 0x64 */
  155. u16 reserved20;
  156. u8 rfcntl; /* PSC + 0x68 */
  157. u8 reserved21[5];
  158. u16 rfalarm; /* PSC + 0x6e */
  159. u16 reserved22;
  160. u16 rfrptr; /* PSC + 0x72 */
  161. u16 reserved23;
  162. u16 rfwptr; /* PSC + 0x76 */
  163. u16 reserved24;
  164. u16 rflrfptr; /* PSC + 0x7a */
  165. u16 reserved25;
  166. u16 rflwfptr; /* PSC + 0x7e */
  167. u32 tfdata; /* PSC + 0x80 */
  168. u16 tfstat; /* PSC + 0x84 */
  169. u16 reserved26;
  170. u8 tfcntl; /* PSC + 0x88 */
  171. u8 reserved27[5];
  172. u16 tfalarm; /* PSC + 0x8e */
  173. u16 reserved28;
  174. u16 tfrptr; /* PSC + 0x92 */
  175. u16 reserved29;
  176. u16 tfwptr; /* PSC + 0x96 */
  177. u16 reserved30;
  178. u16 tflrfptr; /* PSC + 0x9a */
  179. u16 reserved31;
  180. u16 tflwfptr; /* PSC + 0x9e */
  181. };
  182. #endif /* __ASM_MPC52xx_PSC_H__ */