Pull misc into release branch
[linux-2.6] / arch / mips / mips-boards / malta / malta_platform.c
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) 2007 MIPS Technologies, Inc.
7  *   written by Ralf Baechle (ralf@linux-mips.org)
8  *
9  * Probe driver for the Malta's UART ports:
10  *
11  *   o 2 ports in the SMC SuperIO
12  *   o 1 port in the CBUS UART, a discrete 16550 which normally is only used
13  *     for bringups.
14  *
15  * We don't use 8250_platform.c on Malta as it would result in the CBUS
16  * UART becoming ttyS0.
17  */
18 #include <linux/module.h>
19 #include <linux/init.h>
20 #include <linux/serial_8250.h>
21
22 #define SMC_PORT(base, int)                                             \
23 {                                                                       \
24         .iobase         = base,                                         \
25         .irq            = int,                                          \
26         .uartclk        = 1843200,                                      \
27         .iotype         = UPIO_PORT,                                    \
28         .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,            \
29         .regshift       = 0,                                            \
30 }
31
32 #define CBUS_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
33
34 static struct plat_serial8250_port uart8250_data[] = {
35         SMC_PORT(0x3F8, 4),
36         SMC_PORT(0x2F8, 3),
37         {
38                 .mapbase        = 0x1f000900,   /* The CBUS UART */
39                 .irq            = MIPS_CPU_IRQ_BASE + 2,
40                 .uartclk        = 3686400,      /* Twice the usual clk! */
41                 .iotype         = UPIO_MEM32,
42                 .flags          = CBUS_UART_FLAGS,
43                 .regshift       = 3,
44         },
45         { },
46 };
47
48 static struct platform_device uart8250_device = {
49         .name                   = "serial8250",
50         .id                     = PLAT8250_DEV_PLATFORM2,
51         .dev                    = {
52                 .platform_data  = uart8250_data,
53         },
54 };
55
56 static int __init uart8250_init(void)
57 {
58         return platform_device_register(&uart8250_device);
59 }
60
61 module_init(uart8250_init);
62
63 MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
64 MODULE_LICENSE("GPL");
65 MODULE_DESCRIPTION("8250 UART probe driver for the Malta CBUS UART");