1 /*
2  * (C) Copyright 2014
3  * Vikas Manocha, ST Micoelectronics, vikas.manocha@st.com.
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #ifndef _STV0991_GPT_H
9 #define _STV0991_GPT_H
10 
11 #include <asm/arch-stv0991/hardware.h>
12 
13 struct gpt_regs {
14 	u32 cr1;
15 	u32 cr2;
16 	u32 reserved_1;
17 	u32 dier;	/* dma_int_en */
18 	u32 sr;		/* status reg */
19 	u32 egr;	/* event gen */
20 	u32 reserved_2[3];	/* offset 0x18--0x20*/
21 	u32 cnt;
22 	u32 psc;
23 	u32 arr;
24 };
25 
26 struct gpt_regs *const gpt1_regs_ptr =
27 	(struct gpt_regs *) GPTIMER1_BASE_ADDR;
28 
29 /* Timer control1 register  */
30 #define GPT_CR1_CEN			0x0001
31 #define GPT_MODE_AUTO_RELOAD		(1 << 7)
32 
33 /* Timer prescalar reg */
34 #define GPT_PRESCALER_128		0x128
35 
36 /* Auto reload register for free running config */
37 #define GPT_FREE_RUNNING		0xFFFF
38 
39 /* Timer, HZ specific defines */
40 #define CONFIG_STV0991_HZ		1000
41 #define CONFIG_STV0991_HZ_CLOCK		(27*1000*1000)/GPT_PRESCALER_128
42 
43 #endif
44