xref: /freebsd/sys/arm/ti/ti_adcreg.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1855feb68SLuiz Otavio O Souza /*-
2855feb68SLuiz Otavio O Souza  * Copyright 2014 Luiz Otavio O Souza <loos@freebsd.org>
3855feb68SLuiz Otavio O Souza  * All rights reserved.
4855feb68SLuiz Otavio O Souza  *
5855feb68SLuiz Otavio O Souza  * Redistribution and use in source and binary forms, with or without
6855feb68SLuiz Otavio O Souza  * modification, are permitted provided that the following conditions
7855feb68SLuiz Otavio O Souza  * are met:
8855feb68SLuiz Otavio O Souza  * 1. Redistributions of source code must retain the above copyright
9855feb68SLuiz Otavio O Souza  *    notice, this list of conditions and the following disclaimer.
10855feb68SLuiz Otavio O Souza  * 2. Redistributions in binary form must reproduce the above copyright
11855feb68SLuiz Otavio O Souza  *    notice, this list of conditions and the following disclaimer in the
12855feb68SLuiz Otavio O Souza  *    documentation and/or other materials provided with the distribution.
13855feb68SLuiz Otavio O Souza  *
14855feb68SLuiz Otavio O Souza  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15855feb68SLuiz Otavio O Souza  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16855feb68SLuiz Otavio O Souza  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17855feb68SLuiz Otavio O Souza  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18855feb68SLuiz Otavio O Souza  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19855feb68SLuiz Otavio O Souza  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20855feb68SLuiz Otavio O Souza  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21855feb68SLuiz Otavio O Souza  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22855feb68SLuiz Otavio O Souza  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23855feb68SLuiz Otavio O Souza  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24855feb68SLuiz Otavio O Souza  * SUCH DAMAGE.
25855feb68SLuiz Otavio O Souza  */
26855feb68SLuiz Otavio O Souza 
27855feb68SLuiz Otavio O Souza #ifndef _TI_ADCREG_H_
28855feb68SLuiz Otavio O Souza #define _TI_ADCREG_H_
29855feb68SLuiz Otavio O Souza 
30855feb68SLuiz Otavio O Souza #define	ADC_REVISION		0x000
31855feb68SLuiz Otavio O Souza #define	ADC_REV_SCHEME_MSK		0xc0000000
32855feb68SLuiz Otavio O Souza #define	ADC_REV_SCHEME_SHIFT		30
33855feb68SLuiz Otavio O Souza #define	ADC_REV_FUNC_MSK		0x0fff0000
34855feb68SLuiz Otavio O Souza #define	ADC_REV_FUNC_SHIFT		16
35855feb68SLuiz Otavio O Souza #define	ADC_REV_RTL_MSK			0x0000f800
36855feb68SLuiz Otavio O Souza #define	ADC_REV_RTL_SHIFT		11
37855feb68SLuiz Otavio O Souza #define	ADC_REV_MAJOR_MSK		0x00000700
38855feb68SLuiz Otavio O Souza #define	ADC_REV_MAJOR_SHIFT		8
39855feb68SLuiz Otavio O Souza #define	ADC_REV_CUSTOM_MSK		0x000000c0
40855feb68SLuiz Otavio O Souza #define	ADC_REV_CUSTOM_SHIFT		6
41855feb68SLuiz Otavio O Souza #define	ADC_REV_MINOR_MSK		0x0000003f
42855feb68SLuiz Otavio O Souza #define	ADC_SYSCFG		0x010
43855feb68SLuiz Otavio O Souza #define	ADC_SYSCFG_IDLE_MSK		0x000000c0
44855feb68SLuiz Otavio O Souza #define	ADC_SYSCFG_IDLE_SHIFT		2
45855feb68SLuiz Otavio O Souza #define	ADC_IRQSTATUS_RAW	0x024
46855feb68SLuiz Otavio O Souza #define	ADC_IRQSTATUS		0x028
47855feb68SLuiz Otavio O Souza #define	ADC_IRQENABLE_SET	0x02c
48855feb68SLuiz Otavio O Souza #define	ADC_IRQENABLE_CLR	0x030
49855feb68SLuiz Otavio O Souza #define	ADC_IRQ_HW_PEN_SYNC		(1 << 10)
50855feb68SLuiz Otavio O Souza #define	ADC_IRQ_PEN_UP			(1 << 9)
51855feb68SLuiz Otavio O Souza #define	ADC_IRQ_OUT_RANGE		(1 << 8)
52855feb68SLuiz Otavio O Souza #define	ADC_IRQ_FIFO1_UNDR		(1 << 7)
53855feb68SLuiz Otavio O Souza #define	ADC_IRQ_FIFO1_OVERR		(1 << 6)
54855feb68SLuiz Otavio O Souza #define	ADC_IRQ_FIFO1_THRES		(1 << 5)
55855feb68SLuiz Otavio O Souza #define	ADC_IRQ_FIFO0_UNDR		(1 << 4)
56855feb68SLuiz Otavio O Souza #define	ADC_IRQ_FIFO0_OVERR		(1 << 3)
57855feb68SLuiz Otavio O Souza #define	ADC_IRQ_FIFO0_THRES		(1 << 2)
58855feb68SLuiz Otavio O Souza #define	ADC_IRQ_END_OF_SEQ		(1 << 1)
59855feb68SLuiz Otavio O Souza #define	ADC_IRQ_HW_PEN_ASYNC		(1 << 0)
60855feb68SLuiz Otavio O Souza #define	ADC_CTRL		0x040
61651f7544SOleksandr Tymoshenko #define	ADC_CTRL_TSC_ENABLE		(1 << 7)
62651f7544SOleksandr Tymoshenko #define	ADC_CTRL_TSC_4WIRE		(1 << 5)
63651f7544SOleksandr Tymoshenko #define	ADC_CTRL_TSC_5WIRE		(2 << 5)
64651f7544SOleksandr Tymoshenko #define	ADC_CTRL_TSC_8WIRE		(3 << 5)
65855feb68SLuiz Otavio O Souza #define	ADC_CTRL_STEP_WP		(1 << 2)
66855feb68SLuiz Otavio O Souza #define	ADC_CTRL_STEP_ID		(1 << 1)
67855feb68SLuiz Otavio O Souza #define	ADC_CTRL_ENABLE			(1 << 0)
68855feb68SLuiz Otavio O Souza #define	ADC_STAT		0x044
69855feb68SLuiz Otavio O Souza #define	ADC_CLKDIV		0x04c
70855feb68SLuiz Otavio O Souza #define	ADC_STEPENABLE		0x054
71855feb68SLuiz Otavio O Souza #define	ADC_IDLECONFIG		0x058
72651f7544SOleksandr Tymoshenko #define	ADC_TC_CHARGE_STEPCONFIG	0x05C
73651f7544SOleksandr Tymoshenko #define	ADC_TC_CHARGE_DELAY		0x060
74651f7544SOleksandr Tymoshenko #define	ADC_STEPS		16
75651f7544SOleksandr Tymoshenko #define	ADC_STEPCFG(n)		(0x064 + (8*((n)-1)))
76651f7544SOleksandr Tymoshenko #define	ADC_STEPDLY(n)		(0x068 + (8*((n)-1)))
77651f7544SOleksandr Tymoshenko #define	ADC_STEP_FIFO1			(1 << 26)
78855feb68SLuiz Otavio O Souza #define	ADC_STEP_DIFF_CNTRL		(1 << 25)
79855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFM_MSK		0x01800000
80855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFM_SHIFT		23
81855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFM_VSSA		0
82855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFM_XNUR		1
83855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFM_YNLR		2
84855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFM_VREFN		3
85855feb68SLuiz Otavio O Souza #define	ADC_STEP_INP_MSK		0x00780000
86855feb68SLuiz Otavio O Souza #define	ADC_STEP_INP_SHIFT		19
87651f7544SOleksandr Tymoshenko #define	ADC_STEP_INP(i)			((i) << ADC_STEP_INP_SHIFT)
88855feb68SLuiz Otavio O Souza #define	ADC_STEP_INM_MSK		0x00078000
89855feb68SLuiz Otavio O Souza #define	ADC_STEP_INM_SHIFT		15
90651f7544SOleksandr Tymoshenko #define	ADC_STEP_INM(i)			((i) << ADC_STEP_INM_SHIFT)
91855feb68SLuiz Otavio O Souza #define	ADC_STEP_IN_VREFN		8
92855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFP_MSK		0x00007000
93855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFP_SHIFT		12
94855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFP_VDDA		0
95855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFP_XPUL		1
96855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFP_YPLL		2
97855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFP_VREFP		3
98855feb68SLuiz Otavio O Souza #define	ADC_STEP_RFP_INTREF		4
99651f7544SOleksandr Tymoshenko #define	ADC_STEP_YPN_SW			(1 << 10)
100651f7544SOleksandr Tymoshenko #define	ADC_STEP_YNN_SW			(1 << 8)
101651f7544SOleksandr Tymoshenko #define	ADC_STEP_YPP_SW			(1 << 7)
102651f7544SOleksandr Tymoshenko #define	ADC_STEP_XNN_SW			(1 << 6)
103651f7544SOleksandr Tymoshenko #define	ADC_STEP_XPP_SW			(1 << 5)
104855feb68SLuiz Otavio O Souza #define	ADC_STEP_AVG_MSK		0x0000001c
105855feb68SLuiz Otavio O Souza #define	ADC_STEP_AVG_SHIFT		2
106855feb68SLuiz Otavio O Souza #define	ADC_STEP_MODE_MSK		0x00000003
107855feb68SLuiz Otavio O Souza #define	ADC_STEP_MODE_ONESHOT		0x00000000
108855feb68SLuiz Otavio O Souza #define	ADC_STEP_MODE_CONTINUOUS	0x00000001
109651f7544SOleksandr Tymoshenko #define	ADC_STEP_MODE_HW_ONESHOT	0x00000002
110651f7544SOleksandr Tymoshenko #define	ADC_STEP_MODE_HW_CONTINUOUS	0x00000003
111855feb68SLuiz Otavio O Souza #define	ADC_STEP_SAMPLE_DELAY		0xff000000
112855feb68SLuiz Otavio O Souza #define	ADC_STEP_OPEN_DELAY		0x0003ffff
113855feb68SLuiz Otavio O Souza #define	ADC_FIFO0COUNT		0x0e4
114855feb68SLuiz Otavio O Souza #define	ADC_FIFO0THRESHOLD	0x0e8
115651f7544SOleksandr Tymoshenko #define	ADC_FIFO1COUNT		0x0f0
116651f7544SOleksandr Tymoshenko #define	ADC_FIFO1THRESHOLD	0x0f4
117855feb68SLuiz Otavio O Souza #define	ADC_FIFO0DATA		0x100
118651f7544SOleksandr Tymoshenko #define	ADC_FIFO1DATA		0x200
119855feb68SLuiz Otavio O Souza #define	ADC_FIFO_COUNT_MSK		0x0000007f
120855feb68SLuiz Otavio O Souza #define	ADC_FIFO_STEP_ID_MSK		0x000f0000
121855feb68SLuiz Otavio O Souza #define	ADC_FIFO_STEP_ID_SHIFT		16
122855feb68SLuiz Otavio O Souza #define	ADC_FIFO_DATA_MSK		0x00000fff
123*fbeb453bSOleksandr Tymoshenko #define	ADC_MAX_VALUE		0xfff
124855feb68SLuiz Otavio O Souza 
125855feb68SLuiz Otavio O Souza #endif /* _TI_ADCREG_H_ */
126