2 * Atheros AR71xx GPIO API definitions
4 * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
13 #ifndef __ASM_MACH_AR71XX_GPIO_H
14 #define __ASM_MACH_AR71XX_GPIO_H
16 #define ARCH_NR_GPIOS 64
17 #include <asm-generic/gpio.h>
19 #include <asm/mach-ar71xx/ar71xx.h>
21 extern unsigned long ar71xx_gpio_count
;
22 extern void __ar71xx_gpio_set_value(unsigned gpio
, int value
);
23 extern int __ar71xx_gpio_get_value(unsigned gpio
);
25 static inline int gpio_to_irq(unsigned gpio
)
27 return AR71XX_GPIO_IRQ(gpio
);
30 static inline int irq_to_gpio(unsigned irq
)
32 return irq
- AR71XX_GPIO_IRQ_BASE
;
35 static inline int gpio_get_value(unsigned gpio
)
37 if (gpio
< ar71xx_gpio_count
)
38 return __ar71xx_gpio_get_value(gpio
);
40 return __gpio_get_value(gpio
);
43 static inline void gpio_set_value(unsigned gpio
, int value
)
45 if (gpio
< ar71xx_gpio_count
)
46 __ar71xx_gpio_set_value(gpio
, value
);
48 __gpio_set_value(gpio
, value
);
51 #define gpio_cansleep __gpio_cansleep
53 #endif /* __ASM_MACH_AR71XX_GPIO_H */
This page took 0.045861 seconds and 5 git commands to generate.