diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2011-01-13 15:10:18 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-01-13 15:10:18 -0500 |
commit | ab4382d27412e7e3e7c936e8d50d8888dfac3df8 (patch) | |
tree | 51d96dea2431140358784b6b426715f37f74fd53 /drivers/tty/serial/68328serial.h | |
parent | 728674a7e466628df2aeec6d11a2ae1ef968fb67 (diff) |
tty: move drivers/serial/ to drivers/tty/serial/
The serial drivers are really just tty drivers, so move them to
drivers/tty/ to make things a bit neater overall.
This is part of the tty/serial driver movement proceedure as proposed by
Arnd Bergmann and approved by everyone involved a number of months ago.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Rogier Wolff <R.E.Wolff@bitwizard.nl>
Cc: Michael H. Warfield <mhw@wittsend.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty/serial/68328serial.h')
-rw-r--r-- | drivers/tty/serial/68328serial.h | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/drivers/tty/serial/68328serial.h b/drivers/tty/serial/68328serial.h new file mode 100644 index 000000000000..664ceb0a158c --- /dev/null +++ b/drivers/tty/serial/68328serial.h | |||
@@ -0,0 +1,188 @@ | |||
1 | /* 68328serial.h: Definitions for the mc68328 serial driver. | ||
2 | * | ||
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> | ||
7 | * | ||
8 | * VZ Support/Fixes Evan Stawnyczy <e@lineo.ca> | ||
9 | */ | ||
10 | |||
11 | #ifndef _MC683XX_SERIAL_H | ||
12 | #define _MC683XX_SERIAL_H | ||
13 | |||
14 | |||
15 | struct serial_struct { | ||
16 | int type; | ||
17 | int line; | ||
18 | int port; | ||
19 | int irq; | ||
20 | int flags; | ||
21 | int xmit_fifo_size; | ||
22 | int custom_divisor; | ||
23 | int baud_base; | ||
24 | unsigned short close_delay; | ||
25 | char reserved_char[2]; | ||
26 | int hub6; /* FIXME: We don't have AT&T Hub6 boards! */ | ||
27 | unsigned short closing_wait; /* time to wait before closing */ | ||
28 | unsigned short closing_wait2; /* no longer used... */ | ||
29 | int reserved[4]; | ||
30 | }; | ||
31 | |||
32 | /* | ||
33 | * For the close wait times, 0 means wait forever for serial port to | ||
34 | * flush its output. 65535 means don't wait at all. | ||
35 | */ | ||
36 | #define S_CLOSING_WAIT_INF 0 | ||
37 | #define S_CLOSING_WAIT_NONE 65535 | ||
38 | |||
39 | /* | ||
40 | * Definitions for S_struct (and serial_struct) flags field | ||
41 | */ | ||
42 | #define S_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes | ||
43 | on the callout port */ | ||
44 | #define S_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */ | ||
45 | #define S_SAK 0x0004 /* Secure Attention Key (Orange book) */ | ||
46 | #define S_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ | ||
47 | |||
48 | #define S_SPD_MASK 0x0030 | ||
49 | #define S_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */ | ||
50 | |||
51 | #define S_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ | ||
52 | #define S_SPD_CUST 0x0030 /* Use user-specified divisor */ | ||
53 | |||
54 | #define S_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */ | ||
55 | #define S_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */ | ||
56 | #define S_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */ | ||
57 | #define S_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ | ||
58 | #define S_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */ | ||
59 | |||
60 | #define S_FLAGS 0x0FFF /* Possible legal S flags */ | ||
61 | #define S_USR_MASK 0x0430 /* Legal flags that non-privileged | ||
62 | * users can set or reset */ | ||
63 | |||
64 | /* Internal flags used only by kernel/chr_drv/serial.c */ | ||
65 | #define S_INITIALIZED 0x80000000 /* Serial port was initialized */ | ||
66 | #define S_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */ | ||
67 | #define S_NORMAL_ACTIVE 0x20000000 /* Normal device is active */ | ||
68 | #define S_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */ | ||
69 | #define S_CLOSING 0x08000000 /* Serial port is closing */ | ||
70 | #define S_CTS_FLOW 0x04000000 /* Do CTS flow control */ | ||
71 | #define S_CHECK_CD 0x02000000 /* i.e., CLOCAL */ | ||
72 | |||
73 | /* Software state per channel */ | ||
74 | |||
75 | #ifdef __KERNEL__ | ||
76 | |||
77 | /* | ||
78 | * I believe this is the optimal setting that reduces the number of interrupts. | ||
79 | * At high speeds the output might become a little "bursted" (use USTCNT_TXHE | ||
80 | * if that bothers you), but in most cases it will not, since we try to | ||
81 | * transmit characters every time rs_interrupt is called. Thus, quite often | ||
82 | * you'll see that a receive interrupt occures before the transmit one. | ||
83 | * -- Vladimir Gurevich | ||
84 | */ | ||
85 | #define USTCNT_TX_INTR_MASK (USTCNT_TXEE) | ||
86 | |||
87 | /* | ||
88 | * 68328 and 68EZ328 UARTS are a little bit different. EZ328 has special | ||
89 | * "Old data interrupt" which occures whenever the data stay in the FIFO | ||
90 | * longer than 30 bits time. This allows us to use FIFO without compromising | ||
91 | * latency. '328 does not have this feature and without the real 328-based | ||
92 | * board I would assume that RXRE is the safest setting. | ||
93 | * | ||
94 | * For EZ328 I use RXHE (Half empty) interrupt to reduce the number of | ||
95 | * interrupts. RXFE (receive queue full) causes the system to lose data | ||
96 | * at least at 115200 baud | ||
97 | * | ||
98 | * If your board is busy doing other stuff, you might consider to use | ||
99 | * RXRE (data ready intrrupt) instead. | ||
100 | * | ||
101 | * The other option is to make these INTR masks run-time configurable, so | ||
102 | * that people can dynamically adapt them according to the current usage. | ||
103 | * -- Vladimir Gurevich | ||
104 | */ | ||
105 | |||
106 | /* (es) */ | ||
107 | #if defined(CONFIG_M68EZ328) || defined(CONFIG_M68VZ328) | ||
108 | #define USTCNT_RX_INTR_MASK (USTCNT_RXHE | USTCNT_ODEN) | ||
109 | #elif defined(CONFIG_M68328) | ||
110 | #define USTCNT_RX_INTR_MASK (USTCNT_RXRE) | ||
111 | #else | ||
112 | #error Please, define the Rx interrupt events for your CPU | ||
113 | #endif | ||
114 | /* (/es) */ | ||
115 | |||
116 | /* | ||
117 | * This is our internal structure for each serial port's state. | ||
118 | * | ||
119 | * Many fields are paralleled by the structure used by the serial_struct | ||
120 | * structure. | ||
121 | * | ||
122 | * For definitions of the flags field, see tty.h | ||
123 | */ | ||
124 | |||
125 | struct m68k_serial { | ||
126 | char soft_carrier; /* Use soft carrier on this channel */ | ||
127 | char break_abort; /* Is serial console in, so process brk/abrt */ | ||
128 | char is_cons; /* Is this our console. */ | ||
129 | |||
130 | /* We need to know the current clock divisor | ||
131 | * to read the bps rate the chip has currently | ||
132 | * loaded. | ||
133 | */ | ||
134 | unsigned char clk_divisor; /* May be 1, 16, 32, or 64 */ | ||
135 | int baud; | ||
136 | int magic; | ||
137 | int baud_base; | ||
138 | int port; | ||
139 | int irq; | ||
140 | int flags; /* defined in tty.h */ | ||
141 | int type; /* UART type */ | ||
142 | struct tty_struct *tty; | ||
143 | int read_status_mask; | ||
144 | int ignore_status_mask; | ||
145 | int timeout; | ||
146 | int xmit_fifo_size; | ||
147 | int custom_divisor; | ||
148 | int x_char; /* xon/xoff character */ | ||
149 | int close_delay; | ||
150 | unsigned short closing_wait; | ||
151 | unsigned short closing_wait2; | ||
152 | unsigned long event; | ||
153 | unsigned long last_active; | ||
154 | int line; | ||
155 | int count; /* # of fd on device */ | ||
156 | int blocked_open; /* # of blocked opens */ | ||
157 | unsigned char *xmit_buf; | ||
158 | int xmit_head; | ||
159 | int xmit_tail; | ||
160 | int xmit_cnt; | ||
161 | struct work_struct tqueue; | ||
162 | struct work_struct tqueue_hangup; | ||
163 | wait_queue_head_t open_wait; | ||
164 | wait_queue_head_t close_wait; | ||
165 | }; | ||
166 | |||
167 | |||
168 | #define SERIAL_MAGIC 0x5301 | ||
169 | |||
170 | /* | ||
171 | * The size of the serial xmit buffer is 1 page, or 4096 bytes | ||
172 | */ | ||
173 | #define SERIAL_XMIT_SIZE 4096 | ||
174 | |||
175 | /* | ||
176 | * Events are used to schedule things to happen at timer-interrupt | ||
177 | * time, instead of at rs interrupt time. | ||
178 | */ | ||
179 | #define RS_EVENT_WRITE_WAKEUP 0 | ||
180 | |||
181 | /* | ||
182 | * Define the number of ports supported and their irqs. | ||
183 | */ | ||
184 | #define NR_PORTS 1 | ||
185 | #define UART_IRQ_DEFNS {UART_IRQ_NUM} | ||
186 | |||
187 | #endif /* __KERNEL__ */ | ||
188 | #endif /* !(_MC683XX_SERIAL_H) */ | ||