arm/tegra: add new fields to struct tegra_pingroup_desc
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-tegra / include / mach / pinmux.h
blob988c6c5ec9eca2d1046988f5ce0de7a8fa61db5d
1 /*
2 * linux/arch/arm/mach-tegra/include/mach/pinmux.h
4 * Copyright (C) 2010 Google, Inc.
5 * Copyright (C) 2010,2011 Nvidia, Inc.
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #ifndef __MACH_TEGRA_PINMUX_H
19 #define __MACH_TEGRA_PINMUX_H
21 enum tegra_mux_func {
22 TEGRA_MUX_RSVD = 0x8000,
23 TEGRA_MUX_RSVD1 = 0x8000,
24 TEGRA_MUX_RSVD2 = 0x8001,
25 TEGRA_MUX_RSVD3 = 0x8002,
26 TEGRA_MUX_RSVD4 = 0x8003,
27 TEGRA_MUX_NONE = -1,
28 TEGRA_MUX_AHB_CLK,
29 TEGRA_MUX_APB_CLK,
30 TEGRA_MUX_AUDIO_SYNC,
31 TEGRA_MUX_CRT,
32 TEGRA_MUX_DAP1,
33 TEGRA_MUX_DAP2,
34 TEGRA_MUX_DAP3,
35 TEGRA_MUX_DAP4,
36 TEGRA_MUX_DAP5,
37 TEGRA_MUX_DISPLAYA,
38 TEGRA_MUX_DISPLAYB,
39 TEGRA_MUX_EMC_TEST0_DLL,
40 TEGRA_MUX_EMC_TEST1_DLL,
41 TEGRA_MUX_GMI,
42 TEGRA_MUX_GMI_INT,
43 TEGRA_MUX_HDMI,
44 TEGRA_MUX_I2C,
45 TEGRA_MUX_I2C2,
46 TEGRA_MUX_I2C3,
47 TEGRA_MUX_IDE,
48 TEGRA_MUX_IRDA,
49 TEGRA_MUX_KBC,
50 TEGRA_MUX_MIO,
51 TEGRA_MUX_MIPI_HS,
52 TEGRA_MUX_NAND,
53 TEGRA_MUX_OSC,
54 TEGRA_MUX_OWR,
55 TEGRA_MUX_PCIE,
56 TEGRA_MUX_PLLA_OUT,
57 TEGRA_MUX_PLLC_OUT1,
58 TEGRA_MUX_PLLM_OUT1,
59 TEGRA_MUX_PLLP_OUT2,
60 TEGRA_MUX_PLLP_OUT3,
61 TEGRA_MUX_PLLP_OUT4,
62 TEGRA_MUX_PWM,
63 TEGRA_MUX_PWR_INTR,
64 TEGRA_MUX_PWR_ON,
65 TEGRA_MUX_RTCK,
66 TEGRA_MUX_SDIO1,
67 TEGRA_MUX_SDIO2,
68 TEGRA_MUX_SDIO3,
69 TEGRA_MUX_SDIO4,
70 TEGRA_MUX_SFLASH,
71 TEGRA_MUX_SPDIF,
72 TEGRA_MUX_SPI1,
73 TEGRA_MUX_SPI2,
74 TEGRA_MUX_SPI2_ALT,
75 TEGRA_MUX_SPI3,
76 TEGRA_MUX_SPI4,
77 TEGRA_MUX_TRACE,
78 TEGRA_MUX_TWC,
79 TEGRA_MUX_UARTA,
80 TEGRA_MUX_UARTB,
81 TEGRA_MUX_UARTC,
82 TEGRA_MUX_UARTD,
83 TEGRA_MUX_UARTE,
84 TEGRA_MUX_ULPI,
85 TEGRA_MUX_VI,
86 TEGRA_MUX_VI_SENSOR_CLK,
87 TEGRA_MUX_XIO,
88 TEGRA_MUX_SAFE,
89 TEGRA_MAX_MUX,
92 enum tegra_pullupdown {
93 TEGRA_PUPD_NORMAL = 0,
94 TEGRA_PUPD_PULL_DOWN,
95 TEGRA_PUPD_PULL_UP,
98 enum tegra_tristate {
99 TEGRA_TRI_NORMAL = 0,
100 TEGRA_TRI_TRISTATE = 1,
103 enum tegra_pin_io {
104 TEGRA_PIN_OUTPUT = 0,
105 TEGRA_PIN_INPUT = 1,
108 enum tegra_vddio {
109 TEGRA_VDDIO_BB = 0,
110 TEGRA_VDDIO_LCD,
111 TEGRA_VDDIO_VI,
112 TEGRA_VDDIO_UART,
113 TEGRA_VDDIO_DDR,
114 TEGRA_VDDIO_NAND,
115 TEGRA_VDDIO_SYS,
116 TEGRA_VDDIO_AUDIO,
117 TEGRA_VDDIO_SD,
120 struct tegra_pingroup_config {
121 int pingroup;
122 enum tegra_mux_func func;
123 enum tegra_pullupdown pupd;
124 enum tegra_tristate tristate;
127 enum tegra_slew {
128 TEGRA_SLEW_FASTEST = 0,
129 TEGRA_SLEW_FAST,
130 TEGRA_SLEW_SLOW,
131 TEGRA_SLEW_SLOWEST,
132 TEGRA_MAX_SLEW,
135 enum tegra_pull_strength {
136 TEGRA_PULL_0 = 0,
137 TEGRA_PULL_1,
138 TEGRA_PULL_2,
139 TEGRA_PULL_3,
140 TEGRA_PULL_4,
141 TEGRA_PULL_5,
142 TEGRA_PULL_6,
143 TEGRA_PULL_7,
144 TEGRA_PULL_8,
145 TEGRA_PULL_9,
146 TEGRA_PULL_10,
147 TEGRA_PULL_11,
148 TEGRA_PULL_12,
149 TEGRA_PULL_13,
150 TEGRA_PULL_14,
151 TEGRA_PULL_15,
152 TEGRA_PULL_16,
153 TEGRA_PULL_17,
154 TEGRA_PULL_18,
155 TEGRA_PULL_19,
156 TEGRA_PULL_20,
157 TEGRA_PULL_21,
158 TEGRA_PULL_22,
159 TEGRA_PULL_23,
160 TEGRA_PULL_24,
161 TEGRA_PULL_25,
162 TEGRA_PULL_26,
163 TEGRA_PULL_27,
164 TEGRA_PULL_28,
165 TEGRA_PULL_29,
166 TEGRA_PULL_30,
167 TEGRA_PULL_31,
168 TEGRA_MAX_PULL,
171 enum tegra_drive {
172 TEGRA_DRIVE_DIV_8 = 0,
173 TEGRA_DRIVE_DIV_4,
174 TEGRA_DRIVE_DIV_2,
175 TEGRA_DRIVE_DIV_1,
176 TEGRA_MAX_DRIVE,
179 enum tegra_hsm {
180 TEGRA_HSM_DISABLE = 0,
181 TEGRA_HSM_ENABLE,
184 enum tegra_schmitt {
185 TEGRA_SCHMITT_DISABLE = 0,
186 TEGRA_SCHMITT_ENABLE,
189 struct tegra_drive_pingroup_config {
190 int pingroup;
191 enum tegra_hsm hsm;
192 enum tegra_schmitt schmitt;
193 enum tegra_drive drive;
194 enum tegra_pull_strength pull_down;
195 enum tegra_pull_strength pull_up;
196 enum tegra_slew slew_rising;
197 enum tegra_slew slew_falling;
200 struct tegra_drive_pingroup_desc {
201 const char *name;
202 s16 reg_bank;
203 s16 reg;
206 struct tegra_pingroup_desc {
207 const char *name;
208 int funcs[4];
209 int func_safe;
210 int vddio;
211 enum tegra_pin_io io_default;
212 s16 tri_bank; /* Register bank the tri_reg exists within */
213 s16 mux_bank; /* Register bank the mux_reg exists within */
214 s16 pupd_bank; /* Register bank the pupd_reg exists within */
215 s16 tri_reg; /* offset into the TRISTATE_REG_* register bank */
216 s16 mux_reg; /* offset into the PIN_MUX_CTL_* register bank */
217 s16 pupd_reg; /* offset into the PULL_UPDOWN_REG_* register bank */
218 s8 tri_bit; /* offset into the TRISTATE_REG_* register bit */
219 s8 mux_bit; /* offset into the PIN_MUX_CTL_* register bit */
220 s8 pupd_bit; /* offset into the PULL_UPDOWN_REG_* register bit */
221 s8 lock_bit; /* offset of the LOCK bit into mux register bit */
222 s8 od_bit; /* offset of the OD bit into mux register bit */
223 s8 ioreset_bit; /* offset of the IO_RESET bit into mux register bit */
226 typedef void (*pinmux_init) (const struct tegra_pingroup_desc **pg,
227 int *pg_max, const struct tegra_drive_pingroup_desc **pgdrive,
228 int *pgdrive_max);
230 void tegra20_pinmux_init(const struct tegra_pingroup_desc **pg, int *pg_max,
231 const struct tegra_drive_pingroup_desc **pgdrive, int *pgdrive_max);
233 int tegra_pinmux_set_tristate(int pg, enum tegra_tristate tristate);
234 int tegra_pinmux_set_pullupdown(int pg, enum tegra_pullupdown pupd);
236 void tegra_pinmux_config_table(const struct tegra_pingroup_config *config,
237 int len);
239 void tegra_drive_pinmux_config_table(struct tegra_drive_pingroup_config *config,
240 int len);
241 void tegra_pinmux_set_safe_pinmux_table(const struct tegra_pingroup_config *config,
242 int len);
243 void tegra_pinmux_config_pinmux_table(const struct tegra_pingroup_config *config,
244 int len);
245 void tegra_pinmux_config_tristate_table(const struct tegra_pingroup_config *config,
246 int len, enum tegra_tristate tristate);
247 void tegra_pinmux_config_pullupdown_table(const struct tegra_pingroup_config *config,
248 int len, enum tegra_pullupdown pupd);
249 #endif