aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/include/mach/gpio.h
diff options
context:
space:
mode:
authorCyril Chemparathy <cyril@ti.com>2010-05-18 12:51:20 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-06-21 15:48:31 -0400
commitd92c7962470b699ef7a697524b9a679846e9e15b (patch)
treebb0045e061b4905a965b799d6a9139f1e2b1bd39 /arch/arm/mach-davinci/include/mach/gpio.h
parent4d1e78480cc5b5937c9384e47a0b2b0cdf117da4 (diff)
Davinci: tnetv107x initial gpio support
This patch adds support for the tnetv107x gpio controller. Key differences between davinci and tnetv107x controllers: - register map - davinci's controller is organized into banks of 32 gpios, tnetv107x has a single space with arrays of registers for in, out, direction, etc. - davinci's controller has separate set/clear registers for output, tnetv107x has a single direct mapped register. This patch does not yet add gpio irq support on this controller. Signed-off-by: Cyril Chemparathy <cyril@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/include/mach/gpio.h')
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
index 504cc180a60b..fbece126c2bf 100644
--- a/arch/arm/mach-davinci/include/mach/gpio.h
+++ b/arch/arm/mach-davinci/include/mach/gpio.h
@@ -25,6 +25,7 @@
25 25
26enum davinci_gpio_type { 26enum davinci_gpio_type {
27 GPIO_TYPE_DAVINCI = 0, 27 GPIO_TYPE_DAVINCI = 0,
28 GPIO_TYPE_TNETV107X,
28}; 29};
29 30
30/* 31/*
@@ -87,9 +88,13 @@ static inline u32 __gpio_mask(unsigned gpio)
87 return 1 << (gpio % 32); 88 return 1 << (gpio % 32);
88} 89}
89 90
90/* The get/set/clear functions will inline when called with constant 91/*
92 * The get/set/clear functions will inline when called with constant
91 * parameters referencing built-in GPIOs, for low-overhead bitbanging. 93 * parameters referencing built-in GPIOs, for low-overhead bitbanging.
92 * 94 *
95 * gpio_set_value() will inline only on traditional Davinci style controllers
96 * with distinct set/clear registers.
97 *
93 * Otherwise, calls with variable parameters or referencing external 98 * Otherwise, calls with variable parameters or referencing external
94 * GPIOs (e.g. on GPIO expander chips) use outlined functions. 99 * GPIOs (e.g. on GPIO expander chips) use outlined functions.
95 */ 100 */
@@ -100,12 +105,15 @@ static inline void gpio_set_value(unsigned gpio, int value)
100 u32 mask; 105 u32 mask;
101 106
102 ctlr = __gpio_to_controller(gpio); 107 ctlr = __gpio_to_controller(gpio);
103 mask = __gpio_mask(gpio); 108
104 if (value) 109 if (ctlr->set_data != ctlr->clr_data) {
105 __raw_writel(mask, ctlr->set_data); 110 mask = __gpio_mask(gpio);
106 else 111 if (value)
107 __raw_writel(mask, ctlr->clr_data); 112 __raw_writel(mask, ctlr->set_data);
108 return; 113 else
114 __raw_writel(mask, ctlr->clr_data);
115 return;
116 }
109 } 117 }
110 118
111 __gpio_set_value(gpio, value); 119 __gpio_set_value(gpio, value);