diff options
-rw-r--r-- | sys/dev/fdt/imxgpio.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/sys/dev/fdt/imxgpio.c b/sys/dev/fdt/imxgpio.c index fee68566a31..4a108c212ca 100644 --- a/sys/dev/fdt/imxgpio.c +++ b/sys/dev/fdt/imxgpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxgpio.c,v 1.2 2018/08/06 10:52:30 patrick Exp $ */ +/* $OpenBSD: imxgpio.c,v 1.3 2018/08/08 11:06:47 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> @@ -82,6 +82,8 @@ void *imxgpio_intr_establish(void *, int *, int, int (*)(void *), void *, char *); void imxgpio_intr_disestablish(void *); void imxgpio_recalc_ipl(struct imxgpio_softc *); +void imxgpio_intr_enable(void *); +void imxgpio_intr_disable(void *); struct cfattach imxgpio_ca = { @@ -131,6 +133,8 @@ imxgpio_attach(struct device *parent, struct device *self, void *aux) sc->sc_ic.ic_cookie = sc; sc->sc_ic.ic_establish = imxgpio_intr_establish; sc->sc_ic.ic_disestablish = imxgpio_intr_disestablish; + sc->sc_ic.ic_enable = imxgpio_intr_enable; + sc->sc_ic.ic_disable = imxgpio_intr_disable; fdt_intr_register(&sc->sc_ic); printf("\n"); @@ -372,3 +376,33 @@ imxgpio_recalc_ipl(struct imxgpio_softc *sc) } } } + +void +imxgpio_intr_enable(void *cookie) +{ + struct intrhand *ih = cookie; + struct imxgpio_softc *sc = ih->ih_sc; + uint32_t mask; + int s; + + s = splhigh(); + mask = bus_space_read_4(sc->sc_iot, sc->sc_ioh, GPIO_IMR); + mask |= (1 << ih->ih_irq); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, GPIO_IMR, mask); + splx(s); +} + +void +imxgpio_intr_disable(void *cookie) +{ + struct intrhand *ih = cookie; + struct imxgpio_softc *sc = ih->ih_sc; + uint32_t mask; + int s; + + s = splhigh(); + mask = bus_space_read_4(sc->sc_iot, sc->sc_ioh, GPIO_IMR); + mask &= ~(1 << ih->ih_irq); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, GPIO_IMR, mask); + splx(s); +} |