/* SPDX-License-Identifier: GPL-2.0-only */1/* arch/arm/include/debug/sa1100.S2*3* Debugging macro include header4*5* Copyright (C) 1994-1999 Russell King6* Moved from linux/arch/arm/kernel/debug.S by Ben Dooks7*/89#define UTCR3 0x0c10#define UTDR 0x1411#define UTSR1 0x2012#define UTCR3_TXE 0x00000002 /* Transmit Enable */13#define UTSR1_TBY 0x00000001 /* Transmitter BusY (read) */14#define UTSR1_TNF 0x00000004 /* Transmit FIFO Not Full (read) */1516.macro addruart, rp, rv, tmp17mrc p15, 0, \rp, c1, c018tst \rp, #1 @ MMU enabled?19moveq \rp, #0x80000000 @ physical base address20movne \rp, #0xf8000000 @ virtual address2122@ We probe for the active serial port here, coherently with23@ the comment in arch/arm/mach-sa1100/include/mach/uncompress.h.24@ We assume r1 can be clobbered.2526@ see if Ser3 is active27add \rp, \rp, #0x0005000028ldr \rv, [\rp, #UTCR3]29tst \rv, #UTCR3_TXE3031@ if Ser3 is inactive, then try Ser132addeq \rp, \rp, #(0x00010000 - 0x00050000)33ldreq \rv, [\rp, #UTCR3]34tsteq \rv, #UTCR3_TXE3536@ if Ser1 is inactive, then try Ser237addeq \rp, \rp, #(0x00030000 - 0x00010000)38ldreq \rv, [\rp, #UTCR3]39tsteq \rv, #UTCR3_TXE4041@ clear top bits, and generate both phys and virt addresses42lsl \rp, \rp, #843lsr \rp, \rp, #844orr \rv, \rp, #0xf8000000 @ virtual45orr \rp, \rp, #0x80000000 @ physical4647.endm4849.macro senduart,rd,rx50str \rd, [\rx, #UTDR]51.endm5253.macro waituartcts,rd,rx54.endm5556.macro waituarttxrdy,rd,rx571001: ldr \rd, [\rx, #UTSR1]58tst \rd, #UTSR1_TNF59beq 1001b60.endm6162.macro busyuart,rd,rx631001: ldr \rd, [\rx, #UTSR1]64tst \rd, #UTSR1_TBY65bne 1001b66.endm676869