e0f72c93bbe6b15c449d341409533684a9dc5a5b
[openwrt/svn-archive/archive.git] / target / linux / adm5120-2.6 / files / include / asm-mips / mach-adm5120 / gpio.h
1 /*
2 * $Id$
3 *
4 * ADM5120 GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 *
24 */
25
26 #ifndef _ADM5120_GPIO_H_
27 #define _ADM5120_GPIO_H_
28
29 #define ADM5120_GPIO_PIN0 0
30 #define ADM5120_GPIO_PIN1 1
31 #define ADM5120_GPIO_PIN2 2
32 #define ADM5120_GPIO_PIN3 3
33 #define ADM5120_GPIO_PIN4 4
34 #define ADM5120_GPIO_PIN5 5
35 #define ADM5120_GPIO_PIN6 6
36 #define ADM5120_GPIO_PIN7 7
37 #define ADM5120_GPIO_P0L0 8
38 #define ADM5120_GPIO_P0L1 9
39 #define ADM5120_GPIO_P0L2 10
40 #define ADM5120_GPIO_P1L0 11
41 #define ADM5120_GPIO_P1L1 12
42 #define ADM5120_GPIO_P1L2 13
43 #define ADM5120_GPIO_P2L0 14
44 #define ADM5120_GPIO_P2L1 15
45 #define ADM5120_GPIO_P2L2 16
46 #define ADM5120_GPIO_P3L0 17
47 #define ADM5120_GPIO_P3L1 18
48 #define ADM5120_GPIO_P3L2 19
49 #define ADM5120_GPIO_P4L0 20
50 #define ADM5120_GPIO_P4L1 21
51 #define ADM5120_GPIO_P4L2 22
52 #define ADM5120_GPIO_MAX 22
53 #define ADM5120_GPIO_COUNT ADM5120_GPIO_MAX+1
54
55 extern int adm5120_gpio_direction_input(unsigned gpio);
56 extern int adm5120_gpio_direction_output(unsigned gpio, int value);
57 extern int adm5120_gpio_get_value(unsigned gpio);
58 extern void adm5120_gpio_set_value(unsigned gpio, int value);
59 extern int adm5120_gpio_request(unsigned gpio, const char *label);
60 extern void adm5120_gpio_free(unsigned gpio);
61 extern int adm5120_gpio_to_irq(unsigned gpio);
62 extern int adm5120_irq_to_gpio(unsigned irq);
63
64 /*
65 * Wrappers for the generic GPIO layer
66 */
67 static inline int gpio_direction_input(unsigned gpio)
68 {
69 return adm5120_gpio_direction_input(gpio);
70 }
71
72 static inline int gpio_direction_output(unsigned gpio, int value)
73 {
74 return adm5120_gpio_direction_output(gpio,value);
75 }
76
77 static inline int gpio_get_value(unsigned gpio)
78 {
79 return adm5120_gpio_get_value(gpio);
80 }
81
82 static inline void gpio_set_value(unsigned gpio, int value)
83 {
84 adm5120_gpio_set_value(gpio, value);
85 }
86
87 static inline int gpio_request(unsigned gpio, const char *label)
88 {
89 return adm5120_gpio_request(gpio, label);
90 }
91
92 static inline void gpio_free(unsigned gpio)
93 {
94 adm5120_gpio_free(gpio);
95 }
96
97 static inline int gpio_to_irq(unsigned gpio)
98 {
99 return adm5120_gpio_to_irq(gpio);
100 }
101
102 static inline int irq_to_gpio(unsigned irq)
103 {
104 return adm5120_irq_to_gpio(irq);
105 }
106
107 #include <asm-generic/gpio.h> /* cansleep wrappers */
108
109 #endif /* _ADM5120_GPIO_H_ */
110 /*
111 * $Id$
112 *
113 * ADM5120 GPIO wrappers for arch-neutral GPIO calls
114 *
115 * Copyright (C) 2007 OpenWrt.org
116 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
117 *
118 * This program is free software; you can redistribute it and/or
119 * modify it under the terms of the GNU General Public License
120 * as published by the Free Software Foundation; either version 2
121 * of the License, or (at your option) any later version.
122 *
123 * This program is distributed in the hope that it will be useful,
124 * but WITHOUT ANY WARRANTY; without even the implied warranty of
125 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
126 * GNU General Public License for more details.
127 *
128 * You should have received a copy of the GNU General Public License
129 * along with this program; if not, write to the
130 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
131 * Boston, MA 02110-1301, USA.
132 *
133 */
134
135 #ifndef _ADM5120_GPIO_H_
136 #define _ADM5120_GPIO_H_
137
138 #define ADM5120_GPIO_PIN0 0
139 #define ADM5120_GPIO_PIN1 1
140 #define ADM5120_GPIO_PIN2 2
141 #define ADM5120_GPIO_PIN3 3
142 #define ADM5120_GPIO_PIN4 4
143 #define ADM5120_GPIO_PIN5 5
144 #define ADM5120_GPIO_PIN6 6
145 #define ADM5120_GPIO_PIN7 7
146 #define ADM5120_GPIO_P0L0 8
147 #define ADM5120_GPIO_P0L1 9
148 #define ADM5120_GPIO_P0L2 10
149 #define ADM5120_GPIO_P1L0 11
150 #define ADM5120_GPIO_P1L1 12
151 #define ADM5120_GPIO_P1L2 13
152 #define ADM5120_GPIO_P2L0 14
153 #define ADM5120_GPIO_P2L1 15
154 #define ADM5120_GPIO_P2L2 16
155 #define ADM5120_GPIO_P3L0 17
156 #define ADM5120_GPIO_P3L1 18
157 #define ADM5120_GPIO_P3L2 19
158 #define ADM5120_GPIO_P4L0 20
159 #define ADM5120_GPIO_P4L1 21
160 #define ADM5120_GPIO_P4L2 22
161 #define ADM5120_GPIO_MAX 22
162 #define ADM5120_GPIO_COUNT ADM5120_GPIO_MAX+1
163
164 extern int adm5120_gpio_direction_input(unsigned gpio);
165 extern int adm5120_gpio_direction_output(unsigned gpio, int value);
166 extern int adm5120_gpio_get_value(unsigned gpio);
167 extern void adm5120_gpio_set_value(unsigned gpio, int value);
168 extern int adm5120_gpio_request(unsigned gpio, const char *label);
169 extern void adm5120_gpio_free(unsigned gpio);
170 extern int adm5120_gpio_to_irq(unsigned gpio);
171 extern int adm5120_irq_to_gpio(unsigned irq);
172
173 /*
174 * Wrappers for the generic GPIO layer
175 */
176 static inline int gpio_direction_input(unsigned gpio)
177 {
178 return adm5120_gpio_direction_input(gpio);
179 }
180
181 static inline int gpio_direction_output(unsigned gpio, int value)
182 {
183 return adm5120_gpio_direction_output(gpio,value);
184 }
185
186 static inline int gpio_get_value(unsigned gpio)
187 {
188 return adm5120_gpio_get_value(gpio);
189 }
190
191 static inline void gpio_set_value(unsigned gpio, int value)
192 {
193 adm5120_gpio_set_value(gpio, value);
194 }
195
196 static inline int gpio_request(unsigned gpio, const char *label)
197 {
198 return adm5120_gpio_request(gpio, label);
199 }
200
201 static inline void gpio_free(unsigned gpio)
202 {
203 adm5120_gpio_free(gpio);
204 }
205
206 static inline int gpio_to_irq(unsigned gpio)
207 {
208 return adm5120_gpio_to_irq(gpio);
209 }
210
211 static inline int irq_to_gpio(unsigned irq)
212 {
213 return adm5120_irq_to_gpio(irq);
214 }
215
216 #include <asm-generic/gpio.h> /* cansleep wrappers */
217
218 #endif /* _ADM5120_GPIO_H_ */