aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ns9xxx
diff options
context:
space:
mode:
authorUwe Kleine-König <Uwe.Kleine-Koenig@digi.com>2008-01-31 08:20:21 -0500
committerUwe Kleine-König <Uwe.Kleine-Koenig@digi.com>2008-03-31 02:17:00 -0400
commit210b94e864de9d50ed08603a1ff0834603f309e0 (patch)
tree7743310b311efadfdfc257b64aecd90da3a9f253 /arch/arm/mach-ns9xxx
parent05dda977f2574c3341abef9b74c27d2b362e1e3a (diff)
ns9xxx: move registration of serial8250 to a dedicated file
Now the needed structs are allocated dynamically from __init code reducing memory usage if the kernel runs on a board different from a9m9750dev. Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Diffstat (limited to 'arch/arm/mach-ns9xxx')
-rw-r--r--arch/arm/mach-ns9xxx/Kconfig4
-rw-r--r--arch/arm/mach-ns9xxx/Makefile3
-rw-r--r--arch/arm/mach-ns9xxx/board-a9m9750dev.c58
-rw-r--r--arch/arm/mach-ns9xxx/plat-serial8250.c69
4 files changed, 76 insertions, 58 deletions
diff --git a/arch/arm/mach-ns9xxx/Kconfig b/arch/arm/mach-ns9xxx/Kconfig
index 8584ed107991..83c0efa7399c 100644
--- a/arch/arm/mach-ns9xxx/Kconfig
+++ b/arch/arm/mach-ns9xxx/Kconfig
@@ -2,6 +2,9 @@ if ARCH_NS9XXX
2 2
3menu "NS9xxx Implementations" 3menu "NS9xxx Implementations"
4 4
5config NS9XXX_HAVE_SERIAL8250
6 bool
7
5config MACH_CC9P9360DEV 8config MACH_CC9P9360DEV
6 bool "ConnectCore 9P 9360 on an A9M9750 Devboard" 9 bool "ConnectCore 9P 9360 on an A9M9750 Devboard"
7 select PROCESSOR_NS9360 10 select PROCESSOR_NS9360
@@ -23,6 +26,7 @@ config PROCESSOR_NS9360
23 26
24config BOARD_A9M9750DEV 27config BOARD_A9M9750DEV
25 bool 28 bool
29 select NS9XXX_HAVE_SERIAL8250
26 30
27config BOARD_JSCC9P9360 31config BOARD_JSCC9P9360
28 bool 32 bool
diff --git a/arch/arm/mach-ns9xxx/Makefile b/arch/arm/mach-ns9xxx/Makefile
index 6fb82b855a55..ca2c68dede1d 100644
--- a/arch/arm/mach-ns9xxx/Makefile
+++ b/arch/arm/mach-ns9xxx/Makefile
@@ -5,3 +5,6 @@ obj-$(CONFIG_MACH_CC9P9360JS) += mach-cc9p9360js.o
5 5
6obj-$(CONFIG_BOARD_A9M9750DEV) += board-a9m9750dev.o 6obj-$(CONFIG_BOARD_A9M9750DEV) += board-a9m9750dev.o
7obj-$(CONFIG_BOARD_JSCC9P9360) += board-jscc9p9360.o 7obj-$(CONFIG_BOARD_JSCC9P9360) += board-jscc9p9360.o
8
9# platform devices
10obj-$(CONFIG_NS9XXX_HAVE_SERIAL8250) += plat-serial8250.o
diff --git a/arch/arm/mach-ns9xxx/board-a9m9750dev.c b/arch/arm/mach-ns9xxx/board-a9m9750dev.c
index 0f65177f9e5f..14a06da25ac2 100644
--- a/arch/arm/mach-ns9xxx/board-a9m9750dev.c
+++ b/arch/arm/mach-ns9xxx/board-a9m9750dev.c
@@ -8,8 +8,6 @@
8 * under the terms of the GNU General Public License version 2 as published by 8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11#include <linux/platform_device.h>
12#include <linux/serial_8250.h>
13#include <linux/irq.h> 11#include <linux/irq.h>
14 12
15#include <asm/mach/map.h> 13#include <asm/mach/map.h>
@@ -126,59 +124,6 @@ void __init board_a9m9750dev_init_irq(void)
126 a9m9750dev_fpga_demux_handler); 124 a9m9750dev_fpga_demux_handler);
127} 125}
128 126
129static struct plat_serial8250_port board_a9m9750dev_serial8250_port[] = {
130 {
131 .iobase = FPGA_UARTA_BASE,
132 .membase = (unsigned char*)FPGA_UARTA_BASE,
133 .mapbase = FPGA_UARTA_BASE,
134 .irq = IRQ_FPGA_UARTA,
135 .iotype = UPIO_MEM,
136 .uartclk = 18432000,
137 .regshift = 0,
138 .flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ,
139 }, {
140 .iobase = FPGA_UARTB_BASE,
141 .membase = (unsigned char*)FPGA_UARTB_BASE,
142 .mapbase = FPGA_UARTB_BASE,
143 .irq = IRQ_FPGA_UARTB,
144 .iotype = UPIO_MEM,
145 .uartclk = 18432000,
146 .regshift = 0,
147 .flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ,
148 }, {
149 .iobase = FPGA_UARTC_BASE,
150 .membase = (unsigned char*)FPGA_UARTC_BASE,
151 .mapbase = FPGA_UARTC_BASE,
152 .irq = IRQ_FPGA_UARTC,
153 .iotype = UPIO_MEM,
154 .uartclk = 18432000,
155 .regshift = 0,
156 .flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ,
157 }, {
158 .iobase = FPGA_UARTD_BASE,
159 .membase = (unsigned char*)FPGA_UARTD_BASE,
160 .mapbase = FPGA_UARTD_BASE,
161 .irq = IRQ_FPGA_UARTD,
162 .iotype = UPIO_MEM,
163 .uartclk = 18432000,
164 .regshift = 0,
165 .flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ,
166 }, {
167 /* end marker */
168 },
169};
170
171static struct platform_device board_a9m9750dev_serial_device = {
172 .name = "serial8250",
173 .dev = {
174 .platform_data = board_a9m9750dev_serial8250_port,
175 },
176};
177
178static struct platform_device *board_a9m9750dev_devices[] __initdata = {
179 &board_a9m9750dev_serial_device,
180};
181
182void __init board_a9m9750dev_init_machine(void) 127void __init board_a9m9750dev_init_machine(void)
183{ 128{
184 u32 reg; 129 u32 reg;
@@ -210,7 +155,4 @@ void __init board_a9m9750dev_init_machine(void)
210 __raw_writel(0x2, MEM_SMOED(0)); 155 __raw_writel(0x2, MEM_SMOED(0));
211 __raw_writel(0x6, MEM_SMRD(0)); 156 __raw_writel(0x6, MEM_SMRD(0));
212 __raw_writel(0x6, MEM_SMWD(0)); 157 __raw_writel(0x6, MEM_SMWD(0));
213
214 platform_add_devices(board_a9m9750dev_devices,
215 ARRAY_SIZE(board_a9m9750dev_devices));
216} 158}
diff --git a/arch/arm/mach-ns9xxx/plat-serial8250.c b/arch/arm/mach-ns9xxx/plat-serial8250.c
new file mode 100644
index 000000000000..5aa5d9baf8c8
--- /dev/null
+++ b/arch/arm/mach-ns9xxx/plat-serial8250.c
@@ -0,0 +1,69 @@
1/*
2 * arch/arm/mach-ns9xxx/plat-serial8250.c
3 *
4 * Copyright (C) 2008 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#include <linux/platform_device.h>
12#include <linux/serial_8250.h>
13
14#include <asm/arch-ns9xxx/regs-board-a9m9750dev.h>
15#include <asm/arch-ns9xxx/board.h>
16
17#define DRIVER_NAME "serial8250"
18
19static int __init ns9xxx_plat_serial8250_init(void)
20{
21 struct plat_serial8250_port *pdata;
22 struct platform_device *pdev;
23 int ret = -ENOMEM;
24 int i;
25
26 if (!board_is_a9m9750dev())
27 return -ENODEV;
28
29 pdev = platform_device_alloc(DRIVER_NAME, 0);
30 if (!pdev)
31 goto err;
32
33 pdata = kzalloc(5 * sizeof(*pdata), GFP_KERNEL);
34 if (!pdata)
35 goto err;
36
37 pdev->dev.platform_data = pdata;
38
39 pdata[0].iobase = FPGA_UARTA_BASE;
40 pdata[1].iobase = FPGA_UARTB_BASE;
41 pdata[2].iobase = FPGA_UARTC_BASE;
42 pdata[3].iobase = FPGA_UARTD_BASE;
43
44 for (i = 0; i < 4; ++i) {
45 pdata[i].membase = (void __iomem *)pdata[i].iobase;
46 pdata[i].mapbase = pdata[i].iobase;
47 pdata[i].iotype = UPIO_MEM;
48 pdata[i].uartclk = 18432000;
49 pdata[i].flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
50 }
51
52 pdata[0].irq = IRQ_FPGA_UARTA;
53 pdata[1].irq = IRQ_FPGA_UARTB;
54 pdata[2].irq = IRQ_FPGA_UARTC;
55 pdata[3].irq = IRQ_FPGA_UARTD;
56
57 ret = platform_device_add(pdev);
58 if (ret) {
59err:
60 platform_device_put(pdev);
61
62 printk(KERN_WARNING "Could not add %s (errno=%d)\n",
63 DRIVER_NAME, ret);
64 }
65
66 return 0;
67}
68
69arch_initcall(ns9xxx_plat_serial8250_init);