blob: 5df0eb28c96f4a4a20fcf408707b3924586466bb [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 */
Simon Glass923983a2017-07-25 08:29:57 -06008#include <debug_uart.h>
Simon Glass0f2af882020-05-10 11:40:05 -06009#include <log.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();
Simon Glass923983a2017-07-25 08:29:57 -060035#ifdef CONFIG_DEBUG_UART
36 debug_uart_init();
37#endif
Allen Martin36ea6272012-10-19 21:08:23 +000038 preloader_console_init();
Allen Martine60ab6e2012-08-31 08:30:09 +000039}
40
Allen Martin36ea6272012-10-19 21:08:23 +000041u32 spl_boot_device(void)
Allen Martine60ab6e2012-08-31 08:30:09 +000042{
Allen Martin36ea6272012-10-19 21:08:23 +000043 return BOOT_DEVICE_RAM;
Allen Martine60ab6e2012-08-31 08:30:09 +000044}
45
Allen Martin36ea6272012-10-19 21:08:23 +000046void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
Allen Martine60ab6e2012-08-31 08:30:09 +000047{
Andre Przywara6c526072017-01-02 11:48:31 +000048 debug("image entry point: 0x%lX\n", spl_image->entry_point);
Allen Martine60ab6e2012-08-31 08:30:09 +000049
Allen Martin36ea6272012-10-19 21:08:23 +000050 start_cpu((u32)spl_image->entry_point);
Allen Martine60ab6e2012-08-31 08:30:09 +000051 halt_avp();
Allen Martine60ab6e2012-08-31 08:30:09 +000052}