175a6faf6SThomas Gleixner// SPDX-License-Identifier: GPL-2.0-only
2f07cb6a0SSantosh Shilimkar/*
3f07cb6a0SSantosh Shilimkar * Keystone SOC SMP platform code
4f07cb6a0SSantosh Shilimkar *
5f07cb6a0SSantosh Shilimkar * Copyright 2013 Texas Instruments, Inc.
6f07cb6a0SSantosh Shilimkar *	Cyril Chemparathy <cyril@ti.com>
7f07cb6a0SSantosh Shilimkar *	Santosh Shilimkar <santosh.shillimkar@ti.com>
8f07cb6a0SSantosh Shilimkar *
9f07cb6a0SSantosh Shilimkar * Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
10f07cb6a0SSantosh Shilimkar */
11f07cb6a0SSantosh Shilimkar
12f07cb6a0SSantosh Shilimkar#include <linux/init.h>
13f07cb6a0SSantosh Shilimkar#include <linux/smp.h>
14f07cb6a0SSantosh Shilimkar#include <linux/io.h>
1565fddcfcSMike Rapoport#include <linux/pgtable.h>
16f07cb6a0SSantosh Shilimkar
17f07cb6a0SSantosh Shilimkar#include <asm/smp_plat.h>
185eb3da72SSantosh Shilimkar#include <asm/prom.h>
195eb3da72SSantosh Shilimkar#include <asm/tlbflush.h>
20f07cb6a0SSantosh Shilimkar
21f07cb6a0SSantosh Shilimkar#include "keystone.h"
22f07cb6a0SSantosh Shilimkar
238bd26e3aSPaul Gortmakerstatic int keystone_smp_boot_secondary(unsigned int cpu,
24f07cb6a0SSantosh Shilimkar						struct task_struct *idle)
25f07cb6a0SSantosh Shilimkar{
265eb3da72SSantosh Shilimkar	unsigned long start = virt_to_idmap(&secondary_startup);
27f07cb6a0SSantosh Shilimkar	int error;
28f07cb6a0SSantosh Shilimkar
29f07cb6a0SSantosh Shilimkar	pr_debug("keystone-smp: booting cpu %d, vector %08lx\n",
30f07cb6a0SSantosh Shilimkar		 cpu, start);
31f07cb6a0SSantosh Shilimkar
323aae7ab0SSantosh Shilimkar	error = keystone_cpu_smc(KEYSTONE_MON_CPU_UP_IDX, cpu, start);
333aae7ab0SSantosh Shilimkar	if (error)
343aae7ab0SSantosh Shilimkar		pr_err("CPU %d bringup failed with %d\n", cpu, error);
35f07cb6a0SSantosh Shilimkar
36f07cb6a0SSantosh Shilimkar	return error;
37f07cb6a0SSantosh Shilimkar}
38f07cb6a0SSantosh Shilimkar
3975305275SMasahiro Yamadaconst struct smp_operations keystone_smp_ops __initconst = {
40f07cb6a0SSantosh Shilimkar	.smp_boot_secondary	= keystone_smp_boot_secondary,
41f07cb6a0SSantosh Shilimkar};
42