msm.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. *
  3. * Copyright (C) 2007 Google, Inc.
  4. * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  5. * Author: Brian Swetland <swetland@google.com>
  6. *
  7. * This software is licensed under the terms of the GNU General Public
  8. * License version 2, as published by the Free Software Foundation, and
  9. * may be copied, distributed, and modified under those terms.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. */
  17. .macro addruart, rp, rv, tmp
  18. #ifdef CONFIG_DEBUG_UART_PHYS
  19. ldr \rp, =CONFIG_DEBUG_UART_PHYS
  20. ldr \rv, =CONFIG_DEBUG_UART_VIRT
  21. #endif
  22. .endm
  23. .macro senduart, rd, rx
  24. #ifdef CONFIG_DEBUG_QCOM_UARTDM
  25. @ Write the 1 character to UARTDM_TF
  26. str \rd, [\rx, #0x70]
  27. #else
  28. str \rd, [\rx, #0x0C]
  29. #endif
  30. .endm
  31. .macro waituart, rd, rx
  32. #ifdef CONFIG_DEBUG_QCOM_UARTDM
  33. @ check for TX_EMT in UARTDM_SR
  34. ldr \rd, [\rx, #0x08]
  35. tst \rd, #0x08
  36. bne 1002f
  37. @ wait for TXREADY in UARTDM_ISR
  38. 1001: ldr \rd, [\rx, #0x14]
  39. tst \rd, #0x80
  40. beq 1001b
  41. 1002:
  42. @ Clear TX_READY by writing to the UARTDM_CR register
  43. mov \rd, #0x300
  44. str \rd, [\rx, #0x10]
  45. @ Write 0x1 to NCF register
  46. mov \rd, #0x1
  47. str \rd, [\rx, #0x40]
  48. @ UARTDM reg. Read to induce delay
  49. ldr \rd, [\rx, #0x08]
  50. #else
  51. @ wait for TX_READY
  52. 1001: ldr \rd, [\rx, #0x08]
  53. tst \rd, #0x04
  54. beq 1001b
  55. #endif
  56. .endm
  57. .macro busyuart, rd, rx
  58. .endm