2 * NEC VR4100 series GIU platform device.
4 * Copyright (C) 2007 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>
26 #include <asm/vr41xx/giu.h>
27 #include <asm/vr41xx/irq.h>
29 static struct resource giu_50pins_pullupdown_resource
[] __initdata
= {
33 .flags
= IORESOURCE_MEM
,
38 .flags
= IORESOURCE_MEM
,
43 .flags
= IORESOURCE_IRQ
,
47 static struct resource giu_36pins_resource
[] __initdata
= {
51 .flags
= IORESOURCE_MEM
,
56 .flags
= IORESOURCE_IRQ
,
60 static struct resource giu_48pins_resource
[] __initdata
= {
64 .flags
= IORESOURCE_MEM
,
69 .flags
= IORESOURCE_IRQ
,
73 static int __init
vr41xx_giu_add(void)
75 struct platform_device
*pdev
;
80 pdev
= platform_device_alloc("GIU", -1);
84 switch (current_cpu_type()) {
87 pdev
->id
= GPIO_50PINS_PULLUPDOWN
;
88 res
= giu_50pins_pullupdown_resource
;
89 num
= ARRAY_SIZE(giu_50pins_pullupdown_resource
);
93 pdev
->id
= GPIO_36PINS
;
94 res
= giu_36pins_resource
;
95 num
= ARRAY_SIZE(giu_36pins_resource
);
98 pdev
->id
= GPIO_48PINS_EDGE_SELECT
;
99 res
= giu_48pins_resource
;
100 num
= ARRAY_SIZE(giu_48pins_resource
);
104 goto err_free_device
;
107 retval
= platform_device_add_resources(pdev
, res
, num
);
109 goto err_free_device
;
111 retval
= platform_device_add(pdev
);
113 goto err_free_device
;
118 platform_device_put(pdev
);
122 device_initcall(vr41xx_giu_add
);