blob: fec31c468649e2699f3810f2f4baac0fea9ea4c9 [file] [log] [blame]
Aaron Durbinbc3019c2014-07-15 10:53:29 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2014 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Aaron Durbinbc3019c2014-07-15 10:53:29 -050014 */
15
Aaron Durbinbc3019c2014-07-15 10:53:29 -050016#include <arch/stages.h>
Julius Werner7dcf9d52015-10-16 13:10:02 -070017#include <gic.h>
Aaron Durbinbc3019c2014-07-15 10:53:29 -050018#include <soc/addressmap.h>
Jimmy Zhangaa228d02014-07-23 17:42:45 -070019#include <soc/clock.h>
Furquan Shaikhfdb3a8d2015-10-15 15:50:30 -070020#include <soc/mc.h>
Julius Werner96195ee2014-10-20 13:25:21 -070021#include <soc/mmu_operations.h>
Aaron Durbinbc3019c2014-07-15 10:53:29 -050022
Furquan Shaikhfdb3a8d2015-10-15 15:50:30 -070023static void lock_down_vpr(void)
24{
25 struct tegra_mc_regs *regs = (void *)(uintptr_t)TEGRA_MC_BASE;
26
27 write32(&regs->video_protect_bom, 0);
28 write32(&regs->video_protect_size_mb, 0);
29 write32(&regs->video_protect_reg_ctrl, 1);
30}
31
Julius Werner7dcf9d52015-10-16 13:10:02 -070032/* Tegra-specific entry point, called from assembly in stage_entry.S */
33void ramstage_entry(void);
34void ramstage_entry(void)
Aaron Durbinbc3019c2014-07-15 10:53:29 -050035{
Julius Werner7dcf9d52015-10-16 13:10:02 -070036 /* TODO: Is this still needed? */
37 gic_init();
38
39 /* TODO: Move TrustZone setup to BL31? */
Aaron Durbin7ddb5f72014-07-21 14:24:42 -050040 trustzone_region_init();
Furquan Shaikhda9b9f32014-07-17 11:42:35 -070041
42 tegra132_mmu_init();
Jimmy Zhangaa228d02014-07-23 17:42:45 -070043
44 clock_cpu0_config();
Furquan Shaikhfdb3a8d2015-10-15 15:50:30 -070045
46 clock_init_arm_generic_timer();
47
48 /* Lock down VPR */
49 lock_down_vpr();
Julius Werner7dcf9d52015-10-16 13:10:02 -070050
51 /* Jump to boot state machine in common code. */
52 main();
Aaron Durbinbc3019c2014-07-15 10:53:29 -050053}