Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  Copyright (C) 2002 ARM Ltd.
0004  *  All Rights Reserved
0005  *  Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved.
0006  */
0007 
0008 #include <linux/clk/tegra.h>
0009 #include <linux/kernel.h>
0010 #include <linux/smp.h>
0011 
0012 #include <soc/tegra/common.h>
0013 #include <soc/tegra/fuse.h>
0014 
0015 #include <asm/smp_plat.h>
0016 
0017 #include "common.h"
0018 #include "sleep.h"
0019 
0020 static void (*tegra_hotplug_shutdown)(void);
0021 
0022 int tegra_cpu_kill(unsigned cpu)
0023 {
0024     cpu = cpu_logical_map(cpu);
0025 
0026     /* Clock gate the CPU */
0027     tegra_wait_cpu_in_reset(cpu);
0028     tegra_disable_cpu_clock(cpu);
0029 
0030     return 1;
0031 }
0032 
0033 /*
0034  * platform-specific code to shutdown a CPU
0035  *
0036  * Called with IRQs disabled
0037  */
0038 void tegra_cpu_die(unsigned int cpu)
0039 {
0040     if (!tegra_hotplug_shutdown) {
0041         WARN(1, "hotplug is not yet initialized\n");
0042         return;
0043     }
0044 
0045     /* Clean L1 data cache */
0046     tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
0047 
0048     /* Shut down the current CPU. */
0049     tegra_hotplug_shutdown();
0050 
0051     /* Should never return here. */
0052     BUG();
0053 }
0054 
0055 static int __init tegra_hotplug_init(void)
0056 {
0057     if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
0058         return 0;
0059 
0060     if (!soc_is_tegra())
0061         return 0;
0062 
0063     if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20)
0064         tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
0065     if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30)
0066         tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
0067     if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114)
0068         tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
0069     if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124)
0070         tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
0071 
0072     return 0;
0073 }
0074 pure_initcall(tegra_hotplug_init);