2010-02-22 01:46:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2002 ARM Ltd.
|
|
|
|
* All Rights Reserved
|
2013-02-13 17:15:48 +00:00
|
|
|
* Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved.
|
2010-02-22 01:46:23 +00: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.
|
|
|
|
*/
|
2014-07-11 07:44:49 +00:00
|
|
|
|
|
|
|
#include <linux/clk/tegra.h>
|
2010-02-22 01:46:23 +00:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
|
2014-07-11 09:00:37 +00:00
|
|
|
#include <soc/tegra/common.h>
|
2014-07-11 07:52:41 +00:00
|
|
|
#include <soc/tegra/fuse.h>
|
|
|
|
|
2012-08-16 09:31:51 +00:00
|
|
|
#include <asm/smp_plat.h>
|
2010-02-22 01:46:23 +00:00
|
|
|
|
2016-04-28 12:50:14 +00:00
|
|
|
#include "common.h"
|
2012-08-16 09:31:51 +00:00
|
|
|
#include "sleep.h"
|
2010-02-22 01:46:23 +00:00
|
|
|
|
2012-08-16 09:31:51 +00:00
|
|
|
static void (*tegra_hotplug_shutdown)(void);
|
2010-02-22 01:46:23 +00:00
|
|
|
|
2013-01-03 06:43:00 +00: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 01:46:23 +00:00
|
|
|
/*
|
|
|
|
* platform-specific code to shutdown a CPU
|
|
|
|
*
|
|
|
|
* Called with IRQs disabled
|
|
|
|
*/
|
2015-10-19 20:05:33 +00:00
|
|
|
void tegra_cpu_die(unsigned int cpu)
|
2010-02-22 01:46:23 +00:00
|
|
|
{
|
2014-07-11 09:00:37 +00:00
|
|
|
if (!tegra_hotplug_shutdown) {
|
|
|
|
WARN(1, "hotplug is not yet initialized\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-03 06:42:59 +00:00
|
|
|
/* Clean L1 data cache */
|
2013-07-03 09:50:38 +00:00
|
|
|
tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
|
2010-02-22 01:46:23 +00:00
|
|
|
|
2012-08-16 09:31:51 +00:00
|
|
|
/* Shut down the current CPU. */
|
|
|
|
tegra_hotplug_shutdown();
|
|
|
|
|
|
|
|
/* Should never return here. */
|
|
|
|
BUG();
|
2010-02-22 01:46:23 +00:00
|
|
|
}
|
|
|
|
|
2014-07-11 09:00:37 +00:00
|
|
|
static int __init tegra_hotplug_init(void)
|
2012-08-16 09:31:52 +00:00
|
|
|
{
|
2013-02-13 17:15:48 +00:00
|
|
|
if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
|
2014-07-11 09:00:37 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (!soc_is_tegra())
|
|
|
|
return 0;
|
2012-08-16 09:31:52 +00:00
|
|
|
|
2014-07-11 07:52:41 +00:00
|
|
|
if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20)
|
2013-02-13 17:15:48 +00:00
|
|
|
tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
|
2014-07-11 07:52:41 +00:00
|
|
|
if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30)
|
2013-02-13 17:15:48 +00:00
|
|
|
tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
|
2014-07-11 07:52:41 +00:00
|
|
|
if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114)
|
2013-05-20 10:39:29 +00:00
|
|
|
tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
|
2014-07-11 07:52:41 +00:00
|
|
|
if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124)
|
2013-10-11 09:57:30 +00:00
|
|
|
tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
|
2014-07-11 09:00:37 +00:00
|
|
|
|
|
|
|
return 0;
|
2012-08-16 09:31:51 +00:00
|
|
|
}
|
2014-07-11 09:00:37 +00:00
|
|
|
pure_initcall(tegra_hotplug_init);
|