xref: /linux/arch/arm/include/debug/renesas-scif.S (revision aaccf3c97418f169afdbb5855e9cbcbda34e90fd)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Renesas SCIF(A) debugging macro include header
4 *
5 * Based on r8a7790.S
6 *
7 * Copyright (C) 2012-2013 Renesas Electronics Corporation
8 * Copyright (C) 1994-1999 Russell King
9 */
10
11#define SCIF_PHYS	CONFIG_DEBUG_UART_PHYS
12#define SCIF_VIRT	((SCIF_PHYS & 0x00ffffff) | 0xfd000000)
13
14#if CONFIG_DEBUG_UART_PHYS < 0xe6e00000
15/* SCIFA */
16#define FTDR		0x20
17#define FSR		0x14
18#else
19/* SCIF */
20#define FTDR		0x0c
21#define FSR		0x10
22#endif
23
24#define TDFE	(1 << 5)
25#define TEND	(1 << 6)
26
27	.macro	addruart, rp, rv, tmp
28	ldr	\rp, =SCIF_PHYS
29	ldr	\rv, =SCIF_VIRT
30	.endm
31
32	.macro	waituart, rd, rx
331001:	ldrh	\rd, [\rx, #FSR]
34	tst	\rd, #TDFE
35	beq	1001b
36	.endm
37
38	.macro	senduart, rd, rx
39	strb	\rd, [\rx, #FTDR]
40	ldrh	\rd, [\rx, #FSR]
41	bic	\rd, \rd, #TEND
42	strh	\rd, [\rx, #FSR]
43	.endm
44
45	.macro	busyuart, rd, rx
461001:	ldrh	\rd, [\rx, #FSR]
47	tst	\rd, #TEND
48	beq	1001b
49	.endm
50