-/* $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>
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 = {
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");
}
}
}
+
+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);
+}