Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bcmgpio_fdt_intrstr: interrupt type
> De : Martin Husemann <martin%duskware.de@localhost>
> À : yarl-baudig%mailoo.org@localhost
> 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@localhost 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.
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@localhost>
/* 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@localhost>";
+ 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);
}
Home |
Main Index |
Thread Index |
Old Index