blob: 905a254b37648962b854e14bc534ec9fccda17e4 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/* arch/arm/mach-msm7200/include/mach/debug-macro.S
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
Pavel Machek6339f662009-11-02 11:48:29 +010017
18
Russell Kinga09e64f2008-08-05 16:14:15 +010019#include <mach/hardware.h>
20#include <mach/msm_iomap.h>
21
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070022#ifdef CONFIG_MSM_DEBUG_UART
23 .macro addruart, rp, rv
24 ldr \rp, =MSM_DEBUG_UART_PHYS
25 ldr \rv, =MSM_DEBUG_UART_BASE
Russell Kinga09e64f2008-08-05 16:14:15 +010026 .endm
27
28 .macro senduart,rd,rx
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029#ifdef CONFIG_SERIAL_MSM_HSL
30 @ Clear TX_READY by writing to the UARTDM_CR register
31 mov r12, #0x300
32 str r12, [\rx, #0x10]
33 @ Write 0x1 to NCF register
34 mov r12, #0x1
35 str r12, [\rx, #0x40]
36 @ UARTDM reg. Read to induce delay
37 ldr r12, [\rx, #0x08]
38 @ Write the 1 character to UARTDM_TF
39 str \rd, [\rx, #0x70]
40#else
41 teq \rx, #0
42 strne \rd, [\rx, #0x0C]
43#endif
Russell Kinga09e64f2008-08-05 16:14:15 +010044 .endm
45
46 .macro waituart,rd,rx
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#ifdef CONFIG_SERIAL_MSM_HSL
48 @ check for TX_EMT in UARTDM_SR
49 ldr \rd, [\rx, #0x08]
50 tst \rd, #0x08
51 bne 1002f
52 @ wait for TXREADY in UARTDM_ISR
531001: ldreq \rd, [\rx, #0x14]
54 tst \rd, #0x80
55 dsb
56 beq 1001b
Daniel Walkerbcd72c32010-10-27 15:25:59 -070057#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058 @ wait for TX_READY
591001: ldr \rd, [\rx, #0x08]
60 tst \rd, #0x04
61 beq 1001b
62#endif
631002:
64 .endm
65
66#else
67
Daniel Walkerbcd72c32010-10-27 15:25:59 -070068 .macro addruart, rp, rv
Daniel Walkerbcd72c32010-10-27 15:25:59 -070069 .endm
70
71 .macro senduart,rd,rx
72 .endm
73
74 .macro waituart,rd,rx
75 .endm
76#endif
Russell Kinga09e64f2008-08-05 16:14:15 +010077
78 .macro busyuart,rd,rx
79 .endm