1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1999 by Ralf Baechle 7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 */ 9#include <linux/config.h> 10#include <asm/jazz.h> 11 12/* 13 * This assumes you have a 1.8432 MHz clock for your UART. 14 * 15 * It'd be nice if someone built a serial card with a 24.576 MHz 16 * clock, since the 16550A is capable of handling a top speed of 1.5 17 * megabits/second; but this requires the faster clock. 18 */ 19#define BASE_BAUD ( 1843200 / 16 ) 20 21#ifndef CONFIG_OLIVETTI_M700 22#define JAZZ_BASE_BAUD ( 8000000 / 16 ) /* ( 3072000 / 16) */ 23#else 24/* but the M700 isn't such a strange beast */ 25#define JAZZ_BASE_BAUD BASE_BAUD 26#endif 27 28/* Standard COM flags (except for COM4, because of the 8514 problem) */ 29#ifdef CONFIG_SERIAL_DETECT_IRQ 30#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) 31#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ) 32#else 33#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) 34#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF 35#endif 36 37#ifdef CONFIG_SERIAL_MANY_PORTS 38#define FOURPORT_FLAGS ASYNC_FOURPORT 39#define ACCENT_FLAGS 0 40#define BOCA_FLAGS 0 41#define HUB6_FLAGS 0 42#define RS_TABLE_SIZE 64 43#else 44#define RS_TABLE_SIZE 45#endif 46 47/* 48 * The following define the access methods for the HUB6 card. All 49 * access is through two ports for all 24 possible chips. The card is 50 * selected through the high 2 bits, the port on that card with the 51 * "middle" 3 bits, and the register on that port with the bottom 52 * 3 bits. 53 * 54 * While the access port and interrupt is configurable, the default 55 * port locations are 0x302 for the port control register, and 0x303 56 * for the data read/write register. Normally, the interrupt is at irq3 57 * but can be anything from 3 to 7 inclusive. Note that using 3 will 58 * require disabling com2. 59 */ 60 61#define C_P(card,port) (((card)<<6|(port)<<3) + 1) 62 63#ifdef CONFIG_MIPS_JAZZ 64#define _JAZZ_SERIAL_INIT(int, base) \ 65 { .baud_base = JAZZ_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \ 66 .iomem_base = (u8 *) base, .iomem_reg_shift = 0, \ 67 .io_type = SERIAL_IO_MEM } 68#define JAZZ_SERIAL_PORT_DEFNS \ 69 _JAZZ_SERIAL_INIT(JAZZ_SERIAL1_IRQ, JAZZ_SERIAL1_BASE), \ 70 _JAZZ_SERIAL_INIT(JAZZ_SERIAL2_IRQ, JAZZ_SERIAL2_BASE), 71#else 72#define JAZZ_SERIAL_PORT_DEFNS 73#endif 74 75#ifdef CONFIG_MIPS_ATLAS 76#include <asm/mips-boards/atlas.h> 77#include <asm/mips-boards/atlasint.h> 78#define ATLAS_SERIAL_PORT_DEFNS \ 79 /* UART CLK PORT IRQ FLAGS */ \ 80 { 0, ATLAS_BASE_BAUD, ATLAS_UART_REGS_BASE, ATLASINT_UART, STD_COM_FLAGS }, /* ttyS0 */ 81#else 82#define ATLAS_SERIAL_PORT_DEFNS 83#endif 84 85#ifdef CONFIG_MIPS_SEAD 86#include <asm/mips-boards/sead.h> 87#include <asm/mips-boards/seadint.h> 88#define SEAD_SERIAL_PORT_DEFNS \ 89 /* UART CLK PORT IRQ FLAGS */ \ 90 { 0, SEAD_BASE_BAUD, SEAD_UART0_REGS_BASE, SEADINT_UART0, STD_COM_FLAGS }, /* ttyS0 */ 91#else 92#define SEAD_SERIAL_PORT_DEFNS 93#endif 94 95#ifdef CONFIG_MIPS_COBALT 96#include <asm/cobalt/cobalt.h> 97#define COBALT_BASE_BAUD (18432000 / 16) 98#define COBALT_SERIAL_PORT_DEFNS \ 99 /* UART CLK PORT IRQ FLAGS */ \ 100 { 0, COBALT_BASE_BAUD, 0xc800000, COBALT_SERIAL_IRQ, STD_COM_FLAGS }, /* ttyS0 */ 101#else 102#define COBALT_SERIAL_PORT_DEFNS 103#endif 104 105/* 106 * Both Galileo boards have the same UART mappings. 107 */ 108#if defined(CONFIG_MIPS_EV96100) || defined(CONFIG_MIPS_EV64120) 109#include <asm/galileo-boards/ev96100.h> 110#include <asm/galileo-boards/ev96100int.h> 111#define EV96100_SERIAL_PORT_DEFNS \ 112 { .baud_base = EV96100_BASE_BAUD, .irq = EV96100INT_UART_0, \ 113 .flags = STD_COM_FLAGS, \ 114 .iomem_base = EV96100_UART0_REGS_BASE, .iomem_reg_shift = 2, \ 115 .io_type = SERIAL_IO_MEM }, \ 116 { .baud_base = EV96100_BASE_BAUD, .irq = EV96100INT_UART_0, \ 117 .flags = STD_COM_FLAGS, \ 118 .iomem_base = EV96100_UART1_REGS_BASE, .iomem_reg_shift = 2, \ 119 .io_type = SERIAL_IO_MEM }, 120#else 121#define EV96100_SERIAL_PORT_DEFNS 122#endif 123 124#ifdef CONFIG_MIPS_ITE8172 125#include <asm/it8172/it8172.h> 126#include <asm/it8172/it8172_int.h> 127#include <asm/it8712.h> 128#define ITE_SERIAL_PORT_DEFNS \ 129 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \ 130 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, \ 131 { .baud_base = (24000000/(16*13)), .port = (IT8172_PCI_IO_BASE + IT8712_UART1_PORT), \ 132 .irq = IT8172_SERIRQ_4, .flags = STD_COM_FLAGS, .type = 0x3 }, \ 133 /* Smart Card Reader 0 */ \ 134 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR0_BASE), \ 135 .irq = IT8172_SCR0_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, \ 136 /* Smart Card Reader 1 */ \ 137 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \ 138 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, 139#else 140#define ITE_SERIAL_PORT_DEFNS 141#endif 142 143#ifdef CONFIG_MIPS_IVR 144#include <asm/it8172/it8172.h> 145#include <asm/it8172/it8172_int.h> 146#define IVR_SERIAL_PORT_DEFNS \ 147 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \ 148 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, \ 149 /* Smart Card Reader 1 */ \ 150 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \ 151 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .type = 0x3 }, 152#else 153#define IVR_SERIAL_PORT_DEFNS 154#endif 155 156#ifdef CONFIG_AU1X00_UART 157#include <asm/au1000.h> 158#define AU1000_SERIAL_PORT_DEFNS \ 159 { .baud_base = 0, .port = UART0_ADDR, .irq = AU1000_UART0_INT, \ 160 .flags = STD_COM_FLAGS, .type = 1 }, \ 161 { .baud_base = 0, .port = UART1_ADDR, .irq = AU1000_UART1_INT, \ 162 .flags = STD_COM_FLAGS, .type = 1 }, \ 163 { .baud_base = 0, .port = UART2_ADDR, .irq = AU1000_UART2_INT, \ 164 .flags = STD_COM_FLAGS, .type = 1 }, \ 165 { .baud_base = 0, .port = UART3_ADDR, .irq = AU1000_UART3_INT, \ 166 .flags = STD_COM_FLAGS, .type = 1 }, 167#else 168#define AU1000_SERIAL_PORT_DEFNS 169#endif 170 171#ifdef CONFIG_TOSHIBA_JMR3927 172#include <asm/jmr3927/jmr3927.h> 173#define TXX927_SERIAL_PORT_DEFNS \ 174 { .baud_base = JMR3927_BASE_BAUD, .port = UART0_ADDR, .irq = UART0_INT, \ 175 .flags = UART0_FLAGS, .type = 1 }, \ 176 { .baud_base = JMR3927_BASE_BAUD, .port = UART1_ADDR, .irq = UART1_INT, \ 177 .flags = UART1_FLAGS, .type = 1 }, 178#else 179#define TXX927_SERIAL_PORT_DEFNS 180#endif 181 182#ifdef CONFIG_BCM947XX 183/* reserve 4 ports to be configured at runtime */ 184#define BCM947XX_SERIAL_PORT_DEFNS { 0, }, { 0, }, { 0, }, { 0, }, 185#else 186#define BCM947XX_SERIAL_PORT_DEFNS 187#endif 188 189#ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT 190#define STD_SERIAL_PORT_DEFNS \ 191 /* UART CLK PORT IRQ FLAGS */ \ 192 { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ 193 { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ 194 { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ 195 { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ 196 197#ifdef CONFIG_SERIAL_MANY_PORTS 198#define EXTRA_SERIAL_PORT_DEFNS \ 199 { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ 200 { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ 201 { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ 202 { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ 203 { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ 204 { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ 205 { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ 206 { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ 207 { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ 208 { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ 209 { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ 210 { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ 211 { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ 212 { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ 213 { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ 214 { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ 215 { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ 216 { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ 217 { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ 218 { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ 219 { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ 220 { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ 221 { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ 222 { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ 223 { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ 224 { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ 225 { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ 226 { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ 227#else /* CONFIG_SERIAL_MANY_PORTS */ 228#define EXTRA_SERIAL_PORT_DEFNS 229#endif /* CONFIG_SERIAL_MANY_PORTS */ 230 231#else /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */ 232#define STD_SERIAL_PORT_DEFNS 233#define EXTRA_SERIAL_PORT_DEFNS 234#endif /* CONFIG_HAVE_STD_PC_SERIAL_PORTS */ 235 236/* You can have up to four HUB6's in the system, but I've only 237 * included two cards here for a total of twelve ports. 238 */ 239#if (defined(CONFIG_HUB6) && defined(CONFIG_SERIAL_MANY_PORTS)) 240#define HUB6_SERIAL_PORT_DFNS \ 241 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,0) }, /* ttyS32 */ \ 242 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,1) }, /* ttyS33 */ \ 243 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,2) }, /* ttyS34 */ \ 244 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,3) }, /* ttyS35 */ \ 245 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,4) }, /* ttyS36 */ \ 246 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,5) }, /* ttyS37 */ \ 247 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,0) }, /* ttyS38 */ \ 248 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,1) }, /* ttyS39 */ \ 249 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,2) }, /* ttyS40 */ \ 250 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,3) }, /* ttyS41 */ \ 251 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,4) }, /* ttyS42 */ \ 252 { 0, BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,5) }, /* ttyS43 */ 253#else 254#define HUB6_SERIAL_PORT_DFNS 255#endif 256 257#ifdef CONFIG_MCA 258#define MCA_SERIAL_PORT_DFNS \ 259 { 0, BASE_BAUD, 0x3220, 3, STD_COM_FLAGS }, \ 260 { 0, BASE_BAUD, 0x3228, 3, STD_COM_FLAGS }, \ 261 { 0, BASE_BAUD, 0x4220, 3, STD_COM_FLAGS }, \ 262 { 0, BASE_BAUD, 0x4228, 3, STD_COM_FLAGS }, \ 263 { 0, BASE_BAUD, 0x5220, 3, STD_COM_FLAGS }, \ 264 { 0, BASE_BAUD, 0x5228, 3, STD_COM_FLAGS }, 265#else 266#define MCA_SERIAL_PORT_DFNS 267#endif 268 269#ifdef CONFIG_MOMENCO_OCELOT 270/* Ordinary NS16552 duart with a 20MHz crystal. */ 271#define OCELOT_BASE_BAUD ( 20000000 / 16 ) 272 273#define OCELOT_SERIAL1_IRQ 4 274#define OCELOT_SERIAL1_BASE 0xe0001020 275 276#define _OCELOT_SERIAL_INIT(int, base) \ 277 { .baud_base = OCELOT_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \ 278 .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \ 279 .io_type = SERIAL_IO_MEM } 280#define MOMENCO_OCELOT_SERIAL_PORT_DEFNS \ 281 _OCELOT_SERIAL_INIT(OCELOT_SERIAL1_IRQ, OCELOT_SERIAL1_BASE) 282#else 283#define MOMENCO_OCELOT_SERIAL_PORT_DEFNS 284#endif 285 286#ifdef CONFIG_MOMENCO_OCELOT_G 287/* Ordinary NS16552 duart with a 20MHz crystal. */ 288#define OCELOT_G_BASE_BAUD ( 20000000 / 16 ) 289 290#define OCELOT_G_SERIAL1_IRQ 4 291#define OCELOT_G_SERIAL1_BASE 0xfd000020 292 293#define _OCELOT_G_SERIAL_INIT(int, base) \ 294 { .baud_base = OCELOT_G_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS,\ 295 .iomem_base = (u8 *) base, .iomem_reg_shift = 2, \ 296 .io_type = SERIAL_IO_MEM } 297#define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \ 298 _OCELOT_G_SERIAL_INIT(OCELOT_G_SERIAL1_IRQ, OCELOT_G_SERIAL1_BASE) 299#else 300#define MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS 301#endif 302 303#ifdef CONFIG_DDB5477 304#include <asm/ddb5xxx/ddb5477.h> 305#define DDB5477_SERIAL_PORT_DEFNS \ 306 { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART0, \ 307 .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04200, \ 308 .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM}, \ 309 { .baud_base = BASE_BAUD, .irq = VRC5477_IRQ_UART1, \ 310 .flags = STD_COM_FLAGS, .iomem_base = (u8*)0xbfa04240, \ 311 .iomem_reg_shift = 3, .io_type = SERIAL_IO_MEM}, 312#else 313#define DDB5477_SERIAL_PORT_DEFNS 314#endif 315 316#define SERIAL_PORT_DFNS \ 317 BCM947XX_SERIAL_PORT_DEFNS \ 318 IVR_SERIAL_PORT_DEFNS \ 319 ITE_SERIAL_PORT_DEFNS \ 320 ATLAS_SERIAL_PORT_DEFNS \ 321 SEAD_SERIAL_PORT_DEFNS \ 322 COBALT_SERIAL_PORT_DEFNS \ 323 EV96100_SERIAL_PORT_DEFNS \ 324 JAZZ_SERIAL_PORT_DEFNS \ 325 STD_SERIAL_PORT_DEFNS \ 326 EXTRA_SERIAL_PORT_DEFNS \ 327 HUB6_SERIAL_PORT_DFNS \ 328 MOMENCO_OCELOT_SERIAL_PORT_DEFNS \ 329 MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \ 330 AU1000_SERIAL_PORT_DEFNS \ 331 TXX927_SERIAL_PORT_DEFNS \ 332 DDB5477_SERIAL_PORT_DEFNS 333