Full support for Ginger Console
[linux-ginger.git] / arch / powerpc / platforms / 44x / idle.c
blob7a81f921fef9bfc203a873d324c86e534d2a28e8
1 /*
2 * Copyright 2008 IBM Corp.
4 * Based on arch/powerpc/platforms/pasemi/idle.c:
5 * Copyright (C) 2006-2007 PA Semi, Inc
7 * Added by: Jerone Young <jyoung5@us.ibm.com>
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.
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.
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
24 #include <linux/of.h>
25 #include <linux/kernel.h>
26 #include <asm/machdep.h>
28 static int mode_spin;
30 static void ppc44x_idle(void)
32 unsigned long msr_save;
34 msr_save = mfmsr();
35 /* set wait state MSR */
36 mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE|MSR_DE);
37 isync();
38 /* return to initial state */
39 mtmsr(msr_save);
40 isync();
43 int __init ppc44x_idle_init(void)
45 if (!mode_spin) {
46 /* If we are not setting spin mode
47 then we set to wait mode */
48 ppc_md.power_save = &ppc44x_idle;
51 return 0;
54 arch_initcall(ppc44x_idle_init);
56 static int __init idle_param(char *p)
59 if (!strcmp("spin", p)) {
60 mode_spin = 1;
61 ppc_md.power_save = NULL;
64 return 0;
67 early_param("idle", idle_param);