timer_32.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * timer.h: Definitions for the timer chips on the Sparc.
  3. *
  4. * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  5. */
  6. #ifndef _SPARC_TIMER_H
  7. #define _SPARC_TIMER_H
  8. #include <linux/clocksource.h>
  9. #include <linux/irqreturn.h>
  10. #include <asm-generic/percpu.h>
  11. #include <asm/cpu_type.h> /* For SUN4M_NCPUS */
  12. #define SBUS_CLOCK_RATE 2000000 /* 2MHz */
  13. #define TIMER_VALUE_SHIFT 9
  14. #define TIMER_VALUE_MASK 0x3fffff
  15. #define TIMER_LIMIT_BIT (1 << 31) /* Bit 31 in Counter-Timer register */
  16. /* The counter timer register has the value offset by 9 bits.
  17. * From sun4m manual:
  18. * When a counter reaches the value in the corresponding limit register,
  19. * the Limit bit is set and the counter is set to 500 nS (i.e. 0x00000200).
  20. *
  21. * To compensate for this add one to the value.
  22. */
  23. static inline unsigned int timer_value(unsigned int value)
  24. {
  25. return (value + 1) << TIMER_VALUE_SHIFT;
  26. }
  27. extern volatile u32 __iomem *master_l10_counter;
  28. irqreturn_t notrace timer_interrupt(int dummy, void *dev_id);
  29. #ifdef CONFIG_SMP
  30. DECLARE_PER_CPU(struct clock_event_device, sparc32_clockevent);
  31. void register_percpu_ce(int cpu);
  32. #endif
  33. #endif /* !(_SPARC_TIMER_H) */