| Juergen Beisert | eea643f | 2008-07-05 10:02:56 +0200 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright (C) 1999 ARM Limited | 
 | 3 |  * Copyright (C) 2000 Deep Blue Solutions Ltd | 
 | 4 |  * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved. | 
 | 5 |  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de | 
 | 6 |  * | 
 | 7 |  * This program is free software; you can redistribute it and/or modify | 
 | 8 |  * it under the terms of the GNU General Public License as published by | 
 | 9 |  * the Free Software Foundation; either version 2 of the License, or | 
 | 10 |  * (at your option) any later version. | 
 | 11 |  * | 
 | 12 |  * This program is distributed in the hope that it will be useful, | 
 | 13 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 14 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 15 |  * GNU General Public License for more details. | 
 | 16 |  * | 
 | 17 |  * You should have received a copy of the GNU General Public License | 
 | 18 |  * along with this program; if not, write to the Free Software | 
 | 19 |  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | 
 | 20 |  */ | 
 | 21 |  | 
 | 22 | #include <linux/kernel.h> | 
 | 23 | #include <linux/clk.h> | 
 | 24 | #include <linux/io.h> | 
 | 25 |  | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 26 | #include <mach/hardware.h> | 
| Juergen Beisert | eea643f | 2008-07-05 10:02:56 +0200 | [diff] [blame] | 27 | #include <asm/proc-fns.h> | 
 | 28 | #include <asm/system.h> | 
 | 29 |  | 
 | 30 | /* | 
 | 31 |  * Put the CPU into idle mode. It is called by default_idle() | 
 | 32 |  * in process.c file. | 
 | 33 |  */ | 
 | 34 | void arch_idle(void) | 
 | 35 | { | 
 | 36 | 	/* | 
 | 37 | 	 * This should do all the clock switching | 
 | 38 | 	 * and wait for interrupt tricks. | 
 | 39 | 	 */ | 
 | 40 | 	cpu_do_idle(); | 
 | 41 | } | 
 | 42 |  | 
 | 43 | #define WDOG_WCR_REG                    IO_ADDRESS(WDOG_BASE_ADDR) | 
 | 44 | #define WDOG_WCR_SRS                    (1 << 4) | 
 | 45 |  | 
 | 46 | /* | 
 | 47 |  * Reset the system. It is called by machine_restart(). | 
 | 48 |  */ | 
 | 49 | void arch_reset(char mode) | 
 | 50 | { | 
 | 51 | 	struct clk *clk; | 
 | 52 |  | 
 | 53 | 	clk = clk_get(NULL, "wdog_clk"); | 
 | 54 | 	if (!clk) { | 
 | 55 | 		printk(KERN_ERR"Cannot activate the watchdog. Giving up\n"); | 
 | 56 | 		return; | 
 | 57 | 	} | 
 | 58 |  | 
 | 59 | 	clk_enable(clk); | 
 | 60 |  | 
 | 61 | 	/* Assert SRS signal */ | 
 | 62 | 	__raw_writew(__raw_readw(WDOG_WCR_REG) & ~WDOG_WCR_SRS, WDOG_WCR_REG); | 
 | 63 | } |