blob: ba0e10e6cc271a15c64a7ffd578ac6b54c3887dc [file] [log] [blame]
Fabrice Gasnier5a1da382018-07-24 16:31:31 +02001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
4 * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
5 *
6 * Originally based on the Linux kernel v4.18 drivers/iio/adc/stm32-adc-core.h.
7 */
8
9#ifndef __STM32_ADC_H
10#define __STM32_ADC_H
11
12/*
13 * STM32 - ADC global register map
14 * ________________________________________________________
15 * | Offset | Register |
16 * --------------------------------------------------------
17 * | 0x000 | Master ADC1 |
18 * --------------------------------------------------------
19 * | 0x100 | Slave ADC2 |
20 * --------------------------------------------------------
21 * | 0x200 | Slave ADC3 |
22 * --------------------------------------------------------
23 * | 0x300 | Master & Slave common regs |
24 * --------------------------------------------------------
25 */
26#define STM32_ADC_MAX_ADCS 3
27#define STM32_ADCX_COMN_OFFSET 0x300
28
29#include <common.h>
30#include <clk.h>
31#include <dm.h>
32
33/**
34 * struct stm32_adc_common - stm32 ADC driver common data (for all instances)
35 * @base: control registers base cpu addr
36 * @rate: clock rate used for analog circuitry
37 * @aclk: clock for the analog circuitry
38 * @bclk: bus clock common for all ADCs
39 * @vref: regulator reference
40 * @vref_uv: reference supply voltage (uV)
41 */
42struct stm32_adc_common {
43 void __iomem *base;
44 unsigned long rate;
45 struct clk aclk;
46 struct clk bclk;
47 struct udevice *vref;
48 int vref_uv;
49};
50
51#endif