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 
24 #ifndef _SPR_GPT_H
25 #define _SPR_GPT_H
26 
27 struct gpt_regs {
28 	u8 reserved[0x80];
29 	u32 control;
30 	u32 status;
31 	u32 compare;
32 	u32 count;
33 	u32 capture_re;
34 	u32 capture_fe;
35 };
36 
37 /*
38  * TIMER_CONTROL register settings
39  */
40 
41 #define GPT_PRESCALER_MASK		0x000F
42 #define GPT_PRESCALER_1			0x0000
43 #define GPT_PRESCALER_2 		0x0001
44 #define GPT_PRESCALER_4 		0x0002
45 #define GPT_PRESCALER_8 		0x0003
46 #define GPT_PRESCALER_16		0x0004
47 #define GPT_PRESCALER_32		0x0005
48 #define GPT_PRESCALER_64		0x0006
49 #define GPT_PRESCALER_128		0x0007
50 #define GPT_PRESCALER_256		0x0008
51 
52 #define GPT_MODE_SINGLE_SHOT		0x0010
53 #define GPT_MODE_AUTO_RELOAD		0x0000
54 
55 #define GPT_ENABLE			0x0020
56 
57 #define GPT_CAPT_MODE_MASK		0x00C0
58 #define GPT_CAPT_MODE_NONE		0x0000
59 #define GPT_CAPT_MODE_RE		0x0040
60 #define GPT_CAPT_MODE_FE		0x0080
61 #define GPT_CAPT_MODE_BOTH		0x00C0
62 
63 #define GPT_INT_MATCH			0x0100
64 #define GPT_INT_FE			0x0200
65 #define GPT_INT_RE			0x0400
66 
67 /*
68  * TIMER_STATUS register settings
69  */
70 
71 #define GPT_STS_MATCH			0x0001
72 #define GPT_STS_FE			0x0002
73 #define GPT_STS_RE			0x0004
74 
75 /*
76  * TIMER_COMPARE register settings
77  */
78 
79 #define GPT_FREE_RUNNING		0xFFFF
80 
81 /* Timer, HZ specific defines */
82 #define CONFIG_SPEAR_HZ			1000
83 #define CONFIG_SPEAR_HZ_CLOCK		8300000
84 
85 #endif
86