mpc52xx_psc.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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. #ifdef CONFIG_PPC_MPC512x
  26. #define MPC52xx_PSC_MAXNUM 12
  27. #else
  28. #define MPC52xx_PSC_MAXNUM 6
  29. #endif
  30. /* Programmable Serial Controller (PSC) status register bits */
  31. #define MPC52xx_PSC_SR_UNEX_RX 0x0001
  32. #define MPC52xx_PSC_SR_DATA_VAL 0x0002
  33. #define MPC52xx_PSC_SR_DATA_OVR 0x0004
  34. #define MPC52xx_PSC_SR_CMDSEND 0x0008
  35. #define MPC52xx_PSC_SR_CDE 0x0080
  36. #define MPC52xx_PSC_SR_RXRDY 0x0100
  37. #define MPC52xx_PSC_SR_RXFULL 0x0200
  38. #define MPC52xx_PSC_SR_TXRDY 0x0400
  39. #define MPC52xx_PSC_SR_TXEMP 0x0800
  40. #define MPC52xx_PSC_SR_OE 0x1000
  41. #define MPC52xx_PSC_SR_PE 0x2000
  42. #define MPC52xx_PSC_SR_FE 0x4000
  43. #define MPC52xx_PSC_SR_RB 0x8000
  44. /* PSC Command values */
  45. #define MPC52xx_PSC_RX_ENABLE 0x0001
  46. #define MPC52xx_PSC_RX_DISABLE 0x0002
  47. #define MPC52xx_PSC_TX_ENABLE 0x0004
  48. #define MPC52xx_PSC_TX_DISABLE 0x0008
  49. #define MPC52xx_PSC_SEL_MODE_REG_1 0x0010
  50. #define MPC52xx_PSC_RST_RX 0x0020
  51. #define MPC52xx_PSC_RST_TX 0x0030
  52. #define MPC52xx_PSC_RST_ERR_STAT 0x0040
  53. #define MPC52xx_PSC_RST_BRK_CHG_INT 0x0050
  54. #define MPC52xx_PSC_START_BRK 0x0060
  55. #define MPC52xx_PSC_STOP_BRK 0x0070
  56. /* PSC TxRx FIFO status bits */
  57. #define MPC52xx_PSC_RXTX_FIFO_ERR 0x0040
  58. #define MPC52xx_PSC_RXTX_FIFO_UF 0x0020
  59. #define MPC52xx_PSC_RXTX_FIFO_OF 0x0010
  60. #define MPC52xx_PSC_RXTX_FIFO_FR 0x0008
  61. #define MPC52xx_PSC_RXTX_FIFO_FULL 0x0004
  62. #define MPC52xx_PSC_RXTX_FIFO_ALARM 0x0002
  63. #define MPC52xx_PSC_RXTX_FIFO_EMPTY 0x0001
  64. /* PSC interrupt status/mask bits */
  65. #define MPC52xx_PSC_IMR_UNEX_RX_SLOT 0x0001
  66. #define MPC52xx_PSC_IMR_DATA_VALID 0x0002
  67. #define MPC52xx_PSC_IMR_DATA_OVR 0x0004
  68. #define MPC52xx_PSC_IMR_CMD_SEND 0x0008
  69. #define MPC52xx_PSC_IMR_ERROR 0x0040
  70. #define MPC52xx_PSC_IMR_DEOF 0x0080
  71. #define MPC52xx_PSC_IMR_TXRDY 0x0100
  72. #define MPC52xx_PSC_IMR_RXRDY 0x0200
  73. #define MPC52xx_PSC_IMR_DB 0x0400
  74. #define MPC52xx_PSC_IMR_TXEMP 0x0800
  75. #define MPC52xx_PSC_IMR_ORERR 0x1000
  76. #define MPC52xx_PSC_IMR_IPC 0x8000
  77. /* PSC input port change bits */
  78. #define MPC52xx_PSC_CTS 0x01
  79. #define MPC52xx_PSC_DCD 0x02
  80. #define MPC52xx_PSC_D_CTS 0x10
  81. #define MPC52xx_PSC_D_DCD 0x20
  82. /* PSC acr bits */
  83. #define MPC52xx_PSC_IEC_CTS 0x01
  84. #define MPC52xx_PSC_IEC_DCD 0x02
  85. /* PSC output port bits */
  86. #define MPC52xx_PSC_OP_RTS 0x01
  87. #define MPC52xx_PSC_OP_RES 0x02
  88. /* PSC mode fields */
  89. #define MPC52xx_PSC_MODE_5_BITS 0x00
  90. #define MPC52xx_PSC_MODE_6_BITS 0x01
  91. #define MPC52xx_PSC_MODE_7_BITS 0x02
  92. #define MPC52xx_PSC_MODE_8_BITS 0x03
  93. #define MPC52xx_PSC_MODE_BITS_MASK 0x03
  94. #define MPC52xx_PSC_MODE_PAREVEN 0x00
  95. #define MPC52xx_PSC_MODE_PARODD 0x04
  96. #define MPC52xx_PSC_MODE_PARFORCE 0x08
  97. #define MPC52xx_PSC_MODE_PARNONE 0x10
  98. #define MPC52xx_PSC_MODE_ERR 0x20
  99. #define MPC52xx_PSC_MODE_FFULL 0x40
  100. #define MPC52xx_PSC_MODE_RXRTS 0x80
  101. #define MPC52xx_PSC_MODE_ONE_STOP_5_BITS 0x00
  102. #define MPC52xx_PSC_MODE_ONE_STOP 0x07
  103. #define MPC52xx_PSC_MODE_TWO_STOP 0x0f
  104. #define MPC52xx_PSC_MODE_TXCTS 0x10
  105. #define MPC52xx_PSC_RFNUM_MASK 0x01ff
  106. #define MPC52xx_PSC_SICR_DTS1 (1 << 29)
  107. #define MPC52xx_PSC_SICR_SHDR (1 << 28)
  108. #define MPC52xx_PSC_SICR_SIM_MASK (0xf << 24)
  109. #define MPC52xx_PSC_SICR_SIM_UART (0x0 << 24)
  110. #define MPC52xx_PSC_SICR_SIM_UART_DCD (0x8 << 24)
  111. #define MPC52xx_PSC_SICR_SIM_CODEC_8 (0x1 << 24)
  112. #define MPC52xx_PSC_SICR_SIM_CODEC_16 (0x2 << 24)
  113. #define MPC52xx_PSC_SICR_SIM_AC97 (0x3 << 24)
  114. #define MPC52xx_PSC_SICR_SIM_SIR (0x8 << 24)
  115. #define MPC52xx_PSC_SICR_SIM_SIR_DCD (0xc << 24)
  116. #define MPC52xx_PSC_SICR_SIM_MIR (0x5 << 24)
  117. #define MPC52xx_PSC_SICR_SIM_FIR (0x6 << 24)
  118. #define MPC52xx_PSC_SICR_SIM_CODEC_24 (0x7 << 24)
  119. #define MPC52xx_PSC_SICR_SIM_CODEC_32 (0xf << 24)
  120. #define MPC52xx_PSC_SICR_ACRB (0x8 << 24)
  121. #define MPC52xx_PSC_SICR_AWR (1 << 30)
  122. #define MPC52xx_PSC_SICR_GENCLK (1 << 23)
  123. #define MPC52xx_PSC_SICR_I2S (1 << 22)
  124. #define MPC52xx_PSC_SICR_CLKPOL (1 << 21)
  125. #define MPC52xx_PSC_SICR_SYNCPOL (1 << 20)
  126. #define MPC52xx_PSC_SICR_CELLSLAVE (1 << 19)
  127. #define MPC52xx_PSC_SICR_CELL2XCLK (1 << 18)
  128. #define MPC52xx_PSC_SICR_ESAI (1 << 17)
  129. #define MPC52xx_PSC_SICR_ENAC97 (1 << 16)
  130. #define MPC52xx_PSC_SICR_SPI (1 << 15)
  131. #define MPC52xx_PSC_SICR_MSTR (1 << 14)
  132. #define MPC52xx_PSC_SICR_CPOL (1 << 13)
  133. #define MPC52xx_PSC_SICR_CPHA (1 << 12)
  134. #define MPC52xx_PSC_SICR_USEEOF (1 << 11)
  135. #define MPC52xx_PSC_SICR_DISABLEEOF (1 << 10)
  136. /* Structure of the hardware registers */
  137. struct mpc52xx_psc {
  138. union {
  139. u8 mode; /* PSC + 0x00 */
  140. u8 mr2;
  141. };
  142. u8 reserved0[3];
  143. union { /* PSC + 0x04 */
  144. u16 status;
  145. u16 clock_select;
  146. } sr_csr;
  147. #define mpc52xx_psc_status sr_csr.status
  148. #define mpc52xx_psc_clock_select sr_csr.clock_select
  149. u16 reserved1;
  150. u8 command; /* PSC + 0x08 */
  151. u8 reserved2[3];
  152. union { /* PSC + 0x0c */
  153. u8 buffer_8;
  154. u16 buffer_16;
  155. u32 buffer_32;
  156. } buffer;
  157. #define mpc52xx_psc_buffer_8 buffer.buffer_8
  158. #define mpc52xx_psc_buffer_16 buffer.buffer_16
  159. #define mpc52xx_psc_buffer_32 buffer.buffer_32
  160. union { /* PSC + 0x10 */
  161. u8 ipcr;
  162. u8 acr;
  163. } ipcr_acr;
  164. #define mpc52xx_psc_ipcr ipcr_acr.ipcr
  165. #define mpc52xx_psc_acr ipcr_acr.acr
  166. u8 reserved3[3];
  167. union { /* PSC + 0x14 */
  168. u16 isr;
  169. u16 imr;
  170. } isr_imr;
  171. #define mpc52xx_psc_isr isr_imr.isr
  172. #define mpc52xx_psc_imr isr_imr.imr
  173. u16 reserved4;
  174. u8 ctur; /* PSC + 0x18 */
  175. u8 reserved5[3];
  176. u8 ctlr; /* PSC + 0x1c */
  177. u8 reserved6[3];
  178. /* BitClkDiv field of CCR is byte swapped in
  179. * the hardware for mpc5200/b compatibility */
  180. u32 ccr; /* PSC + 0x20 */
  181. u32 ac97_slots; /* PSC + 0x24 */
  182. u32 ac97_cmd; /* PSC + 0x28 */
  183. u32 ac97_data; /* PSC + 0x2c */
  184. u8 ivr; /* PSC + 0x30 */
  185. u8 reserved8[3];
  186. u8 ip; /* PSC + 0x34 */
  187. u8 reserved9[3];
  188. u8 op1; /* PSC + 0x38 */
  189. u8 reserved10[3];
  190. u8 op0; /* PSC + 0x3c */
  191. u8 reserved11[3];
  192. u32 sicr; /* PSC + 0x40 */
  193. u8 ircr1; /* PSC + 0x44 */
  194. u8 reserved13[3];
  195. u8 ircr2; /* PSC + 0x44 */
  196. u8 reserved14[3];
  197. u8 irsdr; /* PSC + 0x4c */
  198. u8 reserved15[3];
  199. u8 irmdr; /* PSC + 0x50 */
  200. u8 reserved16[3];
  201. u8 irfdr; /* PSC + 0x54 */
  202. u8 reserved17[3];
  203. };
  204. struct mpc52xx_psc_fifo {
  205. u16 rfnum; /* PSC + 0x58 */
  206. u16 reserved18;
  207. u16 tfnum; /* PSC + 0x5c */
  208. u16 reserved19;
  209. u32 rfdata; /* PSC + 0x60 */
  210. u16 rfstat; /* PSC + 0x64 */
  211. u16 reserved20;
  212. u8 rfcntl; /* PSC + 0x68 */
  213. u8 reserved21[5];
  214. u16 rfalarm; /* PSC + 0x6e */
  215. u16 reserved22;
  216. u16 rfrptr; /* PSC + 0x72 */
  217. u16 reserved23;
  218. u16 rfwptr; /* PSC + 0x76 */
  219. u16 reserved24;
  220. u16 rflrfptr; /* PSC + 0x7a */
  221. u16 reserved25;
  222. u16 rflwfptr; /* PSC + 0x7e */
  223. u32 tfdata; /* PSC + 0x80 */
  224. u16 tfstat; /* PSC + 0x84 */
  225. u16 reserved26;
  226. u8 tfcntl; /* PSC + 0x88 */
  227. u8 reserved27[5];
  228. u16 tfalarm; /* PSC + 0x8e */
  229. u16 reserved28;
  230. u16 tfrptr; /* PSC + 0x92 */
  231. u16 reserved29;
  232. u16 tfwptr; /* PSC + 0x96 */
  233. u16 reserved30;
  234. u16 tflrfptr; /* PSC + 0x9a */
  235. u16 reserved31;
  236. u16 tflwfptr; /* PSC + 0x9e */
  237. };
  238. #define MPC512x_PSC_FIFO_EOF 0x100
  239. #define MPC512x_PSC_FIFO_RESET_SLICE 0x80
  240. #define MPC512x_PSC_FIFO_ENABLE_SLICE 0x01
  241. #define MPC512x_PSC_FIFO_ENABLE_DMA 0x04
  242. #define MPC512x_PSC_FIFO_EMPTY 0x1
  243. #define MPC512x_PSC_FIFO_FULL 0x2
  244. #define MPC512x_PSC_FIFO_ALARM 0x4
  245. #define MPC512x_PSC_FIFO_URERR 0x8
  246. struct mpc512x_psc_fifo {
  247. u32 reserved1[10];
  248. u32 txcmd; /* PSC + 0x80 */
  249. u32 txalarm; /* PSC + 0x84 */
  250. u32 txsr; /* PSC + 0x88 */
  251. u32 txisr; /* PSC + 0x8c */
  252. u32 tximr; /* PSC + 0x90 */
  253. u32 txcnt; /* PSC + 0x94 */
  254. u32 txptr; /* PSC + 0x98 */
  255. u32 txsz; /* PSC + 0x9c */
  256. u32 reserved2[7];
  257. union {
  258. u8 txdata_8;
  259. u16 txdata_16;
  260. u32 txdata_32;
  261. } txdata; /* PSC + 0xbc */
  262. #define txdata_8 txdata.txdata_8
  263. #define txdata_16 txdata.txdata_16
  264. #define txdata_32 txdata.txdata_32
  265. u32 rxcmd; /* PSC + 0xc0 */
  266. u32 rxalarm; /* PSC + 0xc4 */
  267. u32 rxsr; /* PSC + 0xc8 */
  268. u32 rxisr; /* PSC + 0xcc */
  269. u32 rximr; /* PSC + 0xd0 */
  270. u32 rxcnt; /* PSC + 0xd4 */
  271. u32 rxptr; /* PSC + 0xd8 */
  272. u32 rxsz; /* PSC + 0xdc */
  273. u32 reserved3[7];
  274. union {
  275. u8 rxdata_8;
  276. u16 rxdata_16;
  277. u32 rxdata_32;
  278. } rxdata; /* PSC + 0xfc */
  279. #define rxdata_8 rxdata.rxdata_8
  280. #define rxdata_16 rxdata.rxdata_16
  281. #define rxdata_32 rxdata.rxdata_32
  282. };
  283. struct mpc5125_psc {
  284. u8 mr1; /* PSC + 0x00 */
  285. u8 reserved0[3];
  286. u8 mr2; /* PSC + 0x04 */
  287. u8 reserved1[3];
  288. struct {
  289. u16 status; /* PSC + 0x08 */
  290. u8 reserved2[2];
  291. u8 clock_select; /* PSC + 0x0c */
  292. u8 reserved3[3];
  293. } sr_csr;
  294. u8 command; /* PSC + 0x10 */
  295. u8 reserved4[3];
  296. union { /* PSC + 0x14 */
  297. u8 buffer_8;
  298. u16 buffer_16;
  299. u32 buffer_32;
  300. } buffer;
  301. struct {
  302. u8 ipcr; /* PSC + 0x18 */
  303. u8 reserved5[3];
  304. u8 acr; /* PSC + 0x1c */
  305. u8 reserved6[3];
  306. } ipcr_acr;
  307. struct {
  308. u16 isr; /* PSC + 0x20 */
  309. u8 reserved7[2];
  310. u16 imr; /* PSC + 0x24 */
  311. u8 reserved8[2];
  312. } isr_imr;
  313. u8 ctur; /* PSC + 0x28 */
  314. u8 reserved9[3];
  315. u8 ctlr; /* PSC + 0x2c */
  316. u8 reserved10[3];
  317. u32 ccr; /* PSC + 0x30 */
  318. u32 ac97slots; /* PSC + 0x34 */
  319. u32 ac97cmd; /* PSC + 0x38 */
  320. u32 ac97data; /* PSC + 0x3c */
  321. u8 reserved11[4];
  322. u8 ip; /* PSC + 0x44 */
  323. u8 reserved12[3];
  324. u8 op1; /* PSC + 0x48 */
  325. u8 reserved13[3];
  326. u8 op0; /* PSC + 0x4c */
  327. u8 reserved14[3];
  328. u32 sicr; /* PSC + 0x50 */
  329. u8 reserved15[4]; /* make eq. sizeof(mpc52xx_psc) */
  330. };
  331. #endif /* __ASM_MPC52xx_PSC_H__ */