e8ef632715e076d0f1265c711e31f7556a0caa7b
[platform/kernel/u-boot.git] / arch / arm / include / asm / arch-tegra2 / pinmux.h
1 /*
2  *  (C) Copyright 2010,2011
3  *  NVIDIA Corporation <www.nvidia.com>
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23
24 #ifndef _PINMUX_H_
25 #define _PINMUX_H_
26
27 /* Pin groups which we can set to tristate or normal */
28 enum pmux_pingrp {
29         /* APB_MISC_PP_TRISTATE_REG_A_0 */
30         PINGRP_ATA,
31         PINGRP_ATB,
32         PINGRP_ATC,
33         PINGRP_ATD,
34         PINGRP_CDEV1,
35         PINGRP_CDEV2,
36         PINGRP_CSUS,
37         PINGRP_DAP1,
38
39         PINGRP_DAP2,
40         PINGRP_DAP3,
41         PINGRP_DAP4,
42         PINGRP_DTA,
43         PINGRP_DTB,
44         PINGRP_DTC,
45         PINGRP_DTD,
46         PINGRP_DTE,
47
48         PINGRP_GPU,
49         PINGRP_GPV,
50         PINGRP_I2CP,
51         PINGRP_IRTX,
52         PINGRP_IRRX,
53         PINGRP_KBCB,
54         PINGRP_KBCA,
55         PINGRP_PMC,
56
57         PINGRP_PTA,
58         PINGRP_RM,
59         PINGRP_KBCE,
60         PINGRP_KBCF,
61         PINGRP_GMA,
62         PINGRP_GMC,
63         PINGRP_SDMMC1,
64         PINGRP_OWC,
65
66         /* 32: APB_MISC_PP_TRISTATE_REG_B_0 */
67         PINGRP_GME,
68         PINGRP_SDC,
69         PINGRP_SDD,
70         PINGRP_RESERVED0,
71         PINGRP_SLXA,
72         PINGRP_SLXC,
73         PINGRP_SLXD,
74         PINGRP_SLXK,
75
76         PINGRP_SPDI,
77         PINGRP_SPDO,
78         PINGRP_SPIA,
79         PINGRP_SPIB,
80         PINGRP_SPIC,
81         PINGRP_SPID,
82         PINGRP_SPIE,
83         PINGRP_SPIF,
84
85         PINGRP_SPIG,
86         PINGRP_SPIH,
87         PINGRP_UAA,
88         PINGRP_UAB,
89         PINGRP_UAC,
90         PINGRP_UAD,
91         PINGRP_UCA,
92         PINGRP_UCB,
93
94         PINGRP_RESERVED1,
95         PINGRP_ATE,
96         PINGRP_KBCC,
97         PINGRP_RESERVED2,
98         PINGRP_RESERVED3,
99         PINGRP_GMB,
100         PINGRP_GMD,
101         PINGRP_DDC,
102
103         /* 64: APB_MISC_PP_TRISTATE_REG_C_0 */
104         PINGRP_LD0,
105         PINGRP_LD1,
106         PINGRP_LD2,
107         PINGRP_LD3,
108         PINGRP_LD4,
109         PINGRP_LD5,
110         PINGRP_LD6,
111         PINGRP_LD7,
112
113         PINGRP_LD8,
114         PINGRP_LD9,
115         PINGRP_LD10,
116         PINGRP_LD11,
117         PINGRP_LD12,
118         PINGRP_LD13,
119         PINGRP_LD14,
120         PINGRP_LD15,
121
122         PINGRP_LD16,
123         PINGRP_LD17,
124         PINGRP_LHP0,
125         PINGRP_LHP1,
126         PINGRP_LHP2,
127         PINGRP_LVP0,
128         PINGRP_LVP1,
129         PINGRP_HDINT,
130
131         PINGRP_LM0,
132         PINGRP_LM1,
133         PINGRP_LVS,
134         PINGRP_LSC0,
135         PINGRP_LSC1,
136         PINGRP_LSCK,
137         PINGRP_LDC,
138         PINGRP_LCSN,
139
140         /* 96: APB_MISC_PP_TRISTATE_REG_D_0 */
141         PINGRP_LSPI,
142         PINGRP_LSDA,
143         PINGRP_LSDI,
144         PINGRP_LPW0,
145         PINGRP_LPW1,
146         PINGRP_LPW2,
147         PINGRP_LDI,
148         PINGRP_LHS,
149
150         PINGRP_LPP,
151         PINGRP_RESERVED4,
152         PINGRP_KBCD,
153         PINGRP_GPU7,
154         PINGRP_DTF,
155         PINGRP_UDA,
156         PINGRP_CRTP,
157         PINGRP_SDB,
158 };
159
160
161 #define TEGRA_TRISTATE_REGS 4
162
163 /* APB MISC Pin Mux and Tristate (APB_MISC_PP_) registers */
164 struct pmux_tri_ctlr {
165         uint pmt_reserved0;             /* ABP_MISC_PP_ reserved offset 00 */
166         uint pmt_reserved1;             /* ABP_MISC_PP_ reserved offset 04 */
167         uint pmt_strap_opt_a;           /* _STRAPPING_OPT_A_0, offset 08 */
168         uint pmt_reserved2;             /* ABP_MISC_PP_ reserved offset 0C */
169         uint pmt_reserved3;             /* ABP_MISC_PP_ reserved offset 10 */
170         uint pmt_tri[TEGRA_TRISTATE_REGS]; /* _TRI_STATE_REG_A/B/C/D_0 14-20 */
171         uint pmt_cfg_ctl;               /* _CONFIG_CTL_0, offset 24 */
172
173         uint pmt_reserved[22];          /* ABP_MISC_PP_ reserved offs 28-7C */
174
175         uint pmt_ctl_a;                 /* _PINGRP_MUX_CTL_A_0, offset 80 */
176         uint pmt_ctl_b;                 /* _PINGRP_MUX_CTL_B_0, offset 84 */
177         uint pmt_ctl_c;                 /* _PINGRP_MUX_CTL_C_0, offset 88 */
178         uint pmt_ctl_d;                 /* _PINGRP_MUX_CTL_D_0, offset 8C */
179         uint pmt_ctl_e;                 /* _PINGRP_MUX_CTL_E_0, offset 90 */
180         uint pmt_ctl_f;                 /* _PINGRP_MUX_CTL_F_0, offset 94 */
181         uint pmt_ctl_g;                 /* _PINGRP_MUX_CTL_G_0, offset 98 */
182 };
183
184 /* Converts a pin group to a tristate register: 0=A, 1=B, 2=C, 3=D */
185 #define TRISTATE_REG(id) ((id) >> 5)
186
187 /* Mask value for a tristate (within TRISTATE_REG(id)) */
188 #define TRISTATE_MASK(id) (1 << ((id) & 0x1f))
189
190 /* Set a pin group to tristate */
191 void pinmux_tristate_enable(enum pmux_pingrp pin);
192
193 /* Set a pin group to normal (non tristate) */
194 void pinmux_tristate_disable(enum pmux_pingrp pin);
195
196 #endif  /* PINMUX_H */