blob: 0c4e17d4d359a42cb372341045068f7dc44462c6 [file] [log] [blame]
Shawn Guo6dde5ac2012-09-16 20:50:45 +08001/* 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 */
Shawn Guo49c9e602012-10-08 13:44:29 +080013#define IMX6Q_UART1_BASE_ADDR 0x02020000
14#define IMX6Q_UART2_BASE_ADDR 0x021e8000
15#define IMX6Q_UART3_BASE_ADDR 0x021ec000
16#define IMX6Q_UART4_BASE_ADDR 0x021f0000
17#define IMX6Q_UART5_BASE_ADDR 0x021f4000
18
19/*
20 * IMX6Q_UART_BASE_ADDR is put in the middle to force the expansion
21 * of IMX6Q_UART##n##_BASE_ADDR.
22 */
23#define IMX6Q_UART_BASE_ADDR(n) IMX6Q_UART##n##_BASE_ADDR
24#define IMX6Q_UART_BASE(n) IMX6Q_UART_BASE_ADDR(n)
25#define IMX6Q_DEBUG_UART_BASE IMX6Q_UART_BASE(CONFIG_DEBUG_IMX6Q_UART_PORT)
26
Shawn Guo6dde5ac2012-09-16 20:50:45 +080027#ifdef CONFIG_DEBUG_IMX1_UART
28#define UART_PADDR 0x00206000
29#elif defined (CONFIG_DEBUG_IMX25_UART)
30#define UART_PADDR 0x43f90000
31#elif defined (CONFIG_DEBUG_IMX21_IMX27_UART)
32#define UART_PADDR 0x1000a000
33#elif defined (CONFIG_DEBUG_IMX31_IMX35_UART)
34#define UART_PADDR 0x43f90000
35#elif defined (CONFIG_DEBUG_IMX51_UART)
36#define UART_PADDR 0x73fbc000
37#elif defined (CONFIG_DEBUG_IMX50_IMX53_UART)
38#define UART_PADDR 0x53fbc000
Shawn Guo49c9e602012-10-08 13:44:29 +080039#elif defined (CONFIG_DEBUG_IMX6Q_UART)
40#define UART_PADDR IMX6Q_DEBUG_UART_BASE
Shawn Guo6dde5ac2012-09-16 20:50:45 +080041#endif
42
43/*
44 * FIXME: This is a copy of IMX_IO_P2V in hardware.h, and needs to
45 * stay sync with that. It's hard to maintain, and should be fixed
46 * globally for multi-platform build to use a fixed virtual address
47 * for low-level debug uart port across platforms.
48 */
49#define IMX_IO_P2V(x) ( \
50 (((x) & 0x80000000) >> 7) | \
51 (0xf4000000 + \
52 (((x) & 0x50000000) >> 6) + \
53 (((x) & 0x0b000000) >> 4) + \
54 (((x) & 0x000fffff))))
55
56#define UART_VADDR IMX_IO_P2V(UART_PADDR)
57
58 .macro addruart, rp, rv, tmp
59 ldr \rp, =UART_PADDR @ physical
60 ldr \rv, =UART_VADDR @ virtual
61 .endm
62
63 .macro senduart,rd,rx
64 str \rd, [\rx, #0x40] @ TXDATA
65 .endm
66
67 .macro waituart,rd,rx
68 .endm
69
70 .macro busyuart,rd,rx
711002: ldr \rd, [\rx, #0x98] @ SR2
72 tst \rd, #1 << 3 @ TXDC
73 beq 1002b @ wait until transmit done
74 .endm