aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/process.c
diff options
context:
space:
mode:
authorVitja Makarov <vitja.makarov@gmail.com>2008-02-28 23:24:23 -0500
committerBryan Wu <cooloney@kernel.org>2008-02-28 23:24:23 -0500
commit8b5f79f9d7ee4f4edb0212886771c977476eb811 (patch)
tree5c9928710ad8c2556b64cee56fea768ce5ac4ba7 /arch/blackfin/kernel/process.c
parent3dc5063786b273f1aee545844f6bd4e9651ebffe (diff)
[Blackfin] arch: initial generic time and clock sources
This patch enables Hight-Res Timers and tickless kernel Signed-off-by: Vitja Makarov <vitja.makarov@gmail.com> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/kernel/process.c')
-rw-r--r--arch/blackfin/kernel/process.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 6b8459c66163..6dedb2da8b67 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -32,6 +32,8 @@
32#include <linux/unistd.h> 32#include <linux/unistd.h>
33#include <linux/user.h> 33#include <linux/user.h>
34#include <linux/uaccess.h> 34#include <linux/uaccess.h>
35#include <linux/sched.h>
36#include <linux/tick.h>
35#include <linux/fs.h> 37#include <linux/fs.h>
36#include <linux/err.h> 38#include <linux/err.h>
37 39
@@ -69,33 +71,44 @@ EXPORT_SYMBOL(pm_power_off);
69 * The idle loop on BFIN 71 * The idle loop on BFIN
70 */ 72 */
71#ifdef CONFIG_IDLE_L1 73#ifdef CONFIG_IDLE_L1
72void default_idle(void)__attribute__((l1_text)); 74static void default_idle(void)__attribute__((l1_text));
73void cpu_idle(void)__attribute__((l1_text)); 75void cpu_idle(void)__attribute__((l1_text));
74#endif 76#endif
75 77
76void default_idle(void) 78/*
79 * This is our default idle handler. We need to disable
80 * interrupts here to ensure we don't miss a wakeup call.
81 */
82static void default_idle(void)
77{ 83{
78 while (!need_resched()) { 84 local_irq_disable();
79 local_irq_disable(); 85 if (!need_resched())
80 if (likely(!need_resched())) 86 idle_with_irq_disabled();
81 idle_with_irq_disabled();
82 local_irq_enable();
83 }
84}
85 87
86void (*idle)(void) = default_idle; 88 local_irq_enable();
89}
87 90
88/* 91/*
89 * The idle thread. There's no useful work to be 92 * The idle thread. We try to conserve power, while trying to keep
90 * done, so just try to conserve power and have a 93 * overall latency low. The architecture specific idle is passed
91 * low exit latency (ie sit in a loop waiting for 94 * a value to indicate the level of "idleness" of the system.
92 * somebody to say that they'd like to reschedule)
93 */ 95 */
94void cpu_idle(void) 96void cpu_idle(void)
95{ 97{
96 /* endless idle loop with no priority at all */ 98 /* endless idle loop with no priority at all */
97 while (1) { 99 while (1) {
98 idle(); 100 void (*idle)(void) = pm_idle;
101
102#ifdef CONFIG_HOTPLUG_CPU
103 if (cpu_is_offline(smp_processor_id()))
104 cpu_die();
105#endif
106 if (!idle)
107 idle = default_idle;
108 tick_nohz_stop_sched_tick();
109 while (!need_resched())
110 idle();
111 tick_nohz_restart_sched_tick();
99 preempt_enable_no_resched(); 112 preempt_enable_no_resched();
100 schedule(); 113 schedule();
101 preempt_disable(); 114 preempt_disable();