1c44e182eSWolfram Sang/* SPDX-License-Identifier: GPL-2.0 */ 27a2071c5SGeert Uytterhoeven/* 37a2071c5SGeert Uytterhoeven * Renesas SCIF(A) debugging macro include header 47a2071c5SGeert Uytterhoeven * 57a2071c5SGeert Uytterhoeven * Based on r8a7790.S 67a2071c5SGeert Uytterhoeven * 77a2071c5SGeert Uytterhoeven * Copyright (C) 2012-2013 Renesas Electronics Corporation 87a2071c5SGeert Uytterhoeven * Copyright (C) 1994-1999 Russell King 97a2071c5SGeert Uytterhoeven */ 107a2071c5SGeert Uytterhoeven 117a2071c5SGeert Uytterhoeven#define SCIF_PHYS CONFIG_DEBUG_UART_PHYS 127a2071c5SGeert Uytterhoeven#define SCIF_VIRT ((SCIF_PHYS & 0x00ffffff) | 0xfd000000) 137a2071c5SGeert Uytterhoeven 14e9670ccbSGeert Uytterhoeven#if defined(CONFIG_DEBUG_R7S9210_SCIF2) || defined(CONFIG_DEBUG_R7S9210_SCIF4) 15e9670ccbSGeert Uytterhoeven/* RZ/A2 SCIFA */ 16e9670ccbSGeert Uytterhoeven#define FTDR 0x06 17e9670ccbSGeert Uytterhoeven#define FSR 0x08 18e9670ccbSGeert Uytterhoeven#elif CONFIG_DEBUG_UART_PHYS < 0xe6e00000 197a2071c5SGeert Uytterhoeven/* SCIFA */ 207a2071c5SGeert Uytterhoeven#define FTDR 0x20 217a2071c5SGeert Uytterhoeven#define FSR 0x14 227a2071c5SGeert Uytterhoeven#else 237a2071c5SGeert Uytterhoeven/* SCIF */ 247a2071c5SGeert Uytterhoeven#define FTDR 0x0c 257a2071c5SGeert Uytterhoeven#define FSR 0x10 267a2071c5SGeert Uytterhoeven#endif 277a2071c5SGeert Uytterhoeven 287a2071c5SGeert Uytterhoeven#define TDFE (1 << 5) 297a2071c5SGeert Uytterhoeven#define TEND (1 << 6) 307a2071c5SGeert Uytterhoeven 317a2071c5SGeert Uytterhoeven .macro addruart, rp, rv, tmp 327a2071c5SGeert Uytterhoeven ldr \rp, =SCIF_PHYS 337a2071c5SGeert Uytterhoeven ldr \rv, =SCIF_VIRT 347a2071c5SGeert Uytterhoeven .endm 357a2071c5SGeert Uytterhoeven 36*2c50a570SLinus Walleij .macro waituartcts,rd,rx 37*2c50a570SLinus Walleij .endm 38*2c50a570SLinus Walleij 39*2c50a570SLinus Walleij .macro waituarttxrdy, rd, rx 407a2071c5SGeert Uytterhoeven1001: ldrh \rd, [\rx, #FSR] 417a2071c5SGeert Uytterhoeven tst \rd, #TDFE 427a2071c5SGeert Uytterhoeven beq 1001b 437a2071c5SGeert Uytterhoeven .endm 447a2071c5SGeert Uytterhoeven 457a2071c5SGeert Uytterhoeven .macro senduart, rd, rx 467a2071c5SGeert Uytterhoeven strb \rd, [\rx, #FTDR] 477a2071c5SGeert Uytterhoeven ldrh \rd, [\rx, #FSR] 487a2071c5SGeert Uytterhoeven bic \rd, \rd, #TEND 497a2071c5SGeert Uytterhoeven strh \rd, [\rx, #FSR] 507a2071c5SGeert Uytterhoeven .endm 517a2071c5SGeert Uytterhoeven 527a2071c5SGeert Uytterhoeven .macro busyuart, rd, rx 537a2071c5SGeert Uytterhoeven1001: ldrh \rd, [\rx, #FSR] 547a2071c5SGeert Uytterhoeven tst \rd, #TEND 557a2071c5SGeert Uytterhoeven beq 1001b 567a2071c5SGeert Uytterhoeven .endm 57