From: patrick Date: Thu, 10 Nov 2022 12:16:06 +0000 (+0000) Subject: Remove hack that uses a timeout to fake interrupts now that qcpdc(4) allows X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1df9b8456c49d2f0f685411e44d6ace0cf83d41b;p=openbsd Remove hack that uses a timeout to fake interrupts now that qcpdc(4) allows us to properly establish interrupts. The fixed IPL_BIO should probably be replaced by the highest IPL requested by our children. ok kettenis@ --- diff --git a/sys/dev/fdt/qcspmi.c b/sys/dev/fdt/qcspmi.c index a837b6fdde8..697dcc69657 100644 --- a/sys/dev/fdt/qcspmi.c +++ b/sys/dev/fdt/qcspmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qcspmi.c,v 1.1 2022/11/08 19:34:54 patrick Exp $ */ +/* $OpenBSD: qcspmi.c,v 1.2 2022/11/10 12:16:06 patrick Exp $ */ /* * Copyright (c) 2022 Patrick Wildt * @@ -18,7 +18,6 @@ #include #include #include -#include #include #include @@ -139,6 +138,7 @@ struct qcspmi_softc { bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh[QCSPMI_REG_MAX]; + void *sc_ih; int sc_ee; @@ -149,8 +149,6 @@ struct qcspmi_softc { struct interrupt_controller sc_ic; TAILQ_HEAD(,qcspmi_intrhand) sc_intrq; - - struct timeout sc_tick; }; int qcspmi_match(struct device *, void *, void *); @@ -170,8 +168,6 @@ void qcspmi_intr_barrier(void *); int qcspmi_pin_intr(struct qcspmi_softc *, int); int qcspmi_intr(void *); -void qcspmi_tick(void *); - const struct cfattach qcspmi_ca = { sizeof(struct qcspmi_softc), qcspmi_match, qcspmi_attach }; @@ -232,6 +228,13 @@ qcspmi_attach(struct device *parent, struct device *self, void *aux) TAILQ_INIT(&sc->sc_intrq); + sc->sc_ih = fdt_intr_establish(sc->sc_node, IPL_BIO, qcspmi_intr, + sc, sc->sc_dev.dv_xname); + if (sc->sc_ih == NULL) { + printf(": can't establish interrupt\n"); + return; + } + printf("\n"); for (i = 0; i < SPMI_MAX_PERIPH; i++) { @@ -290,10 +293,6 @@ qcspmi_attach(struct device *parent, struct device *self, void *aux) sa.sa_node = node; config_found(self, &sa, qcspmi_print); } - - /* TODO: implement interrupts */ - timeout_set(&sc->sc_tick, qcspmi_tick, sc); - timeout_add_sec(&sc->sc_tick, 1); } int @@ -557,12 +556,10 @@ qcspmi_intr_disable(void *cookie) void qcspmi_intr_barrier(void *cookie) { -#if 0 struct qcspmi_intrhand *ih = cookie; struct qcspmi_softc *sc = ih->ih_sc; intr_barrier(sc->sc_ih); -#endif } int @@ -604,12 +601,3 @@ qcspmi_intr(void *arg) return handled; } - -void -qcspmi_tick(void *arg) -{ - struct qcspmi_softc *sc = arg; - - qcspmi_intr(arg); - timeout_add_sec(&sc->sc_tick, 1); -}