1 |
1626 |
jcastillo |
/* 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@rt-control.com>
|
6 |
|
|
* Copyright (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>
|
7 |
|
|
*
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
#ifndef _MC683XX_SERIAL_H
|
11 |
|
|
#define _MC683XX_SERIAL_H
|
12 |
|
|
|
13 |
|
|
#include <linux/config.h>
|
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 loose 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 |
|
|
#if defined(CONFIG_M68EZ328)
|
107 |
|
|
#define USTCNT_RX_INTR_MASK (USTCNT_RXHE | USTCNT_ODEN)
|
108 |
|
|
#elif defined(CONFIG_M68328)
|
109 |
|
|
#define USTCNT_RX_INTR_MASK (USTCNT_RXRE)
|
110 |
|
|
#else
|
111 |
|
|
#error Please, define the Rx interrupt events for your CPU
|
112 |
|
|
#endif
|
113 |
|
|
|
114 |
|
|
/*
|
115 |
|
|
* This is our internal structure for each serial port's state.
|
116 |
|
|
*
|
117 |
|
|
* Many fields are paralleled by the structure used by the serial_struct
|
118 |
|
|
* structure.
|
119 |
|
|
*
|
120 |
|
|
* For definitions of the flags field, see tty.h
|
121 |
|
|
*/
|
122 |
|
|
|
123 |
|
|
struct m68k_serial {
|
124 |
|
|
char soft_carrier; /* Use soft carrier on this channel */
|
125 |
|
|
char break_abort; /* Is serial console in, so process brk/abrt */
|
126 |
|
|
char is_cons; /* Is this our console. */
|
127 |
|
|
|
128 |
|
|
/* We need to know the current clock divisor
|
129 |
|
|
* to read the bps rate the chip has currently
|
130 |
|
|
* loaded.
|
131 |
|
|
*/
|
132 |
|
|
unsigned char clk_divisor; /* May be 1, 16, 32, or 64 */
|
133 |
|
|
int baud;
|
134 |
|
|
int magic;
|
135 |
|
|
int baud_base;
|
136 |
|
|
int port;
|
137 |
|
|
int irq;
|
138 |
|
|
int flags; /* defined in tty.h */
|
139 |
|
|
int type; /* UART type */
|
140 |
|
|
struct tty_struct *tty;
|
141 |
|
|
int read_status_mask;
|
142 |
|
|
int ignore_status_mask;
|
143 |
|
|
int timeout;
|
144 |
|
|
int xmit_fifo_size;
|
145 |
|
|
int custom_divisor;
|
146 |
|
|
int x_char; /* xon/xoff character */
|
147 |
|
|
int close_delay;
|
148 |
|
|
unsigned short closing_wait;
|
149 |
|
|
unsigned short closing_wait2;
|
150 |
|
|
unsigned long event;
|
151 |
|
|
unsigned long last_active;
|
152 |
|
|
int line;
|
153 |
|
|
int count; /* # of fd on device */
|
154 |
|
|
int blocked_open; /* # of blocked opens */
|
155 |
|
|
long session; /* Session of opening process */
|
156 |
|
|
long pgrp; /* pgrp of opening process */
|
157 |
|
|
unsigned char *xmit_buf;
|
158 |
|
|
int xmit_head;
|
159 |
|
|
int xmit_tail;
|
160 |
|
|
int xmit_cnt;
|
161 |
|
|
struct tq_struct tqueue;
|
162 |
|
|
struct tq_struct tqueue_hangup;
|
163 |
|
|
struct termios normal_termios;
|
164 |
|
|
struct termios callout_termios;
|
165 |
|
|
struct wait_queue *open_wait;
|
166 |
|
|
struct wait_queue *close_wait;
|
167 |
|
|
};
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
#define SERIAL_MAGIC 0x5301
|
171 |
|
|
|
172 |
|
|
/*
|
173 |
|
|
* The size of the serial xmit buffer is 1 page, or 4096 bytes
|
174 |
|
|
*/
|
175 |
|
|
#define SERIAL_XMIT_SIZE 4096
|
176 |
|
|
|
177 |
|
|
/*
|
178 |
|
|
* Events are used to schedule things to happen at timer-interrupt
|
179 |
|
|
* time, instead of at rs interrupt time.
|
180 |
|
|
*/
|
181 |
|
|
#define RS_EVENT_WRITE_WAKEUP 0
|
182 |
|
|
|
183 |
|
|
#endif /* __KERNEL__ */
|
184 |
|
|
#endif /* !(_MC683XX_SERIAL_H) */
|