Home | History | Annotate | Line # | Download | only in tsarm
tspld.c revision 1.18
      1 /*	$NetBSD: tspld.c,v 1.18 2009/03/14 15:36:05 dsl 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.18 2009/03/14 15:36:05 dsl 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/ep93xx/epgpioreg.h>
     62 #include <arm/arm32/machdep.h>
     63 #include <arm/cpufunc.h>
     64 #include <dev/sysmon/sysmonvar.h>
     65 
     66 int	tspldmatch (struct device *, struct cfdata *, void *);
     67 void	tspldattach (struct device *, struct device *, void *);
     68 static int	tspld_wdog_setmode (struct sysmon_wdog *);
     69 static int	tspld_wdog_tickle (struct sysmon_wdog *);
     70 int tspld_search (struct device *, struct cfdata *, const int *, void *);
     71 int tspld_print (void *, const char *);
     72 void boardtemp_poll (void *);
     73 
     74 struct tspld_softc {
     75         struct device           sc_dev;
     76         bus_space_tag_t         sc_iot;
     77 	bus_space_handle_t	sc_wdogfeed_ioh;
     78 	bus_space_handle_t	sc_wdogctrl_ioh;
     79 	struct sysmon_wdog	sc_wdog;
     80 	bus_space_handle_t	sc_ssph;
     81 	bus_space_handle_t	sc_gpioh;
     82 	unsigned const char *	sc_com2mode;
     83 	unsigned const char *	sc_model;
     84 	unsigned char		sc_pldrev[4];
     85 	uint32_t		sc_rs485;
     86 	uint32_t		sc_adc;
     87 	uint32_t		sc_jp[6];
     88 	uint32_t		sc_blaster_present;
     89 	uint32_t		sc_blaster_boot;
     90 	uint32_t		boardtemp;
     91 	uint32_t		boardtemp_5s;
     92 	uint32_t		boardtemp_30s;
     93 	struct callout		boardtemp_callout;
     94 };
     95 
     96 CFATTACH_DECL(tspld, sizeof(struct tspld_softc),
     97     tspldmatch, tspldattach, NULL, NULL);
     98 
     99 void	tspld_callback(struct device *);
    100 
    101 #define GPIO_GET(x)	bus_space_read_4(sc->sc_iot, sc->sc_gpioh, \
    102 	(EP93XX_GPIO_ ## x))
    103 
    104 #define GPIO_SET(x, y)	bus_space_write_4(sc->sc_iot, sc->sc_gpioh, \
    105 	(EP93XX_GPIO_ ## x), (y))
    106 
    107 #define GPIO_SETBITS(x, y)	bus_space_write_4(sc->sc_iot, sc->sc_gpioh, \
    108 	(EP93XX_GPIO_ ## x), GPIO_GET(x) | (y))
    109 
    110 #define GPIO_CLEARBITS(x, y)	bus_space_write_4(sc->sc_iot, sc->sc_gpioh, \
    111 	(EP93XX_GPIO_ ## x), GPIO_GET(x) & (~(y)))
    112 
    113 #define SSP_GET(x)	bus_space_read_4(sc->sc_iot, sc->sc_ssph, \
    114 	(EP93XX_SSP_ ## x))
    115 
    116 #define SSP_SET(x, y)	bus_space_write_4(sc->sc_iot, sc->sc_ssph, \
    117 	(EP93XX_SSP_ ## x), (y))
    118 
    119 #define SSP_SETBITS(x, y)	bus_space_write_4(sc->sc_iot, sc->sc_ssph, \
    120 	(EP93XX_SSP_ ## x), SSP_GET(x) | (y))
    121 
    122 #define SSP_CLEARBITS(x, y)	bus_space_write_4(sc->sc_iot, sc->sc_ssph, \
    123 	(EP93XX_SSP_ ## x), SSP_GET(x) & (~(y)))
    124 
    125 int
    126 tspldmatch(struct device *parent, struct cfdata *match, void *aux)
    127 {
    128 
    129 	return 1;
    130 }
    131 
    132 void
    133 boardtemp_poll(void *arg)
    134 {
    135 	struct tspld_softc *sc = arg;
    136 	u_int16_t val;
    137 
    138 	/* Disable chip select */
    139 	GPIO_SET(PFDDR, 0x0);
    140 
    141 	val = SSP_GET(SSPDR) & 0xffff;
    142 	sc->boardtemp = ((int16_t)val >> 3) * 62500;
    143 	sc->boardtemp_5s = sc->boardtemp_5s / 20 * 19 + sc->boardtemp / 20;
    144 	sc->boardtemp_30s = sc->boardtemp_30s / 120 * 119 + sc->boardtemp / 120;
    145 
    146 	callout_schedule(&sc->boardtemp_callout, hz / 4);
    147 
    148 	/* Enable chip select */
    149 	GPIO_SET(PFDDR, 0x4);
    150 
    151 	/* Send read command */
    152 	SSP_SET(SSPDR, 0x8000);
    153 }
    154 
    155 void
    156 tspldattach(parent, self, aux)
    157 	struct device *parent, *self;
    158 	void *aux;
    159 {
    160 	int	i, rev, features, jp, model;
    161 	struct tspld_softc *sc = (struct tspld_softc *)self;
    162 	bus_space_handle_t 	ioh;
    163         const struct sysctlnode *node;
    164 
    165 	if (sysctl_createv(NULL, 0, NULL, NULL,
    166 				CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw",
    167 				NULL, NULL, 0, NULL, 0,
    168 				CTL_HW, CTL_EOL) != 0) {
    169 		printf("%s: could not create sysctl\n",
    170 			sc->sc_dev.dv_xname);
    171 		return;
    172 	}
    173 	if (sysctl_createv(NULL, 0, NULL, &node,
    174         			0, CTLTYPE_NODE, sc->sc_dev.dv_xname,
    175         			NULL,
    176         			NULL, 0, NULL, 0,
    177 				CTL_HW, CTL_CREATE, CTL_EOL) != 0) {
    178                 printf("%s: could not create sysctl\n",
    179 			sc->sc_dev.dv_xname);
    180 		return;
    181 	}
    182 
    183 	sc->sc_iot = &ep93xx_bs_tag;
    184 	bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_MODEL, 2, 0,
    185 		&ioh);
    186 	model = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x7;
    187 	sc->sc_model = (model ? "TS-7250" : "TS-7200");
    188 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    189         			0, CTLTYPE_STRING, "boardmodel",
    190         			SYSCTL_DESCR("Technologic Systems board model"),
    191         			NULL, 0, __UNCONST(sc->sc_model), 0,
    192 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    193 				!= 0) {
    194                 printf("%s: could not create sysctl\n",
    195 			sc->sc_dev.dv_xname);
    196 		return;
    197 	}
    198 	bus_space_unmap(sc->sc_iot, ioh, 2);
    199 
    200 	bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_PLDREV, 2, 0,
    201 		&ioh);
    202 	rev = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x7;
    203 	rev = 'A' + rev - 1;
    204 	sc->sc_pldrev[0] = rev;
    205 	sc->sc_pldrev[1] = 0;
    206 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    207         			0, CTLTYPE_STRING, "pldrev",
    208         			SYSCTL_DESCR("CPLD revision"),
    209         			NULL, 0, sc->sc_pldrev, 0,
    210 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    211 				!= 0) {
    212                 printf("%s: could not create sysctl\n",
    213 			sc->sc_dev.dv_xname);
    214 		return;
    215 	}
    216 	bus_space_unmap(sc->sc_iot, ioh, 2);
    217 
    218 	bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_FEATURES, 2, 0,
    219 		&ioh);
    220 	features = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x7;
    221 	bus_space_unmap(sc->sc_iot, ioh, 2);
    222 
    223         bus_space_map(sc->sc_iot, TS7XXX_IO8_HWBASE + TS7XXX_STATUS1, 1, 0,
    224 		&ioh);
    225 	i = bus_space_read_1(sc->sc_iot, ioh, 0) & 0x1f;
    226 	jp = (~((i & 0x18) >> 1) & 0xc) | (i & 0x3);
    227 	bus_space_unmap(sc->sc_iot, ioh, 1);
    228 
    229 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    230         			0, CTLTYPE_INT, "blaster_present",
    231         			SYSCTL_DESCR("Whether or not a TS-9420/TS-9202 blaster board is connected"),
    232         			NULL, 0, &sc->sc_blaster_present, 0,
    233 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    234 				!= 0) {
    235                 printf("%s: could not create sysctl\n",
    236 			sc->sc_dev.dv_xname);
    237 		return;
    238 	}
    239 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    240         			0, CTLTYPE_INT, "blaster_boot",
    241         			SYSCTL_DESCR("Whether or not a blast board was used to boot"),
    242         			NULL, 0, &sc->sc_blaster_boot, 0,
    243 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    244 				!= 0) {
    245                 printf("%s: could not create sysctl\n",
    246 			sc->sc_dev.dv_xname);
    247 		return;
    248 	}
    249         bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_STATUS2, 2, 0,
    250 		&ioh);
    251 	i = bus_space_read_2(sc->sc_iot, ioh, 0) & 0x6;
    252 	sc->sc_blaster_boot = sc->sc_blaster_present = 0;
    253 	if (i & 0x2)
    254 		sc->sc_blaster_boot = 1;
    255 	if (i & 0x4)
    256 		sc->sc_blaster_present = 1;
    257 	jp |= (i << 4);
    258 	bus_space_unmap(sc->sc_iot, ioh, 1);
    259 
    260 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    261         			0, CTLTYPE_INT, "rs485_avail",
    262         			SYSCTL_DESCR("RS485 level driver for COM2 available"),
    263         			NULL, 0, &sc->sc_rs485, 0,
    264 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    265 				!= 0) {
    266                 printf("%s: could not create sysctl\n",
    267 			sc->sc_dev.dv_xname);
    268 		return;
    269 	}
    270 	sc->sc_com2mode = "rs232";
    271 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    272         			0, CTLTYPE_STRING, "com2_mode",
    273         			SYSCTL_DESCR("line driver type for COM2"),
    274         			NULL, 0, __UNCONST(sc->sc_com2mode), 0,
    275 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    276 				!= 0) {
    277                 printf("%s: could not create sysctl\n",
    278 			sc->sc_dev.dv_xname);
    279 		return;
    280 	}
    281 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    282         			0, CTLTYPE_INT, "max197adc_avail",
    283         			SYSCTL_DESCR("Maxim 197 Analog to Digital Converter available"),
    284         			NULL, 0, &sc->sc_adc, 0,
    285 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    286 				!= 0) {
    287                 printf("%s: could not create sysctl\n",
    288 			sc->sc_dev.dv_xname);
    289 		return;
    290 	}
    291 	printf(": Technologic Systems %s rev %c, features 0x%x",
    292 		sc->sc_model, rev, features);
    293 	sc->sc_adc = sc->sc_rs485 = 0;
    294 	if (features == 0x1) {
    295 		printf("<MAX197-ADC>");
    296 		sc->sc_adc = 1;
    297 	} else if (features == 0x2) {
    298 		printf("<RS485>");
    299 		sc->sc_rs485 = 1;
    300 	} else if (features == 0x3) {
    301 		printf("<MAX197-ADC,RS485>");
    302 		sc->sc_adc = sc->sc_rs485 = 1;
    303 	}
    304 	printf("\n");
    305 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    306         			0, CTLTYPE_INT, "jp1",
    307         			SYSCTL_DESCR("onboard jumper setting"),
    308         			NULL, 0, &sc->sc_jp[0], 0,
    309 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    310 				!= 0) {
    311                 printf("%s: could not create sysctl\n",
    312 			sc->sc_dev.dv_xname);
    313 		return;
    314 	}
    315 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    316         			0, CTLTYPE_INT, "jp2",
    317         			SYSCTL_DESCR("onboard jumper setting"),
    318         			NULL, 0, &sc->sc_jp[1], 0,
    319 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    320 				!= 0) {
    321                 printf("%s: could not create sysctl\n",
    322 			sc->sc_dev.dv_xname);
    323 		return;
    324 	}
    325 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    326         			0, CTLTYPE_INT, "jp3",
    327         			SYSCTL_DESCR("onboard jumper setting"),
    328         			NULL, 0, &sc->sc_jp[2], 0,
    329 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    330 				!= 0) {
    331                 printf("%s: could not create sysctl\n",
    332 			sc->sc_dev.dv_xname);
    333 		return;
    334 	}
    335 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    336         			0, CTLTYPE_INT, "jp4",
    337         			SYSCTL_DESCR("onboard jumper setting"),
    338         			NULL, 0, &sc->sc_jp[3], 0,
    339 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    340 				!= 0) {
    341                 printf("%s: could not create sysctl\n",
    342 			sc->sc_dev.dv_xname);
    343 		return;
    344 	}
    345 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    346         			0, CTLTYPE_INT, "jp5",
    347         			SYSCTL_DESCR("onboard jumper setting"),
    348         			NULL, 0, &sc->sc_jp[4], 0,
    349 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    350 				!= 0) {
    351                 printf("%s: could not create sysctl\n",
    352 			sc->sc_dev.dv_xname);
    353 		return;
    354 	}
    355 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    356         			0, CTLTYPE_INT, "jp6",
    357         			SYSCTL_DESCR("onboard jumper setting"),
    358         			NULL, 0, &sc->sc_jp[5], 0,
    359 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    360 				!= 0) {
    361                 printf("%s: could not create sysctl\n",
    362 			sc->sc_dev.dv_xname);
    363 		return;
    364 	}
    365 	printf("%s: jumpers 0x%x", sc->sc_dev.dv_xname, jp);
    366 	if (jp) {
    367 		printf("<");
    368 		for(i = 0; i < 5; i++) {
    369 			if (jp & (1 << i)) {
    370 				sc->sc_jp[i + 1] = 1;
    371 				printf("JP%d", i + 2);
    372 				jp &= ~(1 << i);
    373 				if (jp) printf(",");
    374 			} else {
    375 				sc->sc_jp[i + 2] = 0;
    376 			}
    377 		}
    378 		printf(">");
    379 	}
    380 	printf("\n");
    381 
    382 
    383         bus_space_map(sc->sc_iot, EP93XX_APB_HWBASE + EP93XX_APB_SSP,
    384 		EP93XX_APB_SSP_SIZE, 0, &sc->sc_ssph);
    385         bus_space_map(sc->sc_iot, EP93XX_APB_HWBASE + EP93XX_APB_GPIO,
    386 		EP93XX_APB_GPIO_SIZE, 0, &sc->sc_gpioh);
    387 	SSP_SETBITS(SSPCR1, 0x10);
    388 	SSP_SET(SSPCR0, 0xf);
    389 	SSP_SET(SSPCPSR, 0xfe);
    390 	SSP_CLEARBITS(SSPCR1, 0x10);
    391 	SSP_SETBITS(SSPCR1, 0x10);
    392 	GPIO_SET(PFDR, 0x0);
    393 	callout_init(&sc->boardtemp_callout, 0);
    394 	callout_setfunc(&sc->boardtemp_callout, boardtemp_poll, sc);
    395 	boardtemp_poll(sc);
    396 	delay(1000);
    397 	boardtemp_poll(sc);
    398 	sc->boardtemp_5s = sc->boardtemp_30s = sc->boardtemp;
    399 #define DEGF(c)	((c) * 9 / 5 + 32000000)
    400 	printf("%s: board temperature %d.%02d degC (%d.%02d degF)\n",
    401 		sc->sc_dev.dv_xname,
    402 		sc->boardtemp / 1000000, sc->boardtemp / 10000 % 100,
    403 		DEGF(sc->boardtemp) / 1000000, DEGF(sc->boardtemp) / 10000 % 100);
    404 #undef DEGF
    405 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    406         			0, CTLTYPE_INT, "board_temp",
    407         			SYSCTL_DESCR("board temperature in micro degrees Celsius"),
    408         			NULL, 0, &sc->boardtemp, 0,
    409 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    410 				!= 0) {
    411                 printf("%s: could not create sysctl\n",
    412 			sc->sc_dev.dv_xname);
    413 		return;
    414 	}
    415 
    416 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    417         			0, CTLTYPE_INT, "board_temp_5s",
    418         			SYSCTL_DESCR("5 second average board temperature in micro degrees Celsius"),
    419         			NULL, 0, &sc->boardtemp_5s, 0,
    420 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    421 				!= 0) {
    422                 printf("%s: could not create sysctl\n",
    423 			sc->sc_dev.dv_xname);
    424 		return;
    425 	}
    426 
    427 	if ((i = sysctl_createv(NULL, 0, NULL, NULL,
    428         			0, CTLTYPE_INT, "board_temp_30s",
    429         			SYSCTL_DESCR("30 second average board temperature in micro degrees Celsius"),
    430         			NULL, 0, &sc->boardtemp_30s, 0,
    431 				CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL))
    432 				!= 0) {
    433                 printf("%s: could not create sysctl\n",
    434 			sc->sc_dev.dv_xname);
    435 		return;
    436 	}
    437 
    438         bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_WDOGCTRL, 2, 0,
    439 		&sc->sc_wdogctrl_ioh);
    440         bus_space_map(sc->sc_iot, TS7XXX_IO16_HWBASE + TS7XXX_WDOGFEED, 2, 0,
    441 		&sc->sc_wdogfeed_ioh);
    442 
    443 	sc->sc_wdog.smw_name = sc->sc_dev.dv_xname;
    444 	sc->sc_wdog.smw_cookie = sc;
    445 	sc->sc_wdog.smw_setmode = tspld_wdog_setmode;
    446 	sc->sc_wdog.smw_tickle = tspld_wdog_tickle;
    447 	sc->sc_wdog.smw_period = 8;
    448 	sysmon_wdog_register(&sc->sc_wdog);
    449 	tspld_wdog_setmode(&sc->sc_wdog);
    450 
    451 	/* Set the on board peripherals bus callback */
    452 	config_defer(self, tspld_callback);
    453 }
    454 
    455 int
    456 tspld_search(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux)
    457 {
    458 	struct tspld_softc *sc = (struct tspld_softc *)parent;
    459 	struct tspld_attach_args sa;
    460 
    461 	sa.ta_iot = sc->sc_iot;
    462 
    463 	if (config_match(parent, cf, &sa) > 0)
    464 		config_attach(parent, cf, &sa, tspld_print);
    465 
    466 	return (0);
    467 }
    468 
    469 int
    470 tspld_print(void *aux, const char *name)
    471 {
    472 
    473 	return (UNCONF);
    474 }
    475 
    476 void
    477 tspld_callback(struct device *self)
    478 {
    479 #if NISA > 0
    480 	extern void isa_bs_mallocok(void);
    481 	struct isabus_attach_args iba;
    482 
    483 	/*
    484 	 * Attach the ISA bus behind this bridge.
    485 	 */
    486 	memset(&iba, 0, sizeof(iba));
    487 	iba.iba_iot = &isa_io_bs_tag;
    488 	iba.iba_memt = &isa_mem_bs_tag;
    489 	isa_bs_mallocok();
    490 	config_found_ia(self, "isabus", &iba, isabusprint);
    491 #endif
    492 	/*
    493 	 *  Attach each devices
    494 	 */
    495 	config_search_ia(tspld_search, self, "tspldbus", NULL);
    496 
    497 }
    498 
    499 static int
    500 tspld_wdog_tickle(struct sysmon_wdog *smw)
    501 {
    502 	struct tspld_softc *sc = (struct tspld_softc *)smw->smw_cookie;
    503 
    504 	bus_space_write_2(sc->sc_iot, sc->sc_wdogfeed_ioh, 0, 0x5);
    505 	return 0;
    506 }
    507 
    508 static int
    509 tspld_wdog_setmode(struct sysmon_wdog *smw)
    510 {
    511 	int i, ret = 0;
    512 	struct tspld_softc *sc = (struct tspld_softc *)smw->smw_cookie;
    513 
    514 	i = disable_interrupts(I32_bit|F32_bit);
    515 	if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) {
    516 		bus_space_write_2(sc->sc_iot, sc->sc_wdogfeed_ioh, 0, 0x5);
    517 		bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0, 0);
    518 	} else {
    519 		if (smw->smw_period == WDOG_PERIOD_DEFAULT) {
    520 			smw->smw_period = 8;
    521 		}
    522 
    523 		bus_space_write_2(sc->sc_iot, sc->sc_wdogfeed_ioh, 0, 0x5);
    524 		switch (smw->smw_period) {
    525 		case 1:
    526 			bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
    527 				0x3);
    528 			break;
    529 		case 2:
    530 			bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
    531 				0x5);
    532 			break;
    533 		case 4:
    534 			bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
    535 				0x6);
    536 			break;
    537 		case 8:
    538 			bus_space_write_2(sc->sc_iot, sc->sc_wdogctrl_ioh, 0,
    539 				0x7);
    540 			break;
    541 		default:
    542 			ret = EINVAL;
    543 		}
    544 	}
    545 	restore_interrupts(i);
    546 	return ret;
    547 }
    548