1/*
2 * xen/arch/arm/arm64/debug-imx-lpuart.inc
3 *
4 * i.MX8QM specific debug code
5 *
6 * Peng Fan <peng.fan@nxp.com>
7 * Copyright 2022 NXP
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 */
19
20#include <asm/imx-lpuart.h>
21
22/*
23 * Wait LPUART to be ready to transmit
24 * rb: register which contains the UART base address
25 * rc: scratch register
26 */
27.macro early_uart_ready xb, c
281:
29        ldr   w\c, [\xb, #UARTSTAT]   /* <- Flag register */
30        tst   w\c, #UARTSTAT_TDRE     /* Check FIFO EMPTY bit */
31        beq   1b                      /* Wait for the UART to be ready */
32.endm
33
34/*
35 * LPUART transmit character
36 * rb: register which contains the UART base address
37 * rt: register which contains the character to transmit
38 */
39.macro early_uart_transmit xb, wt
40        str   \wt, [\xb, #UARTDATA]  /* -> Data Register */
41.endm
42
43/*
44 * Local variables:
45 * mode: ASM
46 * indent-tabs-mode: nil
47 * End:
48 */
49