hotplug.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (C) 2002 ARM Ltd.
  4. * All Rights Reserved
  5. * Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved.
  6. */
  7. #include <linux/clk/tegra.h>
  8. #include <linux/kernel.h>
  9. #include <linux/smp.h>
  10. #include <soc/tegra/common.h>
  11. #include <soc/tegra/fuse.h>
  12. #include <asm/smp_plat.h>
  13. #include "common.h"
  14. #include "sleep.h"
  15. static void (*tegra_hotplug_shutdown)(void);
  16. int tegra_cpu_kill(unsigned cpu)
  17. {
  18. cpu = cpu_logical_map(cpu);
  19. /* Clock gate the CPU */
  20. tegra_wait_cpu_in_reset(cpu);
  21. tegra_disable_cpu_clock(cpu);
  22. return 1;
  23. }
  24. /*
  25. * platform-specific code to shutdown a CPU
  26. *
  27. * Called with IRQs disabled
  28. */
  29. void tegra_cpu_die(unsigned int cpu)
  30. {
  31. if (!tegra_hotplug_shutdown) {
  32. WARN(1, "hotplug is not yet initialized\n");
  33. return;
  34. }
  35. /* Clean L1 data cache */
  36. tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
  37. /* Shut down the current CPU. */
  38. tegra_hotplug_shutdown();
  39. /* Should never return here. */
  40. BUG();
  41. }
  42. static int __init tegra_hotplug_init(void)
  43. {
  44. if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
  45. return 0;
  46. if (!soc_is_tegra())
  47. return 0;
  48. if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20)
  49. tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
  50. if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30)
  51. tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
  52. if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114)
  53. tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
  54. if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124)
  55. tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
  56. return 0;
  57. }
  58. pure_initcall(tegra_hotplug_init);