blob: 8af507b3f32d914d70307bfff7e8819b4284581d [file] [log] [blame]
Benjamin Gaignard6e93e262017-12-05 15:55:59 +01001/* SPDX-License-Identifier: GPL-2.0 */
Fabrice Gasnier1add69882016-11-15 16:30:57 +01002/*
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 *
Fabrice Gasnier1add69882016-11-15 16:30:57 +01008 */
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
Fabrice Gasnier2763ea02017-01-26 15:28:33 +010033 * @phys_base: control registers base physical addr
Fabrice Gasnier95e339b2017-05-29 11:28:20 +020034 * @rate: clock rate used for analog circuitry
Fabrice Gasnier1add69882016-11-15 16:30:57 +010035 * @vref_mv: vref voltage (mv)
36 */
37struct stm32_adc_common {
38 void __iomem *base;
Fabrice Gasnier2763ea02017-01-26 15:28:33 +010039 phys_addr_t phys_base;
Fabrice Gasnier95e339b2017-05-29 11:28:20 +020040 unsigned long rate;
Fabrice Gasnier1add69882016-11-15 16:30:57 +010041 int vref_mv;
42};
43
44#endif