renesas-scif.S 899 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Renesas SCIF(A) debugging macro include header
  4. *
  5. * Based on r8a7790.S
  6. *
  7. * Copyright (C) 2012-2013 Renesas Electronics Corporation
  8. * Copyright (C) 1994-1999 Russell King
  9. */
  10. #define SCIF_PHYS CONFIG_DEBUG_UART_PHYS
  11. #define SCIF_VIRT ((SCIF_PHYS & 0x00ffffff) | 0xfd000000)
  12. #if CONFIG_DEBUG_UART_PHYS < 0xe6e00000
  13. /* SCIFA */
  14. #define FTDR 0x20
  15. #define FSR 0x14
  16. #else
  17. /* SCIF */
  18. #define FTDR 0x0c
  19. #define FSR 0x10
  20. #endif
  21. #define TDFE (1 << 5)
  22. #define TEND (1 << 6)
  23. .macro addruart, rp, rv, tmp
  24. ldr \rp, =SCIF_PHYS
  25. ldr \rv, =SCIF_VIRT
  26. .endm
  27. .macro waituart, rd, rx
  28. 1001: ldrh \rd, [\rx, #FSR]
  29. tst \rd, #TDFE
  30. beq 1001b
  31. .endm
  32. .macro senduart, rd, rx
  33. strb \rd, [\rx, #FTDR]
  34. ldrh \rd, [\rx, #FSR]
  35. bic \rd, \rd, #TEND
  36. strh \rd, [\rx, #FSR]
  37. .endm
  38. .macro busyuart, rd, rx
  39. 1001: ldrh \rd, [\rx, #FSR]
  40. tst \rd, #TEND
  41. beq 1001b
  42. .endm