debug-macro.S 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Debugging macro for DaVinci
  3. *
  4. * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
  5. *
  6. * 2007 (c) MontaVista Software, Inc. This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. */
  11. /* Modifications
  12. * Jan 2009 Chaithrika U S Added senduart, busyuart, waituart
  13. * macros, based on debug-8250.S file
  14. * but using 32-bit accesses required for
  15. * some davinci devices.
  16. */
  17. #include <linux/serial_reg.h>
  18. #define UART_SHIFT 2
  19. .macro addruart, rx
  20. mrc p15, 0, \rx, c1, c0
  21. tst \rx, #1 @ MMU enabled?
  22. moveq \rx, #0x01000000 @ physical base address
  23. movne \rx, #0xfe000000 @ virtual base
  24. orr \rx, \rx, #0x00c20000 @ UART 0
  25. .endm
  26. .macro senduart,rd,rx
  27. str \rd, [\rx, #UART_TX << UART_SHIFT]
  28. .endm
  29. .macro busyuart,rd,rx
  30. 1002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT]
  31. and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
  32. teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
  33. bne 1002b
  34. .endm
  35. .macro waituart,rd,rx
  36. #ifdef FLOW_CONTROL
  37. 1001: ldr \rd, [\rx, #UART_MSR << UART_SHIFT]
  38. tst \rd, #UART_MSR_CTS
  39. beq 1001b
  40. #endif
  41. .endm