xref: /openbmc/linux/drivers/iio/adc/stm32-adc-core.h (revision 3213486f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * This file is part of STM32 ADC driver
4  *
5  * Copyright (C) 2016, STMicroelectronics - All Rights Reserved
6  * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
7  *
8  */
9 
10 #ifndef __STM32_ADC_H
11 #define __STM32_ADC_H
12 
13 /*
14  * STM32 - ADC global register map
15  * ________________________________________________________
16  * | Offset |                 Register                    |
17  * --------------------------------------------------------
18  * | 0x000  |                Master ADC1                  |
19  * --------------------------------------------------------
20  * | 0x100  |                Slave ADC2                   |
21  * --------------------------------------------------------
22  * | 0x200  |                Slave ADC3                   |
23  * --------------------------------------------------------
24  * | 0x300  |         Master & Slave common regs          |
25  * --------------------------------------------------------
26  */
27 #define STM32_ADC_MAX_ADCS		3
28 #define STM32_ADCX_COMN_OFFSET		0x300
29 
30 /**
31  * struct stm32_adc_common - stm32 ADC driver common data (for all instances)
32  * @base:		control registers base cpu addr
33  * @phys_base:		control registers base physical addr
34  * @rate:		clock rate used for analog circuitry
35  * @vref_mv:		vref voltage (mv)
36  */
37 struct stm32_adc_common {
38 	void __iomem			*base;
39 	phys_addr_t			phys_base;
40 	unsigned long			rate;
41 	int				vref_mv;
42 };
43 
44 #endif
45