blob: 54f1844eac031bd165484daec502040fee2a992a [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Dinh Nguyen9c4566a2012-10-25 10:41:39 -06002/*
3 * Copyright (c) 2003 ARM Limited
4 * Copyright (c) u-boot contributors
5 * Copyright (c) 2012 Pavel Machek <pavel@denx.de>
Dinh Nguyen9c4566a2012-10-25 10:41:39 -06006 */
7#include <linux/linkage.h>
8#include <linux/init.h>
Dinh Nguyen3a4356c2014-10-01 05:44:48 -05009#include <asm/memory.h>
Ben Dooksbf55e0a2015-03-25 11:27:47 +000010#include <asm/assembler.h>
Dinh Nguyen9c4566a2012-10-25 10:41:39 -060011
Pavel Machekad208d02012-10-27 01:00:53 +020012 .arch armv7-a
Sascha Hauer5616f362016-04-20 13:34:31 +000013 .arm
Dinh Nguyen9c4566a2012-10-25 10:41:39 -060014
Dinh Nguyen9c4566a2012-10-25 10:41:39 -060015ENTRY(secondary_trampoline)
Dinh Nguyen3a4356c2014-10-01 05:44:48 -050016 /* CPU1 will always fetch from 0x0 when it is brought out of reset.
17 * Thus, we can just subtract the PAGE_OFFSET to get the physical
18 * address of &cpu1start_addr. This would not work for platforms
19 * where the physical memory does not start at 0x0.
Ben Dooksbf55e0a2015-03-25 11:27:47 +000020 */
21ARM_BE8(setend be)
Dinh Nguyen3a4356c2014-10-01 05:44:48 -050022 adr r0, 1f
23 ldmia r0, {r1, r2}
24 sub r2, r2, #PAGE_OFFSET
25 ldr r3, [r2]
26 ldr r4, [r3]
Ben Dooksbf55e0a2015-03-25 11:27:47 +000027ARM_BE8(rev r4, r4)
Dinh Nguyen3a4356c2014-10-01 05:44:48 -050028 bx r4
Dinh Nguyen9c4566a2012-10-25 10:41:39 -060029
Dinh Nguyen3a4356c2014-10-01 05:44:48 -050030 .align
311: .long .
32 .long socfpga_cpu1start_addr
Dinh Nguyen9c4566a2012-10-25 10:41:39 -060033ENTRY(secondary_trampoline_end)