summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-clps711x
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2013-03-11 13:26:37 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-11 22:17:42 +0100
commit5fdba0feadefd2cc15a5c4d094f5891bf90e4a3b (patch)
tree2de7e75106231926175d7ebb049af56c404ce45b /arch/arm/mach-clps711x
parent100c016f3561d5f87fd27f8cb02d886ba3e72536 (diff)
downloadbarebox-5fdba0feadefd2cc15a5c4d094f5891bf90e4a3b.tar.gz
barebox-5fdba0feadefd2cc15a5c4d094f5891bf90e4a3b.tar.xz
ARM: clps711x: Add GPIO driver
This patch adds support for CLPS711X GPIOs. Driver based on generic GPIO driver. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-clps711x')
-rw-r--r--arch/arm/mach-clps711x/devices.c82
-rw-r--r--arch/arm/mach-clps711x/include/mach/gpio.h3
2 files changed, 85 insertions, 0 deletions
diff --git a/arch/arm/mach-clps711x/devices.c b/arch/arm/mach-clps711x/devices.c
index 6221da30b8..f94b5849bb 100644
--- a/arch/arm/mach-clps711x/devices.c
+++ b/arch/arm/mach-clps711x/devices.c
@@ -111,3 +111,85 @@ void clps711x_add_uart(unsigned int id)
break;
}
}
+
+static struct resource gpio0_resources[] = {
+ {
+ .start = PADR,
+ .end = PADR,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = PADDR,
+ .end = PADDR,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct resource gpio1_resources[] = {
+ {
+ .start = PBDR,
+ .end = PBDR,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = PBDDR,
+ .end = PBDDR,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct resource gpio2_resources[] = {
+ {
+ .start = PCDR,
+ .end = PCDR,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = PCDDR,
+ .end = PCDDR,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct resource gpio3_resources[] = {
+ {
+ .start = PDDR,
+ .end = PDDR,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = PDDDR,
+ .end = PDDDR,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct resource gpio4_resources[] = {
+ {
+ .start = PEDR,
+ .end = PEDR,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = PEDDR,
+ .end = PEDDR,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static __init int clps711x_gpio_init(void)
+{
+ add_generic_device_res("clps711x-gpio", 0, gpio0_resources,
+ ARRAY_SIZE(gpio0_resources), NULL);
+ add_generic_device_res("clps711x-gpio", 1, gpio1_resources,
+ ARRAY_SIZE(gpio1_resources), NULL);
+ add_generic_device_res("clps711x-gpio", 2, gpio2_resources,
+ ARRAY_SIZE(gpio2_resources), NULL);
+ add_generic_device_res("clps711x-gpio", 3, gpio3_resources,
+ ARRAY_SIZE(gpio3_resources), NULL);
+ add_generic_device_res("clps711x-gpio", 4, gpio4_resources,
+ ARRAY_SIZE(gpio4_resources), NULL);
+
+ return 0;
+}
+coredevice_initcall(clps711x_gpio_init);
diff --git a/arch/arm/mach-clps711x/include/mach/gpio.h b/arch/arm/mach-clps711x/include/mach/gpio.h
new file mode 100644
index 0000000000..3428fe54bb
--- /dev/null
+++ b/arch/arm/mach-clps711x/include/mach/gpio.h
@@ -0,0 +1,3 @@
+#include <asm-generic/gpio.h>
+
+#define CLPS711X_GPIO(prt,bit) ((prt) * 8 + (bit))