blob: ed897efc5f07510683104786212ec4a4b040a8d2 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Allen Martine60ab6e2012-08-31 08:30:09 +00002/*
3 * (C) Copyright 2012
4 * NVIDIA Inc, <www.nvidia.com>
5 *
6 * Allen Martin <amartin@nvidia.com>
Allen Martine60ab6e2012-08-31 08:30:09 +00007 */
8#include <common.h>
Simon Glass923983a2017-07-25 08:29:57 -06009#include <debug_uart.h>
Simon Glass0f2af882020-05-10 11:40:05 -060010#include <log.h>
Allen Martin36ea6272012-10-19 21:08:23 +000011#include <spl.h>
Allen Martine60ab6e2012-08-31 08:30:09 +000012
13#include <asm/io.h>
Allen Martine60ab6e2012-08-31 08:30:09 +000014#include <asm/arch/clock.h>
Allen Martine60ab6e2012-08-31 08:30:09 +000015#include <asm/arch/pinmux.h>
Tom Warrenab371962012-09-19 15:50:56 -070016#include <asm/arch/tegra.h>
Stephen Warrenfdb906f2014-03-21 12:28:53 -060017#include <asm/arch-tegra/apb_misc.h>
Lucas Stache80f7ca2012-09-29 10:02:08 +000018#include <asm/arch-tegra/board.h>
Masahiro Yamada74726562014-04-23 21:20:43 +090019#include <asm/spl.h>
Tom Warren9c79abe2012-12-11 13:34:13 +000020#include "cpu.h"
Allen Martine60ab6e2012-08-31 08:30:09 +000021
Allen Martin36ea6272012-10-19 21:08:23 +000022void spl_board_init(void)
Allen Martine60ab6e2012-08-31 08:30:09 +000023{
Stephen Warrenfdb906f2014-03-21 12:28:53 -060024 struct apb_misc_pp_ctlr *apb_misc =
25 (struct apb_misc_pp_ctlr *)NV_PA_APB_MISC_BASE;
Allen Martine60ab6e2012-08-31 08:30:09 +000026
Allen Martin36ea6272012-10-19 21:08:23 +000027 /* enable JTAG */
Stephen Warrenfdb906f2014-03-21 12:28:53 -060028 writel(0xC0, &apb_misc->cfg_ctl);
Allen Martin36ea6272012-10-19 21:08:23 +000029
Allen Martine60ab6e2012-08-31 08:30:09 +000030 board_init_uart_f();
31
32 /* Initialize periph GPIOs */
Allen Martine60ab6e2012-08-31 08:30:09 +000033 gpio_early_init_uart();
Allen Martine60ab6e2012-08-31 08:30:09 +000034
Allen Martin36ea6272012-10-19 21:08:23 +000035 clock_early_init();
Simon Glass923983a2017-07-25 08:29:57 -060036#ifdef CONFIG_DEBUG_UART
37 debug_uart_init();
38#endif
Allen Martin36ea6272012-10-19 21:08:23 +000039 preloader_console_init();
Allen Martine60ab6e2012-08-31 08:30:09 +000040}
41
Allen Martin36ea6272012-10-19 21:08:23 +000042u32 spl_boot_device(void)
Allen Martine60ab6e2012-08-31 08:30:09 +000043{
Allen Martin36ea6272012-10-19 21:08:23 +000044 return BOOT_DEVICE_RAM;
Allen Martine60ab6e2012-08-31 08:30:09 +000045}
46
Allen Martin36ea6272012-10-19 21:08:23 +000047void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
Allen Martine60ab6e2012-08-31 08:30:09 +000048{
Andre Przywara6c526072017-01-02 11:48:31 +000049 debug("image entry point: 0x%lX\n", spl_image->entry_point);
Allen Martine60ab6e2012-08-31 08:30:09 +000050
Allen Martin36ea6272012-10-19 21:08:23 +000051 start_cpu((u32)spl_image->entry_point);
Allen Martine60ab6e2012-08-31 08:30:09 +000052 halt_avp();
Allen Martine60ab6e2012-08-31 08:30:09 +000053}