xref: /openbmc/linux/arch/arm/include/debug/imx.S (revision d0b73b48)
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#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
27#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
39#elif defined (CONFIG_DEBUG_IMX6Q_UART)
40#define UART_PADDR	IMX6Q_DEBUG_UART_BASE
41#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
75