aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2010-10-01 03:34:34 -0400
committerKukjin Kim <kgene.kim@samsung.com>2010-10-22 22:49:57 -0400
commit5459148b098e3bbdc24376f1865045189a80a0af (patch)
treee303832cf0f25a91cf4ff5a05678304d1dda994c
parentce5d3ac1f57b7a4ff28c57ebef709b8f9fd30fab (diff)
ARM: SAMSUNG: Add s3c_gpio_cfgall_range() function
Add a function to configure a range of GPIOs function and pull in one go, mainly for the SDHCI and framebuffer helpers which tend to do this. Signed-off-by: Ben Dooks <ben-linux@fluff.org> [kgene.kim@samsung.com: Fix small comments] Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r--arch/arm/plat-samsung/gpio-config.c16
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg.h19
2 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c
index fa180dcc41ce..8a372110a850 100644
--- a/arch/arm/plat-samsung/gpio-config.c
+++ b/arch/arm/plat-samsung/gpio-config.c
@@ -56,6 +56,22 @@ int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
56} 56}
57EXPORT_SYMBOL_GPL(s3c_gpio_cfgpin_range); 57EXPORT_SYMBOL_GPL(s3c_gpio_cfgpin_range);
58 58
59int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
60 unsigned int cfg, s3c_gpio_pull_t pull)
61{
62 int ret;
63
64 for (; nr > 0; nr--, start++) {
65 s3c_gpio_setpull(start, pull);
66 ret = s3c_gpio_cfgpin(start, cfg);
67 if (ret != 0)
68 return ret;
69 }
70
71 return 0;
72}
73EXPORT_SYMBOL_GPL(s3c_gpio_cfgall_range);
74
59unsigned s3c_gpio_getcfg(unsigned int pin) 75unsigned s3c_gpio_getcfg(unsigned int pin)
60{ 76{
61 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); 77 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
index 6e117dc2709b..c84defd29502 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
@@ -153,6 +153,25 @@ extern int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull);
153*/ 153*/
154extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin); 154extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin);
155 155
156/* configure `all` aspects of an gpio */
157
158/**
159 * s3c_gpio_cfgall_range() - configure range of gpio functtion and pull.
160 * @start: The gpio number to start at.
161 * @nr: The number of gpio to configure from @start.
162 * @cfg: The configuration to use
163 * @pull: The pull setting to use.
164 *
165 * Run s3c_gpio_cfgpin() and s3c_gpio_setpull() over the gpio range starting
166 * @gpio and running for @size.
167 *
168 * @sa s3c_gpio_cfgpin
169 * @sa s3c_gpio_setpull
170 * @sa s3c_gpio_cfgpin_range
171 */
172extern int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
173 unsigned int cfg, s3c_gpio_pull_t pull);
174
156/* Define values for the drvstr available for each gpio pin. 175/* Define values for the drvstr available for each gpio pin.
157 * 176 *
158 * These values control the value of the output signal driver strength, 177 * These values control the value of the output signal driver strength,