Commit | Line | Data |
---|---|---|
1da177e4 LT |
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 | struct uart_cpm_port { | |
44 | struct uart_port port; | |
45 | u16 rx_nrfifos; | |
46 | u16 rx_fifosize; | |
47 | u16 tx_nrfifos; | |
48 | u16 tx_fifosize; | |
49 | smc_t *smcp; | |
50 | smc_uart_t *smcup; | |
51 | scc_t *sccp; | |
52 | scc_uart_t *sccup; | |
53 | volatile cbd_t *rx_bd_base; | |
54 | volatile cbd_t *rx_cur; | |
55 | volatile cbd_t *tx_bd_base; | |
56 | volatile cbd_t *tx_cur; | |
57 | unsigned char *tx_buf; | |
58 | unsigned char *rx_buf; | |
59 | u32 flags; | |
60 | void (*set_lineif)(struct uart_cpm_port *); | |
61 | u8 brg; | |
62 | uint dp_addr; | |
63 | void *mem_addr; | |
64 | dma_addr_t dma_addr; | |
65 | /* helpers */ | |
66 | int baud; | |
67 | int bits; | |
68 | /* Keep track of 'odd' SMC2 wirings */ | |
69 | int is_portb; | |
70 | }; | |
71 | ||
72 | extern int cpm_uart_port_map[UART_NR]; | |
73 | extern int cpm_uart_nr; | |
74 | extern struct uart_cpm_port cpm_uart_ports[UART_NR]; | |
75 | ||
76 | /* these are located in their respective files */ | |
77 | void cpm_line_cr_cmd(int line, int cmd); | |
78 | int cpm_uart_init_portdesc(void); | |
79 | int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con); | |
80 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo); | |
81 | ||
82 | void smc1_lineif(struct uart_cpm_port *pinfo); | |
83 | void smc2_lineif(struct uart_cpm_port *pinfo); | |
84 | void scc1_lineif(struct uart_cpm_port *pinfo); | |
85 | void scc2_lineif(struct uart_cpm_port *pinfo); | |
86 | void scc3_lineif(struct uart_cpm_port *pinfo); | |
87 | void scc4_lineif(struct uart_cpm_port *pinfo); | |
88 | ||
89 | #endif /* CPM_UART_H */ |