blob: 67f49d7756153867d6bf2410038c9ca61ec8aa21 [file] [log] [blame]
Allen Martinc037c932012-08-31 08:30:09 +00001/*
Tom Warren1b245fe2012-12-11 13:34:13 +00002 * Copyright (c) 2010-2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
Allen Martinc037c932012-08-31 08:30:09 +000016
Allen Martinc037c932012-08-31 08:30:09 +000017#include <common.h>
Tom Warren150c2492012-09-19 15:50:56 -070018#include <asm/io.h>
Tom Warren150c2492012-09-19 15:50:56 -070019#include <asm/arch/tegra.h>
Tom Warren150c2492012-09-19 15:50:56 -070020#include <asm/arch-tegra/pmc.h>
Masahiro Yamada09f455d2015-02-20 17:04:04 +090021#include "../cpu.h"
Allen Martinc037c932012-08-31 08:30:09 +000022
Allen Martinc037c932012-08-31 08:30:09 +000023static void enable_cpu_power_rail(void)
24{
Tom Warren29f3e3f2012-09-04 17:00:24 -070025 struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
Allen Martinc037c932012-08-31 08:30:09 +000026 u32 reg;
27
28 reg = readl(&pmc->pmc_cntrl);
29 reg |= CPUPWRREQ_OE;
30 writel(reg, &pmc->pmc_cntrl);
31
32 /*
33 * The TI PMU65861C needs a 3.75ms delay between enabling
34 * the power rail and enabling the CPU clock. This delay
35 * between SM1EN and SM1 is for switching time + the ramp
36 * up of the voltage to the CPU (VDD_CPU from PMU).
37 */
38 udelay(3750);
39}
40
Allen Martinc037c932012-08-31 08:30:09 +000041void start_cpu(u32 reset_vector)
42{
43 /* Enable VDD_CPU */
44 enable_cpu_power_rail();
45
46 /* Hold the CPUs in reset */
47 reset_A9_cpu(1);
48
49 /* Disable the CPU clock */
50 enable_cpu_clock(0);
51
52 /* Enable CoreSight */
53 clock_enable_coresight(1);
54
55 /*
56 * Set the entry point for CPU execution from reset,
57 * if it's a non-zero value.
58 */
59 if (reset_vector)
60 writel(reset_vector, EXCEP_VECTOR_CPU_RESET_VECTOR);
61
62 /* Enable the CPU clock */
63 enable_cpu_clock(1);
64
65 /* If the CPU doesn't already have power, power it up */
66 powerup_cpu();
67
68 /* Take the CPU out of reset */
69 reset_A9_cpu(0);
70}