Merge tag 'locking-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / arm / include / debug / sti.S
blob72d0525118908804f9d24b751211ae191dbe9100
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * arch/arm/include/debug/sti.S
4  *
5  * Debugging macro include header
6  * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
7  */
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
21 #endif
23 #if IS_ENABLED(CONFIG_STIH41X_DEBUG_SBC_ASC1)
24 #define DEBUG_LL_UART_BASE      STIH41X_SBC_ASC1_BASE
25 #endif
27 #ifndef DEBUG_LL_UART_BASE
28 #error "DEBUG UART is not Configured"
29 #endif
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
42                 .endm
44                 .macro  senduart,rd,rx
45                 strb    \rd, [\rx, #ASC_TX_BUF_OFF]
46                 .endm
48                 .macro  waituartcts,rd,rx
49                 .endm
51                 .macro  waituarttxrdy,rd,rx
52 1001:           ldr     \rd, [\rx, #ASC_STA_OFF]
53                 tst     \rd, #ASC_STA_TX_FULL
54                 bne     1001b
55                 .endm
57                 .macro  busyuart,rd,rx
58 1001:           ldr     \rd, [\rx, #ASC_STA_OFF]
59                 tst     \rd, #ASC_STA_TX_EMPTY
60                 beq     1001b
61                 .endm