omap-hotplug.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * OMAP4 SMP cpu-hotplug support
  4. *
  5. * Copyright (C) 2010 Texas Instruments, Inc.
  6. * Author:
  7. * Santosh Shilimkar <[email protected]>
  8. *
  9. * Platform file needed for the OMAP4 SMP. This file is based on arm
  10. * realview smp platform.
  11. * Copyright (c) 2002 ARM Limited.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/errno.h>
  15. #include <linux/smp.h>
  16. #include <linux/io.h>
  17. #include "omap-wakeupgen.h"
  18. #include "common.h"
  19. #include "powerdomain.h"
  20. /*
  21. * platform-specific code to shutdown a CPU
  22. * Called with IRQs disabled
  23. */
  24. void omap4_cpu_die(unsigned int cpu)
  25. {
  26. unsigned int boot_cpu = 0;
  27. void __iomem *base = omap_get_wakeupgen_base();
  28. /*
  29. * we're ready for shutdown now, so do it
  30. */
  31. if (omap_secure_apis_support()) {
  32. if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
  33. pr_err("Secure clear status failed\n");
  34. } else {
  35. writel_relaxed(0, base + OMAP_AUX_CORE_BOOT_0);
  36. }
  37. for (;;) {
  38. /*
  39. * Enter into low power state
  40. */
  41. omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF);
  42. if (omap_secure_apis_support())
  43. boot_cpu = omap_read_auxcoreboot0() >> 9;
  44. else
  45. boot_cpu =
  46. readl_relaxed(base + OMAP_AUX_CORE_BOOT_0) >> 5;
  47. if (boot_cpu == smp_processor_id()) {
  48. /*
  49. * OK, proper wakeup, we're done
  50. */
  51. break;
  52. }
  53. pr_debug("CPU%u: spurious wakeup call\n", cpu);
  54. }
  55. }
  56. /* Needed by kexec and platform_can_cpu_hotplug() */
  57. int omap4_cpu_kill(unsigned int cpu)
  58. {
  59. return 1;
  60. }