xref: /linux/arch/arm/include/debug/msm.S (revision 2c50a570e9dc649c182268e779dffe0712e98a6a)
19c92ab61SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */
26d07917eSStephen Boyd/*
36d07917eSStephen Boyd *
46d07917eSStephen Boyd * Copyright (C) 2007 Google, Inc.
56d07917eSStephen Boyd * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
66d07917eSStephen Boyd * Author: Brian Swetland <swetland@google.com>
76d07917eSStephen Boyd */
86d07917eSStephen Boyd
96d07917eSStephen Boyd	.macro	addruart, rp, rv, tmp
107098cff2SIvan T. Ivanov	ldr	\rp, =CONFIG_DEBUG_UART_PHYS
117098cff2SIvan T. Ivanov	ldr	\rv, =CONFIG_DEBUG_UART_VIRT
126d07917eSStephen Boyd	.endm
136d07917eSStephen Boyd
146d07917eSStephen Boyd	.macro	senduart, rd, rx
159edb4b13SStephen BoydARM_BE8(rev	\rd, \rd )
166d07917eSStephen Boyd	@ Write the 1 character to UARTDM_TF
176d07917eSStephen Boyd	str	\rd, [\rx, #0x70]
186d07917eSStephen Boyd	.endm
196d07917eSStephen Boyd
20*2c50a570SLinus Walleij	.macro	waituartcts,rd,rx
21*2c50a570SLinus Walleij	.endm
22*2c50a570SLinus Walleij
23*2c50a570SLinus Walleij	.macro	waituarttxrdy, rd, rx
246d07917eSStephen Boyd	@ check for TX_EMT in UARTDM_SR
256d07917eSStephen Boyd	ldr	\rd, [\rx, #0x08]
269edb4b13SStephen BoydARM_BE8(rev     \rd, \rd )
276d07917eSStephen Boyd	tst	\rd, #0x08
286d07917eSStephen Boyd	bne	1002f
296d07917eSStephen Boyd	@ wait for TXREADY in UARTDM_ISR
306d07917eSStephen Boyd1001:	ldr	\rd, [\rx, #0x14]
319edb4b13SStephen BoydARM_BE8(rev     \rd, \rd )
326d07917eSStephen Boyd	tst	\rd, #0x80
336d07917eSStephen Boyd	beq 	1001b
346d07917eSStephen Boyd1002:
356d07917eSStephen Boyd	@ Clear TX_READY by writing to the UARTDM_CR register
366d07917eSStephen Boyd	mov	\rd, #0x300
379edb4b13SStephen BoydARM_BE8(rev     \rd, \rd )
386d07917eSStephen Boyd	str	\rd, [\rx, #0x10]
396d07917eSStephen Boyd	@ Write 0x1 to NCF register
406d07917eSStephen Boyd	mov 	\rd, #0x1
419edb4b13SStephen BoydARM_BE8(rev     \rd, \rd )
426d07917eSStephen Boyd	str	\rd, [\rx, #0x40]
436d07917eSStephen Boyd	@ UARTDM reg. Read to induce delay
446d07917eSStephen Boyd	ldr	\rd, [\rx, #0x08]
456d07917eSStephen Boyd	.endm
466d07917eSStephen Boyd
476d07917eSStephen Boyd	.macro	busyuart, rd, rx
486d07917eSStephen Boyd	.endm
49