Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bcmgpio_fdt_intrstr: interrupt type
I am sorry, I send a wrong patch.
This one is ok.
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)
{
/* 1st cell is the GPIO number */
- /* 3rd cell is flags */
+ /* 2rd 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";
+ 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