xref: /linux/arch/arm/include/debug/meson.S (revision 1517d90cfafe0f95fd7863d04e1596f7beb7dfa8)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2014 Carlo Caione
4 * Carlo Caione <carlo@caione.org>
5 */
6
7#define MESON_AO_UART_WFIFO		0x0
8#define MESON_AO_UART_STATUS		0xc
9
10#define MESON_AO_UART_TX_FIFO_EMPTY	(1 << 22)
11#define MESON_AO_UART_TX_FIFO_FULL	(1 << 21)
12
13	.macro	addruart, rp, rv, tmp
14	ldr	\rp, =(CONFIG_DEBUG_UART_PHYS)		@ physical
15	ldr	\rv, =(CONFIG_DEBUG_UART_VIRT)		@ virtual
16	.endm
17
18	.macro	senduart,rd,rx
19	str	\rd, [\rx, #MESON_AO_UART_WFIFO]
20	.endm
21
22	.macro	busyuart,rd,rx
231002:	ldr	\rd, [\rx, #MESON_AO_UART_STATUS]
24	tst	\rd, #MESON_AO_UART_TX_FIFO_EMPTY
25	beq	1002b
26	.endm
27
28	.macro	waituart,rd,rx
291001:	ldr	\rd, [\rx, #MESON_AO_UART_STATUS]
30	tst	\rd, #MESON_AO_UART_TX_FIFO_FULL
31	bne	1001b
32	.endm
33