From 6f4cf779e35f5276e9ef45c1045063b365cd5968 Mon Sep 17 00:00:00 2001 From: Yauhen Kharuzhy Date: Thu, 6 Jan 2011 13:04:33 +0900 Subject: [PATCH] --- yaml --- r: 231471 b: refs/heads/master c: 0536d0d087c264f0edbb911fca6fff39bb2eb71b h: refs/heads/master i: 231469: c193c1e050cc07927965ff9643347ed5945d1891 231467: efbd2eb594598333f1eed2317dd07b2b260d731a 231463: 74037ae901064903de690852a4617d0bf597e5ea 231455: 4a72378a36855b95442c5432e5d984630f7dd2df v: v3 --- [refs] | 2 +- trunk/arch/arm/mach-s3c2443/Kconfig | 1 + trunk/arch/arm/mach-s3c2443/s3c2443.c | 7 ++++ trunk/arch/arm/plat-samsung/Kconfig | 6 +++ trunk/arch/arm/plat-samsung/gpio-config.c | 42 +++++++++++++++++++ .../include/plat/gpio-cfg-helpers.h | 2 +- 6 files changed, 58 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 15dd3f47d515..635a2fe785ab 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 479c4f4aba27318d64698867a18865d29e3287a6 +refs/heads/master: 0536d0d087c264f0edbb911fca6fff39bb2eb71b diff --git a/trunk/arch/arm/mach-s3c2443/Kconfig b/trunk/arch/arm/mach-s3c2443/Kconfig index 8814031516ce..d8eb86823df7 100644 --- a/trunk/arch/arm/mach-s3c2443/Kconfig +++ b/trunk/arch/arm/mach-s3c2443/Kconfig @@ -10,6 +10,7 @@ config CPU_S3C2443 select CPU_LLSERIAL_S3C2440 select SAMSUNG_CLKSRC select S3C2443_CLOCK + select S3C_GPIO_PULL_S3C2443 help Support for the S3C2443 SoC from the S3C24XX line diff --git a/trunk/arch/arm/mach-s3c2443/s3c2443.c b/trunk/arch/arm/mach-s3c2443/s3c2443.c index 33d18dd1ebd5..e6a28ba52c7d 100644 --- a/trunk/arch/arm/mach-s3c2443/s3c2443.c +++ b/trunk/arch/arm/mach-s3c2443/s3c2443.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,9 @@ #include #include +#include +#include +#include #include #include #include @@ -86,6 +90,9 @@ void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no) void __init s3c2443_map_io(void) { + s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_s3c2443; + s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_s3c2443; + iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc)); } diff --git a/trunk/arch/arm/plat-samsung/Kconfig b/trunk/arch/arm/plat-samsung/Kconfig index dcd6eff4ee53..4ecb15531b92 100644 --- a/trunk/arch/arm/plat-samsung/Kconfig +++ b/trunk/arch/arm/plat-samsung/Kconfig @@ -95,6 +95,12 @@ config S3C_GPIO_PULL_UPDOWN help Internal configuration to enable the correct GPIO pull helper +config S3C_GPIO_PULL_S3C2443 + bool + select S3C_GPIO_PULL_UPDOWN + help + Internal configuration to enable the correct GPIO pull helper for S3C2443-style GPIO + config S3C_GPIO_PULL_DOWN bool help diff --git a/trunk/arch/arm/plat-samsung/gpio-config.c b/trunk/arch/arm/plat-samsung/gpio-config.c index 0aa32f242ee4..1c0b0401594b 100644 --- a/trunk/arch/arm/plat-samsung/gpio-config.c +++ b/trunk/arch/arm/plat-samsung/gpio-config.c @@ -278,6 +278,48 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip, pup &= 0x3; return (__force s3c_gpio_pull_t)pup; } + +#ifdef CONFIG_S3C_GPIO_PULL_S3C2443 +int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip, + unsigned int off, s3c_gpio_pull_t pull) +{ + switch (pull) { + case S3C_GPIO_PULL_NONE: + pull = 0x01; + break; + case S3C_GPIO_PULL_UP: + pull = 0x00; + break; + case S3C_GPIO_PULL_DOWN: + pull = 0x02; + break; + } + return s3c_gpio_setpull_updown(chip, off, pull); +} + +s3c_gpio_pull_t s3c_gpio_getpull_s3c2443(struct s3c_gpio_chip *chip, + unsigned int off) +{ + s3c_gpio_pull_t pull; + + pull = s3c_gpio_getpull_updown(chip, off); + + switch (pull) { + case 0x00: + pull = S3C_GPIO_PULL_UP; + break; + case 0x01: + case 0x03: + pull = S3C_GPIO_PULL_NONE; + break; + case 0x02: + pull = S3C_GPIO_PULL_DOWN; + break; + } + + return pull; +} +#endif #endif #if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN) diff --git a/trunk/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h b/trunk/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h index 0d2c5703f1ee..5603db0b79bc 100644 --- a/trunk/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h +++ b/trunk/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, * This helper function reads the state of the pull-{up,down} resistor for the * given GPIO in the same case as s3c_gpio_setpull_upown. */ -extern s3c_gpio_pull_t s3c_gpio_getpull_s3c24xx(struct s3c_gpio_chip *chip, +extern s3c_gpio_pull_t s3c_gpio_getpull_s3c2443(struct s3c_gpio_chip *chip, unsigned int off); #endif /* __PLAT_GPIO_CFG_HELPERS_H */