blob: b03024fa671f41cebc5a0bf728b1a30fe1ad571d [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 ldr \rp, =CONFIG_DEBUG_UART_PHYS
20 ldr \rv, =CONFIG_DEBUG_UART_VIRT
Russell Kinga09e64f2008-08-05 16:14:15 +010021 .endm
22
Stephen Boyda3d3ef92011-11-08 10:33:04 -080023 .macro senduart, rd, rx
Stephen Boyd9edb4b12014-06-30 14:49:39 -070024ARM_BE8(rev \rd, \rd )
Stephen Boyda3d3ef92011-11-08 10:33:04 -080025 @ Write the 1 character to UARTDM_TF
26 str \rd, [\rx, #0x70]
Russell Kinga09e64f2008-08-05 16:14:15 +010027 .endm
28
Stephen Boyda3d3ef92011-11-08 10:33:04 -080029 .macro waituart, rd, rx
Stephen Boyda3d3ef92011-11-08 10:33:04 -080030 @ check for TX_EMT in UARTDM_SR
31 ldr \rd, [\rx, #0x08]
Stephen Boyd9edb4b12014-06-30 14:49:39 -070032ARM_BE8(rev \rd, \rd )
Stephen Boyda3d3ef92011-11-08 10:33:04 -080033 tst \rd, #0x08
34 bne 1002f
35 @ wait for TXREADY in UARTDM_ISR
361001: ldr \rd, [\rx, #0x14]
Stephen Boyd9edb4b12014-06-30 14:49:39 -070037ARM_BE8(rev \rd, \rd )
Stephen Boyda3d3ef92011-11-08 10:33:04 -080038 tst \rd, #0x80
39 beq 1001b
401002:
41 @ Clear TX_READY by writing to the UARTDM_CR register
42 mov \rd, #0x300
Stephen Boyd9edb4b12014-06-30 14:49:39 -070043ARM_BE8(rev \rd, \rd )
Stephen Boyda3d3ef92011-11-08 10:33:04 -080044 str \rd, [\rx, #0x10]
45 @ Write 0x1 to NCF register
46 mov \rd, #0x1
Stephen Boyd9edb4b12014-06-30 14:49:39 -070047ARM_BE8(rev \rd, \rd )
Stephen Boyda3d3ef92011-11-08 10:33:04 -080048 str \rd, [\rx, #0x40]
49 @ UARTDM reg. Read to induce delay
50 ldr \rd, [\rx, #0x08]
Russell Kinga09e64f2008-08-05 16:14:15 +010051 .endm
Russell Kinga09e64f2008-08-05 16:14:15 +010052
Stephen Boyda3d3ef92011-11-08 10:33:04 -080053 .macro busyuart, rd, rx
Russell Kinga09e64f2008-08-05 16:14:15 +010054 .endm