summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-07-05 23:44:23 -0600
committerGrant Likely <grant.likely@secretlab.ca>2011-07-21 15:45:02 -0600
commit359ece7ae3a0e3640b6f40dd8caa85cf2aec7aac (patch)
tree13a7d58e7372ae269130f6bca238e497200aaf54
parentb5ef209d293c51692833b70202fee7f19931b8f8 (diff)
gpio/tegra: add devicetree support
Add support for decoding gpios from the device tree Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio_nvidia.txt7
-rw-r--r--arch/arm/mach-tegra/gpio.c10
2 files changed, 17 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt b/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt
new file mode 100644
index 00000000000..64aac39e6ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt
@@ -0,0 +1,7 @@
+NVIDIA Tegra 2 GPIO controller
+
+Required properties:
+- compatible : "nvidia,tegra20-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.
diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c
index 919d6383773..747eb40e8af 100644
--- a/arch/arm/mach-tegra/gpio.c
+++ b/arch/arm/mach-tegra/gpio.c
@@ -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,tegra20-gpio");
+#endif /* CONFIG_OF_GPIO */
+
gpiochip_add(&tegra_gpio_chip);
for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) {