[source] brcm63xx: implement gpio_to_irq for bcm63xx-gpio
LEDE Commits
lede-commits at lists.infradead.org
Thu Feb 9 05:31:21 PST 2017
jogo pushed a commit to source.git, branch master:
https://git.lede-project.org/dd7079e79a94fdde2e0ff4c1d6f428f3b115211c
commit dd7079e79a94fdde2e0ff4c1d6f428f3b115211c
Author: Jonas Gorski <jonas.gorski at gmail.com>
AuthorDate: Sun Dec 18 13:54:17 2016 +0100
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 at gmail.com>
---
target/linux/brcm63xx/dts/bcm6318.dtsi | 4 ++++
target/linux/brcm63xx/dts/bcm63268.dtsi | 4 ++++
target/linux/brcm63xx/dts/bcm6328.dtsi | 5 +++++
target/linux/brcm63xx/dts/bcm6348.dtsi | 4 ++++
target/linux/brcm63xx/dts/bcm6358.dtsi | 9 +++++++++
target/linux/brcm63xx/dts/bcm6362.dtsi | 5 +++++
target/linux/brcm63xx/dts/bcm6368.dtsi | 9 +++++++++
.../374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch | 14 +++++++++++++-
8 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/target/linux/brcm63xx/dts/bcm6318.dtsi b/target/linux/brcm63xx/dts/bcm6318.dtsi
index 7766980..0371617 100644
--- a/target/linux/brcm63xx/dts/bcm6318.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6318.dtsi
@@ -65,6 +65,10 @@
#gpio-cells = <2>;
ngpios = <18>;
+
+ interrupt-parent = <&ext_intc>;
+ interrupts = <0 0>, <1 0>;
+ interrupt-names = "gpio1", "gpio2";
};
gpio0: gpio-controller at 10000084 {
diff --git a/target/linux/brcm63xx/dts/bcm63268.dtsi b/target/linux/brcm63xx/dts/bcm63268.dtsi
index 47894f8..5a0a909 100644
--- a/target/linux/brcm63xx/dts/bcm63268.dtsi
+++ b/target/linux/brcm63xx/dts/bcm63268.dtsi
@@ -72,6 +72,10 @@
#gpio-cells = <2>;
ngpios = <20>;
+
+ interrupt-parent = <&periph_intc>;
+ interrupts = <0 0>, <1 0>, <2 0>, <3 0>;
+ interrupt-names = "gpio0", "gpio1", "gpio2", "gpio3";
};
gpio0: gpio-controller at 100000c4 {
diff --git a/target/linux/brcm63xx/dts/bcm6328.dtsi b/target/linux/brcm63xx/dts/bcm6328.dtsi
index b49958a..5eec6de 100644
--- a/target/linux/brcm63xx/dts/bcm6328.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6328.dtsi
@@ -62,6 +62,11 @@
gpio-controller;
#gpio-cells = <2>;
+
+ interrupt-parent = <&ext_intc>;
+ interrupts = <3 0>, <2 0>, <0 0>, <1 0>;
+ interrupt-names = "gpio12", "gpio15",
+ "gpio23", "gpio24";
};
};
};
diff --git a/target/linux/brcm63xx/dts/bcm6348.dtsi b/target/linux/brcm63xx/dts/bcm6348.dtsi
index 7edda30..d1219c0 100644
--- a/target/linux/brcm63xx/dts/bcm6348.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6348.dtsi
@@ -78,6 +78,10 @@
#gpio-cells = <2>;
ngpios = <5>;
+
+ interrupt-parent = <&ext_intc>;
+ interrupts = <0 0>, <1 0>, <2 0>, <3 0>;
+ interrupt-names = "gpio0", "gpio1", "gpio2", "gpio3";
};
gpio0: gpio-controller at fffe0404 {
diff --git a/target/linux/brcm63xx/dts/bcm6358.dtsi b/target/linux/brcm63xx/dts/bcm6358.dtsi
index fa0b5b8..9d95849 100644
--- a/target/linux/brcm63xx/dts/bcm6358.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6358.dtsi
@@ -94,6 +94,15 @@
#gpio-cells = <2>;
ngpios = <8>;
+
+ interrupts-extended = <&ext_intc1 0 0>,
+ <&ext_intc1 1 0>,
+ <&ext_intc0 0 0>,
+ <&ext_intc0 1 0>,
+ <&ext_intc0 2 0>,
+ <&ext_intc0 3 0>;
+ interrupt-names = "gpio0", "gpio1", "gpio2", "gpio3",
+ "gpio4", "gpio5";
};
gpio0: gpio-controller at fffe0084 {
diff --git a/target/linux/brcm63xx/dts/bcm6362.dtsi b/target/linux/brcm63xx/dts/bcm6362.dtsi
index 40f6b9e..a6a5c1f 100644
--- a/target/linux/brcm63xx/dts/bcm6362.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6362.dtsi
@@ -80,6 +80,11 @@
gpio-controller;
#gpio-cells = <2>;
+
+ interrupt-parent = <&ext_intc>;
+ interrupts = <0 0>, <1 0>, <2 0>, <3 0>;
+ interrupt-names = "gpio24", "gpio25",
+ "gpio26", "gpio27";
};
};
};
diff --git a/target/linux/brcm63xx/dts/bcm6368.dtsi b/target/linux/brcm63xx/dts/bcm6368.dtsi
index 52bcec4..59ef41a 100644
--- a/target/linux/brcm63xx/dts/bcm6368.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6368.dtsi
@@ -84,6 +84,15 @@
#gpio-cells = <2>;
ngpios = <6>;
+
+ interrupts-extended = <&ext_intc1 0 0>,
+ <&ext_intc1 1 0>,
+ <&ext_intc0 0 0>,
+ <&ext_intc0 1 0>,
+ <&ext_intc0 2 0>,
+ <&ext_intc0 3 0>;
+ interrupt-names = "gpio0", "gpio1", "gpio2", "gpio3",
+ "gpio4", "gpio5";
};
gpio0: gpio-controller at 10000084 {
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 28930d0..cd613f5 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 at 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 at 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 at 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)
More information about the lede-commits
mailing list