/kern_oII/arch/arm/mach-w90x900/time.c

http://omnia2droid.googlecode.com/ · C · 79 lines · 50 code · 11 blank · 18 comment · 0 complexity · c9b850632809ee6b2dee7509dc10cfb6 MD5 · raw file

  1. /*
  2. * linux/arch/arm/mach-w90x900/time.c
  3. *
  4. * Based on linux/arch/arm/plat-s3c24xx/time.c by Ben Dooks
  5. *
  6. * Copyright (c) 2008 Nuvoton technology corporation
  7. * All rights reserved.
  8. *
  9. * Wan ZongShun <mcuos.com@gmail.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/sched.h>
  19. #include <linux/init.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/err.h>
  22. #include <linux/clk.h>
  23. #include <linux/io.h>
  24. #include <linux/leds.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/mach/irq.h>
  27. #include <asm/mach/time.h>
  28. #include <mach/map.h>
  29. #include <mach/regs-timer.h>
  30. static unsigned long w90x900_gettimeoffset(void)
  31. {
  32. return 0;
  33. }
  34. /*IRQ handler for the timer*/
  35. static irqreturn_t
  36. w90x900_timer_interrupt(int irq, void *dev_id)
  37. {
  38. timer_tick();
  39. __raw_writel(0x01, REG_TISR); /* clear TIF0 */
  40. return IRQ_HANDLED;
  41. }
  42. static struct irqaction w90x900_timer_irq = {
  43. .name = "w90x900 Timer Tick",
  44. .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
  45. .handler = w90x900_timer_interrupt,
  46. };
  47. /*Set up timer reg.*/
  48. static void w90x900_timer_setup(void)
  49. {
  50. __raw_writel(0, REG_TCSR0);
  51. __raw_writel(0, REG_TCSR1);
  52. __raw_writel(0, REG_TCSR2);
  53. __raw_writel(0, REG_TCSR3);
  54. __raw_writel(0, REG_TCSR4);
  55. __raw_writel(0x1F, REG_TISR);
  56. __raw_writel(15000000/(100 * 100), REG_TICR0);
  57. __raw_writel(0x68000063, REG_TCSR0);
  58. }
  59. static void __init w90x900_timer_init(void)
  60. {
  61. w90x900_timer_setup();
  62. setup_irq(IRQ_TIMER0, &w90x900_timer_irq);
  63. }
  64. struct sys_timer w90x900_timer = {
  65. .init = w90x900_timer_init,
  66. .offset = w90x900_gettimeoffset,
  67. .resume = w90x900_timer_setup
  68. };