diff options
author | Holger Schurig <hs4233@mail.mn-solutions.de> | 2009-01-29 04:07:50 -0500 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-03-13 05:33:44 -0400 |
commit | ccfe30a7c8329e85ae426813a1060e27e2547dd1 (patch) | |
tree | 3a1b77c46e084c4ea0236c315d949af72a678bf6 /arch/arm/plat-mxc/include/mach/iomux.h | |
parent | 16b71fdf97599f1b1b7f38418ee9922d9f117396 (diff) |
arm/imx2x: new IOMUX definitions
* removed iomux-mx1-mx2.h completely
* distributes the former contents to four different files (iomux-mx1.h,
iomux-mx21.h, iomux-mx27.h and the file iomux-mx2x.h, which is common to
both i.MX21 and i.MX27).
* adds all documented IOMUX definitions for i.MX21 and i.MX27
* fixes a few that were wrong (PD14_AOUT_FEC_CLR, PE16_AF_RTCK).
* don't silenly include <linux/io.h>
* and fixes all collateral damage from above
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/plat-mxc/include/mach/iomux.h')
-rw-r--r-- | arch/arm/plat-mxc/include/mach/iomux.h | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/arch/arm/plat-mxc/include/mach/iomux.h b/arch/arm/plat-mxc/include/mach/iomux.h new file mode 100644 index 000000000000..171f8adc1109 --- /dev/null +++ b/arch/arm/plat-mxc/include/mach/iomux.h | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de> | ||
3 | * Copyright (C) 2009 by Holger Schurig <hs4233@mail.mn-solutions.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, | ||
17 | * MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef _MXC_IOMUX_H | ||
21 | #define _MXC_IOMUX_H | ||
22 | |||
23 | /* | ||
24 | * GPIO Module and I/O Multiplexer | ||
25 | * x = 0..3 for reg_A, reg_B, reg_C, reg_D | ||
26 | */ | ||
27 | #define VA_GPIO_BASE IO_ADDRESS(GPIO_BASE_ADDR) | ||
28 | #define MXC_DDIR(x) (0x00 + ((x) << 8)) | ||
29 | #define MXC_OCR1(x) (0x04 + ((x) << 8)) | ||
30 | #define MXC_OCR2(x) (0x08 + ((x) << 8)) | ||
31 | #define MXC_ICONFA1(x) (0x0c + ((x) << 8)) | ||
32 | #define MXC_ICONFA2(x) (0x10 + ((x) << 8)) | ||
33 | #define MXC_ICONFB1(x) (0x14 + ((x) << 8)) | ||
34 | #define MXC_ICONFB2(x) (0x18 + ((x) << 8)) | ||
35 | #define MXC_DR(x) (0x1c + ((x) << 8)) | ||
36 | #define MXC_GIUS(x) (0x20 + ((x) << 8)) | ||
37 | #define MXC_SSR(x) (0x24 + ((x) << 8)) | ||
38 | #define MXC_ICR1(x) (0x28 + ((x) << 8)) | ||
39 | #define MXC_ICR2(x) (0x2c + ((x) << 8)) | ||
40 | #define MXC_IMR(x) (0x30 + ((x) << 8)) | ||
41 | #define MXC_ISR(x) (0x34 + ((x) << 8)) | ||
42 | #define MXC_GPR(x) (0x38 + ((x) << 8)) | ||
43 | #define MXC_SWR(x) (0x3c + ((x) << 8)) | ||
44 | #define MXC_PUEN(x) (0x40 + ((x) << 8)) | ||
45 | |||
46 | #ifdef CONFIG_ARCH_MX1 | ||
47 | # define GPIO_PORT_MAX 3 | ||
48 | #endif | ||
49 | #ifdef CONFIG_ARCH_MX2 | ||
50 | # define GPIO_PORT_MAX 5 | ||
51 | #endif | ||
52 | |||
53 | #ifndef GPIO_PORT_MAX | ||
54 | # error "GPIO config port count unknown!" | ||
55 | #endif | ||
56 | |||
57 | #define GPIO_PIN_MASK 0x1f | ||
58 | |||
59 | #define GPIO_PORT_SHIFT 5 | ||
60 | #define GPIO_PORT_MASK (0x7 << GPIO_PORT_SHIFT) | ||
61 | |||
62 | #define GPIO_PORTA (0 << GPIO_PORT_SHIFT) | ||
63 | #define GPIO_PORTB (1 << GPIO_PORT_SHIFT) | ||
64 | #define GPIO_PORTC (2 << GPIO_PORT_SHIFT) | ||
65 | #define GPIO_PORTD (3 << GPIO_PORT_SHIFT) | ||
66 | #define GPIO_PORTE (4 << GPIO_PORT_SHIFT) | ||
67 | #define GPIO_PORTF (5 << GPIO_PORT_SHIFT) | ||
68 | |||
69 | #define GPIO_OUT (1 << 8) | ||
70 | #define GPIO_IN (0 << 8) | ||
71 | #define GPIO_PUEN (1 << 9) | ||
72 | |||
73 | #define GPIO_PF (1 << 10) | ||
74 | #define GPIO_AF (1 << 11) | ||
75 | |||
76 | #define GPIO_OCR_SHIFT 12 | ||
77 | #define GPIO_OCR_MASK (3 << GPIO_OCR_SHIFT) | ||
78 | #define GPIO_AIN (0 << GPIO_OCR_SHIFT) | ||
79 | #define GPIO_BIN (1 << GPIO_OCR_SHIFT) | ||
80 | #define GPIO_CIN (2 << GPIO_OCR_SHIFT) | ||
81 | #define GPIO_GPIO (3 << GPIO_OCR_SHIFT) | ||
82 | |||
83 | #define GPIO_AOUT_SHIFT 14 | ||
84 | #define GPIO_AOUT_MASK (3 << GPIO_AOUT_SHIFT) | ||
85 | #define GPIO_AOUT (0 << GPIO_AOUT_SHIFT) | ||
86 | #define GPIO_AOUT_ISR (1 << GPIO_AOUT_SHIFT) | ||
87 | #define GPIO_AOUT_0 (2 << GPIO_AOUT_SHIFT) | ||
88 | #define GPIO_AOUT_1 (3 << GPIO_AOUT_SHIFT) | ||
89 | |||
90 | #define GPIO_BOUT_SHIFT 16 | ||
91 | #define GPIO_BOUT_MASK (3 << GPIO_BOUT_SHIFT) | ||
92 | #define GPIO_BOUT (0 << GPIO_BOUT_SHIFT) | ||
93 | #define GPIO_BOUT_ISR (1 << GPIO_BOUT_SHIFT) | ||
94 | #define GPIO_BOUT_0 (2 << GPIO_BOUT_SHIFT) | ||
95 | #define GPIO_BOUT_1 (3 << GPIO_BOUT_SHIFT) | ||
96 | |||
97 | |||
98 | #ifdef CONFIG_ARCH_MX1 | ||
99 | #include <mach/iomux-mx1.h> | ||
100 | #endif | ||
101 | #ifdef CONFIG_ARCH_MX2 | ||
102 | #include <mach/iomux-mx2x.h> | ||
103 | #ifdef CONFIG_MACH_MX21 | ||
104 | #include <mach/iomux-mx21.h> | ||
105 | #endif | ||
106 | #ifdef CONFIG_MACH_MX27 | ||
107 | #include <mach/iomux-mx27.h> | ||
108 | #endif | ||
109 | #endif | ||
110 | |||
111 | |||
112 | /* decode irq number to use with IMR(x), ISR(x) and friends */ | ||
113 | #define IRQ_TO_REG(irq) ((irq - MXC_INTERNAL_IRQS) >> 5) | ||
114 | |||
115 | #define IRQ_GPIOA(x) (MXC_GPIO_IRQ_START + x) | ||
116 | #define IRQ_GPIOB(x) (IRQ_GPIOA(32) + x) | ||
117 | #define IRQ_GPIOC(x) (IRQ_GPIOB(32) + x) | ||
118 | #define IRQ_GPIOD(x) (IRQ_GPIOC(32) + x) | ||
119 | #define IRQ_GPIOE(x) (IRQ_GPIOD(32) + x) | ||
120 | |||
121 | |||
122 | extern void mxc_gpio_mode(int gpio_mode); | ||
123 | extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count, | ||
124 | const char *label); | ||
125 | extern void mxc_gpio_release_multiple_pins(const int *pin_list, int count); | ||
126 | |||
127 | #endif | ||