aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorYauhen Kharuzhy <yauhen.kharuzhy@promwad.com>2011-01-05 23:04:33 -0500
committerKukjin Kim <kgene.kim@samsung.com>2011-01-06 00:09:19 -0500
commit0536d0d087c264f0edbb911fca6fff39bb2eb71b (patch)
tree0aba95a46e004efbdc5f095366f7016898fb468f /arch/arm
parent479c4f4aba27318d64698867a18865d29e3287a6 (diff)
ARM: S3C2443: Implement GPIO pull-up/down configuration methods
S3C2443 has two-bits pull-up/pull-down configuration fields in GPIO registers, but values are differ from other SoCs with two-bits configuration. gpio-cfg-helpers.h already has prototypes for s3c2443-style pull-up/down methods, so implement them. Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-s3c2443/Kconfig1
-rw-r--r--arch/arm/mach-s3c2443/s3c2443.c7
-rw-r--r--arch/arm/plat-samsung/Kconfig6
-rw-r--r--arch/arm/plat-samsung/gpio-config.c42
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h2
5 files changed, 57 insertions, 1 deletions
diff --git a/arch/arm/mach-s3c2443/Kconfig b/arch/arm/mach-s3c2443/Kconfig
index 8814031516ce..d8eb86823df7 100644
--- a/arch/arm/mach-s3c2443/Kconfig
+++ b/arch/arm/mach-s3c2443/Kconfig
@@ -10,6 +10,7 @@ config CPU_S3C2443
10 select CPU_LLSERIAL_S3C2440 10 select CPU_LLSERIAL_S3C2440
11 select SAMSUNG_CLKSRC 11 select SAMSUNG_CLKSRC
12 select S3C2443_CLOCK 12 select S3C2443_CLOCK
13 select S3C_GPIO_PULL_S3C2443
13 help 14 help
14 Support for the S3C2443 SoC from the S3C24XX line 15 Support for the S3C2443 SoC from the S3C24XX line
15 16
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index 33d18dd1ebd5..e6a28ba52c7d 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -16,6 +16,7 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/gpio.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/serial_core.h> 21#include <linux/serial_core.h>
21#include <linux/sysdev.h> 22#include <linux/sysdev.h>
@@ -32,6 +33,9 @@
32#include <mach/regs-s3c2443-clock.h> 33#include <mach/regs-s3c2443-clock.h>
33#include <mach/reset.h> 34#include <mach/reset.h>
34 35
36#include <plat/gpio-core.h>
37#include <plat/gpio-cfg.h>
38#include <plat/gpio-cfg-helpers.h>
35#include <plat/s3c2443.h> 39#include <plat/s3c2443.h>
36#include <plat/devs.h> 40#include <plat/devs.h>
37#include <plat/cpu.h> 41#include <plat/cpu.h>
@@ -86,6 +90,9 @@ void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no)
86 90
87void __init s3c2443_map_io(void) 91void __init s3c2443_map_io(void)
88{ 92{
93 s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_s3c2443;
94 s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_s3c2443;
95
89 iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc)); 96 iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc));
90} 97}
91 98
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index dcd6eff4ee53..4ecb15531b92 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -95,6 +95,12 @@ config S3C_GPIO_PULL_UPDOWN
95 help 95 help
96 Internal configuration to enable the correct GPIO pull helper 96 Internal configuration to enable the correct GPIO pull helper
97 97
98config S3C_GPIO_PULL_S3C2443
99 bool
100 select S3C_GPIO_PULL_UPDOWN
101 help
102 Internal configuration to enable the correct GPIO pull helper for S3C2443-style GPIO
103
98config S3C_GPIO_PULL_DOWN 104config S3C_GPIO_PULL_DOWN
99 bool 105 bool
100 help 106 help
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c
index 0aa32f242ee4..1c0b0401594b 100644
--- a/arch/arm/plat-samsung/gpio-config.c
+++ b/arch/arm/plat-samsung/gpio-config.c
@@ -278,6 +278,48 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip,
278 pup &= 0x3; 278 pup &= 0x3;
279 return (__force s3c_gpio_pull_t)pup; 279 return (__force s3c_gpio_pull_t)pup;
280} 280}
281
282#ifdef CONFIG_S3C_GPIO_PULL_S3C2443
283int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip,
284 unsigned int off, s3c_gpio_pull_t pull)
285{
286 switch (pull) {
287 case S3C_GPIO_PULL_NONE:
288 pull = 0x01;
289 break;
290 case S3C_GPIO_PULL_UP:
291 pull = 0x00;
292 break;
293 case S3C_GPIO_PULL_DOWN:
294 pull = 0x02;
295 break;
296 }
297 return s3c_gpio_setpull_updown(chip, off, pull);
298}
299
300s3c_gpio_pull_t s3c_gpio_getpull_s3c2443(struct s3c_gpio_chip *chip,
301 unsigned int off)
302{
303 s3c_gpio_pull_t pull;
304
305 pull = s3c_gpio_getpull_updown(chip, off);
306
307 switch (pull) {
308 case 0x00:
309 pull = S3C_GPIO_PULL_UP;
310 break;
311 case 0x01:
312 case 0x03:
313 pull = S3C_GPIO_PULL_NONE;
314 break;
315 case 0x02:
316 pull = S3C_GPIO_PULL_DOWN;
317 break;
318 }
319
320 return pull;
321}
322#endif
281#endif 323#endif
282 324
283#if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN) 325#if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN)
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
index 0d2c5703f1ee..5603db0b79bc 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
@@ -244,7 +244,7 @@ extern int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip,
244 * This helper function reads the state of the pull-{up,down} resistor for the 244 * This helper function reads the state of the pull-{up,down} resistor for the
245 * given GPIO in the same case as s3c_gpio_setpull_upown. 245 * given GPIO in the same case as s3c_gpio_setpull_upown.
246*/ 246*/
247extern s3c_gpio_pull_t s3c_gpio_getpull_s3c24xx(struct s3c_gpio_chip *chip, 247extern s3c_gpio_pull_t s3c_gpio_getpull_s3c2443(struct s3c_gpio_chip *chip,
248 unsigned int off); 248 unsigned int off);
249 249
250#endif /* __PLAT_GPIO_CFG_HELPERS_H */ 250#endif /* __PLAT_GPIO_CFG_HELPERS_H */