msm.S 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. #if defined(CONFIG_ARCH_MSM7X00A) || defined(CONFIG_ARCH_QSD8X50)
  18. #define MSM_UART1_PHYS 0xA9A00000
  19. #define MSM_UART2_PHYS 0xA9B00000
  20. #define MSM_UART3_PHYS 0xA9C00000
  21. #elif defined(CONFIG_ARCH_MSM7X30)
  22. #define MSM_UART1_PHYS 0xACA00000
  23. #define MSM_UART2_PHYS 0xACB00000
  24. #define MSM_UART3_PHYS 0xACC00000
  25. #endif
  26. #if defined(CONFIG_DEBUG_MSM_UART1)
  27. #define MSM_DEBUG_UART_BASE 0xE1000000
  28. #define MSM_DEBUG_UART_PHYS MSM_UART1_PHYS
  29. #elif defined(CONFIG_DEBUG_MSM_UART2)
  30. #define MSM_DEBUG_UART_BASE 0xE1000000
  31. #define MSM_DEBUG_UART_PHYS MSM_UART2_PHYS
  32. #elif defined(CONFIG_DEBUG_MSM_UART3)
  33. #define MSM_DEBUG_UART_BASE 0xE1000000
  34. #define MSM_DEBUG_UART_PHYS MSM_UART3_PHYS
  35. #endif
  36. #ifdef CONFIG_DEBUG_MSM8660_UART
  37. #define MSM_DEBUG_UART_BASE 0xF0040000
  38. #define MSM_DEBUG_UART_PHYS 0x19C40000
  39. #endif
  40. #ifdef CONFIG_DEBUG_MSM8960_UART
  41. #define MSM_DEBUG_UART_BASE 0xF0040000
  42. #define MSM_DEBUG_UART_PHYS 0x16440000
  43. #endif
  44. .macro addruart, rp, rv, tmp
  45. #ifdef MSM_DEBUG_UART_PHYS
  46. ldr \rp, =MSM_DEBUG_UART_PHYS
  47. ldr \rv, =MSM_DEBUG_UART_BASE
  48. #endif
  49. .endm
  50. .macro senduart, rd, rx
  51. #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS
  52. @ Write the 1 character to UARTDM_TF
  53. str \rd, [\rx, #0x70]
  54. #else
  55. str \rd, [\rx, #0x0C]
  56. #endif
  57. .endm
  58. .macro waituart, rd, rx
  59. #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS
  60. @ check for TX_EMT in UARTDM_SR
  61. ldr \rd, [\rx, #0x08]
  62. tst \rd, #0x08
  63. bne 1002f
  64. @ wait for TXREADY in UARTDM_ISR
  65. 1001: ldr \rd, [\rx, #0x14]
  66. tst \rd, #0x80
  67. beq 1001b
  68. 1002:
  69. @ Clear TX_READY by writing to the UARTDM_CR register
  70. mov \rd, #0x300
  71. str \rd, [\rx, #0x10]
  72. @ Write 0x1 to NCF register
  73. mov \rd, #0x1
  74. str \rd, [\rx, #0x40]
  75. @ UARTDM reg. Read to induce delay
  76. ldr \rd, [\rx, #0x08]
  77. #else
  78. @ wait for TX_READY
  79. 1001: ldr \rd, [\rx, #0x08]
  80. tst \rd, #0x04
  81. beq 1001b
  82. #endif
  83. .endm
  84. .macro busyuart, rd, rx
  85. .endm