From 2a7be1160a7ccc8b53693ef793fccb4ad2e75bbc Mon Sep 17 00:00:00 2001 From: Jonas Bonn Date: Sat, 4 Jun 2011 22:28:42 +0300 Subject: OpenRISC: Idle/Power management Minimal functionality... Signed-off-by: Jonas Bonn Reviewed-by: Arnd Bergmann --- arch/openrisc/kernel/idle.c | 77 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 arch/openrisc/kernel/idle.c (limited to 'arch/openrisc') diff --git a/arch/openrisc/kernel/idle.c b/arch/openrisc/kernel/idle.c new file mode 100644 index 000000000000..d5bc5f813e89 --- /dev/null +++ b/arch/openrisc/kernel/idle.c @@ -0,0 +1,77 @@ +/* + * OpenRISC idle.c + * + * Linux architectural port borrowing liberally from similar works of + * others. All original copyrights apply as per the original source + * declaration. + * + * Modifications for the OpenRISC architecture: + * Copyright (C) 2003 Matjaz Breskvar + * Copyright (C) 2010-2011 Jonas Bonn + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Idle daemon for or32. Idle daemon will handle any action + * that needs to be taken when the system becomes idle. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +void (*powersave) (void) = NULL; + +static inline void pm_idle(void) +{ + barrier(); +} + +void cpu_idle(void) +{ + set_thread_flag(TIF_POLLING_NRFLAG); + + /* endless idle loop with no priority at all */ + while (1) { + tick_nohz_stop_sched_tick(1); + + while (!need_resched()) { + check_pgt_cache(); + rmb(); + + clear_thread_flag(TIF_POLLING_NRFLAG); + + local_irq_disable(); + /* Don't trace irqs off for idle */ + stop_critical_timings(); + if (!need_resched() && powersave != NULL) + powersave(); + start_critical_timings(); + local_irq_enable(); + set_thread_flag(TIF_POLLING_NRFLAG); + } + + tick_nohz_restart_sched_tick(); + preempt_enable_no_resched(); + schedule(); + preempt_disable(); + } +} -- cgit v1.2.3