stm32-adc-core.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  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. #ifndef __STM32_ADC_H
  22. #define __STM32_ADC_H
  23. /*
  24. * STM32 - ADC global register map
  25. * ________________________________________________________
  26. * | Offset | Register |
  27. * --------------------------------------------------------
  28. * | 0x000 | Master ADC1 |
  29. * --------------------------------------------------------
  30. * | 0x100 | Slave ADC2 |
  31. * --------------------------------------------------------
  32. * | 0x200 | Slave ADC3 |
  33. * --------------------------------------------------------
  34. * | 0x300 | Master & Slave common regs |
  35. * --------------------------------------------------------
  36. */
  37. #define STM32_ADC_MAX_ADCS 3
  38. #define STM32_ADCX_COMN_OFFSET 0x300
  39. /**
  40. * struct stm32_adc_common - stm32 ADC driver common data (for all instances)
  41. * @base: control registers base cpu addr
  42. * @phys_base: control registers base physical addr
  43. * @rate: clock rate used for analog circuitry
  44. * @vref_mv: vref voltage (mv)
  45. */
  46. struct stm32_adc_common {
  47. void __iomem *base;
  48. phys_addr_t phys_base;
  49. unsigned long rate;
  50. int vref_mv;
  51. };
  52. #endif