sa1100.S 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* arch/arm/include/debug/sa1100.S
  3. *
  4. * Debugging macro include header
  5. *
  6. * Copyright (C) 1994-1999 Russell King
  7. * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
  8. */
  9. #define UTCR3 0x0c
  10. #define UTDR 0x14
  11. #define UTSR1 0x20
  12. #define UTCR3_TXE 0x00000002 /* Transmit Enable */
  13. #define UTSR1_TBY 0x00000001 /* Transmitter BusY (read) */
  14. #define UTSR1_TNF 0x00000004 /* Transmit FIFO Not Full (read) */
  15. .macro addruart, rp, rv, tmp
  16. mrc p15, 0, \rp, c1, c0
  17. tst \rp, #1 @ MMU enabled?
  18. moveq \rp, #0x80000000 @ physical base address
  19. movne \rp, #0xf8000000 @ virtual address
  20. @ We probe for the active serial port here, coherently with
  21. @ the comment in arch/arm/mach-sa1100/include/mach/uncompress.h.
  22. @ We assume r1 can be clobbered.
  23. @ see if Ser3 is active
  24. add \rp, \rp, #0x00050000
  25. ldr \rv, [\rp, #UTCR3]
  26. tst \rv, #UTCR3_TXE
  27. @ if Ser3 is inactive, then try Ser1
  28. addeq \rp, \rp, #(0x00010000 - 0x00050000)
  29. ldreq \rv, [\rp, #UTCR3]
  30. tsteq \rv, #UTCR3_TXE
  31. @ if Ser1 is inactive, then try Ser2
  32. addeq \rp, \rp, #(0x00030000 - 0x00010000)
  33. ldreq \rv, [\rp, #UTCR3]
  34. tsteq \rv, #UTCR3_TXE
  35. @ clear top bits, and generate both phys and virt addresses
  36. lsl \rp, \rp, #8
  37. lsr \rp, \rp, #8
  38. orr \rv, \rp, #0xf8000000 @ virtual
  39. orr \rp, \rp, #0x80000000 @ physical
  40. .endm
  41. .macro senduart,rd,rx
  42. str \rd, [\rx, #UTDR]
  43. .endm
  44. .macro waituartcts,rd,rx
  45. .endm
  46. .macro waituarttxrdy,rd,rx
  47. 1001: ldr \rd, [\rx, #UTSR1]
  48. tst \rd, #UTSR1_TNF
  49. beq 1001b
  50. .endm
  51. .macro busyuart,rd,rx
  52. 1001: ldr \rd, [\rx, #UTSR1]
  53. tst \rd, #UTSR1_TBY
  54. bne 1001b
  55. .endm