aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/vr41xx/common/pmu.c
diff options
context:
space:
mode:
authorYoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>2007-08-06 11:09:17 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-10-11 18:45:58 -0400
commit61a33168bebb6ce5343a5f34ab421971dbfae9fa (patch)
tree855ad0dd5373ce7f13e8c45dde605f11894da674 /arch/mips/vr41xx/common/pmu.c
parentf571eff0a24ed97a919f2b61bb4afdeab4b43002 (diff)
[MIPS] vr41xx: add cpu_wait
Add cpu_wait for NEC VR41xx Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/vr41xx/common/pmu.c')
-rw-r--r--arch/mips/vr41xx/common/pmu.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/arch/mips/vr41xx/common/pmu.c b/arch/mips/vr41xx/common/pmu.c
index 5e469796413f..e0ffbe9a9844 100644
--- a/arch/mips/vr41xx/common/pmu.c
+++ b/arch/mips/vr41xx/common/pmu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pmu.c, Power Management Unit routines for NEC VR4100 series. 2 * pmu.c, Power Management Unit routines for NEC VR4100 series.
3 * 3 *
4 * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 4 * Copyright (C) 2003-2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
@@ -22,11 +22,12 @@
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/smp.h> 25#include <linux/sched.h>
26#include <linux/types.h> 26#include <linux/types.h>
27 27
28#include <asm/cpu.h> 28#include <asm/cpu.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/processor.h>
30#include <asm/reboot.h> 31#include <asm/reboot.h>
31#include <asm/system.h> 32#include <asm/system.h>
32 33
@@ -44,6 +45,18 @@ static void __iomem *pmu_base;
44#define pmu_read(offset) readw(pmu_base + (offset)) 45#define pmu_read(offset) readw(pmu_base + (offset))
45#define pmu_write(offset, value) writew((value), pmu_base + (offset)) 46#define pmu_write(offset, value) writew((value), pmu_base + (offset))
46 47
48static void vr41xx_cpu_wait(void)
49{
50 local_irq_disable();
51 if (!need_resched())
52 /*
53 * "standby" sets IE bit of the CP0_STATUS to 1.
54 */
55 __asm__("standby;\n");
56 else
57 local_irq_enable();
58}
59
47static inline void software_reset(void) 60static inline void software_reset(void)
48{ 61{
49 uint16_t pmucnt2; 62 uint16_t pmucnt2;
@@ -113,6 +126,7 @@ static int __init vr41xx_pmu_init(void)
113 return -EBUSY; 126 return -EBUSY;
114 } 127 }
115 128
129 cpu_wait = vr41xx_cpu_wait;
116 _machine_restart = vr41xx_restart; 130 _machine_restart = vr41xx_restart;
117 _machine_halt = vr41xx_halt; 131 _machine_halt = vr41xx_halt;
118 pm_power_off = vr41xx_power_off; 132 pm_power_off = vr41xx_power_off;