ARM: imx: move debug macros to include/debug
[firefly-linux-kernel-4.4.55.git] / arch / arm / include / debug / imx.S
1 /* arch/arm/mach-imx/include/mach/debug-macro.S
2  *
3  * Debugging macro include header
4  *
5  *  Copyright (C) 1994-1999 Russell King
6  *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  *
12  */
13 #ifdef CONFIG_DEBUG_IMX1_UART
14 #define UART_PADDR      0x00206000
15 #elif defined (CONFIG_DEBUG_IMX25_UART)
16 #define UART_PADDR      0x43f90000
17 #elif defined (CONFIG_DEBUG_IMX21_IMX27_UART)
18 #define UART_PADDR      0x1000a000
19 #elif defined (CONFIG_DEBUG_IMX31_IMX35_UART)
20 #define UART_PADDR      0x43f90000
21 #elif defined (CONFIG_DEBUG_IMX51_UART)
22 #define UART_PADDR      0x73fbc000
23 #elif defined (CONFIG_DEBUG_IMX50_IMX53_UART)
24 #define UART_PADDR      0x53fbc000
25 #elif defined (CONFIG_DEBUG_IMX6Q_UART2)
26 #define UART_PADDR      0x021e8000
27 #elif defined (CONFIG_DEBUG_IMX6Q_UART4)
28 #define UART_PADDR      0x021f0000
29 #endif
30
31 /*
32  * FIXME: This is a copy of IMX_IO_P2V in hardware.h, and needs to
33  * stay sync with that.  It's hard to maintain, and should be fixed
34  * globally for multi-platform build to use a fixed virtual address
35  * for low-level debug uart port across platforms.
36  */
37 #define IMX_IO_P2V(x)   (                                               \
38                         (((x) & 0x80000000) >> 7) |                     \
39                         (0xf4000000 +                                   \
40                         (((x) & 0x50000000) >> 6) +                     \
41                         (((x) & 0x0b000000) >> 4) +                     \
42                         (((x) & 0x000fffff))))
43
44 #define UART_VADDR      IMX_IO_P2V(UART_PADDR)
45
46                 .macro  addruart, rp, rv, tmp
47                 ldr     \rp, =UART_PADDR        @ physical
48                 ldr     \rv, =UART_VADDR        @ virtual
49                 .endm
50
51                 .macro  senduart,rd,rx
52                 str     \rd, [\rx, #0x40]       @ TXDATA
53                 .endm
54
55                 .macro  waituart,rd,rx
56                 .endm
57
58                 .macro  busyuart,rd,rx
59 1002:           ldr     \rd, [\rx, #0x98]       @ SR2
60                 tst     \rd, #1 << 3            @ TXDC
61                 beq     1002b                   @ wait until transmit done
62                 .endm