2 * NEC VR4100 series SIU platform device.
4 * Copyright (C) 2007-2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
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.
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.
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
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_core.h>
27 #include <asm/vr41xx/siu.h>
29 static unsigned int siu_type1_ports[SIU_PORTS_MAX] __initdata = {
34 static struct resource siu_type1_resource[] __initdata = {
38 .flags = IORESOURCE_MEM,
43 .flags = IORESOURCE_IRQ,
47 static unsigned int siu_type2_ports[SIU_PORTS_MAX] __initdata = {
52 static struct resource siu_type2_resource[] __initdata = {
56 .flags = IORESOURCE_MEM,
61 .flags = IORESOURCE_MEM,
66 .flags = IORESOURCE_IRQ,
71 .flags = IORESOURCE_IRQ,
75 static int __init vr41xx_siu_add(void)
77 struct platform_device *pdev;
82 pdev = platform_device_alloc("SIU", -1);
86 switch (current_cpu_type()) {
89 pdev->dev.platform_data = siu_type1_ports;
90 res = siu_type1_resource;
91 num = ARRAY_SIZE(siu_type1_resource);
96 pdev->dev.platform_data = siu_type2_ports;
97 res = siu_type2_resource;
98 num = ARRAY_SIZE(siu_type2_resource);
102 goto err_free_device;
105 retval = platform_device_add_resources(pdev, res, num);
107 goto err_free_device;
109 retval = platform_device_add(pdev);
111 goto err_free_device;
116 platform_device_put(pdev);
120 device_initcall(vr41xx_siu_add);
122 void __init vr41xx_siu_setup(void)
124 struct uart_port port;
125 struct resource *res;
129 switch (current_cpu_type()) {
132 type = siu_type1_ports;
133 res = siu_type1_resource;
138 type = siu_type2_ports;
139 res = siu_type2_resource;
145 for (i = 0; i < SIU_PORTS_MAX; i++) {
148 if (port.type == PORT_UNKNOWN)
150 port.mapbase = res[i].start;
151 port.membase = (unsigned char __iomem *)KSEG1ADDR(res[i].start);
152 vr41xx_siu_early_setup(&port);