Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 1 | ============================= |
| 2 | RTC device subsystem analysis |
| 3 | ============================= |
| 4 | |
| 5 | Tomas Hlavacek <tmshlvck@gmail.com> |
| 6 | 2012-03-10 |
| 7 | |
| 8 | I) Overview |
| 9 | ----------- |
| 10 | |
| 11 | U-Boot currently implements one common API for RTC devices. The interface |
| 12 | is defined in include/rtc.h and comprises of functions and structures: |
| 13 | |
| 14 | struct rtc_time { |
Wolfgang Denk | ec7fbf5 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 15 | int tm_sec; |
| 16 | int tm_min; |
| 17 | int tm_hour; |
| 18 | int tm_mday; |
| 19 | int tm_mon; |
| 20 | int tm_year; |
| 21 | int tm_wday; |
| 22 | int tm_yday; |
| 23 | int tm_isdst; |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | int rtc_get (struct rtc_time *); |
| 27 | int rtc_set (struct rtc_time *); |
| 28 | void rtc_reset (void); |
| 29 | |
| 30 | The functions are implemented by a proper device driver in drivers/rtc |
| 31 | directory and the driver to be compiled in is selected in a Makefile. |
| 32 | Drivers are mutually exclusive. |
| 33 | |
| 34 | Drivers depends on date code in drivers/rtc/date.c and naturally on board |
| 35 | specific data. |
| 36 | |
| 37 | II) Approach |
| 38 | ------------ |
| 39 | |
| 40 | 1) New API |
| 41 | ---------- |
| 42 | In the UDM each rtc driver would register itself by a function |
| 43 | |
| 44 | int rtc_device_register(struct instance *i, |
Wolfgang Denk | ec7fbf5 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 45 | struct rtc_device_ops *o); |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 46 | |
| 47 | The structure being defined as follows: |
| 48 | |
| 49 | struct rtc_device_ops { |
Wolfgang Denk | ec7fbf5 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 50 | int (*get_time)(struct instance *i, struct rtc_time *t); |
| 51 | int (*set_time)(struct instance *i, struct rtc_time *t); |
| 52 | int (*reset)(struct instance *i); |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | |
| 56 | 2) Conversion thougths |
| 57 | ---------------------- |
| 58 | U-Boot RTC drivers exports the same functions and therefore the conversion |
| 59 | of the drivers is straight-forward. There is no initialization needed. |
| 60 | |
| 61 | |
| 62 | III) Analysis of in-tree drivers |
| 63 | -------------------------------- |
| 64 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 65 | drivers/rtc/rv3029.c |
| 66 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 67 | The driver is standard rtc. Simple conversion is possible. |
| 68 | |
| 69 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 70 | drivers/rtc/s3c24x0_rtc.c |
| 71 | ------------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 72 | The driver is standard rtc. Simple conversion is possible. |
| 73 | |
| 74 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 75 | drivers/rtc/pt7c4338.c |
| 76 | ---------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 77 | The driver is standard rtc. Simple conversion is possible. |
| 78 | |
| 79 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 80 | drivers/rtc/mvrtc.c |
| 81 | ------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 82 | The driver is standard rtc. Simple conversion is possible. |
| 83 | |
| 84 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 85 | drivers/rtc/ftrtc010.c |
| 86 | ---------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 87 | The driver is standard rtc. Simple conversion is possible. |
| 88 | |
| 89 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 90 | drivers/rtc/mpc5xxx.c |
| 91 | --------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 92 | The driver is standard rtc. Simple conversion is possible. |
| 93 | |
| 94 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 95 | drivers/rtc/ds164x.c |
| 96 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 97 | The driver is standard rtc. Simple conversion is possible. |
| 98 | |
| 99 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 100 | drivers/rtc/rs5c372.c |
| 101 | --------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 102 | The driver is standard rtc. Simple conversion is possible. |
| 103 | |
| 104 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 105 | drivers/rtc/m41t94.c |
| 106 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 107 | The driver is standard rtc. Simple conversion is possible. |
| 108 | |
| 109 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 110 | drivers/rtc/mc13xxx-rtc.c |
| 111 | ------------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 112 | The driver is standard rtc. Simple conversion is possible. |
| 113 | |
| 114 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 115 | drivers/rtc/mcfrtc.c |
| 116 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 117 | The driver is standard rtc. Simple conversion is possible. |
| 118 | |
| 119 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 120 | drivers/rtc/davinci.c |
| 121 | --------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 122 | The driver is standard rtc. Simple conversion is possible. |
| 123 | |
| 124 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 125 | drivers/rtc/rx8025.c |
| 126 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 127 | The driver is standard rtc. Simple conversion is possible. |
| 128 | |
| 129 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 130 | drivers/rtc/bfin_rtc.c |
| 131 | ---------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 132 | The driver is standard rtc. Simple conversion is possible. |
| 133 | |
| 134 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 135 | drivers/rtc/m41t62.c |
| 136 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 137 | The driver is standard rtc. Simple conversion is possible. |
| 138 | |
| 139 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 140 | drivers/rtc/ds1306.c |
| 141 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 142 | The driver is standard rtc. Simple conversion is possible. |
| 143 | |
| 144 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 145 | drivers/rtc/mpc8xx.c |
| 146 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 147 | The driver is standard rtc. Simple conversion is possible. |
| 148 | |
| 149 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 150 | drivers/rtc/ds3231.c |
| 151 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 152 | The driver is standard rtc. Simple conversion is possible. |
| 153 | |
| 154 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 155 | drivers/rtc/ds12887.c |
| 156 | --------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 157 | The driver is standard rtc. Simple conversion is possible. |
| 158 | |
| 159 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 160 | drivers/rtc/ds1302.c |
| 161 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 162 | The driver is standard rtc. Simple conversion is possible. |
| 163 | |
| 164 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 165 | drivers/rtc/ds1374.c |
| 166 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 167 | The driver is standard rtc. Simple conversion is possible. |
| 168 | |
| 169 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 170 | drivers/rtc/ds174x.c |
| 171 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 172 | The driver is standard rtc. Simple conversion is possible. |
| 173 | |
| 174 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 175 | drivers/rtc/m41t60.c |
| 176 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 177 | The driver is standard rtc. Simple conversion is possible. |
| 178 | |
| 179 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 180 | drivers/rtc/m48t35ax.c |
| 181 | ---------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 182 | The driver is standard rtc. Simple conversion is possible. |
| 183 | |
| 184 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 185 | drivers/rtc/pl031.c |
| 186 | ------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 187 | The driver is standard rtc. Simple conversion is possible. |
| 188 | |
| 189 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 190 | drivers/rtc/x1205.c |
| 191 | ------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 192 | The driver is standard rtc. Simple conversion is possible. |
| 193 | |
| 194 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 195 | drivers/rtc/m41t11.c |
| 196 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 197 | The driver is standard rtc. Simple conversion is possible. |
| 198 | |
| 199 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 200 | drivers/rtc/pcf8563.c |
| 201 | --------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 202 | The driver is standard rtc. Simple conversion is possible. |
| 203 | |
| 204 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 205 | drivers/rtc/mk48t59.c |
| 206 | --------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 207 | Macros needs cleanup. Besides that the driver is standard rtc. |
| 208 | Simple conversion is possible. |
| 209 | |
| 210 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 211 | drivers/rtc/mxsrtc.c |
| 212 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 213 | The driver is standard rtc. Simple conversion is possible. |
| 214 | |
| 215 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 216 | drivers/rtc/ds1307.c |
| 217 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 218 | The driver is standard rtc. Simple conversion is possible. |
| 219 | |
| 220 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 221 | drivers/rtc/ds1556.c |
| 222 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 223 | The driver is standard rtc. Simple conversion is possible. |
| 224 | |
| 225 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 226 | drivers/rtc/rtc4543.c |
| 227 | --------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 228 | The driver is standard rtc. Simple conversion is possible. |
| 229 | |
| 230 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 231 | drivers/rtc/ds1337.c |
| 232 | -------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 233 | The driver is standard rtc. Simple conversion is possible. |
| 234 | |
| 235 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 236 | drivers/rtc/isl1208.c |
| 237 | --------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 238 | The driver is standard rtc. Simple conversion is possible. |
| 239 | |
| 240 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 241 | drivers/rtc/max6900.c |
| 242 | --------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 243 | The driver is standard rtc. Simple conversion is possible. |
| 244 | |
| 245 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 246 | drivers/rtc/mc146818.c |
| 247 | ---------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 248 | The driver is standard rtc. Simple conversion is possible. |
| 249 | |
| 250 | |
Masahiro Yamada | a756da9 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 251 | drivers/rtc/at91sam9_rtt.c |
| 252 | -------------------------- |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 253 | The driver is standard rtc. Simple conversion is possible. |