2 * NEC VR4100 series RTC platform device.
4 * Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
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/irq.h>
28 static struct resource rtc_type1_resource
[] __initdata
= {
32 .flags
= IORESOURCE_MEM
,
37 .flags
= IORESOURCE_MEM
,
40 .start
= ELAPSEDTIME_IRQ
,
41 .end
= ELAPSEDTIME_IRQ
,
42 .flags
= IORESOURCE_IRQ
,
45 .start
= RTCLONG1_IRQ
,
47 .flags
= IORESOURCE_IRQ
,
51 static struct resource rtc_type2_resource
[] __initdata
= {
55 .flags
= IORESOURCE_MEM
,
60 .flags
= IORESOURCE_MEM
,
63 .start
= ELAPSEDTIME_IRQ
,
64 .end
= ELAPSEDTIME_IRQ
,
65 .flags
= IORESOURCE_IRQ
,
68 .start
= RTCLONG1_IRQ
,
70 .flags
= IORESOURCE_IRQ
,
74 static int __init
vr41xx_rtc_add(void)
76 struct platform_device
*pdev
;
81 pdev
= platform_device_alloc("RTC", -1);
85 switch (current_cpu_type()) {
88 res
= rtc_type1_resource
;
89 num
= ARRAY_SIZE(rtc_type1_resource
);
94 res
= rtc_type2_resource
;
95 num
= ARRAY_SIZE(rtc_type2_resource
);
102 retval
= platform_device_add_resources(pdev
, res
, num
);
104 goto err_free_device
;
106 retval
= platform_device_add(pdev
);
108 goto err_free_device
;
113 platform_device_put(pdev
);
117 device_initcall(vr41xx_rtc_add
);