summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2011-09-30 16:14:27 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-10-12 14:16:20 -0700
commitc96caf501e3f32e65ae3c2f51b65645d007e4804 (patch)
treec5079f840490deaa7bfa13b4ed81689bc3fdb9cd
parent82d02c8163f3e815aa74813b63a2f98f50b67fda (diff)
arm: tegra: gpio: API to configure pins as gpio with init value
Adding api to configure pins in gpio mode with init value before gpio library is up. This will provide to configure the pins in initial state and avoid any glitch in pins. bug 876305 Reviewed-on: http://git-master/r/56630 (cherry picked from commit 9e357b69d25f96c13acb660860bcdf8e0ab0a1ef) Change-Id: Ia14721c0bf96e1a45561139fdbbf2d995b9a4963 Reviewed-on: http://git-master/r/57265 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/gpio.c11
-rw-r--r--arch/arm/mach-tegra/include/mach/gpio.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c
index 654dec578f45..bf66fc45a155 100644
--- a/arch/arm/mach-tegra/gpio.c
+++ b/arch/arm/mach-tegra/gpio.c
@@ -130,6 +130,17 @@ void tegra_gpio_disable(int gpio)
tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 0);
}
+void tegra_gpio_init_configure(unsigned gpio, bool is_input, int value)
+{
+ if (is_input) {
+ tegra_gpio_mask_write(GPIO_MSK_OE(gpio), gpio, 0);
+ } else {
+ tegra_gpio_mask_write(GPIO_MSK_OUT(gpio), gpio, value);
+ tegra_gpio_mask_write(GPIO_MSK_OE(gpio), gpio, 1);
+ }
+ tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 1);
+}
+
static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
tegra_gpio_mask_write(GPIO_MSK_OUT(offset), offset, value);
diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
index bd53ed8cc3bb..3ec5d94214e1 100644
--- a/arch/arm/mach-tegra/include/mach/gpio.h
+++ b/arch/arm/mach-tegra/include/mach/gpio.h
@@ -65,5 +65,5 @@ void tegra_gpio_config(struct tegra_gpio_table *table, int num);
void tegra_gpio_enable(int gpio);
void tegra_gpio_disable(int gpio);
int tegra_gpio_resume_init(void);
-
+void tegra_gpio_init_configure(unsigned gpio, bool is_input, int value);
#endif