spr_gpt.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * (C) Copyright 2009
  3. * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef _SPR_GPT_H
  24. #define _SPR_GPT_H
  25. struct gpt_regs {
  26. u8 reserved[0x80];
  27. u32 control;
  28. u32 status;
  29. u32 compare;
  30. u32 count;
  31. u32 capture_re;
  32. u32 capture_fe;
  33. };
  34. /*
  35. * TIMER_CONTROL register settings
  36. */
  37. #define GPT_PRESCALER_MASK 0x000F
  38. #define GPT_PRESCALER_1 0x0000
  39. #define GPT_PRESCALER_2 0x0001
  40. #define GPT_PRESCALER_4 0x0002
  41. #define GPT_PRESCALER_8 0x0003
  42. #define GPT_PRESCALER_16 0x0004
  43. #define GPT_PRESCALER_32 0x0005
  44. #define GPT_PRESCALER_64 0x0006
  45. #define GPT_PRESCALER_128 0x0007
  46. #define GPT_PRESCALER_256 0x0008
  47. #define GPT_MODE_SINGLE_SHOT 0x0010
  48. #define GPT_MODE_AUTO_RELOAD 0x0000
  49. #define GPT_ENABLE 0x0020
  50. #define GPT_CAPT_MODE_MASK 0x00C0
  51. #define GPT_CAPT_MODE_NONE 0x0000
  52. #define GPT_CAPT_MODE_RE 0x0040
  53. #define GPT_CAPT_MODE_FE 0x0080
  54. #define GPT_CAPT_MODE_BOTH 0x00C0
  55. #define GPT_INT_MATCH 0x0100
  56. #define GPT_INT_FE 0x0200
  57. #define GPT_INT_RE 0x0400
  58. /*
  59. * TIMER_STATUS register settings
  60. */
  61. #define GPT_STS_MATCH 0x0001
  62. #define GPT_STS_FE 0x0002
  63. #define GPT_STS_RE 0x0004
  64. /*
  65. * TIMER_COMPARE register settings
  66. */
  67. #define GPT_FREE_RUNNING 0xFFFF
  68. /* Timer, HZ specific defines */
  69. #define CONFIG_SPEAR_HZ (1000)
  70. #define CONFIG_SPEAR_HZ_CLOCK (8300000)
  71. #endif