Home | History | Annotate | Line # | Download | only in g42xxeb
obio.c revision 1.1
      1  1.1  bsh /*	$NetBSD: obio.c,v 1.1 2005/02/26 10:49:53 bsh 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.1  bsh #include <arm/xscale/pxa2x0reg.h>
     46  1.1  bsh #include <arm/xscale/pxa2x0var.h>
     47  1.1  bsh #include <arm/xscale/pxa2x0_gpio.h>
     48  1.1  bsh #include <arm/sa11x0/sa11x0_var.h>
     49  1.1  bsh #include <evbarm/g42xxeb/g42xxeb_reg.h>
     50  1.1  bsh #include <evbarm/g42xxeb/g42xxeb_var.h>
     51  1.1  bsh 
     52  1.1  bsh #include "locators.h"
     53  1.1  bsh 
     54  1.1  bsh /* prototypes */
     55  1.1  bsh static int	obio_match(struct device *, struct cfdata *, void *);
     56  1.1  bsh static void	obio_attach(struct device *, struct device *, void *);
     57  1.1  bsh static int 	obio_search(struct device *, struct cfdata *, void *);
     58  1.1  bsh static int	obio_print(void *, const char *);
     59  1.1  bsh 
     60  1.1  bsh /* attach structures */
     61  1.1  bsh CFATTACH_DECL(obio, sizeof(struct obio_softc), obio_match, obio_attach,
     62  1.1  bsh     NULL, NULL);
     63  1.1  bsh 
     64  1.1  bsh static int
     65  1.1  bsh obio_spurious(void *arg)
     66  1.1  bsh {
     67  1.1  bsh 	int irqno = (int)arg;
     68  1.1  bsh 
     69  1.1  bsh 	printf("Spurious interrupt %d on On-board peripheral", irqno);
     70  1.1  bsh 	return 1;
     71  1.1  bsh }
     72  1.1  bsh 
     73  1.1  bsh 
     74  1.1  bsh /*
     75  1.1  bsh  * interrupt handler for GPIO0 (on-board peripherals)
     76  1.1  bsh  *
     77  1.1  bsh  * On G4250ebx, 10 interrupts are ORed through on-board logic,
     78  1.1  bsh  * and routed to GPIO0 of PXA250 processor.
     79  1.1  bsh  */
     80  1.1  bsh static int
     81  1.1  bsh obio_intr(void *arg)
     82  1.1  bsh {
     83  1.1  bsh 	int irqno, pending;
     84  1.1  bsh 	struct obio_softc *sc = (struct obio_softc *)arg;
     85  1.1  bsh 	int n=0;
     86  1.1  bsh 
     87  1.1  bsh #define get_pending(sc) \
     88  1.1  bsh 	(bus_space_read_2( sc->sc_iot, sc->sc_obioreg_ioh, G42XXEB_INTSTS1) \
     89  1.1  bsh 	& ~(sc->sc_intr_pending|sc->sc_intr_mask))
     90  1.1  bsh 
     91  1.1  bsh #ifdef DEBUG
     92  1.1  bsh 	printf("obio_intr: pend=%x, mask=%x, pend=%x, mask=%x\n",
     93  1.1  bsh 	    bus_space_read_2(sc->sc_iot, sc->sc_obioreg_ioh, G42XXEB_INTSTS1),
     94  1.1  bsh 	    bus_space_read_2(sc->sc_iot, sc->sc_obioreg_ioh, G42XXEB_INTMASK),
     95  1.1  bsh 	    sc->sc_intr_pending,
     96  1.1  bsh 	    sc->sc_intr_mask);
     97  1.1  bsh #endif
     98  1.1  bsh 
     99  1.1  bsh 	for (pending = get_pending(sc);
    100  1.1  bsh 	     (irqno = find_first_bit(pending)) >= 0;
    101  1.1  bsh 	     pending = get_pending(sc)) {
    102  1.1  bsh 
    103  1.1  bsh 		/* reset pending bit */
    104  1.1  bsh 		bus_space_write_2(sc->sc_iot, sc->sc_obioreg_ioh,
    105  1.1  bsh 		    G42XXEB_INTSTS1, ~(1<<irqno));
    106  1.1  bsh 
    107  1.1  bsh #if 0
    108  1.1  bsh 		if (sc->sc_handler[irqno].level > saved_spl_level) {
    109  1.1  bsh 			int spl_save = _splraise(sc->sc_handler[irqno].level);
    110  1.1  bsh 			(* sc->sc_handler[irqno].func)(
    111  1.1  bsh 				sc->sc_handler[irqno].arg);
    112  1.1  bsh 			splx(spl_save);
    113  1.1  bsh 		}
    114  1.1  bsh 		else
    115  1.1  bsh #endif
    116  1.1  bsh 		{
    117  1.1  bsh 			int psw = disable_interrupts(I32_bit); /* XXX */
    118  1.1  bsh 
    119  1.1  bsh 			/* mask this interrupt until software
    120  1.1  bsh 			   interrupt is handled. */
    121  1.1  bsh 			sc->sc_intr_pending |= (1U<<irqno);
    122  1.1  bsh 			obio_update_intrmask(sc);
    123  1.1  bsh 
    124  1.1  bsh 			restore_interrupts(psw);
    125  1.1  bsh 			++n;
    126  1.1  bsh 		}
    127  1.1  bsh #ifdef DIAGNOSTIC
    128  1.1  bsh 		if (n > 1000)
    129  1.1  bsh 			panic("obio_intr: stayed too long");
    130  1.1  bsh #endif
    131  1.1  bsh 	}
    132  1.1  bsh 
    133  1.1  bsh 	if (n > 0) {
    134  1.1  bsh 		/* handle it later */
    135  1.1  bsh 		softintr_schedule(sc->sc_si);
    136  1.1  bsh 	}
    137  1.1  bsh 
    138  1.1  bsh 	/* GPIO interrupt is edge triggered.  make a pulse
    139  1.1  bsh 	   to let Cotulla notice when other interrupts are
    140  1.1  bsh 	   still pending */
    141  1.1  bsh 	bus_space_write_2(sc->sc_iot, sc->sc_obioreg_ioh,
    142  1.1  bsh 	    G42XXEB_INTMASK, 0xffff);
    143  1.1  bsh 	obio_update_intrmask(sc);
    144  1.1  bsh 
    145  1.1  bsh 	return 1;
    146  1.1  bsh }
    147  1.1  bsh 
    148  1.1  bsh static void
    149  1.1  bsh obio_softintr(void *arg)
    150  1.1  bsh {
    151  1.1  bsh 	struct obio_softc *sc = (struct obio_softc *)arg;
    152  1.1  bsh 	int irqno;
    153  1.1  bsh 	int spl_save = current_spl_level;
    154  1.1  bsh 	int psw;
    155  1.1  bsh 
    156  1.1  bsh 	psw = disable_interrupts(I32_bit);
    157  1.1  bsh 	while ((irqno = find_first_bit(sc->sc_intr_pending)) >= 0) {
    158  1.1  bsh 		sc->sc_intr_pending &= ~(1U<<irqno);
    159  1.1  bsh 
    160  1.1  bsh 		restore_interrupts(psw);
    161  1.1  bsh 
    162  1.1  bsh 		_splraise(sc->sc_handler[irqno].level);
    163  1.1  bsh 		(* sc->sc_handler[irqno].func)(
    164  1.1  bsh 			sc->sc_handler[irqno].arg);
    165  1.1  bsh 		splx(spl_save);
    166  1.1  bsh 
    167  1.1  bsh 		psw = disable_interrupts(I32_bit);
    168  1.1  bsh 	}
    169  1.1  bsh 
    170  1.1  bsh 	/* assert(sc->sc_intr_pending==0) */
    171  1.1  bsh 
    172  1.1  bsh 	bus_space_write_2(sc->sc_iot, sc->sc_obioreg_ioh,
    173  1.1  bsh 	    G42XXEB_INTMASK, 0xffff);
    174  1.1  bsh 	obio_update_intrmask(sc);
    175  1.1  bsh 
    176  1.1  bsh 	restore_interrupts(psw);
    177  1.1  bsh }
    178  1.1  bsh 
    179  1.1  bsh /*
    180  1.1  bsh  * int obio_print(void *aux, const char *name)
    181  1.1  bsh  * print configuration info for children
    182  1.1  bsh  */
    183  1.1  bsh 
    184  1.1  bsh static int
    185  1.1  bsh obio_print(void *aux, const char *name)
    186  1.1  bsh {
    187  1.1  bsh 	struct obio_attach_args *oba = (struct obio_attach_args*)aux;
    188  1.1  bsh 
    189  1.1  bsh 	if (oba->oba_addr != OBIOCF_ADDR_DEFAULT)
    190  1.1  bsh                 printf(" addr 0x%lx", oba->oba_addr);
    191  1.1  bsh         if (oba->oba_intr > 0)
    192  1.1  bsh                 printf(" intr %d", oba->oba_intr);
    193  1.1  bsh         return (UNCONF);
    194  1.1  bsh }
    195  1.1  bsh 
    196  1.1  bsh int
    197  1.1  bsh obio_match(struct device *parent, struct cfdata *match, void *aux)
    198  1.1  bsh {
    199  1.1  bsh 	return 1;
    200  1.1  bsh }
    201  1.1  bsh 
    202  1.1  bsh void
    203  1.1  bsh obio_attach(struct device *parent, struct device *self, void *aux)
    204  1.1  bsh {
    205  1.1  bsh 	struct obio_softc *sc = (struct obio_softc*)self;
    206  1.1  bsh 	struct sa11x0_attach_args *sa = (struct sa11x0_attach_args *)aux;
    207  1.1  bsh 	bus_space_tag_t iot = sa->sa_iot;
    208  1.1  bsh 	int i;
    209  1.1  bsh 	uint16_t reg;
    210  1.1  bsh 
    211  1.1  bsh 	/* tweak memory access timing for CS3.
    212  1.1  bsh 	   the value set by redboot is too slow */
    213  1.1  bsh 	if (bus_space_map(iot, PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0,
    214  1.1  bsh 		&sc->sc_memctl_ioh))
    215  1.1  bsh 		goto fail;
    216  1.1  bsh 	bus_space_write_4(iot, sc->sc_memctl_ioh, MEMCTL_MSC1,
    217  1.1  bsh 	    (0xffff & bus_space_read_4(iot, sc->sc_memctl_ioh, MEMCTL_MSC1))
    218  1.1  bsh 	    | (0x6888 << 16));
    219  1.1  bsh 
    220  1.1  bsh 	/* Map on-board FPGA registers */
    221  1.1  bsh 	sc->sc_iot = iot;
    222  1.1  bsh 	if (bus_space_map(iot, G42XXEB_PLDREG_BASE, G42XXEB_PLDREG_SIZE,
    223  1.1  bsh 	    0, &(sc->sc_obioreg_ioh)))
    224  1.1  bsh 		goto fail;
    225  1.1  bsh 
    226  1.1  bsh 	/*
    227  1.1  bsh 	 *  Mask all interrupts.
    228  1.1  bsh 	 *  They are later unmasked at each device's attach routine.
    229  1.1  bsh 	 */
    230  1.1  bsh 	sc->sc_intr_mask = 0xffff;
    231  1.1  bsh 	bus_space_write_2(iot, sc->sc_obioreg_ioh, G42XXEB_INTMASK,
    232  1.1  bsh 	    sc->sc_intr_mask );
    233  1.1  bsh 
    234  1.1  bsh #if 0
    235  1.1  bsh 	sc->sc_intr = 8;		/* GPIO0 */
    236  1.1  bsh #endif
    237  1.1  bsh 	sc->sc_intr_pending = 0;
    238  1.1  bsh 
    239  1.1  bsh 	for (i=0; i < G42XXEB_N_INTS; ++i) {
    240  1.1  bsh 		sc->sc_handler[i].func = obio_spurious;
    241  1.1  bsh 		sc->sc_handler[i].arg = (void *)i;
    242  1.1  bsh 	}
    243  1.1  bsh 
    244  1.1  bsh 	obio_peripheral_reset(sc, 1, 0);
    245  1.1  bsh 
    246  1.1  bsh 	/*
    247  1.1  bsh 	 * establish interrupt handler.
    248  1.1  bsh 	 * level is very high to allow high priority sub-interrupts.
    249  1.1  bsh 	 */
    250  1.1  bsh 	sc->sc_ipl = IPL_AUDIO;
    251  1.1  bsh 	sc->sc_ih = pxa2x0_gpio_intr_establish(0, IST_EDGE_FALLING, sc->sc_ipl,
    252  1.1  bsh 	    obio_intr, sc);
    253  1.1  bsh 	sc->sc_si = softintr_establish(IPL_SOFTNET, obio_softintr, sc);
    254  1.1  bsh 
    255  1.1  bsh 	reg = bus_space_read_2(iot, sc->sc_obioreg_ioh, G42XXEB_PLDVER);
    256  1.1  bsh 	aprint_normal(": board %d version %x\n", reg>>8, reg & 0xff);
    257  1.1  bsh 
    258  1.1  bsh 	/*
    259  1.1  bsh 	 *  Attach each devices
    260  1.1  bsh 	 */
    261  1.1  bsh 	config_search(obio_search, self, NULL);
    262  1.1  bsh 	return;
    263  1.1  bsh 
    264  1.1  bsh  fail:
    265  1.1  bsh 	printf( "%s: can't map FPGA registers\n", self->dv_xname );
    266  1.1  bsh }
    267  1.1  bsh 
    268  1.1  bsh int
    269  1.1  bsh obio_search(struct device *parent, struct cfdata *cf, void *aux)
    270  1.1  bsh {
    271  1.1  bsh 	struct obio_softc *sc = (struct obio_softc *)parent;
    272  1.1  bsh 	struct obio_attach_args oba;
    273  1.1  bsh 
    274  1.1  bsh 	oba.oba_sc = sc;
    275  1.1  bsh         oba.oba_iot = sc->sc_iot;
    276  1.1  bsh         oba.oba_addr = cf->cf_loc[OBIOCF_ADDR];
    277  1.1  bsh         oba.oba_intr = cf->cf_loc[OBIOCF_INTR];
    278  1.1  bsh 
    279  1.1  bsh         if (config_match(parent, cf, &oba) > 0)
    280  1.1  bsh                 config_attach(parent, cf, &oba, obio_print);
    281  1.1  bsh 
    282  1.1  bsh         return 0;
    283  1.1  bsh }
    284  1.1  bsh 
    285  1.1  bsh void *
    286  1.1  bsh obio_intr_establish(struct obio_softc *sc, int irq, int ipl,
    287  1.1  bsh     int type, int (*func)(void *), void *arg)
    288  1.1  bsh {
    289  1.1  bsh 	int save;
    290  1.1  bsh 	int regidx, sft;
    291  1.1  bsh 	uint16_t reg;
    292  1.1  bsh 	static const uint8_t ist_code[] = {
    293  1.1  bsh 		0,
    294  1.1  bsh 		G42XXEB_INT_EDGE_FALLING, /* pulse */
    295  1.1  bsh 		G42XXEB_INT_EDGE_FALLING, /* IST_EDGE */
    296  1.1  bsh 		G42XXEB_INT_LEVEL_LOW,	   /* IST_LEVEL */
    297  1.1  bsh 		G42XXEB_INT_LEVEL_HIGH,   /* IST_LEVEL_HIGH */
    298  1.1  bsh 		G42XXEB_INT_EDGE_RISING,  /* IST_EDGE_RISING */
    299  1.1  bsh 		G42XXEB_INT_EDGE_BOTH,	   /* IST_EDGE_BOTH */
    300  1.1  bsh 	};
    301  1.1  bsh 
    302  1.1  bsh 	if (irq < 0 || G42XXEB_N_INTS <= irq)
    303  1.1  bsh 		panic("Bad irq no. for obio (%d)", irq);
    304  1.1  bsh 
    305  1.1  bsh 	if (type < 0 || IST_EDGE_BOTH < type)
    306  1.1  bsh 		panic("Bad interrupt type for obio (%d)", type);
    307  1.1  bsh 
    308  1.1  bsh 	regidx = G42XXEB_INTCNTL;
    309  1.1  bsh 	sft = 3 * irq;
    310  1.1  bsh 	if (irq >= 5) {
    311  1.1  bsh 		regidx = G42XXEB_INTCNTH;
    312  1.1  bsh 		sft -= 3*5;
    313  1.1  bsh 	}
    314  1.1  bsh 
    315  1.1  bsh 	save = disable_interrupts(I32_bit);
    316  1.1  bsh 
    317  1.1  bsh 	sc->sc_handler[irq].func = func;
    318  1.1  bsh 	sc->sc_handler[irq].arg = arg;
    319  1.1  bsh 	sc->sc_handler[irq].level = ipl;
    320  1.1  bsh 
    321  1.1  bsh 	/* set interrupt type */
    322  1.1  bsh 	reg = bus_space_read_2(sc->sc_iot, sc->sc_obioreg_ioh, regidx);
    323  1.1  bsh 	bus_space_write_2(sc->sc_iot, sc->sc_obioreg_ioh, regidx,
    324  1.1  bsh 	    (reg & ~(7<<sft)) | (ist_code[type] << sft));
    325  1.1  bsh 
    326  1.1  bsh #ifdef DEBUG
    327  1.1  bsh 	printf("INTCTL=%x,%x\n",
    328  1.1  bsh 	    bus_space_read_2(sc->sc_iot, sc->sc_obioreg_ioh, G42XXEB_INTCNTL),
    329  1.1  bsh 	    bus_space_read_2(sc->sc_iot, sc->sc_obioreg_ioh, G42XXEB_INTCNTH));
    330  1.1  bsh #endif
    331  1.1  bsh 
    332  1.1  bsh 	sc->sc_intr_mask &= ~(1U << irq);
    333  1.1  bsh 	obio_update_intrmask(sc);
    334  1.1  bsh 
    335  1.1  bsh 	restore_interrupts(save);
    336  1.1  bsh 
    337  1.1  bsh #if 0
    338  1.1  bsh 	if (ipl > sc->sc_ipl) {
    339  1.1  bsh 		pxa2x0_update_intr_masks(sc->sc_intr, ipl);
    340  1.1  bsh 		sc->sc_ipl = ipl;
    341  1.1  bsh 	}
    342  1.1  bsh #endif
    343  1.1  bsh 
    344  1.1  bsh 	return &sc->sc_handler[irq];
    345  1.1  bsh }
    346  1.1  bsh 
    347  1.1  bsh void
    348  1.1  bsh obio_intr_disestablish(struct obio_softc *sc, int irq, int (* func)(void *))
    349  1.1  bsh {
    350  1.1  bsh 	int error = 0;
    351  1.1  bsh 	int save;
    352  1.1  bsh 
    353  1.1  bsh 	save = disable_interrupts(I32_bit);
    354  1.1  bsh 
    355  1.1  bsh 	if (sc->sc_handler[irq].func != func)
    356  1.1  bsh 		error = 1;
    357  1.1  bsh 	else {
    358  1.1  bsh 		sc->sc_handler[irq].func = obio_spurious;
    359  1.1  bsh 		sc->sc_handler[irq].level = IPL_NONE;
    360  1.1  bsh 
    361  1.1  bsh 		sc->sc_intr_pending &= ~(1U << irq);
    362  1.1  bsh 		sc->sc_intr_mask |= (1U << irq);
    363  1.1  bsh 		obio_update_intrmask(sc);
    364  1.1  bsh 	}
    365  1.1  bsh 
    366  1.1  bsh 	restore_interrupts(save);
    367  1.1  bsh 
    368  1.1  bsh 	if (error)
    369  1.1  bsh 		aprint_error("%s: bad intr_disestablish\n",
    370  1.1  bsh 		    sc->sc_dev.dv_xname);
    371  1.1  bsh }
    372  1.1  bsh 
    373  1.1  bsh void
    374  1.1  bsh obio_intr_mask(struct obio_softc *sc, struct obio_handler *ih)
    375  1.1  bsh {
    376  1.1  bsh 	int irqno;
    377  1.1  bsh 	int save;
    378  1.1  bsh 
    379  1.1  bsh 	irqno = ih - sc->sc_handler;
    380  1.1  bsh #ifdef DIAGNOSTIC
    381  1.1  bsh 	if (ih == NULL || ih->func==NULL || irqno < 0 ||
    382  1.1  bsh 	    irqno >= G42XXEB_N_INTS)
    383  1.1  bsh 		panic("Bad arg for obio_intr_mask");
    384  1.1  bsh #endif
    385  1.1  bsh 
    386  1.1  bsh 	save = disable_interrupts(I32_bit);
    387  1.1  bsh 	sc->sc_intr_mask |= 1U<<irqno;
    388  1.1  bsh 	obio_update_intrmask(sc);
    389  1.1  bsh 	restore_interrupts(save);
    390  1.1  bsh }
    391  1.1  bsh 
    392  1.1  bsh void
    393  1.1  bsh obio_intr_unmask(struct obio_softc *sc, struct obio_handler *ih)
    394  1.1  bsh {
    395  1.1  bsh 	int irqno;
    396  1.1  bsh 	int save;
    397  1.1  bsh 
    398  1.1  bsh 	irqno = ih - sc->sc_handler;
    399  1.1  bsh #ifdef DIAGNOSTIC
    400  1.1  bsh 	if (ih == NULL || ih->func==NULL || irqno < 0 ||
    401  1.1  bsh 	    irqno >= G42XXEB_N_INTS)
    402  1.1  bsh 		panic("Bad arg for obio_intr_unmask");
    403  1.1  bsh #endif
    404  1.1  bsh 
    405  1.1  bsh 	save = disable_interrupts(I32_bit);
    406  1.1  bsh 	sc->sc_intr_mask &= ~(1U<<irqno);
    407  1.1  bsh 	obio_update_intrmask(sc);
    408  1.1  bsh 	restore_interrupts(save);
    409  1.1  bsh }
    410  1.1  bsh 
    411  1.1  bsh void
    412  1.1  bsh obio_peripheral_reset(struct obio_softc *bsc, int no, int onoff)
    413  1.1  bsh {
    414  1.1  bsh 	uint16_t reg;
    415  1.1  bsh 
    416  1.1  bsh 	reg = bus_space_read_2(bsc->sc_iot, bsc->sc_obioreg_ioh,
    417  1.1  bsh 	    G42XXEB_RST);
    418  1.1  bsh 	bus_space_write_2(bsc->sc_iot, bsc->sc_obioreg_ioh, G42XXEB_RST,
    419  1.1  bsh 	    onoff ?  (reg & ~RST_EXT(no)) : (reg | RST_EXT(no)));
    420  1.1  bsh }
    421  1.1  bsh 
    422