msm.S 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #ifdef CONFIG_DEBUG_MSM8974_UART
  45. #define MSM_DEBUG_UART_BASE 0xFA71E000
  46. #define MSM_DEBUG_UART_PHYS 0xF991E000
  47. #endif
  48. .macro addruart, rp, rv, tmp
  49. #ifdef MSM_DEBUG_UART_PHYS
  50. ldr \rp, =MSM_DEBUG_UART_PHYS
  51. ldr \rv, =MSM_DEBUG_UART_BASE
  52. #endif
  53. .endm
  54. .macro senduart, rd, rx
  55. #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS
  56. @ Write the 1 character to UARTDM_TF
  57. str \rd, [\rx, #0x70]
  58. #else
  59. str \rd, [\rx, #0x0C]
  60. #endif
  61. .endm
  62. .macro waituart, rd, rx
  63. #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS
  64. @ check for TX_EMT in UARTDM_SR
  65. ldr \rd, [\rx, #0x08]
  66. tst \rd, #0x08
  67. bne 1002f
  68. @ wait for TXREADY in UARTDM_ISR
  69. 1001: ldr \rd, [\rx, #0x14]
  70. tst \rd, #0x80
  71. beq 1001b
  72. 1002:
  73. @ Clear TX_READY by writing to the UARTDM_CR register
  74. mov \rd, #0x300
  75. str \rd, [\rx, #0x10]
  76. @ Write 0x1 to NCF register
  77. mov \rd, #0x1
  78. str \rd, [\rx, #0x40]
  79. @ UARTDM reg. Read to induce delay
  80. ldr \rd, [\rx, #0x08]
  81. #else
  82. @ wait for TX_READY
  83. 1001: ldr \rd, [\rx, #0x08]
  84. tst \rd, #0x04
  85. beq 1001b
  86. #endif
  87. .endm
  88. .macro busyuart, rd, rx
  89. .endm