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