ralink: add pinctrl driver
[openwrt/staging/wigyori.git] / target / linux / ramips / patches-3.10 / 0006-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch
index cd4f38f925531752321bfc50719b086e279101cd..19d592bde237b70b2aed0c5ba4c7079b04e40aac 100644 (file)
@@ -19,9 +19,11 @@ Cc: linux-gpio@vger.kernel.org
  create mode 100644 arch/mips/include/asm/mach-ralink/gpio.h
  create mode 100644 drivers/gpio/gpio-ralink.c
 
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -444,6 +444,7 @@ config RALINK
+Index: linux-3.10.9/arch/mips/Kconfig
+===================================================================
+--- linux-3.10.9.orig/arch/mips/Kconfig        2013-08-26 17:48:27.481164281 +0200
++++ linux-3.10.9/arch/mips/Kconfig     2013-08-27 23:15:40.751965869 +0200
+@@ -444,6 +444,7 @@
        select SYS_HAS_EARLY_PRINTK
        select HAVE_MACH_CLKDEV
        select CLKDEV_LOOKUP
@@ -29,8 +31,10 @@ Cc: linux-gpio@vger.kernel.org
  
  config SGI_IP22
        bool "SGI IP22 (Indy/Indigo2)"
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ralink/gpio.h
+Index: linux-3.10.9/arch/mips/include/asm/mach-ralink/gpio.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.9/arch/mips/include/asm/mach-ralink/gpio.h      2013-08-26 17:48:30.941164428 +0200
 @@ -0,0 +1,24 @@
 +/*
 + *  Ralink SoC GPIO API support
@@ -56,9 +60,11 @@ Cc: linux-gpio@vger.kernel.org
 +#define gpio_to_irq   __gpio_to_irq
 +
 +#endif /* __ASM_MACH_RALINK_GPIO_H */
---- a/drivers/gpio/Kconfig
-+++ b/drivers/gpio/Kconfig
-@@ -209,6 +209,12 @@ config GPIO_RCAR
+Index: linux-3.10.9/drivers/gpio/Kconfig
+===================================================================
+--- linux-3.10.9.orig/drivers/gpio/Kconfig     2013-08-21 00:40:47.000000000 +0200
++++ linux-3.10.9/drivers/gpio/Kconfig  2013-08-26 17:48:30.941164428 +0200
+@@ -209,6 +209,12 @@
        help
          Say yes here to support GPIO on Renesas R-Car SoCs.
  
@@ -71,9 +77,11 @@ Cc: linux-gpio@vger.kernel.org
  config GPIO_SPEAR_SPICS
        bool "ST SPEAr13xx SPI Chip Select as GPIO support"
        depends on PLAT_SPEAR
---- a/drivers/gpio/Makefile
-+++ b/drivers/gpio/Makefile
-@@ -56,6 +56,7 @@ obj-$(CONFIG_GPIO_PCF857X)   += gpio-pcf85
+Index: linux-3.10.9/drivers/gpio/Makefile
+===================================================================
+--- linux-3.10.9.orig/drivers/gpio/Makefile    2013-08-21 00:40:47.000000000 +0200
++++ linux-3.10.9/drivers/gpio/Makefile 2013-08-26 17:48:30.941164428 +0200
+@@ -56,6 +56,7 @@
  obj-$(CONFIG_GPIO_PCH)                += gpio-pch.o
  obj-$(CONFIG_GPIO_PL061)      += gpio-pl061.o
  obj-$(CONFIG_GPIO_PXA)                += gpio-pxa.o
@@ -81,9 +89,11 @@ Cc: linux-gpio@vger.kernel.org
  obj-$(CONFIG_GPIO_RC5T583)    += gpio-rc5t583.o
  obj-$(CONFIG_GPIO_RDC321X)    += gpio-rdc321x.o
  obj-$(CONFIG_GPIO_RCAR)               += gpio-rcar.o
---- /dev/null
-+++ b/drivers/gpio/gpio-ralink.c
-@@ -0,0 +1,337 @@
+Index: linux-3.10.9/drivers/gpio/gpio-ralink.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10.9/drivers/gpio/gpio-ralink.c    2013-08-27 22:37:34.999868257 +0200
+@@ -0,0 +1,345 @@
 +/*
 + * This program is free software; you can redistribute it and/or modify it
 + * under the terms of the GNU General Public License version 2 as published
@@ -337,6 +347,13 @@ Cc: linux-gpio@vger.kernel.org
 +      dev_info(rg->chip.dev, "registering %d irq handlers\n", rg->chip.ngpio);
 +}
 +
++static int ralink_gpio_request(struct gpio_chip *chip, unsigned offset)
++{
++      int gpio = chip->base + offset;
++
++      return pinctrl_request_gpio(gpio);
++}
++
 +static int ralink_gpio_probe(struct platform_device *pdev)
 +{
 +      struct device_node *np = pdev->dev.of_node;
@@ -388,6 +405,7 @@ Cc: linux-gpio@vger.kernel.org
 +      rg->chip.direction_output = ralink_gpio_direction_output;
 +      rg->chip.get = ralink_gpio_get;
 +      rg->chip.set = ralink_gpio_set;
++      rg->chip.request = ralink_gpio_request;
 +      rg->chip.to_irq = ralink_gpio_to_irq;
 +
 +      /* set polarity to low for all lines */