hotplug.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) 2012-2013 Xilinx
  3. *
  4. * based on linux/arch/arm/mach-realview/hotplug.c
  5. *
  6. * Copyright (C) 2002 ARM Ltd.
  7. * All Rights Reserved
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/errno.h>
  15. #include <linux/smp.h>
  16. #include <asm/cacheflush.h>
  17. #include <asm/cp15.h>
  18. #include "common.h"
  19. static inline void zynq_cpu_enter_lowpower(void)
  20. {
  21. unsigned int v;
  22. flush_cache_all();
  23. asm volatile(
  24. " mcr p15, 0, %1, c7, c5, 0\n"
  25. " dsb\n"
  26. /*
  27. * Turn off coherency
  28. */
  29. " mrc p15, 0, %0, c1, c0, 1\n"
  30. " bic %0, %0, #0x40\n"
  31. " mcr p15, 0, %0, c1, c0, 1\n"
  32. " mrc p15, 0, %0, c1, c0, 0\n"
  33. " bic %0, %0, %2\n"
  34. " mcr p15, 0, %0, c1, c0, 0\n"
  35. : "=&r" (v)
  36. : "r" (0), "Ir" (CR_C)
  37. : "cc");
  38. }
  39. /*
  40. * platform-specific code to shutdown a CPU
  41. *
  42. * Called with IRQs disabled
  43. */
  44. void zynq_platform_cpu_die(unsigned int cpu)
  45. {
  46. zynq_cpu_enter_lowpower();
  47. /*
  48. * there is no power-control hardware on this platform, so all
  49. * we can do is put the core into WFI; this is safe as the calling
  50. * code will have already disabled interrupts
  51. */
  52. for (;;)
  53. cpu_do_idle();
  54. }