debug-macro.S 1.6 KB

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