x86: i8259A: remove redundant irq_descinitialization
[wrt350n-kernel.git] / include / asm-arm / arch-s3c2410 / system.h
blob14de4e596f87b170661faad4cabe21deeb7019aa
1 /* linux/include/asm-arm/arch-s3c2410/system.h
3 * Copyright (c) 2003 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * S3C2410 - System function defines and includes
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.
13 #include <asm/hardware.h>
14 #include <asm/io.h>
16 #include <asm/arch/map.h>
17 #include <asm/arch/idle.h>
18 #include <asm/arch/reset.h>
20 #include <asm/plat-s3c/regs-watchdog.h>
21 #include <asm/arch/regs-clock.h>
23 #include <linux/clk.h>
24 #include <linux/err.h>
26 void (*s3c24xx_idle)(void);
27 void (*s3c24xx_reset_hook)(void);
29 void s3c24xx_default_idle(void)
31 unsigned long tmp;
32 int i;
34 /* idle the system by using the idle mode which will wait for an
35 * interrupt to happen before restarting the system.
38 /* Warning: going into idle state upsets jtag scanning */
40 __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
41 S3C2410_CLKCON);
43 /* the samsung port seems to do a loop and then unset idle.. */
44 for (i = 0; i < 50; i++) {
45 tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
48 /* this bit is not cleared on re-start... */
50 __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
51 S3C2410_CLKCON);
54 static void arch_idle(void)
56 if (s3c24xx_idle != NULL)
57 (s3c24xx_idle)();
58 else
59 s3c24xx_default_idle();
62 static void
63 arch_reset(char mode)
65 struct clk *wdtclk;
67 if (mode == 's') {
68 cpu_reset(0);
71 if (s3c24xx_reset_hook)
72 s3c24xx_reset_hook();
74 printk("arch_reset: attempting watchdog reset\n");
76 __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */
78 wdtclk = clk_get(NULL, "watchdog");
79 if (!IS_ERR(wdtclk)) {
80 clk_enable(wdtclk);
81 } else
82 printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);
84 /* put initial values into count and data */
85 __raw_writel(0x80, S3C2410_WTCNT);
86 __raw_writel(0x80, S3C2410_WTDAT);
88 /* set the watchdog to go and reset... */
89 __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN |
90 S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON);
92 /* wait for reset to assert... */
93 mdelay(500);
95 printk(KERN_ERR "Watchdog reset failed to assert reset\n");
97 /* delay to allow the serial port to show the message */
98 mdelay(50);
100 /* we'll take a jump through zero as a poor second */
101 cpu_reset(0);