msm.S 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. ARM_BE8(rev \rd, \rd )
  25. #ifdef CONFIG_DEBUG_QCOM_UARTDM
  26. @ Write the 1 character to UARTDM_TF
  27. str \rd, [\rx, #0x70]
  28. #else
  29. str \rd, [\rx, #0x0C]
  30. #endif
  31. .endm
  32. .macro waituart, rd, rx
  33. #ifdef CONFIG_DEBUG_QCOM_UARTDM
  34. @ check for TX_EMT in UARTDM_SR
  35. ldr \rd, [\rx, #0x08]
  36. ARM_BE8(rev \rd, \rd )
  37. tst \rd, #0x08
  38. bne 1002f
  39. @ wait for TXREADY in UARTDM_ISR
  40. 1001: ldr \rd, [\rx, #0x14]
  41. ARM_BE8(rev \rd, \rd )
  42. tst \rd, #0x80
  43. beq 1001b
  44. 1002:
  45. @ Clear TX_READY by writing to the UARTDM_CR register
  46. mov \rd, #0x300
  47. ARM_BE8(rev \rd, \rd )
  48. str \rd, [\rx, #0x10]
  49. @ Write 0x1 to NCF register
  50. mov \rd, #0x1
  51. ARM_BE8(rev \rd, \rd )
  52. str \rd, [\rx, #0x40]
  53. @ UARTDM reg. Read to induce delay
  54. ldr \rd, [\rx, #0x08]
  55. #else
  56. @ wait for TX_READY
  57. 1001: ldr \rd, [\rx, #0x08]
  58. ARM_BE8(rev \rd, \rd )
  59. tst \rd, #0x04
  60. beq 1001b
  61. #endif
  62. .endm
  63. .macro busyuart, rd, rx
  64. .endm