[PATCH] W1: w1_netlink: New init/fini netlink callbacks.
[linux-2.6/verdex.git] / drivers / serial / 68328serial.h
blob978f8a609f3dbf8c3b4d901fae505331b4935de2
1 /* 68328serial.h: Definitions for the mc68328 serial driver.
3 * Copyright (C) 1995 David S. Miller <davem@caip.rutgers.edu>
4 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
5 * Copyright (C) 1998, 1999 D. Jeff Dionne <jeff@uclinux.org>
6 * Copyright (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>
8 * VZ Support/Fixes Evan Stawnyczy <e@lineo.ca>
9 */
11 #ifndef _MC683XX_SERIAL_H
12 #define _MC683XX_SERIAL_H
14 #include <linux/config.h>
16 struct serial_struct {
17 int type;
18 int line;
19 int port;
20 int irq;
21 int flags;
22 int xmit_fifo_size;
23 int custom_divisor;
24 int baud_base;
25 unsigned short close_delay;
26 char reserved_char[2];
27 int hub6; /* FIXME: We don't have AT&T Hub6 boards! */
28 unsigned short closing_wait; /* time to wait before closing */
29 unsigned short closing_wait2; /* no longer used... */
30 int reserved[4];
34 * For the close wait times, 0 means wait forever for serial port to
35 * flush its output. 65535 means don't wait at all.
37 #define S_CLOSING_WAIT_INF 0
38 #define S_CLOSING_WAIT_NONE 65535
41 * Definitions for S_struct (and serial_struct) flags field
43 #define S_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes
44 on the callout port */
45 #define S_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */
46 #define S_SAK 0x0004 /* Secure Attention Key (Orange book) */
47 #define S_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
49 #define S_SPD_MASK 0x0030
50 #define S_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */
52 #define S_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */
53 #define S_SPD_CUST 0x0030 /* Use user-specified divisor */
55 #define S_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
56 #define S_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */
57 #define S_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
58 #define S_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */
59 #define S_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */
61 #define S_FLAGS 0x0FFF /* Possible legal S flags */
62 #define S_USR_MASK 0x0430 /* Legal flags that non-privileged
63 * users can set or reset */
65 /* Internal flags used only by kernel/chr_drv/serial.c */
66 #define S_INITIALIZED 0x80000000 /* Serial port was initialized */
67 #define S_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */
68 #define S_NORMAL_ACTIVE 0x20000000 /* Normal device is active */
69 #define S_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */
70 #define S_CLOSING 0x08000000 /* Serial port is closing */
71 #define S_CTS_FLOW 0x04000000 /* Do CTS flow control */
72 #define S_CHECK_CD 0x02000000 /* i.e., CLOCAL */
74 /* Software state per channel */
76 #ifdef __KERNEL__
79 * I believe this is the optimal setting that reduces the number of interrupts.
80 * At high speeds the output might become a little "bursted" (use USTCNT_TXHE
81 * if that bothers you), but in most cases it will not, since we try to
82 * transmit characters every time rs_interrupt is called. Thus, quite often
83 * you'll see that a receive interrupt occures before the transmit one.
84 * -- Vladimir Gurevich
86 #define USTCNT_TX_INTR_MASK (USTCNT_TXEE)
89 * 68328 and 68EZ328 UARTS are a little bit different. EZ328 has special
90 * "Old data interrupt" which occures whenever the data stay in the FIFO
91 * longer than 30 bits time. This allows us to use FIFO without compromising
92 * latency. '328 does not have this feature and without the real 328-based
93 * board I would assume that RXRE is the safest setting.
95 * For EZ328 I use RXHE (Half empty) interrupt to reduce the number of
96 * interrupts. RXFE (receive queue full) causes the system to lose data
97 * at least at 115200 baud
99 * If your board is busy doing other stuff, you might consider to use
100 * RXRE (data ready intrrupt) instead.
102 * The other option is to make these INTR masks run-time configurable, so
103 * that people can dynamically adapt them according to the current usage.
104 * -- Vladimir Gurevich
107 /* (es) */
108 #if defined(CONFIG_M68EZ328) || defined(CONFIG_M68VZ328)
109 #define USTCNT_RX_INTR_MASK (USTCNT_RXHE | USTCNT_ODEN)
110 #elif defined(CONFIG_M68328)
111 #define USTCNT_RX_INTR_MASK (USTCNT_RXRE)
112 #else
113 #error Please, define the Rx interrupt events for your CPU
114 #endif
115 /* (/es) */
118 * This is our internal structure for each serial port's state.
120 * Many fields are paralleled by the structure used by the serial_struct
121 * structure.
123 * For definitions of the flags field, see tty.h
126 struct m68k_serial {
127 char soft_carrier; /* Use soft carrier on this channel */
128 char break_abort; /* Is serial console in, so process brk/abrt */
129 char is_cons; /* Is this our console. */
131 /* We need to know the current clock divisor
132 * to read the bps rate the chip has currently
133 * loaded.
135 unsigned char clk_divisor; /* May be 1, 16, 32, or 64 */
136 int baud;
137 int magic;
138 int baud_base;
139 int port;
140 int irq;
141 int flags; /* defined in tty.h */
142 int type; /* UART type */
143 struct tty_struct *tty;
144 int read_status_mask;
145 int ignore_status_mask;
146 int timeout;
147 int xmit_fifo_size;
148 int custom_divisor;
149 int x_char; /* xon/xoff character */
150 int close_delay;
151 unsigned short closing_wait;
152 unsigned short closing_wait2;
153 unsigned long event;
154 unsigned long last_active;
155 int line;
156 int count; /* # of fd on device */
157 int blocked_open; /* # of blocked opens */
158 unsigned char *xmit_buf;
159 int xmit_head;
160 int xmit_tail;
161 int xmit_cnt;
162 struct work_struct tqueue;
163 struct work_struct tqueue_hangup;
164 wait_queue_head_t open_wait;
165 wait_queue_head_t close_wait;
169 #define SERIAL_MAGIC 0x5301
172 * The size of the serial xmit buffer is 1 page, or 4096 bytes
174 #define SERIAL_XMIT_SIZE 4096
177 * Events are used to schedule things to happen at timer-interrupt
178 * time, instead of at rs interrupt time.
180 #define RS_EVENT_WRITE_WAKEUP 0
183 * Define the number of ports supported and their irqs.
185 #ifndef CONFIG_68328_SERIAL_UART2
186 #define NR_PORTS 1
187 #define UART_IRQ_DEFNS {UART_IRQ_NUM}
188 #else
189 #define NR_PORTS 2
190 #define UART_IRQ_DEFNS {UART1_IRQ_NUM, UART2_IRQ_NUM}
191 #endif
193 #endif /* __KERNEL__ */
194 #endif /* !(_MC683XX_SERIAL_H) */