1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * NEC VR4100 series GIU platform device.
5 * Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
7 #include <linux/errno.h>
8 #include <linux/init.h>
10 #include <linux/ioport.h>
11 #include <linux/platform_device.h>
14 #include <asm/vr41xx/giu.h>
15 #include <asm/vr41xx/irq.h>
17 static struct resource giu_50pins_pullupdown_resource
[] __initdata
= {
21 .flags
= IORESOURCE_MEM
,
26 .flags
= IORESOURCE_MEM
,
31 .flags
= IORESOURCE_IRQ
,
35 static struct resource giu_36pins_resource
[] __initdata
= {
39 .flags
= IORESOURCE_MEM
,
44 .flags
= IORESOURCE_IRQ
,
48 static struct resource giu_48pins_resource
[] __initdata
= {
52 .flags
= IORESOURCE_MEM
,
57 .flags
= IORESOURCE_IRQ
,
61 static int __init
vr41xx_giu_add(void)
63 struct platform_device
*pdev
;
68 pdev
= platform_device_alloc("GIU", -1);
72 switch (current_cpu_type()) {
75 pdev
->id
= GPIO_50PINS_PULLUPDOWN
;
76 res
= giu_50pins_pullupdown_resource
;
77 num
= ARRAY_SIZE(giu_50pins_pullupdown_resource
);
81 pdev
->id
= GPIO_36PINS
;
82 res
= giu_36pins_resource
;
83 num
= ARRAY_SIZE(giu_36pins_resource
);
86 pdev
->id
= GPIO_48PINS_EDGE_SELECT
;
87 res
= giu_48pins_resource
;
88 num
= ARRAY_SIZE(giu_48pins_resource
);
95 retval
= platform_device_add_resources(pdev
, res
, num
);
99 retval
= platform_device_add(pdev
);
101 goto err_free_device
;
106 platform_device_put(pdev
);
110 device_initcall(vr41xx_giu_add
);