From: patrick Date: Mon, 10 Jul 2023 13:48:02 +0000 (+0000) Subject: The changes to the register layout affect the interrupt status/ack registers X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=80663c2667c9960b3abac430b24d70b0bfafc17c;p=openbsd The changes to the register layout affect the interrupt status/ack registers as well. Make use of these, otherwise it might lead to an interrupt flood. ok kettenis@ --- diff --git a/sys/dev/fdt/rkgpio.c b/sys/dev/fdt/rkgpio.c index ebfad548409..a7e9f776c97 100644 --- a/sys/dev/fdt/rkgpio.c +++ b/sys/dev/fdt/rkgpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rkgpio.c,v 1.10 2023/03/05 14:45:07 patrick Exp $ */ +/* $OpenBSD: rkgpio.c,v 1.11 2023/07/10 13:48:02 patrick Exp $ */ /* * Copyright (c) 2017 Mark Kettenis * Copyright (c) 2019 Patrick Wildt @@ -56,6 +56,9 @@ #define GPIO_INT_TYPE_H 0x0024 #define GPIO_INT_POLARITY_L 0x0028 #define GPIO_INT_POLARITY_H 0x002c +#define GPIO_INT_STATUS_V2 0x0050 +#define GPIO_PORT_EOI_L 0x0060 +#define GPIO_PORT_EOI_H 0x0064 #define GPIO_EXT_PORT 0x0070 #define GPIO_VER_ID 0x0078 #define GPIO_VER_ID_1_0 0x00000000 @@ -276,7 +279,10 @@ rkgpio_intr(void *cookie) uint32_t status, pending; int pin, s; - status = HREAD4(sc, GPIO_INT_STATUS); + if (sc->sc_version == 2) + status = HREAD4(sc, GPIO_INT_STATUS_V2); + else + status = HREAD4(sc, GPIO_INT_STATUS); pending = status; while (pending) { @@ -292,7 +298,13 @@ rkgpio_intr(void *cookie) pending &= ~(1 << pin); } - HWRITE4(sc, GPIO_PORTS_EOI, status); + if (sc->sc_version == 2) { + HWRITE4(sc, GPIO_PORT_EOI_L, + (status & 0xffff) << 16 | (status & 0xffff)); + HWRITE4(sc, GPIO_PORT_EOI_H, + status >> 16 | (status & 0xffff0000)); + } else + HWRITE4(sc, GPIO_PORTS_EOI, status); return 1; }