Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* linux/include/asm-arm/arch-s3c2410/system.h |
| 2 | * |
Ben Dooks | f056076 | 2006-12-17 19:59:20 +0100 | [diff] [blame] | 3 | * Copyright (c) 2003 Simtec Electronics |
| 4 | * Ben Dooks <ben@simtec.co.uk> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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. |
Ben Dooks | 3c06cd1 | 2006-09-09 19:44:57 +0100 | [diff] [blame] | 11 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
Russell King | be50972 | 2008-08-04 10:41:28 +0100 | [diff] [blame^] | 13 | #include <asm/arch/hardware.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <asm/io.h> |
| 15 | |
| 16 | #include <asm/arch/map.h> |
| 17 | #include <asm/arch/idle.h> |
Ben Dooks | d4156d5 | 2007-02-15 22:52:15 +0100 | [diff] [blame] | 18 | #include <asm/arch/reset.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include <asm/arch/regs-clock.h> |
| 21 | |
| 22 | void (*s3c24xx_idle)(void); |
Ben Dooks | d4156d5 | 2007-02-15 22:52:15 +0100 | [diff] [blame] | 23 | void (*s3c24xx_reset_hook)(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
| 25 | void s3c24xx_default_idle(void) |
| 26 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | unsigned long tmp; |
| 28 | int i; |
| 29 | |
| 30 | /* idle the system by using the idle mode which will wait for an |
| 31 | * interrupt to happen before restarting the system. |
| 32 | */ |
| 33 | |
| 34 | /* Warning: going into idle state upsets jtag scanning */ |
| 35 | |
Matt Reimer | b05f871 | 2007-02-12 20:42:52 +0100 | [diff] [blame] | 36 | __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE, |
| 37 | S3C2410_CLKCON); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | /* the samsung port seems to do a loop and then unset idle.. */ |
| 40 | for (i = 0; i < 50; i++) { |
Matt Reimer | b05f871 | 2007-02-12 20:42:52 +0100 | [diff] [blame] | 41 | tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | /* this bit is not cleared on re-start... */ |
| 45 | |
Matt Reimer | b05f871 | 2007-02-12 20:42:52 +0100 | [diff] [blame] | 46 | __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE, |
| 47 | S3C2410_CLKCON); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | static void arch_idle(void) |
| 51 | { |
| 52 | if (s3c24xx_idle != NULL) |
| 53 | (s3c24xx_idle)(); |
| 54 | else |
| 55 | s3c24xx_default_idle(); |
| 56 | } |
| 57 | |
Ben Dooks | 3c7d9c8 | 2008-04-16 00:15:20 +0100 | [diff] [blame] | 58 | #include <asm/arch/system-reset.h> |