summaryrefslogtreecommitdiff
path: root/doc/driver-model/UDM-watchdog.txt
blob: 3f130635dc201ec6f044c3c51c48ae18f0112a8a (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
--------------------------------

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


  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.


  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.


  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.


  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.


  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.


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


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


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


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


  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.


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


  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.


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


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


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