1/*
2 * include/asm-ppc/serial.h
3 */
4
5#include <linux/config.h>
6
7/*
8 * This assumes you have a 1.8432 MHz clock for your UART.
9 *
10 * It'd be nice if someone built a serial card with a 24.576 MHz
11 * clock, since the 16550A is capable of handling a top speed of 1.5
12 * megabits/second; but this requires the faster clock.
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
18 */
19#define BASE_BAUD ( 1843200 / 16 )
20
21#ifdef CONFIG_SERIAL_MANY_PORTS
22#define RS_TABLE_SIZE  64
23#else
24#define RS_TABLE_SIZE  4
25#endif
26
27/* Standard COM flags (except for COM4, because of the 8514 problem) */
28#ifdef CONFIG_SERIAL_DETECT_IRQ
29#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
30#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
31#else
32#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
33#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
34#endif
35
36#ifdef CONFIG_SERIAL_MANY_PORTS
37#define FOURPORT_FLAGS ASYNC_FOURPORT
38#define ACCENT_FLAGS 0
39#define BOCA_FLAGS 0
40#define HUB6_FLAGS 0
41#endif
42
43/*
44 * The following define the access methods for the HUB6 card. All
45 * access is through two ports for all 24 possible chips. The card is
46 * selected through the high 2 bits, the port on that card with the
47 * "middle" 3 bits, and the register on that port with the bottom
48 * 3 bits.
49 *
50 * While the access port and interrupt is configurable, the default
51 * port locations are 0x302 for the port control register, and 0x303
52 * for the data read/write register. Normally, the interrupt is at irq3
53 * but can be anything from 3 to 7 inclusive. Note that using 3 will
54 * require disabling com2.
55 */
56
57#define C_P(card,port) (((card)<<6|(port)<<3) + 1)
58
59#define STD_SERIAL_PORT_DEFNS			\
60	/* UART CLK   PORT IRQ     FLAGS        */			\
61	{ 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },	/* ttyS0 */	\
62	{ 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS },	/* ttyS1 */	\
63	{ 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },	/* ttyS2 */	\
64	{ 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },	/* ttyS3 */
65
66
67#ifdef CONFIG_SERIAL_MANY_PORTS
68#define EXTRA_SERIAL_PORT_DEFNS			\
69	{ 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, 	/* ttyS4 */	\
70	{ 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS },	/* ttyS5 */	\
71	{ 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS },	/* ttyS6 */	\
72	{ 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS },	/* ttyS7 */	\
73	{ 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS },	/* ttyS8 */	\
74	{ 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS },	/* ttyS9 */	\
75	{ 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS },	/* ttyS10 */	\
76	{ 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS },	/* ttyS11 */	\
77	{ 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS },	/* ttyS12 */	\
78	{ 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS },	/* ttyS13 */	\
79	{ 0, BASE_BAUD, 0x000, 0, 0 },	/* ttyS14 (spare) */		\
80	{ 0, BASE_BAUD, 0x000, 0, 0 },	/* ttyS15 (spare) */		\
81	{ 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS },	/* ttyS16 */	\
82	{ 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS },	/* ttyS17 */	\
83	{ 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS },	/* ttyS18 */	\
84	{ 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS },	/* ttyS19 */	\
85	{ 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS },	/* ttyS20 */	\
86	{ 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS },	/* ttyS21 */	\
87	{ 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS },	/* ttyS22 */	\
88	{ 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS },	/* ttyS23 */	\
89	{ 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS },	/* ttyS24 */	\
90	{ 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS },	/* ttyS25 */	\
91	{ 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS },	/* ttyS26 */	\
92	{ 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS },	/* ttyS27 */	\
93	{ 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS },	/* ttyS28 */	\
94	{ 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS },	/* ttyS29 */	\
95	{ 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS },	/* ttyS30 */	\
96	{ 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS },	/* ttyS31 */
97#else
98#define EXTRA_SERIAL_PORT_DEFNS
99#endif
100
101/* You can have up to four HUB6's in the system, but I've only
102 * included two cards here for a total of twelve ports.
103 */
104#if (defined(CONFIG_HUB6) && defined(CONFIG_SERIAL_MANY_PORTS))
105#define HUB6_SERIAL_PORT_DFNS		\
106	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,0) },  /* ttyS32 */	\
107	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,1) },  /* ttyS33 */	\
108	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,2) },  /* ttyS34 */	\
109	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,3) },  /* ttyS35 */	\
110	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,4) },  /* ttyS36 */	\
111	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,5) },  /* ttyS37 */	\
112	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,0) },  /* ttyS38 */	\
113	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,1) },  /* ttyS39 */	\
114	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,2) },  /* ttyS40 */	\
115	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,3) },  /* ttyS41 */	\
116	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,4) },  /* ttyS42 */	\
117	{ 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,5) },  /* ttyS43 */
118#else
119#define HUB6_SERIAL_PORT_DFNS
120#endif
121
122#define MCA_SERIAL_PORT_DFNS
123
124#define SERIAL_PORT_DFNS		\
125	STD_SERIAL_PORT_DEFNS		\
126	EXTRA_SERIAL_PORT_DEFNS		\
127	HUB6_SERIAL_PORT_DFNS		\
128	MCA_SERIAL_PORT_DFNS
129