]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - include/asm-arm/arch-mx28/pinctrl.h
imported Ka-Ro specific additions to U-Boot 2009.08 for TX28
[karo-tx-uboot.git] / include / asm-arm / arch-mx28 / pinctrl.h
1 /*
2  *
3  * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19 #ifndef __PINCTRL_H
20 #define __PINCTRL_H
21
22 #define PIN_BITS                5
23 #define PINS_PER_BANK           (1 << PIN_BITS)
24 #define PINID_2_BANK(id)        ((id) >> PIN_BITS)
25 #define PINID_2_PIN(id)         ((id) & (PINS_PER_BANK - 1))
26 #define PINID_ENCODE(bank, pin) (((bank) << PIN_BITS) + (pin))
27
28 /*
29  * Each pin may be routed up to four different HW interfaces
30  * including GPIO
31  */
32 enum pin_fun {
33         PIN_FUN1 = 0,
34         PIN_FUN2,
35         PIN_FUN3,
36         PIN_GPIO
37 };
38
39 /*
40  * Each pin may have different output drive strength in range from
41  * 4mA to 20mA. The most common case is 4, 8 and 12 mA strengths.
42  */
43 enum pad_strength {
44         PAD_4MA = 0,
45         PAD_8MA,
46         PAD_12MA,
47         PAD_RESV
48 };
49
50 /*
51  * Each pin can be programmed for 1.8V or 3.3V
52  */
53 enum pad_voltage {
54         PAD_1V8 = 0,
55         PAD_3V3
56 };
57
58 /*
59  * Structure to define a group of pins and their parameters
60  */
61 struct pin_desc {
62         u32 id;
63         enum pin_fun fun;
64         enum pad_strength strength;
65         enum pad_voltage voltage;
66         u32 pullup:1;
67 };
68
69 struct pin_group {
70         struct pin_desc *pins;
71         int nr_pins;
72 };
73
74 extern void pin_gpio_direction(u32 id, u32 output);
75 extern u32 pin_gpio_get(u32 id);
76 extern void pin_gpio_set(u32 id, u32 val);
77 extern void pin_set_type(u32 id, enum pin_fun cfg);
78 extern void pin_set_strength(u32 id, enum pad_strength strength);
79 extern void pin_set_voltage(u32 id, enum pad_voltage volt);
80 extern void pin_set_pullup(u32 id, u32 pullup);
81 extern void pin_set_group(struct pin_group *pin_group);
82
83 /*
84  * Definitions of all i.MX28 pins
85  */
86 /* Bank 0 */
87 #define PINID_GPMI_D00          PINID_ENCODE(0, 0)
88 #define PINID_GPMI_D01          PINID_ENCODE(0, 1)
89 #define PINID_GPMI_D02          PINID_ENCODE(0, 2)
90 #define PINID_GPMI_D03          PINID_ENCODE(0, 3)
91 #define PINID_GPMI_D04          PINID_ENCODE(0, 4)
92 #define PINID_GPMI_D05          PINID_ENCODE(0, 5)
93 #define PINID_GPMI_D06          PINID_ENCODE(0, 6)
94 #define PINID_GPMI_D07          PINID_ENCODE(0, 7)
95 #define PINID_GPMI_CE0N         PINID_ENCODE(0, 16)
96 #define PINID_GPMI_CE1N         PINID_ENCODE(0, 17)
97 #define PINID_GPMI_CE2N         PINID_ENCODE(0, 18)
98 #define PINID_GPMI_CE3N         PINID_ENCODE(0, 19)
99 #define PINID_GPMI_RDY0         PINID_ENCODE(0, 20)
100 #define PINID_GPMI_RDY1         PINID_ENCODE(0, 21)
101 #define PINID_GPMI_RDY2         PINID_ENCODE(0, 22)
102 #define PINID_GPMI_RDY3         PINID_ENCODE(0, 23)
103 #define PINID_GPMI_RDN          PINID_ENCODE(0, 24)
104 #define PINID_GPMI_WRN          PINID_ENCODE(0, 25)
105 #define PINID_GPMI_ALE          PINID_ENCODE(0, 26)
106 #define PINID_GPMI_CLE          PINID_ENCODE(0, 27)
107 #define PINID_GPMI_RESETN       PINID_ENCODE(0, 28)
108
109 /* Bank 1 */
110 #define PINID_LCD_D00           PINID_ENCODE(1, 0)
111 #define PINID_LCD_D01           PINID_ENCODE(1, 1)
112 #define PINID_LCD_D02           PINID_ENCODE(1, 2)
113 #define PINID_LCD_D03           PINID_ENCODE(1, 3)
114 #define PINID_LCD_D04           PINID_ENCODE(1, 4)
115 #define PINID_LCD_D05           PINID_ENCODE(1, 5)
116 #define PINID_LCD_D06           PINID_ENCODE(1, 6)
117 #define PINID_LCD_D07           PINID_ENCODE(1, 7)
118 #define PINID_LCD_D08           PINID_ENCODE(1, 8)
119 #define PINID_LCD_D09           PINID_ENCODE(1, 9)
120 #define PINID_LCD_D10           PINID_ENCODE(1, 10)
121 #define PINID_LCD_D11           PINID_ENCODE(1, 11)
122 #define PINID_LCD_D12           PINID_ENCODE(1, 12)
123 #define PINID_LCD_D13           PINID_ENCODE(1, 13)
124 #define PINID_LCD_D14           PINID_ENCODE(1, 14)
125 #define PINID_LCD_D15           PINID_ENCODE(1, 15)
126 #define PINID_LCD_D16           PINID_ENCODE(1, 16)
127 #define PINID_LCD_D17           PINID_ENCODE(1, 17)
128 #define PINID_LCD_D18           PINID_ENCODE(1, 18)
129 #define PINID_LCD_D19           PINID_ENCODE(1, 19)
130 #define PINID_LCD_D20           PINID_ENCODE(1, 20)
131 #define PINID_LCD_D21           PINID_ENCODE(1, 21)
132 #define PINID_LCD_D22           PINID_ENCODE(1, 22)
133 #define PINID_LCD_D23           PINID_ENCODE(1, 23)
134 #define PINID_LCD_RD_E          PINID_ENCODE(1, 24)
135 #define PINID_LCD_WR_RWN        PINID_ENCODE(1, 25)
136 #define PINID_LCD_RS            PINID_ENCODE(1, 26)
137 #define PINID_LCD_CS            PINID_ENCODE(1, 27)
138 #define PINID_LCD_VSYNC         PINID_ENCODE(1, 28)
139 #define PINID_LCD_HSYNC         PINID_ENCODE(1, 29)
140 #define PINID_LCD_DOTCK         PINID_ENCODE(1, 30)
141 #define PINID_LCD_ENABLE        PINID_ENCODE(1, 31)
142
143 /* Bank 2 */
144 #define PINID_SSP0_DATA0        PINID_ENCODE(2, 0)
145 #define PINID_SSP0_DATA1        PINID_ENCODE(2, 1)
146 #define PINID_SSP0_DATA2        PINID_ENCODE(2, 2)
147 #define PINID_SSP0_DATA3        PINID_ENCODE(2, 3)
148 #define PINID_SSP0_DATA4        PINID_ENCODE(2, 4)
149 #define PINID_SSP0_DATA5        PINID_ENCODE(2, 5)
150 #define PINID_SSP0_DATA6        PINID_ENCODE(2, 6)
151 #define PINID_SSP0_DATA7        PINID_ENCODE(2, 7)
152 #define PINID_SSP0_CMD          PINID_ENCODE(2, 8)
153 #define PINID_SSP0_DETECT       PINID_ENCODE(2, 9)
154 #define PINID_SSP0_SCK          PINID_ENCODE(2, 10)
155 #define PINID_SSP1_SCK          PINID_ENCODE(2, 12)
156 #define PINID_SSP1_CMD          PINID_ENCODE(2, 13)
157 #define PINID_SSP1_DATA0        PINID_ENCODE(2, 14)
158 #define PINID_SSP1_DATA3        PINID_ENCODE(2, 15)
159 #define PINID_SSP2_SCK          PINID_ENCODE(2, 16)
160 #define PINID_SSP2_MOSI         PINID_ENCODE(2, 17)
161 #define PINID_SSP2_MISO         PINID_ENCODE(2, 18)
162 #define PINID_SSP2_SS0          PINID_ENCODE(2, 19)
163 #define PINID_SSP2_SS1          PINID_ENCODE(2, 20)
164 #define PINID_SSP2_SS2          PINID_ENCODE(2, 21)
165 #define PINID_SSP3_SCK          PINID_ENCODE(2, 24)
166 #define PINID_SSP3_MOSI         PINID_ENCODE(2, 25)
167 #define PINID_SSP3_MISO         PINID_ENCODE(2, 26)
168 #define PINID_SSP3_SS0          PINID_ENCODE(2, 27)
169
170 /* Bank 3 */
171 #define PINID_AUART0_RX         PINID_ENCODE(3, 0)
172 #define PINID_AUART0_TX         PINID_ENCODE(3, 1)
173 #define PINID_AUART0_CTS        PINID_ENCODE(3, 2)
174 #define PINID_AUART0_RTS        PINID_ENCODE(3, 3)
175 #define PINID_AUART1_RX         PINID_ENCODE(3, 4)
176 #define PINID_AUART1_TX         PINID_ENCODE(3, 5)
177 #define PINID_AUART1_CTS        PINID_ENCODE(3, 6)
178 #define PINID_AUART1_RTS        PINID_ENCODE(3, 7)
179 #define PINID_AUART2_RX         PINID_ENCODE(3, 8)
180 #define PINID_AUART2_TX         PINID_ENCODE(3, 9)
181 #define PINID_AUART2_CTS        PINID_ENCODE(3, 10)
182 #define PINID_AUART2_RTS        PINID_ENCODE(3, 11)
183 #define PINID_AUART3_RX         PINID_ENCODE(3, 12)
184 #define PINID_AUART3_TX         PINID_ENCODE(3, 13)
185 #define PINID_AUART3_CTS        PINID_ENCODE(3, 14)
186 #define PINID_AUART3_RTS        PINID_ENCODE(3, 15)
187 #define PINID_PWM0              PINID_ENCODE(3, 16)
188 #define PINID_PWM1              PINID_ENCODE(3, 17)
189 #define PINID_PWM2              PINID_ENCODE(3, 18)
190 #define PINID_SAIF0_MCLK        PINID_ENCODE(3, 20)
191 #define PINID_SAIF0_LRCLK       PINID_ENCODE(3, 21)
192 #define PINID_SAIF0_BITCLK      PINID_ENCODE(3, 22)
193 #define PINID_SAIF0_SDATA0      PINID_ENCODE(3, 23)
194 #define PINID_I2C0_SCL          PINID_ENCODE(3, 24)
195 #define PINID_I2C0_SDA          PINID_ENCODE(3, 25)
196 #define PINID_SAIF1_SDATA0      PINID_ENCODE(3, 26)
197 #define PINID_SPDIF             PINID_ENCODE(3, 27)
198 #define PINID_PWM3              PINID_ENCODE(3, 28)
199 #define PINID_PWM4              PINID_ENCODE(3, 29)
200 #define PINID_LCD_RESET         PINID_ENCODE(3, 30)
201
202 /* Bank 4 */
203 #define PINID_ENET0_MDC         PINID_ENCODE(4, 0)
204 #define PINID_ENET0_MDIO        PINID_ENCODE(4, 1)
205 #define PINID_ENET0_RX_EN       PINID_ENCODE(4, 2)
206 #define PINID_ENET0_RXD0        PINID_ENCODE(4, 3)
207 #define PINID_ENET0_RXD1        PINID_ENCODE(4, 4)
208 #define PINID_ENET0_TX_CLK      PINID_ENCODE(4, 5)
209 #define PINID_ENET0_TX_EN       PINID_ENCODE(4, 6)
210 #define PINID_ENET0_TXD0        PINID_ENCODE(4, 7)
211 #define PINID_ENET0_TXD1        PINID_ENCODE(4, 8)
212 #define PINID_ENET0_RXD2        PINID_ENCODE(4, 9)
213 #define PINID_ENET0_RXD3        PINID_ENCODE(4, 10)
214 #define PINID_ENET0_TXD2        PINID_ENCODE(4, 11)
215 #define PINID_ENET0_TXD3        PINID_ENCODE(4, 12)
216 #define PINID_ENET0_RX_CLK      PINID_ENCODE(4, 13)
217 #define PINID_ENET0_COL         PINID_ENCODE(4, 14)
218 #define PINID_ENET0_CRS         PINID_ENCODE(4, 15)
219 #define PINID_ENET_CLK          PINID_ENCODE(4, 16)
220 #define PINID_JTAG_RTCK         PINID_ENCODE(4, 20)
221
222 #endif