[OpenWrt-Devel] Request for comment: ATH79/AR71XX GPIO IRQ patch

Gerhard Bertelsmann info at gerhard-bertelsmann.de
Wed Feb 25 06:27:38 EST 2015


Hi,

please find below a link to use GPIO IRQ on ATH79 platform. It works but uses
an ugly way to clear the IRQ:

+static void ath79_gpio_irq(unsigned int irq, struct irq_desc *desc)
+{
+	void __iomem *base = ath79_gpio_base;
+	void __iomem *base2 = ath79_reset_base;
+	unsigned int stat = __raw_readl(base + AR71XX_GPIO_REG_INT_PENDING);
+	int irq_base = ATH79_GPIO_IRQ_BASE;
+
+	while (stat) {
+		int bit_num = __ffs(stat);
+		unsigned long bit = (1<<bit_num);
+
+		if (bit & gpio_both_edge) {
+			__raw_writel(__raw_readl(base + AR71XX_GPIO_REG_INT_POLARITY) ^ bit,
+				base + AR71XX_GPIO_REG_INT_POLARITY);
+		}
+
+		generic_handle_irq(irq_base + bit_num);
+		stat &= ~bit;
+	}
+
+	/* TODO: reset GPIO MISC INT - this is not the usual place to do this */
+	__raw_writel(1<<3, base2 + AR71XX_RESET_REG_MISC_INT_STATUS);
+	/* and flush write */
+	__raw_readl(base2 + AR71XX_RESET_REG_MISC_INT_STATUS);
+}

Could someone of you wizards have a look at the patch and (maybe) add a patch for OpenWRT trunk ?

Link to GPIO IRQ patch for ATH79:
https://raw.githubusercontent.com/GBert/openwrt-misc/master/gpio-test/src/patches-3.18/728-MIPS-ath79-add-gpio-irq.patch

Best regards

Gerd
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list