xref: /linux/arch/arm/include/debug/8250.S (revision d2912cb15bdda8ba4a5dd73396ad62641af2f520)
1*d2912cb1SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */
22facbc88SRussell King/*
32facbc88SRussell King * arch/arm/include/debug/8250.S
42facbc88SRussell King *
52facbc88SRussell King *  Copyright (C) 1994-2013 Russell King
62facbc88SRussell King */
72facbc88SRussell King#include <linux/serial_reg.h>
82facbc88SRussell King
92facbc88SRussell King		.macro	addruart, rp, rv, tmp
102facbc88SRussell King		ldr	\rp, =CONFIG_DEBUG_UART_PHYS
112facbc88SRussell King		ldr	\rv, =CONFIG_DEBUG_UART_VIRT
122facbc88SRussell King		.endm
132facbc88SRussell King
140b4cccbeSRussell King#ifdef CONFIG_DEBUG_UART_8250_WORD
150b4cccbeSRussell King		.macro	store, rd, rx:vararg
166ef4e479SBen Dooks	 ARM_BE8(rev \rd, \rd)
170b4cccbeSRussell King		str	\rd, \rx
186ef4e479SBen Dooks	 ARM_BE8(rev \rd, \rd)
190b4cccbeSRussell King		.endm
200b4cccbeSRussell King
210b4cccbeSRussell King		.macro	load, rd, rx:vararg
220b4cccbeSRussell King		ldr	\rd, \rx
236ef4e479SBen Dooks	ARM_BE8(rev \rd, \rd)
240b4cccbeSRussell King		.endm
250b4cccbeSRussell King#else
260b4cccbeSRussell King		.macro	store, rd, rx:vararg
270b4cccbeSRussell King		strb	\rd, \rx
280b4cccbeSRussell King		.endm
290b4cccbeSRussell King
300b4cccbeSRussell King		.macro	load, rd, rx:vararg
310b4cccbeSRussell King		ldrb	\rd, \rx
320b4cccbeSRussell King		.endm
330b4cccbeSRussell King#endif
340b4cccbeSRussell King
352facbc88SRussell King#define UART_SHIFT CONFIG_DEBUG_UART_8250_SHIFT
362facbc88SRussell King
372facbc88SRussell King		.macro	senduart,rd,rx
380b4cccbeSRussell King		store	\rd, [\rx, #UART_TX << UART_SHIFT]
392facbc88SRussell King		.endm
402facbc88SRussell King
412facbc88SRussell King		.macro	busyuart,rd,rx
420b4cccbeSRussell King1002:		load	\rd, [\rx, #UART_LSR << UART_SHIFT]
432facbc88SRussell King		and	\rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
442facbc88SRussell King		teq	\rd, #UART_LSR_TEMT | UART_LSR_THRE
452facbc88SRussell King		bne	1002b
462facbc88SRussell King		.endm
472facbc88SRussell King
482facbc88SRussell King		.macro	waituart,rd,rx
492facbc88SRussell King#ifdef CONFIG_DEBUG_UART_8250_FLOW_CONTROL
500b4cccbeSRussell King1001:		load	\rd, [\rx, #UART_MSR << UART_SHIFT]
512facbc88SRussell King		tst	\rd, #UART_MSR_CTS
522facbc88SRussell King		beq	1001b
532facbc88SRussell King#endif
542facbc88SRussell King		.endm
55