]> git.ipfire.org Git - thirdparty/kernel/stable.git/blame - arch/arm/include/debug/sti.S
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500
[thirdparty/kernel/stable.git] / arch / arm / include / debug / sti.S
CommitLineData
d2912cb1 1/* SPDX-License-Identifier: GPL-2.0-only */
5026aecf
SK
2/*
3 * arch/arm/include/debug/sti.S
4 *
5 * Debugging macro include header
6 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
5026aecf
SK
7 */
8
9#define STIH41X_COMMS_BASE 0xfed00000
10#define STIH41X_ASC2_BASE (STIH41X_COMMS_BASE+0x32000)
11
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)
15
16
17#define VIRT_ADDRESS(x) (x - 0x1000000)
18
19#if IS_ENABLED(CONFIG_STIH41X_DEBUG_ASC2)
20#define DEBUG_LL_UART_BASE STIH41X_ASC2_BASE
21#endif
22
23#if IS_ENABLED(CONFIG_STIH41X_DEBUG_SBC_ASC1)
24#define DEBUG_LL_UART_BASE STIH41X_SBC_ASC1_BASE
25#endif
26
27#ifndef DEBUG_LL_UART_BASE
28#error "DEBUG UART is not Configured"
29#endif
30
31#define ASC_TX_BUF_OFF 0x04
32#define ASC_CTRL_OFF 0x0c
33#define ASC_STA_OFF 0x14
34
35#define ASC_STA_TX_FULL (1<<9)
36#define ASC_STA_TX_EMPTY (1<<1)
37
38
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
43
44 .macro senduart,rd,rx
45 strb \rd, [\rx, #ASC_TX_BUF_OFF]
46 .endm
47
48 .macro waituart,rd,rx
491001: ldr \rd, [\rx, #ASC_STA_OFF]
50 tst \rd, #ASC_STA_TX_FULL
51 bne 1001b
52 .endm
53
54 .macro busyuart,rd,rx
551001: ldr \rd, [\rx, #ASC_STA_OFF]
56 tst \rd, #ASC_STA_TX_EMPTY
57 beq 1001b
58 .endm