allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / arm / plat-iop / gpio.c
blobeda436083417977ea8e60c2aa35436a2e7b71c73
1 /*
2 * arch/arm/plat-iop/gpio.c
3 * GPIO handling for Intel IOP3xx processors.
5 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
13 #include <linux/device.h>
14 #include <asm/hardware/iop3xx.h>
16 void gpio_line_config(int line, int direction)
18 unsigned long flags;
20 local_irq_save(flags);
21 if (direction == GPIO_IN) {
22 *IOP3XX_GPOE |= 1 << line;
23 } else if (direction == GPIO_OUT) {
24 *IOP3XX_GPOE &= ~(1 << line);
26 local_irq_restore(flags);
28 EXPORT_SYMBOL(gpio_line_config);
30 int gpio_line_get(int line)
32 return !!(*IOP3XX_GPID & (1 << line));
34 EXPORT_SYMBOL(gpio_line_get);
36 void gpio_line_set(int line, int value)
38 unsigned long flags;
40 local_irq_save(flags);
41 if (value == GPIO_LOW) {
42 *IOP3XX_GPOD &= ~(1 << line);
43 } else if (value == GPIO_HIGH) {
44 *IOP3XX_GPOD |= 1 << line;
46 local_irq_restore(flags);
48 EXPORT_SYMBOL(gpio_line_set);