aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/mpsc.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/mpsc.h')
-rw-r--r--drivers/serial/mpsc.h290
1 files changed, 0 insertions, 290 deletions
diff --git a/drivers/serial/mpsc.h b/drivers/serial/mpsc.h
deleted file mode 100644
index 15913300cea7..000000000000
--- a/drivers/serial/mpsc.h
+++ /dev/null
@@ -1,290 +0,0 @@
1/*
2 * drivers/serial/mpsc.h
3 *
4 * Author: Mark A. Greer <mgreer@mvista.com>
5 *
6 * 2004 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifndef __MPSC_H__
13#define __MPSC_H__
14
15#include <linux/config.h>
16
17#if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
18#define SUPPORT_SYSRQ
19#endif
20
21#include <linux/module.h>
22#include <linux/moduleparam.h>
23#include <linux/tty.h>
24#include <linux/tty_flip.h>
25#include <linux/ioport.h>
26#include <linux/init.h>
27#include <linux/console.h>
28#include <linux/sysrq.h>
29#include <linux/serial.h>
30#include <linux/serial_core.h>
31#include <linux/delay.h>
32#include <linux/device.h>
33#include <linux/dma-mapping.h>
34#include <linux/mv643xx.h>
35
36#include <asm/io.h>
37#include <asm/irq.h>
38
39#define MPSC_NUM_CTLRS 2
40
41/*
42 * Descriptors and buffers must be cache line aligned.
43 * Buffers lengths must be multiple of cache line size.
44 * Number of Tx & Rx descriptors must be powers of 2.
45 */
46#define MPSC_RXR_ENTRIES 32
47#define MPSC_RXRE_SIZE dma_get_cache_alignment()
48#define MPSC_RXR_SIZE (MPSC_RXR_ENTRIES * MPSC_RXRE_SIZE)
49#define MPSC_RXBE_SIZE dma_get_cache_alignment()
50#define MPSC_RXB_SIZE (MPSC_RXR_ENTRIES * MPSC_RXBE_SIZE)
51
52#define MPSC_TXR_ENTRIES 32
53#define MPSC_TXRE_SIZE dma_get_cache_alignment()
54#define MPSC_TXR_SIZE (MPSC_TXR_ENTRIES * MPSC_TXRE_SIZE)
55#define MPSC_TXBE_SIZE dma_get_cache_alignment()
56#define MPSC_TXB_SIZE (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE)
57
58#define MPSC_DMA_ALLOC_SIZE (MPSC_RXR_SIZE + MPSC_RXB_SIZE + \
59 MPSC_TXR_SIZE + MPSC_TXB_SIZE + \
60 dma_get_cache_alignment() /* for alignment */)
61
62/* Rx and Tx Ring entry descriptors -- assume entry size is <= cacheline size */
63struct mpsc_rx_desc {
64 u16 bufsize;
65 u16 bytecnt;
66 u32 cmdstat;
67 u32 link;
68 u32 buf_ptr;
69} __attribute((packed));
70
71struct mpsc_tx_desc {
72 u16 bytecnt;
73 u16 shadow;
74 u32 cmdstat;
75 u32 link;
76 u32 buf_ptr;
77} __attribute((packed));
78
79/*
80 * Some regs that have the erratum that you can't read them are are shared
81 * between the two MPSC controllers. This struct contains those shared regs.
82 */
83struct mpsc_shared_regs {
84 phys_addr_t mpsc_routing_base_p;
85 phys_addr_t sdma_intr_base_p;
86
87 void __iomem *mpsc_routing_base;
88 void __iomem *sdma_intr_base;
89
90 u32 MPSC_MRR_m;
91 u32 MPSC_RCRR_m;
92 u32 MPSC_TCRR_m;
93 u32 SDMA_INTR_CAUSE_m;
94 u32 SDMA_INTR_MASK_m;
95};
96
97/* The main driver data structure */
98struct mpsc_port_info {
99 struct uart_port port; /* Overlay uart_port structure */
100
101 /* Internal driver state for this ctlr */
102 u8 ready;
103 u8 rcv_data;
104 tcflag_t c_iflag; /* save termios->c_iflag */
105 tcflag_t c_cflag; /* save termios->c_cflag */
106
107 /* Info passed in from platform */
108 u8 mirror_regs; /* Need to mirror regs? */
109 u8 cache_mgmt; /* Need manual cache mgmt? */
110 u8 brg_can_tune; /* BRG has baud tuning? */
111 u32 brg_clk_src;
112 u16 mpsc_max_idle;
113 int default_baud;
114 int default_bits;
115 int default_parity;
116 int default_flow;
117
118 /* Physical addresses of various blocks of registers (from platform) */
119 phys_addr_t mpsc_base_p;
120 phys_addr_t sdma_base_p;
121 phys_addr_t brg_base_p;
122
123 /* Virtual addresses of various blocks of registers (from platform) */
124 void __iomem *mpsc_base;
125 void __iomem *sdma_base;
126 void __iomem *brg_base;
127
128 /* Descriptor ring and buffer allocations */
129 void *dma_region;
130 dma_addr_t dma_region_p;
131
132 dma_addr_t rxr; /* Rx descriptor ring */
133 dma_addr_t rxr_p; /* Phys addr of rxr */
134 u8 *rxb; /* Rx Ring I/O buf */
135 u8 *rxb_p; /* Phys addr of rxb */
136 u32 rxr_posn; /* First desc w/ Rx data */
137
138 dma_addr_t txr; /* Tx descriptor ring */
139 dma_addr_t txr_p; /* Phys addr of txr */
140 u8 *txb; /* Tx Ring I/O buf */
141 u8 *txb_p; /* Phys addr of txb */
142 int txr_head; /* Where new data goes */
143 int txr_tail; /* Where sent data comes off */
144
145 /* Mirrored values of regs we can't read (if 'mirror_regs' set) */
146 u32 MPSC_MPCR_m;
147 u32 MPSC_CHR_1_m;
148 u32 MPSC_CHR_2_m;
149 u32 MPSC_CHR_10_m;
150 u32 BRG_BCR_m;
151 struct mpsc_shared_regs *shared_regs;
152};
153
154/* Hooks to platform-specific code */
155int mpsc_platform_register_driver(void);
156void mpsc_platform_unregister_driver(void);
157
158/* Hooks back in to mpsc common to be called by platform-specific code */
159struct mpsc_port_info *mpsc_device_probe(int index);
160struct mpsc_port_info *mpsc_device_remove(int index);
161
162/*
163 *****************************************************************************
164 *
165 * Multi-Protocol Serial Controller Interface Registers
166 *
167 *****************************************************************************
168 */
169
170/* Main Configuratino Register Offsets */
171#define MPSC_MMCRL 0x0000
172#define MPSC_MMCRH 0x0004
173#define MPSC_MPCR 0x0008
174#define MPSC_CHR_1 0x000c
175#define MPSC_CHR_2 0x0010
176#define MPSC_CHR_3 0x0014
177#define MPSC_CHR_4 0x0018
178#define MPSC_CHR_5 0x001c
179#define MPSC_CHR_6 0x0020
180#define MPSC_CHR_7 0x0024
181#define MPSC_CHR_8 0x0028
182#define MPSC_CHR_9 0x002c
183#define MPSC_CHR_10 0x0030
184#define MPSC_CHR_11 0x0034
185
186#define MPSC_MPCR_FRZ (1 << 9)
187#define MPSC_MPCR_CL_5 0
188#define MPSC_MPCR_CL_6 1
189#define MPSC_MPCR_CL_7 2
190#define MPSC_MPCR_CL_8 3
191#define MPSC_MPCR_SBL_1 0
192#define MPSC_MPCR_SBL_2 1
193
194#define MPSC_CHR_2_TEV (1<<1)
195#define MPSC_CHR_2_TA (1<<7)
196#define MPSC_CHR_2_TTCS (1<<9)
197#define MPSC_CHR_2_REV (1<<17)
198#define MPSC_CHR_2_RA (1<<23)
199#define MPSC_CHR_2_CRD (1<<25)
200#define MPSC_CHR_2_EH (1<<31)
201#define MPSC_CHR_2_PAR_ODD 0
202#define MPSC_CHR_2_PAR_SPACE 1
203#define MPSC_CHR_2_PAR_EVEN 2
204#define MPSC_CHR_2_PAR_MARK 3
205
206/* MPSC Signal Routing */
207#define MPSC_MRR 0x0000
208#define MPSC_RCRR 0x0004
209#define MPSC_TCRR 0x0008
210
211/*
212 *****************************************************************************
213 *
214 * Serial DMA Controller Interface Registers
215 *
216 *****************************************************************************
217 */
218
219#define SDMA_SDC 0x0000
220#define SDMA_SDCM 0x0008
221#define SDMA_RX_DESC 0x0800
222#define SDMA_RX_BUF_PTR 0x0808
223#define SDMA_SCRDP 0x0810
224#define SDMA_TX_DESC 0x0c00
225#define SDMA_SCTDP 0x0c10
226#define SDMA_SFTDP 0x0c14
227
228#define SDMA_DESC_CMDSTAT_PE (1<<0)
229#define SDMA_DESC_CMDSTAT_CDL (1<<1)
230#define SDMA_DESC_CMDSTAT_FR (1<<3)
231#define SDMA_DESC_CMDSTAT_OR (1<<6)
232#define SDMA_DESC_CMDSTAT_BR (1<<9)
233#define SDMA_DESC_CMDSTAT_MI (1<<10)
234#define SDMA_DESC_CMDSTAT_A (1<<11)
235#define SDMA_DESC_CMDSTAT_AM (1<<12)
236#define SDMA_DESC_CMDSTAT_CT (1<<13)
237#define SDMA_DESC_CMDSTAT_C (1<<14)
238#define SDMA_DESC_CMDSTAT_ES (1<<15)
239#define SDMA_DESC_CMDSTAT_L (1<<16)
240#define SDMA_DESC_CMDSTAT_F (1<<17)
241#define SDMA_DESC_CMDSTAT_P (1<<18)
242#define SDMA_DESC_CMDSTAT_EI (1<<23)
243#define SDMA_DESC_CMDSTAT_O (1<<31)
244
245#define SDMA_DESC_DFLT (SDMA_DESC_CMDSTAT_O | \
246 SDMA_DESC_CMDSTAT_EI)
247
248#define SDMA_SDC_RFT (1<<0)
249#define SDMA_SDC_SFM (1<<1)
250#define SDMA_SDC_BLMR (1<<6)
251#define SDMA_SDC_BLMT (1<<7)
252#define SDMA_SDC_POVR (1<<8)
253#define SDMA_SDC_RIFB (1<<9)
254
255#define SDMA_SDCM_ERD (1<<7)
256#define SDMA_SDCM_AR (1<<15)
257#define SDMA_SDCM_STD (1<<16)
258#define SDMA_SDCM_TXD (1<<23)
259#define SDMA_SDCM_AT (1<<31)
260
261#define SDMA_0_CAUSE_RXBUF (1<<0)
262#define SDMA_0_CAUSE_RXERR (1<<1)
263#define SDMA_0_CAUSE_TXBUF (1<<2)
264#define SDMA_0_CAUSE_TXEND (1<<3)
265#define SDMA_1_CAUSE_RXBUF (1<<8)
266#define SDMA_1_CAUSE_RXERR (1<<9)
267#define SDMA_1_CAUSE_TXBUF (1<<10)
268#define SDMA_1_CAUSE_TXEND (1<<11)
269
270#define SDMA_CAUSE_RX_MASK (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \
271 SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR)
272#define SDMA_CAUSE_TX_MASK (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \
273 SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND)
274
275/* SDMA Interrupt registers */
276#define SDMA_INTR_CAUSE 0x0000
277#define SDMA_INTR_MASK 0x0080
278
279/*
280 *****************************************************************************
281 *
282 * Baud Rate Generator Interface Registers
283 *
284 *****************************************************************************
285 */
286
287#define BRG_BCR 0x0000
288#define BRG_BTR 0x0004
289
290#endif /* __MPSC_H__ */