diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2010-05-18 06:23:36 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-05-19 05:15:02 -0400 |
commit | 838c6d499b780c42fccbbdfecc0f5dcc471d0ef3 (patch) | |
tree | 8dbbe6ad6f940c390ea62c273470480ebdde2d63 /arch/arm/plat-samsung/gpio-config.c | |
parent | 14b8a0f92b309ff452a8c339abd9a096d00b210f (diff) |
ARM: SAMSUNG: move driver strength gpio configuration helper to common dir
Driver strength parameter can be changed not only on S5PC100 but also
on S5PV210/S5PC110 platforms, so move the helper functions to the common
plat-samsung directory.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-samsung/gpio-config.c')
-rw-r--r-- | arch/arm/plat-samsung/gpio-config.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c index a76eef533392..57b68a50f45e 100644 --- a/arch/arm/plat-samsung/gpio-config.c +++ b/arch/arm/plat-samsung/gpio-config.c | |||
@@ -261,3 +261,51 @@ s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, | |||
261 | } | 261 | } |
262 | #endif /* CONFIG_S3C_GPIO_PULL_UP */ | 262 | #endif /* CONFIG_S3C_GPIO_PULL_UP */ |
263 | 263 | ||
264 | #ifdef CONFIG_S5P_GPIO_DRVSTR | ||
265 | s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin) | ||
266 | { | ||
267 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
268 | unsigned int off; | ||
269 | void __iomem *reg; | ||
270 | int shift; | ||
271 | u32 drvstr; | ||
272 | |||
273 | if (!chip) | ||
274 | return -EINVAL; | ||
275 | |||
276 | off = chip->chip.base - pin; | ||
277 | shift = off * 2; | ||
278 | reg = chip->base + 0x0C; | ||
279 | |||
280 | drvstr = __raw_readl(reg); | ||
281 | drvstr = 0xffff & (0x3 << shift); | ||
282 | drvstr = drvstr >> shift; | ||
283 | |||
284 | return (__force s5p_gpio_drvstr_t)drvstr; | ||
285 | } | ||
286 | EXPORT_SYMBOL(s5p_gpio_get_drvstr); | ||
287 | |||
288 | int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr) | ||
289 | { | ||
290 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
291 | unsigned int off; | ||
292 | void __iomem *reg; | ||
293 | int shift; | ||
294 | u32 tmp; | ||
295 | |||
296 | if (!chip) | ||
297 | return -EINVAL; | ||
298 | |||
299 | off = chip->chip.base - pin; | ||
300 | shift = off * 2; | ||
301 | reg = chip->base + 0x0C; | ||
302 | |||
303 | tmp = __raw_readl(reg); | ||
304 | tmp |= drvstr << shift; | ||
305 | |||
306 | __raw_writel(tmp, reg); | ||
307 | |||
308 | return 0; | ||
309 | } | ||
310 | EXPORT_SYMBOL(s5p_gpio_set_drvstr); | ||
311 | #endif /* CONFIG_S5P_GPIO_DRVSTR */ | ||