Vipin KUMAR | 7cb1635 | 2010-01-15 19:15:43 +0530 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2009 |
| 3 | * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com. |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Vipin KUMAR | 7cb1635 | 2010-01-15 19:15:43 +0530 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _SPR_GPT_H |
| 9 | #define _SPR_GPT_H |
| 10 | |
| 11 | struct gpt_regs { |
| 12 | u8 reserved[0x80]; |
| 13 | u32 control; |
| 14 | u32 status; |
| 15 | u32 compare; |
| 16 | u32 count; |
| 17 | u32 capture_re; |
| 18 | u32 capture_fe; |
| 19 | }; |
| 20 | |
| 21 | /* |
| 22 | * TIMER_CONTROL register settings |
| 23 | */ |
| 24 | |
| 25 | #define GPT_PRESCALER_MASK 0x000F |
| 26 | #define GPT_PRESCALER_1 0x0000 |
| 27 | #define GPT_PRESCALER_2 0x0001 |
| 28 | #define GPT_PRESCALER_4 0x0002 |
| 29 | #define GPT_PRESCALER_8 0x0003 |
| 30 | #define GPT_PRESCALER_16 0x0004 |
| 31 | #define GPT_PRESCALER_32 0x0005 |
| 32 | #define GPT_PRESCALER_64 0x0006 |
| 33 | #define GPT_PRESCALER_128 0x0007 |
| 34 | #define GPT_PRESCALER_256 0x0008 |
| 35 | |
| 36 | #define GPT_MODE_SINGLE_SHOT 0x0010 |
| 37 | #define GPT_MODE_AUTO_RELOAD 0x0000 |
| 38 | |
| 39 | #define GPT_ENABLE 0x0020 |
| 40 | |
| 41 | #define GPT_CAPT_MODE_MASK 0x00C0 |
| 42 | #define GPT_CAPT_MODE_NONE 0x0000 |
| 43 | #define GPT_CAPT_MODE_RE 0x0040 |
| 44 | #define GPT_CAPT_MODE_FE 0x0080 |
| 45 | #define GPT_CAPT_MODE_BOTH 0x00C0 |
| 46 | |
| 47 | #define GPT_INT_MATCH 0x0100 |
| 48 | #define GPT_INT_FE 0x0200 |
| 49 | #define GPT_INT_RE 0x0400 |
| 50 | |
| 51 | /* |
| 52 | * TIMER_STATUS register settings |
| 53 | */ |
| 54 | |
| 55 | #define GPT_STS_MATCH 0x0001 |
| 56 | #define GPT_STS_FE 0x0002 |
| 57 | #define GPT_STS_RE 0x0004 |
| 58 | |
| 59 | /* |
| 60 | * TIMER_COMPARE register settings |
| 61 | */ |
| 62 | |
| 63 | #define GPT_FREE_RUNNING 0xFFFF |
| 64 | |
| 65 | /* Timer, HZ specific defines */ |
Amit Virdi | 9ee8d63 | 2012-05-07 13:07:01 +0530 | [diff] [blame] | 66 | #define CONFIG_SPEAR_HZ 1000 |
| 67 | #define CONFIG_SPEAR_HZ_CLOCK 8300000 |
Vipin KUMAR | 7cb1635 | 2010-01-15 19:15:43 +0530 | [diff] [blame] | 68 | |
| 69 | #endif |