timer.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * (C) Copyright 2007-2011
  3. * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
  4. * Tom Cubie <tangliang@allwinnertech.com>
  5. *
  6. * Configuration settings for the Allwinner A10-evb board.
  7. *
  8. * SPDX-License-Identifier: GPL-2.0+
  9. */
  10. #ifndef _SUNXI_TIMER_H_
  11. #define _SUNXI_TIMER_H_
  12. #ifndef __ASSEMBLY__
  13. #include <linux/types.h>
  14. #include <asm/arch/watchdog.h>
  15. /* General purpose timer */
  16. struct sunxi_timer {
  17. u32 ctl;
  18. u32 inter;
  19. u32 val;
  20. u8 res[4];
  21. };
  22. /* Audio video sync*/
  23. struct sunxi_avs {
  24. u32 ctl; /* 0x80 */
  25. u32 cnt0; /* 0x84 */
  26. u32 cnt1; /* 0x88 */
  27. u32 div; /* 0x8c */
  28. };
  29. /* 64 bit counter */
  30. struct sunxi_64cnt {
  31. u32 ctl; /* 0xa0 */
  32. u32 lo; /* 0xa4 */
  33. u32 hi; /* 0xa8 */
  34. };
  35. /* Rtc */
  36. struct sunxi_rtc {
  37. u32 ctl; /* 0x100 */
  38. u32 yymmdd; /* 0x104 */
  39. u32 hhmmss; /* 0x108 */
  40. };
  41. /* Alarm */
  42. struct sunxi_alarm {
  43. u32 ddhhmmss; /* 0x10c */
  44. u32 hhmmss; /* 0x110 */
  45. u32 en; /* 0x114 */
  46. u32 irqen; /* 0x118 */
  47. u32 irqsta; /* 0x11c */
  48. };
  49. /* Timer general purpose register */
  50. struct sunxi_tgp {
  51. u32 tgpd;
  52. };
  53. struct sunxi_timer_reg {
  54. u32 tirqen; /* 0x00 */
  55. u32 tirqsta; /* 0x04 */
  56. u8 res1[8];
  57. struct sunxi_timer timer[6]; /* We have 6 timers */
  58. u8 res2[16];
  59. struct sunxi_avs avs;
  60. #if defined(CONFIG_SUNXI_GEN_SUN4I) || defined(CONFIG_MACH_SUN8I_R40)
  61. struct sunxi_wdog wdog; /* 0x90 */
  62. /* XXX the following is not accurate for sun5i/sun7i */
  63. struct sunxi_64cnt cnt64; /* 0xa0 */
  64. u8 res4[0x58];
  65. struct sunxi_rtc rtc;
  66. struct sunxi_alarm alarm;
  67. struct sunxi_tgp tgp[4];
  68. u8 res5[8];
  69. u32 cpu_cfg;
  70. #elif defined(CONFIG_SUNXI_GEN_SUN6I)
  71. u8 res3[16];
  72. struct sunxi_wdog wdog[5]; /* We have 5 watchdogs */
  73. #endif
  74. };
  75. #endif /* __ASSEMBLY__ */
  76. #endif