tspld.c revision 1.6 1 1.6 he /* $NetBSD: tspld.c,v 1.6 2005/06/04 22:40:03 he 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.6 he __KERNEL_RCSID(0, "$NetBSD: tspld.c,v 1.6 2005/06/04 22:40:03 he 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.3 joff int tspld_search __P((struct device *, struct cfdata *, void *));
67 1.3 joff int tspld_print __P((void *, const char *));
68 1.1 joff
69 1.1 joff struct tspld_softc {
70 1.1 joff struct device sc_dev;
71 1.1 joff bus_space_tag_t sc_iot;
72 1.2 joff bus_space_handle_t sc_wdogfeed_ioh;
73 1.2 joff bus_space_handle_t sc_wdogctrl_ioh;
74 1.2 joff struct sysmon_wdog sc_wdog;
75 1.6 he unsigned const char * sc_com2mode;
76 1.6 he unsigned const char * sc_model;
77 1.5 joff unsigned char sc_pldrev[4];
78 1.5 joff uint32_t sc_rs485;
79 1.5 joff uint32_t sc_adc;
80 1.5 joff uint32_t sc_jp[6];
81 1.5 joff uint32_t sc_blaster_present;
82 1.5 joff uint32_t sc_blaster_boot;
83 1.1 joff };
84 1.1 joff
85 1.1 joff CFATTACH_DECL(tspld, sizeof(struct tspld_softc),
86 1.1 joff tspldmatch, tspldattach, NULL, NULL);
87 1.1 joff
88 1.1 joff void tspld_callback __P((struct device *));
89 1.1 joff
90 1.1 joff int
91 1.1 joff tspldmatch(parent, match, aux)
92 1.1 joff struct device *parent;
93 1.1 joff struct cfdata *match;
94 1.1 joff void *aux;
95 1.1 joff {
96 1.1 joff
97 1.1 joff return 1;
98 1.1 joff }
99 1.1 joff
100 1.1 joff void
101 1.1 joff tspldattach(parent, self, aux)
102 1.1 joff struct device *parent, *self;
103 1.1 joff void *aux;
104 1.1 joff {
105 1.1 joff int i, rev, features, jp, model;
106 1.1 joff struct tspld_softc *sc = (struct tspld_softc *)self;
107 1.1 joff bus_space_handle_t ioh;
108 1.5 joff struct sysctlnode *node;
109 1.5 joff
110 1.5 joff if (sysctl_createv(NULL, 0, NULL, NULL,
111 1.5 joff CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw",
112 1.5 joff NULL, NULL, 0, NULL, 0,
113 1.5 joff CTL_HW, CTL_EOL) != 0) {
114 1.5 joff printf("%s: could not create sysctl\n",
115 1.5 joff sc->sc_dev.dv_xname);
116 1.5 joff return;
117 1.5 joff }
118 1.5 joff if (sysctl_createv(NULL, 0, NULL, &node,
119 1.5 joff 0, CTLTYPE_NODE, "tspld",
120 1.5 joff NULL,
121 1.5 joff NULL, 0, NULL, 0,
122 1.5 joff CTL_HW, CTL_CREATE, CTL_EOL) != 0) {
123 1.5 joff printf("%s: could not create sysctl\n",
124 1.5 joff sc->sc_dev.dv_xname);
125 1.5 joff return;
126 1.5 joff }
127 1.1 joff
128 1.1 joff sc->sc_iot = &ep93xx_bs_tag;
129 1.1 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_MODEL, 2, 0,
130 1.1 joff &ioh);
131 1.1 joff model = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x7;
132 1.5 joff sc->sc_model = (model ? "TS-7250" : "TS-7200");
133 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
134 1.5 joff 0, CTLTYPE_STRING, "boardmodel",
135 1.5 joff SYSCTL_DESCR("Technologic Systems board model"),
136 1.6 he NULL, 0, __UNCONST(sc->sc_model), 0,
137 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
138 1.5 joff != 0) {
139 1.5 joff printf("%s: could not create sysctl\n",
140 1.5 joff sc->sc_dev.dv_xname);
141 1.5 joff return;
142 1.5 joff }
143 1.1 joff bus_space_unmap(sc->sc_iot, ioh, 2);
144 1.1 joff
145 1.1 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_PLDREV, 2, 0,
146 1.1 joff &ioh);
147 1.1 joff rev = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x7;
148 1.1 joff rev = 'A' + rev - 1;
149 1.5 joff sc->sc_pldrev[0] = rev;
150 1.5 joff sc->sc_pldrev[1] = 0;
151 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
152 1.5 joff 0, CTLTYPE_STRING, "pldrev",
153 1.5 joff SYSCTL_DESCR("CPLD revision"),
154 1.5 joff NULL, 0, sc->sc_pldrev, 0,
155 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
156 1.5 joff != 0) {
157 1.5 joff printf("%s: could not create sysctl\n",
158 1.5 joff sc->sc_dev.dv_xname);
159 1.5 joff return;
160 1.5 joff }
161 1.1 joff bus_space_unmap(sc->sc_iot, ioh, 2);
162 1.1 joff
163 1.1 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_FEATURES, 2, 0,
164 1.1 joff &ioh);
165 1.1 joff features = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x7;
166 1.1 joff bus_space_unmap(sc->sc_iot, ioh, 2);
167 1.1 joff
168 1.1 joff bus_space_map(sc->sc_iot, TS7XXX_IO8_HWBASE + TS7XXX_STATUS1, 1, 0,
169 1.1 joff &ioh);
170 1.1 joff i = bus_space_read_1(sc->sc_iot, ioh, 0) & 0x1f;
171 1.1 joff jp = (~((i & 0x18) >> 1) & 0xc) | (i & 0x3);
172 1.1 joff bus_space_unmap(sc->sc_iot, ioh, 1);
173 1.1 joff
174 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
175 1.5 joff 0, CTLTYPE_INT, "blaster_present",
176 1.5 joff SYSCTL_DESCR("Whether or not a TS-9420/TS-9202 blaster board is connected"),
177 1.5 joff NULL, 0, &sc->sc_blaster_present, 0,
178 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
179 1.5 joff != 0) {
180 1.5 joff printf("%s: could not create sysctl\n",
181 1.5 joff sc->sc_dev.dv_xname);
182 1.5 joff return;
183 1.5 joff }
184 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
185 1.5 joff 0, CTLTYPE_INT, "blaster_boot",
186 1.5 joff SYSCTL_DESCR("Whether or not a blast board was used to boot"),
187 1.5 joff NULL, 0, &sc->sc_blaster_boot, 0,
188 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
189 1.5 joff != 0) {
190 1.5 joff printf("%s: could not create sysctl\n",
191 1.5 joff sc->sc_dev.dv_xname);
192 1.5 joff return;
193 1.5 joff }
194 1.1 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_STATUS2, 2, 0,
195 1.1 joff &ioh);
196 1.1 joff i = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x1;
197 1.5 joff sc->sc_blaster_boot = sc->sc_blaster_present = 0;
198 1.5 joff if (i & 0x2)
199 1.5 joff sc->sc_blaster_boot = 1;
200 1.5 joff if (i & 0x4)
201 1.5 joff sc->sc_blaster_present = 1;
202 1.1 joff jp |= (i << 4);
203 1.1 joff bus_space_unmap(sc->sc_iot, ioh, 1);
204 1.1 joff
205 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
206 1.5 joff 0, CTLTYPE_INT, "rs485_avail",
207 1.5 joff SYSCTL_DESCR("RS485 level driver for COM2 available"),
208 1.5 joff NULL, 0, &sc->sc_rs485, 0,
209 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
210 1.5 joff != 0) {
211 1.5 joff printf("%s: could not create sysctl\n",
212 1.5 joff sc->sc_dev.dv_xname);
213 1.5 joff return;
214 1.5 joff }
215 1.5 joff sc->sc_com2mode = "rs232";
216 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
217 1.5 joff 0, CTLTYPE_STRING, "com2_mode",
218 1.5 joff SYSCTL_DESCR("line driver type for COM2"),
219 1.6 he NULL, 0, __UNCONST(sc->sc_com2mode), 0,
220 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
221 1.5 joff != 0) {
222 1.5 joff printf("%s: could not create sysctl\n",
223 1.5 joff sc->sc_dev.dv_xname);
224 1.5 joff return;
225 1.5 joff }
226 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
227 1.5 joff 0, CTLTYPE_INT, "max197adc_avail",
228 1.5 joff SYSCTL_DESCR("Maxim 197 Analog to Digital Converter available"),
229 1.5 joff NULL, 0, &sc->sc_adc, 0,
230 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
231 1.5 joff != 0) {
232 1.5 joff printf("%s: could not create sysctl\n",
233 1.5 joff sc->sc_dev.dv_xname);
234 1.5 joff return;
235 1.5 joff }
236 1.5 joff printf(": Technologic Systems %s rev %c, features 0x%x",
237 1.5 joff sc->sc_model, rev, features);
238 1.5 joff sc->sc_adc = sc->sc_rs485 = 0;
239 1.5 joff if (features == 0x1) {
240 1.1 joff printf("<MAX197-ADC>");
241 1.5 joff sc->sc_adc = 1;
242 1.5 joff } else if (features == 0x2) {
243 1.1 joff printf("<RS485>");
244 1.5 joff sc->sc_rs485 = 1;
245 1.5 joff } else if (features == 0x3) {
246 1.1 joff printf("<MAX197-ADC,RS485>");
247 1.5 joff sc->sc_adc = sc->sc_rs485 = 1;
248 1.5 joff }
249 1.1 joff printf("\n");
250 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
251 1.5 joff 0, CTLTYPE_INT, "jp1",
252 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
253 1.5 joff NULL, 0, &sc->sc_jp[0], 0,
254 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
255 1.5 joff != 0) {
256 1.5 joff printf("%s: could not create sysctl\n",
257 1.5 joff sc->sc_dev.dv_xname);
258 1.5 joff return;
259 1.5 joff }
260 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
261 1.5 joff 0, CTLTYPE_INT, "jp2",
262 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
263 1.5 joff NULL, 0, &sc->sc_jp[1], 0,
264 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
265 1.5 joff != 0) {
266 1.5 joff printf("%s: could not create sysctl\n",
267 1.5 joff sc->sc_dev.dv_xname);
268 1.5 joff return;
269 1.5 joff }
270 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
271 1.5 joff 0, CTLTYPE_INT, "jp3",
272 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
273 1.5 joff NULL, 0, &sc->sc_jp[2], 0,
274 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
275 1.5 joff != 0) {
276 1.5 joff printf("%s: could not create sysctl\n",
277 1.5 joff sc->sc_dev.dv_xname);
278 1.5 joff return;
279 1.5 joff }
280 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
281 1.5 joff 0, CTLTYPE_INT, "jp4",
282 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
283 1.5 joff NULL, 0, &sc->sc_jp[3], 0,
284 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
285 1.5 joff != 0) {
286 1.5 joff printf("%s: could not create sysctl\n",
287 1.5 joff sc->sc_dev.dv_xname);
288 1.5 joff return;
289 1.5 joff }
290 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
291 1.5 joff 0, CTLTYPE_INT, "jp5",
292 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
293 1.5 joff NULL, 0, &sc->sc_jp[4], 0,
294 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
295 1.5 joff != 0) {
296 1.5 joff printf("%s: could not create sysctl\n",
297 1.5 joff sc->sc_dev.dv_xname);
298 1.5 joff return;
299 1.5 joff }
300 1.5 joff if ((i = sysctl_createv(NULL, 0, NULL, NULL,
301 1.5 joff 0, CTLTYPE_INT, "jp6",
302 1.5 joff SYSCTL_DESCR("onboard jumper setting"),
303 1.5 joff NULL, 0, &sc->sc_jp[5], 0,
304 1.5 joff CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
305 1.5 joff != 0) {
306 1.5 joff printf("%s: could not create sysctl\n",
307 1.5 joff sc->sc_dev.dv_xname);
308 1.5 joff return;
309 1.5 joff }
310 1.1 joff printf("%s: jumpers 0x%x", sc->sc_dev.dv_xname, jp);
311 1.1 joff if (jp) {
312 1.1 joff printf("<");
313 1.1 joff for(i = 0; i < 5; i++) {
314 1.1 joff if (jp & (1 << i)) {
315 1.5 joff sc->sc_jp[i + 1] = 1;
316 1.1 joff printf("JP%d", i + 2);
317 1.1 joff jp &= ~(1 << i);
318 1.1 joff if (jp) printf(",");
319 1.5 joff } else {
320 1.5 joff sc->sc_jp[i + 2] = 0;
321 1.1 joff }
322 1.1 joff }
323 1.1 joff printf(">");
324 1.1 joff }
325 1.1 joff printf("\n");
326 1.1 joff
327 1.2 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_WDOGCTRL, 2, 0,
328 1.2 joff &sc->sc_wdogctrl_ioh);
329 1.2 joff bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_WDOGFEED, 2, 0,
330 1.2 joff &sc->sc_wdogfeed_ioh);
331 1.2 joff
332 1.2 joff sc->sc_wdog.smw_name = sc->sc_dev.dv_xname;
333 1.2 joff sc->sc_wdog.smw_cookie = sc;
334 1.2 joff sc->sc_wdog.smw_setmode = tspld_wdog_setmode;
335 1.2 joff sc->sc_wdog.smw_tickle = tspld_wdog_tickle;
336 1.2 joff sc->sc_wdog.smw_period = 8;
337 1.2 joff sysmon_wdog_register(&sc->sc_wdog);
338 1.2 joff tspld_wdog_setmode(&sc->sc_wdog);
339 1.2 joff
340 1.5 joff
341 1.1 joff /* Set the on board peripherals bus callback */
342 1.1 joff config_defer(self, tspld_callback);
343 1.1 joff }
344 1.1 joff
345 1.3 joff int
346 1.3 joff tspld_search(parent, cf, aux)
347 1.3 joff struct device *parent;
348 1.3 joff struct cfdata *cf;
349 1.3 joff void *aux;
350 1.3 joff {
351 1.3 joff struct tspld_softc *sc = (struct tspld_softc *)parent;
352 1.3 joff struct tspld_attach_args sa;
353 1.3 joff
354 1.3 joff sa.ta_iot = sc->sc_iot;
355 1.3 joff
356 1.3 joff if (config_match(parent, cf, &sa) > 0)
357 1.3 joff config_attach(parent, cf, &sa, tspld_print);
358 1.3 joff
359 1.3 joff return (0);
360 1.3 joff }
361 1.3 joff
362 1.3 joff int
363 1.3 joff tspld_print(aux, name)
364 1.3 joff void *aux;
365 1.3 joff const char *name;
366 1.3 joff {
367 1.3 joff
368 1.3 joff return (UNCONF);
369 1.3 joff }
370 1.3 joff
371 1.1 joff void
372 1.1 joff tspld_callback(self)
373 1.1 joff struct device *self;
374 1.1 joff {
375 1.1 joff #if NISA > 0
376 1.4 joff extern void isa_bs_mallocok(void);
377 1.1 joff struct isabus_attach_args iba;
378 1.1 joff
379 1.1 joff /*
380 1.1 joff * Attach the ISA bus behind this bridge.
381 1.1 joff */
382 1.1 joff memset(&iba, 0, sizeof(iba));
383 1.1 joff iba.iba_iot = &isa_io_bs_tag;
384 1.1 joff iba.iba_memt = &isa_mem_bs_tag;
385 1.4 joff isa_bs_mallocok();
386 1.1 joff config_found_ia(self, "isabus", &iba, isabusprint);
387 1.1 joff #endif
388 1.3 joff /*
389 1.3 joff * Attach each devices
390 1.3 joff */
391 1.3 joff config_search(tspld_search, self, NULL);
392 1.3 joff
393 1.1 joff }
394 1.2 joff
395 1.2 joff static int
396 1.2 joff tspld_wdog_tickle(smw)
397 1.2 joff struct sysmon_wdog *smw;
398 1.2 joff {
399 1.2 joff struct tspld_softc *sc = (struct tspld_softc *)smw->smw_cookie;
400 1.2 joff
401 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogfeed_ioh, 0, 0x5);
402 1.2 joff return 0;
403 1.2 joff }
404 1.2 joff
405 1.2 joff static int
406 1.2 joff tspld_wdog_setmode(smw)
407 1.2 joff struct sysmon_wdog *smw;
408 1.2 joff {
409 1.2 joff int i, ret = 0;
410 1.2 joff struct tspld_softc *sc = (struct tspld_softc *)smw->smw_cookie;
411 1.2 joff
412 1.2 joff i = disable_interrupts(I32_bit|F32_bit);
413 1.2 joff if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) {
414 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogfeed_ioh, 0, 0x5);
415 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0, 0);
416 1.2 joff } else {
417 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogfeed_ioh, 0, 0x5);
418 1.2 joff switch (smw->smw_period) {
419 1.2 joff case 1:
420 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
421 1.2 joff 0x3);
422 1.2 joff break;
423 1.2 joff case 2:
424 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
425 1.2 joff 0x5);
426 1.2 joff break;
427 1.2 joff case 4:
428 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
429 1.2 joff 0x6);
430 1.2 joff break;
431 1.2 joff case 8:
432 1.2 joff bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
433 1.2 joff 0x7);
434 1.2 joff break;
435 1.2 joff default:
436 1.2 joff ret = EINVAL;
437 1.2 joff }
438 1.2 joff }
439 1.2 joff restore_interrupts(i);
440 1.2 joff return ret;
441 1.2 joff }
442