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