2010-02-22 02:46:23 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 ARM Ltd.
|
|
|
|
* All Rights Reserved
|
2012-08-16 11:31:51 +02:00
|
|
|
* Copyright (c) 2010, 2012 NVIDIA Corporation. All rights reserved.
|
2010-02-22 02:46:23 +01:00
|
|
|
*
|
|
|
|
* 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/kernel.h>
|
|
|
|
#include <linux/smp.h>
|
2013-01-11 08:46:21 +01:00
|
|
|
#include <linux/clk/tegra.h>
|
2010-02-22 02:46:23 +01:00
|
|
|
|
|
|
|
#include <asm/cacheflush.h>
|
2012-08-16 11:31:51 +02:00
|
|
|
#include <asm/smp_plat.h>
|
2010-02-22 02:46:23 +01:00
|
|
|
|
2012-08-16 11:31:51 +02:00
|
|
|
#include "sleep.h"
|
2010-02-22 02:46:23 +01:00
|
|
|
|
2012-08-16 11:31:51 +02:00
|
|
|
static void (*tegra_hotplug_shutdown)(void);
|
2010-02-22 02:46:23 +01:00
|
|
|
|
2013-01-03 07:43:00 +01:00
|
|
|
int tegra_cpu_kill(unsigned cpu)
|
|
|
|
{
|
|
|
|
cpu = cpu_logical_map(cpu);
|
|
|
|
|
|
|
|
/* Clock gate the CPU */
|
|
|
|
tegra_wait_cpu_in_reset(cpu);
|
|
|
|
tegra_disable_cpu_clock(cpu);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-02-22 02:46:23 +01:00
|
|
|
/*
|
|
|
|
* platform-specific code to shutdown a CPU
|
|
|
|
*
|
|
|
|
* Called with IRQs disabled
|
|
|
|
*/
|
2011-09-08 14:15:22 +02:00
|
|
|
void __ref tegra_cpu_die(unsigned int cpu)
|
2010-02-22 02:46:23 +01:00
|
|
|
{
|
2013-01-03 07:42:59 +01:00
|
|
|
/* Clean L1 data cache */
|
|
|
|
tegra_disable_clean_inv_dcache();
|
2010-02-22 02:46:23 +01:00
|
|
|
|
2012-08-16 11:31:51 +02:00
|
|
|
/* Shut down the current CPU. */
|
|
|
|
tegra_hotplug_shutdown();
|
|
|
|
|
|
|
|
/* Should never return here. */
|
|
|
|
BUG();
|
2010-02-22 02:46:23 +01:00
|
|
|
}
|
|
|
|
|
2012-09-22 09:06:21 +02:00
|
|
|
int tegra_cpu_disable(unsigned int cpu)
|
2010-02-22 02:46:23 +01:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* we don't allow CPU 0 to be shutdown (it is still too special
|
|
|
|
* e.g. clock tick interrupts)
|
|
|
|
*/
|
|
|
|
return cpu == 0 ? -EPERM : 0;
|
|
|
|
}
|
2012-08-16 11:31:51 +02:00
|
|
|
|
2012-08-16 11:31:52 +02:00
|
|
|
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
|
|
|
|
extern void tegra20_hotplug_shutdown(void);
|
|
|
|
void __init tegra20_hotplug_init(void)
|
|
|
|
{
|
|
|
|
tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-08-16 11:31:51 +02:00
|
|
|
#ifdef CONFIG_ARCH_TEGRA_3x_SOC
|
|
|
|
extern void tegra30_hotplug_shutdown(void);
|
|
|
|
void __init tegra30_hotplug_init(void)
|
|
|
|
{
|
|
|
|
tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
|
|
|
|
}
|
|
|
|
#endif
|