blob: ed897efc5f07510683104786212ec4a4b040a8d2 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Allen Martinc037c932012-08-31 08:30:09 +00002/*
3 * (C) Copyright 2012
4 * NVIDIA Inc, <www.nvidia.com>
5 *
6 * Allen Martin <amartin@nvidia.com>
Allen Martinc037c932012-08-31 08:30:09 +00007 */
8#include <common.h>
Simon Glass9b6b3c12017-07-25 08:29:57 -06009#include <debug_uart.h>
Simon Glassf7ae49f2020-05-10 11:40:05 -060010#include <log.h>
Allen Martinb2f98932012-10-19 21:08:23 +000011#include <spl.h>
Allen Martinc037c932012-08-31 08:30:09 +000012
13#include <asm/io.h>
Allen Martinc037c932012-08-31 08:30:09 +000014#include <asm/arch/clock.h>
Allen Martinc037c932012-08-31 08:30:09 +000015#include <asm/arch/pinmux.h>
Tom Warren150c2492012-09-19 15:50:56 -070016#include <asm/arch/tegra.h>
Stephen Warren19ed7b42014-03-21 12:28:53 -060017#include <asm/arch-tegra/apb_misc.h>
Lucas Stach516f00b2012-09-29 10:02:08 +000018#include <asm/arch-tegra/board.h>
Masahiro Yamada9f2ec3f2014-04-23 21:20:43 +090019#include <asm/spl.h>
Tom Warren1b245fe2012-12-11 13:34:13 +000020#include "cpu.h"
Allen Martinc037c932012-08-31 08:30:09 +000021
Allen Martinb2f98932012-10-19 21:08:23 +000022void spl_board_init(void)
Allen Martinc037c932012-08-31 08:30:09 +000023{
Stephen Warren19ed7b42014-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 Martinc037c932012-08-31 08:30:09 +000026
27 /* enable JTAG */
Stephen Warren19ed7b42014-03-21 12:28:53 -060028 writel(0xC0, &apb_misc->cfg_ctl);
Allen Martinc037c932012-08-31 08:30:09 +000029
Allen Martinb2f98932012-10-19 21:08:23 +000030 board_init_uart_f();
Allen Martinc037c932012-08-31 08:30:09 +000031
Allen Martinb2f98932012-10-19 21:08:23 +000032 /* Initialize periph GPIOs */
33 gpio_early_init_uart();
Allen Martinc037c932012-08-31 08:30:09 +000034
35 clock_early_init();
Simon Glass9b6b3c12017-07-25 08:29:57 -060036#ifdef CONFIG_DEBUG_UART
37 debug_uart_init();
38#endif
Allen Martinc037c932012-08-31 08:30:09 +000039 preloader_console_init();
Allen Martinc037c932012-08-31 08:30:09 +000040}
41
Allen Martinb2f98932012-10-19 21:08:23 +000042u32 spl_boot_device(void)
Allen Martinc037c932012-08-31 08:30:09 +000043{
Allen Martinb2f98932012-10-19 21:08:23 +000044 return BOOT_DEVICE_RAM;
45}
46
47void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
48{
Andre Przywara11e14792017-01-02 11:48:31 +000049 debug("image entry point: 0x%lX\n", spl_image->entry_point);
Allen Martinb2f98932012-10-19 21:08:23 +000050
51 start_cpu((u32)spl_image->entry_point);
52 halt_avp();
Allen Martinc037c932012-08-31 08:30:09 +000053}