diff options
author | Ben Dooks <ben-linux@fluff.org> | 2005-10-28 10:26:41 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-10-28 10:26:41 -0400 |
commit | 42d3a120fe9a1831b88e7037ce0b048d82433b09 (patch) | |
tree | 0fef604e20da25b1c6254ebda98d00cfce2498e2 | |
parent | c09f98271f685af349d3f0199360f1c0e85550e0 (diff) |
[ARM] 3033/1: S3C2410 - add generic gpio_cfgpin options
Patch from Ben Dooks
Add generic values for the parameters to the
s3c2410_gpio_cfgpin() function, so that a caller
does not need to know the exact constant for
the specified pin.
This is very useful for the case where a driver
is passed a gpio pin number and needs to reconfigure
the pin's function.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-s3c2410/gpio.c | 22 | ||||
-rw-r--r-- | include/asm-arm/arch-s3c2410/regs-gpio.h | 6 |
2 files changed, 28 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c2410/gpio.c b/arch/arm/mach-s3c2410/gpio.c index 94f1776cf312..23ea3d5fa09c 100644 --- a/arch/arm/mach-s3c2410/gpio.c +++ b/arch/arm/mach-s3c2410/gpio.c | |||
@@ -30,6 +30,7 @@ | |||
30 | * 04-Oct-2004 BJD Added irq filter controls for GPIO | 30 | * 04-Oct-2004 BJD Added irq filter controls for GPIO |
31 | * 05-Nov-2004 BJD EXPORT_SYMBOL() added for all code | 31 | * 05-Nov-2004 BJD EXPORT_SYMBOL() added for all code |
32 | * 13-Mar-2005 BJD Updates for __iomem | 32 | * 13-Mar-2005 BJD Updates for __iomem |
33 | * 26-Oct-2005 BJD Added generic configuration types | ||
33 | */ | 34 | */ |
34 | 35 | ||
35 | 36 | ||
@@ -58,6 +59,27 @@ void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function) | |||
58 | mask = 3 << S3C2410_GPIO_OFFSET(pin)*2; | 59 | mask = 3 << S3C2410_GPIO_OFFSET(pin)*2; |
59 | } | 60 | } |
60 | 61 | ||
62 | switch (function) { | ||
63 | case S3C2410_GPIO_LEAVE: | ||
64 | mask = 0; | ||
65 | function = 0; | ||
66 | break; | ||
67 | |||
68 | case S3C2410_GPIO_INPUT: | ||
69 | case S3C2410_GPIO_OUTPUT: | ||
70 | case S3C2410_GPIO_SFN2: | ||
71 | case S3C2410_GPIO_SFN3: | ||
72 | if (pin < S3C2410_GPIO_BANKB) { | ||
73 | function &= 1; | ||
74 | function <<= S3C2410_GPIO_OFFSET(pin); | ||
75 | } else { | ||
76 | function &= 3; | ||
77 | function <<= S3C2410_GPIO_OFFSET(pin)*2; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | /* modify the specified register wwith IRQs off */ | ||
82 | |||
61 | local_irq_save(flags); | 83 | local_irq_save(flags); |
62 | 84 | ||
63 | con = __raw_readl(base + 0x00); | 85 | con = __raw_readl(base + 0x00); |
diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h index 2053cbacffc3..cb33d57c146c 100644 --- a/include/asm-arm/arch-s3c2410/regs-gpio.h +++ b/include/asm-arm/arch-s3c2410/regs-gpio.h | |||
@@ -20,6 +20,7 @@ | |||
20 | * 18-11-2004 BJD Added S3C2440 AC97 controls | 20 | * 18-11-2004 BJD Added S3C2440 AC97 controls |
21 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA | 21 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA |
22 | * 28-Mar-2005 LCVR Fixed definition of GPB10 | 22 | * 28-Mar-2005 LCVR Fixed definition of GPB10 |
23 | * 26-Oct-2005 BJD Added generic configuration types | ||
23 | */ | 24 | */ |
24 | 25 | ||
25 | 26 | ||
@@ -43,6 +44,11 @@ | |||
43 | /* general configuration options */ | 44 | /* general configuration options */ |
44 | 45 | ||
45 | #define S3C2410_GPIO_LEAVE (0xFFFFFFFF) | 46 | #define S3C2410_GPIO_LEAVE (0xFFFFFFFF) |
47 | #define S3C2410_GPIO_INPUT (0xFFFFFFF0) | ||
48 | #define S3C2410_GPIO_OUTPUT (0xFFFFFFF1) | ||
49 | #define S3C2410_GPIO_IRQ (0xFFFFFFF2) /* not available for all */ | ||
50 | #define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* not available on A */ | ||
51 | #define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */ | ||
46 | 52 | ||
47 | /* configure GPIO ports A..G */ | 53 | /* configure GPIO ports A..G */ |
48 | 54 | ||