debug-macro.S 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. .pushsection .data
  21. davinci_uart_phys: .word 0
  22. davinci_uart_virt: .word 0
  23. .popsection
  24. .macro addruart, rp, rv, tmp
  25. /* Use davinci_uart_phys/virt if already configured */
  26. 10: adr \rp, 99f @ get effective addr of 99f
  27. ldr \rv, [\rp] @ get absolute addr of 99f
  28. sub \rv, \rv, \rp @ offset between the two
  29. ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys
  30. sub \tmp, \rp, \rv @ make it effective
  31. ldr \rp, [\tmp, #0] @ davinci_uart_phys
  32. ldr \rv, [\tmp, #4] @ davinci_uart_virt
  33. cmp \rp, #0 @ is port configured?
  34. cmpne \rv, #0
  35. bne 100f @ already configured
  36. /* Check the debug UART address set in uncompress.h */
  37. and \rp, pc, #0xff000000
  38. ldr \rv, =DAVINCI_UART_INFO_OFS
  39. add \rp, \rp, \rv
  40. /* Copy uart phys address from decompressor uart info */
  41. ldr \rv, [\rp, #0]
  42. str \rv, [\tmp, #0]
  43. /* Copy uart virt address from decompressor uart info */
  44. ldr \rv, [\rp, #4]
  45. str \rv, [\tmp, #4]
  46. b 10b
  47. .align
  48. 99: .word .
  49. .word davinci_uart_phys
  50. .ltorg
  51. 100:
  52. .endm
  53. .macro senduart,rd,rx
  54. str \rd, [\rx, #UART_TX << UART_SHIFT]
  55. .endm
  56. .macro busyuart,rd,rx
  57. 1002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT]
  58. and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
  59. teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
  60. bne 1002b
  61. .endm
  62. .macro waituart,rd,rx
  63. #ifdef FLOW_CONTROL
  64. 1001: ldr \rd, [\rx, #UART_MSR << UART_SHIFT]
  65. tst \rd, #UART_MSR_CTS
  66. beq 1001b
  67. #endif
  68. .endm