xref: /openbmc/linux/arch/arm/include/debug/sti.S (revision 8c0b9ee8)
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 */
11
12#define STIH41X_COMMS_BASE              0xfed00000
13#define STIH41X_ASC2_BASE               (STIH41X_COMMS_BASE+0x32000)
14
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)
18
19
20#define VIRT_ADDRESS(x)		(x - 0x1000000)
21
22#if IS_ENABLED(CONFIG_STIH41X_DEBUG_ASC2)
23#define DEBUG_LL_UART_BASE	STIH41X_ASC2_BASE
24#endif
25
26#if IS_ENABLED(CONFIG_STIH41X_DEBUG_SBC_ASC1)
27#define DEBUG_LL_UART_BASE	STIH41X_SBC_ASC1_BASE
28#endif
29
30#ifndef DEBUG_LL_UART_BASE
31#error "DEBUG UART is not Configured"
32#endif
33
34#define ASC_TX_BUF_OFF  0x04
35#define ASC_CTRL_OFF    0x0c
36#define ASC_STA_OFF     0x14
37
38#define ASC_STA_TX_FULL         (1<<9)
39#define ASC_STA_TX_EMPTY        (1<<1)
40
41
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
46
47                .macro  senduart,rd,rx
48                strb    \rd, [\rx, #ASC_TX_BUF_OFF]
49                .endm
50
51                .macro  waituart,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