omap-hotplug.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 <mach/omap-wakeupgen.h>
  22. #include "common.h"
  23. #include "powerdomain.h"
  24. int platform_cpu_kill(unsigned int cpu)
  25. {
  26. return 1;
  27. }
  28. /*
  29. * platform-specific code to shutdown a CPU
  30. * Called with IRQs disabled
  31. */
  32. void __ref platform_cpu_die(unsigned int cpu)
  33. {
  34. unsigned int boot_cpu = 0;
  35. void __iomem *base = omap_get_wakeupgen_base();
  36. flush_cache_all();
  37. dsb();
  38. /*
  39. * we're ready for shutdown now, so do it
  40. */
  41. if (omap_secure_apis_support()) {
  42. if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
  43. pr_err("Secure clear status failed\n");
  44. } else {
  45. __raw_writel(0, base + OMAP_AUX_CORE_BOOT_0);
  46. }
  47. for (;;) {
  48. /*
  49. * Enter into low power state
  50. */
  51. omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF);
  52. if (omap_secure_apis_support())
  53. boot_cpu = omap_read_auxcoreboot0();
  54. else
  55. boot_cpu =
  56. __raw_readl(base + OMAP_AUX_CORE_BOOT_0) >> 5;
  57. if (boot_cpu == smp_processor_id()) {
  58. /*
  59. * OK, proper wakeup, we're done
  60. */
  61. break;
  62. }
  63. pr_debug("CPU%u: spurious wakeup call\n", cpu);
  64. }
  65. }
  66. int platform_cpu_disable(unsigned int cpu)
  67. {
  68. /*
  69. * we don't allow CPU 0 to be shutdown (it is still too special
  70. * e.g. clock tick interrupts)
  71. */
  72. return cpu == 0 ? -EPERM : 0;
  73. }