dw_apb_timer.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * (C) Copyright 2009 Intel Corporation
  3. * Author: Jacob Pan (jacob.jun.pan@intel.com)
  4. *
  5. * Shared with ARM platforms, Jamie Iles, Picochip 2011
  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 version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * Support for the Synopsys DesignWare APB Timers.
  12. */
  13. #ifndef __DW_APB_TIMER_H__
  14. #define __DW_APB_TIMER_H__
  15. #include <linux/clockchips.h>
  16. #include <linux/clocksource.h>
  17. #include <linux/interrupt.h>
  18. #define APBTMRS_REG_SIZE 0x14
  19. struct dw_apb_timer {
  20. void __iomem *base;
  21. unsigned long freq;
  22. int irq;
  23. };
  24. struct dw_apb_clock_event_device {
  25. struct clock_event_device ced;
  26. struct dw_apb_timer timer;
  27. struct irqaction irqaction;
  28. void (*eoi)(struct dw_apb_timer *);
  29. };
  30. struct dw_apb_clocksource {
  31. struct dw_apb_timer timer;
  32. struct clocksource cs;
  33. };
  34. void dw_apb_clockevent_register(struct dw_apb_clock_event_device *dw_ced);
  35. void dw_apb_clockevent_pause(struct dw_apb_clock_event_device *dw_ced);
  36. void dw_apb_clockevent_resume(struct dw_apb_clock_event_device *dw_ced);
  37. void dw_apb_clockevent_stop(struct dw_apb_clock_event_device *dw_ced);
  38. struct dw_apb_clock_event_device *
  39. dw_apb_clockevent_init(int cpu, const char *name, unsigned rating,
  40. void __iomem *base, int irq, unsigned long freq);
  41. struct dw_apb_clocksource *
  42. dw_apb_clocksource_init(unsigned rating, const char *name, void __iomem *base,
  43. unsigned long freq);
  44. void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs);
  45. void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
  46. cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
  47. void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);
  48. #endif /* __DW_APB_TIMER_H__ */