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