serial_stm32x7.h 829 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * (C) Copyright 2016
  3. * Vikas Manocha, <vikas.manocha@st.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef _SERIAL_STM32_X7_
  8. #define _SERIAL_STM32_X7_
  9. struct stm32_usart {
  10. u32 cr1;
  11. u32 cr2;
  12. u32 cr3;
  13. u32 brr;
  14. u32 gtpr;
  15. u32 rtor;
  16. u32 rqr;
  17. u32 sr;
  18. u32 icr;
  19. u32 rd_dr;
  20. u32 tx_dr;
  21. };
  22. /* Information about a serial port */
  23. struct stm32x7_serial_platdata {
  24. struct stm32_usart *base; /* address of registers in physical memory */
  25. unsigned long int clock_rate;
  26. };
  27. #define USART_CR1_OVER8 (1 << 15)
  28. #define USART_CR1_TE (1 << 3)
  29. #define USART_CR1_RE (1 << 2)
  30. #define USART_CR1_UE (1 << 0)
  31. #define USART_CR3_OVRDIS (1 << 12)
  32. #define USART_SR_FLAG_RXNE (1 << 5)
  33. #define USART_SR_FLAG_TXE (1 << 7)
  34. #define USART_BRR_F_MASK 0xFF
  35. #define USART_BRR_M_SHIFT 4
  36. #define USART_BRR_M_MASK 0xFFF0
  37. #endif