Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / arm / include / debug / sti.S
blobe3aa58ff17761fd7b1f0b909a075783b3917cb7d
1 /*
2  * arch/arm/include/debug/sti.S
3  *
4  * Debugging macro include header
5  * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
12 #define STIH41X_COMMS_BASE              0xfed00000
13 #define STIH41X_ASC2_BASE               (STIH41X_COMMS_BASE+0x32000)
15 #define STIH41X_SBC_LPM_BASE            0xfe400000
16 #define STIH41X_SBC_COMMS_BASE          (STIH41X_SBC_LPM_BASE + 0x100000)
17 #define STIH41X_SBC_ASC1_BASE           (STIH41X_SBC_COMMS_BASE + 0x31000)
20 #define VIRT_ADDRESS(x)         (x - 0x1000000)
22 #if IS_ENABLED(CONFIG_STIH41X_DEBUG_ASC2)
23 #define DEBUG_LL_UART_BASE      STIH41X_ASC2_BASE
24 #endif
26 #if IS_ENABLED(CONFIG_STIH41X_DEBUG_SBC_ASC1)
27 #define DEBUG_LL_UART_BASE      STIH41X_SBC_ASC1_BASE
28 #endif
30 #ifndef DEBUG_LL_UART_BASE
31 #error "DEBUG UART is not Configured"
32 #endif
34 #define ASC_TX_BUF_OFF  0x04
35 #define ASC_CTRL_OFF    0x0c
36 #define ASC_STA_OFF     0x14
38 #define ASC_STA_TX_FULL         (1<<9)
39 #define ASC_STA_TX_EMPTY        (1<<1)
42                 .macro  addruart, rp, rv, tmp
43                 ldr     \rp,      =DEBUG_LL_UART_BASE   @ physical base
44                 ldr     \rv,      =VIRT_ADDRESS(DEBUG_LL_UART_BASE) @ virt base
45                 .endm
47                 .macro  senduart,rd,rx
48                 strb    \rd, [\rx, #ASC_TX_BUF_OFF]
49                 .endm
51                 .macro  waituart,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