1/*
2 *  linux/include/asm-arm/arch-ebsa110/system.h
3 *
4 *  Copyright (C) 1996-2000 Russell King.
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARCH_SYSTEM_H
11#define __ASM_ARCH_SYSTEM_H
12
13/*
14 * EBSA110 idling methodology:
15 *
16 * We can not execute the "wait for interrupt" instruction since that
17 * will stop our MCLK signal (which provides the clock for the glue
18 * logic, and therefore the timer interrupt).
19 *
20 * Instead, we spin, waiting for either hlt_counter or need_resched
21 * to be set.  If we have been spinning for 2cs, then we drop the
22 * core clock down to the memory clock.
23 */
24static void arch_idle(void)
25{
26	unsigned long start_idle;
27
28	start_idle = jiffies;
29
30	do {
31		if (current->need_resched || hlt_counter)
32			goto slow_out;
33	} while (time_before(jiffies, start_idle + HZ/50));
34
35	cpu_do_idle(IDLE_CLOCK_SLOW);
36
37	while (!current->need_resched && !hlt_counter) {
38		/* do nothing slowly */
39	}
40
41	cpu_do_idle(IDLE_CLOCK_FAST);
42slow_out:
43}
44
45#define arch_reset(mode)	cpu_reset(0x80000000)
46
47#endif
48