Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Copyright (C) 2006, 07 MIPS Technologies, Inc.
0007  *   written by Ralf Baechle (ralf@linux-mips.org)
0008  *     written by Ralf Baechle <ralf@linux-mips.org>
0009  *
0010  * Copyright (C) 2008 Wind River Systems, Inc.
0011  *   updated by Tiejun Chen <tiejun.chen@windriver.com>
0012  *
0013  * 1. Probe driver for the Malta's UART ports:
0014  *
0015  *   o 2 ports in the SMC SuperIO
0016  *   o 1 port in the CBUS UART, a discrete 16550 which normally is only used
0017  *     for bringups.
0018  *
0019  * We don't use 8250_platform.c on Malta as it would result in the CBUS
0020  * UART becoming ttyS0.
0021  *
0022  * 2. Register RTC-CMOS platform device on Malta.
0023  */
0024 #include <linux/init.h>
0025 #include <linux/serial_8250.h>
0026 #include <linux/irq.h>
0027 #include <linux/platform_device.h>
0028 #include <asm/mips-boards/maltaint.h>
0029 
0030 #define SMC_PORT(base, int)                     \
0031 {                                   \
0032     .iobase     = base,                     \
0033     .irq        = int,                      \
0034     .uartclk    = 1843200,                  \
0035     .iotype     = UPIO_PORT,                    \
0036     .flags      = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |       \
0037               UPF_MAGIC_MULTIPLIER,             \
0038     .regshift   = 0,                        \
0039 }
0040 
0041 #define CBUS_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
0042 
0043 static struct plat_serial8250_port uart8250_data[] = {
0044     SMC_PORT(0x3F8, 4),
0045     SMC_PORT(0x2F8, 3),
0046 #ifndef CONFIG_MIPS_CMP
0047     {
0048         .mapbase    = 0x1f000900,   /* The CBUS UART */
0049         .irq        = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB2,
0050         .uartclk    = 3686400,  /* Twice the usual clk! */
0051         .iotype     = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) ?
0052                   UPIO_MEM32BE : UPIO_MEM32,
0053         .flags      = CBUS_UART_FLAGS,
0054         .regshift   = 3,
0055     },
0056 #endif
0057     { },
0058 };
0059 
0060 static struct platform_device malta_uart8250_device = {
0061     .name           = "serial8250",
0062     .id         = PLAT8250_DEV_PLATFORM,
0063     .dev            = {
0064         .platform_data  = uart8250_data,
0065     },
0066 };
0067 
0068 static struct platform_device *malta_devices[] __initdata = {
0069     &malta_uart8250_device,
0070 };
0071 
0072 static int __init malta_add_devices(void)
0073 {
0074     return platform_add_devices(malta_devices, ARRAY_SIZE(malta_devices));
0075 }
0076 
0077 device_initcall(malta_add_devices);