localtimer.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #include <asm/smp_twd.h>
  23. /*
  24. * Setup the local clock events for a CPU.
  25. */
  26. int __cpuinit local_timer_setup(struct clock_event_device *evt)
  27. {
  28. struct device_node *np;
  29. np = of_find_compatible_node(NULL, NULL, "arm,smp-twd");
  30. if (!twd_base) {
  31. twd_base = of_iomap(np, 0);
  32. WARN_ON(!twd_base);
  33. }
  34. evt->irq = irq_of_parse_and_map(np, 0);
  35. twd_timer_setup(evt);
  36. return 0;
  37. }