2010-12-14 08:56:55 +01:00
|
|
|
/*
|
|
|
|
* SMP support for R-Mobile / SH-Mobile
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Magnus Damm
|
2011-01-07 04:03:22 +01:00
|
|
|
* Copyright (C) 2011 Paul Mundt
|
2010-12-14 08:56:55 +01:00
|
|
|
*
|
|
|
|
* Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
#include <linux/io.h>
|
2011-04-03 14:01:30 +02:00
|
|
|
#include <asm/hardware/gic.h>
|
2010-12-14 08:56:55 +01:00
|
|
|
#include <asm/localtimer.h>
|
2010-12-14 08:57:11 +01:00
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <mach/common.h>
|
2010-12-14 08:56:55 +01:00
|
|
|
|
|
|
|
static unsigned int __init shmobile_smp_get_core_count(void)
|
|
|
|
{
|
2010-12-14 08:57:11 +01:00
|
|
|
if (machine_is_ag5evm())
|
|
|
|
return sh73a0_get_core_count();
|
|
|
|
|
2010-12-14 08:56:55 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __init shmobile_smp_prepare_cpus(void)
|
|
|
|
{
|
2010-12-14 08:57:11 +01:00
|
|
|
if (machine_is_ag5evm())
|
|
|
|
sh73a0_smp_prepare_cpus();
|
2010-12-14 08:56:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void __cpuinit platform_secondary_init(unsigned int cpu)
|
|
|
|
{
|
|
|
|
trace_hardirqs_off();
|
2010-12-14 08:57:11 +01:00
|
|
|
|
|
|
|
if (machine_is_ag5evm())
|
|
|
|
sh73a0_secondary_init(cpu);
|
2010-12-14 08:56:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
|
|
|
|
{
|
2010-12-14 08:57:11 +01:00
|
|
|
if (machine_is_ag5evm())
|
|
|
|
return sh73a0_boot_secondary(cpu);
|
|
|
|
|
2010-12-14 08:56:55 +01:00
|
|
|
return -ENOSYS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void __init smp_init_cpus(void)
|
|
|
|
{
|
|
|
|
unsigned int ncores = shmobile_smp_get_core_count();
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ncores; i++)
|
|
|
|
set_cpu_possible(i, true);
|
2011-04-03 14:01:30 +02:00
|
|
|
|
|
|
|
set_smp_cross_call(gic_raise_softirq);
|
2010-12-14 08:56:55 +01:00
|
|
|
}
|
|
|
|
|
2011-01-07 04:03:22 +01:00
|
|
|
void __init platform_smp_prepare_cpus(unsigned int max_cpus)
|
2010-12-14 08:56:55 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < max_cpus; i++)
|
|
|
|
set_cpu_present(i, true);
|
|
|
|
|
2011-01-07 04:03:22 +01:00
|
|
|
shmobile_smp_prepare_cpus();
|
2010-12-14 08:56:55 +01:00
|
|
|
}
|