M7350/kernel/arch/arm/mach-vexpress/platsmp.c

117 lines
3.0 KiB
C
Raw Normal View History

2024-09-09 08:52:07 +00:00
/*
* linux/arch/arm/mach-vexpress/platsmp.c
*
* 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/smp.h>
#include <linux/io.h>
2024-09-09 08:57:42 +00:00
#include <linux/of_address.h>
#include <linux/vexpress.h>
2024-09-09 08:52:07 +00:00
2024-09-09 08:57:42 +00:00
#include <asm/mcpm.h>
2024-09-09 08:52:07 +00:00
#include <asm/smp_scu.h>
#include <asm/mach/map.h>
#include <mach/motherboard.h>
2024-09-09 08:57:42 +00:00
#include <plat/platsmp.h>
2024-09-09 08:52:07 +00:00
2024-09-09 08:57:42 +00:00
#include "core.h"
2024-09-09 08:52:07 +00:00
2024-09-09 08:57:42 +00:00
/*
* Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
*/
static void __init vexpress_smp_init_cpus(void)
2024-09-09 08:52:07 +00:00
{
2024-09-09 08:57:42 +00:00
ct_desc->init_cpu_map();
2024-09-09 08:52:07 +00:00
}
2024-09-09 08:57:42 +00:00
static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus)
2024-09-09 08:52:07 +00:00
{
2024-09-09 08:57:42 +00:00
/*
* Initialise the present map, which describes the set of CPUs
* actually populated at the present time.
*/
ct_desc->smp_enable(max_cpus);
2024-09-09 08:52:07 +00:00
2024-09-09 08:57:42 +00:00
/*
* Write the address of secondary startup into the
* system-wide flags register. The boot monitor waits
* until it receives a soft interrupt, and then the
* secondary CPU branches to this address.
*/
vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
2024-09-09 08:52:07 +00:00
}
2024-09-09 08:57:42 +00:00
struct smp_operations __initdata vexpress_smp_ops = {
.smp_init_cpus = vexpress_smp_init_cpus,
.smp_prepare_cpus = vexpress_smp_prepare_cpus,
.smp_secondary_init = versatile_secondary_init,
.smp_boot_secondary = versatile_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_die = vexpress_cpu_die,
#endif
};
2024-09-09 08:52:07 +00:00
2024-09-09 08:57:42 +00:00
bool __init vexpress_smp_init_ops(void)
2024-09-09 08:52:07 +00:00
{
2024-09-09 08:57:42 +00:00
#ifdef CONFIG_MCPM
/*
* The best way to detect a multi-cluster configuration at the moment
* is to look for the presence of a CCI in the system.
* Override the default vexpress_smp_ops if so.
*/
struct device_node *node;
node = of_find_compatible_node(NULL, NULL, "arm,cci-400");
if (node && of_device_is_available(node)) {
mcpm_smp_set_ops();
return true;
2024-09-09 08:52:07 +00:00
}
2024-09-09 08:57:42 +00:00
#endif
return false;
2024-09-09 08:52:07 +00:00
}
2024-09-09 08:57:42 +00:00
#if defined(CONFIG_OF)
2024-09-09 08:52:07 +00:00
2024-09-09 08:57:42 +00:00
static const struct of_device_id vexpress_smp_dt_scu_match[] __initconst = {
{ .compatible = "arm,cortex-a5-scu", },
{ .compatible = "arm,cortex-a9-scu", },
{}
};
2024-09-09 08:52:07 +00:00
2024-09-09 08:57:42 +00:00
static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
2024-09-09 08:52:07 +00:00
{
2024-09-09 08:57:42 +00:00
struct device_node *scu = of_find_matching_node(NULL,
vexpress_smp_dt_scu_match);
2024-09-09 08:52:07 +00:00
2024-09-09 08:57:42 +00:00
if (scu)
scu_enable(of_iomap(scu, 0));
2024-09-09 08:52:07 +00:00
/*
* Write the address of secondary startup into the
* system-wide flags register. The boot monitor waits
* until it receives a soft interrupt, and then the
* secondary CPU branches to this address.
*/
2024-09-09 08:57:42 +00:00
vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
2024-09-09 08:52:07 +00:00
}
2024-09-09 08:57:42 +00:00
struct smp_operations __initdata vexpress_smp_dt_ops = {
.smp_prepare_cpus = vexpress_smp_dt_prepare_cpus,
.smp_secondary_init = versatile_secondary_init,
.smp_boot_secondary = versatile_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_die = vexpress_cpu_die,
#endif
};
#endif