blob: 2d14ac9d95e72cbff9307956865eff3f7b8d5578 [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/*
Tom Warren9c79abe2012-12-11 13:34:13 +00003 * Copyright (c) 2010-2012, NVIDIA CORPORATION. All rights reserved.
Tom Warren9c79abe2012-12-11 13:34:13 +00004 */
Allen Martine60ab6e2012-08-31 08:30:09 +00005
Tom Warrenab371962012-09-19 15:50:56 -07006#include <common.h>
Allen Martine60ab6e2012-08-31 08:30:09 +00007#include <asm/io.h>
Tom Warrenab371962012-09-19 15:50:56 -07008#include <asm/arch/tegra.h>
Tom Warrenab371962012-09-19 15:50:56 -07009#include <asm/arch-tegra/pmc.h>
Masahiro Yamadaed1632a2015-02-20 17:04:04 +090010#include "../cpu.h"
Allen Martine60ab6e2012-08-31 08:30:09 +000011
Allen Martine60ab6e2012-08-31 08:30:09 +000012static void enable_cpu_power_rail(void)
13{
Tom Warren22562a42012-09-04 17:00:24 -070014 struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
Allen Martine60ab6e2012-08-31 08:30:09 +000015 u32 reg;
16
17 reg = readl(&pmc->pmc_cntrl);
18 reg |= CPUPWRREQ_OE;
19 writel(reg, &pmc->pmc_cntrl);
20
21 /*
22 * The TI PMU65861C needs a 3.75ms delay between enabling
23 * the power rail and enabling the CPU clock. This delay
24 * between SM1EN and SM1 is for switching time + the ramp
25 * up of the voltage to the CPU (VDD_CPU from PMU).
26 */
27 udelay(3750);
28}
29
Allen Martine60ab6e2012-08-31 08:30:09 +000030void start_cpu(u32 reset_vector)
31{
32 /* Enable VDD_CPU */
33 enable_cpu_power_rail();
34
35 /* Hold the CPUs in reset */
36 reset_A9_cpu(1);
37
38 /* Disable the CPU clock */
39 enable_cpu_clock(0);
40
41 /* Enable CoreSight */
42 clock_enable_coresight(1);
43
44 /*
45 * Set the entry point for CPU execution from reset,
46 * if it's a non-zero value.
47 */
48 if (reset_vector)
49 writel(reset_vector, EXCEP_VECTOR_CPU_RESET_VECTOR);
50
51 /* Enable the CPU clock */
52 enable_cpu_clock(1);
53
54 /* If the CPU doesn't already have power, power it up */
55 powerup_cpu();
56
57 /* Take the CPU out of reset */
58 reset_A9_cpu(0);
59}