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