aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2007-02-05 10:57:13 -0500
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2007-02-09 09:01:58 -0500
commit6a4e5227a33f60f918b30cf2001fb0bb259d9396 (patch)
treea3e8d130fdfb88710872afc9908e1e78644b300f /include
parent10b50b7dd2716b944299d45452d0875dbeb5f0c2 (diff)
[AVR32] GPIO API implementation
Arch-neutral GPIO calls for AVR32. GPIO IRQ support written by David Brownell. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-avr32/arch-at32ap/gpio.h27
-rw-r--r--include/asm-avr32/arch-at32ap/irq.h14
-rw-r--r--include/asm-avr32/arch-at32ap/portmux.h7
-rw-r--r--include/asm-avr32/gpio.h6
-rw-r--r--include/asm-avr32/irq.h8
5 files changed, 57 insertions, 5 deletions
diff --git a/include/asm-avr32/arch-at32ap/gpio.h b/include/asm-avr32/arch-at32ap/gpio.h
new file mode 100644
index 000000000000..fcb756bdaa8e
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/gpio.h
@@ -0,0 +1,27 @@
1#ifndef __ASM_AVR32_ARCH_GPIO_H
2#define __ASM_AVR32_ARCH_GPIO_H
3
4#include <linux/compiler.h>
5#include <asm/irq.h>
6
7
8/* Arch-neutral GPIO API */
9int __must_check gpio_request(unsigned int gpio, const char *label);
10void gpio_free(unsigned int gpio);
11
12int gpio_direction_input(unsigned int gpio);
13int gpio_direction_output(unsigned int gpio);
14int gpio_get_value(unsigned int gpio);
15void gpio_set_value(unsigned int gpio, int value);
16
17static inline int gpio_to_irq(unsigned int gpio)
18{
19 return gpio + GPIO_IRQ_BASE;
20}
21
22static inline int irq_to_gpio(unsigned int irq)
23{
24 return irq - GPIO_IRQ_BASE;
25}
26
27#endif /* __ASM_AVR32_ARCH_GPIO_H */
diff --git a/include/asm-avr32/arch-at32ap/irq.h b/include/asm-avr32/arch-at32ap/irq.h
new file mode 100644
index 000000000000..f8f7f4571e44
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/irq.h
@@ -0,0 +1,14 @@
1#ifndef __ASM_AVR32_ARCH_IRQ_H
2#define __ASM_AVR32_ARCH_IRQ_H
3
4#define EIM_IRQ_BASE NR_INTERNAL_IRQS
5#define NR_EIM_IRQS 32
6
7#define AT32_EXTINT(n) (EIM_IRQ_BASE + (n))
8
9#define GPIO_IRQ_BASE (EIM_IRQ_BASE + NR_EIM_IRQS)
10#define NR_GPIO_IRQS (4 * 32)
11
12#define NR_IRQS (GPIO_IRQ_BASE + NR_GPIO_IRQS)
13
14#endif /* __ASM_AVR32_ARCH_IRQ_H */
diff --git a/include/asm-avr32/arch-at32ap/portmux.h b/include/asm-avr32/arch-at32ap/portmux.h
index 83c690571322..2ba611e0e134 100644
--- a/include/asm-avr32/arch-at32ap/portmux.h
+++ b/include/asm-avr32/arch-at32ap/portmux.h
@@ -15,9 +15,10 @@
15 * 15 *
16 * The following flags determine the initial state of the pin. 16 * The following flags determine the initial state of the pin.
17 */ 17 */
18#define AT32_GPIOF_PULLUP 0x00000001 /* Enable pull-up */ 18#define AT32_GPIOF_PULLUP 0x00000001 /* (not-OUT) Enable pull-up */
19#define AT32_GPIOF_OUTPUT 0x00000002 /* Enable output driver */ 19#define AT32_GPIOF_OUTPUT 0x00000002 /* (OUT) Enable output driver */
20#define AT32_GPIOF_HIGH 0x00000004 /* Set output high */ 20#define AT32_GPIOF_HIGH 0x00000004 /* (OUT) Set output high */
21#define AT32_GPIOF_DEGLITCH 0x00000008 /* (IN) Filter glitches */
21 22
22void at32_select_periph(unsigned int pin, unsigned int periph, 23void at32_select_periph(unsigned int pin, unsigned int periph,
23 unsigned long flags); 24 unsigned long flags);
diff --git a/include/asm-avr32/gpio.h b/include/asm-avr32/gpio.h
new file mode 100644
index 000000000000..19e8ccc77db3
--- /dev/null
+++ b/include/asm-avr32/gpio.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_GPIO_H
2#define __ASM_AVR32_GPIO_H
3
4#include <asm/arch/gpio.h>
5
6#endif /* __ASM_AVR32_GPIO_H */
diff --git a/include/asm-avr32/irq.h b/include/asm-avr32/irq.h
index f7e725707dd7..83e6549d7783 100644
--- a/include/asm-avr32/irq.h
+++ b/include/asm-avr32/irq.h
@@ -2,8 +2,12 @@
2#define __ASM_AVR32_IRQ_H 2#define __ASM_AVR32_IRQ_H
3 3
4#define NR_INTERNAL_IRQS 64 4#define NR_INTERNAL_IRQS 64
5#define NR_EXTERNAL_IRQS 64 5
6#define NR_IRQS (NR_INTERNAL_IRQS + NR_EXTERNAL_IRQS) 6#include <asm/arch/irq.h>
7
8#ifndef NR_IRQS
9#define NR_IRQS (NR_INTERNAL_IRQS)
10#endif
7 11
8#define irq_canonicalize(i) (i) 12#define irq_canonicalize(i) (i)
9 13