1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * NEC VR4100 series RTC 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/irq.h>
16 static struct resource rtc_type1_resource
[] __initdata
= {
20 .flags
= IORESOURCE_MEM
,
25 .flags
= IORESOURCE_MEM
,
28 .start
= ELAPSEDTIME_IRQ
,
29 .end
= ELAPSEDTIME_IRQ
,
30 .flags
= IORESOURCE_IRQ
,
33 .start
= RTCLONG1_IRQ
,
35 .flags
= IORESOURCE_IRQ
,
39 static struct resource rtc_type2_resource
[] __initdata
= {
43 .flags
= IORESOURCE_MEM
,
48 .flags
= IORESOURCE_MEM
,
51 .start
= ELAPSEDTIME_IRQ
,
52 .end
= ELAPSEDTIME_IRQ
,
53 .flags
= IORESOURCE_IRQ
,
56 .start
= RTCLONG1_IRQ
,
58 .flags
= IORESOURCE_IRQ
,
62 static int __init
vr41xx_rtc_add(void)
64 struct platform_device
*pdev
;
69 pdev
= platform_device_alloc("RTC", -1);
73 switch (current_cpu_type()) {
76 res
= rtc_type1_resource
;
77 num
= ARRAY_SIZE(rtc_type1_resource
);
82 res
= rtc_type2_resource
;
83 num
= ARRAY_SIZE(rtc_type2_resource
);
90 retval
= platform_device_add_resources(pdev
, res
, num
);
94 retval
= platform_device_add(pdev
);
101 platform_device_put(pdev
);
105 device_initcall(vr41xx_rtc_add
);