Path: blob/master/arch/powerpc/platforms/44x/idle.c
10820 views
/*1* Copyright 2008 IBM Corp.2*3* Based on arch/powerpc/platforms/pasemi/idle.c:4* Copyright (C) 2006-2007 PA Semi, Inc5*6* Added by: Jerone Young <[email protected]>7*8* This program is free software; you can redistribute it and/or modify9* it under the terms of the GNU General Public License version 2 as10* published by the Free Software Foundation.11*12* This program is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15* GNU General Public License for more details.16*17* You should have received a copy of the GNU General Public License18* along with this program; if not, write to the Free Software19* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20*21*/2223#include <linux/of.h>24#include <linux/kernel.h>25#include <asm/machdep.h>2627static int mode_spin;2829static void ppc44x_idle(void)30{31unsigned long msr_save;3233msr_save = mfmsr();34/* set wait state MSR */35mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE|MSR_DE);36isync();37/* return to initial state */38mtmsr(msr_save);39isync();40}4142int __init ppc44x_idle_init(void)43{44if (!mode_spin) {45/* If we are not setting spin mode46then we set to wait mode */47ppc_md.power_save = &ppc44x_idle;48}4950return 0;51}5253arch_initcall(ppc44x_idle_init);5455static int __init idle_param(char *p)56{5758if (!strcmp("spin", p)) {59mode_spin = 1;60ppc_md.power_save = NULL;61}6263return 0;64}6566early_param("idle", idle_param);676869