1/*
2 * xen/arch/arm/arm64/debug-meson.inc
3 *
4 * MESON specific debug code.
5 *
6 * Copyright (c) 2019, 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 AML_UART_WFIFO_REG      0x00
22#define AML_UART_STATUS_REG     0x0c
23
24#define AML_UART_TX_FIFO_FULL   21
25
26.macro early_uart_init xb, c
27/* Uart has already been initialized by Firmware, for instance by TF-A */
28.endm
29
30/*
31 * MESON UART wait UART to be ready to transmit
32 * xb: register which contains the UART base address
33 * c: scratch register
34 */
35.macro early_uart_ready xb c
361:
37        ldr     w\c, [\xb, #AML_UART_STATUS_REG]        /* status register */
38        tbnz    w\c, #AML_UART_TX_FIFO_FULL, 1b         /* Check TXFIFO FULL bit */
39.endm
40
41/*
42 * MESON UART transmit character
43 * xb: register which contains the UART base address
44 * wt: register which contains the character to transmit
45 */
46.macro early_uart_transmit xb wt
47        str    \wt, [\xb, #AML_UART_WFIFO_REG]
48.endm
49
50/*
51 * Local variables:
52 * mode: ASM
53 * indent-tabs-mode: nil
54 * End:
55 */
56