Masahiro Yamada | 59cbe79 | 2014-09-01 11:06:32 +0900 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/include/debug/8250.S |
| 3 | * |
| 4 | * Copyright (C) 1994-2013 Russell King |
| 5 | * |
Masahiro Yamada | 349eba2 | 2014-09-01 11:06:33 +0900 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | 59cbe79 | 2014-09-01 11:06:32 +0900 | [diff] [blame] | 7 | */ |
| 8 | #include <linux/serial_reg.h> |
| 9 | |
| 10 | .macro addruart, rp, rv, tmp |
| 11 | ldr \rp, =CONFIG_DEBUG_UART_PHYS |
| 12 | ldr \rv, =CONFIG_DEBUG_UART_VIRT |
| 13 | .endm |
| 14 | |
| 15 | #ifdef CONFIG_DEBUG_UART_8250_WORD |
| 16 | .macro store, rd, rx:vararg |
| 17 | str \rd, \rx |
| 18 | .endm |
| 19 | |
| 20 | .macro load, rd, rx:vararg |
| 21 | ldr \rd, \rx |
| 22 | .endm |
| 23 | #else |
| 24 | .macro store, rd, rx:vararg |
| 25 | strb \rd, \rx |
| 26 | .endm |
| 27 | |
| 28 | .macro load, rd, rx:vararg |
| 29 | ldrb \rd, \rx |
| 30 | .endm |
| 31 | #endif |
| 32 | |
| 33 | #define UART_SHIFT CONFIG_DEBUG_UART_8250_SHIFT |
| 34 | |
| 35 | .macro senduart,rd,rx |
| 36 | store \rd, [\rx, #UART_TX << UART_SHIFT] |
| 37 | .endm |
| 38 | |
| 39 | .macro busyuart,rd,rx |
| 40 | 1002: load \rd, [\rx, #UART_LSR << UART_SHIFT] |
| 41 | and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE |
| 42 | teq \rd, #UART_LSR_TEMT | UART_LSR_THRE |
| 43 | bne 1002b |
| 44 | .endm |
| 45 | |
| 46 | .macro waituart,rd,rx |
| 47 | #ifdef CONFIG_DEBUG_UART_8250_FLOW_CONTROL |
| 48 | 1001: load \rd, [\rx, #UART_MSR << UART_SHIFT] |
| 49 | tst \rd, #UART_MSR_CTS |
| 50 | beq 1001b |
| 51 | #endif |
| 52 | .endm |