summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2025-01-09 21:52:26 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2025-01-09 21:52:26 +0000
commitdcc66fb4a0ddcc22142e48316348b923057f6fe3 (patch)
tree3179da5da881e606ad7371cdca015bfd1eaf37b9 /sys
parentc3836835c914b731e37626dc6b03808ad33e5af1 (diff)
Implement support for using GPIO pins as interrupt pins in qcgpio(4).
ok kn@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/fdt/qcgpio_fdt.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/fdt/qcgpio_fdt.c b/sys/dev/fdt/qcgpio_fdt.c
index e4a5443e906..6901cb89b5b 100644
--- a/sys/dev/fdt/qcgpio_fdt.c
+++ b/sys/dev/fdt/qcgpio_fdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qcgpio_fdt.c,v 1.4 2024/07/02 19:43:52 patrick Exp $ */
+/* $OpenBSD: qcgpio_fdt.c,v 1.5 2025/01/09 21:52:25 kettenis Exp $ */
/*
* Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org>
*
@@ -86,6 +86,8 @@ const struct cfattach qcgpio_fdt_ca = {
void qcgpio_fdt_config_pin(void *, uint32_t *, int);
int qcgpio_fdt_get_pin(void *, uint32_t *);
void qcgpio_fdt_set_pin(void *, uint32_t *, int);
+void *qcgpio_fdt_intr_establish_pin(void *, uint32_t *, int,
+ struct cpu_info *, int (*)(void *), void *, char *);
void *qcgpio_fdt_intr_establish(void *, int *, int, struct cpu_info *,
int (*)(void *), void *, char *);
@@ -136,6 +138,7 @@ qcgpio_fdt_attach(struct device *parent, struct device *self, void *aux)
sc->sc_gc.gc_config_pin = qcgpio_fdt_config_pin;
sc->sc_gc.gc_get_pin = qcgpio_fdt_get_pin;
sc->sc_gc.gc_set_pin = qcgpio_fdt_set_pin;
+ sc->sc_gc.gc_intr_establish = qcgpio_fdt_intr_establish_pin;
gpio_controller_register(&sc->sc_gc);
sc->sc_ic.ic_node = faa->fa_node;
@@ -214,6 +217,19 @@ qcgpio_fdt_set_pin(void *cookie, uint32_t *cells, int val)
}
void *
+qcgpio_fdt_intr_establish_pin(void *cookie, uint32_t *cells, int ipl,
+ struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
+{
+ struct qcgpio_softc *sc = cookie;
+ uint32_t icells[2];
+
+ icells[0] = cells[0];
+ icells[1] = 3; /* both edges */
+
+ return qcgpio_fdt_intr_establish(sc, icells, ipl, ci, func, arg, name);
+}
+
+void *
qcgpio_fdt_intr_establish(void *cookie, int *cells, int ipl,
struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{