blob: 73c8a088c160fcda57b98bbc6574cb8f673dadb5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
Kumar Gala311c4622005-08-09 10:08:00 -070043#define SCC_WAIT_CLOSING 100
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045struct uart_cpm_port {
46 struct uart_port port;
Kumar Gala311c4622005-08-09 10:08:00 -070047 u16 rx_nrfifos;
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 u16 rx_fifosize;
Kumar Gala311c4622005-08-09 10:08:00 -070049 u16 tx_nrfifos;
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 u16 tx_fifosize;
Kumar Gala311c4622005-08-09 10:08:00 -070051 smc_t *smcp;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 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;
Kumar Gala311c4622005-08-09 10:08:00 -070072 /* wait on close if needed */
73 int wait_closing;
Linus Torvalds1da177e2005-04-16 15:20:36 -070074};
75
76extern int cpm_uart_port_map[UART_NR];
77extern int cpm_uart_nr;
78extern struct uart_cpm_port cpm_uart_ports[UART_NR];
79
80/* these are located in their respective files */
81void cpm_line_cr_cmd(int line, int cmd);
82int cpm_uart_init_portdesc(void);
83int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
84void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
85
86void smc1_lineif(struct uart_cpm_port *pinfo);
87void smc2_lineif(struct uart_cpm_port *pinfo);
88void scc1_lineif(struct uart_cpm_port *pinfo);
89void scc2_lineif(struct uart_cpm_port *pinfo);
90void scc3_lineif(struct uart_cpm_port *pinfo);
91void scc4_lineif(struct uart_cpm_port *pinfo);
92
93#endif /* CPM_UART_H */