aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-4.4
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2016-12-18 13:54:17 +0100
committerJonas Gorski <jonas.gorski@gmail.com>2017-02-09 14:30:43 +0100
commitdd7079e79a94fdde2e0ff4c1d6f428f3b115211c (patch)
tree63537ed0cd61d71a8983ff564104220110cd8906 /target/linux/brcm63xx/patches-4.4
parent94bbd1f057c5fdccc3a6ef80b1c533064220a2ff (diff)
downloadupstream-dd7079e79a94fdde2e0ff4c1d6f428f3b115211c.tar.gz
upstream-dd7079e79a94fdde2e0ff4c1d6f428f3b115211c.tar.bz2
upstream-dd7079e79a94fdde2e0ff4c1d6f428f3b115211c.zip
brcm63xx: implement gpio_to_irq for bcm63xx-gpio
Add support for mapping some GPIO lines to IRQs. GPIO to IRQ mappings were found out through experimentation, helped by having the GPIO as output still toggling the IRQ input. Based-on: http://patchwork.ozlabs.org/patch/660534/ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/brcm63xx/patches-4.4')
-rw-r--r--target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch14
1 files changed, 13 insertions, 1 deletions
diff --git a/target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch b/target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
index 28930d0f9f..cd613f5e7b 100644
--- a/target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
+++ b/target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
@@ -40,7 +40,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o
--- /dev/null
+++ b/drivers/gpio/gpio-bcm63xx.c
-@@ -0,0 +1,122 @@
+@@ -0,0 +1,134 @@
+/*
+ * Driver for BCM63XX memory-mapped GPIO controllers, based on
+ * Generic driver for memory-mapped GPIO controllers.
@@ -73,8 +73,17 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+#include <linux/mod_devicetable.h>
+#include <linux/basic_mmio_gpio.h>
+#include <linux/of.h>
++#include <linux/of_irq.h>
+#include <linux/of_gpio.h>
+
++static int bcm63xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
++{
++ char irq_name[7]; /* "gpioXX" */
++
++ sprintf(irq_name, "gpio%d", gpio);
++ return of_irq_get_byname(chip->of_node, irq_name);
++}
++
+static int bcm63xx_gpio_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
@@ -126,6 +135,9 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+ if (!of_property_read_u32(dev->of_node, "ngpios", &ngpios))
+ bgc->gc.ngpio = ngpios;
+
++ if (of_get_property(dev->of_node, "interrupt-names", NULL))
++ bgc->gc.to_irq = bcm63xx_gpio_to_irq;
++
+ } else if (pdata) {
+ bgc->gc.base = pdata->base;
+ if (pdata->ngpio > 0)