2008-11-26 06:52:44 +00:00
|
|
|
/*
|
|
|
|
* The idle loop for all SuperH platforms.
|
|
|
|
*
|
2009-06-19 05:40:51 +00:00
|
|
|
* Copyright (C) 2002 - 2009 Paul Mundt
|
2008-11-26 06:52:44 +00:00
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/pm.h>
|
|
|
|
#include <linux/tick.h>
|
|
|
|
#include <linux/preempt.h>
|
|
|
|
#include <linux/thread_info.h>
|
|
|
|
#include <linux/irqflags.h>
|
2009-06-19 05:40:51 +00:00
|
|
|
#include <linux/smp.h>
|
2011-04-01 23:34:59 +00:00
|
|
|
#include <linux/cpuidle.h>
|
2011-07-26 23:09:06 +00:00
|
|
|
#include <linux/atomic.h>
|
2012-03-30 10:29:57 +00:00
|
|
|
#include <asm/pgalloc.h>
|
2010-04-26 10:08:55 +00:00
|
|
|
#include <asm/smp.h>
|
2012-03-28 17:30:03 +00:00
|
|
|
#include <asm/bl_bit.h>
|
2008-11-26 06:52:44 +00:00
|
|
|
|
2013-02-10 03:52:57 +00:00
|
|
|
static void (*sh_idle)(void);
|
2010-01-20 07:42:52 +00:00
|
|
|
|
2013-03-21 21:49:59 +00:00
|
|
|
void default_idle(void)
|
2009-10-16 08:20:58 +00:00
|
|
|
{
|
2013-03-21 21:49:59 +00:00
|
|
|
set_bl_bit();
|
2009-10-16 08:20:58 +00:00
|
|
|
local_irq_enable();
|
2013-03-21 21:49:59 +00:00
|
|
|
/* Isn't this racy ? */
|
|
|
|
cpu_sleep();
|
|
|
|
clear_bl_bit();
|
2009-10-16 08:20:58 +00:00
|
|
|
}
|
|
|
|
|
2013-03-21 21:49:59 +00:00
|
|
|
void arch_cpu_idle_dead(void)
|
2008-11-26 06:52:44 +00:00
|
|
|
{
|
2013-03-21 21:49:59 +00:00
|
|
|
play_dead();
|
2008-11-26 06:52:44 +00:00
|
|
|
}
|
|
|
|
|
2013-03-21 21:49:59 +00:00
|
|
|
void arch_cpu_idle(void)
|
2008-11-26 06:52:44 +00:00
|
|
|
{
|
2013-03-21 21:49:59 +00:00
|
|
|
if (cpuidle_idle_call())
|
|
|
|
sh_idle();
|
2008-11-26 06:52:44 +00:00
|
|
|
}
|
2009-06-19 05:40:51 +00:00
|
|
|
|
2010-03-23 08:06:47 +00:00
|
|
|
void __init select_idle_routine(void)
|
2009-10-16 08:20:58 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* If a platform has set its own idle routine, leave it alone.
|
|
|
|
*/
|
2013-03-21 21:49:59 +00:00
|
|
|
if (!sh_idle)
|
2013-02-10 03:52:57 +00:00
|
|
|
sh_idle = default_idle;
|
2009-10-16 08:20:58 +00:00
|
|
|
}
|
|
|
|
|
2010-01-20 07:42:52 +00:00
|
|
|
void stop_this_cpu(void *unused)
|
|
|
|
{
|
|
|
|
local_irq_disable();
|
2010-04-26 09:39:50 +00:00
|
|
|
set_cpu_online(smp_processor_id(), false);
|
2010-01-20 07:42:52 +00:00
|
|
|
|
|
|
|
for (;;)
|
|
|
|
cpu_sleep();
|
|
|
|
}
|