diff options
author | Ben Dooks <ben-linux@fluff.org> | 2010-05-03 01:39:45 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-05-05 20:25:57 -0400 |
commit | 1ec7269fd8b05044f2cb4059b679e053d57460f5 (patch) | |
tree | 20addcc19fac614b2954fc1b126d9ae5ca38485e /arch/arm/plat-samsung | |
parent | 9bbb851c7079ff670ba3fe6c7ce93bb5daa9a694 (diff) |
ARM: S3C24XX: Add the gpio pull configuration for pull-up
Add the necessary gpio configuration helper for the devices which
have a single-bit pull-up resistor disabled.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r-- | arch/arm/plat-samsung/gpio-config.c | 32 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h | 11 |
2 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c index c5832824e198..8aca88d6c486 100644 --- a/arch/arm/plat-samsung/gpio-config.c +++ b/arch/arm/plat-samsung/gpio-config.c | |||
@@ -164,3 +164,35 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip, | |||
164 | return (__force s3c_gpio_pull_t)pup; | 164 | return (__force s3c_gpio_pull_t)pup; |
165 | } | 165 | } |
166 | #endif | 166 | #endif |
167 | |||
168 | #ifdef CONFIG_S3C_GPIO_PULL_UP | ||
169 | int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip, | ||
170 | unsigned int off, s3c_gpio_pull_t pull) | ||
171 | { | ||
172 | void __iomem *reg = chip->base + 0x08; | ||
173 | u32 pup = __raw_readl(reg); | ||
174 | |||
175 | pup = __raw_readl(reg); | ||
176 | |||
177 | if (pup == S3C_GPIO_PULL_UP) | ||
178 | pup &= ~(1 << off); | ||
179 | else if (pup == S3C_GPIO_PULL_NONE) | ||
180 | pup |= (1 << off); | ||
181 | else | ||
182 | return -EINVAL; | ||
183 | |||
184 | __raw_writel(pup, reg); | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, | ||
189 | unsigned int off) | ||
190 | { | ||
191 | void __iomem *reg = chip->base + 0x08; | ||
192 | u32 pup = __raw_readl(reg); | ||
193 | |||
194 | pup &= (1 << off); | ||
195 | return pup ? S3C_GPIO_PULL_NONE : S3C_GPIO_PULL_UP; | ||
196 | } | ||
197 | #endif /* CONFIG_S3C_GPIO_PULL_UP */ | ||
198 | |||
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 dda19da037ad..885e9ac642d3 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h +++ b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h | |||
@@ -146,6 +146,17 @@ extern s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip, | |||
146 | unsigned int off); | 146 | unsigned int off); |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * s3c_gpio_getpull_1up() - Get configuration for choice of up or none | ||
150 | * @chip: The gpio chip that the GPIO pin belongs to | ||
151 | * @off: The offset to the pin to get the configuration of. | ||
152 | * | ||
153 | * This helper function reads the state of the pull-up resistor for the | ||
154 | * given GPIO in the same case as s3c_gpio_setpull_1up. | ||
155 | */ | ||
156 | extern s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, | ||
157 | unsigned int off); | ||
158 | |||
159 | /** | ||
149 | * s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443. | 160 | * s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443. |
150 | * @chip: The gpio chip that is being configured. | 161 | * @chip: The gpio chip that is being configured. |
151 | * @off: The offset for the GPIO being configured. | 162 | * @off: The offset for the GPIO being configured. |