debug-macro.S 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #include <mach/serial.h>
  19. #define UART_SHIFT 2
  20. #if defined(CONFIG_DEBUG_DAVINCI_DMx_UART0)
  21. #define UART_BASE DAVINCI_UART0_BASE
  22. #elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART0)
  23. #define UART_BASE DA8XX_UART0_BASE
  24. #elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART1)
  25. #define UART_BASE DA8XX_UART1_BASE
  26. #elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART2)
  27. #define UART_BASE DA8XX_UART2_BASE
  28. #elif defined(CONFIG_DEBUG_DAVINCI_TNETV107X_UART1)
  29. #define UART_BASE TNETV107X_UART2_BASE
  30. #define UART_VIRTBASE TNETV107X_UART2_VIRT
  31. #else
  32. #error "Select a specifc port for DEBUG_LL"
  33. #endif
  34. #ifndef UART_VIRTBASE
  35. #define UART_VIRTBASE IO_ADDRESS(UART_BASE)
  36. #endif
  37. .macro addruart, rp, rv, tmp
  38. ldr \rp, =UART_BASE
  39. ldr \rv, =UART_VIRTBASE
  40. .endm
  41. .macro senduart,rd,rx
  42. str \rd, [\rx, #UART_TX << UART_SHIFT]
  43. .endm
  44. .macro busyuart,rd,rx
  45. 1002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT]
  46. and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
  47. teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
  48. bne 1002b
  49. .endm
  50. .macro waituart,rd,rx
  51. #ifdef FLOW_CONTROL
  52. 1001: ldr \rd, [\rx, #UART_MSR << UART_SHIFT]
  53. tst \rd, #UART_MSR_CTS
  54. beq 1001b
  55. #endif
  56. .endm