idle.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright 2008 IBM Corp.
  3. *
  4. * Based on arch/powerpc/platforms/pasemi/idle.c:
  5. * Copyright (C) 2006-2007 PA Semi, Inc
  6. *
  7. * Added by: Jerone Young <jyoung5@us.ibm.com>
  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. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. #include <linux/of.h>
  24. #include <linux/kernel.h>
  25. #include <asm/machdep.h>
  26. static int mode_spin;
  27. static void ppc44x_idle(void)
  28. {
  29. unsigned long msr_save;
  30. msr_save = mfmsr();
  31. /* set wait state MSR */
  32. mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE|MSR_DE);
  33. isync();
  34. /* return to initial state */
  35. mtmsr(msr_save);
  36. isync();
  37. }
  38. int __init ppc44x_idle_init(void)
  39. {
  40. if (!mode_spin) {
  41. /* If we are not setting spin mode
  42. then we set to wait mode */
  43. ppc_md.power_save = &ppc44x_idle;
  44. }
  45. return 0;
  46. }
  47. arch_initcall(ppc44x_idle_init);
  48. static int __init idle_param(char *p)
  49. {
  50. if (!strcmp("spin", p)) {
  51. mode_spin = 1;
  52. ppc_md.power_save = NULL;
  53. }
  54. return 0;
  55. }
  56. early_param("idle", idle_param);