Index: linux-2.6/include/asm-arm/arch-sa1100/gpio.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ linux-2.6/include/asm-arm/arch-sa1100/gpio.h 2006-12-30 14:43:49.000000000 +0100 @@ -0,0 +1,72 @@ +/* + * linux/include/asm-arm/arch-sa1100/gpio.h + * + * SA1100 GPIO wrappers for arch-neutral GPIO calls + * + * Written by Philipp Zabel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __ASM_ARCH_SA1100_GPIO_H +#define __ASM_ARCH_SA1100_GPIO_H + +#include +#include + +static inline int gpio_request(unsigned gpio, const char *label) +{ + return 0; +} + +static inline void gpio_free(unsigned gpio) +{ + return; +} + +#define gpio_direction_input sa1100_gpio_direction_output +#define gpio_direction_output sa1100_gpio_direction_output + +static inline int gpio_get_value(unsigned gpio) +{ + return GPLR & GPIO_GPIO(gpio); +} + +static inline void gpio_set_value(unsigned gpio, int value) +{ + if (value) + GPSR = GPIO_GPIO(gpio); + else + GPCR = GPIO_GPIO(gpio); +} + +static inline unsigned gpio_to_irq(unsigned gpio) +{ + if (gpio < 11) + return IRQ_GPIO0 + gpio; + else + return IRQ_GPIO11 - 11 + gpio; +} + +static inline unsigned irq_to_gpio(unsigned irq) +{ + if (irq < IRQ_GPIO11_27) + return irq - IRQ_GPIO0; + else + return irq - IRQ_GPIO11 + 11; +} + +#endif /* __ASM_ARCH_SA1100_GPIO_H */ Index: linux-2.6/arch/arm/mach-sa1100/generic.c =================================================================== --- linux-2.6.orig/arch/arm/mach-sa1100/generic.c 2006-12-27 21:50:03.000000000 +0100 +++ linux-2.6/arch/arm/mach-sa1100/generic.c 2006-12-30 14:50:42.000000000 +0100 @@ -138,6 +138,36 @@ return v; } +int sa1100_gpio_direction_input(unsigned gpio) +{ + unsigned long flags; + + if (gpio > GPIO_MAX) + return -EINVAL; + + local_irq_save(flags); + GPDR &= ~GPIO_GPIO(gpio); + local_irq_restore(flags); + return 0; +} + +EXPORT_SYMBOL(sa1100_gpio_direction_input); + +int sa1100_gpio_direction_output(unsigned gpio) +{ + unsigned long flags; + + if (gpio > GPIO_MAX) + return -EINVAL; + + local_irq_save(flags); + GPDR |= GPIO_GPIO(gpio); + local_irq_restore(flags); + return 0; +} + +EXPORT_SYMBOL(sa1100_gpio_direction_output); + /* * Default power-off for SA1100 */ Index: linux-2.6/include/asm-arm/arch-sa1100/hardware.h =================================================================== --- linux-2.6.orig/include/asm-arm/arch-sa1100/hardware.h 2006-12-27 21:50:05.000000000 +0100 +++ linux-2.6/include/asm-arm/arch-sa1100/hardware.h 2006-12-30 14:43:30.000000000 +0100 @@ -48,6 +48,9 @@ #endif +extern int sa1100_gpio_direction_input(unsigned gpio); +extern int sa1100_gpio_direction_output(unsigned gpio); + #include "SA-1100.h" #ifdef CONFIG_SA1101