Stephen Boyd | 650e3f0 | 2011-11-08 10:33:03 -0800 | [diff] [blame] | 1 | /* |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 2 | * |
| 3 | * Copyright (C) 2007 Google, Inc. |
Stephen Boyd | a3d3ef9 | 2011-11-08 10:33:04 -0800 | [diff] [blame] | 4 | * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 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 | |
| 18 | #include <mach/hardware.h> |
| 19 | #include <mach/msm_iomap.h> |
| 20 | |
Nicolas Pitre | 639da5e | 2011-08-31 22:55:46 -0400 | [diff] [blame] | 21 | .macro addruart, rp, rv, tmp |
Stephen Boyd | 650e3f0 | 2011-11-08 10:33:03 -0800 | [diff] [blame] | 22 | #ifdef MSM_DEBUG_UART_PHYS |
Jeremy Kerr | 0ea1293 | 2010-07-06 18:30:06 +0800 | [diff] [blame] | 23 | ldr \rp, =MSM_DEBUG_UART_PHYS |
| 24 | ldr \rv, =MSM_DEBUG_UART_BASE |
Stephen Boyd | 650e3f0 | 2011-11-08 10:33:03 -0800 | [diff] [blame] | 25 | #endif |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 26 | .endm |
| 27 | |
Stephen Boyd | a3d3ef9 | 2011-11-08 10:33:04 -0800 | [diff] [blame] | 28 | .macro senduart, rd, rx |
| 29 | #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS |
| 30 | @ Write the 1 character to UARTDM_TF |
| 31 | str \rd, [\rx, #0x70] |
| 32 | #else |
Stephen Boyd | c97d932 | 2011-12-05 10:27:42 -0800 | [diff] [blame] | 33 | str \rd, [\rx, #0x0C] |
Stephen Boyd | a3d3ef9 | 2011-11-08 10:33:04 -0800 | [diff] [blame] | 34 | #endif |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 35 | .endm |
| 36 | |
Stephen Boyd | a3d3ef9 | 2011-11-08 10:33:04 -0800 | [diff] [blame] | 37 | .macro waituart, rd, rx |
| 38 | #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS |
| 39 | @ check for TX_EMT in UARTDM_SR |
| 40 | ldr \rd, [\rx, #0x08] |
| 41 | tst \rd, #0x08 |
| 42 | bne 1002f |
| 43 | @ wait for TXREADY in UARTDM_ISR |
| 44 | 1001: ldr \rd, [\rx, #0x14] |
| 45 | tst \rd, #0x80 |
| 46 | beq 1001b |
| 47 | 1002: |
| 48 | @ Clear TX_READY by writing to the UARTDM_CR register |
| 49 | mov \rd, #0x300 |
| 50 | str \rd, [\rx, #0x10] |
| 51 | @ Write 0x1 to NCF register |
| 52 | mov \rd, #0x1 |
| 53 | str \rd, [\rx, #0x40] |
| 54 | @ UARTDM reg. Read to induce delay |
| 55 | ldr \rd, [\rx, #0x08] |
| 56 | #else |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 57 | @ wait for TX_READY |
Pavel Machek | 6339f66 | 2009-11-02 11:48:29 +0100 | [diff] [blame] | 58 | 1001: ldr \rd, [\rx, #0x08] |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 59 | tst \rd, #0x04 |
Pavel Machek | 6339f66 | 2009-11-02 11:48:29 +0100 | [diff] [blame] | 60 | beq 1001b |
Stephen Boyd | a3d3ef9 | 2011-11-08 10:33:04 -0800 | [diff] [blame] | 61 | #endif |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 62 | .endm |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 63 | |
Stephen Boyd | a3d3ef9 | 2011-11-08 10:33:04 -0800 | [diff] [blame] | 64 | .macro busyuart, rd, rx |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 65 | .endm |