xref: /openbmc/linux/drivers/iio/adc/stm32-adc-core.h (revision 95e339b6)
1 /*
2  * This file is part of STM32 ADC driver
3  *
4  * Copyright (C) 2016, STMicroelectronics - All Rights Reserved
5  * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
6  *
7  * License type: GPLv2
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License version 2 as published by
11  * the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along with
19  * this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __STM32_ADC_H
23 #define __STM32_ADC_H
24 
25 /*
26  * STM32 - ADC global register map
27  * ________________________________________________________
28  * | Offset |                 Register                    |
29  * --------------------------------------------------------
30  * | 0x000  |                Master ADC1                  |
31  * --------------------------------------------------------
32  * | 0x100  |                Slave ADC2                   |
33  * --------------------------------------------------------
34  * | 0x200  |                Slave ADC3                   |
35  * --------------------------------------------------------
36  * | 0x300  |         Master & Slave common regs          |
37  * --------------------------------------------------------
38  */
39 #define STM32_ADC_MAX_ADCS		3
40 #define STM32_ADCX_COMN_OFFSET		0x300
41 
42 /**
43  * struct stm32_adc_common - stm32 ADC driver common data (for all instances)
44  * @base:		control registers base cpu addr
45  * @phys_base:		control registers base physical addr
46  * @rate:		clock rate used for analog circuitry
47  * @vref_mv:		vref voltage (mv)
48  */
49 struct stm32_adc_common {
50 	void __iomem			*base;
51 	phys_addr_t			phys_base;
52 	unsigned long			rate;
53 	int				vref_mv;
54 };
55 
56 #endif
57