diff options
author | Kyungmin Park <kyungmin.park@samsung.com> | 2009-11-17 02:41:16 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-11-30 20:33:14 -0500 |
commit | b0d5217cfb0a2357ac076977400c648cccff6154 (patch) | |
tree | 79795a07f16b3f3962836206651911a869bbca71 /arch/arm/plat-s5pc1xx/gpio-config.c | |
parent | d7b9ace51d949e1bfec7f32d21d094cf2c683ca0 (diff) |
ARM: S5PC1xx: add gpiolib and external/gpio interrupt support
Add support for gpiolib calls. This is based on the gpiolib implementation
from plat-s3c64xx tree.
Add support for external interrupts for GPIO H banks.
Add support for GPIO interrupts for all banks.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-s5pc1xx/gpio-config.c')
-rw-r--r-- | arch/arm/plat-s5pc1xx/gpio-config.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/arch/arm/plat-s5pc1xx/gpio-config.c b/arch/arm/plat-s5pc1xx/gpio-config.c new file mode 100644 index 000000000000..bba675df9c75 --- /dev/null +++ b/arch/arm/plat-s5pc1xx/gpio-config.c | |||
@@ -0,0 +1,62 @@ | |||
1 | /* linux/arch/arm/plat-s5pc1xx/gpio-config.c | ||
2 | * | ||
3 | * Copyright 2009 Samsung Electronics | ||
4 | * | ||
5 | * S5PC1XX GPIO Configuration. | ||
6 | * | ||
7 | * Based on plat-s3c64xx/gpio-config.c | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/gpio.h> | ||
17 | #include <linux/io.h> | ||
18 | |||
19 | #include <mach/gpio-core.h> | ||
20 | #include <plat/gpio-cfg-s5pc1xx.h> | ||
21 | |||
22 | s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin, unsigned int off) | ||
23 | { | ||
24 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
25 | void __iomem *reg; | ||
26 | int shift = off * 2; | ||
27 | u32 drvstr; | ||
28 | |||
29 | if (!chip) | ||
30 | return -EINVAL; | ||
31 | |||
32 | reg = chip->base + 0x0C; | ||
33 | |||
34 | drvstr = __raw_readl(reg); | ||
35 | drvstr = 0xffff & (0x3 << shift); | ||
36 | drvstr = drvstr >> shift; | ||
37 | |||
38 | return (__force s5p_gpio_drvstr_t)drvstr; | ||
39 | } | ||
40 | EXPORT_SYMBOL(s5p_gpio_get_drvstr); | ||
41 | |||
42 | int s5p_gpio_set_drvstr(unsigned int pin, unsigned int off, | ||
43 | s5p_gpio_drvstr_t drvstr) | ||
44 | { | ||
45 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
46 | void __iomem *reg; | ||
47 | int shift = off * 2; | ||
48 | u32 tmp; | ||
49 | |||
50 | if (!chip) | ||
51 | return -EINVAL; | ||
52 | |||
53 | reg = chip->base + 0x0C; | ||
54 | |||
55 | tmp = __raw_readl(reg); | ||
56 | tmp |= drvstr << shift; | ||
57 | |||
58 | __raw_writel(tmp, reg); | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | EXPORT_SYMBOL(s5p_gpio_set_drvstr); | ||