18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/arm/mach-prima2/include/mach/debug-macro.S
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#define SIRF_LLUART_TXFIFO_STATUS	0x0114
98c2ecf20Sopenharmony_ci#define SIRF_LLUART_TXFIFO_DATA	0x0118
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define SIRF_LLUART_TXFIFO_FULL                       (1 << 5)
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_SIRFATLAS7_UART0
148c2ecf20Sopenharmony_ci#define SIRF_LLUART_TXFIFO_EMPTY			(1 << 8)
158c2ecf20Sopenharmony_ci#else
168c2ecf20Sopenharmony_ci#define SIRF_LLUART_TXFIFO_EMPTY			(1 << 6)
178c2ecf20Sopenharmony_ci#endif
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	.macro	addruart, rp, rv, tmp
218c2ecf20Sopenharmony_ci	ldr	\rp, =CONFIG_DEBUG_UART_PHYS		@ physical
228c2ecf20Sopenharmony_ci	ldr	\rv, =CONFIG_DEBUG_UART_VIRT		@ virtual
238c2ecf20Sopenharmony_ci	.endm
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	.macro	senduart,rd,rx
268c2ecf20Sopenharmony_ci	str	\rd, [\rx, #SIRF_LLUART_TXFIFO_DATA]
278c2ecf20Sopenharmony_ci	.endm
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	.macro	busyuart,rd,rx
308c2ecf20Sopenharmony_ci	.endm
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci	.macro	waituartcts,rd,rx
338c2ecf20Sopenharmony_ci	.endm
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	.macro	waituarttxrdy,rd,rx
368c2ecf20Sopenharmony_ci1001:	ldr	\rd, [\rx, #SIRF_LLUART_TXFIFO_STATUS]
378c2ecf20Sopenharmony_ci	tst	\rd, #SIRF_LLUART_TXFIFO_EMPTY
388c2ecf20Sopenharmony_ci	beq	1001b
398c2ecf20Sopenharmony_ci	.endm
408c2ecf20Sopenharmony_ci
41