summaryrefslogtreecommitdiff
path: root/doc/driver-model/UDM-watchdog.txt
blob: 7948e5926053886e9797e7bfd485d50e861f602c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
The U-Boot Driver Model Project
===============================
Watchdog device subsystem analysis
==================================

Tomas Hlavacek <tmshlvck@gmail.com>
2012-03-09

I) Overview
-----------

U-Boot currently implements an API for HW watchdog devices as explicit drivers
in drivers/watchdog directory. There are also drivers for both hardware and
software watchdog on particular CPUs implemented in arch/*/cpu/*/cpu.c. There
are macros in include/watchdog.h that selects between SW and HW watchdog and
assembly SW implementation.

The current common interface comprises of one set out of these two possible
variants:

    1)
    void watchdog_reset(void);
    int watchdog_disable(void);
    int watchdog_init(void);

    2)
    void hw_watchdog_reset(void);
    void hw_watchdog_init(void);

The watchdog implementations are also spread through board/*/*.c that in
some cases. The API and semantics is in most cases same as the above
mentioned common functions.


II) Approach
------------

  1) New API
  ----------

  In the UDM each watchdog driver would register itself by a function

    int watchdog_device_register(struct instance *i,
				 const struct watchdog_device_ops *o);

  The structure being defined as follows:

    struct watchdog_device_ops {
	int (*disable)(struct instance *i);
	void (*reset)(struct instance *i);
    };

  The watchdog_init() function will be dissolved into probe() function.

  2) Conversion thougths
  ----------------------

  Conversion of watchdog implementations to a new API could be divided
  to three subsections: a) HW implementations, which are mostly compliant
  to the above mentioned API; b) SW implementations, which are compliant
  to the above mentioned API and c) SW implementations that are not compliant
  to the API and has to be rectified or partially rewritten.

III) Analysis of in-tree drivers
--------------------------------

  1) drivers/watchdog/at91sam9_wdt.c
  ----------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  2) drivers/watchdog/ftwdt010_wdt.c
  ----------------------------------
  The driver is ad-hoc HW watchdog. Conversion has to take into account
  driver parts spread in include/faraday/*. Restructuring the driver and
  code cleanup has to be considered.


  3) arch/arm/cpu/arm1136/mx31/timer.c
  ------------------------------------
  The driver is semi-standard ad-hoc HW watchdog. Conversion has to take
  into account driver parts spread in the timer.c file.


  4) arch/arm/cpu/arm926ejs/davinci/timer.c
  -----------------------------------------
  The driver is ad-hoc semi-standard HW watchdog. Conversion has to take
  into account driver parts spread in the timer.c file.


  5) arch/arm/cpu/armv7/omap-common/hwinit-common.c
  -------------------------------------------------
  The driver is non-standard ad-hoc HW watchdog. Conversion is possible
  but functions has to be renamed and constants moved to another places.


  6) arch/arm/cpu/armv7/omap3/board.c
  -----------------------------------
  The driver is non-standard ad-hoc HW watchdog. Conversion is possible
  but functions has to be renamed and constants moved to another places.


  7) arch/blackfin/cpu/watchdog.c
  -------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  8) arch/m68k/cpu/mcf523x/cpu.c
  ------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  9) arch/m68k/cpu/mcf52x2/cpu.c
  ------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  10) arch/m68k/cpu/mcf532x/cpu.c
  -------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  11) arch/m68k/cpu/mcf547x_8x/cpu.c
  ----------------------------------
  The driver is standard HW watchdog (there is slight naming convention
  violation that has to be rectified). Simple conversion is possible.


  12) arch/powerpc/cpu/74xx_7xx/cpu.c
  -----------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  13) arch/powerpc/cpu/mpc512x/cpu.c
  ----------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  14) arch/powerpc/cpu/mpc5xx/cpu.c
  ---------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  15) arch/powerpc/cpu/mpc5xxx/cpu.c
  ----------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  16) arch/powerpc/cpu/mpc8260/cpu.c
  ----------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  17) arch/powerpc/cpu/mpc83xx/cpu.c
  ----------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  18) arch/powerpc/cpu/mpc85xx/cpu.c
  ----------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  19) arch/powerpc/cpu/mpc86xx/cpu.c
  ----------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  20) arch/powerpc/cpu/mpc8xx/cpu.c

  The driver is standard HW watchdog. Simple conversion is possible.


  21) arch/powerpc/cpu/ppc4xx/cpu.c
  ---------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  22) arch/sh/cpu/sh2/watchdog.c
  ------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  23) arch/sh/cpu/sh3/watchdog.c
  ------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  24) arch/sh/cpu/sh4/watchdog.c
  ------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  25) board/amcc/luan/luan.c
  --------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  26) board/amcc/yosemite/yosemite.c
  ----------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  27) board/apollon/apollon.c
  ---------------------------
  The driver is standard HW watchdog however the watchdog_init()
  function is called in early initialization. Simple conversion is possible.


  28) board/bmw/m48t59y.c
  -----------------------
  Special watchdog driver. Dead code. To be removed.


  29) board/davedenx/qong/qong.c
  ------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  30) board/dvlhost/watchdog.c
  ----------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  31) board/eNET/eNET.c
  ---------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  32) board/eltec/elppc/elppc.c
  -----------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  33) board/enbw/enbw_cmc/enbw_cmc.c
  ----------------------------------
  Only function proxy call. Code cleanup needed.


  34) board/freescale/mx31pdk/mx31pdk.c
  -------------------------------------
  Only function proxy call. Code cleanup needed.


  35) board/gth2/gth2.c
  ---------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  36) board/lwmon5/lwmon5.c
  -------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  37) board/manroland/mucmc52/mucmc52.c
  -------------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  38) board/manroland/uc101/uc101.c
  ---------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  39) board/mousse/m48t59y.c
  --------------------------
  Special watchdog driver. Dead code. To be removed.


  40) board/mvblue/mvblue.c
  -------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  41) board/netphone/netphone.c
  -----------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  42) board/netta/netta.c
  -----------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  43) board/netta2/netta2.c
  -------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  44) board/omicron/calimain/calimain.c
  -------------------------------------
  Only function proxy call. Code cleanup needed.


  46) board/pcs440ep/pcs440ep.c
  -----------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  47) board/stx/stxxtc/stxxtc.c
  -----------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  48) board/ti/omap2420h4/omap2420h4.c
  ------------------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  49) board/ttcontrol/vision2/vision2.c
  -------------------------------------
  The driver is standard HW watchdog but namespace is polluted by
  non-standard macros. Simple conversion is possible, code cleanup
  needed.


  50) board/v38b/v38b.c
  ---------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  51) board/ve8313/ve8313.c
  -------------------------
  The driver is standard HW watchdog. Simple conversion is possible.


  52) board/w7o/watchdog.c
  ------------------------
  The driver is standard HW watchdog. Simple conversion is possible.