blob: 250ee958a6695a605d0c06b8878104882b3d05b8 [file] [log] [blame]
Fabrice Gasnier1add69882016-11-15 16:30:57 +01001/*
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
Fabrice Gasnier2763ea02017-01-26 15:28:33 +010045 * @phys_base: control registers base physical addr
Fabrice Gasnier95e339b2017-05-29 11:28:20 +020046 * @rate: clock rate used for analog circuitry
Fabrice Gasnier1add69882016-11-15 16:30:57 +010047 * @vref_mv: vref voltage (mv)
48 */
49struct stm32_adc_common {
50 void __iomem *base;
Fabrice Gasnier2763ea02017-01-26 15:28:33 +010051 phys_addr_t phys_base;
Fabrice Gasnier95e339b2017-05-29 11:28:20 +020052 unsigned long rate;
Fabrice Gasnier1add69882016-11-15 16:30:57 +010053 int vref_mv;
54};
55
56#endif