Skip to contentSkip to conversation

GPIO: Add SPEAr GPIO driver

PATCH New Stefan Roese 1 participant 1 message May 8, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GPIO: Add SPEAr GPIO driver

Tested on x600 (SPEAr600).

---
 arch/arm/include/asm/arch-spear/gpio.h |   40 +++++++++++++
 drivers/gpio/Makefile                  |    1 +
 drivers/gpio/spear_gpio.c              |  102 ++++++++++++++++++++++++++++++++
 3 files changed, 143 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-spear/gpio.h
 create mode 100644 drivers/gpio/spear_gpio.c
arch/arm/include/asm/arch-spear/gpio.h new file +40 -0
new file mode 100644
index 0000000..c3697de
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 Stefan Roese <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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_SPEAR_GPIO_H
+#define __ASM_ARCH_SPEAR_GPIO_H
+
+enum gpio_direction {
+	GPIO_DIRECTION_IN,
+	GPIO_DIRECTION_OUT,
+};
+
+struct gpio_regs {
+	u32 gpiodata[0x100];	/* 0x000 ... 0x3fc */
+	u32 gpiodir;		/* 0x400 */
+};
+
+#define SPEAR_GPIO_COUNT		8
+#define DATA_REG_ADDR(gpio)		(1 << (gpio + 2))
+
+#endif	/* __ASM_ARCH_SPEAR_GPIO_H */
drivers/gpio/Makefile +1 -0
index fb3b09a..10e82b9 100644
@@ -35,6 +35,7 @@ COBJS-$(CONFIG_PCA953X)		+= pca953x.o
 COBJS-$(CONFIG_PCA9698)		+= pca9698.o
 COBJS-$(CONFIG_S5P)		+= s5p_gpio.o
 COBJS-$(CONFIG_SANDBOX_GPIO)	+= sandbox.o
+COBJS-$(CONFIG_SPEAR_GPIO)	+= spear_gpio.o
 COBJS-$(CONFIG_TEGRA2_GPIO)	+= tegra2_gpio.o
 COBJS-$(CONFIG_DA8XX_GPIO)	+= da8xx_gpio.o
 COBJS-$(CONFIG_ALTERA_PIO)	+= altera_pio.o
drivers/gpio/spear_gpio.c new file +102 -0

102 lines not on this page · raw message

Signature · 1 line
1.7.10.1