aboutsummaryrefslogtreecommitdiff
path: root/include/asm-arm
diff options
context:
space:
mode:
authorHolger Freyther <zecke@openmoko.org>2008-11-19 17:09:36 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:09:36 +0000
commit45dc83b5242f041b1c0af6415d773564ab198942 (patch)
treea9a7e1271fcb70b723e8a74468612a4601b2ac9a /include/asm-arm
parent8c5ea97172f712b24b8ed9fc82014d4a99c35a70 (diff)
Add GPIO -> IRQ for the s3c2410 and add irq_to_gpio to the gpio.h of the Samsung SoC
Use this irq_to_gpio in the neo1973 keyboard driver
Diffstat (limited to 'include/asm-arm')
-rw-r--r--include/asm-arm/arch-s3c2410/gpio.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/include/asm-arm/arch-s3c2410/gpio.h b/include/asm-arm/arch-s3c2410/gpio.h
new file mode 100644
index 00000000000..b2bc7bfea63
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/gpio.h
@@ -0,0 +1,63 @@
+/* linux/include/asm-arm/arch-s3c2410/gpio.h
+ *
+ * Copyright (c) 2008 Simtec Electronics
+ * http://armlinux.simtec.co.uk/
+ * Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2410 - GPIO lib support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#define gpio_get_value __gpio_get_value
+#define gpio_set_value __gpio_set_value
+#define gpio_cansleep __gpio_cansleep
+
+#ifndef __ASM_ARCH_S3C2410_GPIO_H
+#define __ASM_ARCH_S3C2410_GPIO_H
+
+#include <asm/irq.h>
+#include <asm/hardware.h>
+#include <asm/arch/regs-gpio.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)
+{
+ s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_INPUT);
+ return 0;
+}
+
+static inline int gpio_direction_output(unsigned gpio, int value)
+{
+ s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_OUTPUT);
+ /* REVISIT can we write the value first, to avoid glitching? */
+ s3c2410_gpio_setpin(gpio, value);
+ return 0;
+}
+
+#define gpio_get_value(gpio) s3c2410_gpio_getpin(gpio)
+#define gpio_set_value(gpio,value) s3c2410_gpio_setpin(gpio, value)
+
+#include <asm-generic/gpio.h> /* cansleep wrappers */
+
+#ifdef CONFIG_CPU_S3C2400
+#define gpio_to_irq(gpio) s3c2400_gpio_getirq(gpio)
+#else
+#define gpio_to_irq(gpio) s3c2410_gpio_getirq(gpio)
+#define irq_to_gpio(irq) s3c2410_irq_to_gpio(irq)
+#endif
+
+/* FIXME implement irq_to_gpio() */
+
+#include <asm-generic/gpio.h>