~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/loongson/common/serial.c

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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 Ralf Baechle (ralf@linux-mips.org)
  7  *
  8  * Copyright (C) 2009 Lemote, Inc.
  9  * Author: Yan hua (yanhua@lemote.com)
 10  * Author: Wu Zhangjin (wuzhangjin@gmail.com)
 11  */
 12 
 13 #include <linux/io.h>
 14 #include <linux/init.h>
 15 #include <linux/serial_8250.h>
 16 
 17 #include <asm/bootinfo.h>
 18 
 19 #include <loongson.h>
 20 #include <machine.h>
 21 
 22 #define PORT(int)                       \
 23 {                                                               \
 24         .irq            = int,                                  \
 25         .uartclk        = 1843200,                              \
 26         .iotype         = UPIO_PORT,                            \
 27         .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,    \
 28         .regshift       = 0,                                    \
 29 }
 30 
 31 #define PORT_M(int)                             \
 32 {                                                               \
 33         .irq            = MIPS_CPU_IRQ_BASE + (int),            \
 34         .uartclk        = 3686400,                              \
 35         .iotype         = UPIO_MEM,                             \
 36         .membase        = (void __iomem *)NULL,                 \
 37         .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,    \
 38         .regshift       = 0,                                    \
 39 }
 40 
 41 static struct plat_serial8250_port uart8250_data[][2] = {
 42         [MACH_LOONGSON_UNKNOWN]         {},
 43         [MACH_LEMOTE_FL2E]              {PORT(4), {} },
 44         [MACH_LEMOTE_FL2F]              {PORT(3), {} },
 45         [MACH_LEMOTE_ML2F7]             {PORT_M(3), {} },
 46         [MACH_LEMOTE_YL2F89]            {PORT_M(3), {} },
 47         [MACH_DEXXON_GDIUM2F10]         {PORT_M(3), {} },
 48         [MACH_LEMOTE_NAS]               {PORT_M(3), {} },
 49         [MACH_LEMOTE_LL2F]              {PORT(3), {} },
 50         [MACH_LOONGSON_END]             {},
 51 };
 52 
 53 static struct platform_device uart8250_device = {
 54         .name = "serial8250",
 55         .id = PLAT8250_DEV_PLATFORM,
 56 };
 57 
 58 static int __init serial_init(void)
 59 {
 60         unsigned char iotype;
 61 
 62         iotype = uart8250_data[mips_machtype][0].iotype;
 63 
 64         if (UPIO_MEM == iotype)
 65                 uart8250_data[mips_machtype][0].membase =
 66                         (void __iomem *)_loongson_uart_base;
 67         else if (UPIO_PORT == iotype)
 68                 uart8250_data[mips_machtype][0].iobase =
 69                     loongson_uart_base - LOONGSON_PCIIO_BASE;
 70 
 71         uart8250_device.dev.platform_data = uart8250_data[mips_machtype];
 72 
 73         return platform_device_register(&uart8250_device);
 74 }
 75 
 76 device_initcall(serial_init);
 77 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp