gpio/tegra: add devicetree support
authorGrant Likely <grant.likely@secretlab.ca>
Wed, 15 Jun 2011 20:54:14 +0000 (14:54 -0600)
committerGrant Likely <grant.likely@secretlab.ca>
Wed, 15 Jun 2011 20:54:14 +0000 (14:54 -0600)
Add support for decoding gpios from the device tree

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Olof Johansson <olof@lixom.net>
Documentation/devicetree/bindings/gpio/gpio_nvidia.txt [new file with mode: 0644]
drivers/gpio/gpio-tegra.c

diff --git a/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt b/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt
new file mode 100644 (file)
index 0000000..afb3ff3
--- /dev/null
@@ -0,0 +1,7 @@
+NVIDIA Tegra 2 GPIO controller
+
+Required properties:
+- compatible : "nvidia,tegra250-gpio"
+- #gpio-cells : Should be two. The first cell is the pin number and the
+  second cell is used to specify optional parameters (currently unused).
+- gpio-controller : Marks the device node as a GPIO controller.
index 919d63837736e357fe1ae8706ade2f4e4f84d3d8..13afb881ffc3a87621e3943ff176d0daca67da51 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/of.h>
 
 #include <asm/mach/irq.h>
 
@@ -340,6 +341,15 @@ static int __init tegra_gpio_init(void)
                }
        }
 
+#ifdef CONFIG_OF_GPIO
+       /*
+        * This isn't ideal, but it gets things hooked up until this
+        * driver is converted into a platform_device
+        */
+       tegra_gpio_chip.of_node = of_find_compatible_node(NULL, NULL,
+                                               "nvidia,tegra250-gpio");
+#endif /* CONFIG_OF_GPIO */
+
        gpiochip_add(&tegra_gpio_chip);
 
        for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) {