hotplug.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. *
  3. * Copyright (C) 2002 ARM Ltd.
  4. * All Rights Reserved
  5. * Copyright (c) 2010, 2012 NVIDIA Corporation. All rights reserved.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/smp.h>
  13. #include <asm/cacheflush.h>
  14. #include <asm/smp_plat.h>
  15. #include "sleep.h"
  16. #include "tegra_cpu_car.h"
  17. static void (*tegra_hotplug_shutdown)(void);
  18. int platform_cpu_kill(unsigned int cpu)
  19. {
  20. return 1;
  21. }
  22. /*
  23. * platform-specific code to shutdown a CPU
  24. *
  25. * Called with IRQs disabled
  26. */
  27. void platform_cpu_die(unsigned int cpu)
  28. {
  29. cpu = cpu_logical_map(cpu);
  30. /* Flush the L1 data cache. */
  31. flush_cache_all();
  32. /* Shut down the current CPU. */
  33. tegra_hotplug_shutdown();
  34. /* Clock gate the CPU */
  35. tegra_wait_cpu_in_reset(cpu);
  36. tegra_disable_cpu_clock(cpu);
  37. /* Should never return here. */
  38. BUG();
  39. }
  40. int platform_cpu_disable(unsigned int cpu)
  41. {
  42. /*
  43. * we don't allow CPU 0 to be shutdown (it is still too special
  44. * e.g. clock tick interrupts)
  45. */
  46. return cpu == 0 ? -EPERM : 0;
  47. }
  48. #ifdef CONFIG_ARCH_TEGRA_3x_SOC
  49. extern void tegra30_hotplug_shutdown(void);
  50. void __init tegra30_hotplug_init(void)
  51. {
  52. tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
  53. }
  54. #endif