UDM-rtc.txt 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. =============================
  2. RTC device subsystem analysis
  3. =============================
  4. Tomas Hlavacek <tmshlvck@gmail.com>
  5. 2012-03-10
  6. I) Overview
  7. -----------
  8. U-Boot currently implements one common API for RTC devices. The interface
  9. is defined in include/rtc.h and comprises of functions and structures:
  10. struct rtc_time {
  11. int tm_sec;
  12. int tm_min;
  13. int tm_hour;
  14. int tm_mday;
  15. int tm_mon;
  16. int tm_year;
  17. int tm_wday;
  18. int tm_yday;
  19. int tm_isdst;
  20. };
  21. int rtc_get (struct rtc_time *);
  22. int rtc_set (struct rtc_time *);
  23. void rtc_reset (void);
  24. The functions are implemented by a proper device driver in drivers/rtc
  25. directory and the driver to be compiled in is selected in a Makefile.
  26. Drivers are mutually exclusive.
  27. Drivers depends on date code in drivers/rtc/date.c and naturally on board
  28. specific data.
  29. II) Approach
  30. ------------
  31. 1) New API
  32. ----------
  33. In the UDM each rtc driver would register itself by a function
  34. int rtc_device_register(struct instance *i,
  35. struct rtc_device_ops *o);
  36. The structure being defined as follows:
  37. struct rtc_device_ops {
  38. int (*get_time)(struct instance *i, struct rtc_time *t);
  39. int (*set_time)(struct instance *i, struct rtc_time *t);
  40. int (*reset)(struct instance *i);
  41. };
  42. 2) Conversion thougths
  43. ----------------------
  44. U-Boot RTC drivers exports the same functions and therefore the conversion
  45. of the drivers is straight-forward. There is no initialization needed.
  46. III) Analysis of in-tree drivers
  47. --------------------------------
  48. 1) drivers/rtc/rv3029.c
  49. -----------------------
  50. The driver is standard rtc. Simple conversion is possible.
  51. 2) drivers/rtc/s3c24x0_rtc.c
  52. ----------------------------
  53. The driver is standard rtc. Simple conversion is possible.
  54. 3) drivers/rtc/pt7c4338.c
  55. -------------------------
  56. The driver is standard rtc. Simple conversion is possible.
  57. 4) drivers/rtc/mvrtc.c
  58. ----------------------
  59. The driver is standard rtc. Simple conversion is possible.
  60. 5) drivers/rtc/ftrtc010.c
  61. -------------------------
  62. The driver is standard rtc. Simple conversion is possible.
  63. 6) drivers/rtc/mpc5xxx.c
  64. ------------------------
  65. The driver is standard rtc. Simple conversion is possible.
  66. 7) drivers/rtc/ds164x.c
  67. -----------------------
  68. The driver is standard rtc. Simple conversion is possible.
  69. 8) drivers/rtc/rs5c372.c
  70. ------------------------
  71. The driver is standard rtc. Simple conversion is possible.
  72. 9) drivers/rtc/m41t94.c
  73. -----------------------
  74. The driver is standard rtc. Simple conversion is possible.
  75. 10) drivers/rtc/mc13xxx-rtc.c
  76. -----------------------------
  77. The driver is standard rtc. Simple conversion is possible.
  78. 11) drivers/rtc/mcfrtc.c
  79. ------------------------
  80. The driver is standard rtc. Simple conversion is possible.
  81. 12) drivers/rtc/davinci.c
  82. -------------------------
  83. The driver is standard rtc. Simple conversion is possible.
  84. 13) drivers/rtc/rx8025.c
  85. ------------------------
  86. The driver is standard rtc. Simple conversion is possible.
  87. 14) drivers/rtc/bfin_rtc.c
  88. --------------------------
  89. The driver is standard rtc. Simple conversion is possible.
  90. 15) drivers/rtc/m41t62.c
  91. ------------------------
  92. The driver is standard rtc. Simple conversion is possible.
  93. 16) drivers/rtc/ds1306.c
  94. ------------------------
  95. The driver is standard rtc. Simple conversion is possible.
  96. 17) drivers/rtc/mpc8xx.c
  97. ------------------------
  98. The driver is standard rtc. Simple conversion is possible.
  99. 18) drivers/rtc/ds3231.c
  100. ------------------------
  101. The driver is standard rtc. Simple conversion is possible.
  102. 19) drivers/rtc/ds12887.c
  103. -------------------------
  104. The driver is standard rtc. Simple conversion is possible.
  105. 20) drivers/rtc/ds1302.c
  106. ------------------------
  107. The driver is standard rtc. Simple conversion is possible.
  108. 21) drivers/rtc/ds1374.c
  109. ------------------------
  110. The driver is standard rtc. Simple conversion is possible.
  111. 22) drivers/rtc/ds174x.c
  112. ------------------------
  113. The driver is standard rtc. Simple conversion is possible.
  114. 23) drivers/rtc/m41t60.c
  115. ------------------------
  116. The driver is standard rtc. Simple conversion is possible.
  117. 24) drivers/rtc/m48t35ax.c
  118. --------------------------
  119. The driver is standard rtc. Simple conversion is possible.
  120. 25) drivers/rtc/pl031.c
  121. -----------------------
  122. The driver is standard rtc. Simple conversion is possible.
  123. 26) drivers/rtc/x1205.c
  124. -----------------------
  125. The driver is standard rtc. Simple conversion is possible.
  126. 27) drivers/rtc/m41t11.c
  127. ------------------------
  128. The driver is standard rtc. Simple conversion is possible.
  129. 28) drivers/rtc/pcf8563.c
  130. -------------------------
  131. The driver is standard rtc. Simple conversion is possible.
  132. 29) drivers/rtc/mk48t59.c
  133. -------------------------
  134. Macros needs cleanup. Besides that the driver is standard rtc.
  135. Simple conversion is possible.
  136. 30) drivers/rtc/mxsrtc.c
  137. ------------------------
  138. The driver is standard rtc. Simple conversion is possible.
  139. 31) drivers/rtc/ds1307.c
  140. ------------------------
  141. The driver is standard rtc. Simple conversion is possible.
  142. 32) drivers/rtc/ds1556.c
  143. ------------------------
  144. The driver is standard rtc. Simple conversion is possible.
  145. 33) drivers/rtc/rtc4543.c
  146. -------------------------
  147. The driver is standard rtc. Simple conversion is possible.
  148. 34) drivers/rtc/ds1337.c
  149. ------------------------
  150. The driver is standard rtc. Simple conversion is possible.
  151. 35) drivers/rtc/isl1208.c
  152. -------------------------
  153. The driver is standard rtc. Simple conversion is possible.
  154. 36) drivers/rtc/max6900.c
  155. -------------------------
  156. The driver is standard rtc. Simple conversion is possible.
  157. 37) drivers/rtc/mc146818.c
  158. --------------------------
  159. The driver is standard rtc. Simple conversion is possible.
  160. 38) drivers/rtc/at91sam9_rtt.c
  161. ------------------------------
  162. The driver is standard rtc. Simple conversion is possible.