18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Lemote Fuloong platform support
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright(c) 2010 Arnaud Patard <apatard@mandriva.com>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/init.h>
98c2ecf20Sopenharmony_ci#include <linux/kernel.h>
108c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
118c2ecf20Sopenharmony_ci#include <linux/mc146818rtc.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistatic struct resource loongson_rtc_resources[] = {
148c2ecf20Sopenharmony_ci	{
158c2ecf20Sopenharmony_ci		.start	= RTC_PORT(0),
168c2ecf20Sopenharmony_ci		.end	= RTC_PORT(1),
178c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IO,
188c2ecf20Sopenharmony_ci	}, {
198c2ecf20Sopenharmony_ci		.start	= RTC_IRQ,
208c2ecf20Sopenharmony_ci		.end	= RTC_IRQ,
218c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
228c2ecf20Sopenharmony_ci	}
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistatic struct platform_device loongson_rtc_device = {
268c2ecf20Sopenharmony_ci	.name		= "rtc_cmos",
278c2ecf20Sopenharmony_ci	.id		= -1,
288c2ecf20Sopenharmony_ci	.resource	= loongson_rtc_resources,
298c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(loongson_rtc_resources),
308c2ecf20Sopenharmony_ci};
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistatic int __init loongson_rtc_platform_init(void)
348c2ecf20Sopenharmony_ci{
358c2ecf20Sopenharmony_ci	platform_device_register(&loongson_rtc_device);
368c2ecf20Sopenharmony_ci	return 0;
378c2ecf20Sopenharmony_ci}
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cidevice_initcall(loongson_rtc_platform_init);
40