diff options
Diffstat (limited to 'include/asm-arm/arch-ep93xx/gpio.h')
-rw-r--r-- | include/asm-arm/arch-ep93xx/gpio.h | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/include/asm-arm/arch-ep93xx/gpio.h b/include/asm-arm/arch-ep93xx/gpio.h index 1ee14a14cba0..9b1864bbd9a8 100644 --- a/include/asm-arm/arch-ep93xx/gpio.h +++ b/include/asm-arm/arch-ep93xx/gpio.h | |||
@@ -5,16 +5,6 @@ | |||
5 | #ifndef __ASM_ARCH_GPIO_H | 5 | #ifndef __ASM_ARCH_GPIO_H |
6 | #define __ASM_ARCH_GPIO_H | 6 | #define __ASM_ARCH_GPIO_H |
7 | 7 | ||
8 | #define GPIO_IN 0 | ||
9 | #define GPIO_OUT 1 | ||
10 | |||
11 | #define EP93XX_GPIO_LOW 0 | ||
12 | #define EP93XX_GPIO_HIGH 1 | ||
13 | |||
14 | extern void gpio_line_config(int line, int direction); | ||
15 | extern int gpio_line_get(int line); | ||
16 | extern void gpio_line_set(int line, int value); | ||
17 | |||
18 | /* GPIO port A. */ | 8 | /* GPIO port A. */ |
19 | #define EP93XX_GPIO_LINE_A(x) ((x) + 0) | 9 | #define EP93XX_GPIO_LINE_A(x) ((x) + 0) |
20 | #define EP93XX_GPIO_LINE_EGPIO0 EP93XX_GPIO_LINE_A(0) | 10 | #define EP93XX_GPIO_LINE_EGPIO0 EP93XX_GPIO_LINE_A(0) |
@@ -38,7 +28,7 @@ extern void gpio_line_set(int line, int value); | |||
38 | #define EP93XX_GPIO_LINE_EGPIO15 EP93XX_GPIO_LINE_B(7) | 28 | #define EP93XX_GPIO_LINE_EGPIO15 EP93XX_GPIO_LINE_B(7) |
39 | 29 | ||
40 | /* GPIO port C. */ | 30 | /* GPIO port C. */ |
41 | #define EP93XX_GPIO_LINE_C(x) ((x) + 16) | 31 | #define EP93XX_GPIO_LINE_C(x) ((x) + 40) |
42 | #define EP93XX_GPIO_LINE_ROW0 EP93XX_GPIO_LINE_C(0) | 32 | #define EP93XX_GPIO_LINE_ROW0 EP93XX_GPIO_LINE_C(0) |
43 | #define EP93XX_GPIO_LINE_ROW1 EP93XX_GPIO_LINE_C(1) | 33 | #define EP93XX_GPIO_LINE_ROW1 EP93XX_GPIO_LINE_C(1) |
44 | #define EP93XX_GPIO_LINE_ROW2 EP93XX_GPIO_LINE_C(2) | 34 | #define EP93XX_GPIO_LINE_ROW2 EP93XX_GPIO_LINE_C(2) |
@@ -71,7 +61,7 @@ extern void gpio_line_set(int line, int value); | |||
71 | #define EP93XX_GPIO_LINE_IDEDA2 EP93XX_GPIO_LINE_E(7) | 61 | #define EP93XX_GPIO_LINE_IDEDA2 EP93XX_GPIO_LINE_E(7) |
72 | 62 | ||
73 | /* GPIO port F. */ | 63 | /* GPIO port F. */ |
74 | #define EP93XX_GPIO_LINE_F(x) ((x) + 40) | 64 | #define EP93XX_GPIO_LINE_F(x) ((x) + 16) |
75 | #define EP93XX_GPIO_LINE_WP EP93XX_GPIO_LINE_F(0) | 65 | #define EP93XX_GPIO_LINE_WP EP93XX_GPIO_LINE_F(0) |
76 | #define EP93XX_GPIO_LINE_MCCD1 EP93XX_GPIO_LINE_F(1) | 66 | #define EP93XX_GPIO_LINE_MCCD1 EP93XX_GPIO_LINE_F(1) |
77 | #define EP93XX_GPIO_LINE_MCCD2 EP93XX_GPIO_LINE_F(2) | 67 | #define EP93XX_GPIO_LINE_MCCD2 EP93XX_GPIO_LINE_F(2) |
@@ -103,5 +93,49 @@ extern void gpio_line_set(int line, int value); | |||
103 | #define EP93XX_GPIO_LINE_DD6 EP93XX_GPIO_LINE_H(6) | 93 | #define EP93XX_GPIO_LINE_DD6 EP93XX_GPIO_LINE_H(6) |
104 | #define EP93XX_GPIO_LINE_DD7 EP93XX_GPIO_LINE_H(7) | 94 | #define EP93XX_GPIO_LINE_DD7 EP93XX_GPIO_LINE_H(7) |
105 | 95 | ||
96 | /* maximum value for gpio line identifiers */ | ||
97 | #define EP93XX_GPIO_LINE_MAX EP93XX_GPIO_LINE_H(7) | ||
98 | |||
99 | /* maximum value for irq capable line identifiers */ | ||
100 | #define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) | ||
101 | |||
102 | /* new generic GPIO API - see Documentation/gpio.txt */ | ||
103 | |||
104 | static inline int gpio_request(unsigned gpio, const char *label) | ||
105 | { | ||
106 | if (gpio > EP93XX_GPIO_LINE_MAX) | ||
107 | return -EINVAL; | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static inline void gpio_free(unsigned gpio) | ||
112 | { | ||
113 | } | ||
114 | |||
115 | int gpio_direction_input(unsigned gpio); | ||
116 | int gpio_direction_output(unsigned gpio, int value); | ||
117 | int gpio_get_value(unsigned gpio); | ||
118 | void gpio_set_value(unsigned gpio, int value); | ||
119 | |||
120 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | ||
121 | |||
122 | /* | ||
123 | * Map GPIO A0..A7 (0..7) to irq 64..71, | ||
124 | * B0..B7 (7..15) to irq 72..79, and | ||
125 | * F0..F7 (16..24) to irq 80..87. | ||
126 | */ | ||
127 | |||
128 | static inline int gpio_to_irq(unsigned gpio) | ||
129 | { | ||
130 | if (gpio <= EP93XX_GPIO_LINE_MAX_IRQ) | ||
131 | return 64 + gpio; | ||
132 | |||
133 | return -EINVAL; | ||
134 | } | ||
135 | |||
136 | static inline int irq_to_gpio(unsigned irq) | ||
137 | { | ||
138 | return irq - gpio_to_irq(0); | ||
139 | } | ||
106 | 140 | ||
107 | #endif | 141 | #endif |