SPDX: Convert all of our single license tags to Linux Kernel style
[oweals/u-boot.git] / arch / arm / mach-exynos / include / mach / adc.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  *  Copyright (C) 2010 Samsung Electronics
4  *  Minkyu Kang <mk7.kang@samsung.com>
5  *  MyungJoo Ham <myungjoo.ham@samsung.com>
6  */
7
8 #ifndef __ASM_ARM_ARCH_ADC_H_
9 #define __ASM_ARM_ARCH_ADC_H_
10
11 #define ADC_V2_CON1_SOFT_RESET          (0x2 << 1)
12 #define ADC_V2_CON1_STC_EN              0x1
13
14 #define ADC_V2_CON2_OSEL(x)             (((x) & 0x1) << 10)
15 #define OSEL_2S                         0x0
16 #define OSEL_BINARY                     0x1
17 #define ADC_V2_CON2_ESEL(x)             (((x) & 0x1) << 9)
18 #define ESEL_ADC_EVAL_TIME_40CLK        0x0
19 #define ESEL_ADC_EVAL_TIME_20CLK        0x1
20 #define ADC_V2_CON2_HIGHF(x)            (((x) & 0x1) << 8)
21 #define HIGHF_CONV_RATE_30KSPS          0x0
22 #define HIGHF_CONV_RATE_600KSPS         0x1
23 #define ADC_V2_CON2_C_TIME(x)           (((x) & 0x7) << 4)
24 #define ADC_V2_CON2_CHAN_SEL_MASK       0xf
25 #define ADC_V2_CON2_CHAN_SEL(x)         ((x) & ADC_V2_CON2_CHAN_SEL_MASK)
26
27 #define ADC_V2_GET_STATUS_FLAG(x)       (((x) >> 2) & 0x1)
28 #define FLAG_CONV_END                   0x1
29
30 #define ADC_V2_INT_DISABLE              0x0
31 #define ADC_V2_INT_ENABLE               0x1
32 #define INT_NOT_GENERATED               0x0
33 #define INT_GENERATED                   0x1
34
35 #define ADC_V2_VERSION                  0x80000008
36
37 #define ADC_V2_MAX_CHANNEL              9
38
39 /* For default 8 time convertion with sample rate 600 kSPS - 15us timeout */
40 #define ADC_V2_CONV_TIMEOUT_US          15
41
42 #define ADC_V2_DAT_MASK                 0xfff
43
44 #ifndef __ASSEMBLY__
45 struct s5p_adc {
46         unsigned int adccon;
47         unsigned int adctsc;
48         unsigned int adcdly;
49         unsigned int adcdat0;
50         unsigned int adcdat1;
51         unsigned int adcupdn;
52         unsigned int adcclrint;
53         unsigned int adcmux;
54         unsigned int adcclrintpndnup;
55 };
56
57 struct exynos_adc_v2 {
58         unsigned int con1;
59         unsigned int con2;
60         unsigned int status;
61         unsigned int dat;
62         unsigned int int_en;
63         unsigned int int_status;
64         unsigned int reserved[2];
65         unsigned int version;
66 };
67 #endif
68
69 #endif /* __ASM_ARM_ARCH_ADC_H_ */