0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LINUX_STM32_LPTIMER_H_
0010 #define _LINUX_STM32_LPTIMER_H_
0011
0012 #include <linux/clk.h>
0013 #include <linux/regmap.h>
0014
0015 #define STM32_LPTIM_ISR 0x00
0016 #define STM32_LPTIM_ICR 0x04
0017 #define STM32_LPTIM_IER 0x08
0018 #define STM32_LPTIM_CFGR 0x0C
0019 #define STM32_LPTIM_CR 0x10
0020 #define STM32_LPTIM_CMP 0x14
0021 #define STM32_LPTIM_ARR 0x18
0022 #define STM32_LPTIM_CNT 0x1C
0023
0024
0025 #define STM32_LPTIM_CMPOK_ARROK GENMASK(4, 3)
0026 #define STM32_LPTIM_ARROK BIT(4)
0027 #define STM32_LPTIM_CMPOK BIT(3)
0028
0029
0030 #define STM32_LPTIM_ARRMCF BIT(1)
0031 #define STM32_LPTIM_CMPOKCF_ARROKCF GENMASK(4, 3)
0032
0033
0034 #define STM32_LPTIM_ARRMIE BIT(1)
0035
0036
0037 #define STM32_LPTIM_CNTSTRT BIT(2)
0038 #define STM32_LPTIM_SNGSTRT BIT(1)
0039 #define STM32_LPTIM_ENABLE BIT(0)
0040
0041
0042 #define STM32_LPTIM_ENC BIT(24)
0043 #define STM32_LPTIM_COUNTMODE BIT(23)
0044 #define STM32_LPTIM_WAVPOL BIT(21)
0045 #define STM32_LPTIM_PRESC GENMASK(11, 9)
0046 #define STM32_LPTIM_CKPOL GENMASK(2, 1)
0047
0048
0049 #define STM32_LPTIM_CKPOL_RISING_EDGE 0
0050 #define STM32_LPTIM_CKPOL_FALLING_EDGE 1
0051 #define STM32_LPTIM_CKPOL_BOTH_EDGES 2
0052
0053
0054 #define STM32_LPTIM_MAX_ARR 0xFFFF
0055
0056
0057
0058
0059
0060
0061
0062 struct stm32_lptimer {
0063 struct clk *clk;
0064 struct regmap *regmap;
0065 bool has_encoder;
0066 };
0067
0068 #endif