ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / char / serial_tx3912.h
1 /*
2  *  drivers/char/serial_tx3912.h
3  *
4  *  Copyright (C) 1999 Harald Koerfgen
5  *  Copyright (C) 2000 Jim Pick <jim@jimpick.com>
6  *  Copyright (C) 2001 Steven J. Hill (sjhill@realitydiluted.com)
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  *
12  *  Serial driver for TMPR3912/05 and PR31700 processors
13  */
14 #include <linux/serialP.h>
15 #include <linux/generic_serial.h>
16
17 /* UART Interrupt (Interrupt 2) bits (UARTA,UARTB) */
18 #define UART_RX_INT         9  /* receiver holding register full  (31, 21) */
19 #define UART_RXOVERRUN_INT  8  /* receiver overrun error          (30, 20) */
20 #define UART_FRAMEERR_INT   7  /* receiver frame error            (29, 19) */
21 #define UART_BREAK_INT      6  /* received break signal           (28, 18) */
22 #define UART_PARITYERR_INT  5  /* receiver parity error           (27, 17) */
23 #define UART_TX_INT         4  /* transmit holding register empty (26, 16) */
24 #define UART_TXOVERRUN_INT  3  /* transmit overrun error          (25, 15) */
25 #define UART_EMPTY_INT      2  /* both trans/recv regs empty      (24, 14) */
26 #define UART_DMAFULL_INT    1  /* DMA at end of buffer            (23, 13) */
27 #define UART_DMAHALF_INT    0  /* DMA halfway through buffer      (22, 12) */
28
29 #define UARTA_SHIFT        22
30 #define UARTB_SHIFT        12
31
32 #define INTTYPE(interrupttype)            (1 << interrupttype)
33
34 /* 
35  * This driver can spew a whole lot of debugging output at you. If you
36  * need maximum performance, you should disable the DEBUG define.
37  */
38 #undef TX3912_UART_DEBUG
39
40 #ifdef TX3912_UART_DEBUG
41 #define TX3912_UART_DEBUG_OPEN          0x00000001
42 #define TX3912_UART_DEBUG_SETTING       0x00000002
43 #define TX3912_UART_DEBUG_FLOW          0x00000004
44 #define TX3912_UART_DEBUG_MODEMSIGNALS  0x00000008
45 #define TX3912_UART_DEBUG_TERMIOS       0x00000010
46 #define TX3912_UART_DEBUG_TRANSMIT      0x00000020
47 #define TX3912_UART_DEBUG_RECEIVE       0x00000040
48 #define TX3912_UART_DEBUG_INTERRUPTS    0x00000080
49 #define TX3912_UART_DEBUG_PROBE         0x00000100
50 #define TX3912_UART_DEBUG_INIT          0x00000200
51 #define TX3912_UART_DEBUG_CLEANUP       0x00000400
52 #define TX3912_UART_DEBUG_CLOSE         0x00000800
53 #define TX3912_UART_DEBUG_FIRMWARE      0x00001000
54 #define TX3912_UART_DEBUG_MEMTEST       0x00002000
55 #define TX3912_UART_DEBUG_THROTTLE      0x00004000
56 #define TX3912_UART_DEBUG_ALL           0xffffffff
57
58 int rs_debug = TX3912_UART_DEBUG_ALL & ~TX3912_UART_DEBUG_TRANSMIT;
59
60 #define rs_dprintk(f, str...) if (rs_debug & f) printk (str)
61 #define func_enter() rs_dprintk (TX3912_UART_DEBUG_FLOW,        \
62                                 "rs: enter %s\n", __FUNCTION__)
63 #define func_exit() rs_dprintk (TX3912_UART_DEBUG_FLOW, \
64                                 "rs: exit %s\n", __FUNCTION__)
65
66 #else
67 #define rs_dprintk(f, str...)
68 #define func_enter()
69 #define func_exit()
70
71 #endif  /* TX3912_UART_DEBUG */
72
73 /*
74  * Number of serial ports
75  */
76 #define TX3912_UART_NPORTS  2
77
78 /*
79  * Hardware specific serial port structure
80  */
81 struct rs_port {        
82         struct gs_port          gs;             /* Must be first field! */
83
84         unsigned long           base;
85         int                     intshift;       /* Register shift */
86         struct wait_queue       *shutdown_wait; 
87         int                     stat_flags;
88         struct async_icount     icount;         /* Counters for 4 input IRQs */
89         int                     read_status_mask;
90         int                     ignore_status_mask;
91         int                     x_char;         /* XON/XOFF character */
92 };