hotplug.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. /*
  19. * platform-specific code to shutdown a CPU
  20. *
  21. * Called with IRQs disabled
  22. */
  23. void __ref tegra_cpu_die(unsigned int cpu)
  24. {
  25. cpu = cpu_logical_map(cpu);
  26. /* Flush the L1 data cache. */
  27. flush_cache_all();
  28. /* Shut down the current CPU. */
  29. tegra_hotplug_shutdown();
  30. /* Clock gate the CPU */
  31. tegra_wait_cpu_in_reset(cpu);
  32. tegra_disable_cpu_clock(cpu);
  33. /* Should never return here. */
  34. BUG();
  35. }
  36. int tegra_cpu_disable(unsigned int cpu)
  37. {
  38. /*
  39. * we don't allow CPU 0 to be shutdown (it is still too special
  40. * e.g. clock tick interrupts)
  41. */
  42. return cpu == 0 ? -EPERM : 0;
  43. }
  44. #ifdef CONFIG_ARCH_TEGRA_2x_SOC
  45. extern void tegra20_hotplug_shutdown(void);
  46. void __init tegra20_hotplug_init(void)
  47. {
  48. tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
  49. }
  50. #endif
  51. #ifdef CONFIG_ARCH_TEGRA_3x_SOC
  52. extern void tegra30_hotplug_shutdown(void);
  53. void __init tegra30_hotplug_init(void)
  54. {
  55. tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
  56. }
  57. #endif