omap-hotplug.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 <linux/io.h>
  20. #include "omap-wakeupgen.h"
  21. #include "common.h"
  22. #include "powerdomain.h"
  23. /*
  24. * platform-specific code to shutdown a CPU
  25. * Called with IRQs disabled
  26. */
  27. void omap4_cpu_die(unsigned int cpu)
  28. {
  29. unsigned int boot_cpu = 0;
  30. void __iomem *base = omap_get_wakeupgen_base();
  31. /*
  32. * we're ready for shutdown now, so do it
  33. */
  34. if (omap_secure_apis_support()) {
  35. if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
  36. pr_err("Secure clear status failed\n");
  37. } else {
  38. writel_relaxed(0, base + OMAP_AUX_CORE_BOOT_0);
  39. }
  40. for (;;) {
  41. /*
  42. * Enter into low power state
  43. */
  44. omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF);
  45. if (omap_secure_apis_support())
  46. boot_cpu = omap_read_auxcoreboot0();
  47. else
  48. boot_cpu =
  49. readl_relaxed(base + OMAP_AUX_CORE_BOOT_0) >> 5;
  50. if (boot_cpu == smp_processor_id()) {
  51. /*
  52. * OK, proper wakeup, we're done
  53. */
  54. break;
  55. }
  56. pr_debug("CPU%u: spurious wakeup call\n", cpu);
  57. }
  58. }
  59. /* Needed by kexec and platform_can_cpu_hotplug() */
  60. int omap4_cpu_kill(unsigned int cpu)
  61. {
  62. return 1;
  63. }