mtu.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * (C) Copyright 2009 Alessandro Rubini
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #ifndef __ASM_ARCH_MTU_H
  23. #define __ASM_ARCH_MTU_H
  24. /*
  25. * The MTU device hosts four different counters, with 4 set of
  26. * registers. These are register names.
  27. */
  28. #define MTU_IMSC 0x00 /* Interrupt mask set/clear */
  29. #define MTU_RIS 0x04 /* Raw interrupt status */
  30. #define MTU_MIS 0x08 /* Masked interrupt status */
  31. #define MTU_ICR 0x0C /* Interrupt clear register */
  32. /* per-timer registers take 0..3 as argument */
  33. #define MTU_LR(x) (0x10 + 0x10 * (x) + 0x00) /* Load value */
  34. #define MTU_VAL(x) (0x10 + 0x10 * (x) + 0x04) /* Current value */
  35. #define MTU_CR(x) (0x10 + 0x10 * (x) + 0x08) /* Control reg */
  36. #define MTU_BGLR(x) (0x10 + 0x10 * (x) + 0x0c) /* At next overflow */
  37. /* bits for the control register */
  38. #define MTU_CRn_ENA 0x80
  39. #define MTU_CRn_PERIODIC 0x40 /* if 0 = free-running */
  40. #define MTU_CRn_PRESCALE_MASK 0x0c
  41. #define MTU_CRn_PRESCALE_1 0x00
  42. #define MTU_CRn_PRESCALE_16 0x04
  43. #define MTU_CRn_PRESCALE_256 0x08
  44. #define MTU_CRn_32BITS 0x02
  45. #define MTU_CRn_ONESHOT 0x01 /* if 0 = wraps reloading from BGLR*/
  46. /* Other registers are usual amba/primecell registers, currently not used */
  47. #define MTU_ITCR 0xff0
  48. #define MTU_ITOP 0xff4
  49. #define MTU_PERIPH_ID0 0xfe0
  50. #define MTU_PERIPH_ID1 0xfe4
  51. #define MTU_PERIPH_ID2 0xfe8
  52. #define MTU_PERIPH_ID3 0xfeC
  53. #define MTU_PCELL0 0xff0
  54. #define MTU_PCELL1 0xff4
  55. #define MTU_PCELL2 0xff8
  56. #define MTU_PCELL3 0xffC
  57. #endif /* __ASM_ARCH_MTU_H */