diff options
author | Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | 2007-10-11 09:54:13 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-10-11 18:46:19 -0400 |
commit | 2c4d13570d8e512cca65d159502622e1666ad4bd (patch) | |
tree | 29498acd98392dacd7ac9f0c6a8d1a039e08935b /arch/mips/gt64120 | |
parent | 572afc248c33c902760f6f24a72c180f0e4f1719 (diff) |
[MIPS] WRPPMC serial support move to platform device
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/gt64120')
-rw-r--r-- | arch/mips/gt64120/wrppmc/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/gt64120/wrppmc/serial.c | 80 | ||||
-rw-r--r-- | arch/mips/gt64120/wrppmc/setup.c | 34 |
3 files changed, 81 insertions, 35 deletions
diff --git a/arch/mips/gt64120/wrppmc/Makefile b/arch/mips/gt64120/wrppmc/Makefile index bef15c90ae15..b49d282bee8a 100644 --- a/arch/mips/gt64120/wrppmc/Makefile +++ b/arch/mips/gt64120/wrppmc/Makefile | |||
@@ -9,6 +9,6 @@ | |||
9 | # Makefile for the Wind River MIPS 4KC PPMC Eval Board | 9 | # Makefile for the Wind River MIPS 4KC PPMC Eval Board |
10 | # | 10 | # |
11 | 11 | ||
12 | obj-y += irq.o reset.o setup.o time.o pci.o | 12 | obj-y += irq.o pci.o reset.o serial.o setup.o time.o |
13 | 13 | ||
14 | EXTRA_CFLAGS += -Werror | 14 | EXTRA_CFLAGS += -Werror |
diff --git a/arch/mips/gt64120/wrppmc/serial.c b/arch/mips/gt64120/wrppmc/serial.c new file mode 100644 index 000000000000..5ec1c2ffd3a5 --- /dev/null +++ b/arch/mips/gt64120/wrppmc/serial.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Registration of WRPPMC UART platform device. | ||
3 | * | ||
4 | * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | #include <linux/errno.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/serial_8250.h> | ||
25 | |||
26 | #include <asm/gt64120.h> | ||
27 | |||
28 | static struct resource wrppmc_uart_resource[] __initdata = { | ||
29 | { | ||
30 | .start = WRPPMC_UART16550_BASE, | ||
31 | .end = WRPPMC_UART16550_BASE + 7, | ||
32 | .flags = IORESOURCE_MEM, | ||
33 | }, | ||
34 | { | ||
35 | .start = WRPPMC_UART16550_IRQ, | ||
36 | .end = WRPPMC_UART16550_IRQ, | ||
37 | .flags = IORESOURCE_IRQ, | ||
38 | }, | ||
39 | }; | ||
40 | |||
41 | static struct plat_serial8250_port wrppmc_serial8250_port[] = { | ||
42 | { | ||
43 | .irq = WRPPMC_UART16550_IRQ, | ||
44 | .uartclk = WRPPMC_UART16550_CLOCK, | ||
45 | .iotype = UPIO_MEM, | ||
46 | .flags = UPF_IOREMAP | UPF_SKIP_TEST, | ||
47 | .mapbase = WRPPMC_UART16550_BASE, | ||
48 | }, | ||
49 | {}, | ||
50 | }; | ||
51 | |||
52 | static __init int wrppmc_uart_add(void) | ||
53 | { | ||
54 | struct platform_device *pdev; | ||
55 | int retval; | ||
56 | |||
57 | pdev = platform_device_alloc("serial8250", -1); | ||
58 | if (!pdev) | ||
59 | return -ENOMEM; | ||
60 | |||
61 | pdev->id = PLAT8250_DEV_PLATFORM; | ||
62 | pdev->dev.platform_data = wrppmc_serial8250_port; | ||
63 | |||
64 | retval = platform_device_add_resources(pdev, wrppmc_uart_resource, | ||
65 | ARRAY_SIZE(wrppmc_uart_resource)); | ||
66 | if (retval) | ||
67 | goto err_free_device; | ||
68 | |||
69 | retval = platform_device_add(pdev); | ||
70 | if (retval) | ||
71 | goto err_free_device; | ||
72 | |||
73 | return 0; | ||
74 | |||
75 | err_free_device: | ||
76 | platform_device_put(pdev); | ||
77 | |||
78 | return retval; | ||
79 | } | ||
80 | device_initcall(wrppmc_uart_add); | ||
diff --git a/arch/mips/gt64120/wrppmc/setup.c b/arch/mips/gt64120/wrppmc/setup.c index f2ccf101e6d9..51f6b7862460 100644 --- a/arch/mips/gt64120/wrppmc/setup.c +++ b/arch/mips/gt64120/wrppmc/setup.c | |||
@@ -11,10 +11,6 @@ | |||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/tty.h> | ||
15 | #include <linux/serial.h> | ||
16 | #include <linux/serial_core.h> | ||
17 | #include <linux/serial_8250.h> | ||
18 | #include <linux/pm.h> | 14 | #include <linux/pm.h> |
19 | 15 | ||
20 | #include <asm/io.h> | 16 | #include <asm/io.h> |
@@ -98,32 +94,6 @@ void __init prom_free_prom_memory(void) | |||
98 | { | 94 | { |
99 | } | 95 | } |
100 | 96 | ||
101 | #ifdef CONFIG_SERIAL_8250 | ||
102 | static void wrppmc_setup_serial(void) | ||
103 | { | ||
104 | struct uart_port up; | ||
105 | |||
106 | memset(&up, 0x00, sizeof(struct uart_port)); | ||
107 | |||
108 | /* | ||
109 | * A note about mapbase/membase | ||
110 | * -) mapbase is the physical address of the IO port. | ||
111 | * -) membase is an 'ioremapped' cookie. | ||
112 | */ | ||
113 | up.line = 0; | ||
114 | up.type = PORT_16550; | ||
115 | up.iotype = UPIO_MEM; | ||
116 | up.mapbase = WRPPMC_UART16550_BASE; | ||
117 | up.membase = ioremap(up.mapbase, 8); | ||
118 | up.irq = WRPPMC_UART16550_IRQ; | ||
119 | up.uartclk = WRPPMC_UART16550_CLOCK; | ||
120 | up.flags = UPF_SKIP_TEST/* | UPF_BOOT_AUTOCONF */; | ||
121 | up.regshift = 0; | ||
122 | |||
123 | early_serial_setup(&up); | ||
124 | } | ||
125 | #endif | ||
126 | |||
127 | void __init plat_mem_setup(void) | 97 | void __init plat_mem_setup(void) |
128 | { | 98 | { |
129 | extern void wrppmc_machine_restart(char *command); | 99 | extern void wrppmc_machine_restart(char *command); |
@@ -138,10 +108,6 @@ void __init plat_mem_setup(void) | |||
138 | * physical address ( < KSEG0) can work via KSEG1 | 108 | * physical address ( < KSEG0) can work via KSEG1 |
139 | */ | 109 | */ |
140 | set_io_port_base(KSEG1); | 110 | set_io_port_base(KSEG1); |
141 | |||
142 | #ifdef CONFIG_SERIAL_8250 | ||
143 | wrppmc_setup_serial(); | ||
144 | #endif | ||
145 | } | 111 | } |
146 | 112 | ||
147 | const char *get_system_type(void) | 113 | const char *get_system_type(void) |