tspld.c revision 1.8 1 1.8 drochner /* $NetBSD: tspld.c,v 1.8 2005/06/30 17:03:53 drochner Exp $ */
2 1.1 joff
3 1.1 joff /*-
4 1.1 joff * Copyright (c) 2004 Jesse Off
5 1.1 joff * All rights reserved.
6 1.1 joff *
7 1.1 joff * Redistribution and use in source and binary forms, with or without
8 1.1 joff * modification, are permitted provided that the following conditions
9 1.1 joff * are met:
10 1.1 joff * 1. Redistributions of source code must retain the above copyright
11 1.1 joff * notice, this list of conditions and the following disclaimer.
12 1.1 joff * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 joff * notice, this list of conditions and the following disclaimer in the
14 1.1 joff * documentation and/or other materials provided with the distribution.
15 1.1 joff * 3. All advertising materials mentioning features or use of this software
16 1.1 joff * must display the following acknowledgement:
17 1.1 joff * This product includes software developed by the NetBSD
18 1.1 joff * Foundation, Inc. and its contributors.
19 1.1 joff * 4. Neither the name of The NetBSD Foundation nor the names of its
20 1.1 joff * contributors may be used to endorse or promote products derived
21 1.1 joff * from this software without specific prior written permission.
22 1.1 joff *
23 1.1 joff * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24 1.1 joff * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 1.1 joff * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 1.1 joff * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
27 1.1 joff * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 1.1 joff * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 1.1 joff * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 1.1 joff * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 1.1 joff * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 1.1 joff * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 1.1 joff * POSSIBILITY OF SUCH DAMAGE.
34 1.1 joff *
35 1.1 joff */
36 1.1 joff
37 1.1 joff #include <sys/cdefs.h>
38 1.8 drochner __KERNEL_RCSID(0, "$NetBSD: tspld.c,v 1.8 2005/06/30 17:03:53 drochner Exp $");
39 1.1 joff
40 1.1 joff #include <sys/param.h>
41 1.5 joff #include <sys/sysctl.h>
42 1.1 joff #include <sys/systm.h>
43 1.1 joff #include <sys/device.h>
44 1.2 joff #include <sys/wdog.h>
45 1.1 joff
46 1.1 joff #include <machine/bus.h>
47 1.2 joff #include <machine/cpu.h>
48 1.1 joff #include <machine/autoconf.h>
49 1.1 joff #include "isa.h"
50 1.1 joff #if NISA > 0
51 1.1 joff #include <dev/isa/isavar.h>
52 1.1 joff #include <machine/isa_machdep.h>
53 1.1 joff #endif
54 1.1 joff
55 1.1 joff #include <evbarm/tsarm/tsarmreg.h>
56 1.1 joff #include <evbarm/tsarm/tspldvar.h>
57 1.1 joff #include <arm/ep93xx/ep93xxvar.h>
58 1.2 joff #include <arm/arm32/machdep.h>
59 1.2 joff #include <arm/cpufunc.h>
60 1.2 joff #include <dev/sysmon/sysmonvar.h>
61 1.1 joff
62 1.1 joff int tspldmatch __P((struct device *, struct cfdata *, void *));
63 1.1 joff void tspldattach __P((struct device *, struct device *, void *));
64 1.2 joff static int tspld_wdog_setmode __P((struct sysmon_wdog *));
65 1.2 joff static int tspld_wdog_tickle __P((struct sysmon_wdog *));
66 1.8 drochner int tspld_search __P((struct device *, struct cfdata *,
67 1.8 drochner const locdesc_t *, void *));
68 1.3 joff int tspld_print __P((void *, const char *));
69 1.1 joff
70 1.1 joff struct tspld_softc {
71 1.1 joff struct device sc_dev;
72 1.1 joff bus_space_tag_t sc_iot;
73 1.2 joff bus_space_handle_t sc_wdogfeed_ioh;
74 1.2 joff bus_space_handle_t sc_wdogctrl_ioh;
75 1.2 joff struct sysmon_wdog sc_wdog;
76 1.6 he unsigned const char * sc_com2mode;
77 1.6 he unsigned const char * sc_model;
78 1.5 joff unsigned char sc_pldrev[4];
79 1.5 joff uint32_t sc_rs485;
80 1.5 joff uint32_t sc_adc;
81 1.5 joff uint32_t sc_jp[6];
82 1.5 joff uint32_t sc_blaster_present;
83 1.5 joff uint32_t sc_blaster_boot;
84 1.1 joff };
85 1.1 joff
86 1.1 joff CFATTACH_DECL(tspld, sizeof(struct tspld_softc),
87 1.1 joff tspldmatch, tspldattach, NULL, NULL);
88 1.1 joff
89 1.1 joff void tspld_callback __P((struct device *));
90 1.1 joff
91 1.1 joff int
92 1.1 joff tspldmatch(parent, match, aux)
93 1.1 joff struct device *parent;
94 1.1 joff struct cfdata *match;
95 1.1 joff void *aux;
96 1.1 joff {
97 1.1 joff
98 1.1 joff return 1;
99 1.1 joff }
100 1.1 joff
101 1.1 joff void
102 1.1 joff tspldattach(parent, self, aux)
103 1.1 joff struct device *parent, *self;
104 1.1 joff void *aux;
105 1.1 joff {
106 1.1 joff int i, rev, features, jp, model;
107 1.1 joff struct tspld_softc *sc = (struct tspld_softc *)self;
108 1.1 joff bus_space_handle_t ioh;
109 1.7 atatat const struct sysctlnode *node;
110 1.5 joff
111 1.5 joff if (sysctl_createv(NULL, 0, NULL, NULL,
112 1.5 joff CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw",
113 1.5 joff NULL, NULL, 0, NULL, 0,
114 1.5 joff CTL_HW, CTL_EOL) != 0) {
115 1.5 joff printf("%s: could not create sysctl\n",
116 1.5 joff sc->sc_dev.dv_xname);
117 1.5 joff return;
118 1.5 joff }
119 1.5 joff if (sysctl_createv(NULL, 0, NULL, &node,
120 1.5 joff 0, CTLTYPE_NODE, "tspld",
121 1.5 joff NULL,
122 1.5 joff NULL, 0, NULL, 0,
123 1.5 joff CTL_HW, CTL_CREATE, CTL_EOL) != 0) {
124 1.5 joff printf("%s: could not create sysctl\n",
125 1.5 joff sc->sc_dev.dv_xname);
126 1.5 joff return;
127 1.5 joff }
128 1.1 joff
129 1.1 joff sc->sc_iot = &ep93xx_bs_tag;
130 1.1 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_MODEL, 2, 0,
131 1.1 joff &ioh);
132 1.1 joff model = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x7;
133 1.5 joff sc->sc_model = (model ? "TS-7250" : "TS-7200");
134 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
135 1.5 joff 0, CTLTYPE_STRING, "boardmodel",
136 1.5 joff SYSCTL_DESCR("Technologic Systems board model"),
137 1.6 he NULL, 0, __UNCONST(sc->sc_model), 0,
138 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
139 1.5 joff != 0) {
140 1.5 joff printf("%s: could not create sysctl\n",
141 1.5 joff sc->sc_dev.dv_xname);
142 1.5 joff return;
143 1.5 joff }
144 1.1 joff bus_space_unmap(sc->sc_iot, ioh, 2);
145 1.1 joff
146 1.1 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_PLDREV, 2, 0,
147 1.1 joff &ioh);
148 1.1 joff rev = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x7;
149 1.1 joff rev = 'A' + rev - 1;
150 1.5 joff sc->sc_pldrev[0] = rev;
151 1.5 joff sc->sc_pldrev[1] = 0;
152 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
153 1.5 joff 0, CTLTYPE_STRING, "pldrev",
154 1.5 joff SYSCTL_DESCR("CPLD revision"),
155 1.5 joff NULL, 0, sc->sc_pldrev, 0,
156 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
157 1.5 joff != 0) {
158 1.5 joff printf("%s: could not create sysctl\n",
159 1.5 joff sc->sc_dev.dv_xname);
160 1.5 joff return;
161 1.5 joff }
162 1.1 joff bus_space_unmap(sc->sc_iot, ioh, 2);
163 1.1 joff
164 1.1 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_FEATURES, 2, 0,
165 1.1 joff &ioh);
166 1.1 joff features = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x7;
167 1.1 joff bus_space_unmap(sc->sc_iot, ioh, 2);
168 1.1 joff
169 1.1 joff bus_space_map(sc->sc_iot, TS7XXX_IO8_HWBASE + TS7XXX_STATUS1, 1, 0,
170 1.1 joff &ioh);
171 1.1 joff i = bus_space_read_1(sc->sc_iot, ioh, 0) & 0x1f;
172 1.1 joff jp = (~((i & 0x18) >> 1) & 0xc) | (i & 0x3);
173 1.1 joff bus_space_unmap(sc->sc_iot, ioh, 1);
174 1.1 joff
175 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
176 1.5 joff 0, CTLTYPE_INT, "blaster_present",
177 1.5 joff SYSCTL_DESCR("Whether or not a TS-9420/TS-9202 blaster board is connected"),
178 1.5 joff NULL, 0, &sc->sc_blaster_present, 0,
179 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
180 1.5 joff != 0) {
181 1.5 joff printf("%s: could not create sysctl\n",
182 1.5 joff sc->sc_dev.dv_xname);
183 1.5 joff return;
184 1.5 joff }
185 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
186 1.5 joff 0, CTLTYPE_INT, "blaster_boot",
187 1.5 joff SYSCTL_DESCR("Whether or not a blast board was used to boot"),
188 1.5 joff NULL, 0, &sc->sc_blaster_boot, 0,
189 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
190 1.5 joff != 0) {
191 1.5 joff printf("%s: could not create sysctl\n",
192 1.5 joff sc->sc_dev.dv_xname);
193 1.5 joff return;
194 1.5 joff }
195 1.1 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_STATUS2, 2, 0,
196 1.1 joff &ioh);
197 1.1 joff i = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x1;
198 1.5 joff sc->sc_blaster_boot = sc->sc_blaster_present = 0;
199 1.5 joff if (i & 0x2)
200 1.5 joff sc->sc_blaster_boot = 1;
201 1.5 joff if (i & 0x4)
202 1.5 joff sc->sc_blaster_present = 1;
203 1.1 joff jp |= (i << 4);
204 1.1 joff bus_space_unmap(sc->sc_iot, ioh, 1);
205 1.1 joff
206 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
207 1.5 joff 0, CTLTYPE_INT, "rs485_avail",
208 1.5 joff SYSCTL_DESCR("RS485 level driver for COM2 available"),
209 1.5 joff NULL, 0, &sc->sc_rs485, 0,
210 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
211 1.5 joff != 0) {
212 1.5 joff printf("%s: could not create sysctl\n",
213 1.5 joff sc->sc_dev.dv_xname);
214 1.5 joff return;
215 1.5 joff }
216 1.5 joff sc->sc_com2mode = "rs232";
217 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
218 1.5 joff 0, CTLTYPE_STRING, "com2_mode",
219 1.5 joff SYSCTL_DESCR("line driver type for COM2"),
220 1.6 he NULL, 0, __UNCONST(sc->sc_com2mode), 0,
221 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
222 1.5 joff != 0) {
223 1.5 joff printf("%s: could not create sysctl\n",
224 1.5 joff sc->sc_dev.dv_xname);
225 1.5 joff return;
226 1.5 joff }
227 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
228 1.5 joff 0, CTLTYPE_INT, "max197adc_avail",
229 1.5 joff SYSCTL_DESCR("Maxim 197 Analog to Digital Converter available"),
230 1.5 joff NULL, 0, &sc->sc_adc, 0,
231 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
232 1.5 joff != 0) {
233 1.5 joff printf("%s: could not create sysctl\n",
234 1.5 joff sc->sc_dev.dv_xname);
235 1.5 joff return;
236 1.5 joff }
237 1.5 joff printf(": Technologic Systems %s rev %c, features 0x%x",
238 1.5 joff sc->sc_model, rev, features);
239 1.5 joff sc->sc_adc = sc->sc_rs485 = 0;
240 1.5 joff if (features == 0x1) {
241 1.1 joff printf("<MAX197-ADC>");
242 1.5 joff sc->sc_adc = 1;
243 1.5 joff } else if (features == 0x2) {
244 1.1 joff printf("<RS485>");
245 1.5 joff sc->sc_rs485 = 1;
246 1.5 joff } else if (features == 0x3) {
247 1.1 joff printf("<MAX197-ADC,RS485>");
248 1.5 joff sc->sc_adc = sc->sc_rs485 = 1;
249 1.5 joff }
250 1.1 joff printf("\n");
251 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
252 1.5 joff 0, CTLTYPE_INT, "jp1",
253 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
254 1.5 joff NULL, 0, &sc->sc_jp[0], 0,
255 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
256 1.5 joff != 0) {
257 1.5 joff printf("%s: could not create sysctl\n",
258 1.5 joff sc->sc_dev.dv_xname);
259 1.5 joff return;
260 1.5 joff }
261 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
262 1.5 joff 0, CTLTYPE_INT, "jp2",
263 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
264 1.5 joff NULL, 0, &sc->sc_jp[1], 0,
265 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
266 1.5 joff != 0) {
267 1.5 joff printf("%s: could not create sysctl\n",
268 1.5 joff sc->sc_dev.dv_xname);
269 1.5 joff return;
270 1.5 joff }
271 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
272 1.5 joff 0, CTLTYPE_INT, "jp3",
273 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
274 1.5 joff NULL, 0, &sc->sc_jp[2], 0,
275 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
276 1.5 joff != 0) {
277 1.5 joff printf("%s: could not create sysctl\n",
278 1.5 joff sc->sc_dev.dv_xname);
279 1.5 joff return;
280 1.5 joff }
281 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
282 1.5 joff 0, CTLTYPE_INT, "jp4",
283 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
284 1.5 joff NULL, 0, &sc->sc_jp[3], 0,
285 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
286 1.5 joff != 0) {
287 1.5 joff printf("%s: could not create sysctl\n",
288 1.5 joff sc->sc_dev.dv_xname);
289 1.5 joff return;
290 1.5 joff }
291 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
292 1.5 joff 0, CTLTYPE_INT, "jp5",
293 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
294 1.5 joff NULL, 0, &sc->sc_jp[4], 0,
295 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
296 1.5 joff != 0) {
297 1.5 joff printf("%s: could not create sysctl\n",
298 1.5 joff sc->sc_dev.dv_xname);
299 1.5 joff return;
300 1.5 joff }
301 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
302 1.5 joff 0, CTLTYPE_INT, "jp6",
303 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
304 1.5 joff NULL, 0, &sc->sc_jp[5], 0,
305 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
306 1.5 joff != 0) {
307 1.5 joff printf("%s: could not create sysctl\n",
308 1.5 joff sc->sc_dev.dv_xname);
309 1.5 joff return;
310 1.5 joff }
311 1.1 joff printf("%s: jumpers 0x%x", sc->sc_dev.dv_xname, jp);
312 1.1 joff if (jp) {
313 1.1 joff printf("<");
314 1.1 joff for(i = 0; i < 5; i++) {
315 1.1 joff if (jp & (1 << i)) {
316 1.5 joff sc->sc_jp[i + 1] = 1;
317 1.1 joff printf("JP%d", i + 2);
318 1.1 joff jp &= ~(1 << i);
319 1.1 joff if (jp) printf(",");
320 1.5 joff } else {
321 1.5 joff sc->sc_jp[i + 2] = 0;
322 1.1 joff }
323 1.1 joff }
324 1.1 joff printf(">");
325 1.1 joff }
326 1.1 joff printf("\n");
327 1.1 joff
328 1.2 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_WDOGCTRL, 2, 0,
329 1.2 joff &sc->sc_wdogctrl_ioh);
330 1.2 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_WDOGFEED, 2, 0,
331 1.2 joff &sc->sc_wdogfeed_ioh);
332 1.2 joff
333 1.2 joff sc->sc_wdog.smw_name = sc->sc_dev.dv_xname;
334 1.2 joff sc->sc_wdog.smw_cookie = sc;
335 1.2 joff sc->sc_wdog.smw_setmode = tspld_wdog_setmode;
336 1.2 joff sc->sc_wdog.smw_tickle = tspld_wdog_tickle;
337 1.2 joff sc->sc_wdog.smw_period = 8;
338 1.2 joff sysmon_wdog_register(&sc->sc_wdog);
339 1.2 joff tspld_wdog_setmode(&sc->sc_wdog);
340 1.2 joff
341 1.5 joff
342 1.1 joff /* Set the on board peripherals bus callback */
343 1.1 joff config_defer(self, tspld_callback);
344 1.1 joff }
345 1.1 joff
346 1.3 joff int
347 1.8 drochner tspld_search(parent, cf, ldesc, aux)
348 1.3 joff struct device *parent;
349 1.3 joff struct cfdata *cf;
350 1.8 drochner const locdesc_t *ldesc;
351 1.3 joff void *aux;
352 1.3 joff {
353 1.3 joff struct tspld_softc *sc = (struct tspld_softc *)parent;
354 1.3 joff struct tspld_attach_args sa;
355 1.3 joff
356 1.3 joff sa.ta_iot = sc->sc_iot;
357 1.3 joff
358 1.3 joff if (config_match(parent, cf, &sa) > 0)
359 1.3 joff config_attach(parent, cf, &sa, tspld_print);
360 1.3 joff
361 1.3 joff return (0);
362 1.3 joff }
363 1.3 joff
364 1.3 joff int
365 1.3 joff tspld_print(aux, name)
366 1.3 joff void *aux;
367 1.3 joff const char *name;
368 1.3 joff {
369 1.3 joff
370 1.3 joff return (UNCONF);
371 1.3 joff }
372 1.3 joff
373 1.1 joff void
374 1.1 joff tspld_callback(self)
375 1.1 joff struct device *self;
376 1.1 joff {
377 1.1 joff #if NISA > 0
378 1.4 joff extern void isa_bs_mallocok(void);
379 1.1 joff struct isabus_attach_args iba;
380 1.1 joff
381 1.1 joff /*
382 1.1 joff * Attach the ISA bus behind this bridge.
383 1.1 joff */
384 1.1 joff memset(&iba, 0, sizeof(iba));
385 1.1 joff iba.iba_iot = &isa_io_bs_tag;
386 1.1 joff iba.iba_memt = &isa_mem_bs_tag;
387 1.4 joff isa_bs_mallocok();
388 1.1 joff config_found_ia(self, "isabus", &iba, isabusprint);
389 1.1 joff #endif
390 1.3 joff /*
391 1.3 joff * Attach each devices
392 1.3 joff */
393 1.8 drochner config_search_ia(tspld_search, self, "tspldbus", NULL);
394 1.3 joff
395 1.1 joff }
396 1.2 joff
397 1.2 joff static int
398 1.2 joff tspld_wdog_tickle(smw)
399 1.2 joff struct sysmon_wdog *smw;
400 1.2 joff {
401 1.2 joff struct tspld_softc *sc = (struct tspld_softc *)smw->smw_cookie;
402 1.2 joff
403 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogfeed_ioh, 0, 0x5);
404 1.2 joff return 0;
405 1.2 joff }
406 1.2 joff
407 1.2 joff static int
408 1.2 joff tspld_wdog_setmode(smw)
409 1.2 joff struct sysmon_wdog *smw;
410 1.2 joff {
411 1.2 joff int i, ret = 0;
412 1.2 joff struct tspld_softc *sc = (struct tspld_softc *)smw->smw_cookie;
413 1.2 joff
414 1.2 joff i = disable_interrupts(I32_bit|F32_bit);
415 1.2 joff if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) {
416 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogfeed_ioh, 0, 0x5);
417 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0, 0);
418 1.2 joff } else {
419 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogfeed_ioh, 0, 0x5);
420 1.2 joff switch (smw->smw_period) {
421 1.2 joff case 1:
422 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
423 1.2 joff 0x3);
424 1.2 joff break;
425 1.2 joff case 2:
426 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
427 1.2 joff 0x5);
428 1.2 joff break;
429 1.2 joff case 4:
430 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
431 1.2 joff 0x6);
432 1.2 joff break;
433 1.2 joff case 8:
434 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
435 1.2 joff 0x7);
436 1.2 joff break;
437 1.2 joff default:
438 1.2 joff ret = EINVAL;
439 1.2 joff }
440 1.2 joff }
441 1.2 joff restore_interrupts(i);
442 1.2 joff return ret;
443 1.2 joff }
444