hotplug.c 1.8 KB

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