xref: /openbmc/linux/arch/arm/mach-imx/headsmp.S (revision b38269ec)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright 2011 Freescale Semiconductor, Inc.
4 * Copyright 2011 Linaro Ltd.
5 */
6
7#include <linux/linkage.h>
8#include <linux/init.h>
9#include <asm/assembler.h>
10
11diag_reg_offset:
12	.word	g_diag_reg - .
13
14	.macro	set_diag_reg
15	adr	r0, diag_reg_offset
16	ldr	r1, [r0]
17	add	r1, r1, r0		@ r1 = physical &g_diag_reg
18	ldr	r0, [r1]
19	mcr	p15, 0, r0, c15, c0, 1	@ write diagnostic register
20	.endm
21
22ENTRY(v7_secondary_startup)
23ARM_BE8(setend be)			@ go BE8 if entered LE
24	mrc	p15, 0, r0, c0, c0, 0
25	lsl	r0, r0, #16
26	lsr	r0, r0, #20
27	/* 0xc07 is cortex A7's ID */
28	mov	r1, #0xc00
29	orr	r1, #0x7
30	cmp	r0, r1
31	beq	secondary_startup
32
33	set_diag_reg
34	b	secondary_startup
35ENDPROC(v7_secondary_startup)
36