Disable PCMCIA for adm5120, request IRQ for the USB driver, fix duplicate lines in...
[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