idle.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* arch/arm/mach-msm/idle.c
  2. *
  3. * Idle processing for MSM7K - work around bugs with SWFI.
  4. *
  5. * Copyright (c) 2007 QUALCOMM Incorporated.
  6. * Copyright (C) 2007 Google, Inc.
  7. *
  8. * This software is licensed under the terms of the GNU General Public
  9. * License version 2, as published by the Free Software Foundation, and
  10. * may be copied, distributed, and modified under those terms.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. */
  18. #include <linux/init.h>
  19. #include <asm/system.h>
  20. static void msm_idle(void)
  21. {
  22. #ifdef CONFIG_MSM7X00A_IDLE
  23. asm volatile (
  24. "mrc p15, 0, r1, c1, c0, 0 /* read current CR */ \n\t"
  25. "bic r0, r1, #(1 << 2) /* clear dcache bit */ \n\t"
  26. "bic r0, r0, #(1 << 12) /* clear icache bit */ \n\t"
  27. "mcr p15, 0, r0, c1, c0, 0 /* disable d/i cache */ \n\t"
  28. "mov r0, #0 /* prepare wfi value */ \n\t"
  29. "mcr p15, 0, r0, c7, c10, 0 /* flush the cache */ \n\t"
  30. "mcr p15, 0, r0, c7, c10, 4 /* memory barrier */ \n\t"
  31. "mcr p15, 0, r0, c7, c0, 4 /* wait for interrupt */ \n\t"
  32. "mcr p15, 0, r1, c1, c0, 0 /* restore d/i cache */ \n\t"
  33. : : : "r0","r1" );
  34. #endif
  35. }
  36. static int __init msm_idle_init(void)
  37. {
  38. arm_pm_idle = msm_idle;
  39. return 0;
  40. }
  41. arch_initcall(msm_idle_init);