MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / drivers / serial / serial_atmel.h
blobbfdadac85de58661f9c23ddfe8661d027693899b
1 /* serial-atmel.h: Definitions for the Atmel serial driver.
3 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>,
4 * D. Jeff Dionne <jeff@uClinux.org>,
5 * The Silver Hammer Group, Ltd.
6 * Copyright (C) 2004 Hyok S. Choi <hyok.choi@samsung.com>
7 * 2.6 port
9 * Based on:
11 * drivers/char/68328serial.h
13 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
16 #ifndef _ATMEL_SERIAL_H
17 #define _ATMEL_SERIAL_H
19 #include <linux/config.h>
20 #include <asm/page.h>
21 #include <asm/arch/hardware.h>
24 * For the close wait times, 0 means wait forever for serial port to
25 * flush its output. 65535 means don't wait at all.
27 #define S_CLOSING_WAIT_INF 0
28 #define S_CLOSING_WAIT_NONE 65535
31 * Definitions for S_struct (and serial_struct) flags field
33 #define S_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes
34 on the callout port */
35 #define S_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */
36 #define S_SAK 0x0004 /* Secure Attention Key (Orange book) */
37 #define S_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
39 #define S_SPD_MASK 0x0030
40 #define S_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */
42 #define S_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */
43 #define S_SPD_CUST 0x0030 /* Use user-specified divisor */
45 #define S_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
46 #define S_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */
47 #define S_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
48 #define S_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */
49 #define S_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */
51 #define S_FLAGS 0x0FFF /* Possible legal S flags */
52 #define S_USR_MASK 0x0430 /* Legal flags that non-privileged
53 * users can set or reset */
55 /* Internal flags used only by kernel/chr_drv/serial.c */
56 #define S_INITIALIZED 0x80000000 /* Serial port was initialized */
57 #define S_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */
58 #define S_NORMAL_ACTIVE 0x20000000 /* Normal device is active */
59 #define S_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */
60 #define S_CLOSING 0x08000000 /* Serial port is closing */
61 #define S_CTS_FLOW 0x04000000 /* Do CTS flow control */
62 #define S_CHECK_CD 0x02000000 /* i.e., CLOCAL */
64 #define RS_EVENT_WRITE_WAKEUP 0
65 #define SERIAL_MAGIC 0x5301
67 /* Software state per channel */
70 * This is our internal structure for each serial port's state.
72 * Many fields are paralleled by the structure used by the serial_struct
73 * structure.
75 * For definitions of the flags field, see tty.h
78 struct atmel_serial {
79 char soft_carrier; /* Use soft carrier on this channel */
80 char break_abort; /* Is serial console in, so process brk/abrt */
81 char is_cons; /* Is this our console. */
83 /* We need to know the current clock divisor
84 * to read the bps rate the chip has currently
85 * loaded.
87 unsigned char clk_divisor; /* May be 1, 16, 32, or 64 */
88 int baud;
89 int magic;
90 int baud_base;
91 int port;
92 int irq;
93 int irqmask;
94 int flags; /* defined in tty.h */
95 int type; /* UART type */
96 int use_ints;
97 volatile struct atmel_usart_regs *usart;
98 int cts_state;
99 struct tty_struct *tty;
100 int read_status_mask;
101 int ignore_status_mask;
102 int timeout;
103 int xmit_fifo_size;
104 int custom_divisor;
105 int x_char; /* xon/xoff character */
106 int close_delay;
107 unsigned short closing_wait;
108 unsigned short closing_wait2;
109 unsigned long event;
110 unsigned long last_active;
111 int line;
112 int count; /* # of fd on device */
113 int blocked_open; /* # of blocked opens */
114 unsigned char *xmit_buf;
115 unsigned char *rx_buf;
116 int xmit_head;
117 int xmit_tail;
118 int xmit_cnt;
119 struct work_struct tqueue;
120 struct work_struct tqueue_hangup;
121 wait_queue_head_t open_wait;
122 wait_queue_head_t close_wait;
125 #endif /* !(_ATMEL_SERIAL_H) */