Rob Herring | 6738845 | 2011-05-17 21:02:49 -0500 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2010-2011 Calxeda, Inc. |
| 3 | * Based on localtimer.c, Copyright (C) 2002 ARM Ltd. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms and conditions of the GNU General Public License, |
| 7 | * version 2, as published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/clockchips.h> |
| 19 | #include <linux/of.h> |
| 20 | #include <linux/of_address.h> |
| 21 | #include <linux/of_irq.h> |
| 22 | |
| 23 | #include <asm/smp_twd.h> |
| 24 | |
| 25 | /* |
| 26 | * Setup the local clock events for a CPU. |
| 27 | */ |
| 28 | int __cpuinit local_timer_setup(struct clock_event_device *evt) |
| 29 | { |
| 30 | struct device_node *np; |
| 31 | |
| 32 | np = of_find_compatible_node(NULL, NULL, "arm,smp-twd"); |
| 33 | if (!twd_base) { |
| 34 | twd_base = of_iomap(np, 0); |
| 35 | WARN_ON(!twd_base); |
| 36 | } |
| 37 | evt->irq = irq_of_parse_and_map(np, 0); |
| 38 | twd_timer_setup(evt); |
| 39 | return 0; |
| 40 | } |