omap-hotplug.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 <mach/omap4-common.h>
  21. int platform_cpu_kill(unsigned int cpu)
  22. {
  23. return 1;
  24. }
  25. /*
  26. * platform-specific code to shutdown a CPU
  27. * Called with IRQs disabled
  28. */
  29. void platform_cpu_die(unsigned int cpu)
  30. {
  31. flush_cache_all();
  32. dsb();
  33. /*
  34. * we're ready for shutdown now, so do it
  35. */
  36. if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
  37. printk(KERN_CRIT "Secure clear status failed\n");
  38. for (;;) {
  39. /*
  40. * Execute WFI
  41. */
  42. do_wfi();
  43. if (omap_read_auxcoreboot0() == cpu) {
  44. /*
  45. * OK, proper wakeup, we're done
  46. */
  47. break;
  48. }
  49. pr_debug("CPU%u: spurious wakeup call\n", cpu);
  50. }
  51. }
  52. int platform_cpu_disable(unsigned int cpu)
  53. {
  54. /*
  55. * we don't allow CPU 0 to be shutdown (it is still too special
  56. * e.g. clock tick interrupts)
  57. */
  58. return cpu == 0 ? -EPERM : 0;
  59. }