Home | History | Annotate | Line # | Download | only in g42xxeb
obio.c revision 1.5
      1  1.5    nonaka /*	$NetBSD: obio.c,v 1.5 2006/12/18 15:32:10 nonaka Exp $ */
      2  1.1       bsh 
      3  1.1       bsh /*
      4  1.1       bsh  * Copyright (c) 2002, 2003, 2005  Genetec corp.  All rights reserved.
      5  1.1       bsh  * Written by Hiroyuki Bessho for Genetec corp.
      6  1.1       bsh  *
      7  1.1       bsh  * Redistribution and use in source and binary forms, with or without
      8  1.1       bsh  * modification, are permitted provided that the following conditions
      9  1.1       bsh  * are met:
     10  1.1       bsh  * 1. Redistributions of source code must retain the above copyright
     11  1.1       bsh  *    notice, this list of conditions and the following disclaimer.
     12  1.1       bsh  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1       bsh  *    notice, this list of conditions and the following disclaimer in the
     14  1.1       bsh  *    documentation and/or other materials provided with the distribution.
     15  1.1       bsh  * 3. The name of Genetec corp. may not be used to endorse
     16  1.1       bsh  *    or promote products derived from this software without specific prior
     17  1.1       bsh  *    written permission.
     18  1.1       bsh  *
     19  1.1       bsh  * THIS SOFTWARE IS PROVIDED BY GENETEC CORP. ``AS IS'' AND
     20  1.1       bsh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.1       bsh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.1       bsh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORP.
     23  1.1       bsh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.1       bsh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.1       bsh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.1       bsh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.1       bsh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.1       bsh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.1       bsh  * POSSIBILITY OF SUCH DAMAGE.
     30  1.1       bsh  */
     31  1.1       bsh 
     32  1.1       bsh 
     33  1.1       bsh #include <sys/param.h>
     34  1.1       bsh #include <sys/systm.h>
     35  1.1       bsh #include <sys/device.h>
     36  1.1       bsh #include <sys/kernel.h>
     37  1.1       bsh #include <sys/reboot.h>
     38  1.1       bsh 
     39  1.1       bsh #include <machine/cpu.h>
     40  1.1       bsh #include <machine/bus.h>
     41  1.1       bsh #include <machine/intr.h>
     42  1.1       bsh #include <arm/cpufunc.h>
     43  1.1       bsh 
     44  1.1       bsh #include <arm/mainbus/mainbus.h>
     45  1.5    nonaka #include <arm/xscale/pxa2x0cpu.h>
     46  1.1       bsh #include <arm/xscale/pxa2x0reg.h>
     47  1.1       bsh #include <arm/xscale/pxa2x0var.h>
     48  1.1       bsh #include <arm/xscale/pxa2x0_gpio.h>
     49  1.1       bsh #include <arm/sa11x0/sa11x0_var.h>
     50  1.1       bsh #include <evbarm/g42xxeb/g42xxeb_reg.h>
     51  1.1       bsh #include <evbarm/g42xxeb/g42xxeb_var.h>
     52  1.1       bsh 
     53  1.1       bsh #include "locators.h"
     54  1.1       bsh 
     55  1.1       bsh /* prototypes */
     56  1.1       bsh static int	obio_match(struct device *, struct cfdata *, void *);
     57  1.1       bsh static void	obio_attach(struct device *, struct device *, void *);
     58  1.2  drochner static int 	obio_search(struct device *, struct cfdata *,
     59  1.3  drochner 			    const int *, void *);
     60  1.1       bsh static int	obio_print(void *, const char *);
     61  1.1       bsh 
     62  1.1       bsh /* attach structures */
     63  1.1       bsh CFATTACH_DECL(obio, sizeof(struct obio_softc), obio_match, obio_attach,
     64  1.1       bsh     NULL, NULL);
     65  1.1       bsh 
     66  1.1       bsh static int
     67  1.1       bsh obio_spurious(void *arg)
     68  1.1       bsh {
     69  1.1       bsh 	int irqno = (int)arg;
     70  1.1       bsh 
     71  1.1       bsh 	printf("Spurious interrupt %d on On-board peripheral", irqno);
     72  1.1       bsh 	return 1;
     73  1.1       bsh }
     74  1.1       bsh 
     75  1.1       bsh 
     76  1.1       bsh /*
     77  1.1       bsh  * interrupt handler for GPIO0 (on-board peripherals)
     78  1.1       bsh  *
     79  1.1       bsh  * On G4250ebx, 10 interrupts are ORed through on-board logic,
     80  1.1       bsh  * and routed to GPIO0 of PXA250 processor.
     81  1.1       bsh  */
     82  1.1       bsh static int
     83  1.1       bsh obio_intr(void *arg)
     84  1.1       bsh {
     85  1.1       bsh 	int irqno, pending;
     86  1.1       bsh 	struct obio_softc *sc = (struct obio_softc *)arg;
     87  1.1       bsh 	int n=0;
     88  1.1       bsh 
     89  1.1       bsh #define get_pending(sc) \
     90  1.1       bsh 	(bus_space_read_2( sc->sc_iot, sc->sc_obioreg_ioh, G42XXEB_INTSTS1) \
     91  1.1       bsh 	& ~(sc->sc_intr_pending|sc->sc_intr_mask))
     92  1.1       bsh 
     93  1.1       bsh #ifdef DEBUG
     94  1.1       bsh 	printf("obio_intr: pend=%x, mask=%x, pend=%x, mask=%x\n",
     95  1.1       bsh 	    bus_space_read_2(sc->sc_iot, sc->sc_obioreg_ioh, G42XXEB_INTSTS1),
     96  1.1       bsh 	    bus_space_read_2(sc->sc_iot, sc->sc_obioreg_ioh, G42XXEB_INTMASK),
     97  1.1       bsh 	    sc->sc_intr_pending,
     98  1.1       bsh 	    sc->sc_intr_mask);
     99  1.1       bsh #endif
    100  1.1       bsh 
    101  1.1       bsh 	for (pending = get_pending(sc);
    102  1.1       bsh 	     (irqno = find_first_bit(pending)) >= 0;
    103  1.1       bsh 	     pending = get_pending(sc)) {
    104  1.1       bsh 
    105  1.1       bsh 		/* reset pending bit */
    106  1.1       bsh 		bus_space_write_2(sc->sc_iot, sc->sc_obioreg_ioh,
    107  1.1       bsh 		    G42XXEB_INTSTS1, ~(1<<irqno));
    108  1.1       bsh 
    109  1.1       bsh #if 0
    110  1.1       bsh 		if (sc->sc_handler[irqno].level > saved_spl_level) {
    111  1.1       bsh 			int spl_save = _splraise(sc->sc_handler[irqno].level);
    112  1.1       bsh 			(* sc->sc_handler[irqno].func)(
    113  1.1       bsh 				sc->sc_handler[irqno].arg);
    114  1.1       bsh 			splx(spl_save);
    115  1.1       bsh 		}
    116  1.1       bsh 		else
    117  1.1       bsh #endif
    118  1.1       bsh 		{
    119  1.1       bsh 			int psw = disable_interrupts(I32_bit); /* XXX */
    120  1.1       bsh 
    121  1.1       bsh 			/* mask this interrupt until software
    122  1.1       bsh 			   interrupt is handled. */
    123  1.1       bsh 			sc->sc_intr_pending |= (1U<<irqno);
    124  1.1       bsh 			obio_update_intrmask(sc);
    125  1.1       bsh 
    126  1.1       bsh 			restore_interrupts(psw);
    127  1.1       bsh 			++n;
    128  1.1       bsh 		}
    129  1.1       bsh #ifdef DIAGNOSTIC
    130  1.1       bsh 		if (n > 1000)
    131  1.1       bsh 			panic("obio_intr: stayed too long");
    132  1.1       bsh #endif
    133  1.1       bsh 	}
    134  1.1       bsh 
    135  1.1       bsh 	if (n > 0) {
    136  1.1       bsh 		/* handle it later */
    137  1.1       bsh 		softintr_schedule(sc->sc_si);
    138  1.1       bsh 	}
    139  1.1       bsh 
    140  1.1       bsh 	/* GPIO interrupt is edge triggered.  make a pulse
    141  1.1       bsh 	   to let Cotulla notice when other interrupts are
    142  1.1       bsh 	   still pending */
    143  1.1       bsh 	bus_space_write_2(sc->sc_iot, sc->sc_obioreg_ioh,
    144  1.1       bsh 	    G42XXEB_INTMASK, 0xffff);
    145  1.1       bsh 	obio_update_intrmask(sc);
    146  1.1       bsh 
    147  1.1       bsh 	return 1;
    148  1.1       bsh }
    149  1.1       bsh 
    150  1.1       bsh static void
    151  1.1       bsh obio_softintr(void *arg)
    152  1.1       bsh {
    153  1.1       bsh 	struct obio_softc *sc = (struct obio_softc *)arg;
    154  1.1       bsh 	int irqno;
    155  1.1       bsh 	int spl_save = current_spl_level;
    156  1.1       bsh 	int psw;
    157  1.1       bsh 
    158  1.1       bsh 	psw = disable_interrupts(I32_bit);
    159  1.1       bsh 	while ((irqno = find_first_bit(sc->sc_intr_pending)) >= 0) {
    160  1.1       bsh 		sc->sc_intr_pending &= ~(1U<<irqno);
    161  1.1       bsh 
    162  1.1       bsh 		restore_interrupts(psw);
    163  1.1       bsh 
    164  1.1       bsh 		_splraise(sc->sc_handler[irqno].level);
    165  1.1       bsh 		(* sc->sc_handler[irqno].func)(
    166  1.1       bsh 			sc->sc_handler[irqno].arg);
    167  1.1       bsh 		splx(spl_save);
    168  1.1       bsh 
    169  1.1       bsh 		psw = disable_interrupts(I32_bit);
    170  1.1       bsh 	}
    171  1.1       bsh 
    172  1.1       bsh 	/* assert(sc->sc_intr_pending==0) */
    173  1.1       bsh 
    174  1.1       bsh 	bus_space_write_2(sc->sc_iot, sc->sc_obioreg_ioh,
    175  1.1       bsh 	    G42XXEB_INTMASK, 0xffff);
    176  1.1       bsh 	obio_update_intrmask(sc);
    177  1.1       bsh 
    178  1.1       bsh 	restore_interrupts(psw);
    179  1.1       bsh }
    180  1.1       bsh 
    181  1.1       bsh /*
    182  1.1       bsh  * int obio_print(void *aux, const char *name)
    183  1.1       bsh  * print configuration info for children
    184  1.1       bsh  */
    185  1.1       bsh 
    186  1.1       bsh static int
    187  1.1       bsh obio_print(void *aux, const char *name)
    188  1.1       bsh {
    189  1.1       bsh 	struct obio_attach_args *oba = (struct obio_attach_args*)aux;
    190  1.1       bsh 
    191  1.1       bsh 	if (oba->oba_addr != OBIOCF_ADDR_DEFAULT)
    192  1.1       bsh                 printf(" addr 0x%lx", oba->oba_addr);
    193  1.1       bsh         if (oba->oba_intr > 0)
    194  1.1       bsh                 printf(" intr %d", oba->oba_intr);
    195  1.1       bsh         return (UNCONF);
    196  1.1       bsh }
    197  1.1       bsh 
    198  1.1       bsh int
    199  1.1       bsh obio_match(struct device *parent, struct cfdata *match, void *aux)
    200  1.1       bsh {
    201  1.1       bsh 	return 1;
    202  1.1       bsh }
    203  1.1       bsh 
    204  1.1       bsh void
    205  1.1       bsh obio_attach(struct device *parent, struct device *self, void *aux)
    206  1.1       bsh {
    207  1.1       bsh 	struct obio_softc *sc = (struct obio_softc*)self;
    208  1.1       bsh 	struct sa11x0_attach_args *sa = (struct sa11x0_attach_args *)aux;
    209  1.1       bsh 	bus_space_tag_t iot = sa->sa_iot;
    210  1.1       bsh 	int i;
    211  1.1       bsh 	uint16_t reg;
    212  1.1       bsh 
    213  1.1       bsh 	/* tweak memory access timing for CS3.
    214  1.1       bsh 	   the value set by redboot is too slow */
    215  1.1       bsh 	if (bus_space_map(iot, PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0,
    216  1.1       bsh 		&sc->sc_memctl_ioh))
    217  1.1       bsh 		goto fail;
    218  1.1       bsh 	bus_space_write_4(iot, sc->sc_memctl_ioh, MEMCTL_MSC1,
    219  1.1       bsh 	    (0xffff & bus_space_read_4(iot, sc->sc_memctl_ioh, MEMCTL_MSC1))
    220  1.1       bsh 	    | (0x6888 << 16));
    221  1.1       bsh 
    222  1.1       bsh 	/* Map on-board FPGA registers */
    223  1.1       bsh 	sc->sc_iot = iot;
    224  1.1       bsh 	if (bus_space_map(iot, G42XXEB_PLDREG_BASE, G42XXEB_PLDREG_SIZE,
    225  1.1       bsh 	    0, &(sc->sc_obioreg_ioh)))
    226  1.1       bsh 		goto fail;
    227  1.1       bsh 
    228  1.1       bsh 	/*
    229  1.1       bsh 	 *  Mask all interrupts.
    230  1.1       bsh 	 *  They are later unmasked at each device's attach routine.
    231  1.1       bsh 	 */
    232  1.1       bsh 	sc->sc_intr_mask = 0xffff;
    233  1.1       bsh 	bus_space_write_2(iot, sc->sc_obioreg_ioh, G42XXEB_INTMASK,
    234  1.1       bsh 	    sc->sc_intr_mask );
    235  1.1       bsh 
    236  1.1       bsh #if 0
    237  1.1       bsh 	sc->sc_intr = 8;		/* GPIO0 */
    238  1.1       bsh #endif
    239  1.1       bsh 	sc->sc_intr_pending = 0;
    240  1.1       bsh 
    241  1.1       bsh 	for (i=0; i < G42XXEB_N_INTS; ++i) {
    242  1.1       bsh 		sc->sc_handler[i].func = obio_spurious;
    243  1.1       bsh 		sc->sc_handler[i].arg = (void *)i;
    244  1.1       bsh 	}
    245  1.1       bsh 
    246  1.1       bsh 	obio_peripheral_reset(sc, 1, 0);
    247  1.1       bsh 
    248  1.1       bsh 	/*
    249  1.1       bsh 	 * establish interrupt handler.
    250  1.1       bsh 	 * level is very high to allow high priority sub-interrupts.
    251  1.1       bsh 	 */
    252  1.1       bsh 	sc->sc_ipl = IPL_AUDIO;
    253  1.1       bsh 	sc->sc_ih = pxa2x0_gpio_intr_establish(0, IST_EDGE_FALLING, sc->sc_ipl,
    254  1.1       bsh 	    obio_intr, sc);
    255  1.1       bsh 	sc->sc_si = softintr_establish(IPL_SOFTNET, obio_softintr, sc);
    256  1.1       bsh 
    257  1.1       bsh 	reg = bus_space_read_2(iot, sc->sc_obioreg_ioh, G42XXEB_PLDVER);
    258  1.1       bsh 	aprint_normal(": board %d version %x\n", reg>>8, reg & 0xff);
    259  1.1       bsh 
    260  1.1       bsh 	/*
    261  1.1       bsh 	 *  Attach each devices
    262  1.1       bsh 	 */
    263  1.2  drochner 	config_search_ia(obio_search, self, "obio", NULL);
    264  1.1       bsh 	return;
    265  1.1       bsh 
    266  1.1       bsh  fail:
    267  1.1       bsh 	printf( "%s: can't map FPGA registers\n", self->dv_xname );
    268  1.1       bsh }
    269  1.1       bsh 
    270  1.1       bsh int
    271  1.2  drochner obio_search(struct device *parent, struct cfdata *cf,
    272  1.3  drochner 	    const int *ldesc, void *aux)
    273  1.1       bsh {
    274  1.1       bsh 	struct obio_softc *sc = (struct obio_softc *)parent;
    275  1.1       bsh 	struct obio_attach_args oba;
    276  1.1       bsh 
    277  1.1       bsh 	oba.oba_sc = sc;
    278  1.1       bsh         oba.oba_iot = sc->sc_iot;
    279  1.1       bsh         oba.oba_addr = cf->cf_loc[OBIOCF_ADDR];
    280  1.1       bsh         oba.oba_intr = cf->cf_loc[OBIOCF_INTR];
    281  1.1       bsh 
    282  1.1       bsh         if (config_match(parent, cf, &oba) > 0)
    283  1.1       bsh                 config_attach(parent, cf, &oba, obio_print);
    284  1.1       bsh 
    285  1.1       bsh         return 0;
    286  1.1       bsh }
    287  1.1       bsh 
    288  1.1       bsh void *
    289  1.1       bsh obio_intr_establish(struct obio_softc *sc, int irq, int ipl,
    290  1.1       bsh     int type, int (*func)(void *), void *arg)
    291  1.1       bsh {
    292  1.1       bsh 	int save;
    293  1.1       bsh 	int regidx, sft;
    294  1.1       bsh 	uint16_t reg;
    295  1.1       bsh 	static const uint8_t ist_code[] = {
    296  1.1       bsh 		0,
    297  1.1       bsh 		G42XXEB_INT_EDGE_FALLING, /* pulse */
    298  1.1       bsh 		G42XXEB_INT_EDGE_FALLING, /* IST_EDGE */
    299  1.1       bsh 		G42XXEB_INT_LEVEL_LOW,	   /* IST_LEVEL */
    300  1.1       bsh 		G42XXEB_INT_LEVEL_HIGH,   /* IST_LEVEL_HIGH */
    301  1.1       bsh 		G42XXEB_INT_EDGE_RISING,  /* IST_EDGE_RISING */
    302  1.1       bsh 		G42XXEB_INT_EDGE_BOTH,	   /* IST_EDGE_BOTH */
    303  1.1       bsh 	};
    304  1.1       bsh 
    305  1.1       bsh 	if (irq < 0 || G42XXEB_N_INTS <= irq)
    306  1.1       bsh 		panic("Bad irq no. for obio (%d)", irq);
    307  1.1       bsh 
    308  1.1       bsh 	if (type < 0 || IST_EDGE_BOTH < type)
    309  1.1       bsh 		panic("Bad interrupt type for obio (%d)", type);
    310  1.1       bsh 
    311  1.1       bsh 	regidx = G42XXEB_INTCNTL;
    312  1.1       bsh 	sft = 3 * irq;
    313  1.1       bsh 	if (irq >= 5) {
    314  1.1       bsh 		regidx = G42XXEB_INTCNTH;
    315  1.1       bsh 		sft -= 3*5;
    316  1.1       bsh 	}
    317  1.1       bsh 
    318  1.1       bsh 	save = disable_interrupts(I32_bit);
    319  1.1       bsh 
    320  1.1       bsh 	sc->sc_handler[irq].func = func;
    321  1.1       bsh 	sc->sc_handler[irq].arg = arg;
    322  1.1       bsh 	sc->sc_handler[irq].level = ipl;
    323  1.1       bsh 
    324  1.1       bsh 	/* set interrupt type */
    325  1.1       bsh 	reg = bus_space_read_2(sc->sc_iot, sc->sc_obioreg_ioh, regidx);
    326  1.1       bsh 	bus_space_write_2(sc->sc_iot, sc->sc_obioreg_ioh, regidx,
    327  1.1       bsh 	    (reg & ~(7<<sft)) | (ist_code[type] << sft));
    328  1.1       bsh 
    329  1.1       bsh #ifdef DEBUG
    330  1.1       bsh 	printf("INTCTL=%x,%x\n",
    331  1.1       bsh 	    bus_space_read_2(sc->sc_iot, sc->sc_obioreg_ioh, G42XXEB_INTCNTL),
    332  1.1       bsh 	    bus_space_read_2(sc->sc_iot, sc->sc_obioreg_ioh, G42XXEB_INTCNTH));
    333  1.1       bsh #endif
    334  1.1       bsh 
    335  1.1       bsh 	sc->sc_intr_mask &= ~(1U << irq);
    336  1.1       bsh 	obio_update_intrmask(sc);
    337  1.1       bsh 
    338  1.1       bsh 	restore_interrupts(save);
    339  1.1       bsh 
    340  1.1       bsh #if 0
    341  1.1       bsh 	if (ipl > sc->sc_ipl) {
    342  1.1       bsh 		pxa2x0_update_intr_masks(sc->sc_intr, ipl);
    343  1.1       bsh 		sc->sc_ipl = ipl;
    344  1.1       bsh 	}
    345  1.1       bsh #endif
    346  1.1       bsh 
    347  1.1       bsh 	return &sc->sc_handler[irq];
    348  1.1       bsh }
    349  1.1       bsh 
    350  1.1       bsh void
    351  1.1       bsh obio_intr_disestablish(struct obio_softc *sc, int irq, int (* func)(void *))
    352  1.1       bsh {
    353  1.1       bsh 	int error = 0;
    354  1.1       bsh 	int save;
    355  1.1       bsh 
    356  1.1       bsh 	save = disable_interrupts(I32_bit);
    357  1.1       bsh 
    358  1.1       bsh 	if (sc->sc_handler[irq].func != func)
    359  1.1       bsh 		error = 1;
    360  1.1       bsh 	else {
    361  1.1       bsh 		sc->sc_handler[irq].func = obio_spurious;
    362  1.1       bsh 		sc->sc_handler[irq].level = IPL_NONE;
    363  1.1       bsh 
    364  1.1       bsh 		sc->sc_intr_pending &= ~(1U << irq);
    365  1.1       bsh 		sc->sc_intr_mask |= (1U << irq);
    366  1.1       bsh 		obio_update_intrmask(sc);
    367  1.1       bsh 	}
    368  1.1       bsh 
    369  1.1       bsh 	restore_interrupts(save);
    370  1.1       bsh 
    371  1.1       bsh 	if (error)
    372  1.1       bsh 		aprint_error("%s: bad intr_disestablish\n",
    373  1.1       bsh 		    sc->sc_dev.dv_xname);
    374  1.1       bsh }
    375  1.1       bsh 
    376  1.1       bsh void
    377  1.1       bsh obio_intr_mask(struct obio_softc *sc, struct obio_handler *ih)
    378  1.1       bsh {
    379  1.1       bsh 	int irqno;
    380  1.1       bsh 	int save;
    381  1.1       bsh 
    382  1.1       bsh 	irqno = ih - sc->sc_handler;
    383  1.1       bsh #ifdef DIAGNOSTIC
    384  1.1       bsh 	if (ih == NULL || ih->func==NULL || irqno < 0 ||
    385  1.1       bsh 	    irqno >= G42XXEB_N_INTS)
    386  1.1       bsh 		panic("Bad arg for obio_intr_mask");
    387  1.1       bsh #endif
    388  1.1       bsh 
    389  1.1       bsh 	save = disable_interrupts(I32_bit);
    390  1.1       bsh 	sc->sc_intr_mask |= 1U<<irqno;
    391  1.1       bsh 	obio_update_intrmask(sc);
    392  1.1       bsh 	restore_interrupts(save);
    393  1.1       bsh }
    394  1.1       bsh 
    395  1.1       bsh void
    396  1.1       bsh obio_intr_unmask(struct obio_softc *sc, struct obio_handler *ih)
    397  1.1       bsh {
    398  1.1       bsh 	int irqno;
    399  1.1       bsh 	int save;
    400  1.1       bsh 
    401  1.1       bsh 	irqno = ih - sc->sc_handler;
    402  1.1       bsh #ifdef DIAGNOSTIC
    403  1.1       bsh 	if (ih == NULL || ih->func==NULL || irqno < 0 ||
    404  1.1       bsh 	    irqno >= G42XXEB_N_INTS)
    405  1.1       bsh 		panic("Bad arg for obio_intr_unmask");
    406  1.1       bsh #endif
    407  1.1       bsh 
    408  1.1       bsh 	save = disable_interrupts(I32_bit);
    409  1.1       bsh 	sc->sc_intr_mask &= ~(1U<<irqno);
    410  1.1       bsh 	obio_update_intrmask(sc);
    411  1.1       bsh 	restore_interrupts(save);
    412  1.1       bsh }
    413  1.1       bsh 
    414  1.1       bsh void
    415  1.1       bsh obio_peripheral_reset(struct obio_softc *bsc, int no, int onoff)
    416  1.1       bsh {
    417  1.1       bsh 	uint16_t reg;
    418  1.1       bsh 
    419  1.1       bsh 	reg = bus_space_read_2(bsc->sc_iot, bsc->sc_obioreg_ioh,
    420  1.1       bsh 	    G42XXEB_RST);
    421  1.1       bsh 	bus_space_write_2(bsc->sc_iot, bsc->sc_obioreg_ioh, G42XXEB_RST,
    422  1.1       bsh 	    onoff ?  (reg & ~RST_EXT(no)) : (reg | RST_EXT(no)));
    423  1.1       bsh }
    424  1.1       bsh 
    425