platform.c 910 B

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