1 /*
2 * pmu.c, Power Management Unit routines for NEC VR4100 series.
3 *
4 * Copyright (C) 2003 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5 *
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.
10 *
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.
15 *
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
19 */
20 #include <linux/init.h>
21 #include <linux/types.h>
22
23 #include <asm/cpu.h>
24 #include <asm/io.h>
25 #include <asm/reboot.h>
26 #include <asm/system.h>
27
28 #define PMUCNT2REG KSEG1ADDR(0x0f0000c6)
29 #define SOFTRST 0x0010
30
software_reset(void)31 static inline void software_reset(void)
32 {
33 uint16_t val;
34
35 switch (current_cpu_data.cputype) {
36 case CPU_VR4122:
37 case CPU_VR4131:
38 case CPU_VR4133:
39 val = readw(PMUCNT2REG);
40 val |= SOFTRST;
41 writew(val, PMUCNT2REG);
42 break;
43 default:
44 break;
45 }
46 }
47
vr41xx_restart(char * command)48 static void vr41xx_restart(char *command)
49 {
50 local_irq_disable();
51 software_reset();
52 printk(KERN_NOTICE "\nYou can reset your system\n");
53 while (1) ;
54 }
55
vr41xx_halt(void)56 static void vr41xx_halt(void)
57 {
58 local_irq_disable();
59 printk(KERN_NOTICE "\nYou can turn off the power supply\n");
60 while (1) ;
61 }
62
vr41xx_power_off(void)63 static void vr41xx_power_off(void)
64 {
65 local_irq_disable();
66 printk(KERN_NOTICE "\nYou can turn off the power supply\n");
67 while (1) ;
68 }
69
vr41xx_pmu_init(void)70 void __init vr41xx_pmu_init(void)
71 {
72 _machine_restart = vr41xx_restart;
73 _machine_halt = vr41xx_halt;
74 _machine_power_off = vr41xx_power_off;
75 }
76