Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Allen Martin | e60ab6e | 2012-08-31 08:30:09 +0000 | [diff] [blame] | 2 | /* |
Tom Warren | 9c79abe | 2012-12-11 13:34:13 +0000 | [diff] [blame] | 3 | * Copyright (c) 2010-2012, NVIDIA CORPORATION. All rights reserved. |
Tom Warren | 9c79abe | 2012-12-11 13:34:13 +0000 | [diff] [blame] | 4 | */ |
Allen Martin | e60ab6e | 2012-08-31 08:30:09 +0000 | [diff] [blame] | 5 | |
Tom Warren | ab37196 | 2012-09-19 15:50:56 -0700 | [diff] [blame] | 6 | #include <common.h> |
Allen Martin | e60ab6e | 2012-08-31 08:30:09 +0000 | [diff] [blame] | 7 | #include <asm/io.h> |
Tom Warren | ab37196 | 2012-09-19 15:50:56 -0700 | [diff] [blame] | 8 | #include <asm/arch/tegra.h> |
Tom Warren | ab37196 | 2012-09-19 15:50:56 -0700 | [diff] [blame] | 9 | #include <asm/arch-tegra/pmc.h> |
Masahiro Yamada | ed1632a | 2015-02-20 17:04:04 +0900 | [diff] [blame] | 10 | #include "../cpu.h" |
Allen Martin | e60ab6e | 2012-08-31 08:30:09 +0000 | [diff] [blame] | 11 | |
Allen Martin | e60ab6e | 2012-08-31 08:30:09 +0000 | [diff] [blame] | 12 | static void enable_cpu_power_rail(void) |
| 13 | { |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 14 | struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE; |
Allen Martin | e60ab6e | 2012-08-31 08:30:09 +0000 | [diff] [blame] | 15 | 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 Martin | e60ab6e | 2012-08-31 08:30:09 +0000 | [diff] [blame] | 30 | void 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 | } |