1/*
2 * xen/arch/arm/arm64/debug-mvebu.inc
3 *
4 * MVEBU specific debug code.
5 *
6 * Copyright (c) 2018, Amit Singh Tomar <amittomer25@gmail.com>.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms and conditions of the GNU General Public
10 * License, version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public
18 * License along with this program; If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#define UART_STATUS_REG     0x0c
22#define UART_TX_REG         0x04
23
24/*
25 * MVEBU UART wait UART to be ready to transmit
26 * xb: register which contains the UART base address
27 * c: scratch register
28 */
29.macro early_uart_ready xb c
301:
31        ldrh   w\c, [\xb, #UART_STATUS_REG] /* status register */
32        tst    w\c, #(1 << 11)              /* Check TXFIFO FULL bit */
33        b.ne   1b                           /* Wait for the UART to be ready */
34.endm
35
36/*
37 * MVEBU UART transmit character
38 * xb: register which contains the UART base address
39 * wt: register which contains the character to transmit
40 */
41.macro early_uart_transmit xb wt
42	strb  \wt, [\xb, #UART_TX_REG]
43.endm
44
45/*
46 * Local variables:
47 * mode: ASM
48 * indent-tabs-mode: nil
49 * End:
50 */
51