localtimer.c 862 B

1234567891011121314151617181920212223242526272829303132333435
  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. #include <linux/init.h>
  13. #include <linux/clockchips.h>
  14. #include <linux/of_address.h>
  15. #include <linux/of_irq.h>
  16. #include <asm/smp_twd.h>
  17. /*
  18. * Setup the local clock events for a CPU.
  19. */
  20. int __cpuinit local_timer_setup(struct clock_event_device *evt)
  21. {
  22. struct device_node *np;
  23. np = of_find_compatible_node(NULL, NULL, "arm,smp-twd");
  24. if (!twd_base) {
  25. twd_base = of_iomap(np, 0);
  26. WARN_ON(!twd_base);
  27. }
  28. evt->irq = irq_of_parse_and_map(np, 0);
  29. twd_timer_setup(evt);
  30. return 0;
  31. }