aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2016-07-01 11:22:08 +0200
committerJonas Gorski <jonas.gorski@gmail.com>2017-06-10 12:40:37 +0200
commitf9b7bfa088a9293959bc25eefa6a764736190661 (patch)
tree3209cbbd4c18ae02b6600c83698594fc0ae8e7b7 /target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch
parent5e4bb476c0cc46dedc020a802f045d479e483857 (diff)
downloadupstream-f9b7bfa088a9293959bc25eefa6a764736190661.tar.gz
upstream-f9b7bfa088a9293959bc25eefa6a764736190661.tar.bz2
upstream-f9b7bfa088a9293959bc25eefa6a764736190661.zip
brcm63xx: backport upstream generic gpio changes
Backport patches that add a data pointer to gpio_chip. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch')
-rw-r--r--target/linux/brcm63xx/patches-4.4/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch35
1 files changed, 18 insertions, 17 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 cd613f5e7b..c138e0e461 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
@@ -8,7 +8,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
drivers/gpio/Kconfig | 8 +++
drivers/gpio/Makefile | 1 +
- drivers/gpio/gpio-bcm63xx.c | 122 +++++++++++++++++++++++++++++++++++++++++++
+ drivers/gpio/gpio-bcm63xx.c | 135 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 131 insertions(+)
create mode 100644 drivers/gpio/gpio-bcm63xx.c
@@ -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,134 @@
+@@ -0,0 +1,135 @@
+/*
+ * Driver for BCM63XX memory-mapped GPIO controllers, based on
+ * Generic driver for memory-mapped GPIO controllers.
@@ -68,10 +68,10 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+#include <linux/ioport.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
++#include <linux/gpio/driver.h>
+#include <linux/slab.h>
+#include <linux/platform_device.h>
+#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>
@@ -92,7 +92,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+ void __iomem *dirout;
+ unsigned long sz;
+ int err;
-+ struct bgpio_chip *bgc;
++ struct gpio_chip *gc;
+ struct bgpio_pdata *pdata = dev_get_platdata(dev);
+
+ dirout_r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -113,45 +113,46 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+ if (IS_ERR(dirout))
+ return PTR_ERR(dirout);
+
-+ bgc = devm_kzalloc(&pdev->dev, sizeof(*bgc), GFP_KERNEL);
-+ if (!bgc)
++ gc = devm_kzalloc(&pdev->dev, sizeof(*gc), GFP_KERNEL);
++ if (!gc)
+ return -ENOMEM;
+
-+ err = bgpio_init(bgc, dev, sz, dat, NULL, NULL, dirout, NULL,
++ err = bgpio_init(gc, dev, sz, dat, NULL, NULL, dirout, NULL,
+ BGPIOF_BIG_ENDIAN_BYTE_ORDER);
+ if (err)
+ return err;
+
-+ platform_set_drvdata(pdev, bgc);
++ platform_set_drvdata(pdev, gc);
+
+ if (dev->of_node) {
+ int id = of_alias_get_id(dev->of_node, "gpio");
+ u32 ngpios;
+
+ if (id >= 0)
-+ bgc->gc.label = devm_kasprintf(dev, GFP_KERNEL,
-+ "bcm63xx-gpio.%d", id);
++ gc->label = devm_kasprintf(dev, GFP_KERNEL,
++ "bcm63xx-gpio.%d", id);
+
+ if (!of_property_read_u32(dev->of_node, "ngpios", &ngpios))
-+ bgc->gc.ngpio = ngpios;
++ gc->ngpio = ngpios;
+
+ if (of_get_property(dev->of_node, "interrupt-names", NULL))
-+ bgc->gc.to_irq = bcm63xx_gpio_to_irq;
++ gc->to_irq = bcm63xx_gpio_to_irq;
+
+ } else if (pdata) {
-+ bgc->gc.base = pdata->base;
++ gc->base = pdata->base;
+ if (pdata->ngpio > 0)
-+ bgc->gc.ngpio = pdata->ngpio;
++ gc->ngpio = pdata->ngpio;
+ }
+
-+ return gpiochip_add(&bgc->gc);
++ return gpiochip_add(gc);
+}
+
+static int bcm63xx_gpio_remove(struct platform_device *pdev)
+{
-+ struct bgpio_chip *bgc = platform_get_drvdata(pdev);
++ struct gpio_chip *gc = platform_get_drvdata(pdev);
+
-+ return bgpio_remove(bgc);
++ gpiochip_remove(gc);
++ return 0;
+}
+
+#ifdef CONFIG_OF