xref: /linux/arch/arm/include/debug/sti.S (revision ec8a42e7343234802b9054874fe01810880289ce)
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 */
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	waituartcts,rd,rx
49		.endm
50
51                .macro  waituarttxrdy,rd,rx
521001:           ldr     \rd, [\rx, #ASC_STA_OFF]
53                tst     \rd, #ASC_STA_TX_FULL
54                bne     1001b
55                .endm
56
57                .macro  busyuart,rd,rx
581001:           ldr     \rd, [\rx, #ASC_STA_OFF]
59                tst     \rd, #ASC_STA_TX_EMPTY
60                beq     1001b
61                .endm
62