1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * arch/arm/include/debug/sti.S
5 * Debugging macro include header
6 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
9 #define STIH41X_COMMS_BASE 0xfed00000
10 #define STIH41X_ASC2_BASE (STIH41X_COMMS_BASE+0x32000)
12 #define STIH41X_SBC_LPM_BASE 0xfe400000
13 #define STIH41X_SBC_COMMS_BASE (STIH41X_SBC_LPM_BASE + 0x100000)
14 #define STIH41X_SBC_ASC1_BASE (STIH41X_SBC_COMMS_BASE + 0x31000)
17 #define VIRT_ADDRESS(x) (x - 0x1000000)
19 #if IS_ENABLED(CONFIG_STIH41X_DEBUG_ASC2)
20 #define DEBUG_LL_UART_BASE STIH41X_ASC2_BASE
23 #if IS_ENABLED(CONFIG_STIH41X_DEBUG_SBC_ASC1)
24 #define DEBUG_LL_UART_BASE STIH41X_SBC_ASC1_BASE
27 #ifndef DEBUG_LL_UART_BASE
28 #error "DEBUG UART is not Configured"
31 #define ASC_TX_BUF_OFF 0x04
32 #define ASC_CTRL_OFF 0x0c
33 #define ASC_STA_OFF 0x14
35 #define ASC_STA_TX_FULL (1<<9)
36 #define ASC_STA_TX_EMPTY (1<<1)
39 .macro addruart, rp, rv, tmp
40 ldr \rp, =DEBUG_LL_UART_BASE @ physical base
41 ldr \rv, =VIRT_ADDRESS(DEBUG_LL_UART_BASE) @ virt base
45 strb \rd, [\rx, #ASC_TX_BUF_OFF]
48 .macro waituartcts,rd,rx
51 .macro waituarttxrdy,rd,rx
52 1001: ldr \rd, [\rx, #ASC_STA_OFF]
53 tst \rd, #ASC_STA_TX_FULL
58 1001: ldr \rd, [\rx, #ASC_STA_OFF]
59 tst \rd, #ASC_STA_TX_EMPTY