platform.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * DEC platform devices.
  3. *
  4. * Copyright (c) 2014 Maciej W. Rozycki
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #include <linux/ioport.h>
  12. #include <linux/kernel.h>
  13. #include <linux/mc146818rtc.h>
  14. #include <linux/platform_device.h>
  15. static struct resource dec_rtc_resources[] = {
  16. {
  17. .name = "rtc",
  18. .flags = IORESOURCE_MEM,
  19. },
  20. };
  21. static struct cmos_rtc_board_info dec_rtc_info = {
  22. .flags = CMOS_RTC_FLAGS_NOFREQ,
  23. .address_space = 64,
  24. };
  25. static struct platform_device dec_rtc_device = {
  26. .name = "rtc_cmos",
  27. .id = PLATFORM_DEVID_NONE,
  28. .dev.platform_data = &dec_rtc_info,
  29. .resource = dec_rtc_resources,
  30. .num_resources = ARRAY_SIZE(dec_rtc_resources),
  31. };
  32. static int __init dec_add_devices(void)
  33. {
  34. dec_rtc_resources[0].start = RTC_PORT(0);
  35. dec_rtc_resources[0].end = RTC_PORT(0) + dec_kn_slot_size - 1;
  36. return platform_device_register(&dec_rtc_device);
  37. }
  38. device_initcall(dec_add_devices);