| Shawn Guo | 69c31b7 | 2011-09-06 14:59:40 +0800 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright 2011 Freescale Semiconductor, Inc. | 
 | 3 |  * Copyright 2011 Linaro Ltd. | 
 | 4 |  * | 
 | 5 |  * The code contained herein is licensed under the GNU General Public | 
 | 6 |  * License. You may obtain a copy of the GNU General Public License | 
 | 7 |  * Version 2 or later at the following locations: | 
 | 8 |  * | 
 | 9 |  * http://www.opensource.org/licenses/gpl-license.html | 
 | 10 |  * http://www.gnu.org/copyleft/gpl.html | 
 | 11 |  */ | 
 | 12 |  | 
 | 13 | #include <linux/init.h> | 
 | 14 | #include <linux/clockchips.h> | 
 | 15 | #include <linux/of_address.h> | 
 | 16 | #include <linux/of_irq.h> | 
 | 17 | #include <asm/smp_twd.h> | 
 | 18 |  | 
 | 19 | /* | 
 | 20 |  * Setup the local clock events for a CPU. | 
 | 21 |  */ | 
 | 22 | int __cpuinit local_timer_setup(struct clock_event_device *evt) | 
 | 23 | { | 
 | 24 | 	struct device_node *np; | 
 | 25 |  | 
 | 26 | 	np = of_find_compatible_node(NULL, NULL, "arm,smp-twd"); | 
 | 27 | 	if (!twd_base) { | 
 | 28 | 		twd_base = of_iomap(np, 0); | 
 | 29 | 		WARN_ON(!twd_base); | 
 | 30 | 	} | 
 | 31 | 	evt->irq = irq_of_parse_and_map(np, 0); | 
 | 32 | 	twd_timer_setup(evt); | 
 | 33 |  | 
 | 34 | 	return 0; | 
 | 35 | } |