blob: 4b9a8f33e89daef1c9458be0b176e01211ab225e [file] [log] [blame]
Tom Warrenf4ef6662011-04-14 12:09:41 +00001/*
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#include <common.h>
25#include <asm/io.h>
26#include <asm/arch/tegra2.h>
27#include <asm/arch/gpio.h>
28
29/*
30 * Routine: gpio_config_uart
31 * Description: Force GPIO_PI3 low on Seaboard so UART4 works.
32 */
33void gpio_config_uart(void)
34{
35 int gp = GPIO_PI3;
36 struct gpio_ctlr *gpio = (struct gpio_ctlr *)NV_PA_GPIO_BASE;
37 struct gpio_ctlr_bank *bank = &gpio->gpio_bank[GPIO_BANK(gp)];
38 u32 val;
39
40 /* Enable UART via GPIO_PI3 (port 8, bit 3) so serial console works */
41 val = readl(&bank->gpio_config[GPIO_PORT(gp)]);
42 val |= 1 << GPIO_BIT(gp);
43 writel(val, &bank->gpio_config[GPIO_PORT(gp)]);
44
45 val = readl(&bank->gpio_out[GPIO_PORT(gp)]);
46 val &= ~(1 << GPIO_BIT(gp));
47 writel(val, &bank->gpio_out[GPIO_PORT(gp)]);
48
49 val = readl(&bank->gpio_dir_out[GPIO_PORT(gp)]);
50 val |= 1 << GPIO_BIT(gp);
51 writel(val, &bank->gpio_dir_out[GPIO_PORT(gp)]);
52}