2 * include/asm-ppc/mpc52xx_psc.h
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.
9 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
11 * Based/Extracted from some header of the 2.4 originally written by
12 * Dale Farnsworth <dfarnsworth@mvista.com>
14 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
15 * Copyright (C) 2003 MontaVista, Software, Inc.
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.
22 #ifndef __ASM_MPC52xx_PSC_H__
23 #define __ASM_MPC52xx_PSC_H__
25 #include <asm/types.h>
27 /* Max number of PSCs */
28 #define MPC52xx_PSC_MAXNUM 6
30 /* Programmable Serial Controller (PSC) status register bits */
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
41 /* PSC Command values */
42 #define MPC52xx_PSC_RX_ENABLE 0x0001
43 #define MPC52xx_PSC_RX_DISABLE 0x0002
44 #define MPC52xx_PSC_TX_ENABLE 0x0004
45 #define MPC52xx_PSC_TX_DISABLE 0x0008
46 #define MPC52xx_PSC_SEL_MODE_REG_1 0x0010
47 #define MPC52xx_PSC_RST_RX 0x0020
48 #define MPC52xx_PSC_RST_TX 0x0030
49 #define MPC52xx_PSC_RST_ERR_STAT 0x0040
50 #define MPC52xx_PSC_RST_BRK_CHG_INT 0x0050
51 #define MPC52xx_PSC_START_BRK 0x0060
52 #define MPC52xx_PSC_STOP_BRK 0x0070
54 /* PSC TxRx FIFO status bits */
55 #define MPC52xx_PSC_RXTX_FIFO_ERR 0x0040
56 #define MPC52xx_PSC_RXTX_FIFO_UF 0x0020
57 #define MPC52xx_PSC_RXTX_FIFO_OF 0x0010
58 #define MPC52xx_PSC_RXTX_FIFO_FR 0x0008
59 #define MPC52xx_PSC_RXTX_FIFO_FULL 0x0004
60 #define MPC52xx_PSC_RXTX_FIFO_ALARM 0x0002
61 #define MPC52xx_PSC_RXTX_FIFO_EMPTY 0x0001
63 /* PSC interrupt mask bits */
64 #define MPC52xx_PSC_IMR_TXRDY 0x0100
65 #define MPC52xx_PSC_IMR_RXRDY 0x0200
66 #define MPC52xx_PSC_IMR_DB 0x0400
67 #define MPC52xx_PSC_IMR_IPC 0x8000
69 /* PSC input port change bit */
70 #define MPC52xx_PSC_CTS 0x01
71 #define MPC52xx_PSC_DCD 0x02
72 #define MPC52xx_PSC_D_CTS 0x10
73 #define MPC52xx_PSC_D_DCD 0x20
76 #define MPC52xx_PSC_MODE_5_BITS 0x00
77 #define MPC52xx_PSC_MODE_6_BITS 0x01
78 #define MPC52xx_PSC_MODE_7_BITS 0x02
79 #define MPC52xx_PSC_MODE_8_BITS 0x03
80 #define MPC52xx_PSC_MODE_BITS_MASK 0x03
81 #define MPC52xx_PSC_MODE_PAREVEN 0x00
82 #define MPC52xx_PSC_MODE_PARODD 0x04
83 #define MPC52xx_PSC_MODE_PARFORCE 0x08
84 #define MPC52xx_PSC_MODE_PARNONE 0x10
85 #define MPC52xx_PSC_MODE_ERR 0x20
86 #define MPC52xx_PSC_MODE_FFULL 0x40
87 #define MPC52xx_PSC_MODE_RXRTS 0x80
89 #define MPC52xx_PSC_MODE_ONE_STOP_5_BITS 0x00
90 #define MPC52xx_PSC_MODE_ONE_STOP 0x07
91 #define MPC52xx_PSC_MODE_TWO_STOP 0x0f
93 #define MPC52xx_PSC_RFNUM_MASK 0x01ff
96 /* Structure of the hardware registers */
98 u8 mode
; /* PSC + 0x00 */
100 union { /* PSC + 0x04 */
104 #define mpc52xx_psc_status sr_csr.status
105 #define mpc52xx_psc_clock_select sr_csr.clock_select
107 u8 command
; /* PSC + 0x08 */
109 union { /* PSC + 0x0c */
114 #define mpc52xx_psc_buffer_8 buffer.buffer_8
115 #define mpc52xx_psc_buffer_16 buffer.buffer_16
116 #define mpc52xx_psc_buffer_32 buffer.buffer_32
117 union { /* PSC + 0x10 */
121 #define mpc52xx_psc_ipcr ipcr_acr.ipcr
122 #define mpc52xx_psc_acr ipcr_acr.acr
124 union { /* PSC + 0x14 */
128 #define mpc52xx_psc_isr isr_imr.isr
129 #define mpc52xx_psc_imr isr_imr.imr
131 u8 ctur
; /* PSC + 0x18 */
133 u8 ctlr
; /* PSC + 0x1c */
135 u16 ccr
; /* PSC + 0x20 */
137 u8 ivr
; /* PSC + 0x30 */
139 u8 ip
; /* PSC + 0x34 */
141 u8 op1
; /* PSC + 0x38 */
143 u8 op0
; /* PSC + 0x3c */
145 u32 sicr
; /* PSC + 0x40 */
146 u8 ircr1
; /* PSC + 0x44 */
148 u8 ircr2
; /* PSC + 0x44 */
150 u8 irsdr
; /* PSC + 0x4c */
152 u8 irmdr
; /* PSC + 0x50 */
154 u8 irfdr
; /* PSC + 0x54 */
158 struct mpc52xx_psc_fifo
{
159 u16 rfnum
; /* PSC + 0x58 */
161 u16 tfnum
; /* PSC + 0x5c */
163 u32 rfdata
; /* PSC + 0x60 */
164 u16 rfstat
; /* PSC + 0x64 */
166 u8 rfcntl
; /* PSC + 0x68 */
168 u16 rfalarm
; /* PSC + 0x6e */
170 u16 rfrptr
; /* PSC + 0x72 */
172 u16 rfwptr
; /* PSC + 0x76 */
174 u16 rflrfptr
; /* PSC + 0x7a */
176 u16 rflwfptr
; /* PSC + 0x7e */
177 u32 tfdata
; /* PSC + 0x80 */
178 u16 tfstat
; /* PSC + 0x84 */
180 u8 tfcntl
; /* PSC + 0x88 */
182 u16 tfalarm
; /* PSC + 0x8e */
184 u16 tfrptr
; /* PSC + 0x92 */
186 u16 tfwptr
; /* PSC + 0x96 */
188 u16 tflrfptr
; /* PSC + 0x9a */
190 u16 tflwfptr
; /* PSC + 0x9e */
193 #define MPC512x_PSC_FIFO_RESET_SLICE 0x80
194 #define MPC512x_PSC_FIFO_ENABLE_SLICE 0x01
195 #define MPC512x_PSC_FIFO_ENABLE_DMA 0x04
197 #define MPC512x_PSC_FIFO_EMPTY 0x1
198 #define MPC512x_PSC_FIFO_FULL 0x2
199 #define MPC512x_PSC_FIFO_ALARM 0x4
200 #define MPC512x_PSC_FIFO_URERR 0x8
201 #define MPC512x_PSC_FIFO_ORERR 0x01
202 #define MPC512x_PSC_FIFO_MEMERROR 0x02
204 struct mpc512x_psc_fifo
{
206 u32 txcmd
; /* PSC + 0x80 */
207 u32 txalarm
; /* PSC + 0x84 */
208 u32 txsr
; /* PSC + 0x88 */
209 u32 txisr
; /* PSC + 0x8c */
210 u32 tximr
; /* PSC + 0x90 */
211 u32 txcnt
; /* PSC + 0x94 */
212 u32 txptr
; /* PSC + 0x98 */
213 u32 txsz
; /* PSC + 0x9c */
219 } txdata
; /* PSC + 0xbc */
220 #define txdata_8 txdata.txdata_8
221 #define txdata_16 txdata.txdata_16
222 #define txdata_32 txdata.txdata_32
223 u32 rxcmd
; /* PSC + 0xc0 */
224 u32 rxalarm
; /* PSC + 0xc4 */
225 u32 rxsr
; /* PSC + 0xc8 */
226 u32 rxisr
; /* PSC + 0xcc */
227 u32 rximr
; /* PSC + 0xd0 */
228 u32 rxcnt
; /* PSC + 0xd4 */
229 u32 rxptr
; /* PSC + 0xd8 */
230 u32 rxsz
; /* PSC + 0xdc */
236 } rxdata
; /* PSC + 0xfc */
237 #define rxdata_8 rxdata.rxdata_8
238 #define rxdata_16 rxdata.rxdata_16
239 #define rxdata_32 rxdata.rxdata_32
242 #endif /* __ASM_MPC52xx_PSC_H__ */