omap-hotplug.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * OMAP4 SMP cpu-hotplug support
  3. *
  4. * Copyright (C) 2010 Texas Instruments, Inc.
  5. * Author:
  6. * Santosh Shilimkar <santosh.shilimkar@ti.com>
  7. *
  8. * Platform file needed for the OMAP4 SMP. This file is based on arm
  9. * realview smp platform.
  10. * Copyright (c) 2002 ARM Limited.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/errno.h>
  18. #include <linux/smp.h>
  19. #include <asm/cacheflush.h>
  20. #include "common.h"
  21. #include "powerdomain.h"
  22. int platform_cpu_kill(unsigned int cpu)
  23. {
  24. return 1;
  25. }
  26. /*
  27. * platform-specific code to shutdown a CPU
  28. * Called with IRQs disabled
  29. */
  30. void __ref platform_cpu_die(unsigned int cpu)
  31. {
  32. unsigned int this_cpu;
  33. flush_cache_all();
  34. dsb();
  35. /*
  36. * we're ready for shutdown now, so do it
  37. */
  38. if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
  39. pr_err("Secure clear status failed\n");
  40. for (;;) {
  41. /*
  42. * Enter into low power state
  43. */
  44. omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF);
  45. this_cpu = smp_processor_id();
  46. if (omap_read_auxcoreboot0() == this_cpu) {
  47. /*
  48. * OK, proper wakeup, we're done
  49. */
  50. break;
  51. }
  52. pr_debug("CPU%u: spurious wakeup call\n", cpu);
  53. }
  54. }
  55. int platform_cpu_disable(unsigned int cpu)
  56. {
  57. /*
  58. * we don't allow CPU 0 to be shutdown (it is still too special
  59. * e.g. clock tick interrupts)
  60. */
  61. return cpu == 0 ? -EPERM : 0;
  62. }