ar71xx: move arch specific files to files-2.6.39
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files-2.6.39 / arch / mips / include / asm / mach-ar71xx / gpio.h
1 /*
2 * Atheros AR71xx GPIO API definitions
3 *
4 * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
10 *
11 */
12
13 #ifndef __ASM_MACH_AR71XX_GPIO_H
14 #define __ASM_MACH_AR71XX_GPIO_H
15
16 #define ARCH_NR_GPIOS 64
17 #include <asm-generic/gpio.h>
18
19 extern unsigned long ar71xx_gpio_count;
20 extern void __ar71xx_gpio_set_value(unsigned gpio, int value);
21 extern int __ar71xx_gpio_get_value(unsigned gpio);
22 int gpio_to_irq(unsigned gpio);
23 int irq_to_gpio(unsigned gpio);
24
25 static inline int gpio_get_value(unsigned gpio)
26 {
27 if (gpio < ar71xx_gpio_count)
28 return __ar71xx_gpio_get_value(gpio);
29
30 return __gpio_get_value(gpio);
31 }
32
33 static inline void gpio_set_value(unsigned gpio, int value)
34 {
35 if (gpio < ar71xx_gpio_count)
36 __ar71xx_gpio_set_value(gpio, value);
37 else
38 __gpio_set_value(gpio, value);
39 }
40
41 #define gpio_cansleep __gpio_cansleep
42
43 #endif /* __ASM_MACH_AR71XX_GPIO_H */