hotplug.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (C) 2002 ARM Ltd.
  3. * All Rights Reserved
  4. * Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/smp.h>
  12. #include <linux/clk/tegra.h>
  13. #include <asm/smp_plat.h>
  14. #include "fuse.h"
  15. #include "sleep.h"
  16. static void (*tegra_hotplug_shutdown)(void);
  17. int tegra_cpu_kill(unsigned cpu)
  18. {
  19. cpu = cpu_logical_map(cpu);
  20. /* Clock gate the CPU */
  21. tegra_wait_cpu_in_reset(cpu);
  22. tegra_disable_cpu_clock(cpu);
  23. return 1;
  24. }
  25. /*
  26. * platform-specific code to shutdown a CPU
  27. *
  28. * Called with IRQs disabled
  29. */
  30. void __ref tegra_cpu_die(unsigned int cpu)
  31. {
  32. /* Clean L1 data cache */
  33. tegra_disable_clean_inv_dcache();
  34. /* Shut down the current CPU. */
  35. tegra_hotplug_shutdown();
  36. /* Should never return here. */
  37. BUG();
  38. }
  39. void __init tegra_hotplug_init(void)
  40. {
  41. if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
  42. return;
  43. if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20)
  44. tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
  45. if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30)
  46. tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
  47. }