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 | |
| 65 | 1) drivers/rtc/rv3029.c |
| 66 | ----------------------- |
| 67 | The driver is standard rtc. Simple conversion is possible. |
| 68 | |
| 69 | |
| 70 | 2) drivers/rtc/s3c24x0_rtc.c |
| 71 | ---------------------------- |
| 72 | The driver is standard rtc. Simple conversion is possible. |
| 73 | |
| 74 | |
| 75 | 3) drivers/rtc/pt7c4338.c |
| 76 | ------------------------- |
| 77 | The driver is standard rtc. Simple conversion is possible. |
| 78 | |
| 79 | |
| 80 | 4) drivers/rtc/mvrtc.c |
| 81 | ---------------------- |
| 82 | The driver is standard rtc. Simple conversion is possible. |
| 83 | |
| 84 | |
| 85 | 5) drivers/rtc/ftrtc010.c |
| 86 | ------------------------- |
| 87 | The driver is standard rtc. Simple conversion is possible. |
| 88 | |
| 89 | |
| 90 | 6) drivers/rtc/mpc5xxx.c |
| 91 | ------------------------ |
| 92 | The driver is standard rtc. Simple conversion is possible. |
| 93 | |
| 94 | |
| 95 | 7) drivers/rtc/ds164x.c |
| 96 | ----------------------- |
| 97 | The driver is standard rtc. Simple conversion is possible. |
| 98 | |
| 99 | |
| 100 | 8) drivers/rtc/rs5c372.c |
| 101 | ------------------------ |
| 102 | The driver is standard rtc. Simple conversion is possible. |
| 103 | |
| 104 | |
| 105 | 9) drivers/rtc/m41t94.c |
| 106 | ----------------------- |
| 107 | The driver is standard rtc. Simple conversion is possible. |
| 108 | |
| 109 | |
| 110 | 10) drivers/rtc/mc13xxx-rtc.c |
| 111 | ----------------------------- |
| 112 | The driver is standard rtc. Simple conversion is possible. |
| 113 | |
| 114 | |
| 115 | 11) drivers/rtc/mcfrtc.c |
| 116 | ------------------------ |
| 117 | The driver is standard rtc. Simple conversion is possible. |
| 118 | |
| 119 | |
| 120 | 12) drivers/rtc/davinci.c |
| 121 | ------------------------- |
| 122 | The driver is standard rtc. Simple conversion is possible. |
| 123 | |
| 124 | |
| 125 | 13) drivers/rtc/rx8025.c |
| 126 | ------------------------ |
| 127 | The driver is standard rtc. Simple conversion is possible. |
| 128 | |
| 129 | |
| 130 | 14) drivers/rtc/bfin_rtc.c |
| 131 | -------------------------- |
| 132 | The driver is standard rtc. Simple conversion is possible. |
| 133 | |
| 134 | |
| 135 | 15) drivers/rtc/m41t62.c |
| 136 | ------------------------ |
| 137 | The driver is standard rtc. Simple conversion is possible. |
| 138 | |
| 139 | |
| 140 | 16) drivers/rtc/ds1306.c |
| 141 | ------------------------ |
| 142 | The driver is standard rtc. Simple conversion is possible. |
| 143 | |
| 144 | |
| 145 | 17) drivers/rtc/mpc8xx.c |
| 146 | ------------------------ |
| 147 | The driver is standard rtc. Simple conversion is possible. |
| 148 | |
| 149 | |
| 150 | 18) drivers/rtc/ds3231.c |
| 151 | ------------------------ |
| 152 | The driver is standard rtc. Simple conversion is possible. |
| 153 | |
| 154 | |
| 155 | 19) drivers/rtc/ds12887.c |
| 156 | ------------------------- |
| 157 | The driver is standard rtc. Simple conversion is possible. |
| 158 | |
| 159 | |
| 160 | 20) drivers/rtc/ds1302.c |
| 161 | ------------------------ |
| 162 | The driver is standard rtc. Simple conversion is possible. |
| 163 | |
| 164 | |
| 165 | 21) drivers/rtc/ds1374.c |
| 166 | ------------------------ |
| 167 | The driver is standard rtc. Simple conversion is possible. |
| 168 | |
| 169 | |
| 170 | 22) drivers/rtc/ds174x.c |
| 171 | ------------------------ |
| 172 | The driver is standard rtc. Simple conversion is possible. |
| 173 | |
| 174 | |
| 175 | 23) drivers/rtc/m41t60.c |
| 176 | ------------------------ |
| 177 | The driver is standard rtc. Simple conversion is possible. |
| 178 | |
| 179 | |
| 180 | 24) drivers/rtc/m48t35ax.c |
| 181 | -------------------------- |
| 182 | The driver is standard rtc. Simple conversion is possible. |
| 183 | |
| 184 | |
| 185 | 25) drivers/rtc/pl031.c |
| 186 | ----------------------- |
| 187 | The driver is standard rtc. Simple conversion is possible. |
| 188 | |
| 189 | |
| 190 | 26) drivers/rtc/x1205.c |
| 191 | ----------------------- |
| 192 | The driver is standard rtc. Simple conversion is possible. |
| 193 | |
| 194 | |
| 195 | 27) drivers/rtc/m41t11.c |
| 196 | ------------------------ |
| 197 | The driver is standard rtc. Simple conversion is possible. |
| 198 | |
| 199 | |
| 200 | 28) drivers/rtc/pcf8563.c |
| 201 | ------------------------- |
| 202 | The driver is standard rtc. Simple conversion is possible. |
| 203 | |
| 204 | |
| 205 | 29) drivers/rtc/mk48t59.c |
| 206 | ------------------------- |
| 207 | Macros needs cleanup. Besides that the driver is standard rtc. |
| 208 | Simple conversion is possible. |
| 209 | |
| 210 | |
| 211 | 30) drivers/rtc/mxsrtc.c |
| 212 | ------------------------ |
| 213 | The driver is standard rtc. Simple conversion is possible. |
| 214 | |
| 215 | |
| 216 | 31) drivers/rtc/ds1307.c |
| 217 | ------------------------ |
| 218 | The driver is standard rtc. Simple conversion is possible. |
| 219 | |
| 220 | |
| 221 | 32) drivers/rtc/ds1556.c |
| 222 | ------------------------ |
| 223 | The driver is standard rtc. Simple conversion is possible. |
| 224 | |
| 225 | |
| 226 | 33) drivers/rtc/rtc4543.c |
| 227 | ------------------------- |
| 228 | The driver is standard rtc. Simple conversion is possible. |
| 229 | |
| 230 | |
Masahiro Yamada | fef4fe4 | 2013-08-19 15:01:25 +0900 | [diff] [blame] | 231 | 34) drivers/rtc/ds1337.c |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 232 | ------------------------ |
| 233 | The driver is standard rtc. Simple conversion is possible. |
| 234 | |
| 235 | |
Masahiro Yamada | fef4fe4 | 2013-08-19 15:01:25 +0900 | [diff] [blame] | 236 | 35) drivers/rtc/isl1208.c |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 237 | ------------------------- |
| 238 | The driver is standard rtc. Simple conversion is possible. |
| 239 | |
| 240 | |
Masahiro Yamada | fef4fe4 | 2013-08-19 15:01:25 +0900 | [diff] [blame] | 241 | 36) drivers/rtc/max6900.c |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 242 | ------------------------- |
| 243 | The driver is standard rtc. Simple conversion is possible. |
| 244 | |
| 245 | |
Masahiro Yamada | fef4fe4 | 2013-08-19 15:01:25 +0900 | [diff] [blame] | 246 | 37) drivers/rtc/mc146818.c |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 247 | -------------------------- |
| 248 | The driver is standard rtc. Simple conversion is possible. |
| 249 | |
| 250 | |
Masahiro Yamada | fef4fe4 | 2013-08-19 15:01:25 +0900 | [diff] [blame] | 251 | 38) drivers/rtc/at91sam9_rtt.c |
Tomas Hlavacek | 2208b04 | 2012-08-08 01:42:29 +0000 | [diff] [blame] | 252 | ------------------------------ |
| 253 | The driver is standard rtc. Simple conversion is possible. |