blob: d47a89265279cdf294b1db38377c94ac0b276f1c [file] [log] [blame]
Masahiro Yamada59cbe792014-09-01 11:06:32 +09001/*
2 * arch/arm/include/debug/8250.S
3 *
4 * Copyright (C) 1994-2013 Russell King
5 *
Masahiro Yamada349eba22014-09-01 11:06:33 +09006 * SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada59cbe792014-09-01 11:06:32 +09007 */
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
401002: 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
481001: load \rd, [\rx, #UART_MSR << UART_SHIFT]
49 tst \rd, #UART_MSR_CTS
50 beq 1001b
51#endif
52 .endm