blob: 3f130635dc201ec6f044c3c51c48ae18f0112a8a [file] [log] [blame]
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +00001The U-Boot Driver Model Project
2===============================
3Watchdog device subsystem analysis
4==================================
5
6Tomas Hlavacek <tmshlvck@gmail.com>
72012-03-09
8
9I) Overview
10-----------
11
12U-Boot currently implements an API for HW watchdog devices as explicit drivers
13in drivers/watchdog directory. There are also drivers for both hardware and
14software watchdog on particular CPUs implemented in arch/*/cpu/*/cpu.c. There
15are macros in include/watchdog.h that selects between SW and HW watchdog and
16assembly SW implementation.
17
18The current common interface comprises of one set out of these two possible
19variants:
20
21 1)
22 void watchdog_reset(void);
23 int watchdog_disable(void);
24 int watchdog_init(void);
25
26 2)
27 void hw_watchdog_reset(void);
28 void hw_watchdog_init(void);
29
30The watchdog implementations are also spread through board/*/*.c that in
31some cases. The API and semantics is in most cases same as the above
32mentioned common functions.
33
34
35II) Approach
36------------
37
38 1) New API
39 ----------
40
41 In the UDM each watchdog driver would register itself by a function
42
43 int watchdog_device_register(struct instance *i,
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020044 const struct watchdog_device_ops *o);
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +000045
46 The structure being defined as follows:
47
48 struct watchdog_device_ops {
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020049 int (*disable)(struct instance *i);
50 void (*reset)(struct instance *i);
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +000051 };
52
53 The watchdog_init() function will be dissolved into probe() function.
54
55 2) Conversion thougths
56 ----------------------
57
58 Conversion of watchdog implementations to a new API could be divided
59 to three subsections: a) HW implementations, which are mostly compliant
60 to the above mentioned API; b) SW implementations, which are compliant
61 to the above mentioned API and c) SW implementations that are not compliant
62 to the API and has to be rectified or partially rewritten.
63
64III) Analysis of in-tree drivers
65--------------------------------
66
Masahiro Yamadaa756da92013-09-24 10:32:04 +090067 drivers/watchdog/at91sam9_wdt.c
68 -------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +000069 The driver is standard HW watchdog. Simple conversion is possible.
70
71
Masahiro Yamadaa756da92013-09-24 10:32:04 +090072 drivers/watchdog/ftwdt010_wdt.c
73 -------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +000074 The driver is ad-hoc HW watchdog. Conversion has to take into account
75 driver parts spread in include/faraday/*. Restructuring the driver and
76 code cleanup has to be considered.
77
78
Masahiro Yamadaa756da92013-09-24 10:32:04 +090079 arch/arm/cpu/arm1136/mx31/timer.c
80 ---------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +000081 The driver is semi-standard ad-hoc HW watchdog. Conversion has to take
82 into account driver parts spread in the timer.c file.
83
84
Masahiro Yamadaa756da92013-09-24 10:32:04 +090085 arch/arm/cpu/arm926ejs/davinci/timer.c
86 --------------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +000087 The driver is ad-hoc semi-standard HW watchdog. Conversion has to take
88 into account driver parts spread in the timer.c file.
89
90
Masahiro Yamadaa756da92013-09-24 10:32:04 +090091 arch/arm/cpu/armv7/omap-common/hwinit-common.c
92 ----------------------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +000093 The driver is non-standard ad-hoc HW watchdog. Conversion is possible
94 but functions has to be renamed and constants moved to another places.
95
96
Masahiro Yamadaa756da92013-09-24 10:32:04 +090097 arch/arm/cpu/armv7/omap3/board.c
98 --------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +000099 The driver is non-standard ad-hoc HW watchdog. Conversion is possible
100 but functions has to be renamed and constants moved to another places.
101
102
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900103 arch/blackfin/cpu/watchdog.c
104 ----------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000105 The driver is standard HW watchdog. Simple conversion is possible.
106
107
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900108 arch/m68k/cpu/mcf523x/cpu.c
109 ---------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000110 The driver is standard HW watchdog. Simple conversion is possible.
111
112
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900113 arch/m68k/cpu/mcf52x2/cpu.c
114 ---------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000115 The driver is standard HW watchdog. Simple conversion is possible.
116
117
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900118 arch/m68k/cpu/mcf532x/cpu.c
119 ---------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000120 The driver is standard HW watchdog. Simple conversion is possible.
121
122
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900123 arch/m68k/cpu/mcf547x_8x/cpu.c
124 ------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000125 The driver is standard HW watchdog (there is slight naming convention
126 violation that has to be rectified). Simple conversion is possible.
127
128
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900129 arch/powerpc/cpu/74xx_7xx/cpu.c
130 -------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000131 The driver is standard HW watchdog. Simple conversion is possible.
132
133
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900134 arch/powerpc/cpu/mpc512x/cpu.c
135 ------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000136 The driver is standard HW watchdog. Simple conversion is possible.
137
138
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900139 arch/powerpc/cpu/mpc5xx/cpu.c
140 -----------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000141 The driver is standard HW watchdog. Simple conversion is possible.
142
143
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900144 arch/powerpc/cpu/mpc5xxx/cpu.c
145 ------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000146 The driver is standard HW watchdog. Simple conversion is possible.
147
148
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900149 arch/powerpc/cpu/mpc8260/cpu.c
150 ------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000151 The driver is standard HW watchdog. Simple conversion is possible.
152
153
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900154 arch/powerpc/cpu/mpc83xx/cpu.c
155 ------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000156 The driver is standard HW watchdog. Simple conversion is possible.
157
158
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900159 arch/powerpc/cpu/mpc85xx/cpu.c
160 ------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000161 The driver is standard HW watchdog. Simple conversion is possible.
162
163
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900164 arch/powerpc/cpu/mpc86xx/cpu.c
165 ------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000166 The driver is standard HW watchdog. Simple conversion is possible.
167
168
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900169 arch/powerpc/cpu/mpc8xx/cpu.c
170 -----------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000171 The driver is standard HW watchdog. Simple conversion is possible.
172
173
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900174 arch/powerpc/cpu/ppc4xx/cpu.c
175 -----------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000176 The driver is standard HW watchdog. Simple conversion is possible.
177
178
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900179 arch/sh/cpu/sh2/watchdog.c
180 --------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000181 The driver is standard HW watchdog. Simple conversion is possible.
182
183
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900184 arch/sh/cpu/sh3/watchdog.c
185 --------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000186 The driver is standard HW watchdog. Simple conversion is possible.
187
188
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900189 arch/sh/cpu/sh4/watchdog.c
190 --------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000191 The driver is standard HW watchdog. Simple conversion is possible.
192
193
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900194 board/amcc/luan/luan.c
195 ----------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000196 The driver is standard HW watchdog. Simple conversion is possible.
197
198
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900199 board/amcc/yosemite/yosemite.c
200 ------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000201 The driver is standard HW watchdog. Simple conversion is possible.
202
203
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900204 board/apollon/apollon.c
205 -----------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000206 The driver is standard HW watchdog however the watchdog_init()
207 function is called in early initialization. Simple conversion is possible.
208
209
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900210 board/bmw/m48t59y.c
211 -------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000212 Special watchdog driver. Dead code. To be removed.
213
214
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900215 board/davedenx/qong/qong.c
216 --------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000217 The driver is standard HW watchdog. Simple conversion is possible.
218
219
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900220 board/dvlhost/watchdog.c
221 ------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000222 The driver is standard HW watchdog. Simple conversion is possible.
223
224
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900225 board/eNET/eNET.c
226 -----------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000227 The driver is standard HW watchdog. Simple conversion is possible.
228
229
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900230 board/eltec/elppc/elppc.c
231 -------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000232 The driver is standard HW watchdog. Simple conversion is possible.
233
234
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900235 board/enbw/enbw_cmc/enbw_cmc.c
236 ------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000237 Only function proxy call. Code cleanup needed.
238
239
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900240 board/freescale/mx31pdk/mx31pdk.c
241 ---------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000242 Only function proxy call. Code cleanup needed.
243
244
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900245 board/gth2/gth2.c
246 -----------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000247 The driver is standard HW watchdog. Simple conversion is possible.
248
249
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900250 board/lwmon5/lwmon5.c
251 ---------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000252 The driver is standard HW watchdog. Simple conversion is possible.
253
254
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900255 board/manroland/mucmc52/mucmc52.c
256 ---------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000257 The driver is standard HW watchdog. Simple conversion is possible.
258
259
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900260 board/manroland/uc101/uc101.c
261 -----------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000262 The driver is standard HW watchdog. Simple conversion is possible.
263
264
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900265 board/mousse/m48t59y.c
266 ----------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000267 Special watchdog driver. Dead code. To be removed.
268
269
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900270 board/mvblue/mvblue.c
271 ---------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000272 The driver is standard HW watchdog. Simple conversion is possible.
273
274
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900275 board/netphone/netphone.c
276 -------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000277 The driver is standard HW watchdog. Simple conversion is possible.
278
279
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900280 board/netta/netta.c
281 -------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000282 The driver is standard HW watchdog. Simple conversion is possible.
283
284
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900285 board/netta2/netta2.c
286 ---------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000287 The driver is standard HW watchdog. Simple conversion is possible.
288
289
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900290 board/omicron/calimain/calimain.c
291 ---------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000292 Only function proxy call. Code cleanup needed.
293
294
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900295 board/pcs440ep/pcs440ep.c
296 -------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000297 The driver is standard HW watchdog. Simple conversion is possible.
298
299
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900300 board/stx/stxxtc/stxxtc.c
301 -------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000302 The driver is standard HW watchdog. Simple conversion is possible.
303
304
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900305 board/ti/omap2420h4/omap2420h4.c
306 --------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000307 The driver is standard HW watchdog. Simple conversion is possible.
308
309
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900310 board/ttcontrol/vision2/vision2.c
311 ---------------------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000312 The driver is standard HW watchdog but namespace is polluted by
313 non-standard macros. Simple conversion is possible, code cleanup
314 needed.
315
316
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900317 board/v38b/v38b.c
318 -----------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000319 The driver is standard HW watchdog. Simple conversion is possible.
320
321
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900322 board/ve8313/ve8313.c
323 ---------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000324 The driver is standard HW watchdog. Simple conversion is possible.
325
326
Masahiro Yamadaa756da92013-09-24 10:32:04 +0900327 board/w7o/watchdog.c
328 --------------------
Tomas Hlavacek91e96ec2012-08-08 01:42:26 +0000329 The driver is standard HW watchdog. Simple conversion is possible.