aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm
diff options
context:
space:
mode:
authorJuergen Beisert <j.beisert@pengutronix.de>2008-07-05 04:02:49 -0400
committerRobert Schwebel <r.schwebel@pengutronix.de>2008-07-05 04:02:49 -0400
commit07bd1a6cc7cbb3f373fbe49b204c6cde5e9155fc (patch)
tree94a09785b99feebe4c83e836a976fe7fbf146813 /include/asm-arm
parente3d13ff4b9d3b05d7a969153e2c049548e25deea (diff)
MXC arch: Add gpio support for the whole platform
This patch bases on the one from Daniel Mack. The most important change to Daniel's patch is to be more generic. This gpio routine supports at least the i.MX27 and i.MX31 processors. Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de> Acked-by: Daniel Mack <daniel@caiaq.de>
Diffstat (limited to 'include/asm-arm')
-rw-r--r--include/asm-arm/arch-mxc/common.h1
-rw-r--r--include/asm-arm/arch-mxc/gpio.h42
-rw-r--r--include/asm-arm/arch-mxc/mx31.h19
3 files changed, 62 insertions, 0 deletions
diff --git a/include/asm-arm/arch-mxc/common.h b/include/asm-arm/arch-mxc/common.h
index c6d4aa360635..8774783ed984 100644
--- a/include/asm-arm/arch-mxc/common.h
+++ b/include/asm-arm/arch-mxc/common.h
@@ -17,5 +17,6 @@ extern void mxc_map_io(void);
17extern void mxc_init_irq(void); 17extern void mxc_init_irq(void);
18extern struct sys_timer mxc_timer; 18extern struct sys_timer mxc_timer;
19extern int mxc_clocks_init(unsigned long fref); 19extern int mxc_clocks_init(unsigned long fref);
20extern int mxc_register_gpios(void);
20 21
21#endif 22#endif
diff --git a/include/asm-arm/arch-mxc/gpio.h b/include/asm-arm/arch-mxc/gpio.h
new file mode 100644
index 000000000000..d393e15f5a6b
--- /dev/null
+++ b/include/asm-arm/arch-mxc/gpio.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef __ASM_ARCH_MXC_GPIO_H__
20#define __ASM_ARCH_MXC_GPIO_H__
21
22#include <asm/hardware.h>
23#include <asm-generic/gpio.h>
24
25/* use gpiolib dispatchers */
26#define gpio_get_value __gpio_get_value
27#define gpio_set_value __gpio_set_value
28#define gpio_cansleep __gpio_cansleep
29
30#define gpio_to_irq(gpio) (MXC_MAX_INT_LINES + (gpio))
31#define irq_to_gpio(irq) ((irq) - MXC_MAX_INT_LINES)
32
33struct mxc_gpio_port {
34 void __iomem *base;
35 int irq;
36 int virtual_irq_start;
37 struct gpio_chip chip;
38};
39
40int mxc_gpio_init(struct mxc_gpio_port*, int);
41
42#endif
diff --git a/include/asm-arm/arch-mxc/mx31.h b/include/asm-arm/arch-mxc/mx31.h
index 36a1af495bb3..98e6a4cd1ea9 100644
--- a/include/asm-arm/arch-mxc/mx31.h
+++ b/include/asm-arm/arch-mxc/mx31.h
@@ -347,6 +347,25 @@
347#define SYSTEM_REV_MIN CHIP_REV_1_0 347#define SYSTEM_REV_MIN CHIP_REV_1_0
348#define SYSTEM_REV_NUM 3 348#define SYSTEM_REV_NUM 3
349 349
350/* gpio and gpio based interrupt handling */
351#define GPIO_DR 0x00
352#define GPIO_GDIR 0x04
353#define GPIO_PSR 0x08
354#define GPIO_ICR1 0x0C
355#define GPIO_ICR2 0x10
356#define GPIO_IMR 0x14
357#define GPIO_ISR 0x18
358#define GPIO_INT_LOW_LEV 0x0
359#define GPIO_INT_HIGH_LEV 0x1
360#define GPIO_INT_RISE_EDGE 0x2
361#define GPIO_INT_FALL_EDGE 0x3
362#define GPIO_INT_NONE 0x4
363
364/* Mandatory defines used globally */
365
366/* this CPU supports up to 96 GPIOs */
367#define ARCH_NR_GPIOS 96
368
350#if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS) 369#if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS)
351 370
352/* this is a i.MX31 CPU */ 371/* this is a i.MX31 CPU */