aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/crisv10.h
diff options
context:
space:
mode:
authorJesper Nilsson <jesper.nilsson@axis.com>2007-11-14 20:01:15 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-14 21:45:46 -0500
commit77accbf505a073beecf32e60265697517e203bea (patch)
tree5323f47dac9e40841502aa0191573b252747dc0b /drivers/serial/crisv10.h
parent4b7e888933b0d71f9534830ae1edc1e23f0fb075 (diff)
CRISv10 serial driver rewrite
New and improved serial driver for CRISv10, take three, with improvements suggested by Jiri Slaby. - Call wait_event_interruptible with a _correct_ and sensible condition. - Removed superfluous test of info->flags & ASYNC_CLOSING, since that is done by wait_event_interruptible. - Moved common code for deregistering DMA and IRQ to deinit_port function. - Use setup_timer when initializing flush_timer. - Convert bit-field for uses_dma_in and uses_dma_out to regular bytes. - Removed CVS tags. - Removed defines and comments for CRIS_BUF_SIZE and TTY_THRESHOLD_THROTTLE (no longer used). - Cleaned up code to pass checkpatch. - Add crisv10.h header file. - Merge of CRISv10 from Axis internal CVS. Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com> Reviewed-by: Jiri Slaby <jirislaby@gmail.com> Cc: Mikael Starvik <starvik@axis.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial/crisv10.h')
-rw-r--r--drivers/serial/crisv10.h146
1 files changed, 146 insertions, 0 deletions
diff --git a/drivers/serial/crisv10.h b/drivers/serial/crisv10.h
new file mode 100644
index 000000000000..ccd0f32b7372
--- /dev/null
+++ b/drivers/serial/crisv10.h
@@ -0,0 +1,146 @@
1/*
2 * serial.h: Arch-dep definitions for the Etrax100 serial driver.
3 *
4 * Copyright (C) 1998-2007 Axis Communications AB
5 */
6
7#ifndef _ETRAX_SERIAL_H
8#define _ETRAX_SERIAL_H
9
10#include <linux/circ_buf.h>
11#include <asm/termios.h>
12#include <asm/dma.h>
13#include <asm/arch/io_interface_mux.h>
14
15/* Software state per channel */
16
17#ifdef __KERNEL__
18/*
19 * This is our internal structure for each serial port's state.
20 *
21 * Many fields are paralleled by the structure used by the serial_struct
22 * structure.
23 *
24 * For definitions of the flags field, see tty.h
25 */
26
27#define SERIAL_RECV_DESCRIPTORS 8
28
29struct etrax_recv_buffer {
30 struct etrax_recv_buffer *next;
31 unsigned short length;
32 unsigned char error;
33 unsigned char pad;
34
35 unsigned char buffer[0];
36};
37
38struct e100_serial {
39 int baud;
40 volatile u8 *port; /* R_SERIALx_CTRL */
41 u32 irq; /* bitnr in R_IRQ_MASK2 for dmaX_descr */
42
43 /* Output registers */
44 volatile u8 *oclrintradr; /* adr to R_DMA_CHx_CLR_INTR */
45 volatile u32 *ofirstadr; /* adr to R_DMA_CHx_FIRST */
46 volatile u8 *ocmdadr; /* adr to R_DMA_CHx_CMD */
47 const volatile u8 *ostatusadr; /* adr to R_DMA_CHx_STATUS */
48
49 /* Input registers */
50 volatile u8 *iclrintradr; /* adr to R_DMA_CHx_CLR_INTR */
51 volatile u32 *ifirstadr; /* adr to R_DMA_CHx_FIRST */
52 volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */
53 volatile u32 *idescradr; /* adr to R_DMA_CHx_DESCR */
54
55 int flags; /* defined in tty.h */
56
57 u8 rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */
58 u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */
59 u8 iseteop; /* bit number for R_SET_EOP for the input dma */
60 int enabled; /* Set to 1 if the port is enabled in HW config */
61
62 u8 dma_out_enabled; /* Set to 1 if DMA should be used */
63 u8 dma_in_enabled; /* Set to 1 if DMA should be used */
64
65 /* end of fields defined in rs_table[] in .c-file */
66 int dma_owner;
67 unsigned int dma_in_nbr;
68 unsigned int dma_out_nbr;
69 unsigned int dma_in_irq_nbr;
70 unsigned int dma_out_irq_nbr;
71 unsigned long dma_in_irq_flags;
72 unsigned long dma_out_irq_flags;
73 char *dma_in_irq_description;
74 char *dma_out_irq_description;
75
76 enum cris_io_interface io_if;
77 char *io_if_description;
78
79 u8 uses_dma_in; /* Set to 1 if DMA is used */
80 u8 uses_dma_out; /* Set to 1 if DMA is used */
81 u8 forced_eop; /* a fifo eop has been forced */
82 int baud_base; /* For special baudrates */
83 int custom_divisor; /* For special baudrates */
84 struct etrax_dma_descr tr_descr;
85 struct etrax_dma_descr rec_descr[SERIAL_RECV_DESCRIPTORS];
86 int cur_rec_descr;
87
88 volatile int tr_running; /* 1 if output is running */
89
90 struct tty_struct *tty;
91 int read_status_mask;
92 int ignore_status_mask;
93 int x_char; /* xon/xoff character */
94 int close_delay;
95 unsigned short closing_wait;
96 unsigned short closing_wait2;
97 unsigned long event;
98 unsigned long last_active;
99 int line;
100 int type; /* PORT_ETRAX */
101 int count; /* # of fd on device */
102 int blocked_open; /* # of blocked opens */
103 struct circ_buf xmit;
104 struct etrax_recv_buffer *first_recv_buffer;
105 struct etrax_recv_buffer *last_recv_buffer;
106 unsigned int recv_cnt;
107 unsigned int max_recv_cnt;
108
109 struct work_struct work;
110 struct async_icount icount; /* error-statistics etc.*/
111 struct ktermios normal_termios;
112 struct ktermios callout_termios;
113 wait_queue_head_t open_wait;
114 wait_queue_head_t close_wait;
115
116 unsigned long char_time_usec; /* The time for 1 char, in usecs */
117 unsigned long flush_time_usec; /* How often we should flush */
118 unsigned long last_tx_active_usec; /* Last tx usec in the jiffies */
119 unsigned long last_tx_active; /* Last tx time in jiffies */
120 unsigned long last_rx_active_usec; /* Last rx usec in the jiffies */
121 unsigned long last_rx_active; /* Last rx time in jiffies */
122
123 int break_detected_cnt;
124 int errorcode;
125
126#ifdef CONFIG_ETRAX_RS485
127 struct rs485_control rs485; /* RS-485 support */
128#endif
129};
130
131/* this PORT is not in the standard serial.h. it's not actually used for
132 * anything since we only have one type of async serial-port anyway in this
133 * system.
134 */
135
136#define PORT_ETRAX 1
137
138/*
139 * Events are used to schedule things to happen at timer-interrupt
140 * time, instead of at rs interrupt time.
141 */
142#define RS_EVENT_WRITE_WAKEUP 0
143
144#endif /* __KERNEL__ */
145
146#endif /* !_ETRAX_SERIAL_H */