xref: /linux/arch/arm/include/debug/8250.S (revision ca55b2fef3a9373fcfc30f82fd26bc7fccbda732)
1/*
2 * arch/arm/include/debug/8250.S
3 *
4 *  Copyright (C) 1994-2013 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/serial_reg.h>
11
12		.macro	addruart, rp, rv, tmp
13		ldr	\rp, =CONFIG_DEBUG_UART_PHYS
14		ldr	\rv, =CONFIG_DEBUG_UART_VIRT
15		.endm
16
17#ifdef CONFIG_DEBUG_UART_8250_WORD
18		.macro	store, rd, rx:vararg
19	 ARM_BE8(rev \rd, \rd)
20		str	\rd, \rx
21	 ARM_BE8(rev \rd, \rd)
22		.endm
23
24		.macro	load, rd, rx:vararg
25		ldr	\rd, \rx
26	ARM_BE8(rev \rd, \rd)
27		.endm
28#else
29		.macro	store, rd, rx:vararg
30		strb	\rd, \rx
31		.endm
32
33		.macro	load, rd, rx:vararg
34		ldrb	\rd, \rx
35		.endm
36#endif
37
38#define UART_SHIFT CONFIG_DEBUG_UART_8250_SHIFT
39
40		.macro	senduart,rd,rx
41		store	\rd, [\rx, #UART_TX << UART_SHIFT]
42		.endm
43
44		.macro	busyuart,rd,rx
451002:		load	\rd, [\rx, #UART_LSR << UART_SHIFT]
46		and	\rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
47		teq	\rd, #UART_LSR_TEMT | UART_LSR_THRE
48		bne	1002b
49		.endm
50
51		.macro	waituart,rd,rx
52#ifdef CONFIG_DEBUG_UART_8250_FLOW_CONTROL
531001:		load	\rd, [\rx, #UART_MSR << UART_SHIFT]
54		tst	\rd, #UART_MSR_CTS
55		beq	1001b
56#endif
57		.endm
58