Re: Armadaxp GPIO interrupts

From: Andrew Lunn
Date: Thu Aug 06 2015 - 13:20:27 EST


On Thu, Aug 06, 2015 at 10:28:12PM +0530, raghu MG wrote:
> Ok,I think I need to understand more about this gpio driver.
>
> As you said its registering chained handler,but why are they(IRQs) not
> visible in cat /proc/interrupts.

chained interrupts are never visible there. All you see are leaf
interrupts, i.e. the device interrupts. Here is my Armada XP based
WRT1900AC:

$ cat /proc/interrupts
CPU0 CPU1
16: 8959833 12783597 armada_370_xp_irq 5 Level armada_370_xp_per_cpu_tick
19: 0 0 armada_370_xp_irq 31 Level mv64xxx_i2c
20: 1453 0 armada_370_xp_irq 41 Level serial
26: 0 0 armada_370_xp_irq 45 Level ehci_hcd:usb3
27: 9682 0 armada_370_xp_irq 8 Level mvneta
28: 4 0 armada_370_xp_irq 10 Level mvneta
29: 35078 0 armada_370_xp_irq 55 Level f10a0000.sata
30: 3839 0 armada_370_xp_irq 113 Level f10d0000.nand
70: 0 0 f1018140.gpio 0 Edge WPS
71: 20 0 f1018140.gpio 1 Edge Factory Reset Button
90: 2 0 armada_370_xp_irq 51 Level f1060900.xor
91: 2 0 armada_370_xp_irq 52 Level f1060900.xor
92: 2 0 armada_370_xp_irq 94 Level f10f0900.xor
93: 2 0 armada_370_xp_irq 95 Level f10f0900.xor
94: 0 0 armada_370_xp_msi_irq 0 Edge xhci_hcd

Notice the two f1018140.gpio, which are the buttons.

> Do I need to further initialize marvell GPIO registers to trigger
> these events.

Nope, just the normal gpio API and all will work, as demonstrated by
the two buttons on my board.

> Do I need to change the polarity in polarity register to suit the
> board requirements in probe function.

Nope, you put that in the DT file:

gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&keys_pin>;
pinctrl-names = "default";

button@1 {
label = "WPS";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
};

button@2 {
label = "Factory Reset Button";
linux,code = <KEY_RESTART>;
gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
};
};

You can change GPIO_ACTIVE_HIGH to GPIO_ACTIVE_LOW if that is what you
need.

Andrew

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/