1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) STMicroelectronics SA 2017 - All Rights Reserved
4 * Author: Gerald Baeza <gerald.baeza@st.com> for STMicroelectronics.
7 #define STM32_UART_BASE 0x40011000 /* USART1 */
9 #ifdef CONFIG_STM32F4_DEBUG_UART
10 #define STM32_USART_SR_OFF 0x00
11 #define STM32_USART_TDR_OFF 0x04
14 #ifdef CONFIG_STM32F7_DEBUG_UART
15 #define STM32_USART_SR_OFF 0x1C
16 #define STM32_USART_TDR_OFF 0x28
19 #define STM32_USART_TC (1 << 6) /* Tx complete */
20 #define STM32_USART_TXE (1 << 7) /* Tx data reg empty */
22 .macro addruart, rp, rv, tmp
23 ldr \rp, =STM32_UART_BASE @ physical base
24 ldr \rv, =STM32_UART_BASE @ virt base /* NoMMU */
28 strb \rd, [\rx, #STM32_USART_TDR_OFF]
32 1001: ldr \rd, [\rx, #(STM32_USART_SR_OFF)] @ Read Status Register
33 tst \rd, #STM32_USART_TXE @ TXE = 1 = tx empty
38 1001: ldr \rd, [\rx, #(STM32_USART_SR_OFF)] @ Read Status Register
39 tst \rd, #STM32_USART_TC @ TC = 1 = tx complete