blob: 54b642a83dab4e30cdeef5c5c36ad72c89f3f648 [file] [log] [blame]
wdenk012771d2002-03-08 21:31:05 +00001/*
2 * (C) Copyright 2001
3 * John Clemens <clemens@mclx.com>, Mission Critical Linux, Inc.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24/*
25 * mpsc.h - header file for MPSC in uart mode (console driver)
26 */
27
28#ifndef __MPSC_H__
29#define __MPSC_H__
30
31/* include actual Galileo defines */
32#include <galileo/gt64260R.h>
33
34/* driver related defines */
35
36int mpsc_init(int baud);
37void mpsc_init2(void);
38char mpsc_getchar(void);
39int mpsc_test_char(void);
40int galbrg_set_baudrate(int channel, int rate);
41
42int mpsc_putchar_early(char ch);
43extern int (*mpsc_putchar)(char ch);
44
45#define CHANNEL CONFIG_MPSC_PORT
46
47#define TX_DESC 5
48#define RX_DESC 20
49
50#define DESC_FIRST 0x00010000
51#define DESC_LAST 0x00020000
52#define DESC_OWNER 0x80000000
53
54#define TX_DEMAND 0x00800000
55#define TX_STOP 0x00010000
56#define RX_ENABLE 0x00000080
57
58#define SDMA_RX_ABORT (1 << 15)
59#define SDMA_TX_ABORT (1 << 31)
60#define MPSC_TX_ABORT (1 << 7)
61#define MPSC_RX_ABORT (1 << 23)
62#define MPSC_ENTER_HUNT (1 << 31)
63
64/* MPSC defines */
65
66#define GALMPSC_CONNECT 0x1
67#define GALMPSC_DISCONNECT 0x0
68
69#define GALMPSC_UART 0x1
70
71#define GALMPSC_STOP_BITS_1 0x0
72#define GALMPSC_STOP_BITS_2 0x1
73#define GALMPSC_CHAR_LENGTH_8 0x3
74#define GALMPSC_CHAR_LENGTH_7 0x2
75
76#define GALMPSC_PARITY_ODD 0x0
77#define GALMPSC_PARITY_EVEN 0x2
78#define GALMPSC_PARITY_MARK 0x3
79#define GALMPSC_PARITY_SPACE 0x1
80#define GALMPSC_PARITY_NONE -1
81
82#define GALMPSC_SERIAL_MULTIPLEX SERIAL_PORT_MULTIPLEX /* 0xf010 */
83#define GALMPSC_ROUTING_REGISTER MAIN_ROUTING_REGISTER /* 0xb400 */
84#define GALMPSC_RxC_ROUTE RECEIVE_CLOCK_ROUTING_REGISTER /* 0xb404 */
85#define GALMPSC_TxC_ROUTE TRANSMIT_CLOCK_ROUTING_REGISTER /* 0xb408 */
86#define GALMPSC_MCONF_LOW MPSC0_MAIN_CONFIGURATION_LOW /* 0x8000 */
87#define GALMPSC_MCONF_HIGH MPSC0_MAIN_CONFIGURATION_HIGH /* 0x8004 */
88#define GALMPSC_PROTOCONF_REG MPSC0_PROTOCOL_CONFIGURATION /* 0x8008 */
89
90#define GALMPSC_REG_GAP 0x1000
91
92#define GALMPSC_MCONF_CHREG_BASE CHANNEL0_REGISTER1 /* 0x800c */
93#define GALMPSC_CHANNELREG_1 CHANNEL0_REGISTER1 /* 0x800c */
94#define GALMPSC_CHANNELREG_2 CHANNEL0_REGISTER2 /* 0x8010 */
95#define GALMPSC_CHANNELREG_3 CHANNEL0_REGISTER3 /* 0x8014 */
96#define GALMPSC_CHANNELREG_4 CHANNEL0_REGISTER4 /* 0x8018 */
97#define GALMPSC_CHANNELREG_5 CHANNEL0_REGISTER5 /* 0x801c */
98#define GALMPSC_CHANNELREG_6 CHANNEL0_REGISTER6 /* 0x8020 */
99#define GALMPSC_CHANNELREG_7 CHANNEL0_REGISTER7 /* 0x8024 */
100#define GALMPSC_CHANNELREG_8 CHANNEL0_REGISTER8 /* 0x8028 */
101#define GALMPSC_CHANNELREG_9 CHANNEL0_REGISTER9 /* 0x802c */
102#define GALMPSC_CHANNELREG_10 CHANNEL0_REGISTER10 /* 0x8030 */
103#define GALMPSC_CHANNELREG_11 CHANNEL0_REGISTER11 /* 0x8034 */
104
105#define GALSDMA_COMMAND_FIRST (1 << 16)
106#define GALSDMA_COMMAND_LAST (1 << 17)
107#define GALSDMA_COMMAND_ENABLEINT (1 << 23)
108#define GALSDMA_COMMAND_AUTO (1 << 30)
109#define GALSDMA_COMMAND_OWNER (1 << 31)
110
111#define GALSDMA_RX 0
112#define GALSDMA_TX 1
113
114/* CHANNEL2 should be CHANNEL1, according to documentation,
115 * but to work with the current GTREGS file...
116 */
117#define GALSDMA_0_CONF_REG CHANNEL0_CONFIGURATION_REGISTER /* 0x4000 */
118#define GALSDMA_1_CONF_REG CHANNEL2_CONFIGURATION_REGISTER /* 0x6000 */
119#define GALSDMA_0_COM_REG CHANNEL0_COMMAND_REGISTER /* 0x4008 */
120#define GALSDMA_1_COM_REG CHANNEL2_COMMAND_REGISTER /* 0x6008 */
121#define GALSDMA_0_CUR_RX_PTR CHANNEL0_CURRENT_RX_DESCRIPTOR_POINTER /* 0x4810 */
122#define GALSDMA_0_CUR_TX_PTR CHANNEL0_CURRENT_TX_DESCRIPTOR_POINTER /* 0x4c10 */
123#define GALSDMA_0_FIR_TX_PTR CHANNEL0_FIRST_TX_DESCRIPTOR_POINTER /* 0x4c14 */
124#define GALSDMA_1_CUR_RX_PTR CHANNEL2_CURRENT_RX_DESCRIPTOR_POINTER /* 0x6810 */
125#define GALSDMA_1_CUR_TX_PTR CHANNEL2_CURRENT_TX_DESCRIPTOR_POINTER /* 0x6c10 */
126#define GALSDMA_1_FIR_TX_PTR CHANNEL2_FIRST_TX_DESCRIPTOR_POINTER /* 0x6c14 */
127#define GALSDMA_REG_DIFF 0x2000
128
129/* WRONG in gt64260R.h */
130#define GALSDMA_INT_CAUSE 0xb800 /* SDMA_CAUSE */
131#define GALSDMA_INT_MASK 0xb880 /* SDMA_MASK */
132
133#define GALSDMA_MODE_UART 0
134#define GALSDMA_MODE_BISYNC 1
135#define GALSDMA_MODE_HDLC 2
136#define GALSDMA_MODE_TRANSPARENT 3
137
138#define GALBRG_0_CONFREG BRG0_CONFIGURATION_REGISTER /* 0xb200 */
139#define GALBRG_REG_GAP 0x0008
140#define GALBRG_0_BTREG BRG0_BAUDE_TUNING_REGISTER /* 0xb204 */
141
142#endif /* __MPSC_H__ */