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