Here's a version that compiles ...
From: Philipp Zabel <[email protected]>
Arch-neutral GPIO calls for PXA.
Signed-off-by: David Brownell <[email protected]>
Index: pxa/include/asm-arm/arch-sa1100/gpio.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ pxa/include/asm-arm/arch-sa1100/gpio.h 2006-12-29 18:21:00.000000000 -0800
@@ -0,0 +1,100 @@
+/*
+ * linux/include/asm-arm/arch-sa1100/gpio.h
+ *
+ * SA1100 GPIO wrappers for arch-neutral GPIO calls
+ *
+ * Written by Philipp Zabel <[email protected]>
+ *
+ * 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 <asm/hardware.h>
+#include <asm/arch/irqs.h>
+
+#include <asm/errno.h>
+
+static inline int gpio_request(unsigned gpio, const char *label)
+{
+ return 0;
+}
+
+static inline void gpio_free(unsigned gpio)
+{
+ return;
+}
+
+static inline int gpio_direction_input(unsigned gpio)
+{
+ if (gpio > GPIO_MAX)
+ return -EINVAL;
+ GPDR = (GPDR_In << gpio);
+ return 0;
+}
+
+static inline int gpio_direction_output(unsigned gpio)
+{
+ if (gpio > GPIO_MAX)
+ return -EINVAL;
+ GPDR = (GPDR_Out << gpio);
+ return 0;
+}
+
+extern int sa1100_gpio_get_value(unsigned gpio);
+extern void sa1100_gpio_set_value(unsigned gpio, int value);
+
+static inline int __gpio_get_value(unsigned gpio)
+{
+ return GPLR & GPIO_GPIO(gpio);
+}
+
+#define gpio_get_value(gpio) \
+ (__builtin_constant_p(gpio) \
+ ? __gpio_get_value(gpio) \
+ : sa1100_gpio_get_value(gpio))
+
+static inline void __gpio_set_value(unsigned gpio, int value)
+{
+ if (value)
+ GPSR = GPIO_GPIO(gpio);
+ else
+ GPCR = GPIO_GPIO(gpio);
+}
+
+#define gpio_set_value(gpio,value) \
+ (__builtin_constant_p(gpio) \
+ ? __gpio_set_value(gpio, value) \
+ : sa1100_gpio_set_value(gpio, value))
+
+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
Index: pxa/arch/arm/mach-sa1100/generic.c
===================================================================
--- pxa.orig/arch/arm/mach-sa1100/generic.c 2006-12-10 01:30:42.000000000 -0800
+++ pxa/arch/arm/mach-sa1100/generic.c 2006-12-29 17:46:47.000000000 -0800
@@ -28,6 +28,8 @@
#include <asm/mach/flash.h>
#include <asm/irq.h>
+#include <asm/arch/gpio.h>
+
#include "generic.h"
#define NR_FREQS 16
@@ -139,6 +141,26 @@ unsigned long long sched_clock(void)
}
/*
+ * Return GPIO level
+ */
+int sa1100_gpio_get_value(unsigned gpio)
+{
+ return __gpio_get_value(gpio);
+}
+
+EXPORT_SYMBOL(sa1100_gpio_get_value);
+
+/*
+ * Set output GPIO level
+ */
+void sa1100_gpio_set_value(unsigned gpio, int value)
+{
+ __gpio_set_value(gpio, value);
+}
+
+EXPORT_SYMBOL(sa1100_gpio_set_value);
+
+/*
* Default power-off for SA1100
*/
static void sa1100_power_off(void)
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]