aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include/asm/gpio.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/include/asm/gpio.h')
-rw-r--r--arch/blackfin/include/asm/gpio.h226
1 files changed, 72 insertions, 154 deletions
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index ad33ac271fd..9477d82fcad 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -84,11 +84,14 @@
84#ifndef __ARCH_BLACKFIN_GPIO_H__ 84#ifndef __ARCH_BLACKFIN_GPIO_H__
85#define __ARCH_BLACKFIN_GPIO_H__ 85#define __ARCH_BLACKFIN_GPIO_H__
86 86
87#define gpio_bank(x) ((x) >> 4) 87#define gpio_bank(x) ((x) >> 4)
88#define gpio_bit(x) (1<<((x) & 0xF)) 88#define gpio_bit(x) (1<<((x) & 0xF))
89#define gpio_sub_n(x) ((x) & 0xF) 89#define gpio_sub_n(x) ((x) & 0xF)
90 90
91#define GPIO_BANKSIZE 16 91#define GPIO_BANKSIZE 16
92#define GPIO_BANK_NUM DIV_ROUND_UP(MAX_BLACKFIN_GPIOS, GPIO_BANKSIZE)
93
94#include <mach/gpio.h>
92 95
93#define GPIO_0 0 96#define GPIO_0 0
94#define GPIO_1 1 97#define GPIO_1 1
@@ -139,151 +142,9 @@
139#define GPIO_46 46 142#define GPIO_46 46
140#define GPIO_47 47 143#define GPIO_47 47
141 144
142
143#define PERIPHERAL_USAGE 1 145#define PERIPHERAL_USAGE 1
144#define GPIO_USAGE 0 146#define GPIO_USAGE 0
145 147
146#ifdef BF533_FAMILY
147#define MAX_BLACKFIN_GPIOS 16
148
149#define GPIO_PF0 0
150#define GPIO_PF1 1
151#define GPIO_PF2 2
152#define GPIO_PF3 3
153#define GPIO_PF4 4
154#define GPIO_PF5 5
155#define GPIO_PF6 6
156#define GPIO_PF7 7
157#define GPIO_PF8 8
158#define GPIO_PF9 9
159#define GPIO_PF10 10
160#define GPIO_PF11 11
161#define GPIO_PF12 12
162#define GPIO_PF13 13
163#define GPIO_PF14 14
164#define GPIO_PF15 15
165
166#endif
167
168#if defined(BF527_FAMILY) || defined(BF537_FAMILY)
169#define MAX_BLACKFIN_GPIOS 48
170
171#define GPIO_PF0 0
172#define GPIO_PF1 1
173#define GPIO_PF2 2
174#define GPIO_PF3 3
175#define GPIO_PF4 4
176#define GPIO_PF5 5
177#define GPIO_PF6 6
178#define GPIO_PF7 7
179#define GPIO_PF8 8
180#define GPIO_PF9 9
181#define GPIO_PF10 10
182#define GPIO_PF11 11
183#define GPIO_PF12 12
184#define GPIO_PF13 13
185#define GPIO_PF14 14
186#define GPIO_PF15 15
187#define GPIO_PG0 16
188#define GPIO_PG1 17
189#define GPIO_PG2 18
190#define GPIO_PG3 19
191#define GPIO_PG4 20
192#define GPIO_PG5 21
193#define GPIO_PG6 22
194#define GPIO_PG7 23
195#define GPIO_PG8 24
196#define GPIO_PG9 25
197#define GPIO_PG10 26
198#define GPIO_PG11 27
199#define GPIO_PG12 28
200#define GPIO_PG13 29
201#define GPIO_PG14 30
202#define GPIO_PG15 31
203#define GPIO_PH0 32
204#define GPIO_PH1 33
205#define GPIO_PH2 34
206#define GPIO_PH3 35
207#define GPIO_PH4 36
208#define GPIO_PH5 37
209#define GPIO_PH6 38
210#define GPIO_PH7 39
211#define GPIO_PH8 40
212#define GPIO_PH9 41
213#define GPIO_PH10 42
214#define GPIO_PH11 43
215#define GPIO_PH12 44
216#define GPIO_PH13 45
217#define GPIO_PH14 46
218#define GPIO_PH15 47
219
220#define PORT_F GPIO_PF0
221#define PORT_G GPIO_PG0
222#define PORT_H GPIO_PH0
223
224#endif
225
226#ifdef BF548_FAMILY
227#include <mach/gpio.h>
228#endif
229
230#ifdef BF561_FAMILY
231#define MAX_BLACKFIN_GPIOS 48
232
233#define GPIO_PF0 0
234#define GPIO_PF1 1
235#define GPIO_PF2 2
236#define GPIO_PF3 3
237#define GPIO_PF4 4
238#define GPIO_PF5 5
239#define GPIO_PF6 6
240#define GPIO_PF7 7
241#define GPIO_PF8 8
242#define GPIO_PF9 9
243#define GPIO_PF10 10
244#define GPIO_PF11 11
245#define GPIO_PF12 12
246#define GPIO_PF13 13
247#define GPIO_PF14 14
248#define GPIO_PF15 15
249#define GPIO_PF16 16
250#define GPIO_PF17 17
251#define GPIO_PF18 18
252#define GPIO_PF19 19
253#define GPIO_PF20 20
254#define GPIO_PF21 21
255#define GPIO_PF22 22
256#define GPIO_PF23 23
257#define GPIO_PF24 24
258#define GPIO_PF25 25
259#define GPIO_PF26 26
260#define GPIO_PF27 27
261#define GPIO_PF28 28
262#define GPIO_PF29 29
263#define GPIO_PF30 30
264#define GPIO_PF31 31
265#define GPIO_PF32 32
266#define GPIO_PF33 33
267#define GPIO_PF34 34
268#define GPIO_PF35 35
269#define GPIO_PF36 36
270#define GPIO_PF37 37
271#define GPIO_PF38 38
272#define GPIO_PF39 39
273#define GPIO_PF40 40
274#define GPIO_PF41 41
275#define GPIO_PF42 42
276#define GPIO_PF43 43
277#define GPIO_PF44 44
278#define GPIO_PF45 45
279#define GPIO_PF46 46
280#define GPIO_PF47 47
281
282#define PORT_FIO0 GPIO_0
283#define PORT_FIO1 GPIO_16
284#define PORT_FIO2 GPIO_32
285#endif
286
287#ifndef __ASSEMBLY__ 148#ifndef __ASSEMBLY__
288 149
289/*********************************************************** 150/***********************************************************
@@ -425,20 +286,77 @@ struct gpio_port_s {
425* MODIFICATION HISTORY : 286* MODIFICATION HISTORY :
426**************************************************************/ 287**************************************************************/
427 288
428int gpio_request(unsigned, const char *); 289int bfin_gpio_request(unsigned gpio, const char *label);
429void gpio_free(unsigned); 290void bfin_gpio_free(unsigned gpio);
430 291int bfin_gpio_irq_request(unsigned gpio, const char *label);
431void gpio_set_value(unsigned gpio, int arg); 292void bfin_gpio_irq_free(unsigned gpio);
432int gpio_get_value(unsigned gpio); 293int bfin_gpio_direction_input(unsigned gpio);
294int bfin_gpio_direction_output(unsigned gpio, int value);
295int bfin_gpio_get_value(unsigned gpio);
296void bfin_gpio_set_value(unsigned gpio, int value);
433 297
434#ifndef BF548_FAMILY 298#ifndef BF548_FAMILY
435#define gpio_set_value(gpio, value) set_gpio_data(gpio, value) 299#define bfin_gpio_set_value(gpio, value) set_gpio_data(gpio, value)
436#endif 300#endif
437 301
438int gpio_direction_input(unsigned gpio); 302#ifdef CONFIG_GPIOLIB
439int gpio_direction_output(unsigned gpio, int value); 303#include <asm-generic/gpio.h> /* cansleep wrappers */
304
305static inline int gpio_get_value(unsigned int gpio)
306{
307 if (gpio < MAX_BLACKFIN_GPIOS)
308 return bfin_gpio_get_value(gpio);
309 else
310 return __gpio_get_value(gpio);
311}
312
313static inline void gpio_set_value(unsigned int gpio, int value)
314{
315 if (gpio < MAX_BLACKFIN_GPIOS)
316 bfin_gpio_set_value(gpio, value);
317 else
318 __gpio_set_value(gpio, value);
319}
320
321static inline int gpio_cansleep(unsigned int gpio)
322{
323 return __gpio_cansleep(gpio);
324}
325
326#else /* !CONFIG_GPIOLIB */
327
328static inline int gpio_request(unsigned gpio, const char *label)
329{
330 return bfin_gpio_request(gpio, label);
331}
332
333static inline void gpio_free(unsigned gpio)
334{
335 return bfin_gpio_free(gpio);
336}
337
338static inline int gpio_direction_input(unsigned gpio)
339{
340 return bfin_gpio_direction_input(gpio);
341}
342
343static inline int gpio_direction_output(unsigned gpio, int value)
344{
345 return bfin_gpio_direction_output(gpio, value);
346}
347
348static inline int gpio_get_value(unsigned gpio)
349{
350 return bfin_gpio_get_value(gpio);
351}
352
353static inline void gpio_set_value(unsigned gpio, int value)
354{
355 return bfin_gpio_set_value(gpio, value);
356}
440 357
441#include <asm-generic/gpio.h> /* cansleep wrappers */ 358#include <asm-generic/gpio.h> /* cansleep wrappers */
359#endif /* !CONFIG_GPIOLIB */
442#include <asm/irq.h> 360#include <asm/irq.h>
443 361
444static inline int gpio_to_irq(unsigned gpio) 362static inline int gpio_to_irq(unsigned gpio)