xref: /linux/arch/arm/include/debug/8250.S (revision 0b4cccbec60678212eccdb42dc1e1c233ddf7092)
12facbc88SRussell King/*
22facbc88SRussell King * arch/arm/include/debug/8250.S
32facbc88SRussell King *
42facbc88SRussell King *  Copyright (C) 1994-2013 Russell King
52facbc88SRussell King *
62facbc88SRussell King * This program is free software; you can redistribute it and/or modify
72facbc88SRussell King * it under the terms of the GNU General Public License version 2 as
82facbc88SRussell King * published by the Free Software Foundation.
92facbc88SRussell King */
102facbc88SRussell King#include <linux/serial_reg.h>
112facbc88SRussell King
122facbc88SRussell King		.macro	addruart, rp, rv, tmp
132facbc88SRussell King		ldr	\rp, =CONFIG_DEBUG_UART_PHYS
142facbc88SRussell King		ldr	\rv, =CONFIG_DEBUG_UART_VIRT
152facbc88SRussell King		.endm
162facbc88SRussell King
17*0b4cccbeSRussell King#ifdef CONFIG_DEBUG_UART_8250_WORD
18*0b4cccbeSRussell King		.macro	store, rd, rx:vararg
19*0b4cccbeSRussell King		str	\rd, \rx
20*0b4cccbeSRussell King		.endm
21*0b4cccbeSRussell King
22*0b4cccbeSRussell King		.macro	load, rd, rx:vararg
23*0b4cccbeSRussell King		ldr	\rd, \rx
24*0b4cccbeSRussell King		.endm
25*0b4cccbeSRussell King#else
26*0b4cccbeSRussell King		.macro	store, rd, rx:vararg
27*0b4cccbeSRussell King		strb	\rd, \rx
28*0b4cccbeSRussell King		.endm
29*0b4cccbeSRussell King
30*0b4cccbeSRussell King		.macro	load, rd, rx:vararg
31*0b4cccbeSRussell King		ldrb	\rd, \rx
32*0b4cccbeSRussell King		.endm
33*0b4cccbeSRussell King#endif
34*0b4cccbeSRussell King
352facbc88SRussell King#define UART_SHIFT CONFIG_DEBUG_UART_8250_SHIFT
362facbc88SRussell King
372facbc88SRussell King		.macro	senduart,rd,rx
38*0b4cccbeSRussell King		store	\rd, [\rx, #UART_TX << UART_SHIFT]
392facbc88SRussell King		.endm
402facbc88SRussell King
412facbc88SRussell King		.macro	busyuart,rd,rx
42*0b4cccbeSRussell 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
50*0b4cccbeSRussell 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