sa1100.S 1.7 KB

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