blob: e0f9d5b6b4e9cc919fbba4e1b311ecbec6f3598f [file] [log] [blame]
Allen Martine60ab6e2012-08-31 08:30:09 +00001/*
2 * (C) Copyright 2012
3 * NVIDIA Inc, <www.nvidia.com>
4 *
5 * Allen Martin <amartin@nvidia.com>
6 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02007 * SPDX-License-Identifier: GPL-2.0+
Allen Martine60ab6e2012-08-31 08:30:09 +00008 */
9#include <common.h>
Allen Martin36ea6272012-10-19 21:08:23 +000010#include <spl.h>
Allen Martine60ab6e2012-08-31 08:30:09 +000011
12#include <asm/io.h>
Allen Martine60ab6e2012-08-31 08:30:09 +000013#include <asm/arch/clock.h>
Allen Martine60ab6e2012-08-31 08:30:09 +000014#include <asm/arch/pinmux.h>
Tom Warrenab371962012-09-19 15:50:56 -070015#include <asm/arch/tegra.h>
Stephen Warrenfdb906f2014-03-21 12:28:53 -060016#include <asm/arch-tegra/apb_misc.h>
Lucas Stache80f7ca2012-09-29 10:02:08 +000017#include <asm/arch-tegra/board.h>
Masahiro Yamada74726562014-04-23 21:20:43 +090018#include <asm/spl.h>
Tom Warren9c79abe2012-12-11 13:34:13 +000019#include "cpu.h"
Allen Martine60ab6e2012-08-31 08:30:09 +000020
Allen Martin36ea6272012-10-19 21:08:23 +000021void spl_board_init(void)
Allen Martine60ab6e2012-08-31 08:30:09 +000022{
Stephen Warrenfdb906f2014-03-21 12:28:53 -060023 struct apb_misc_pp_ctlr *apb_misc =
24 (struct apb_misc_pp_ctlr *)NV_PA_APB_MISC_BASE;
Allen Martine60ab6e2012-08-31 08:30:09 +000025
Allen Martin36ea6272012-10-19 21:08:23 +000026 /* enable JTAG */
Stephen Warrenfdb906f2014-03-21 12:28:53 -060027 writel(0xC0, &apb_misc->cfg_ctl);
Allen Martin36ea6272012-10-19 21:08:23 +000028
Allen Martine60ab6e2012-08-31 08:30:09 +000029 board_init_uart_f();
30
31 /* Initialize periph GPIOs */
Allen Martine60ab6e2012-08-31 08:30:09 +000032 gpio_early_init_uart();
Allen Martine60ab6e2012-08-31 08:30:09 +000033
Allen Martin36ea6272012-10-19 21:08:23 +000034 clock_early_init();
35 preloader_console_init();
Allen Martine60ab6e2012-08-31 08:30:09 +000036}
37
Allen Martin36ea6272012-10-19 21:08:23 +000038u32 spl_boot_device(void)
Allen Martine60ab6e2012-08-31 08:30:09 +000039{
Allen Martin36ea6272012-10-19 21:08:23 +000040 return BOOT_DEVICE_RAM;
Allen Martine60ab6e2012-08-31 08:30:09 +000041}
42
Allen Martin36ea6272012-10-19 21:08:23 +000043void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
Allen Martine60ab6e2012-08-31 08:30:09 +000044{
Allen Martin36ea6272012-10-19 21:08:23 +000045 debug("image entry point: 0x%X\n", spl_image->entry_point);
Allen Martine60ab6e2012-08-31 08:30:09 +000046
Allen Martin36ea6272012-10-19 21:08:23 +000047 start_cpu((u32)spl_image->entry_point);
Allen Martine60ab6e2012-08-31 08:30:09 +000048 halt_avp();
Allen Martine60ab6e2012-08-31 08:30:09 +000049}