i8253.c 734 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * i8253.c 8253/PIT functions
  3. *
  4. */
  5. #include <linux/clockchips.h>
  6. #include <linux/i8253.h>
  7. #include <linux/export.h>
  8. #include <linux/smp.h>
  9. #include <linux/irq.h>
  10. #include <asm/time.h>
  11. static irqreturn_t timer_interrupt(int irq, void *dev_id)
  12. {
  13. i8253_clockevent.event_handler(&i8253_clockevent);
  14. return IRQ_HANDLED;
  15. }
  16. static struct irqaction irq0 = {
  17. .handler = timer_interrupt,
  18. .flags = IRQF_NOBALANCING | IRQF_TIMER,
  19. .name = "timer"
  20. };
  21. void __init setup_pit_timer(void)
  22. {
  23. clockevent_i8253_init(true);
  24. setup_irq(0, &irq0);
  25. }
  26. static int __init init_pit_clocksource(void)
  27. {
  28. if (num_possible_cpus() > 1) /* PIT does not scale! */
  29. return 0;
  30. return clocksource_i8253_init();
  31. }
  32. arch_initcall(init_pit_clocksource);