imx8_lpuart.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef IMX8_LPUART_H
  7. #define IMX8_LPUART_H
  8. #include <drivers/console.h>
  9. #define VERID 0x0
  10. #define PARAM 0x4
  11. #define GLOBAL 0x8
  12. #define PINCFG 0xC
  13. #define BAUD 0x10
  14. #define STAT 0x14
  15. #define CTRL 0x18
  16. #define DATA 0x1C
  17. #define MATCH 0x20
  18. #define MODIR 0x24
  19. #define FIFO 0x28
  20. #define WATER 0x2c
  21. #define US1_TDRE (1 << 23)
  22. #define US1_RDRF (1 << 21)
  23. #define CTRL_TE (1 << 19)
  24. #define CTRL_RE (1 << 18)
  25. #define FIFO_TXFE 0x80
  26. #define FIFO_RXFE 0x40
  27. #define WATER_TXWATER_OFF 1
  28. #define WATER_RXWATER_OFF 16
  29. #define LPUART_CTRL_PT_MASK 0x1
  30. #define LPUART_CTRL_PE_MASK 0x2
  31. #define LPUART_CTRL_M_MASK 0x10
  32. #define LPUART_BAUD_OSR_MASK (0x1F000000U)
  33. #define LPUART_BAUD_OSR_SHIFT (24U)
  34. #define LPUART_BAUD_OSR(x) (((uint32_t)(((uint32_t)(x)) << LPUART_BAUD_OSR_SHIFT)) & LPUART_BAUD_OSR_MASK)
  35. #define LPUART_BAUD_SBR_MASK (0x1FFFU)
  36. #define LPUART_BAUD_SBR_SHIFT (0U)
  37. #define LPUART_BAUD_SBR(x) (((uint32_t)(((uint32_t)(x)) << LPUART_BAUD_SBR_SHIFT)) & LPUART_BAUD_SBR_MASK)
  38. #define LPUART_BAUD_SBNS_MASK (0x2000U)
  39. #define LPUART_BAUD_BOTHEDGE_MASK (0x20000U)
  40. #define LPUART_BAUD_M10_MASK (0x20000000U)
  41. #ifndef __ASSEMBLER__
  42. #include <stdint.h>
  43. int console_lpuart_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
  44. console_t *console);
  45. #endif /*__ASSEMBLER__*/
  46. #endif /* IMX8_LPUART_H */