2 * Copyright (C) 2006-2007 PA Semi, Inc
4 * Maintained by: Olof Johansson <olof@lixom.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/kernel.h>
24 #include <linux/string.h>
26 #include <asm/machdep.h>
36 static struct sleep_mode modes[] = {
37 { .name = "spin", .entry = &idle_spin },
38 { .name = "doze", .entry = &idle_doze },
41 static int current_mode = 0;
43 static int pasemi_system_reset_exception(struct pt_regs *regs)
45 /* If we were woken up from power savings, we need to return
46 * to the calling function, since nip is not saved across
50 if (regs->msr & SRR1_WAKEMASK)
51 regs->nip = regs->link;
53 switch (regs->msr & SRR1_WAKEMASK) {
58 timer_interrupt(regs);
65 /* Set higher astate since we come out of power savings at 0 */
66 restore_astate(hard_smp_processor_id());
68 /* everything handled */
73 void __init pasemi_idle_init(void)
75 #ifndef CONFIG_PPC_PASEMI_CPUFREQ
76 printk(KERN_WARNING "No cpufreq driver, powersavings modes disabled\n");
80 ppc_md.system_reset_exception = pasemi_system_reset_exception;
81 ppc_md.power_save = modes[current_mode].entry;
82 printk(KERN_INFO "Using PA6T idle loop (%s)\n", modes[current_mode].name);
85 static int __init idle_param(char *p)
88 for (i = 0; i < sizeof(modes)/sizeof(struct sleep_mode); i++) {
89 if (!strcmp(modes[i].name, p)) {
97 early_param("idle", idle_param);