blob: 2940fc97da370a92c44c9aa13cb3c547c16112da [file] [log] [blame]
Magnus Damm1c51ed42010-12-14 16:56:55 +09001/*
2 * SMP support for R-Mobile / SH-Mobile
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2010 Takashi Yoshii
6 *
7 * Based on vexpress, Copyright (c) 2003 ARM Limited, All Rights Reserved
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/linkage.h>
14#include <linux/init.h>
Magnus Damm6155f772010-12-20 11:04:50 +000015#include <asm/memory.h>
Magnus Damm1c51ed42010-12-14 16:56:55 +090016
Magnus Dammf0eab382011-12-28 16:44:06 +090017 __CPUINIT
Magnus Damm1c51ed42010-12-14 16:56:55 +090018
Magnus Damme994d5e2012-05-09 16:24:59 +090019ENTRY(shmobile_invalidate_start)
20 bl v7_invalidate_l1
21 b secondary_startup
22ENDPROC(shmobile_invalidate_start)
23
Magnus Damm1c51ed42010-12-14 16:56:55 +090024/*
25 * Reset vector for secondary CPUs.
26 * This will be mapped at address 0 by SBAR register.
27 * We need _long_ jump to the physical address.
28 */
29 .align 12
Magnus Dammebe72ab2013-06-10 18:19:36 +090030ENTRY(shmobile_boot_vector)
31 ldr r0, 2f
Magnus Damm1c51ed42010-12-14 16:56:55 +090032 ldr pc, 1f
Magnus Dammebe72ab2013-06-10 18:19:36 +090033ENDPROC(shmobile_boot_vector)
34
35 .globl shmobile_boot_fn
36shmobile_boot_fn:
371: .space 4
38 .globl shmobile_boot_arg
39shmobile_boot_arg:
402: .space 4
Magnus Dammcc615912013-08-01 03:38:18 +090041
42/*
43 * Per-CPU SMP boot function/argument selection code based on MPIDR
44 */
45
46ENTRY(shmobile_smp_boot)
47 @ r0 = MPIDR_HWID_BITMASK
48 mrc p15, 0, r1, c0, c0, 5 @ r1 = MPIDR
49 and r0, r1, r0 @ r0 = cpu_logical_map() value
50 mov r1, #0 @ r1 = CPU index
51 adr r5, 1f @ array of per-cpu mpidr values
52 adr r6, 2f @ array of per-cpu functions
53 adr r7, 3f @ array of per-cpu arguments
54
55shmobile_smp_boot_find_mpidr:
56 ldr r8, [r5, r1, lsl #2]
57 cmp r8, r0
58 bne shmobile_smp_boot_next
59
60 ldr r9, [r6, r1, lsl #2]
61 cmp r9, #0
62 bne shmobile_smp_boot_found
63
64shmobile_smp_boot_next:
65 add r1, r1, #1
66 cmp r1, #CONFIG_NR_CPUS
67 blo shmobile_smp_boot_find_mpidr
68
69 b shmobile_smp_sleep
70
71shmobile_smp_boot_found:
72 ldr r0, [r7, r1, lsl #2]
73 mov pc, r9
74ENDPROC(shmobile_smp_boot)
75
76ENTRY(shmobile_smp_sleep)
77 wfi
78 b shmobile_smp_boot
79ENDPROC(shmobile_smp_sleep)
80
81 .globl shmobile_smp_mpidr
82shmobile_smp_mpidr:
831: .space CONFIG_NR_CPUS * 4
84 .globl shmobile_smp_fn
85shmobile_smp_fn:
862: .space CONFIG_NR_CPUS * 4
87 .globl shmobile_smp_arg
88shmobile_smp_arg:
893: .space CONFIG_NR_CPUS * 4