blob: 98f690e7d33ec28e7451234eb9de209d3601cac7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* linux/include/asm-arm/arch-s3c2410/system.h
2 *
Ben Dooksf0560762006-12-17 19:59:20 +01003 * Copyright (c) 2003 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
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 Dooks3c06cd12006-09-09 19:44:57 +010011*/
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
Russell Kingbe509722008-08-04 10:41:28 +010013#include <asm/arch/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <asm/io.h>
15
16#include <asm/arch/map.h>
17#include <asm/arch/idle.h>
Ben Dooksd4156d52007-02-15 22:52:15 +010018#include <asm/arch/reset.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <asm/arch/regs-clock.h>
21
22void (*s3c24xx_idle)(void);
Ben Dooksd4156d52007-02-15 22:52:15 +010023void (*s3c24xx_reset_hook)(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
25void s3c24xx_default_idle(void)
26{
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 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 Reimerb05f8712007-02-12 20:42:52 +010036 __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
37 S3C2410_CLKCON);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
39 /* the samsung port seems to do a loop and then unset idle.. */
40 for (i = 0; i < 50; i++) {
Matt Reimerb05f8712007-02-12 20:42:52 +010041 tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 }
43
44 /* this bit is not cleared on re-start... */
45
Matt Reimerb05f8712007-02-12 20:42:52 +010046 __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
47 S3C2410_CLKCON);
Linus Torvalds1da177e2005-04-16 15:20:36 -070048}
49
50static void arch_idle(void)
51{
52 if (s3c24xx_idle != NULL)
53 (s3c24xx_idle)();
54 else
55 s3c24xx_default_idle();
56}
57
Ben Dooks3c7d9c82008-04-16 00:15:20 +010058#include <asm/arch/system-reset.h>