2011-01-27 10:58:05 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2010,2011
|
|
|
|
* NVIDIA Corporation <www.nvidia.com>
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <ns16550.h>
|
2012-04-10 05:17:06 +00:00
|
|
|
#include <linux/compiler.h>
|
2011-01-27 10:58:05 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/arch/tegra2.h>
|
|
|
|
#include <asm/arch/sys_proto.h>
|
|
|
|
|
2011-11-28 15:04:40 +00:00
|
|
|
#include <asm/arch/board.h>
|
2011-01-27 10:58:05 +00:00
|
|
|
#include <asm/arch/clk_rst.h>
|
2011-08-30 06:23:13 +00:00
|
|
|
#include <asm/arch/clock.h>
|
2012-04-10 05:17:06 +00:00
|
|
|
#include <asm/arch/emc.h>
|
2011-01-27 10:58:05 +00:00
|
|
|
#include <asm/arch/pinmux.h>
|
2012-04-02 13:18:54 +00:00
|
|
|
#include <asm/arch/pmc.h>
|
|
|
|
#include <asm/arch/pmu.h>
|
2011-01-27 10:58:05 +00:00
|
|
|
#include <asm/arch/uart.h>
|
2012-04-02 13:18:57 +00:00
|
|
|
#include <asm/arch/warmboot.h>
|
2011-11-05 09:48:11 +00:00
|
|
|
#include <spi.h>
|
2012-02-27 10:52:50 +00:00
|
|
|
#include <asm/arch/usb.h>
|
2012-02-03 15:13:57 +00:00
|
|
|
#include <i2c.h>
|
2011-04-14 12:18:06 +00:00
|
|
|
#include "board.h"
|
2012-04-10 05:17:06 +00:00
|
|
|
#include "emc.h"
|
2011-01-27 10:58:05 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
const struct tegra2_sysinfo sysinfo = {
|
|
|
|
CONFIG_TEGRA2_BOARD_STRING
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Routine: timer_init
|
|
|
|
* Description: init the timestamp and lastinc value
|
|
|
|
*/
|
|
|
|
int timer_init(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-02-27 10:52:50 +00:00
|
|
|
void __pin_mux_usb(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void pin_mux_usb(void) __attribute__((weak, alias("__pin_mux_usb")));
|
|
|
|
|
2012-04-02 13:18:58 +00:00
|
|
|
/*
|
|
|
|
* Routine: power_det_init
|
|
|
|
* Description: turn off power detects
|
|
|
|
*/
|
|
|
|
static void power_det_init(void)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_TEGRA2)
|
|
|
|
struct pmc_ctlr *const pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE;
|
|
|
|
|
|
|
|
/* turn off power detects */
|
|
|
|
writel(0, &pmc->pmc_pwr_det_latch);
|
|
|
|
writel(0, &pmc->pmc_pwr_det);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-01-27 10:58:05 +00:00
|
|
|
/*
|
|
|
|
* Routine: board_init
|
|
|
|
* Description: Early hardware init.
|
|
|
|
*/
|
|
|
|
int board_init(void)
|
|
|
|
{
|
2012-04-10 05:17:06 +00:00
|
|
|
__maybe_unused int err;
|
|
|
|
|
2011-11-05 04:46:51 +00:00
|
|
|
/* Do clocks and UART first so that printf() works */
|
2011-09-21 12:40:04 +00:00
|
|
|
clock_init();
|
|
|
|
clock_verify();
|
|
|
|
|
2011-11-05 04:46:51 +00:00
|
|
|
#ifdef CONFIG_SPI_UART_SWITCH
|
|
|
|
gpio_config_uart();
|
|
|
|
#endif
|
2011-11-05 09:48:11 +00:00
|
|
|
#ifdef CONFIG_TEGRA2_SPI
|
|
|
|
spi_init();
|
|
|
|
#endif
|
2011-01-27 10:58:05 +00:00
|
|
|
/* boot param addr */
|
|
|
|
gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE + 0x100);
|
2012-04-02 13:18:58 +00:00
|
|
|
|
|
|
|
power_det_init();
|
|
|
|
|
2012-02-03 15:13:57 +00:00
|
|
|
#ifdef CONFIG_TEGRA_I2C
|
|
|
|
#ifndef CONFIG_SYS_I2C_INIT_BOARD
|
|
|
|
#error "You must define CONFIG_SYS_I2C_INIT_BOARD to use i2c on Nvidia boards"
|
|
|
|
#endif
|
|
|
|
i2c_init_board();
|
2012-04-02 13:18:54 +00:00
|
|
|
# ifdef CONFIG_TEGRA_PMU
|
|
|
|
if (pmu_set_nominal())
|
|
|
|
debug("Failed to select nominal voltages\n");
|
2012-04-10 05:17:06 +00:00
|
|
|
# ifdef CONFIG_TEGRA_CLOCK_SCALING
|
|
|
|
err = board_emc_init();
|
|
|
|
if (err)
|
|
|
|
debug("Memory controller init failed: %d\n", err);
|
|
|
|
# endif
|
|
|
|
# endif /* CONFIG_TEGRA_PMU */
|
|
|
|
#endif /* CONFIG_TEGRA_I2C */
|
2011-01-27 10:58:05 +00:00
|
|
|
|
2012-02-27 10:52:50 +00:00
|
|
|
#ifdef CONFIG_USB_EHCI_TEGRA
|
|
|
|
pin_mux_usb();
|
|
|
|
board_usb_init(gd->fdt_blob);
|
|
|
|
#endif
|
|
|
|
|
2012-04-02 13:18:57 +00:00
|
|
|
#ifdef CONFIG_TEGRA2_LP0
|
|
|
|
/* prepare the WB code to LP0 location */
|
|
|
|
warmboot_prepare_code(TEGRA_LP0_ADDR, TEGRA_LP0_SIZE);
|
|
|
|
#endif
|
|
|
|
|
2011-01-27 10:58:05 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2011-05-31 10:30:37 +00:00
|
|
|
|
2011-09-21 12:40:03 +00:00
|
|
|
#ifdef CONFIG_BOARD_EARLY_INIT_F
|
|
|
|
int board_early_init_f(void)
|
|
|
|
{
|
2011-11-28 15:04:40 +00:00
|
|
|
board_init_uart_f();
|
2011-09-21 12:40:03 +00:00
|
|
|
|
|
|
|
/* Initialize periph GPIOs */
|
2011-11-05 04:46:51 +00:00
|
|
|
#ifdef CONFIG_SPI_UART_SWITCH
|
|
|
|
gpio_early_init_uart();
|
|
|
|
#else
|
2011-09-21 12:40:03 +00:00
|
|
|
gpio_config_uart();
|
2011-11-05 04:46:51 +00:00
|
|
|
#endif
|
2011-09-21 12:40:03 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* EARLY_INIT */
|