diff options
author | Aaron Durbin <adurbin@chromium.org> | 2014-08-22 10:24:27 -0500 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-03-27 08:03:39 +0100 |
commit | 4058d7b9d465ce730a7043e0ce2ae780a7627d81 (patch) | |
tree | e07f51c075da24edc8f6c4707af0974abb2c2346 /src/soc/nvidia/tegra132/ccplex.c | |
parent | 69761cd1652954e4344f6f8926392572d2f5a8d6 (diff) | |
download | coreboot-4058d7b9d465ce730a7043e0ce2ae780a7627d81.tar.xz |
tegra132: refactor cpu startup code
In order to more easily bring up the 2nd core refactor
the cpu startup logic. A common 32bit_entry.S is compiled
both for romstage and ramstage to provide the common 32-bit
entry point.
BUG=chrome-os-partner:31545
BRANCH=None
TEST=Built and booted ryu to the kernel. Also, can get the 2nd
core up out of reset.
Change-Id: I0c2c9f637189009767e8d5510732678c64e62a2a
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 7394b271bf67dfad8a601f41faaac8f07ae6d4a5
Original-Change-Id: Id810df95c53d3dc8b36d8bd21851d3b0006a8bc2
Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/213850
Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/9001
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/nvidia/tegra132/ccplex.c')
-rw-r--r-- | src/soc/nvidia/tegra132/ccplex.c | 68 |
1 files changed, 8 insertions, 60 deletions
diff --git a/src/soc/nvidia/tegra132/ccplex.c b/src/soc/nvidia/tegra132/ccplex.c index 90818b5515..1085b285ad 100644 --- a/src/soc/nvidia/tegra132/ccplex.c +++ b/src/soc/nvidia/tegra132/ccplex.c @@ -23,6 +23,7 @@ #include <cbfs.h> #include <timer.h> #include <soc/addressmap.h> +#include <soc/cpu.h> #include <soc/romstage.h> #include "clk_rst.h" #include "ccplex.h" @@ -31,7 +32,6 @@ #include "pmc.h" #include "power.h" -#define EVP_CPU_RESET_VECTOR (void *)(uintptr_t)(TEGRA_EVP_BASE + 0x100) #define CLK_RST_REGS (void *)(uintptr_t)(TEGRA_CLK_RST_BASE) #define PMC_REGS (void *)(uintptr_t)(TEGRA_PMC_BASE) #define MTS_FILE_NAME "mts" @@ -130,7 +130,6 @@ static void enable_cpu_power_partitions(void) power_ungate_partition(POWER_PARTID_CE1); } - static void request_ram_repair(void) { struct flow_ctlr * const flow = (void *)(uintptr_t)TEGRA_FLOW_BASE; @@ -164,73 +163,22 @@ void ccplex_cpu_prepare(void) request_ram_repair(); } -static void start_cpu0(void) +static void start_common_clocks(void) { struct clk_rst_ctlr * const clk_rst = CLK_RST_REGS; /* Clear fast CPU partition reset. */ write32(CRC_RST_CPUG_CLR_NONCPU, &clk_rst->rst_cpug_cmplx_clr); - /* Clear reset of CPU0 components. */ - write32(CRC_RST_CPUG_CLR_CPU0 | - CRC_RST_CPUG_CLR_DBG0 | - CRC_RST_CPUG_CLR_CORE0 | - CRC_RST_CPUG_CLR_CX0 | - CRC_RST_CPUG_CLR_L2 | - CRC_RST_CPUG_CLR_PDBG, &clk_rst->rst_cpug_cmplx_clr); -} - -/* - * The Denver cores come up in aarch32 mode. In order to transition to - * 64-bit mode a write to the RMR (reset mangement register) with the - * AA64 bit (0) set while setting RR (reset request bit 1). - */ -static const uint32_t aarch32to64[] = { - 0xe3a00003, /* mov r0, #3 */ - 0xee0c0f50, /* mcr 15, 0, r0, cr12, cr0, {2} */ -}; - -static void load_aarch64_trampoline(void *addr) -{ - const size_t trampoline_size = sizeof(aarch32to64); - const void * const trampoline = &aarch32to64[0]; - - /* Copy trampoline into ram. */ - memcpy(addr, trampoline, trampoline_size); + /* Clear reset of L2 and CoreSight components. */ + write32(CRC_RST_CPUG_CLR_L2 | CRC_RST_CPUG_CLR_PDBG, + &clk_rst->rst_cpug_cmplx_clr); } void ccplex_cpu_start(void *entry_addr) { - struct tegra_pmc_regs * const pmc = PMC_REGS; - void * const evp_cpu_reset_vector = EVP_CPU_RESET_VECTOR; - void *trampoline; - uint32_t entry_point; - - /* - * Just place the trampoline at the MTS_LOAD_ADDRESS. This assumes - * the program to run doesn't overlap this address. - */ - const uint32_t trampoline_addr = MTS_LOAD_ADDRESS; - trampoline = (void *)(uintptr_t)trampoline_addr; - - /* The arm entry points have bit 0 set if thumb code. Mask that off. */ - entry_point = (uint32_t)(uintptr_t)entry_addr; - - load_aarch64_trampoline(trampoline); - - /* Warm reset vector is pulled from the PMC scratch registers. */ - write32(entry_point, &pmc->secure_scratch34); - write32(0, &pmc->secure_scratch35); - - printk(BIOS_DEBUG, "Starting CPU0 @ %p trampolining to %08x.\n", - trampoline, entry_point); - - /* - * The Denver cores start in 32-bit mode. Therefore a trampoline - * is needed to get into 64-bit mode. Point the cold reset vector - * to the trampoline location. - */ - write32(trampoline_addr, evp_cpu_reset_vector); + /* Enable common clocks for the shared resources between the cores. */ + start_common_clocks(); - start_cpu0(); + start_cpu(0, entry_addr); } |