xref: /netbsd/sys/dev/ic/clmpccreg.h (revision bf9ec67e)
1 /*  $NetBSD: clmpccreg.h,v 1.3 1999/11/28 12:23:18 scw Exp $ */
2 
3 /*-
4  * Copyright (c) 1999 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Steve C. Woodford.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *        This product includes software developed by the NetBSD
21  *        Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 /*
40  * Register definitions for the Cirrus Logic CD2400/CD2401
41  * Four Channel Multi-Protocol Communications Controller.
42  *
43  * The values defined here are based on the August 1993 data book.
44  * At the present time, this driver supports non-DMA async. mode only.
45  */
46 
47 #ifndef __clmpccreg_h
48 #define __clmpccreg_h
49 
50 /*
51  * Register offsets depend on the level on the chip's BYTESWAP pin.
52  * When BYTESWAP is low, Motorola byte alignment is in effect.
53  * Otherwise, Intel byte alignment is in effect.
54  * The values given here assume BYTESWAP is low. See 'sc_byteswap'
55  * <dev/ic/clmpccvar.h>.
56  */
57 
58 /* Number of bytes of FIFO (Rx & Tx) */
59 #define CLMPCC_FIFO_DEPTH   16
60 
61 /* Global Registers */
62 #define CLMPCC_REG_GFRCR    0x81    /* Global Firmware Revision Code Register */
63 #define CLMPCC_REG_CAR      0xee    /* Channel Access Register */
64 
65 /* Option Registers */
66 #define CLMPCC_REG_CMR      0x1b    /* Channel Mode Register */
67 #define CLMPCC_REG_COR1     0x10    /* Channel Option Register #1 */
68 #define CLMPCC_REG_COR2     0x17    /* Channel Option Register #2 */
69 #define CLMPCC_REG_COR3     0x16    /* Channel Option Register #3 */
70 #define CLMPCC_REG_COR4     0x15    /* Channel Option Register #4 */
71 #define CLMPCC_REG_COR5     0x14    /* Channel Option Register #5 */
72 #define CLMPCC_REG_COR6     0x18    /* Channel Option Register #6 */
73 #define CLMPCC_REG_COR7     0x07    /* Channel Option Register #7 */
74 #define CLMPCC_REG_SCHR1    0x1f    /* Special Character Register #1 */
75 #define CLMPCC_REG_SCHR2    0x1e    /* Special Character Register #2 */
76 #define CLMPCC_REG_SCHR3    0x1d    /* Special Character Register #3 */
77 #define CLMPCC_REG_SCHR4    0x1c    /* Special Character Register #4 */
78 #define CLMPCC_REG_SCRl     0x23    /* Special Character Range (low) */
79 #define CLMPCC_REG_SCRh     0x22    /* Special Character Range (high) */
80 #define CLMPCC_REG_LNXT     0x2e    /* LNext Character */
81 #define CLMPCC_REG_RFAR1    0x1f    /* Receive Frame Address Register #1 */
82 #define CLMPCC_REG_RFAR2    0x1e    /* Receive Frame Address Register #2 */
83 #define CLMPCC_REG_RFAR3    0x1d    /* Receive Frame Address Register #3 */
84 #define CLMPCC_REG_RFAR4    0x1c    /* Receive Frame Address Register #4 */
85 #define CLMPCC_REG_CPSR     0xd6    /* CRC Polynomial Select Register */
86 
87 /* Bit Rate and Clock Option Registers */
88 #define CLMPCC_REG_RBPR     0xcb    /* Receive Baud Rate Period Register */
89 #define CLMPCC_REG_RCOR     0xc8    /* Receive Clock Options Register */
90 #define CLMPCC_REG_TBPR     0xc3    /* Transmit Baud Rate Period Register */
91 #define CLMPCC_REG_TCOR     0xc0    /* Transmit Clock Options Register */
92 
93 /* Channel Command and Status Registers */
94 #define CLMPCC_REG_CCR      0x13    /* Channel Command Register */
95 #define CLMPCC_REG_STCR     0x12    /* Special Transmit Command Register */
96 #define CLMPCC_REG_CSR      0x1a    /* Channel Status Register */
97 #define CLMPCC_REG_MSVR     0xde    /* Modem Signal Value Register */
98 #define CLMPCC_REG_MSVR_RTS 0xde    /* Modem Signal Value Register (RTS) */
99 #define CLMPCC_REG_MSVR_DTR 0xdf    /* Modem Signal Value Register (DTR) */
100 
101 /* Interrupt Registers */
102 #define CLMPCC_REG_LIVR     0x09    /* Local Interrupt Vector Register */
103 #define CLMPCC_REG_IER      0x11    /* Interrupt Enable Register */
104 #define CLMPCC_REG_LICR     0x26    /* Local Interrupting Channel Register */
105 #define CLMPCC_REG_STK      0xe2    /* Stack Register */
106 
107 /* Receive Interrupt Registers */
108 #define CLMPCC_REG_RPILR    0xe1    /* Receive Priority Interrupt Level Reg */
109 #define CLMPCC_REG_RIR      0xed    /* Receive Interrupt Register */
110 #define CLMPCC_REG_RISR     0x88    /* Receive Interrupt Status Reg (16-bits) */
111 #define CLMPCC_REG_RISRl    0x89    /* Receive Interrupt Status Reg (low) */
112 #define CLMPCC_REG_RISRh    0x88    /* Receive Interrupt Status Reg (high) */
113 #define CLMPCC_REG_RFOC     0x30    /* Receive FIFO Output Count */
114 #define CLMPCC_REG_RDR      0xf8    /* Receive Data Register */
115 #define CLMPCC_REG_REOIR    0x84    /* Receive End of Interrupt Register */
116 
117 /* Transmit Interrupt Registers */
118 #define CLMPCC_REG_TPILR    0xe0    /* Transmit Priority Interrupt Level Reg */
119 #define CLMPCC_REG_TIR      0xec    /* Transmit Interrupt Register */
120 #define CLMPCC_REG_TISR     0x8a    /* Transmit Interrupt Status Register */
121 #define CLMPCC_REG_TFTC     0x80    /* Transmit FIFO Transfer Count */
122 #define CLMPCC_REG_TDR      0xf8    /* Transmit Data Register */
123 #define CLMPCC_REG_TEOIR    0x85    /* Transmit End of Interrupt Register */
124 
125 /* Modem Interrupt Registers */
126 #define CLMPCC_REG_MPILR    0xe3    /* Modem Priority Interrupt Level Reg */
127 #define CLMPCC_REG_MIR      0xef    /* Modem Interrupt Register */
128 #define CLMPCC_REG_MISR     0x8b    /* Modem (/Timer) Interrupt Status Reg */
129 #define CLMPCC_REG_MEOIR    0x86    /* Modem End of Interrupt Register */
130 
131 /* DMA Registers */
132 #define CLMPCC_REG_DMR      0xf6    /* DMA Mode Register (write only) */
133 #define CLMPCC_REG_BERCNT   0x8e    /* Bus Error Retry Count */
134 #define CLMPCC_REG_DMABSTS  0x19    /* DMA Buffer Status */
135 
136 /* DMA Receive Registers */
137 #define CLMPCC_REG_ARBADRL  0x42    /* A Receive Buffer Address Lower (word) */
138 #define CLMPCC_REG_ARBADRU  0x40    /* A Receive Buffer Address Upper (word) */
139 #define CLMPCC_REG_BRBADRL  0x46    /* B Receive Buffer Address Lower (word) */
140 #define CLMPCC_REG_BRBADRU  0x44    /* B Receive Buffer Address Upper (16bit) */
141 #define CLMPCC_REG_ARBCNT   0x4a    /* A Receive Buffer Byte Count (word) */
142 #define CLMPCC_REG_BRBCNT   0x48    /* B Receive Buffer Byte Count (word) */
143 #define CLMPCC_REG_ARBSTS   0x4f    /* A Receive Buffer Status */
144 #define CLMPCC_REG_BRBSTS   0x4e    /* B Receive Buffer Status */
145 #define CLMPCC_REG_RCBADRL  0x3e    /* Receive Current Buff Addr Lower (word) */
146 #define CLMPCC_REG_RCBADRU  0x3c    /* Receive Current Buff Addr Upper (word) */
147 
148 /* DMA Transmit Registers */
149 #define CLMPCC_REG_ATBADRL  0x52    /* A Transmit Buffer Address Lower (word) */
150 #define CLMPCC_REG_ATBADRU  0x50    /* A Transmit Buffer Address Upper (word) */
151 #define CLMPCC_REG_BTBADRL  0x56    /* B Transmit Buffer Address Lower (word) */
152 #define CLMPCC_REG_BTBADRU  0x54    /* B Transmit Buffer Address Upper (word) */
153 #define CLMPCC_REG_ATBCNT   0x5a    /* A Transmit Buffer Byte Count (word) */
154 #define CLMPCC_REG_BTBCNT   0x58    /* B Transmit Buffer Byte Count (word) */
155 #define CLMPCC_REG_ATBSTS   0x5f    /* A Transmit Buffer Status */
156 #define CLMPCC_REG_BTBSTS   0x5e    /* B Transmit Buffer Status */
157 #define CLMPCC_REG_TCBADRL  0x3a    /* Transmit Current Buf Addr Lower (word) */
158 #define CLMPCC_REG_TCBADRU  0x38    /* Transmit Current Buf Addr Upper (word) */
159 
160 /* Timer Registers */
161 #define CLMPCC_REG_TPR      0xda    /* Timer Period Register */
162 #define CLMPCC_REG_RTPR     0x24    /* Receive Timeout Period Register (word) */
163 #define CLMPCC_REG_RTPRl    0x25    /* Receive Timeout Period Register (low) */
164 #define CLMPCC_REG_RTPRh    0x24    /* Receive Timeout Period Register (high) */
165 #define CLMPCC_REG_GT1      0x2a    /* General Timer 1 (word) */
166 #define CLMPCC_REG_GT1l     0x2b    /* General Timer 1 (low) */
167 #define CLMPCC_REG_GT1h     0x2a    /* General Timer 1 (high) */
168 #define CLMPCC_REG_GT2      0x29    /* General Timer 2 */
169 #define CLMPCC_REG_TTR      0x29    /* Transmit Timer Register */
170 
171 
172 /* Channel Access Register */
173 #define CLMPCC_CAR_MASK         0x03        /* Channel bit mask */
174 
175 /* Channel Mode Register */
176 #define CLMPCC_CMR_RX_INT       (0 << 7)    /* Rx using interrupts */
177 #define CLMPCC_CMR_RX_DMA       (1 << 7)    /* Rx using DMA */
178 #define CLMPCC_CMR_TX_INT       (0 << 6)    /* Tx using interrupts */
179 #define CLMPCC_CMR_TX_DMA       (1 << 6)    /* Tx using DMA */
180 #define CLMPCC_CMR_HDLC         0x00        /* Select HDLC mode */
181 #define CLMPCC_CMR_BISYNC       0x01        /* Select Bisync mode */
182 #define CLMPCC_CMR_ASYNC        0x02        /* Select async mode */
183 #define CLMPCC_CMR_X21          0x03        /* Select X.21 mode */
184 
185 /* Channel Option Register #1 (Async options) */
186 #define CLMPCC_COR1_EVEN_PARITY (0 << 7)    /* Even parity */
187 #define CLMPCC_COR1_ODD_PARITY  (1 << 7)    /* Odd parity */
188 #define CLMPCC_COR1_NO_PARITY   (0 << 5)    /* No parity */
189 #define CLMPCC_COR1_FORCE_PAR   (1 << 5)    /* Force parity */
190 #define CLMPCC_COR1_NORM_PARITY (2 << 5)    /* Normal parity */
191 #define CLMPCC_COR1_CHECK_PAR   (0 << 4)    /* Check parity */
192 #define CLMPCC_COR1_IGNORE_PAR  (1 << 4)    /* Ignore parity */
193 #define CLMPCC_COR1_CHAR_5BITS  0x04        /* 5 bits per character */
194 #define CLMPCC_COR1_CHAR_6BITS  0x05        /* 6 bits per character */
195 #define CLMPCC_COR1_CHAR_7BITS  0x06        /* 7 bits per character */
196 #define CLMPCC_COR1_CHAR_8BITS  0x07        /* 8 bits per character */
197 
198 /* Channel Option Register #2 (Async options) */
199 #define CLMPCC_COR2_IXM         (1 << 7)    /* Implied XON mode */
200 #define CLMPCC_COR2_TxIBE       (1 << 6)    /* Transmit In-Band Flow Control */
201 #define CLMPCC_COR2_ETC         (1 << 5)    /* Embedded Tx Command Enable */
202 #define CLMPCC_COR2_RLM         (1 << 3)    /* Remote Loopback Mode */
203 #define CLMPCC_COR2_RtsAO       (1 << 2)    /* RTS Automatic Output Enable */
204 #define CLMPCC_COR2_CtsAE       (1 << 1)    /* CTS Automatic Enable */
205 #define CLMPCC_COR2_DsrAE       (1 << 1)    /* DSR Automatic Enable */
206 
207 /* Embedded transmit commands */
208 #define	CLMPCC_ETC_MAGIC		0x00		/* Introduces a command */
209 #define	CLMPCC_ETC_SEND_BREAK	0x81		/* Send a BREAK character */
210 #define	CLMPCC_ETC_DELAY		0x82		/* Insert a delay */
211 #define	CLMPCC_ETC_STOP_BREAK	0x83		/* Stop sending BREAK */
212 
213 /* Channel Option Register #3 (Async options) */
214 #define CLMPCC_COR3_ESCDE       (1 << 7)    /* Ext Special Char Detect Enab */
215 #define CLMPCC_COR3_RngDE       (1 << 6)    /* Range Detect Enable */
216 #define CLMPCC_COR3_FCT         (1 << 5)    /* Flow Ctrl Transparency Mode */
217 #define CLMPCC_COR3_SCDE        (1 << 4)    /* Special Character Detection */
218 #define CLMPCC_COR3_SpIstp      (1 << 3)    /* Special Character I Strip */
219 #define CLMPCC_COR3_STOP_1      0x02        /* 1 Stop Bit */
220 #define CLMPCC_COR3_STOP_1_5    0x03        /* 1.5 Stop Bits */
221 #define CLMPCC_COR3_STOP_2      0x04        /* 2 Stop Bits */
222 
223 /* Channel Option Register #4 */
224 #define CLMPCC_COR4_DSRzd       (1 << 7)    /* Detect 1->0 transition on DSR */
225 #define CLMPCC_COR4_CDzd        (1 << 6)    /* Detect 1->0 transition on CD */
226 #define CLMPCC_COR4_CTSzd       (1 << 5)    /* Detect 1->0 transition on CTS */
227 #define CLMPCC_COR4_FIFO_MASK   0x0f        /* FIFO Threshold bits */
228 #define CLMPCC_COR4_FIFO_LOW	1
229 #define CLMPCC_COR4_FIFO_MED	4
230 #define CLMPCC_COR4_FIFO_HIGH	8
231 
232 /* Channel Option Register #5 */
233 #define CLMPCC_COR5_DSRod       (1 << 7)    /* Detect 0->1 transition on DSR */
234 #define CLMPCC_COR5_CDod        (1 << 6)    /* Detect 0->1 transition on CD */
235 #define CLMPCC_COR5_CTSod       (1 << 5)    /* Detect 0->1 transition on CTS */
236 #define CLMPCC_COR5_FLOW_MASK   0x0f        /* Rx Flow Control FIFO Threshold */
237 #define CLMPCC_COR5_FLOW_NORM	8
238 
239 /* Channel Option Register #6 (Async options) */
240 #define CLMPCC_COR6_RX_CRNL     0x00        /* No special action on CR or NL */
241 #define CLMPCC_COR6_BRK_EXCEPT  (0 << 3)    /* Exception interrupt on BREAK */
242 #define CLMPCC_COR6_BRK_2_NULL  (1 << 3)    /* Translate BREAK to NULL char */
243 #define CLMPCC_COR6_BRK_DISCARD (3 << 3)    /* Discard BREAK characters */
244 #define CLMPCC_COR6_PF_EXCEPT   0x00        /* Exception irq on parity/frame */
245 #define CLMPCC_COR6_PF_2_NULL   0x01        /* Translate parity/frame to NULL */
246 #define CLMPCC_COR6_PF_IGNORE   0x02        /* Ignore error */
247 #define CLMPCC_COR6_PF_DISCARD  0x03        /* Discard character */
248 #define CLMPCC_COR6_PF_TRANS    0x05        /* Translate to FF NULL + char */
249 
250 /* Channel Option Register #7 (Async options) */
251 #define CLMPCC_COR7_ISTRIP      (1 << 7)    /* Strip MSB */
252 #define CLMPCC_COR7_LNE         (1 << 6)    /* Enable LNext Option */
253 #define CLMPCC_COR7_FCERR       (1 << 5)    /* Flow Control on Error Char */
254 #define CLMPCC_COR7_TX_CRNL     0x00        /* No special action on NL or CR */
255 
256 /* Receive Clock Options Register */
257 #define CLMPCC_RCOR_CLK(x)	(x)
258 #define CLMPCC_RCOR_TLVAL       (1 << 7)    /* Transmit Line Value */
259 #define CLMPCC_RCOR_DPLL_ENABLE (1 << 5)    /* Phase Locked Loop Enable */
260 #define CLMPCC_RCOR_DPLL_NRZ    (0 << 3)    /* PLL runs in NRZ mode */
261 #define CLMPCC_RCOR_DPLL_NRZI   (1 << 3)    /* PLL runs in NRZI mode */
262 #define CLMPCC_RCOR_DPLL_MAN    (2 << 3)    /* PLL runs in Manchester mode */
263 #define CLMPCC_RCOR_CLK_0       0x0         /* Rx Clock Source 'Clk0' */
264 #define CLMPCC_RCOR_CLK_1       0x1         /* Rx Clock Source 'Clk1' */
265 #define CLMPCC_RCOR_CLK_2       0x2         /* Rx Clock Source 'Clk2' */
266 #define CLMPCC_RCOR_CLK_3       0x3         /* Rx Clock Source 'Clk3' */
267 #define CLMPCC_RCOR_CLK_4       0x4         /* Rx Clock Source 'Clk4' */
268 #define CLMPCC_RCOR_CLK_EXT     0x6         /* Rx Clock Source 'External' */
269 
270 /* Transmit Clock Options Register */
271 #define CLMPCC_TCOR_CLK(x)	((x) << 5)
272 #define CLMPCC_TCOR_CLK_0       (0 << 5)    /* Tx Clock Source 'Clk0' */
273 #define CLMPCC_TCOR_CLK_1       (1 << 5)    /* Tx Clock Source 'Clk1' */
274 #define CLMPCC_TCOR_CLK_2       (2 << 5)    /* Tx Clock Source 'Clk2' */
275 #define CLMPCC_TCOR_CLK_3       (3 << 5)    /* Tx Clock Source 'Clk3' */
276 #define CLMPCC_TCOR_CLK_4       (4 << 5)    /* Tx Clock Source 'Clk4' */
277 #define CLMPCC_TCOR_CLK_EXT     (6 << 5)    /* Tx Clock Source 'External' */
278 #define CLMPCC_TCOR_CLK_RX      (7 << 5)    /* Tx Clock Source 'Same as Rx' */
279 #define CLMPCC_TCOR_EXT_1X      (1 << 3)    /* Times 1 External Clock */
280 #define CLMPCC_TCOR_LOCAL_LOOP  (1 << 1)    /* Enable Local Loopback */
281 
282 /* Special Transmit Command Register */
283 #define	CLMPCC_STCR_SSPC(n)	((n) & 0x7) /* Send special character 'n' */
284 #define CLMPCC_STCR_SND_SPC	(1 << 3)    /* Initiate send special char */
285 #define	CLMPCC_STCR_APPEND_COMP	(1 << 5)    /* Append complete (Async DMA) */
286 #define CLMPCC_STCR_ABORT_TX	(1 << 6)    /* Abort Tx (HDLC Mode only) */
287 
288 /* Channel Command Register */
289 #define CLMPCC_CCR_T0_CLEAR     0x40        /* Type 0: Clear Channel */
290 #define CLMPCC_CCR_T0_INIT      0x20        /* Type 0: Initialise Channel */
291 #define CLMPCC_CCR_T0_RESET_ALL 0x10        /* Type 0: Reset All */
292 #define CLMPCC_CCR_T0_TX_EN     0x08        /* Type 0: Transmitter Enable */
293 #define CLMPCC_CCR_T0_TX_DIS    0x04        /* Type 0: Transmitter Disable */
294 #define CLMPCC_CCR_T0_RX_EN     0x02        /* Type 0: Receiver Enable */
295 #define CLMPCC_CCR_T0_RX_DIS    0x01        /* Type 0: Receiver Disable */
296 #define CLMPCC_CCR_T1_CLR_TMR1  0xc0        /* Type 1: Clear Timer 1 */
297 #define CLMPCC_CCR_T1_CLR_TMR2  0xa0        /* Type 1: Clear Timer 5 */
298 #define CLMPCC_CCR_T1_CLR_RECV  0x90        /* Type 1: Clear Receiver */
299 
300 /* Channel Status Register (Async Mode) */
301 #define CLMPCC_CSR_RX_ENABLED   (1 << 7)    /* Receiver Enabled */
302 #define CLMPCC_CSR_RX_FLOW_OFF  (1 << 6)    /* Receive Flow Off */
303 #define CLMPCC_CSR_RX_FLOW_ON   (1 << 5)    /* Receive Flow On */
304 #define CLMPCC_CSR_TX_ENABLED   (1 << 3)    /* Transmitter Enabled */
305 #define CLMPCC_CSR_TX_FLOW_OFF  (1 << 2)    /* Transmit Flow Off */
306 #define CLMPCC_CSR_TX_FLOW_ON   (1 << 1)    /* Transmit Flow On */
307 
308 /* Modem Signal Value Register */
309 #define CLMPCC_MSVR_DSR         (1 << 7)    /* Current State of DSR Input */
310 #define CLMPCC_MSVR_CD          (1 << 6)    /* Current State of CD Input */
311 #define CLMPCC_MSVR_CTS         (1 << 5)    /* Current State of CTS Input */
312 #define CLMPCC_MSVR_DTR_OPT     (1 << 4)    /* DTR Option Select */
313 #define CLMPCC_MSVR_PORT_ID     (1 << 2)    /* Device Type (2400 / 2401) */
314 #define CLMPCC_MSVR_DTR         (1 << 1)    /* Current State of DTR Output */
315 #define CLMPCC_MSVR_RTS         (1 << 0)    /* Current State of RTS Output */
316 
317 /* Local Interrupt Vector Register */
318 #define CLMPCC_LIVR_TYPE_MASK	0x03	    /* Type of Interrupt */
319 #define CLMPCC_LIVR_EXCEPTION	0x0	    /* Exception (DMA Completion) */
320 #define CLMPCC_LIVR_MODEM	0x1	    /* Modem Signal Change */
321 #define CLMPCC_LIVR_TX		0x2	    /* Transmit Data Interrupt */
322 #define CLMPCC_LIVR_RX		0x3	    /* Receive Data Interrupt */
323 
324 /* Interrupt Enable Register */
325 #define CLMPCC_IER_MODEM        (1 << 7)    /* Modem Pin Change Detect */
326 #define CLMPCC_IER_RET          (1 << 5)    /* Receive Exception Timeout */
327 #define CLMPCC_IER_RX_FIFO      (1 << 3)    /* Rx FIFO Threshold Reached */
328 #define CLMPCC_IER_TIMER        (1 << 2)    /* General Timer(s) Timeout */
329 #define CLMPCC_IER_TX_EMPTY     (1 << 1)    /* Tx Empty */
330 #define CLMPCC_IER_TX_FIFO      (1 << 0)    /* Tx FIFO Threshold Reached */
331 
332 /* Local Interrupting Channel Register */
333 #define CLMPCC_LICR_MASK	0x0c	    /* Mask for channel number */
334 #define CLMPCC_LICR_CHAN(v)	(((v) & CLMPCC_LICR_MASK) >> 2)
335 
336 /* Receive Interrupt Register */
337 #define CLMPCC_RIR_REN		(1 << 7)    /* Receive Enable */
338 #define CLMPCC_RIR_RACT		(1 << 6)    /* Receive Active */
339 #define CLMPCC_RIR_REOI		(1 << 5)    /* Receive End of Interrupt */
340 #define CLMPCC_RIR_RCVT_MASK	0x0c
341 #define CLMPCC_RIR_RCN_MASK	0x03
342 
343 /* Receive Interrupt Status Register, Low (Async option) */
344 #define CLMPCC_RISR_TIMEOUT	(1 << 7)    /* Rx FIFO Empty and Timeout */
345 #define CLMPCC_RISR_OVERRUN	(1 << 3)    /* Rx Overrun Error */
346 #define CLMPCC_RISR_PARITY	(1 << 2)    /* Rx Parity Error */
347 #define CLMPCC_RISR_FRAMING	(1 << 1)    /* Rx Framing Error */
348 #define CLMPCC_RISR_BREAK	(1 << 0)    /* BREAK Detected */
349 
350 /* Receive FIFO Counter Register */
351 #define CLMPCC_RFOC_MASK	0x1f	    /* Mask for valid bits */
352 
353 /* Receive End of Interrupt Register */
354 #define CLMPCC_REOIR_TERMBUFF	(1 << 7)    /* Terminate Current DMA Buffer */
355 #define CLMPCC_REOIR_DIS_EX_CHR	(1 << 6)    /* Discard Exception Char (DMA) */
356 #define CLMPCC_REOIR_TMR2_SYNC	(1 << 5)    /* Set Timer 2 in Sync Mode */
357 #define CLMPCC_REOIR_TMR1_SYNC	(1 << 4)    /* Set Timer 1 in Sync Mode */
358 #define CLMPCC_REOIR_NO_TRANS	(1 << 3)    /* No Transfer of Data */
359 
360 /* Transmit Interrupt Register */
361 #define CLMPCC_TIR_TEN		(1 << 7)    /* Transmit Enable */
362 #define CLMPCC_TIR_TACT		(1 << 6)    /* Transmit Active */
363 #define CLMPCC_TIR_TEOI		(1 << 5)    /* Transmit End of Interrupt */
364 #define CLMPCC_TIR_TCVT_MASK	0x0c
365 #define CLMPCC_TIR_TCN_MASK	0x03
366 
367 /* Transmit Interrupt Status Register (Async option) */
368 #define CLMPCC_TISR_BERR	(1 << 7)    /* Bus Error (DMA) */
369 #define CLMPCC_TISR_EOF		(1 << 6)    /* Transmit End of Frame (DMA) */
370 #define CLMPCC_TISR_EOB		(1 << 5)    /* Transmit End of Buffer (DMA) */
371 #define CLMPCC_TISR_UNDERRUN	(1 << 4)    /* Transmit Underrun (sync only) */
372 #define CLMPCC_TISR_BUFF_ID	(1 << 3)    /* Buffer that has exception */
373 #define CLMPCC_TISR_TX_EMPTY	(1 << 1)    /* Transmitter Empty */
374 #define CLMPCC_TISR_TX_FIFO	(1 << 0)    /* Transmit FIFO Below Threshold */
375 
376 /* Transmit FIFO Transfer Count Register */
377 #define CLMPCC_TFTC_MASK	0x1f	    /* Mask for valid bits */
378 
379 /* Transmit End of Interrupt Register */
380 #define CLMPCC_TEOIR_TERMBUFF	(1 << 7)    /* Terminate Current DMA Buffer */
381 #define CLMPCC_TEOIR_END_OF_FRM	(1 << 6)    /* End of Frame (sync mode) */
382 #define CLMPCC_TEOIR_TMR2_SYNC	(1 << 5)    /* Set Timer 2 in Sync Mode */
383 #define CLMPCC_TEOIR_TMR1_SYNC	(1 << 4)    /* Set Timer 1 in Sync Mode */
384 #define CLMPCC_TEOIR_NO_TRANS	(1 << 3)    /* No Transfer of Data */
385 
386 /* Modem Interrupt Register */
387 #define CLMPCC_MIR_MEN		(1 << 7)    /* Modem Enable */
388 #define CLMPCC_MIR_MACT		(1 << 6)    /* Modem Active */
389 #define CLMPCC_MIR_MEOI		(1 << 5)    /* Modem End of Interrupt */
390 #define CLMPCC_MIR_MCVT_MASK	0x0c
391 #define CLMPCC_MIR_MCN_MASK	0x03
392 
393 /* Modem/Timer Interrupt Status Register */
394 #define CLMPCC_MISR_DSR		(1 << 7)    /* DSR Changed State */
395 #define CLMPCC_MISR_CD		(1 << 6)    /* CD Changed State */
396 #define CLMPCC_MISR_CTS		(1 << 5)    /* CTS Changed State */
397 #define CLMPCC_MISR_TMR2	(1 << 1)    /* Timer 2 Timed Out */
398 #define CLMPCC_MISR_TMR1	(1 << 0)    /* Timer 1 Timed Out */
399 
400 /* Modem End of Interrupt Register */
401 #define CLMPCC_MEOIR_TMR2_SYNC	(1 << 5)    /* Set Timer 2 in Sync Mode */
402 #define CLMPCC_MEOIR_TMR1_SYNC	(1 << 4)    /* Set Timer 1 in Sync Mode */
403 
404 /* Default value for CLMPCC_REG_RTPRl */
405 #define CLMPCC_RTPR_DEFAULT	2	    /* 2mS timeout period */
406 
407 /*
408  * Return a value for the Receive Timer Prescaler register
409  * for a given clock rate and number of milliseconds.
410  * The minimum recommended value for this register is 0x0a.
411  */
412 #define CLMPCC_MSEC_TO_TPR(c,m)	(((((c)/2048)/(1000/(m))) > 0x0a) ?	\
413 				  (((c)/2048)/(1000/(m))) : 0x0a)
414 
415 #endif  /* __clmpccreg_h */
416