timer_32.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #include <asm/btfixup.h>
  13. #define SBUS_CLOCK_RATE 2000000 /* 2MHz */
  14. #define TIMER_VALUE_SHIFT 9
  15. #define TIMER_VALUE_MASK 0x3fffff
  16. #define TIMER_LIMIT_BIT (1 << 31) /* Bit 31 in Counter-Timer register */
  17. /* The counter timer register has the value offset by 9 bits.
  18. * From sun4m manual:
  19. * When a counter reaches the value in the corresponding limit register,
  20. * the Limit bit is set and the counter is set to 500 nS (i.e. 0x00000200).
  21. *
  22. * To compensate for this add one to the value.
  23. */
  24. static inline unsigned int timer_value(unsigned int value)
  25. {
  26. return (value + 1) << TIMER_VALUE_SHIFT;
  27. }
  28. extern __volatile__ unsigned int *master_l10_counter;
  29. extern irqreturn_t notrace timer_interrupt(int dummy, void *dev_id);
  30. #ifdef CONFIG_SMP
  31. DECLARE_PER_CPU(struct clock_event_device, sparc32_clockevent);
  32. extern void register_percpu_ce(int cpu);
  33. #endif
  34. /* FIXME: Make do_[gs]ettimeofday btfixup calls */
  35. struct timespec;
  36. BTFIXUPDEF_CALL(int, bus_do_settimeofday, struct timespec *tv)
  37. #define bus_do_settimeofday(tv) BTFIXUP_CALL(bus_do_settimeofday)(tv)
  38. #endif /* !(_SPARC_TIMER_H) */