xref: /OK3568_Linux_fs/kernel/arch/mips/dec/platform.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-or-later
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  *	DEC platform devices.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  *	Copyright (c) 2014  Maciej W. Rozycki
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #include <linux/ioport.h>
9*4882a593Smuzhiyun #include <linux/kernel.h>
10*4882a593Smuzhiyun #include <linux/mc146818rtc.h>
11*4882a593Smuzhiyun #include <linux/platform_device.h>
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun static struct resource dec_rtc_resources[] = {
14*4882a593Smuzhiyun 	{
15*4882a593Smuzhiyun 		.name = "rtc",
16*4882a593Smuzhiyun 		.flags = IORESOURCE_MEM,
17*4882a593Smuzhiyun 	},
18*4882a593Smuzhiyun };
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun static struct cmos_rtc_board_info dec_rtc_info = {
21*4882a593Smuzhiyun 	.flags = CMOS_RTC_FLAGS_NOFREQ,
22*4882a593Smuzhiyun 	.address_space = 64,
23*4882a593Smuzhiyun };
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun static struct platform_device dec_rtc_device = {
26*4882a593Smuzhiyun 	.name = "rtc_cmos",
27*4882a593Smuzhiyun 	.id = PLATFORM_DEVID_NONE,
28*4882a593Smuzhiyun 	.dev.platform_data = &dec_rtc_info,
29*4882a593Smuzhiyun 	.resource = dec_rtc_resources,
30*4882a593Smuzhiyun 	.num_resources = ARRAY_SIZE(dec_rtc_resources),
31*4882a593Smuzhiyun };
32*4882a593Smuzhiyun 
dec_add_devices(void)33*4882a593Smuzhiyun static int __init dec_add_devices(void)
34*4882a593Smuzhiyun {
35*4882a593Smuzhiyun 	dec_rtc_resources[0].start = RTC_PORT(0);
36*4882a593Smuzhiyun 	dec_rtc_resources[0].end = RTC_PORT(0) + dec_kn_slot_size - 1;
37*4882a593Smuzhiyun 	return platform_device_register(&dec_rtc_device);
38*4882a593Smuzhiyun }
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun device_initcall(dec_add_devices);
41