diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-04-10 08:31:47 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-10 10:31:37 -0400 |
commit | 45528e38173e7d8c03821850e8fd1ddbf16f2b3d (patch) | |
tree | 96ed1a1e340bb28e47d8b4b9e1de4b42e0d12bd6 /include/asm-arm | |
parent | c353faa4b2abd8d5142640b880532c97a0807460 (diff) |
[ARM] 4961/1: gpiolib support for SA-1100 architecture
This adds gpiolib support for the SA-1100 arch:
- Move all GPIO API functions from generic.c into gpio.c
- Convert all gpio functions into gpiolib callbacks.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/asm-arm')
-rw-r--r-- | include/asm-arm/arch-sa1100/gpio.h | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/include/asm-arm/arch-sa1100/gpio.h b/include/asm-arm/arch-sa1100/gpio.h index e7a9d26e22a8..93d3395b102d 100644 --- a/include/asm-arm/arch-sa1100/gpio.h +++ b/include/asm-arm/arch-sa1100/gpio.h | |||
@@ -26,35 +26,28 @@ | |||
26 | 26 | ||
27 | #include <asm/hardware.h> | 27 | #include <asm/hardware.h> |
28 | #include <asm/irq.h> | 28 | #include <asm/irq.h> |
29 | 29 | #include <asm-generic/gpio.h> | |
30 | static inline int gpio_request(unsigned gpio, const char *label) | ||
31 | { | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | static inline void gpio_free(unsigned gpio) | ||
36 | { | ||
37 | return; | ||
38 | } | ||
39 | |||
40 | extern int gpio_direction_input(unsigned gpio); | ||
41 | extern int gpio_direction_output(unsigned gpio, int value); | ||
42 | |||
43 | 30 | ||
44 | static inline int gpio_get_value(unsigned gpio) | 31 | static inline int gpio_get_value(unsigned gpio) |
45 | { | 32 | { |
46 | return GPLR & GPIO_GPIO(gpio); | 33 | if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) |
34 | return GPLR & GPIO_GPIO(gpio); | ||
35 | else | ||
36 | return __gpio_get_value(gpio); | ||
47 | } | 37 | } |
48 | 38 | ||
49 | static inline void gpio_set_value(unsigned gpio, int value) | 39 | static inline void gpio_set_value(unsigned gpio, int value) |
50 | { | 40 | { |
51 | if (value) | 41 | if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) |
52 | GPSR = GPIO_GPIO(gpio); | 42 | if (value) |
43 | GPSR = GPIO_GPIO(gpio); | ||
44 | else | ||
45 | GPCR = GPIO_GPIO(gpio); | ||
53 | else | 46 | else |
54 | GPCR = GPIO_GPIO(gpio); | 47 | __gpio_set_value(gpio, value); |
55 | } | 48 | } |
56 | 49 | ||
57 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | 50 | #define gpio_cansleep __gpio_cansleep |
58 | 51 | ||
59 | static inline unsigned gpio_to_irq(unsigned gpio) | 52 | static inline unsigned gpio_to_irq(unsigned gpio) |
60 | { | 53 | { |