Merge /spare/repo/linux-2.6/
[sfrench/cifs-2.6.git] / drivers / serial / cpm_uart / cpm_uart.h
1 /*
2  *  linux/drivers/serial/cpm_uart.h
3  *
4  *  Driver for CPM (SCC/SMC) serial ports
5  *
6  *  Copyright (C) 2004 Freescale Semiconductor, Inc.
7  *
8  */
9 #ifndef CPM_UART_H
10 #define CPM_UART_H
11
12 #include <linux/config.h>
13
14 #if defined(CONFIG_CPM2)
15 #include "cpm_uart_cpm2.h"
16 #elif defined(CONFIG_8xx)
17 #include "cpm_uart_cpm1.h"
18 #endif
19
20 #define SERIAL_CPM_MAJOR        204
21 #define SERIAL_CPM_MINOR        46
22
23 #define IS_SMC(pinfo)           (pinfo->flags & FLAG_SMC)
24 #define IS_DISCARDING(pinfo)    (pinfo->flags & FLAG_DISCARDING)
25 #define FLAG_DISCARDING 0x00000004      /* when set, don't discard */
26 #define FLAG_SMC        0x00000002
27 #define FLAG_CONSOLE    0x00000001
28
29 #define UART_SMC1       0
30 #define UART_SMC2       1
31 #define UART_SCC1       2
32 #define UART_SCC2       3
33 #define UART_SCC3       4
34 #define UART_SCC4       5
35
36 #define UART_NR 6
37
38 #define RX_NUM_FIFO     4
39 #define RX_BUF_SIZE     32
40 #define TX_NUM_FIFO     4
41 #define TX_BUF_SIZE     32
42
43 #define SCC_WAIT_CLOSING 100
44
45 struct uart_cpm_port {
46         struct uart_port        port;
47         u16                     rx_nrfifos;
48         u16                     rx_fifosize;
49         u16                     tx_nrfifos;
50         u16                     tx_fifosize;
51         smc_t                   *smcp;
52         smc_uart_t              *smcup;
53         scc_t                   *sccp;
54         scc_uart_t              *sccup;
55         volatile cbd_t          *rx_bd_base;
56         volatile cbd_t          *rx_cur;
57         volatile cbd_t          *tx_bd_base;
58         volatile cbd_t          *tx_cur;
59         unsigned char           *tx_buf;
60         unsigned char           *rx_buf;
61         u32                     flags;
62         void                    (*set_lineif)(struct uart_cpm_port *);
63         u8                      brg;
64         uint                     dp_addr;
65         void                    *mem_addr;
66         dma_addr_t               dma_addr;
67         /* helpers */
68         int                      baud;
69         int                      bits;
70         /* Keep track of 'odd' SMC2 wirings */
71         int                     is_portb;
72         /* wait on close if needed */
73         int                     wait_closing;
74 };
75
76 extern int cpm_uart_port_map[UART_NR];
77 extern int cpm_uart_nr;
78 extern struct uart_cpm_port cpm_uart_ports[UART_NR];
79
80 /* these are located in their respective files */
81 void cpm_line_cr_cmd(int line, int cmd);
82 int cpm_uart_init_portdesc(void);
83 int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
84 void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
85
86 void smc1_lineif(struct uart_cpm_port *pinfo);
87 void smc2_lineif(struct uart_cpm_port *pinfo);
88 void scc1_lineif(struct uart_cpm_port *pinfo);
89 void scc2_lineif(struct uart_cpm_port *pinfo);
90 void scc3_lineif(struct uart_cpm_port *pinfo);
91 void scc4_lineif(struct uart_cpm_port *pinfo);
92
93 #endif /* CPM_UART_H */