aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/include/mach/debug-macro.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1/include/mach/debug-macro.S')
-rw-r--r--arch/arm/mach-omap1/include/mach/debug-macro.S107
1 files changed, 107 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
new file mode 100644
index 000000000000..b6d9584544b4
--- /dev/null
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -0,0 +1,107 @@
1/* arch/arm/mach-omap1/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
14#include <linux/serial_reg.h>
15
16#include <plat/serial.h>
17
18 .pushsection .data
19omap_uart_phys: .word 0x0
20omap_uart_virt: .word 0x0
21 .popsection
22
23 /*
24 * Note that this code won't work if the bootloader passes
25 * a wrong machine ID number in r1. To debug, just hardcode
26 * the desired UART phys and virt addresses temporarily into
27 * the omap_uart_phys and omap_uart_virt above.
28 */
29 .macro addruart, rx, tmp
30
31 /* Use omap_uart_phys/virt if already configured */
329: mrc p15, 0, \rx, c1, c0
33 tst \rx, #1 @ MMU enabled?
34 ldreq \rx, =omap_uart_phys @ physical base address
35 ldrne \rx, =omap_uart_virt @ virtual base
36 ldr \rx, [\rx, #0]
37 cmp \rx, #0 @ is port configured?
38 bne 99f @ already configured
39
40 /* Check 7XX UART1 scratchpad register for uart to use */
41 mrc p15, 0, \rx, c1, c0
42 tst \rx, #1 @ MMU enabled?
43 moveq \rx, #0xff000000 @ physical base address
44 movne \rx, #0xfe000000 @ virtual base
45 orr \rx, \rx, #0x00fb0000 @ OMAP1UART1
46 ldrb \rx, [\rx, #(UART_SCR << OMAP7XX_PORT_SHIFT)]
47 cmp \rx, #0 @ anything in 7XX scratchpad?
48 bne 10f @ found 7XX uart
49
50 /* Check 15xx/16xx UART1 scratchpad register for uart to use */
51 mrc p15, 0, \rx, c1, c0
52 tst \rx, #1 @ MMU enabled?
53 moveq \rx, #0xff000000 @ physical base address
54 movne \rx, #0xfe000000 @ virtual base
55 orr \rx, \rx, #0x00fb0000 @ OMAP1UART1
56 ldrb \rx, [\rx, #(UART_SCR << OMAP_PORT_SHIFT)]
57
58 /* Select the UART to use based on the UART1 scratchpad value */
5910: cmp \rx, #0 @ no port configured?
60 beq 11f @ if none, try to use UART1
61 cmp \rx, #OMAP1UART1
62 beq 11f @ configure OMAP1UART1
63 cmp \rx, #OMAP1UART2
64 beq 12f @ configure OMAP1UART2
65 cmp \rx, #OMAP1UART3
66 beq 13f @ configure OMAP2UART3
67
68 /* Configure the UART offset from the phys/virt base */
6911: mov \rx, #0x00fb0000 @ OMAP1UART1
70 b 98f
7112: mov \rx, #0x00fb0000 @ OMAP1UART1
72 orr \rx, \rx, #0x00000800 @ OMAP1UART2
73 b 98f
7413: mov \rx, #0x00fb0000 @ OMAP1UART1
75 orr \rx, \rx, #0x00000800 @ OMAP1UART2
76 orr \rx, \rx, #0x00009000 @ OMAP1UART3
77
78 /* Store both phys and virt address for the uart */
7998: add \rx, \rx, #0xff000000 @ phys base
80 ldr \tmp, =omap_uart_phys
81 str \rx, [\tmp, #0]
82 sub \rx, \rx, #0xff000000 @ phys base
83 add \rx, \rx, #0xfe000000 @ virt base
84 ldr \tmp, =omap_uart_virt
85 str \rx, [\tmp, #0]
86 b 9b
8799:
88 .endm
89
90 .macro senduart,rd,rx
91 strb \rd, [\rx]
92 .endm
93
94 .macro busyuart,rd,rx
951001: ldrb \rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)]
96 and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
97 teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
98 beq 1002f
99 ldrb \rd, [\rx, #(UART_LSR << OMAP7XX_PORT_SHIFT)]
100 and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
101 teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
102 bne 1001b
1031002:
104 .endm
105
106 .macro waituart,rd,rx
107 .endm