rtc_dev.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include<linux/module.h>
  2. #include<linux/init.h>
  3. #include <linux/platform_device.h>
  4. #include<linux/ioport.h>
  5. #if 0
  6. struct platform_device
  7. {
  8. const char * name;
  9. u32 id;
  10. struct device dev;
  11. u32 num_resources;
  12. struct resource * resource;
  13. };
  14. #endif
  15. static struct resource fs_rtc_resource[]={
  16. [0] ={
  17. .start =0x57000040,
  18. .end =0x57000044,
  19. .flags = IORESOURCE_MEM,
  20. },
  21. [1] ={
  22. .start =12, //0x57000070
  23. .end =19, //0x5700008c 18 17 16 15
  24. .flags = IORESOURCE_MEM,
  25. },
  26. };
  27. void rtc_release(struct device *dev)
  28. {
  29. }
  30. static struct platform_device fs_device_rtc = {
  31. .name ="fs2410-rtc",
  32. .id =-1,
  33. .resource =fs_rtc_resource,
  34. .num_resources = ARRAY_SIZE(fs_rtc_resource),
  35. .dev ={
  36. .release =rtc_release,
  37. },
  38. };
  39. static int __init fs2410_rtc_dev_init(void)
  40. {
  41. platform_device_register(&fs_device_rtc);
  42. return 0;
  43. }
  44. static void __exit fs2410_rtc_dev_exit(void)
  45. {
  46. platform_device_unregister(&fs_device_rtc);
  47. }
  48. module_init(fs2410_rtc_dev_init);
  49. module_exit(fs2410_rtc_dev_exit);
  50. MODULE_LICENSE("GPL");