blob: 9ef57612811dff72bf14b7f73fbe1a0782bb0ae8 [file] [log] [blame]
Stephen Boyd650e3f02011-11-08 10:33:03 -08001/*
Russell Kinga09e64f2008-08-05 16:14:15 +01002 *
3 * Copyright (C) 2007 Google, Inc.
Stephen Boyda3d3ef92011-11-08 10:33:04 -08004 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
Russell Kinga09e64f2008-08-05 16:14:15 +01005 * 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
Nicolas Pitre639da5e2011-08-31 22:55:46 -040018 .macro addruart, rp, rv, tmp
Ivan T. Ivanov7098cff2014-04-14 16:47:34 +030019#ifdef CONFIG_DEBUG_UART_PHYS
20 ldr \rp, =CONFIG_DEBUG_UART_PHYS
21 ldr \rv, =CONFIG_DEBUG_UART_VIRT
Stephen Boyd650e3f02011-11-08 10:33:03 -080022#endif
Russell Kinga09e64f2008-08-05 16:14:15 +010023 .endm
24
Stephen Boyda3d3ef92011-11-08 10:33:04 -080025 .macro senduart, rd, rx
Ivan T. Ivanov7098cff2014-04-14 16:47:34 +030026#ifdef CONFIG_DEBUG_QCOM_UARTDM
Stephen Boyda3d3ef92011-11-08 10:33:04 -080027 @ Write the 1 character to UARTDM_TF
28 str \rd, [\rx, #0x70]
29#else
Stephen Boydc97d9322011-12-05 10:27:42 -080030 str \rd, [\rx, #0x0C]
Stephen Boyda3d3ef92011-11-08 10:33:04 -080031#endif
Russell Kinga09e64f2008-08-05 16:14:15 +010032 .endm
33
Stephen Boyda3d3ef92011-11-08 10:33:04 -080034 .macro waituart, rd, rx
Ivan T. Ivanov7098cff2014-04-14 16:47:34 +030035#ifdef CONFIG_DEBUG_QCOM_UARTDM
Stephen Boyda3d3ef92011-11-08 10:33:04 -080036 @ check for TX_EMT in UARTDM_SR
37 ldr \rd, [\rx, #0x08]
38 tst \rd, #0x08
39 bne 1002f
40 @ wait for TXREADY in UARTDM_ISR
411001: ldr \rd, [\rx, #0x14]
42 tst \rd, #0x80
43 beq 1001b
441002:
45 @ Clear TX_READY by writing to the UARTDM_CR register
46 mov \rd, #0x300
47 str \rd, [\rx, #0x10]
48 @ Write 0x1 to NCF register
49 mov \rd, #0x1
50 str \rd, [\rx, #0x40]
51 @ UARTDM reg. Read to induce delay
52 ldr \rd, [\rx, #0x08]
53#else
Russell Kinga09e64f2008-08-05 16:14:15 +010054 @ wait for TX_READY
Pavel Machek6339f662009-11-02 11:48:29 +0100551001: ldr \rd, [\rx, #0x08]
Russell Kinga09e64f2008-08-05 16:14:15 +010056 tst \rd, #0x04
Pavel Machek6339f662009-11-02 11:48:29 +010057 beq 1001b
Stephen Boyda3d3ef92011-11-08 10:33:04 -080058#endif
Russell Kinga09e64f2008-08-05 16:14:15 +010059 .endm
Russell Kinga09e64f2008-08-05 16:14:15 +010060
Stephen Boyda3d3ef92011-11-08 10:33:04 -080061 .macro busyuart, rd, rx
Russell Kinga09e64f2008-08-05 16:14:15 +010062 .endm