Fabrice Gasnier | a466ece | 2018-07-24 16:31:31 +0200 | [diff] [blame] | 1 | /* 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 | |
Fabrice Gasnier | a466ece | 2018-07-24 16:31:31 +0200 | [diff] [blame] | 29 | #include <clk.h> |
Simon Glass | c273da0 | 2020-07-19 10:15:52 -0600 | [diff] [blame] | 30 | |
| 31 | struct udevice; |
Fabrice Gasnier | a466ece | 2018-07-24 16:31:31 +0200 | [diff] [blame] | 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 | */ |
| 42 | struct 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 |