18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *	DEC platform devices.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *	Copyright (c) 2014  Maciej W. Rozycki
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/ioport.h>
98c2ecf20Sopenharmony_ci#include <linux/kernel.h>
108c2ecf20Sopenharmony_ci#include <linux/mc146818rtc.h>
118c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistatic struct resource dec_rtc_resources[] = {
148c2ecf20Sopenharmony_ci	{
158c2ecf20Sopenharmony_ci		.name = "rtc",
168c2ecf20Sopenharmony_ci		.flags = IORESOURCE_MEM,
178c2ecf20Sopenharmony_ci	},
188c2ecf20Sopenharmony_ci};
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistatic struct cmos_rtc_board_info dec_rtc_info = {
218c2ecf20Sopenharmony_ci	.flags = CMOS_RTC_FLAGS_NOFREQ,
228c2ecf20Sopenharmony_ci	.address_space = 64,
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistatic struct platform_device dec_rtc_device = {
268c2ecf20Sopenharmony_ci	.name = "rtc_cmos",
278c2ecf20Sopenharmony_ci	.id = PLATFORM_DEVID_NONE,
288c2ecf20Sopenharmony_ci	.dev.platform_data = &dec_rtc_info,
298c2ecf20Sopenharmony_ci	.resource = dec_rtc_resources,
308c2ecf20Sopenharmony_ci	.num_resources = ARRAY_SIZE(dec_rtc_resources),
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistatic int __init dec_add_devices(void)
348c2ecf20Sopenharmony_ci{
358c2ecf20Sopenharmony_ci	dec_rtc_resources[0].start = RTC_PORT(0);
368c2ecf20Sopenharmony_ci	dec_rtc_resources[0].end = RTC_PORT(0) + dec_kn_slot_size - 1;
378c2ecf20Sopenharmony_ci	return platform_device_register(&dec_rtc_device);
388c2ecf20Sopenharmony_ci}
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cidevice_initcall(dec_add_devices);
41