debug-macro.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #if defined(CONFIG_ARCH_DAVINCI_DA8XX) && defined(CONFIG_ARCH_DAVINCI_DMx)
  25. #error Cannot enable DaVinci and DA8XX platforms concurrently
  26. #elif defined(CONFIG_MACH_DAVINCI_DA830_EVM) || \
  27. defined(CONFIG_MACH_DAVINCI_DA850_EVM)
  28. orr \rx, \rx, #0x00d00000 @ physical base address
  29. orr \rx, \rx, #0x0000d000 @ of UART 2
  30. #else
  31. orr \rx, \rx, #0x00c20000 @ UART 0
  32. #endif
  33. .endm
  34. .macro senduart,rd,rx
  35. str \rd, [\rx, #UART_TX << UART_SHIFT]
  36. .endm
  37. .macro busyuart,rd,rx
  38. 1002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT]
  39. and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
  40. teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
  41. bne 1002b
  42. .endm
  43. .macro waituart,rd,rx
  44. #ifdef FLOW_CONTROL
  45. 1001: ldr \rd, [\rx, #UART_MSR << UART_SHIFT]
  46. tst \rd, #UART_MSR_CTS
  47. beq 1001b
  48. #endif
  49. .endm