Commit | Line | Data |
---|---|---|
a09e64fb | 1 | /* arch/arm/mach-s3c2410/include/mach/system.h |
1da177e4 | 2 | * |
f056076e BD |
3 | * Copyright (c) 2003 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | |
1da177e4 LT |
5 | * |
6 | * S3C2410 - System function defines and includes | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License version 2 as | |
10 | * published by the Free Software Foundation. | |
3c06cd1c | 11 | */ |
1da177e4 | 12 | |
fced80c7 | 13 | #include <linux/io.h> |
a09e64fb | 14 | #include <mach/hardware.h> |
1da177e4 | 15 | |
a09e64fb RK |
16 | #include <mach/map.h> |
17 | #include <mach/idle.h> | |
1da177e4 | 18 | |
a09e64fb | 19 | #include <mach/regs-clock.h> |
1da177e4 LT |
20 | |
21 | void (*s3c24xx_idle)(void); | |
22 | ||
23 | void s3c24xx_default_idle(void) | |
24 | { | |
1da177e4 LT |
25 | unsigned long tmp; |
26 | int i; | |
27 | ||
28 | /* idle the system by using the idle mode which will wait for an | |
29 | * interrupt to happen before restarting the system. | |
30 | */ | |
31 | ||
32 | /* Warning: going into idle state upsets jtag scanning */ | |
33 | ||
b05f8717 MR |
34 | __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE, |
35 | S3C2410_CLKCON); | |
1da177e4 LT |
36 | |
37 | /* the samsung port seems to do a loop and then unset idle.. */ | |
38 | for (i = 0; i < 50; i++) { | |
b05f8717 | 39 | tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */ |
1da177e4 LT |
40 | } |
41 | ||
42 | /* this bit is not cleared on re-start... */ | |
43 | ||
b05f8717 MR |
44 | __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE, |
45 | S3C2410_CLKCON); | |
1da177e4 LT |
46 | } |
47 | ||
48 | static void arch_idle(void) | |
49 | { | |
50 | if (s3c24xx_idle != NULL) | |
51 | (s3c24xx_idle)(); | |
52 | else | |
53 | s3c24xx_default_idle(); | |
54 | } |