| ============================= |
| RTC device subsystem analysis |
| ============================= |
| |
| Tomas Hlavacek <tmshlvck@gmail.com> |
| 2012-03-10 |
| |
| I) Overview |
| ----------- |
| |
| U-Boot currently implements one common API for RTC devices. The interface |
| is defined in include/rtc.h and comprises of functions and structures: |
| |
| struct rtc_time { |
| int tm_sec; |
| int tm_min; |
| int tm_hour; |
| int tm_mday; |
| int tm_mon; |
| int tm_year; |
| int tm_wday; |
| int tm_yday; |
| int tm_isdst; |
| }; |
| |
| int rtc_get (struct rtc_time *); |
| int rtc_set (struct rtc_time *); |
| void rtc_reset (void); |
| |
| The functions are implemented by a proper device driver in drivers/rtc |
| directory and the driver to be compiled in is selected in a Makefile. |
| Drivers are mutually exclusive. |
| |
| Drivers depends on date code in drivers/rtc/date.c and naturally on board |
| specific data. |
| |
| II) Approach |
| ------------ |
| |
| 1) New API |
| ---------- |
| In the UDM each rtc driver would register itself by a function |
| |
| int rtc_device_register(struct instance *i, |
| struct rtc_device_ops *o); |
| |
| The structure being defined as follows: |
| |
| struct rtc_device_ops { |
| int (*get_time)(struct instance *i, struct rtc_time *t); |
| int (*set_time)(struct instance *i, struct rtc_time *t); |
| int (*reset)(struct instance *i); |
| }; |
| |
| |
| 2) Conversion thougths |
| ---------------------- |
| U-Boot RTC drivers exports the same functions and therefore the conversion |
| of the drivers is straight-forward. There is no initialization needed. |
| |
| |
| III) Analysis of in-tree drivers |
| -------------------------------- |
| |
| drivers/rtc/rv3029.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/s3c24x0_rtc.c |
| ------------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/pt7c4338.c |
| ---------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/mvrtc.c |
| ------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ftrtc010.c |
| ---------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/mpc5xxx.c |
| --------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ds164x.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/rs5c372.c |
| --------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/m41t94.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/mc13xxx-rtc.c |
| ------------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/mcfrtc.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/davinci.c |
| --------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/rx8025.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/bfin_rtc.c |
| ---------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/m41t62.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ds1306.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/mpc8xx.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ds3231.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ds12887.c |
| --------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ds1302.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ds1374.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ds174x.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/m41t60.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/m48t35ax.c |
| ---------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/pl031.c |
| ------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/x1205.c |
| ------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/m41t11.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/pcf8563.c |
| --------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/mk48t59.c |
| --------------------- |
| Macros needs cleanup. Besides that the driver is standard rtc. |
| Simple conversion is possible. |
| |
| |
| drivers/rtc/mxsrtc.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ds1307.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ds1556.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/rtc4543.c |
| --------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/ds1337.c |
| -------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/isl1208.c |
| --------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/max6900.c |
| --------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/mc146818.c |
| ---------------------- |
| The driver is standard rtc. Simple conversion is possible. |
| |
| |
| drivers/rtc/at91sam9_rtt.c |
| -------------------------- |
| The driver is standard rtc. Simple conversion is possible. |