hotplug.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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/clk/tegra.h>
  11. #include <linux/kernel.h>
  12. #include <linux/smp.h>
  13. #include <soc/tegra/common.h>
  14. #include <soc/tegra/fuse.h>
  15. #include <asm/smp_plat.h>
  16. #include "sleep.h"
  17. static void (*tegra_hotplug_shutdown)(void);
  18. int tegra_cpu_kill(unsigned cpu)
  19. {
  20. cpu = cpu_logical_map(cpu);
  21. /* Clock gate the CPU */
  22. tegra_wait_cpu_in_reset(cpu);
  23. tegra_disable_cpu_clock(cpu);
  24. return 1;
  25. }
  26. /*
  27. * platform-specific code to shutdown a CPU
  28. *
  29. * Called with IRQs disabled
  30. */
  31. void tegra_cpu_die(unsigned int cpu)
  32. {
  33. if (!tegra_hotplug_shutdown) {
  34. WARN(1, "hotplug is not yet initialized\n");
  35. return;
  36. }
  37. /* Clean L1 data cache */
  38. tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
  39. /* Shut down the current CPU. */
  40. tegra_hotplug_shutdown();
  41. /* Should never return here. */
  42. BUG();
  43. }
  44. static int __init tegra_hotplug_init(void)
  45. {
  46. if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
  47. return 0;
  48. if (!soc_is_tegra())
  49. return 0;
  50. if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20)
  51. tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
  52. if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30)
  53. tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
  54. if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114)
  55. tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
  56. if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124)
  57. tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
  58. return 0;
  59. }
  60. pure_initcall(tegra_hotplug_init);