Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / mips / vr41xx / common / pmu.c
blobc5f1043de9384c2f495705d0ff9c43fd670b8066
1 /*
2 * pmu.c, Power Management Unit routines for NEC VR4100 series.
4 * Copyright (C) 2003-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <linux/init.h>
21 #include <linux/kernel.h>
22 #include <linux/smp.h>
23 #include <linux/types.h>
25 #include <asm/cpu.h>
26 #include <asm/io.h>
27 #include <asm/reboot.h>
28 #include <asm/system.h>
30 #define PMUCNT2REG KSEG1ADDR(0x0f0000c6)
31 #define SOFTRST 0x0010
33 static inline void software_reset(void)
35 uint16_t val;
37 switch (current_cpu_data.cputype) {
38 case CPU_VR4122:
39 case CPU_VR4131:
40 case CPU_VR4133:
41 val = readw(PMUCNT2REG);
42 val |= SOFTRST;
43 writew(val, PMUCNT2REG);
44 break;
45 default:
46 break;
50 static void vr41xx_restart(char *command)
52 local_irq_disable();
53 software_reset();
54 printk(KERN_NOTICE "\nYou can reset your system\n");
55 while (1) ;
58 static void vr41xx_halt(void)
60 local_irq_disable();
61 printk(KERN_NOTICE "\nYou can turn off the power supply\n");
62 while (1) ;
65 static void vr41xx_power_off(void)
67 local_irq_disable();
68 printk(KERN_NOTICE "\nYou can turn off the power supply\n");
69 while (1) ;
72 static int __init vr41xx_pmu_init(void)
74 _machine_restart = vr41xx_restart;
75 _machine_halt = vr41xx_halt;
76 _machine_power_off = vr41xx_power_off;
78 return 0;
81 early_initcall(vr41xx_pmu_init);