cpu-h7201.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * linux/arch/arm/mach-h720x/cpu-h7201.c
  3. *
  4. * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de>
  5. * 2003 Robert Schwebel <r.schwebel@pengutronix.de>
  6. * 2004 Sascha Hauer <s.hauer@pengutronix.de>
  7. *
  8. * processor specific stuff for the Hynix h7201
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. *
  14. */
  15. #include <linux/init.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/module.h>
  18. #include <asm/types.h>
  19. #include <asm/hardware.h>
  20. #include <asm/irq.h>
  21. #include <asm/arch/irqs.h>
  22. #include <asm/mach/irq.h>
  23. #include <asm/mach/time.h>
  24. #include "common.h"
  25. /*
  26. * Timer interrupt handler
  27. */
  28. static irqreturn_t
  29. h7201_timer_interrupt(int irq, void *dev_id)
  30. {
  31. write_seqlock(&xtime_lock);
  32. CPU_REG (TIMER_VIRT, TIMER_TOPSTAT);
  33. timer_tick();
  34. write_sequnlock(&xtime_lock);
  35. return IRQ_HANDLED;
  36. }
  37. static struct irqaction h7201_timer_irq = {
  38. .name = "h7201 Timer Tick",
  39. .flags = IRQF_DISABLED | IRQF_TIMER,
  40. .handler = h7201_timer_interrupt,
  41. };
  42. /*
  43. * Setup TIMER0 as system timer
  44. */
  45. void __init h7201_init_time(void)
  46. {
  47. CPU_REG (TIMER_VIRT, TM0_PERIOD) = LATCH;
  48. CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_RESET;
  49. CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_REPEAT | TM_START;
  50. CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) = ENABLE_TM0_INTR | TIMER_ENABLE_BIT;
  51. setup_irq(IRQ_TIMER0, &h7201_timer_irq);
  52. }
  53. struct sys_timer h7201_timer = {
  54. .init = h7201_init_time,
  55. .offset = h720x_gettimeoffset,
  56. };