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