[ARM/tegra] Add Tegra3 support
[linux-2.6.git] / arch / arm / mach-tegra / pinmux-t3-tables.c
1 /*
2  * linux/arch/arm/mach-tegra/pinmux-t3-tables.c
3  *
4  * Common pinmux configurations for Tegra 3 SoCs
5  *
6  * Copyright (C) 2010 NVIDIA Corporation
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21  */
22
23 #include <linux/kernel.h>
24 #include <linux/errno.h>
25 #include <linux/spinlock.h>
26 #include <linux/io.h>
27 #include <linux/init.h>
28 #include <linux/string.h>
29
30 #include <mach/iomap.h>
31 #include <mach/pinmux.h>
32 #include <mach/suspend.h>
33
34 #define DRIVE_PINGROUP(pg_name, r)              \
35         [TEGRA_DRIVE_PINGROUP_ ## pg_name] = {  \
36                 .name = #pg_name,               \
37                 .reg = r                        \
38         }
39
40 const struct tegra_drive_pingroup_desc tegra_soc_drive_pingroups[TEGRA_MAX_DRIVE_PINGROUP] = {
41         DRIVE_PINGROUP(AO1,             0x868),
42         DRIVE_PINGROUP(AO2,             0x86c),
43         DRIVE_PINGROUP(AT1,             0x870),
44         DRIVE_PINGROUP(AT2,             0x874),
45         DRIVE_PINGROUP(AT3,             0x878),
46         DRIVE_PINGROUP(AT4,             0x87c),
47         DRIVE_PINGROUP(AT5,             0x880),
48         DRIVE_PINGROUP(CDEV1,           0x884),
49         DRIVE_PINGROUP(CDEV2,           0x888),
50         DRIVE_PINGROUP(CSUS,            0x88c),
51         DRIVE_PINGROUP(DAP1,            0x890),
52         DRIVE_PINGROUP(DAP2,            0x894),
53         DRIVE_PINGROUP(DAP3,            0x898),
54         DRIVE_PINGROUP(DAP4,            0x89c),
55         DRIVE_PINGROUP(DBG,             0x8a0),
56         DRIVE_PINGROUP(LCD1,            0x8a4),
57         DRIVE_PINGROUP(LCD2,            0x8a8),
58         DRIVE_PINGROUP(SDIO2,           0x8ac),
59         DRIVE_PINGROUP(SDIO3,           0x8b0),
60         DRIVE_PINGROUP(SPI,             0x8b4),
61         DRIVE_PINGROUP(UAA,             0x8b8),
62         DRIVE_PINGROUP(UAB,             0x8bc),
63         DRIVE_PINGROUP(UART2,           0x8c0),
64         DRIVE_PINGROUP(UART3,           0x8c4),
65         DRIVE_PINGROUP(VI1,             0x8c8),
66         DRIVE_PINGROUP(SDIO1,           0x8ec),
67         DRIVE_PINGROUP(CRT,             0x8f8),
68         DRIVE_PINGROUP(DDC,             0x8fc),
69         DRIVE_PINGROUP(GMA,             0x900),
70         DRIVE_PINGROUP(GMB,             0x904),
71         DRIVE_PINGROUP(GMC,             0x908),
72         DRIVE_PINGROUP(GMD,             0x90c),
73         DRIVE_PINGROUP(GME,             0x910),
74         DRIVE_PINGROUP(GMF,             0x914),
75         DRIVE_PINGROUP(GMG,             0x918),
76         DRIVE_PINGROUP(GMH,             0x91c),
77         DRIVE_PINGROUP(OWR,             0x920),
78         DRIVE_PINGROUP(UAD,             0x924),
79         DRIVE_PINGROUP(GPV,             0x928),
80         DRIVE_PINGROUP(DEV3,            0x92c),
81         DRIVE_PINGROUP(CEC,             0x938),
82 };
83
84 #define PINGROUP(pg_name, vdd, f0, f1, f2, f3, fs, iod, reg)    \
85         [TEGRA_PINGROUP_ ## pg_name] = {                        \
86                 .name = #pg_name,                               \
87                 .vddio = TEGRA_VDDIO_ ## vdd,                   \
88                 .funcs = {                                      \
89                         TEGRA_MUX_ ## f0,                       \
90                         TEGRA_MUX_ ## f1,                       \
91                         TEGRA_MUX_ ## f2,                       \
92                         TEGRA_MUX_ ## f3,                       \
93                 },                                              \
94                 .func_safe = TEGRA_MUX_ ## fs,                  \
95                 .tri_reg = reg,                                 \
96                 .tri_bit = 4,                                   \
97                 .mux_reg = reg,                                 \
98                 .mux_bit = 0,                                   \
99                 .pupd_reg = reg,                                \
100                 .pupd_bit = 2,                                  \
101                 .io_default = TEGRA_PIN_ ## iod,                \
102         }
103
104 /* !!!FIXME!!! FILL IN fSafe COLUMN IN TABLE ....... */
105 const struct tegra_pingroup_desc tegra_soc_pingroups[TEGRA_MAX_PINGROUP] = {
106         /*       NAME             VDD       f0          f1          f2          f3          fSafe       io      reg */
107         PINGROUP(ULPI_DATA0,      BB,       SPI3,       HSI,        UARTA,      ULPI,       RSVD,       INPUT,  0x3000),
108         PINGROUP(ULPI_DATA1,      BB,       SPI3,       HSI,        UARTA,      ULPI,       RSVD,       INPUT,  0x3004),
109         PINGROUP(ULPI_DATA2,      BB,       SPI3,       HSI,        UARTA,      ULPI,       RSVD,       INPUT,  0x3008),
110         PINGROUP(ULPI_DATA3,      BB,       SPI3,       HSI,        UARTA,      ULPI,       RSVD,       INPUT,  0x300c),
111         PINGROUP(ULPI_DATA4,      BB,       SPI2,       HSI,        UARTA,      ULPI,       RSVD,       INPUT,  0x3010),
112         PINGROUP(ULPI_DATA5,      BB,       SPI2,       HSI,        UARTA,      ULPI,       RSVD,       INPUT,  0x3014),
113         PINGROUP(ULPI_DATA6,      BB,       SPI2,       HSI,        UARTA,      ULPI,       RSVD,       INPUT,  0x3018),
114         PINGROUP(ULPI_DATA7,      BB,       SPI2,       HSI,        UARTA,      ULPI,       RSVD,       INPUT,  0x301c),
115         PINGROUP(ULPI_CLK,        BB,       SPI1,       RSVD,       UARTD,      ULPI,       RSVD,       INPUT,  0x3020),
116         PINGROUP(ULPI_DIR,        BB,       SPI1,       RSVD,       UARTD,      ULPI,       RSVD,       INPUT,  0x3024),
117         PINGROUP(ULPI_NXT,        BB,       SPI1,       RSVD,       UARTD,      ULPI,       RSVD,       INPUT,  0x3028),
118         PINGROUP(ULPI_STP,        BB,       SPI1,       RSVD,       UARTD,      ULPI,       RSVD,       INPUT,  0x302c),
119         PINGROUP(DAP3_FS,         BB,       I2S2,       RSVD1,      DISPLAYA,   DISPLAYB,   RSVD,       INPUT,  0x3030),
120         PINGROUP(DAP3_DIN,        BB,       I2S2,       RSVD1,      DISPLAYA,   DISPLAYB,   RSVD,       INPUT,  0x3034),
121         PINGROUP(DAP3_DOUT,       BB,       I2S2,       RSVD1,      DISPLAYA,   DISPLAYB,   RSVD,       INPUT,  0x3038),
122         PINGROUP(DAP3_SCLK,       BB,       I2S2,       RSVD1,      DISPLAYA,   DISPLAYB,   RSVD,       INPUT,  0x303c),
123         PINGROUP(GPIO_PV0,        BB,       RSVD,       RSVD,       RSVD,       RSVD,       RSVD,       INPUT,  0x3040),
124         PINGROUP(GPIO_PV1,        BB,       RSVD,       RSVD,       RSVD,       RSVD,       RSVD,       INPUT,  0x3044),
125         PINGROUP(SDMMC1_CLK,      SDMMC1,   SDMMC1,     RSVD1,      RSVD2,      UARTA,      RSVD,       INPUT,  0x3048),
126         PINGROUP(SDMMC1_CMD,      SDMMC1,   SDMMC1,     RSVD1,      RSVD2,      UARTA,      RSVD,       INPUT,  0x304c),
127         PINGROUP(SDMMC1_DAT3,     SDMMC1,   SDMMC1,     RSVD1,      UARTE,      UARTA,      RSVD,       INPUT,  0x3050),
128         PINGROUP(SDMMC1_DAT2,     SDMMC1,   SDMMC1,     RSVD1,      UARTE,      UARTA,      RSVD,       INPUT,  0x3054),
129         PINGROUP(SDMMC1_DAT1,     SDMMC1,   SDMMC1,     RSVD1,      UARTE,      UARTA,      RSVD,       INPUT,  0x3058),
130         PINGROUP(SDMMC1_DAT0,     SDMMC1,   SDMMC1,     RSVD1,      UARTE,      UARTA,      RSVD,       INPUT,  0x305c),
131         PINGROUP(GPIO_PV2,        SDMMC1,   OWR,        RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x3060),
132         PINGROUP(GPIO_PV3,        SDMMC1,   CLK12,      RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x3064),
133         PINGROUP(CLK2_OUT,        SDMMC1,   EXTPERIPH2, RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x3068),
134         PINGROUP(CLK2_REQ,        SDMMC1,   DAP,        RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x306c),
135         PINGROUP(LCD_PWR1,        LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x3070),
136         PINGROUP(LCD_PWR2,        LCD,      DISPLAYA,   DISPLAYB,   SPI5,       HDMI,       RSVD,       OUTPUT, 0x3074),
137         PINGROUP(LCD_SDIN,        LCD,      DISPLAYA,   DISPLAYB,   SPI5,       RSVD,       RSVD,       OUTPUT, 0x3078),
138         PINGROUP(LCD_SDOUT,       LCD,      DISPLAYA,   DISPLAYB,   SPI5,       HDMI,       RSVD,       OUTPUT, 0x307c),
139         PINGROUP(LCD_WR_N,        LCD,      DISPLAYA,   DISPLAYB,   SPI5,       HDMI,       RSVD,       OUTPUT, 0x3080),
140         PINGROUP(LCD_CS0_N,       LCD,      DISPLAYA,   DISPLAYB,   SPI5,       RSVD,       RSVD,       OUTPUT, 0x3084),
141         PINGROUP(LCD_DC0,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x3088),
142         PINGROUP(LCD_SCK,         LCD,      DISPLAYA,   DISPLAYB,   SPI5,       HDMI,       RSVD,       OUTPUT, 0x308c),
143         PINGROUP(LCD_PWR0,        LCD,      DISPLAYA,   DISPLAYB,   SPI5,       HDMI,       RSVD,       OUTPUT, 0x3090),
144         PINGROUP(LCD_PCLK,        LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x3094),
145         PINGROUP(LCD_DE,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x3098),
146         PINGROUP(LCD_HSYNC,       LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x309c),
147         PINGROUP(LCD_VSYNC,       LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30a0),
148         PINGROUP(LCD_D0,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30a4),
149         PINGROUP(LCD_D1,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30a8),
150         PINGROUP(LCD_D2,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30ac),
151         PINGROUP(LCD_D3,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30b0),
152         PINGROUP(LCD_D4,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30b4),
153         PINGROUP(LCD_D5,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30b8),
154         PINGROUP(LCD_D6,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30bc),
155         PINGROUP(LCD_D7,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30c0),
156         PINGROUP(LCD_D8,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30c4),
157         PINGROUP(LCD_D9,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30c8),
158         PINGROUP(LCD_D10,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30cc),
159         PINGROUP(LCD_D11,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30d0),
160         PINGROUP(LCD_D12,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30d4),
161         PINGROUP(LCD_D13,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30d8),
162         PINGROUP(LCD_D14,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30dc),
163         PINGROUP(LCD_D15,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30e0),
164         PINGROUP(LCD_D16,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30e4),
165         PINGROUP(LCD_D17,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30e8),
166         PINGROUP(LCD_D18,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30ec),
167         PINGROUP(LCD_D19,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30f0),
168         PINGROUP(LCD_D20,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30f4),
169         PINGROUP(LCD_D21,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30f8),
170         PINGROUP(LCD_D22,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x30fc),
171         PINGROUP(LCD_D23,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x3100),
172         PINGROUP(LCD_CS1_N,       LCD,      DISPLAYA,   DISPLAYB,   SPI5,       RSVD2,      RSVD,       OUTPUT, 0x3104),
173         PINGROUP(LCD_M1,          LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x3108),
174         PINGROUP(LCD_DC1,         LCD,      DISPLAYA,   DISPLAYB,   RSVD1,      RSVD2,      RSVD,       OUTPUT, 0x310c),
175         PINGROUP(HDMI_INT,        LCD,      RSVD,       RSVD,       RSVD,       RSVD,       RSVD,       INPUT,  0x3110),
176         PINGROUP(DDC_SCL,         LCD,      I2C4,       RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x3114),
177         PINGROUP(DDC_SDA,         LCD,      I2C4,       RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x3118),
178         PINGROUP(CRT_HSYNC,       LCD,      CRT,        RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x311c),
179         PINGROUP(CRT_VSYNC,       LCD,      CRT,        RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x3120),
180         PINGROUP(VI_D0,           VI,       DDR,        RSVD1,      VI,         RSVD2,      RSVD,       INPUT,  0x3124),
181         PINGROUP(VI_D1,           VI,       DDR,        SDMMC2,     VI,         RSVD1,      RSVD,       INPUT,  0x3128),
182         PINGROUP(VI_D2,           VI,       DDR,        SDMMC2,     VI,         RSVD1,      RSVD,       INPUT,  0x312c),
183         PINGROUP(VI_D3,           VI,       DDR,        SDMMC2,     VI,         RSVD1,      RSVD,       INPUT,  0x3130),
184         PINGROUP(VI_D4,           VI,       DDR,        SDMMC2,     VI,         RSVD1,      RSVD,       INPUT,  0x3134),
185         PINGROUP(VI_D5,           VI,       DDR,        SDMMC2,     VI,         RSVD1,      RSVD,       INPUT,  0x3138),
186         PINGROUP(VI_D6,           VI,       DDR,        SDMMC2,     VI,         RSVD1,      RSVD,       INPUT,  0x313c),
187         PINGROUP(VI_D7,           VI,       DDR,        SDMMC2,     VI,         RSVD1,      RSVD,       INPUT,  0x3140),
188         PINGROUP(VI_D8,           VI,       DDR,        SDMMC2,     VI,         RSVD1,      RSVD,       INPUT,  0x3144),
189         PINGROUP(VI_D9,           VI,       DDR,        SDMMC2,     VI,         RSVD1,      RSVD,       INPUT,  0x3148),
190         PINGROUP(VI_D10,          VI,       DDR,        RSVD1,      VI,         RSVD2,      RSVD,       INPUT,  0x314c),
191         PINGROUP(VI_D11,          VI,       DDR,        RSVD1,      VI,         RSVD2,      RSVD,       INPUT,  0x3150),
192         PINGROUP(VI_PCLK,         VI,       RSVD1,      SDMMC2,     VI,         RSVD2,      RSVD,       INPUT,  0x3154),
193         PINGROUP(VI_MCLK,         VI,       VI,         VI_ALT1,    VI_ALT2,    VI_ALT3,    RSVD,       INPUT,  0x3158),
194         PINGROUP(VI_VSYNC,        VI,       DDR,        RSVD1,      VI,         RSVD2,      RSVD,       INPUT,  0x315c),
195         PINGROUP(VI_HSYNC,        VI,       DDR,        RSVD1,      VI,         RSVD2,      RSVD,       INPUT,  0x3160),
196         PINGROUP(UART2_RXD,       UART,     IRDA,       SPDIF,      UARTA,      SPI4,       RSVD,       INPUT,  0x3164),
197         PINGROUP(UART2_TXD,       UART,     IRDA,       SPDIF,      UARTA,      SPI4,       RSVD,       INPUT,  0x3168),
198         PINGROUP(UART2_RTS_N,     UART,     UARTA,      UARTB,      GMI,        SPI4,       RSVD,       INPUT,  0x316c),
199         PINGROUP(UART2_CTS_N,     UART,     UARTA,      UARTB,      GMI,        SPI4,       RSVD,       INPUT,  0x3170),
200         PINGROUP(UART3_TXD,       UART,     UARTC,      RSVD1,      GMI,        RSVD2,      RSVD,       INPUT,  0x3174),
201         PINGROUP(UART3_RXD,       UART,     UARTC,      RSVD1,      GMI,        RSVD2,      RSVD,       INPUT,  0x3178),
202         PINGROUP(UART3_CTS_N,     UART,     UARTC,      RSVD1,      GMI,        RSVD2,      RSVD,       INPUT,  0x317c),
203         PINGROUP(UART3_RTS_N,     UART,     UARTC,      PWM0,       GMI,        RSVD2,      RSVD,       INPUT,  0x3180),
204         PINGROUP(GPIO_PU0,        UART,     OWR,        UARTA,      GMI,        RSVD1,      RSVD,       INPUT,  0x3184),
205         PINGROUP(GPIO_PU1,        UART,     RSVD1,      UARTA,      GMI,        RSVD2,      RSVD,       INPUT,  0x3188),
206         PINGROUP(GPIO_PU2,        UART,     RSVD1,      UARTA,      GMI,        RSVD2,      RSVD,       INPUT,  0x318c),
207         PINGROUP(GPIO_PU3,        UART,     PWM0,       UARTA,      GMI,        RSVD1,      RSVD,       INPUT,  0x3190),
208         PINGROUP(GPIO_PU4,        UART,     PWM1,       UARTA,      GMI,        RSVD1,      RSVD,       INPUT,  0x3194),
209         PINGROUP(GPIO_PU5,        UART,     PWM2,       UARTA,      GMI,        RSVD1,      RSVD,       INPUT,  0x3198),
210         PINGROUP(GPIO_PU6,        UART,     PWM3,       UARTA,      GMI,        RSVD1,      RSVD,       INPUT,  0x319c),
211         PINGROUP(GEN1_I2C_SDA,    UART,     I2C1,       RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x31a0),
212         PINGROUP(GEN1_I2C_SCL,    UART,     I2C1,       RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x31a4),
213         PINGROUP(DAP4_FS,         UART,     I2S3,       RSVD1,      GMI,        RSVD2,      RSVD,       INPUT,  0x31a8),
214         PINGROUP(DAP4_DIN,        UART,     I2S3,       RSVD1,      GMI,        RSVD2,      RSVD,       INPUT,  0x31ac),
215         PINGROUP(DAP4_DOUT,       UART,     I2S3,       RSVD1,      GMI,        RSVD2,      RSVD,       INPUT,  0x31b0),
216         PINGROUP(DAP4_SCLK,       UART,     I2S3,       RSVD1,      GMI,        RSVD2,      RSVD,       INPUT,  0x31b4),
217         PINGROUP(CLK3_OUT,        UART,     EXTPERIPH3, RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x31b8),
218         PINGROUP(CLK3_REQ,        UART,     DEV3,       RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x31bc),
219         PINGROUP(GMI_WP_N,        GMI,      RSVD1,      NAND,       GMI,        GMI_ALT,    RSVD,       INPUT,  0x31c0),
220         PINGROUP(GMI_IORDY,       GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x31c4),
221         PINGROUP(GMI_WAIT,        GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x31c8),
222         PINGROUP(GMI_ADV_N,       GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x31cc),
223         PINGROUP(GMI_CLK,         GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x31d0),
224         PINGROUP(GMI_CS0_N,       GMI,      RSVD1,      NAND,       GMI,        DTV,        RSVD,       INPUT,  0x31d4),
225         PINGROUP(GMI_CS1_N,       GMI,      RSVD1,      NAND,       GMI,        DTV,        RSVD,       INPUT,  0x31d8),
226         PINGROUP(GMI_CS2_N,       GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x31dc),
227         PINGROUP(GMI_CS3_N,       GMI,      RSVD1,      NAND,       GMI,        GMI_ALT,    RSVD,       INPUT,  0x31e0),
228         PINGROUP(GMI_CS4_N,       GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x31e4),
229         PINGROUP(GMI_CS6_N,       GMI,      NAND,       NAND_ALT,   GMI,        SATA,       RSVD,       INPUT,  0x31e8),
230         PINGROUP(GMI_CS7_N,       GMI,      NAND,       NAND_ALT,   GMI,        GMI_ALT,    RSVD,       INPUT,  0x31ec),
231         PINGROUP(GMI_AD0,         GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x31f0),
232         PINGROUP(GMI_AD1,         GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x31f4),
233         PINGROUP(GMI_AD2,         GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x31f8),
234         PINGROUP(GMI_AD3,         GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x31fc),
235         PINGROUP(GMI_AD4,         GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x3200),
236         PINGROUP(GMI_AD5,         GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x3204),
237         PINGROUP(GMI_AD6,         GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x3208),
238         PINGROUP(GMI_AD7,         GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x320c),
239         PINGROUP(GMI_AD8,         GMI,      PWM0,       NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x3210),
240         PINGROUP(GMI_AD9,         GMI,      PWM1,       NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x3214),
241         PINGROUP(GMI_AD10,        GMI,      PWM2,       NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x3218),
242         PINGROUP(GMI_AD11,        GMI,      PWM3,       NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x321c),
243         PINGROUP(GMI_AD12,        GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x3220),
244         PINGROUP(GMI_AD13,        GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x3224),
245         PINGROUP(GMI_AD14,        GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x3228),
246         PINGROUP(GMI_AD15,        GMI,      RSVD1,      NAND,       GMI,        RSVD2,      RSVD,       INPUT,  0x322c),
247         PINGROUP(GMI_A16,         GMI,      UARTD,      SPI4,       GMI,        GMI_ALT,    RSVD,       INPUT,  0x3230),
248         PINGROUP(GMI_A17,         GMI,      UARTD,      SPI4,       GMI,        DTV,        RSVD,       INPUT,  0x3234),
249         PINGROUP(GMI_A18,         GMI,      UARTD,      SPI4,       GMI,        DTV,        RSVD,       INPUT,  0x3238),
250         PINGROUP(GMI_A19,         GMI,      UARTD,      SPI4,       GMI,        RSVD3,      RSVD,       INPUT,  0x323c),
251         PINGROUP(GMI_WR_N,        GMI,      RSVD1,      NAND,       GMI,        RSVD3,      RSVD,       INPUT,  0x3240),
252         PINGROUP(GMI_OE_N,        GMI,      RSVD1,      NAND,       GMI,        RSVD3,      RSVD,       INPUT,  0x3244),
253         PINGROUP(GMI_DQS,         GMI,      RSVD1,      NAND,       GMI,        RSVD3,      RSVD,       INPUT,  0x3248),
254         PINGROUP(GMI_RST_N,       GMI,      NAND,       NAND_ALT,   GMI,        RSVD3,      RSVD,       INPUT,  0x324c),
255         PINGROUP(GEN2_I2C_SCL,    GMI,      I2C2,       HDMI,       GMI,        RSVD3,      RSVD,       INPUT,  0x3250),
256         PINGROUP(GEN2_I2C_SDA,    GMI,      I2C2,       HDMI,       GMI,        RSVD3,      RSVD,       INPUT,  0x3254),
257         PINGROUP(SDMMC4_CLK,      SDMMC4,   VI,         NAND,       GMI,        SDMMC4,     RSVD,       INPUT,  0x3258),
258         PINGROUP(SDMMC4_CMD,      SDMMC4,   I2C3,       NAND,       GMI,        SDMMC4,     RSVD,       INPUT,  0x325c),
259         PINGROUP(SDMMC4_DAT0,     SDMMC4,   UARTE,      SPI3,       GMI,        SDMMC4,     RSVD,       INPUT,  0x3260),
260         PINGROUP(SDMMC4_DAT1,     SDMMC4,   UARTE,      SPI3,       GMI,        SDMMC4,     RSVD,       INPUT,  0x3264),
261         PINGROUP(SDMMC4_DAT2,     SDMMC4,   UARTE,      SPI3,       GMI,        SDMMC4,     RSVD,       INPUT,  0x3268),
262         PINGROUP(SDMMC4_DAT3,     SDMMC4,   UARTE,      SPI3,       GMI,        SDMMC4,     RSVD,       INPUT,  0x326c),
263         PINGROUP(SDMMC4_DAT4,     SDMMC4,   I2C3,       I2S4,       GMI,        SDMMC4,     RSVD,       INPUT,  0x3270),
264         PINGROUP(SDMMC4_DAT5,     SDMMC4,   VGP3,       I2S4,       GMI,        SDMMC4,     RSVD,       INPUT,  0x3274),
265         PINGROUP(SDMMC4_DAT6,     SDMMC4,   VGP4,       I2S4,       GMI,        SDMMC4,     RSVD,       INPUT,  0x3278),
266         PINGROUP(SDMMC4_DAT7,     SDMMC4,   VGP5,       I2S4,       GMI,        SDMMC4,     RSVD,       INPUT,  0x327c),
267         PINGROUP(SDMMC4_RST_N,    SDMMC4,   VGP6,       RSVD1,      RSVD2,      POPSDMMC4,  RSVD,       INPUT,  0x3280),
268         PINGROUP(CAM_MCLK,        CAM,      VI,         VI_ALT1,    VI_ALT2,    POPSDMMC4,  RSVD,       INPUT,  0x3284),
269         PINGROUP(GPIO_PCC1,       CAM,      I2S4,       RSVD1,      RSVD2,      POPSDMMC4,  RSVD,       INPUT,  0x3288),
270         PINGROUP(GPIO_PBB0,       CAM,      I2S4,       RSVD1,      RSVD2,      POPSDMMC4,  RSVD,       INPUT,  0x328c),
271         PINGROUP(CAM_I2C_SCL,     CAM,      VGP1,       I2C3,       RSVD2,      POPSDMMC4,  RSVD,       INPUT,  0x3290),
272         PINGROUP(CAM_I2C_SDA,     CAM,      VGP2,       I2C3,       RSVD2,      POPSDMMC4,  RSVD,       INPUT,  0x3294),
273         PINGROUP(GPIO_PBB3,       CAM,      VGP3,       DISPLAYA,   DISPLAYB,   POPSDMMC4,  RSVD,       INPUT,  0x3298),
274         PINGROUP(GPIO_PBB4,       CAM,      VGP4,       DISPLAYA,   DISPLAYB,   POPSDMMC4,  RSVD,       INPUT,  0x329c),
275         PINGROUP(GPIO_PBB5,       CAM,      VGP5,       DISPLAYA,   DISPLAYB,   POPSDMMC4,  RSVD,       INPUT,  0x32a0),
276         PINGROUP(GPIO_PBB6,       CAM,      VGP6,       DISPLAYA,   DISPLAYB,   POPSDMMC4,  RSVD,       INPUT,  0x32a4),
277         PINGROUP(GPIO_PBB7,       CAM,      I2S4,       RSVD1,      RSVD2,      POPSDMMC4,  RSVD,       INPUT,  0x32a8),
278         PINGROUP(GPIO_PCC2,       CAM,      I2S4,       RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x32ac),
279         PINGROUP(JTAG_RTCK,       SYS,      RTCK,       RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x32b0),
280         PINGROUP(PWR_I2C_SCL,     SYS,      I2CPWR,     RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x32b4),
281         PINGROUP(PWR_I2C_SDA,     SYS,      I2CPWR,     RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x32b8),
282         PINGROUP(KB_ROW0,         SYS,      KBC,        NAND,       RSVD2,      RSVD3,      RSVD,       INPUT,  0x32bc),
283         PINGROUP(KB_ROW1,         SYS,      KBC,        NAND,       RSVD2,      RSVD3,      RSVD,       INPUT,  0x32c0),
284         PINGROUP(KB_ROW2,         SYS,      KBC,        NAND,       RSVD2,      RSVD3,      RSVD,       INPUT,  0x32c4),
285         PINGROUP(KB_ROW3,         SYS,      KBC,        NAND,       RSVD2,      MIO,        RSVD,       INPUT,  0x32c8),
286         PINGROUP(KB_ROW4,         SYS,      KBC,        NAND,       TRACE,      RSVD3,      RSVD,       INPUT,  0x32cc),
287         PINGROUP(KB_ROW5,         SYS,      KBC,        NAND,       TRACE,      OWR,        RSVD,       INPUT,  0x32d0),
288         PINGROUP(KB_ROW6,         SYS,      KBC,        NAND,       SDMMC2,     MIO,        RSVD,       INPUT,  0x32d4),
289         PINGROUP(KB_ROW7,         SYS,      KBC,        NAND,       SDMMC2,     MIO,        RSVD,       INPUT,  0x32d8),
290         PINGROUP(KB_ROW8,         SYS,      KBC,        NAND,       SDMMC2,     MIO,        RSVD,       INPUT,  0x32dc),
291         PINGROUP(KB_ROW9,         SYS,      KBC,        NAND,       SDMMC2,     MIO,        RSVD,       INPUT,  0x32e0),
292         PINGROUP(KB_ROW10,        SYS,      KBC,        NAND,       SDMMC2,     MIO,        RSVD,       INPUT,  0x32e4),
293         PINGROUP(KB_ROW11,        SYS,      KBC,        NAND,       SDMMC2,     MIO,        RSVD,       INPUT,  0x32e8),
294         PINGROUP(KB_ROW12,        SYS,      KBC,        NAND,       SDMMC2,     MIO,        RSVD,       INPUT,  0x32ec),
295         PINGROUP(KB_ROW13,        SYS,      KBC,        NAND,       SDMMC2,     MIO,        RSVD,       INPUT,  0x32f0),
296         PINGROUP(KB_ROW14,        SYS,      KBC,        NAND,       SDMMC2,     MIO,        RSVD,       INPUT,  0x32f4),
297         PINGROUP(KB_ROW15,        SYS,      KBC,        NAND,       SDMMC2,     MIO,        RSVD,       INPUT,  0x32f8),
298         PINGROUP(KB_COL0,         SYS,      KBC,        NAND,       TRACE,      EMC_DLL,    RSVD,       INPUT,  0x32fc),
299         PINGROUP(KB_COL1,         SYS,      KBC,        NAND,       TRACE,      EMC_DLL,    RSVD,       INPUT,  0x3300),
300         PINGROUP(KB_COL2,         SYS,      KBC,        NAND,       TRACE,      RSVD,       RSVD,       INPUT,  0x3304),
301         PINGROUP(KB_COL3,         SYS,      KBC,        NAND,       TRACE,      RSVD,       RSVD,       INPUT,  0x3308),
302         PINGROUP(KB_COL4,         SYS,      KBC,        NAND,       TRACE,      RSVD,       RSVD,       INPUT,  0x330c),
303         PINGROUP(KB_COL5,         SYS,      KBC,        NAND,       TRACE,      RSVD,       RSVD,       INPUT,  0x3310),
304         PINGROUP(KB_COL6,         SYS,      KBC,        NAND,       TRACE,      MIO,        RSVD,       INPUT,  0x3314),
305         PINGROUP(KB_COL7,         SYS,      KBC,        NAND,       TRACE,      MIO,        RSVD,       INPUT,  0x3318),
306         PINGROUP(CLK_32K_OUT,     SYS,      BLINK,      RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x331c),
307         PINGROUP(SYS_CLK_REQ,     SYS,      SYSCLK,     RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x3320),
308         PINGROUP(CORE_PWR_REQ,    SYS,      RSVD,       RSVD,       RSVD,       RSVD,       RSVD,       INPUT,  0x3324),
309         PINGROUP(CPU_PWR_REQ,     SYS,      RSVD,       RSVD,       RSVD,       RSVD,       RSVD,       INPUT,  0x3328),
310         PINGROUP(PWR_INT_N,       SYS,      RSVD,       RSVD,       RSVD,       RSVD,       RSVD,       INPUT,  0x332c),
311         PINGROUP(CLK_32K_IN,      SYS,      RSVD,       RSVD,       RSVD,       RSVD,       RSVD,       INPUT,  0x3330),
312         PINGROUP(OWR,             SYS,      OWR,        RSVD,       RSVD,       RSVD,       RSVD,       INPUT,  0x3334),
313         PINGROUP(DAP1_FS,         AUDIO,    I2S0,       HDA,        GMI,        SDMMC2,     RSVD,       INPUT,  0x3338),
314         PINGROUP(DAP1_DIN,        AUDIO,    I2S0,       HDA,        GMI,        SDMMC2,     RSVD,       INPUT,  0x333c),
315         PINGROUP(DAP1_DOUT,       AUDIO,    I2S0,       HDA,        GMI,        SDMMC2,     RSVD,       INPUT,  0x3340),
316         PINGROUP(DAP1_SCLK,       AUDIO,    I2S0,       HDA,        GMI,        SDMMC2,     RSVD,       INPUT,  0x3344),
317         PINGROUP(CLK1_REQ,        AUDIO,    DAP,        DAP1,       RSVD2,      RSVD3,      RSVD,       INPUT,  0x3348),
318         PINGROUP(CLK1_OUT,        AUDIO,    EXTPERIPH1, RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x334c),
319         PINGROUP(SPDIF_IN,        AUDIO,    SPDIF,      DAP2,       I2C1,       DAPSDMMC2,  RSVD,       INPUT,  0x3350),
320         PINGROUP(SPDIF_OUT,       AUDIO,    SPDIF,      RSVD1,      I2C1,       DAPSDMMC2,  RSVD,       INPUT,  0x3354),
321         PINGROUP(DAP2_FS,         AUDIO,    I2S1,       HDA,        RSVD2,      GMI,        RSVD,       INPUT,  0x3358),
322         PINGROUP(DAP2_DIN,        AUDIO,    I2S1,       HDA,        RSVD2,      GMI,        RSVD,       INPUT,  0x335c),
323         PINGROUP(DAP2_DOUT,       AUDIO,    I2S1,       HDA,        RSVD2,      GMI,        RSVD,       INPUT,  0x3360),
324         PINGROUP(DAP2_SCLK,       AUDIO,    I2S1,       HDA,        RSVD2,      GMI,        RSVD,       INPUT,  0x3364),
325         PINGROUP(SPI2_MOSI,       AUDIO,    SPI6,       SPI2,       SPI3,       GMI,        RSVD,       INPUT,  0x3368),
326         PINGROUP(SPI2_MISO,       AUDIO,    SPI6,       SPI2,       SPI3,       GMI,        RSVD,       INPUT,  0x336c),
327         PINGROUP(SPI2_CS0_N,      AUDIO,    SPI6,       SPI2,       SPI3,       GMI,        RSVD,       INPUT,  0x3370),
328         PINGROUP(SPI2_SCK,        AUDIO,    SPI6,       SPI2,       SPI3,       GMI,        RSVD,       INPUT,  0x3374),
329         PINGROUP(SPI1_MOSI,       AUDIO,    SPI2,       SPI1,       SPI2_ALT,   GMI,        RSVD,       INPUT,  0x3378),
330         PINGROUP(SPI1_SCK,        AUDIO,    SPI2,       SPI1,       SPI2_ALT,   GMI,        RSVD,       INPUT,  0x337c),
331         PINGROUP(SPI1_CS0_N,      AUDIO,    SPI2,       SPI1,       SPI2_ALT,   GMI,        RSVD,       INPUT,  0x3380),
332         PINGROUP(SPI1_MISO,       AUDIO,    SPI3,       SPI1,       SPI2,       RSVD3,      RSVD,       INPUT,  0x3384),
333         PINGROUP(SPI2_CS1_N,      AUDIO,    SPI3,       SPI2,       SPI2_ALT,   I2C1,       RSVD,       INPUT,  0x3388),
334         PINGROUP(SPI2_CS2_N,      AUDIO,    SPI3,       SPI2,       SPI2_ALT,   I2C1,       RSVD,       INPUT,  0x338c),
335         PINGROUP(SDMMC3_CLK,      SDMMC3,   UARTA,      PWM2,       SDMMC3,     SPI3,       RSVD,       INPUT,  0x3390),
336         PINGROUP(SDMMC3_CMD,      SDMMC3,   UARTA,      PWM3,       SDMMC3,     SPI2,       RSVD,       INPUT,  0x3394),
337         PINGROUP(SDMMC3_DAT0,     SDMMC3,   RSVD0,      RSVD1,      SDMMC3,     SPI3,       RSVD,       INPUT,  0x3398),
338         PINGROUP(SDMMC3_DAT1,     SDMMC3,   RSVD0,      RSVD1,      SDMMC3,     SPI3,       RSVD,       INPUT,  0x339c),
339         PINGROUP(SDMMC3_DAT2,     SDMMC3,   RSVD0,      PWM1,       SDMMC3,     SPI3,       RSVD,       INPUT,  0x33a0),
340         PINGROUP(SDMMC3_DAT3,     SDMMC3,   RSVD0,      PWM0,       SDMMC3,     SPI3,       RSVD,       INPUT,  0x33a4),
341         PINGROUP(SDMMC3_DAT4,     SDMMC3,   PWM1,       SPI4,       SDMMC3,     SPI2,       RSVD,       INPUT,  0x33a8),
342         PINGROUP(SDMMC3_DAT5,     SDMMC3,   PWM0,       SPI4,       SDMMC3,     SPI2,       RSVD,       INPUT,  0x33ac),
343         PINGROUP(SDMMC3_DAT6,     SDMMC3,   SPDIF,      SPI4,       SDMMC3,     SPI2,       RSVD,       INPUT,  0x33b0),
344         PINGROUP(SDMMC3_DAT7,     SDMMC3,   SPDIF,      SPI4,       SDMMC3,     SPI2,       RSVD,       INPUT,  0x33b4),
345         PINGROUP(PEX_L0_PRSNT_N,  PEXCTL,   PCIE,       HDA,        RSVD2,      RSVD3,      RSVD,       INPUT,  0x33b8),
346         PINGROUP(PEX_L0_RST_N,    PEXCTL,   PCIE,       HDA,        RSVD2,      RSVD3,      RSVD,       INPUT,  0x33bc),
347         PINGROUP(PEX_L0_CLKREQ_N, PEXCTL,   PCIE,       HDA,        RSVD2,      RSVD3,      RSVD,       INPUT,  0x33c0),
348         PINGROUP(PEX_WAKE_N,      PEXCTL,   PCIE,       HDA,        RSVD2,      RSVD3,      RSVD,       INPUT,  0x33c4),
349         PINGROUP(PEX_L1_PRSNT_N,  PEXCTL,   PCIE,       HDA,        RSVD2,      RSVD3,      RSVD,       INPUT,  0x33c8),
350         PINGROUP(PEX_L1_RST_N,    PEXCTL,   PCIE,       HDA,        RSVD2,      RSVD3,      RSVD,       INPUT,  0x33cc),
351         PINGROUP(PEX_L1_CLKREQ_N, PEXCTL,   PCIE,       HDA,        RSVD2,      RSVD3,      RSVD,       INPUT,  0x33d0),
352         PINGROUP(PEX_L2_PRSNT_N,  PEXCTL,   PCIE,       HDA,        RSVD2,      RSVD3,      RSVD,       INPUT,  0x33d4),
353         PINGROUP(PEX_L2_RST_N,    PEXCTL,   PCIE,       HDA,        RSVD2,      RSVD3,      RSVD,       INPUT,  0x33d8),
354         PINGROUP(PEX_L2_CLKREQ_N, PEXCTL,   PCIE,       HDA,        RSVD2,      RSVD3,      RSVD,       INPUT,  0x33dc),
355         PINGROUP(HDMI_CEC,        SYS,      CEC,        RSVD1,      RSVD2,      RSVD3,      RSVD,       INPUT,  0x33e0),
356 };
357
358 #ifdef CONFIG_PM
359
360 static u32 pinmux_reg[TEGRA_MAX_PINGROUP +
361                       ARRAY_SIZE(tegra_soc_drive_pingroups)];
362
363 static inline unsigned long pg_readl(unsigned long offset)
364 {
365         return readl(IO_TO_VIRT(TEGRA_APB_MISC_BASE + offset));
366 }
367
368 static inline void pg_writel(unsigned long value, unsigned long offset)
369 {
370         writel(value, IO_TO_VIRT(TEGRA_APB_MISC_BASE + offset));
371 }
372
373 void tegra_pinmux_suspend(void)
374 {
375         unsigned int i;
376         u32 *ctx = pinmux_reg;
377
378         for (i = 0; i < TEGRA_MAX_PINGROUP; i++)
379                 *ctx++ = pg_readl(tegra_soc_pingroups[i].mux_reg);
380
381         for (i = 0; i < ARRAY_SIZE(tegra_soc_drive_pingroups); i ++)
382                 *ctx++ = pg_readl(tegra_soc_drive_pingroups[i].reg);
383 }
384
385 void tegra_pinmux_resume(void)
386 {
387         unsigned int i;
388         u32 *ctx = pinmux_reg;
389
390         for (i = 0; i < TEGRA_MAX_PINGROUP; i++)
391                 pg_writel(*ctx++, tegra_soc_pingroups[i].mux_reg);
392
393         for (i = 0; i < ARRAY_SIZE(tegra_soc_drive_pingroups); i ++)
394                 pg_writel(*ctx++, tegra_soc_drive_pingroups[i].reg);
395 }
396 #endif