2 * Copyright (c) 2011, Google Inc. All rights reserved.
3 * See file CREDITS for list of people who contributed to this
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 #ifndef _TEGRA2_GPIO_H_
23 #define _TEGRA2_GPIO_H_
26 * The Tegra 2x GPIO controller has 224 GPIOs arranged in 7 banks of 4 ports,
29 #define TEGRA_GPIO_PORTS 4 /* number of ports per bank */
30 #define TEGRA_GPIO_BANKS 7 /* number of banks */
31 #define MAX_NUM_GPIOS (TEGRA_GPIO_PORTS * TEGRA_GPIO_BANKS * 8)
32 #define GPIO_NAME_SIZE 20 /* gpio_request max label len */
34 /* GPIO Controller registers for a single bank */
35 struct gpio_ctlr_bank {
36 uint gpio_config[TEGRA_GPIO_PORTS];
37 uint gpio_dir_out[TEGRA_GPIO_PORTS];
38 uint gpio_out[TEGRA_GPIO_PORTS];
39 uint gpio_in[TEGRA_GPIO_PORTS];
40 uint gpio_int_status[TEGRA_GPIO_PORTS];
41 uint gpio_int_enable[TEGRA_GPIO_PORTS];
42 uint gpio_int_level[TEGRA_GPIO_PORTS];
43 uint gpio_int_clear[TEGRA_GPIO_PORTS];
47 struct gpio_ctlr_bank gpio_bank[TEGRA_GPIO_BANKS];
50 #define GPIO_BANK(x) ((x) >> 5)
51 #define GPIO_PORT(x) (((x) >> 3) & 0x3)
52 #define GPIO_FULLPORT(x) ((x) >> 3)
53 #define GPIO_BIT(x) ((x) & 0x7)
56 GPIO_PA0 = 0, /* pin 0 */
72 GPIO_PC0, /* pin 16 */
80 GPIO_PD0, /* pin 24 */
88 GPIO_PE0, /* pin 32 */
96 GPIO_PF0, /* pin 40 */
104 GPIO_PG0, /* pin 48 */
112 GPIO_PH0, /* pin 56 */
120 GPIO_PI0, /* pin 64 */
128 GPIO_PJ0, /* pin 72 */
136 GPIO_PK0, /* pin 80 */
144 GPIO_PL0, /* pin 88 */
152 GPIO_PM0, /* pin 96 */
160 GPIO_PN0, /* pin 104 */
168 GPIO_PO0, /* pin 112 */
176 GPIO_PP0, /* pin 120 */
184 GPIO_PQ0, /* pin 128 */
192 GPIO_PR0, /* pin 136 */
200 GPIO_PS0, /* pin 144 */
208 GPIO_PT0, /* pin 152 */
216 GPIO_PU0, /* pin 160 */
224 GPIO_PV0, /* pin 168 */
232 GPIO_PW0, /* pin 176 */
240 GPIO_PX0, /* pin 184 */
248 GPIO_PY0, /* pin 192 */
256 GPIO_PZ0, /* pin 200 */
264 GPIO_PAA0, /* pin 208 */
272 GPIO_PBB0, /* pin 216 */
279 GPIO_PBB7, /* pin 223 */
283 * Tegra2-specific GPIO API
286 void gpio_info(void);
288 #define gpio_status() gpio_info()
289 #endif /* TEGRA2_GPIO_H_ */