hotplug.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) STMicroelectronics 2009
  3. * Copyright (C) ST-Ericsson SA 2010
  4. *
  5. * License Terms: GNU General Public License v2
  6. * Based on ARM realview platform
  7. *
  8. * Author: Sundar Iyer <sundar.iyer@stericsson.com>
  9. *
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/errno.h>
  13. #include <linux/smp.h>
  14. #include <asm/cacheflush.h>
  15. extern volatile int pen_release;
  16. static inline void platform_do_lowpower(unsigned int cpu)
  17. {
  18. flush_cache_all();
  19. /* we put the platform to just WFI */
  20. for (;;) {
  21. __asm__ __volatile__("dsb\n\t" "wfi\n\t"
  22. : : : "memory");
  23. if (pen_release == cpu) {
  24. /*
  25. * OK, proper wakeup, we're done
  26. */
  27. break;
  28. }
  29. }
  30. }
  31. int platform_cpu_kill(unsigned int cpu)
  32. {
  33. return 1;
  34. }
  35. /*
  36. * platform-specific code to shutdown a CPU
  37. *
  38. * Called with IRQs disabled
  39. */
  40. void platform_cpu_die(unsigned int cpu)
  41. {
  42. /* directly enter low power state, skipping secure registers */
  43. platform_do_lowpower(cpu);
  44. }
  45. int platform_cpu_disable(unsigned int cpu)
  46. {
  47. /*
  48. * we don't allow CPU 0 to be shutdown (it is still too special
  49. * e.g. clock tick interrupts)
  50. */
  51. return cpu == 0 ? -EPERM : 0;
  52. }