[prev in list] [next in list] [prev in thread] [next in thread]
List: netbsd-port-arm
Subject: Re: bcmgpio_fdt_intrstr: interrupt type
From: yarl-baudig () mailoo ! org
Date: 2019-04-27 8:52:33
Message-ID: ea-mime-5cc41851-7ed9-39e3b931 () www-1 ! net-c ! com
[Download RAW message or body]
> De : Martin Husemann <martin@duskware.de>
> À : yarl-baudig@mailoo.org
> Sujet : Re: bcmgpio_fdt_intrstr: interrupt type
> Date : 27/04/2019 09:04:07 Europe/Paris
>
> On Sat, Apr 27, 2019 at 07:25:32AM +0200, yarl-baudig@mailoo.org wrote:
> > /* 1st cell is the GPIO number */
> > - /* 3rd cell is flags */
> > + /* 2rd cell is flags */
>
> Minor nit: it is 1st, 2nd, 3rd (for first, second, third)
>
> Martin
>
Right, thank you.
["bcmgpio_fdt_intrstr.patch" (text/x-patch)]
diff --git a/sys/arch/arm/broadcom/bcm2835_gpio.c b/sys/arch/arm/broadcom/bcm2835_gpio.c
index 367625c1d3af..527ec7a786cf 100644
--- a/sys/arch/arm/broadcom/bcm2835_gpio.c
+++ b/sys/arch/arm/broadcom/bcm2835_gpio.c
@@ -671,16 +671,40 @@ bcmgpio_fdt_intrstr(device_t dev, u_int *specifier, char *buf, size_t buflen)
{
"Martin Husemann" <martin@duskware.de>
/* 1st cell is the GPIO number */
- /* 3rd cell is flags */
+ /* 2nd cell is flags */
if (!specifier)
return (false);
const u_int bank = be32toh(specifier[0]) / 32;
const u_int pin = be32toh(specifier[0]) % 32;
+ const u_int type = be32toh(specifier[1]) & 0xf;
+ char const* typestr;
if (bank >= BCMGPIO_NBANKS)
return (false);
+ switch (type) {
+ case FDT_INTR_TYPE_DOUBLE_EDGE:
+ typestr = "double edge";
+ break;
+ case FDT_INTR_TYPE_POS_EDGE:
+ typestr = "positive edge";
+ break;
+ case FDT_INTR_TYPE_NEG_EDGE:
+ typestr = "negative edge";
+ break;
+ case FDT_INTR_TYPE_HIGH_LEVEL:
+ typestr = "high level"Martin Husemann" <martin@duskware.de>";
+ break;
+ case FDT_INTR_TYPE_LOW_LEVEL:
+ typestr = "low level";
+ break;
+ default:
+ aprint_error_dev(dev, "%s: unsupported irq type 0x%x\n",
+ __func__, type);
+
+ return (false);
+ }
- snprintf(buf, buflen, "GPIO %u", (bank * 32) + pin);
+ snprintf(buf, buflen, "GPIO %u (%s)", (bank * 32) + pin, typestr);
return (true);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic