aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorJeremy Kerr <jeremy.kerr@canonical.com>2010-07-06 06:30:06 -0400
committerNicolas Pitre <nico@fluxnic.net>2010-10-20 00:27:33 -0400
commit0ea1293009826da45e1019f45dfde1e557bb30df (patch)
tree7111bcd355921f03415182845e5f236ffe1896f4 /arch/arm
parent1ea64615601229f0dc16dee91dc5b50216411baa (diff)
arm: return both physical and virtual addresses from addruart
Rather than checking the MMU status in every instance of addruart, do it once in kernel/debug.S, and change the existing addruart macros to return both physical and virtual addresses. The main debug code can then select the appropriate address to use. This will also allow us to retreive the address of a uart for the MMU state that we're not current in. Updated with fixes for OMAP from Jason Wang <jason77.wang@gmail.com> and Tony Lindgren <tony@atomide.com>, and fix for versatile express from Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>. Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Jason Wang <jason77.wang@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Tested-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/kernel/debug.S22
-rw-r--r--arch/arm/mach-aaec2000/include/mach/debug-macro.S10
-rw-r--r--arch/arm/mach-at91/include/mach/debug-macro.S8
-rw-r--r--arch/arm/mach-clps711x/include/mach/debug-macro.S12
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/debug-macro.S10
-rw-r--r--arch/arm/mach-davinci/include/mach/debug-macro.S46
-rw-r--r--arch/arm/mach-dove/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-ebsa110/include/mach/debug-macro.S7
-rw-r--r--arch/arm/mach-ep93xx/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-footbridge/include/mach/debug-macro.S22
-rw-r--r--arch/arm/mach-gemini/include/mach/debug-macro.S8
-rw-r--r--arch/arm/mach-h720x/include/mach/debug-macro.S10
-rw-r--r--arch/arm/mach-integrator/include/mach/debug-macro.S10
-rw-r--r--arch/arm/mach-iop13xx/include/mach/debug-macro.S16
-rw-r--r--arch/arm/mach-iop32x/include/mach/debug-macro.S7
-rw-r--r--arch/arm/mach-iop33x/include/mach/debug-macro.S12
-rw-r--r--arch/arm/mach-ixp2000/include/mach/debug-macro.S14
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/debug-macro.S16
-rw-r--r--arch/arm/mach-kirkwood/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-ks8695/include/mach/debug-macro.S8
-rw-r--r--arch/arm/mach-l7200/include/mach/debug-macro.S38
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/debug-macro.S10
-rw-r--r--arch/arm/mach-loki/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/debug-macro.S8
-rw-r--r--arch/arm/mach-mmp/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-msm/include/mach/debug-macro.S20
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-netx/include/mach/debug-macro.S10
-rw-r--r--arch/arm/mach-nomadik/include/mach/debug-macro.S12
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/debug-macro.S8
-rw-r--r--arch/arm/mach-omap1/include/mach/debug-macro.S68
-rw-r--r--arch/arm/mach-omap2/include/mach/debug-macro.S127
-rw-r--r--arch/arm/mach-orion5x/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-pnx4008/include/mach/debug-macro.S10
-rw-r--r--arch/arm/mach-pxa/include/mach/debug-macro.S10
-rw-r--r--arch/arm/mach-realview/include/mach/debug-macro.S10
-rw-r--r--arch/arm/mach-rpc/include/mach/debug-macro.S12
-rw-r--r--arch/arm/mach-s3c2410/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-s5p6442/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-s5pc100/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-s5pv210/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-s5pv310/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-sa1100/include/mach/debug-macro.S36
-rw-r--r--arch/arm/mach-shark/include/mach/debug-macro.S7
-rw-r--r--arch/arm/mach-tegra/include/mach/debug-macro.S26
-rw-r--r--arch/arm/mach-u300/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-ux500/include/mach/debug-macro.S8
-rw-r--r--arch/arm/mach-versatile/include/mach/debug-macro.S12
-rw-r--r--arch/arm/mach-vexpress/include/mach/debug-macro.S10
-rw-r--r--arch/arm/plat-mxc/include/mach/debug-macro.S8
-rw-r--r--arch/arm/plat-spear/include/plat/debug-macro.S8
-rw-r--r--arch/arm/plat-stmp3xxx/include/mach/debug-macro.S11
-rw-r--r--arch/arm/plat-tcc/include/mach/debug-macro.S11
56 files changed, 440 insertions, 454 deletions
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index f91395206a4b..a0f07521ca8a 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -22,7 +22,7 @@
22#if defined(CONFIG_DEBUG_ICEDCC) 22#if defined(CONFIG_DEBUG_ICEDCC)
23 @@ debug using ARM EmbeddedICE DCC channel 23 @@ debug using ARM EmbeddedICE DCC channel
24 24
25 .macro addruart, rx, tmp 25 .macro addruart, rp, rv
26 .endm 26 .endm
27 27
28#if defined(CONFIG_CPU_V6) 28#if defined(CONFIG_CPU_V6)
@@ -121,6 +121,22 @@ wait: mrc p14, 0, pc, c0, c1, 0
121#include <mach/debug-macro.S> 121#include <mach/debug-macro.S>
122#endif /* CONFIG_DEBUG_ICEDCC */ 122#endif /* CONFIG_DEBUG_ICEDCC */
123 123
124#ifdef CONFIG_MMU
125 .macro addruart_current, rx, tmp1, tmp2
126 addruart \tmp1, \tmp2
127 mrc p15, 0, \rx, c1, c0
128 tst \rx, #1
129 moveq \rx, \tmp1
130 movne \rx, \tmp2
131 .endm
132
133#else /* !CONFIG_MMU */
134 .macro addruart_current, rx, tmp1, tmp2
135 addruart \rx, \tmp1
136 .endm
137
138#endif /* CONFIG_MMU */
139
124/* 140/*
125 * Useful debugging routines 141 * Useful debugging routines
126 */ 142 */
@@ -155,7 +171,7 @@ ENDPROC(printhex2)
155 .ltorg 171 .ltorg
156 172
157ENTRY(printascii) 173ENTRY(printascii)
158 addruart r3, r1 174 addruart_current r3, r1, r2
159 b 2f 175 b 2f
1601: waituart r2, r3 1761: waituart r2, r3
161 senduart r1, r3 177 senduart r1, r3
@@ -171,7 +187,7 @@ ENTRY(printascii)
171ENDPROC(printascii) 187ENDPROC(printascii)
172 188
173ENTRY(printch) 189ENTRY(printch)
174 addruart r3, r1 190 addruart_current r3, r1, r2
175 mov r1, r0 191 mov r1, r0
176 mov r0, #0 192 mov r0, #0
177 b 1b 193 b 1b
diff --git a/arch/arm/mach-aaec2000/include/mach/debug-macro.S b/arch/arm/mach-aaec2000/include/mach/debug-macro.S
index a9cac368bfe6..bc7ad5561c4c 100644
--- a/arch/arm/mach-aaec2000/include/mach/debug-macro.S
+++ b/arch/arm/mach-aaec2000/include/mach/debug-macro.S
@@ -10,12 +10,10 @@
10 */ 10 */
11 11
12#include "hardware.h" 12#include "hardware.h"
13 .macro addruart, rx, tmp 13 .macro addruart, rp, rv
14 mrc p15, 0, \rx, c1, c0 14 mov \rp, 0x00000800
15 tst \rx, #1 @ MMU enabled? 15 orr \rv, \rp, #io_p2v(0x80000000) @ virtual
16 moveq \rx, #0x80000000 @ physical 16 orr \rp, \rp, #0x80000000 @ physical
17 movne \rx, #io_p2v(0x80000000) @ virtual
18 orr \rx, \rx, #0x00000800
19 .endm 17 .endm
20 18
21 .macro senduart,rd,rx 19 .macro senduart,rd,rx
diff --git a/arch/arm/mach-at91/include/mach/debug-macro.S b/arch/arm/mach-at91/include/mach/debug-macro.S
index 9e750a1c1b5a..0f959faf74a9 100644
--- a/arch/arm/mach-at91/include/mach/debug-macro.S
+++ b/arch/arm/mach-at91/include/mach/debug-macro.S
@@ -14,11 +14,9 @@
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <mach/at91_dbgu.h> 15#include <mach/at91_dbgu.h>
16 16
17 .macro addruart, rx, tmp 17 .macro addruart, rp, rv
18 mrc p15, 0, \rx, c1, c0 18 ldr \rp, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address)
19 tst \rx, #1 @ MMU enabled? 19 ldr \rv, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address)
20 ldreq \rx, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address)
21 ldrne \rx, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address)
22 .endm 20 .endm
23 21
24 .macro senduart,rd,rx 22 .macro senduart,rd,rx
diff --git a/arch/arm/mach-clps711x/include/mach/debug-macro.S b/arch/arm/mach-clps711x/include/mach/debug-macro.S
index 072cc6b61ba3..507c6873b7ee 100644
--- a/arch/arm/mach-clps711x/include/mach/debug-macro.S
+++ b/arch/arm/mach-clps711x/include/mach/debug-macro.S
@@ -14,16 +14,14 @@
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <asm/hardware/clps7111.h> 15#include <asm/hardware/clps7111.h>
16 16
17 .macro addruart, rx, tmp 17 .macro addruart, rp, rv
18 mrc p15, 0, \rx, c1, c0
19 tst \rx, #1 @ MMU enabled?
20 moveq \rx, #CLPS7111_PHYS_BASE
21 movne \rx, #CLPS7111_VIRT_BASE
22#ifndef CONFIG_DEBUG_CLPS711X_UART2 18#ifndef CONFIG_DEBUG_CLPS711X_UART2
23 add \rx, \rx, #0x0000 @ UART1 19 mov \rp, #0x0000 @ UART1
24#else 20#else
25 add \rx, \rx, #0x1000 @ UART2 21 mov \rp, #0x1000 @ UART2
26#endif 22#endif
23 orr \rv, \rp, #CLPS7111_VIRT_BASE
24 orr \rp, \rp, #CLPS7111_PHYS_BASE
27 .endm 25 .endm
28 26
29 .macro senduart,rd,rx 27 .macro senduart,rd,rx
diff --git a/arch/arm/mach-cns3xxx/include/mach/debug-macro.S b/arch/arm/mach-cns3xxx/include/mach/debug-macro.S
index d16ce7eb00e9..56d828634db5 100644
--- a/arch/arm/mach-cns3xxx/include/mach/debug-macro.S
+++ b/arch/arm/mach-cns3xxx/include/mach/debug-macro.S
@@ -10,12 +10,10 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13 .macro addruart,rx 13 .macro addruart,rp,rv
14 mrc p15, 0, \rx, c1, c0 14 mov \rp, #0x00009000
15 tst \rx, #1 @ MMU enabled? 15 orr \rv, \rp, #0xf0000000 @ virtual base
16 moveq \rx, #0x10000000 16 orr \rp, \rp, #0x10000000
17 movne \rx, #0xf0000000 @ virtual base
18 orr \rx, \rx, #0x00009000
19 .endm 17 .endm
20 18
21#include <asm/hardware/debug-pl01x.S> 19#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S b/arch/arm/mach-davinci/include/mach/debug-macro.S
index f761dfdb8689..9f1befc5ac38 100644
--- a/arch/arm/mach-davinci/include/mach/debug-macro.S
+++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
@@ -29,35 +29,39 @@ davinci_uart_phys: .word 0
29davinci_uart_virt: .word 0 29davinci_uart_virt: .word 0
30 .popsection 30 .popsection
31 31
32 .macro addruart, rx, tmp 32 .macro addruart, rp, rv
33 33
34 /* Use davinci_uart_phys/virt if already configured */ 34 /* Use davinci_uart_phys/virt if already configured */
3510: mrc p15, 0, \rx, c1, c0 3510: mrc p15, 0, \rp, c1, c0
36 tst \rx, #1 @ MMU enabled? 36 tst \rp, #1 @ MMU enabled?
37 ldreq \rx, =__virt_to_phys(davinci_uart_phys) 37 ldreq \rp, =__virt_to_phys(davinci_uart_phys)
38 ldrne \rx, =davinci_uart_virt 38 ldrne \rp, =davinci_uart_phys
39 ldr \rx, [\rx] 39 add \rv, \rp, #4 @ davinci_uart_virt
40 cmp \rx, #0 @ is port configured? 40 ldr \rp, [\rp, #0]
41 ldr \rv, [\rv, #0]
42 cmp \rp, #0 @ is port configured?
43 cmpne \rv, #0
41 bne 99f @ already configured 44 bne 99f @ already configured
42 45
43 mrc p15, 0, \rx, c1, c0 46 /* Check the debug UART address set in uncompress.h */
44 tst \rx, #1 @ MMU enabled? 47 mrc p15, 0, \rp, c1, c0
48 tst \rp, #1 @ MMU enabled?
45 49
46 /* Copy uart phys address from decompressor uart info */ 50 /* Copy uart phys address from decompressor uart info */
47 ldreq \tmp, =__virt_to_phys(davinci_uart_phys) 51 ldreq \rv, =__virt_to_phys(davinci_uart_phys)
48 ldrne \tmp, =davinci_uart_phys 52 ldrne \rv, =davinci_uart_phys
49 ldreq \rx, =DAVINCI_UART_INFO 53 ldreq \rp, =DAVINCI_UART_INFO
50 ldrne \rx, =__phys_to_virt(DAVINCI_UART_INFO) 54 ldrne \rp, =__phys_to_virt(DAVINCI_UART_INFO)
51 ldr \rx, [\rx, #0] 55 ldr \rp, [\rp, #0]
52 str \rx, [\tmp] 56 str \rp, [\rv]
53 57
54 /* Copy uart virt address from decompressor uart info */ 58 /* Copy uart virt address from decompressor uart info */
55 ldreq \tmp, =__virt_to_phys(davinci_uart_virt) 59 ldreq \rv, =__virt_to_phys(davinci_uart_virt)
56 ldrne \tmp, =davinci_uart_virt 60 ldrne \rv, =davinci_uart_virt
57 ldreq \rx, =DAVINCI_UART_INFO 61 ldreq \rp, =DAVINCI_UART_INFO
58 ldrne \rx, =__phys_to_virt(DAVINCI_UART_INFO) 62 ldrne \rp, =__phys_to_virt(DAVINCI_UART_INFO)
59 ldr \rx, [\rx, #4] 63 ldr \rp, [\rp, #4]
60 str \rx, [\tmp] 64 str \rp, [\rv]
61 65
62 b 10b 66 b 10b
6399: 6799:
diff --git a/arch/arm/mach-dove/include/mach/debug-macro.S b/arch/arm/mach-dove/include/mach/debug-macro.S
index 1521d13f1d14..da8bf2bad3b1 100644
--- a/arch/arm/mach-dove/include/mach/debug-macro.S
+++ b/arch/arm/mach-dove/include/mach/debug-macro.S
@@ -8,12 +8,11 @@
8 8
9#include <mach/bridge-regs.h> 9#include <mach/bridge-regs.h>
10 10
11 .macro addruart, rx, tmp 11 .macro addruart, rp, rv
12 mrc p15, 0, \rx, c1, c0 12 ldr \rp, =DOVE_SB_REGS_PHYS_BASE
13 tst \rx, #1 @ MMU enabled? 13 ldr \rv, =DOVE_SB_REGS_VIRT_BASE
14 ldreq \rx, =DOVE_SB_REGS_PHYS_BASE 14 orr \rp, \rp, #0x00012000
15 ldrne \rx, =DOVE_SB_REGS_VIRT_BASE 15 orr \rv, \rv, #0x00012000
16 orr \rx, \rx, #0x00012000
17 .endm 16 .endm
18 17
19#define UART_SHIFT 2 18#define UART_SHIFT 2
diff --git a/arch/arm/mach-ebsa110/include/mach/debug-macro.S b/arch/arm/mach-ebsa110/include/mach/debug-macro.S
index ebbd89f0e6c0..7ef5690fd08c 100644
--- a/arch/arm/mach-ebsa110/include/mach/debug-macro.S
+++ b/arch/arm/mach-ebsa110/include/mach/debug-macro.S
@@ -11,9 +11,10 @@
11 * 11 *
12**/ 12**/
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mov \rx, #0xf0000000 15 mov \rp, #0xf0000000
16 orr \rx, \rx, #0x00000be0 16 orr \rp, \rp, #0x00000be0
17 mov \rp, \rv
17 .endm 18 .endm
18 19
19#define UART_SHIFT 2 20#define UART_SHIFT 2
diff --git a/arch/arm/mach-ep93xx/include/mach/debug-macro.S b/arch/arm/mach-ep93xx/include/mach/debug-macro.S
index 5cd22444e223..b25bc9076367 100644
--- a/arch/arm/mach-ep93xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-ep93xx/include/mach/debug-macro.S
@@ -11,12 +11,11 @@
11 */ 11 */
12#include <mach/ep93xx-regs.h> 12#include <mach/ep93xx-regs.h>
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mrc p15, 0, \rx, c1, c0 15 ldr \rp, =EP93XX_APB_PHYS_BASE @ Physical base
16 tst \rx, #1 @ MMU enabled? 16 ldr \rv, =EP93XX_APB_VIRT_BASE @ virtual base
17 ldreq \rx, =EP93XX_APB_PHYS_BASE @ Physical base 17 orr \rp, \rp, #0x000c0000
18 ldrne \rx, =EP93XX_APB_VIRT_BASE @ virtual base 18 orr \rv, \rv, #0x000c0000
19 orr \rx, \rx, #0x000c0000
20 .endm 19 .endm
21 20
22#include <asm/hardware/debug-pl01x.S> 21#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-footbridge/include/mach/debug-macro.S b/arch/arm/mach-footbridge/include/mach/debug-macro.S
index 60dda1318f22..3c9e0c40c679 100644
--- a/arch/arm/mach-footbridge/include/mach/debug-macro.S
+++ b/arch/arm/mach-footbridge/include/mach/debug-macro.S
@@ -15,12 +15,10 @@
15 15
16#ifndef CONFIG_DEBUG_DC21285_PORT 16#ifndef CONFIG_DEBUG_DC21285_PORT
17 /* For NetWinder debugging */ 17 /* For NetWinder debugging */
18 .macro addruart, rx, tmp 18 .macro addruart, rp, rv
19 mrc p15, 0, \rx, c1, c0 19 mov \rp, #0x000003f8
20 tst \rx, #1 @ MMU enabled? 20 orr \rv, \rp, #0x7c000000 @ physical
21 moveq \rx, #0x7c000000 @ physical 21 orr \rp, \rp, #0xff000000 @ virtual
22 movne \rx, #0xff000000 @ virtual
23 orr \rx, \rx, #0x000003f8
24 .endm 22 .endm
25 23
26#define UART_SHIFT 0 24#define UART_SHIFT 0
@@ -32,14 +30,14 @@
32 .equ dc21285_high, ARMCSR_BASE & 0xff000000 30 .equ dc21285_high, ARMCSR_BASE & 0xff000000
33 .equ dc21285_low, ARMCSR_BASE & 0x00ffffff 31 .equ dc21285_low, ARMCSR_BASE & 0x00ffffff
34 32
35 .macro addruart, rx, tmp 33 .macro addruart, rp, rv
36 mrc p15, 0, \rx, c1, c0
37 tst \rx, #1 @ MMU enabled?
38 moveq \rx, #0x42000000
39 movne \rx, #dc21285_high
40 .if dc21285_low 34 .if dc21285_low
41 orrne \rx, \rx, #dc21285_low 35 mov \rp, #dc21285_low
36 .else
37 mov \rp, #0
42 .endif 38 .endif
39 orr \rv, \rp, #0x42000000
40 orr \rp, \rp, #dc21285_high
43 .endm 41 .endm
44 42
45 .macro senduart,rd,rx 43 .macro senduart,rd,rx
diff --git a/arch/arm/mach-gemini/include/mach/debug-macro.S b/arch/arm/mach-gemini/include/mach/debug-macro.S
index ad477047069d..f40e006d296e 100644
--- a/arch/arm/mach-gemini/include/mach/debug-macro.S
+++ b/arch/arm/mach-gemini/include/mach/debug-macro.S
@@ -11,11 +11,9 @@
11 */ 11 */
12#include <mach/hardware.h> 12#include <mach/hardware.h>
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mrc p15, 0, \rx, c1, c0 15 ldr \rp, =GEMINI_UART_BASE @ physical
16 tst \rx, #1 @ MMU enabled? 16 ldr \rv, =IO_ADDRESS(GEMINI_UART_BASE) @ virtual
17 ldreq \rx, =GEMINI_UART_BASE @ physical
18 ldrne \rx, =IO_ADDRESS(GEMINI_UART_BASE) @ virtual
19 .endm 17 .endm
20 18
21#define UART_SHIFT 2 19#define UART_SHIFT 2
diff --git a/arch/arm/mach-h720x/include/mach/debug-macro.S b/arch/arm/mach-h720x/include/mach/debug-macro.S
index 27cafd12f033..c2093e835720 100644
--- a/arch/arm/mach-h720x/include/mach/debug-macro.S
+++ b/arch/arm/mach-h720x/include/mach/debug-macro.S
@@ -16,12 +16,10 @@
16 .equ io_virt, IO_VIRT 16 .equ io_virt, IO_VIRT
17 .equ io_phys, IO_PHYS 17 .equ io_phys, IO_PHYS
18 18
19 .macro addruart, rx, tmp 19 .macro addruart, rp, rv
20 mrc p15, 0, \rx, c1, c0 20 mov \rp, #0x00020000 @ UART1
21 tst \rx, #1 @ MMU enabled? 21 add \rv, \rp, #io_virt @ virtual address
22 moveq \rx, #io_phys @ physical base address 22 add \rp, \rp, #io_phys @ physical base address
23 movne \rx, #io_virt @ virtual address
24 add \rx, \rx, #0x00020000 @ UART1
25 .endm 23 .endm
26 24
27 .macro senduart,rd,rx 25 .macro senduart,rd,rx
diff --git a/arch/arm/mach-integrator/include/mach/debug-macro.S b/arch/arm/mach-integrator/include/mach/debug-macro.S
index 87a6888ae011..a1f598fd3a56 100644
--- a/arch/arm/mach-integrator/include/mach/debug-macro.S
+++ b/arch/arm/mach-integrator/include/mach/debug-macro.S
@@ -11,12 +11,10 @@
11 * 11 *
12*/ 12*/
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mrc p15, 0, \rx, c1, c0 15 mov \rp, #0x16000000 @ physical base address
16 tst \rx, #1 @ MMU enabled? 16 mov \rv, #0xf0000000 @ virtual base
17 moveq \rx, #0x16000000 @ physical base address 17 add \rv, \rv, #0x16000000 >> 4
18 movne \rx, #0xf0000000 @ virtual base
19 addne \rx, \rx, #0x16000000 >> 4
20 .endm 18 .endm
21 19
22#include <asm/hardware/debug-pl01x.S> 20#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-iop13xx/include/mach/debug-macro.S b/arch/arm/mach-iop13xx/include/mach/debug-macro.S
index c9d6ba46963d..e664466d51bf 100644
--- a/arch/arm/mach-iop13xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-iop13xx/include/mach/debug-macro.S
@@ -11,15 +11,13 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mrc p15, 0, \rx, c1, c0 15 mov \rp, #0x00002300
16 tst \rx, #1 @ mmu enabled? 16 orr \rp, \rp, #0x00000040
17 moveq \rx, #0xff000000 @ physical 17 orr \rv, \rp, #0xfe000000 @ virtual
18 orreq \rx, \rx, #0x00d80000 18 orr \rv, \rv, #0x00e80000
19 movne \rx, #0xfe000000 @ virtual 19 orr \rp, \rp, #0xff000000 @ physical
20 orrne \rx, \rx, #0x00e80000 20 orr \rp, \rp, #0x00d80000
21 orr \rx, \rx, #0x00002300
22 orr \rx, \rx, #0x00000040
23 .endm 21 .endm
24 22
25#define UART_SHIFT 2 23#define UART_SHIFT 2
diff --git a/arch/arm/mach-iop32x/include/mach/debug-macro.S b/arch/arm/mach-iop32x/include/mach/debug-macro.S
index 736afe1edd1f..ff9e76c09f35 100644
--- a/arch/arm/mach-iop32x/include/mach/debug-macro.S
+++ b/arch/arm/mach-iop32x/include/mach/debug-macro.S
@@ -11,9 +11,10 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mov \rx, #0xfe000000 @ physical as well as virtual 15 mov \rp, #0xfe000000 @ physical as well as virtual
16 orr \rx, \rx, #0x00800000 @ location of the UART 16 orr \rp, \rp, #0x00800000 @ location of the UART
17 mov \rv, \rp
17 .endm 18 .endm
18 19
19#define UART_SHIFT 0 20#define UART_SHIFT 0
diff --git a/arch/arm/mach-iop33x/include/mach/debug-macro.S b/arch/arm/mach-iop33x/include/mach/debug-macro.S
index addb2da78422..40c500dd1fac 100644
--- a/arch/arm/mach-iop33x/include/mach/debug-macro.S
+++ b/arch/arm/mach-iop33x/include/mach/debug-macro.S
@@ -11,13 +11,11 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mrc p15, 0, \rx, c1, c0 15 mov \rp, #0x00ff0000
16 tst \rx, #1 @ mmu enabled? 16 orr \rp, \rp, #0x0000f700
17 moveq \rx, #0xff000000 @ physical 17 orr \rv, #0xfe000000 @ virtual
18 movne \rx, #0xfe000000 @ virtual 18 orr \rp, #0xff000000 @ physical
19 orr \rx, \rx, #0x00ff0000
20 orr \rx, \rx, #0x0000f700
21 .endm 19 .endm
22 20
23#define UART_SHIFT 2 21#define UART_SHIFT 2
diff --git a/arch/arm/mach-ixp2000/include/mach/debug-macro.S b/arch/arm/mach-ixp2000/include/mach/debug-macro.S
index 6a827681680f..0ef533b20972 100644
--- a/arch/arm/mach-ixp2000/include/mach/debug-macro.S
+++ b/arch/arm/mach-ixp2000/include/mach/debug-macro.S
@@ -11,16 +11,14 @@
11 * 11 *
12*/ 12*/
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mrc p15, 0, \rx, c1, c0 15 mov \rp, #0x00030000
16 tst \rx, #1 @ MMU enabled?
17 moveq \rx, #0xc0000000 @ Physical base
18 movne \rx, #0xfe000000 @ virtual base
19 orrne \rx, \rx, #0x00f00000
20 orr \rx, \rx, #0x00030000
21#ifdef __ARMEB__ 16#ifdef __ARMEB__
22 orr \rx, \rx, #0x00000003 17 orr \rp, \rp, #0x00000003
23#endif 18#endif
19 orr \rv, \rp, #0xfe000000 @ virtual base
20 orr \rv, \rv, #0x00f00000
21 orr \rp, \rp, #0xc0000000 @ Physical base
24 .endm 22 .endm
25 23
26#define UART_SHIFT 2 24#define UART_SHIFT 2
diff --git a/arch/arm/mach-ixp23xx/include/mach/debug-macro.S b/arch/arm/mach-ixp23xx/include/mach/debug-macro.S
index a82e375465e2..f7c6eef7fa22 100644
--- a/arch/arm/mach-ixp23xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-ixp23xx/include/mach/debug-macro.S
@@ -12,13 +12,12 @@
12 */ 12 */
13#include <mach/ixp23xx.h> 13#include <mach/ixp23xx.h>
14 14
15 .macro addruart, rx, tmp 15 .macro addruart, rp, rv
16 mrc p15, 0, \rx, c1, c0 16 ldr \rp, =IXP23XX_PERIPHERAL_PHYS @ physical
17 tst \rx, #1 @ mmu enabled? 17 ldr \rv, =IXP23XX_PERIPHERAL_VIRT @ virtual
18 ldreq \rx, =IXP23XX_PERIPHERAL_PHYS @ physical
19 ldrne \rx, =IXP23XX_PERIPHERAL_VIRT @ virtual
20#ifdef __ARMEB__ 18#ifdef __ARMEB__
21 orr \rx, \rx, #0x00000003 19 orr \rp, \rp, #0x00000003
20 orr \rv, \rv, #0x00000003
22#endif 21#endif
23 .endm 22 .endm
24 23
diff --git a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
index 3fc66d6d00a0..b974a49c0aff 100644
--- a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
@@ -10,16 +10,16 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11*/ 11*/
12 12
13 .macro addruart, rx, tmp 13 .macro addruart, rp, rv
14 mrc p15, 0, \rx, c1, c0
15 tst \rx, #1 @ MMU enabled?
16 moveq \rx, #0xc8000000
17 movne \rx, #0xff000000
18 orrne \rx, \rx, #0x00b00000
19#ifdef __ARMEB__ 14#ifdef __ARMEB__
20 add \rx,\rx,#3 @ Uart regs are at off set of 3 if 15 mov \rp, #3 @ Uart regs are at off set of 3 if
21 @ byte writes used - Big Endian. 16 @ byte writes used - Big Endian.
17#else
18 mov \rp, #0
22#endif 19#endif
20 orr \rv, \rp, #0xff000000 @ virtual
21 orr \rv, \rv, #0x00b00000
22 orr \rp, \rp, #0xc8000000 @ physical
23 .endm 23 .endm
24 24
25#define UART_SHIFT 2 25#define UART_SHIFT 2
diff --git a/arch/arm/mach-kirkwood/include/mach/debug-macro.S b/arch/arm/mach-kirkwood/include/mach/debug-macro.S
index d0606774dea7..db06ae437d08 100644
--- a/arch/arm/mach-kirkwood/include/mach/debug-macro.S
+++ b/arch/arm/mach-kirkwood/include/mach/debug-macro.S
@@ -8,12 +8,11 @@
8 8
9#include <mach/bridge-regs.h> 9#include <mach/bridge-regs.h>
10 10
11 .macro addruart, rx, tmp 11 .macro addruart, rp, rv
12 mrc p15, 0, \rx, c1, c0 12 ldr \rp, =KIRKWOOD_REGS_PHYS_BASE
13 tst \rx, #1 @ MMU enabled? 13 ldr \rv, =KIRKWOOD_REGS_VIRT_BASE
14 ldreq \rx, =KIRKWOOD_REGS_PHYS_BASE 14 orr \rp, \rp, #0x00012000
15 ldrne \rx, =KIRKWOOD_REGS_VIRT_BASE 15 orr \rv, \rv, #0x00012000
16 orr \rx, \rx, #0x00012000
17 .endm 16 .endm
18 17
19#define UART_SHIFT 2 18#define UART_SHIFT 2
diff --git a/arch/arm/mach-ks8695/include/mach/debug-macro.S b/arch/arm/mach-ks8695/include/mach/debug-macro.S
index cf2095da2372..bf516adf1925 100644
--- a/arch/arm/mach-ks8695/include/mach/debug-macro.S
+++ b/arch/arm/mach-ks8695/include/mach/debug-macro.S
@@ -14,11 +14,9 @@
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <mach/regs-uart.h> 15#include <mach/regs-uart.h>
16 16
17 .macro addruart, rx, tmp 17 .macro addruart, rp, rv
18 mrc p15, 0, \rx, c1, c0 18 ldr \rp, =KS8695_UART_PA @ physical base address
19 tst \rx, #1 @ MMU enabled? 19 ldr \rv, =KS8695_UART_VA @ virtual base address
20 ldreq \rx, =KS8695_UART_PA @ physical base address
21 ldrne \rx, =KS8695_UART_VA @ virtual base address
22 .endm 20 .endm
23 21
24 .macro senduart, rd, rx 22 .macro senduart, rd, rx
diff --git a/arch/arm/mach-l7200/include/mach/debug-macro.S b/arch/arm/mach-l7200/include/mach/debug-macro.S
new file mode 100644
index 000000000000..b0a2db77d392
--- /dev/null
+++ b/arch/arm/mach-l7200/include/mach/debug-macro.S
@@ -0,0 +1,38 @@
1/* arch/arm/mach-l7200/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 .equ io_virt, IO_BASE
15 .equ io_phys, IO_START
16
17 .macro addruart, rp, rv
18 mov \rp, #0x00044000 @ UART1
19@ mov \rp, #0x00045000 @ UART2
20 add \rv, \rp, #io_virt @ virtual address
21 add \rp, \rp, #io_phys @ physical base address
22 .endm
23
24 .macro senduart,rd,rx
25 str \rd, [\rx, #0x0] @ UARTDR
26 .endm
27
28 .macro waituart,rd,rx
291001: ldr \rd, [\rx, #0x18] @ UARTFLG
30 tst \rd, #1 << 5 @ UARTFLGUTXFF - 1 when full
31 bne 1001b
32 .endm
33
34 .macro busyuart,rd,rx
351001: ldr \rd, [\rx, #0x18] @ UARTFLG
36 tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy
37 bne 1001b
38 .endm
diff --git a/arch/arm/mach-lh7a40x/include/mach/debug-macro.S b/arch/arm/mach-lh7a40x/include/mach/debug-macro.S
index c0dcbbba22ba..cff33625276f 100644
--- a/arch/arm/mach-lh7a40x/include/mach/debug-macro.S
+++ b/arch/arm/mach-lh7a40x/include/mach/debug-macro.S
@@ -14,12 +14,10 @@
14 @ It is not known if this will be appropriate for every 40x 14 @ It is not known if this will be appropriate for every 40x
15 @ board. 15 @ board.
16 16
17 .macro addruart, rx, tmp 17 .macro addruart, rp, rv
18 mrc p15, 0, \rx, c1, c0 18 mov \rp, #0x00000700 @ offset from base
19 tst \rx, #1 @ MMU enabled? 19 orr \rv, \rp, #0xf8000000 @ virtual base
20 mov \rx, #0x00000700 @ offset from base 20 orr \rp, \rp, #0x80000000 @ physical base
21 orreq \rx, \rx, #0x80000000 @ physical base
22 orrne \rx, \rx, #0xf8000000 @ virtual base
23 .endm 21 .endm
24 22
25 .macro senduart,rd,rx 23 .macro senduart,rd,rx
diff --git a/arch/arm/mach-loki/include/mach/debug-macro.S b/arch/arm/mach-loki/include/mach/debug-macro.S
index 3136c913a92c..cc90d99ac76c 100644
--- a/arch/arm/mach-loki/include/mach/debug-macro.S
+++ b/arch/arm/mach-loki/include/mach/debug-macro.S
@@ -8,12 +8,11 @@
8 8
9#include <mach/loki.h> 9#include <mach/loki.h>
10 10
11 .macro addruart, rx, tmp 11 .macro addruart, rp, rv
12 mrc p15, 0, \rx, c1, c0 12 ldr \rp, =LOKI_REGS_PHYS_BASE
13 tst \rx, #1 @ MMU enabled? 13 ldr \rv, =LOKI_REGS_VIRT_BASE
14 ldreq \rx, =LOKI_REGS_PHYS_BASE 14 orr \rp, \rp, #0x00012000
15 ldrne \rx, =LOKI_REGS_VIRT_BASE 15 orr \rv, \rv, #0x00012000
16 orr \rx, \rx, #0x00012000
17 .endm 16 .endm
18 17
19#define UART_SHIFT 2 18#define UART_SHIFT 2
diff --git a/arch/arm/mach-lpc32xx/include/mach/debug-macro.S b/arch/arm/mach-lpc32xx/include/mach/debug-macro.S
index 621744d6b152..629e744aeb9e 100644
--- a/arch/arm/mach-lpc32xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-lpc32xx/include/mach/debug-macro.S
@@ -20,11 +20,9 @@
20 * Debug output is hardcoded to standard UART 5 20 * Debug output is hardcoded to standard UART 5
21*/ 21*/
22 22
23 .macro addruart,rx, tmp 23 .macro addruart, rp, rv
24 mrc p15, 0, \rx, c1, c0 24 ldreq \rp, =0x40090000
25 tst \rx, #1 @ MMU enabled? 25 ldrne \rv, =0xF4090000
26 ldreq \rx, =0x40090000
27 ldrne \rx, =0xF4090000
28 .endm 26 .endm
29 27
30#define UART_SHIFT 2 28#define UART_SHIFT 2
diff --git a/arch/arm/mach-mmp/include/mach/debug-macro.S b/arch/arm/mach-mmp/include/mach/debug-macro.S
index 76deff238e1c..7e2ebd3efc7c 100644
--- a/arch/arm/mach-mmp/include/mach/debug-macro.S
+++ b/arch/arm/mach-mmp/include/mach/debug-macro.S
@@ -11,12 +11,11 @@
11 11
12#include <mach/addr-map.h> 12#include <mach/addr-map.h>
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mrc p15, 0, \rx, c1, c0 15 ldr \rp, =APB_PHYS_BASE @ physical
16 tst \rx, #1 @ MMU enabled? 16 ldr \rv, =APB_VIRT_BASE @ virtual
17 ldreq \rx, =APB_PHYS_BASE @ physical 17 orr \rp, \rp, #0x00017000
18 ldrne \rx, =APB_VIRT_BASE @ virtual 18 orr \rv, \rv, #0x00017000
19 orr \rx, \rx, #0x00017000
20 .endm 19 .endm
21 20
22#define UART_SHIFT 2 21#define UART_SHIFT 2
diff --git a/arch/arm/mach-msm/include/mach/debug-macro.S b/arch/arm/mach-msm/include/mach/debug-macro.S
index 238c4f132cdb..fbd5d90dcc8c 100644
--- a/arch/arm/mach-msm/include/mach/debug-macro.S
+++ b/arch/arm/mach-msm/include/mach/debug-macro.S
@@ -20,12 +20,9 @@
20#include <mach/msm_iomap.h> 20#include <mach/msm_iomap.h>
21 21
22#ifdef CONFIG_HAS_MSM_DEBUG_UART_PHYS 22#ifdef CONFIG_HAS_MSM_DEBUG_UART_PHYS
23 .macro addruart, rx, tmp 23 .macro addruart, rp, rv
24 @ see if the MMU is enabled and select appropriate base address 24 ldr \rp, =MSM_DEBUG_UART_PHYS
25 mrc p15, 0, \rx, c1, c0 25 ldr \rv, =MSM_DEBUG_UART_BASE
26 tst \rx, #1
27 ldreq \rx, =MSM_DEBUG_UART_PHYS
28 ldrne \rx, =MSM_DEBUG_UART_BASE
29 .endm 26 .endm
30 27
31 .macro senduart,rd,rx 28 .macro senduart,rd,rx
@@ -39,16 +36,7 @@
39 tst \rd, #0x04 36 tst \rd, #0x04
40 beq 1001b 37 beq 1001b
41 .endm 38 .endm
42#else
43 .macro addruart, rx, tmp
44 .endm
45
46 .macro senduart,rd,rx
47 .endm
48
49 .macro waituart,rd,rx
50 .endm
51#endif
52 39
53 .macro busyuart,rd,rx 40 .macro busyuart,rd,rx
54 .endm 41 .endm
42#endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/debug-macro.S b/arch/arm/mach-mv78xx0/include/mach/debug-macro.S
index cd81689c4621..04891428e48b 100644
--- a/arch/arm/mach-mv78xx0/include/mach/debug-macro.S
+++ b/arch/arm/mach-mv78xx0/include/mach/debug-macro.S
@@ -8,12 +8,11 @@
8 8
9#include <mach/mv78xx0.h> 9#include <mach/mv78xx0.h>
10 10
11 .macro addruart, rx, tmp 11 .macro addruart, rp, rv
12 mrc p15, 0, \rx, c1, c0 12 ldr \rp, =MV78XX0_REGS_PHYS_BASE
13 tst \rx, #1 @ MMU enabled? 13 ldr \rv, =MV78XX0_REGS_VIRT_BASE
14 ldreq \rx, =MV78XX0_REGS_PHYS_BASE 14 orr \rp, \rp, #0x00012000
15 ldrne \rx, =MV78XX0_REGS_VIRT_BASE 15 orr \rv, \rv, #0x00012000
16 orr \rx, \rx, #0x00012000
17 .endm 16 .endm
18 17
19#define UART_SHIFT 2 18#define UART_SHIFT 2
diff --git a/arch/arm/mach-netx/include/mach/debug-macro.S b/arch/arm/mach-netx/include/mach/debug-macro.S
index e96339e71d88..56a915228180 100644
--- a/arch/arm/mach-netx/include/mach/debug-macro.S
+++ b/arch/arm/mach-netx/include/mach/debug-macro.S
@@ -13,12 +13,10 @@
13 13
14#include "hardware.h" 14#include "hardware.h"
15 15
16 .macro addruart, rx, tmp 16 .macro addruart, rp, rv
17 mrc p15, 0, \rx, c1, c0 17 mov \rp, #0x00000a00
18 tst \rx, #1 @ MMU enabled? 18 orr \rv, \rp, #io_p2v(0x00100000) @ virtual
19 moveq \rx, #0x00100000 @ physical 19 orr \rp, \rp, #0x00100000 @ physical
20 movne \rx, #io_p2v(0x00100000) @ virtual
21 orr \rx, \rx, #0x00000a00
22 .endm 20 .endm
23 21
24 .macro senduart,rd,rx 22 .macro senduart,rd,rx
diff --git a/arch/arm/mach-nomadik/include/mach/debug-macro.S b/arch/arm/mach-nomadik/include/mach/debug-macro.S
index 4f92acfba954..e7151b4b8889 100644
--- a/arch/arm/mach-nomadik/include/mach/debug-macro.S
+++ b/arch/arm/mach-nomadik/include/mach/debug-macro.S
@@ -10,13 +10,11 @@
10 * 10 *
11*/ 11*/
12 12
13 .macro addruart, rx, tmp 13 .macro addruart, rp, rv
14 mrc p15, 0, \rx, c1, c0 14 mov \rp, #0x00100000
15 tst \rx, #1 @ MMU enabled? 15 add \rp, \rp, #0x000fb000
16 moveq \rx, #0x10000000 @ physical base address 16 add \rv, \rp, #0xf0000000 @ virtual base
17 movne \rx, #0xf0000000 @ virtual base 17 add \rp, \rp, #0x10000000 @ physical base address
18 add \rx, \rx, #0x00100000
19 add \rx, \rx, #0x000fb000
20 .endm 18 .endm
21 19
22#include <asm/hardware/debug-pl01x.S> 20#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-ns9xxx/include/mach/debug-macro.S b/arch/arm/mach-ns9xxx/include/mach/debug-macro.S
index 5c934bdb7158..5a2acbdc3d67 100644
--- a/arch/arm/mach-ns9xxx/include/mach/debug-macro.S
+++ b/arch/arm/mach-ns9xxx/include/mach/debug-macro.S
@@ -12,11 +12,9 @@
12 12
13#include <mach/regs-board-a9m9750dev.h> 13#include <mach/regs-board-a9m9750dev.h>
14 14
15 .macro addruart, rx, tmp 15 .macro addruart, rp, rv
16 mrc p15, 0, \rx, c1, c0 16 ldr \rp, =NS9XXX_CSxSTAT_PHYS(0)
17 tst \rx, #1 17 ldr \rv, =io_p2v(NS9XXX_CSxSTAT_PHYS(0))
18 ldreq \rx, =NS9XXX_CSxSTAT_PHYS(0)
19 ldrne \rx, =io_p2v(NS9XXX_CSxSTAT_PHYS(0))
20 .endm 18 .endm
21 19
22#define UART_SHIFT 2 20#define UART_SHIFT 2
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index 671408eb4ab4..6a0fa0462365 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -28,56 +28,58 @@ omap_uart_virt: .word 0x0
28 * the desired UART phys and virt addresses temporarily into 28 * the desired UART phys and virt addresses temporarily into
29 * the omap_uart_phys and omap_uart_virt above. 29 * the omap_uart_phys and omap_uart_virt above.
30 */ 30 */
31 .macro addruart, rx, tmp 31 .macro addruart, rp, rv
32 32
33 /* Use omap_uart_phys/virt if already configured */ 33 /* Use omap_uart_phys/virt if already configured */
349: mrc p15, 0, \rx, c1, c0 349: mrc p15, 0, \rp, c1, c0
35 tst \rx, #1 @ MMU enabled? 35 tst \rp, #1 @ MMU enabled?
36 ldreq \rx, =__virt_to_phys(omap_uart_phys) @ physical base address 36 ldreq \rp, =__virt_to_phys(omap_uart_phys) @ MMU not enabled
37 ldrne \rx, =omap_uart_virt @ virtual base 37 ldrne \rp, =omap_uart_phys @ MMU enabled
38 ldr \rx, [\rx, #0] 38 add \rv, \rp, #4 @ omap_uart_virt
39 cmp \rx, #0 @ is port configured? 39 ldr \rp, [\rp, #0]
40 ldr \rv, [\rv, #0]
41 cmp \rp, #0 @ is port configured?
42 cmpne \rv, #0
40 bne 99f @ already configured 43 bne 99f @ already configured
41 44
42 /* Check the debug UART configuration set in uncompress.h */ 45 /* Check the debug UART configuration set in uncompress.h */
43 mrc p15, 0, \rx, c1, c0 46 mrc p15, 0, \rp, c1, c0
44 tst \rx, #1 @ MMU enabled? 47 tst \rp, #1 @ MMU enabled?
45 ldreq \rx, =OMAP_UART_INFO 48 ldreq \rp, =OMAP_UART_INFO @ MMU not enabled
46 ldrne \rx, =__phys_to_virt(OMAP_UART_INFO) 49 ldrne \rp, =__phys_to_virt(OMAP_UART_INFO) @ MMU enabled
47 ldr \rx, [\rx, #0] 50 ldr \rp, [\rp, #0]
48 51
49 /* Select the UART to use based on the UART1 scratchpad value */ 52 /* Select the UART to use based on the UART1 scratchpad value */
5010: cmp \rx, #0 @ no port configured? 5310: cmp \rp, #0 @ no port configured?
51 beq 11f @ if none, try to use UART1 54 beq 11f @ if none, try to use UART1
52 cmp \rx, #OMAP1UART1 55 cmp \rp, #OMAP1UART1
53 beq 11f @ configure OMAP1UART1 56 beq 11f @ configure OMAP1UART1
54 cmp \rx, #OMAP1UART2 57 cmp \rp, #OMAP1UART2
55 beq 12f @ configure OMAP1UART2 58 beq 12f @ configure OMAP1UART2
56 cmp \rx, #OMAP1UART3 59 cmp \rp, #OMAP1UART3
57 beq 13f @ configure OMAP2UART3 60 beq 13f @ configure OMAP2UART3
58 61
59 /* Configure the UART offset from the phys/virt base */ 62 /* Configure the UART offset from the phys/virt base */
6011: mov \rx, #0x00fb0000 @ OMAP1UART1 6311: mov \rp, #0x00fb0000 @ OMAP1UART1
61 b 98f 64 b 98f
6212: mov \rx, #0x00fb0000 @ OMAP1UART1 6512: mov \rp, #0x00fb0000 @ OMAP1UART1
63 orr \rx, \rx, #0x00000800 @ OMAP1UART2 66 orr \rp, \rp, #0x00000800 @ OMAP1UART2
64 b 98f 67 b 98f
6513: mov \rx, #0x00fb0000 @ OMAP1UART1 6813: mov \rp, #0x00fb0000 @ OMAP1UART1
66 orr \rx, \rx, #0x00000800 @ OMAP1UART2 69 orr \rp, \rp, #0x00000800 @ OMAP1UART2
67 orr \rx, \rx, #0x00009000 @ OMAP1UART3 70 orr \rp, \rp, #0x00009000 @ OMAP1UART3
68 71
69 /* Store both phys and virt address for the uart */ 72 /* Store both phys and virt address for the uart */
7098: add \rx, \rx, #0xff000000 @ phys base 7398: add \rp, \rp, #0xff000000 @ phys base
71 mrc p15, 0, \tmp, c1, c0 74 mrc p15, 0, \rv, c1, c0
72 tst \tmp, #1 @ MMU enabled? 75 tst \rv, #1 @ MMU enabled?
73 ldreq \tmp, =__virt_to_phys(omap_uart_phys) 76 ldreq \rv, =__virt_to_phys(omap_uart_phys) @ MMU not enabled
74 ldrne \tmp, =omap_uart_phys 77 ldrne \rv, =omap_uart_phys @ MMU enabled
75 str \rx, [\tmp, #0] 78 str \rp, [\rv, #0]
76 sub \rx, \rx, #0xff000000 @ phys base 79 sub \rp, \rp, #0xff000000 @ phys base
77 add \rx, \rx, #0xfe000000 @ virt base 80 add \rp, \rp, #0xfe000000 @ virt base
78 ldreq \tmp, =__virt_to_phys(omap_uart_virt) 81 add \rv, \rv, #4 @ omap_uart_lsr
79 ldrne \tmp, =omap_uart_virt 82 str \rp, [\rv, #0]
80 str \rx, [\tmp, #0]
81 b 9b 83 b 9b
8299: 8499:
83 .endm 85 .endm
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 09331bbbda52..6a4d4136002e 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -31,95 +31,94 @@ omap_uart_lsr: .word 0
31 * the desired UART phys and virt addresses temporarily into 31 * the desired UART phys and virt addresses temporarily into
32 * the omap_uart_phys and omap_uart_virt above. 32 * the omap_uart_phys and omap_uart_virt above.
33 */ 33 */
34 .macro addruart, rx, tmp 34 .macro addruart, rp, rv
35 35
36 /* Use omap_uart_phys/virt if already configured */ 36 /* Use omap_uart_phys/virt if already configured */
3710: mrc p15, 0, \rx, c1, c0 3710: mrc p15, 0, \rp, c1, c0
38 tst \rx, #1 @ MMU enabled? 38 tst \rp, #1 @ MMU enabled?
39 ldreq \rx, =__virt_to_phys(omap_uart_phys) @ physical base address 39 ldreq \rp, =__virt_to_phys(omap_uart_phys) @ MMU not enabled
40 ldrne \rx, =omap_uart_virt @ virtual base address 40 ldrne \rp, =omap_uart_phys @ MMU enabled
41 ldr \rx, [\rx, #0] 41 add \rv, \rp, #4 @ omap_uart_virt
42 cmp \rx, #0 @ is port configured? 42 ldr \rp, [\rp, #0]
43 ldr \rv, [\rv, #0]
44 cmp \rp, #0 @ is port configured?
45 cmpne \rv, #0
43 bne 99f @ already configured 46 bne 99f @ already configured
44 47
45 /* Check the debug UART configuration set in uncompress.h */ 48 /* Check the debug UART configuration set in uncompress.h */
46 mrc p15, 0, \rx, c1, c0 49 mrc p15, 0, \rp, c1, c0
47 tst \rx, #1 @ MMU enabled? 50 tst \rp, #1 @ MMU enabled?
48 ldreq \rx, =OMAP_UART_INFO 51 ldreq \rp, =OMAP_UART_INFO @ MMU not enabled
49 ldrne \rx, =__phys_to_virt(OMAP_UART_INFO) 52 ldrne \rp, =__phys_to_virt(OMAP_UART_INFO) @ MMU enabled
50 ldr \rx, [\rx, #0] 53 ldr \rp, [\rp, #0]
51 54
52 /* Select the UART to use based on the UART1 scratchpad value */ 55 /* Select the UART to use based on the UART1 scratchpad value */
53 cmp \rx, #0 @ no port configured? 56 cmp \rp, #0 @ no port configured?
54 beq 21f @ if none, try to use UART1 57 beq 21f @ if none, try to use UART1
55 cmp \rx, #OMAP2UART1 @ OMAP2/3/4UART1 58 cmp \rp, #OMAP2UART1 @ OMAP2/3/4UART1
56 beq 21f @ configure OMAP2/3/4UART1 59 beq 21f @ configure OMAP2/3/4UART1
57 cmp \rx, #OMAP2UART2 @ OMAP2/3/4UART2 60 cmp \rp, #OMAP2UART2 @ OMAP2/3/4UART2
58 beq 22f @ configure OMAP2/3/4UART2 61 beq 22f @ configure OMAP2/3/4UART2
59 cmp \rx, #OMAP2UART3 @ only on 24xx 62 cmp \rp, #OMAP2UART3 @ only on 24xx
60 beq 23f @ configure OMAP2UART3 63 beq 23f @ configure OMAP2UART3
61 cmp \rx, #OMAP3UART3 @ only on 34xx 64 cmp \rp, #OMAP3UART3 @ only on 34xx
62 beq 33f @ configure OMAP3UART3 65 beq 33f @ configure OMAP3UART3
63 cmp \rx, #OMAP4UART3 @ only on 44xx 66 cmp \rp, #OMAP4UART3 @ only on 44xx
64 beq 43f @ configure OMAP4UART3 67 beq 43f @ configure OMAP4UART3
65 cmp \rx, #OMAP3UART4 @ only on 36xx 68 cmp \rp, #OMAP3UART4 @ only on 36xx
66 beq 34f @ configure OMAP3UART4 69 beq 34f @ configure OMAP3UART4
67 cmp \rx, #OMAP4UART4 @ only on 44xx 70 cmp \rp, #OMAP4UART4 @ only on 44xx
68 beq 44f @ configure OMAP4UART4 71 beq 44f @ configure OMAP4UART4
69 cmp \rx, #ZOOM_UART @ only on zoom2/3 72 cmp \rp, #ZOOM_UART @ only on zoom2/3
70 beq 95f @ configure ZOOM_UART 73 beq 95f @ configure ZOOM_UART
71 74
72 /* Configure the UART offset from the phys/virt base */ 75 /* Configure the UART offset from the phys/virt base */
7321: mov \rx, #UART_OFFSET(OMAP2_UART1_BASE) @ omap2/3/4 7621: mov \rp, #UART_OFFSET(OMAP2_UART1_BASE) @ omap2/3/4
74 b 98f 77 b 98f
7522: mov \rx, #UART_OFFSET(OMAP2_UART2_BASE) @ omap2/3/4 7822: mov \rp, #UART_OFFSET(OMAP2_UART2_BASE) @ omap2/3/4
76 b 98f 79 b 98f
7723: mov \rx, #UART_OFFSET(OMAP2_UART3_BASE) 8023: mov \rp, #UART_OFFSET(OMAP2_UART3_BASE)
78 b 98f 81 b 98f
7933: mov \rx, #UART_OFFSET(OMAP3_UART1_BASE) 8233: mov \rp, #UART_OFFSET(OMAP3_UART1_BASE)
80 add \rx, \rx, #0x00fb0000 83 add \rp, \rp, #0x00fb0000
81 add \rx, \rx, #0x00006000 @ OMAP3_UART3_BASE 84 add \rp, \rp, #0x00006000 @ OMAP3_UART3_BASE
82 b 98f 85 b 98f
8334: mov \rx, #UART_OFFSET(OMAP3_UART1_BASE) 8634: mov \rp, #UART_OFFSET(OMAP3_UART1_BASE)
84 add \rx, \rx, #0x00fb0000 87 add \rp, \rp, #0x00fb0000
85 add \rx, \rx, #0x00028000 @ OMAP3_UART4_BASE 88 add \rp, \rp, #0x00028000 @ OMAP3_UART4_BASE
86 b 98f 89 b 98f
8743: mov \rx, #UART_OFFSET(OMAP4_UART3_BASE) 9043: mov \rp, #UART_OFFSET(OMAP4_UART3_BASE)
88 b 98f 91 b 98f
8944: mov \rx, #UART_OFFSET(OMAP4_UART4_BASE) 9244: mov \rp, #UART_OFFSET(OMAP4_UART4_BASE)
90 b 98f 93 b 98f
9195: ldr \rx, =ZOOM_UART_BASE 9495: ldr \rp, =ZOOM_UART_BASE
92 mrc p15, 0, \tmp, c1, c0 95 mrc p15, 0, \rv, c1, c0
93 tst \tmp, #1 @ MMU enabled? 96 tst \rv, #1 @ MMU enabled?
94 ldreq \tmp, =__virt_to_phys(omap_uart_phys) 97 ldreq \rv, =__virt_to_phys(omap_uart_phys) @ MMU not enabled
95 ldrne \tmp, =omap_uart_phys 98 ldrne \rv, =omap_uart_phys @ MMU enabled
96 str \rx, [\tmp, #0] 99 str \rp, [\rv, #0]
97 ldr \rx, =ZOOM_UART_VIRT 100 ldr \rp, =ZOOM_UART_VIRT
98 ldreq \tmp, =__virt_to_phys(omap_uart_virt) 101 add \rv, \rv, #4 @ omap_uart_virt
99 ldrne \tmp, =omap_uart_virt 102 str \rp, [\rv, #0]
100 str \rx, [\tmp, #0] 103 mov \rp, #(UART_LSR << ZOOM_PORT_SHIFT)
101 mov \rx, #(UART_LSR << ZOOM_PORT_SHIFT) 104 add \rv, \rv, #4 @ omap_uart_lsr
102 ldreq \tmp, =__virt_to_phys(omap_uart_lsr) 105 str \rp, [\rv, #0]
103 ldrne \tmp, =omap_uart_lsr
104 str \rx, [\tmp, #0]
105 b 10b 106 b 10b
106 107
107 /* Store both phys and virt address for the uart */ 108 /* Store both phys and virt address for the uart */
10898: add \rx, \rx, #0x48000000 @ phys base 10998: add \rp, \rp, #0x48000000 @ phys base
109 mrc p15, 0, \tmp, c1, c0 110 mrc p15, 0, \rv, c1, c0
110 tst \tmp, #1 @ MMU enabled? 111 tst \rv, #1 @ MMU enabled?
111 ldreq \tmp, =__virt_to_phys(omap_uart_phys) 112 ldreq \rv, =__virt_to_phys(omap_uart_phys) @ MMU not enabled
112 ldrne \tmp, =omap_uart_phys 113 ldrne \rv, =omap_uart_phys @ MMU enabled
113 str \rx, [\tmp, #0] 114 str \rp, [\rv, #0]
114 sub \rx, \rx, #0x48000000 @ phys base 115 sub \rp, \rp, #0x48000000 @ phys base
115 add \rx, \rx, #0xfa000000 @ virt base 116 add \rp, \rp, #0xfa000000 @ virt base
116 ldreq \tmp, =__virt_to_phys(omap_uart_virt) 117 add \rv, \rv, #4 @ omap_uart_virt
117 ldrne \tmp, =omap_uart_virt 118 str \rp, [\rv, #0]
118 str \rx, [\tmp, #0] 119 mov \rp, #(UART_LSR << OMAP_PORT_SHIFT)
119 mov \rx, #(UART_LSR << OMAP_PORT_SHIFT) 120 add \rv, \rv, #4 @ omap_uart_lsr
120 ldreq \tmp, =__virt_to_phys(omap_uart_lsr) 121 str \rp, [\rv, #0]
121 ldrne \tmp, =omap_uart_lsr
122 str \rx, [\tmp, #0]
123 122
124 b 10b 123 b 10b
12599: 12499:
@@ -131,9 +130,9 @@ omap_uart_lsr: .word 0
131 130
132 .macro busyuart,rd,rx 131 .macro busyuart,rd,rx
1331001: mrc p15, 0, \rd, c1, c0 1321001: mrc p15, 0, \rd, c1, c0
134 tst \rd, #1 @ MMU enabled? 133 tst \rd, #1 @ MMU enabled?
135 ldreq \rd, =__virt_to_phys(omap_uart_lsr) 134 ldreq \rd, =__virt_to_phys(omap_uart_lsr) @ MMU not enabled
136 ldrne \rd, =omap_uart_lsr 135 ldrne \rd, =omap_uart_lsr @ MMU enabled
137 ldr \rd, [\rd, #0] 136 ldr \rd, [\rd, #0]
138 ldrb \rd, [\rx, \rd] 137 ldrb \rd, [\rx, \rd]
139 and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE) 138 and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
diff --git a/arch/arm/mach-orion5x/include/mach/debug-macro.S b/arch/arm/mach-orion5x/include/mach/debug-macro.S
index 91e0e39bb23f..5e3bf5b68aec 100644
--- a/arch/arm/mach-orion5x/include/mach/debug-macro.S
+++ b/arch/arm/mach-orion5x/include/mach/debug-macro.S
@@ -10,12 +10,11 @@
10 10
11#include <mach/orion5x.h> 11#include <mach/orion5x.h>
12 12
13 .macro addruart, rx, tmp 13 .macro addruart, rp, rv
14 mrc p15, 0, \rx, c1, c0 14 ldr \rp, =ORION5X_REGS_PHYS_BASE
15 tst \rx, #1 @ MMU enabled? 15 ldr \rv, =ORION5X_REGS_VIRT_BASE
16 ldreq \rx, =ORION5X_REGS_PHYS_BASE 16 orr \rp, \rp, #0x00012000
17 ldrne \rx, =ORION5X_REGS_VIRT_BASE 17 orr \rv, \rv, #0x00012000
18 orr \rx, \rx, #0x00012000
19 .endm 18 .endm
20 19
21#define UART_SHIFT 2 20#define UART_SHIFT 2
diff --git a/arch/arm/mach-pnx4008/include/mach/debug-macro.S b/arch/arm/mach-pnx4008/include/mach/debug-macro.S
index 6ca8bd30bf46..931afebaf064 100644
--- a/arch/arm/mach-pnx4008/include/mach/debug-macro.S
+++ b/arch/arm/mach-pnx4008/include/mach/debug-macro.S
@@ -11,12 +11,10 @@
11 * 11 *
12*/ 12*/
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mrc p15, 0, \rx, c1, c0 15 mov \rp, #0x00090000
16 tst \rx, #1 @ MMU enabled? 16 add \rv, \rp, #0xf4000000 @ virtual
17 mov \rx, #0x00090000 17 add \rp, \rp, #0x40000000 @ physical
18 addeq \rx, \rx, #0x40000000
19 addne \rx, \rx, #0xf4000000
20 .endm 18 .endm
21 19
22#define UART_SHIFT 2 20#define UART_SHIFT 2
diff --git a/arch/arm/mach-pxa/include/mach/debug-macro.S b/arch/arm/mach-pxa/include/mach/debug-macro.S
index 01cf81393fe2..7d5c75125d65 100644
--- a/arch/arm/mach-pxa/include/mach/debug-macro.S
+++ b/arch/arm/mach-pxa/include/mach/debug-macro.S
@@ -13,12 +13,10 @@
13 13
14#include "hardware.h" 14#include "hardware.h"
15 15
16 .macro addruart, rx, tmp 16 .macro addruart, rp, rv
17 mrc p15, 0, \rx, c1, c0 17 mov \rp, #0x00100000
18 tst \rx, #1 @ MMU enabled? 18 orr \rv, \rp, #io_p2v(0x40000000) @ virtual
19 moveq \rx, #0x40000000 @ physical 19 orr \rp, \rp, #0x40000000 @ physical
20 movne \rx, #io_p2v(0x40000000) @ virtual
21 orr \rx, \rx, #0x00100000
22 .endm 20 .endm
23 21
24#define UART_SHIFT 2 22#define UART_SHIFT 2
diff --git a/arch/arm/mach-realview/include/mach/debug-macro.S b/arch/arm/mach-realview/include/mach/debug-macro.S
index 86622289b74e..90b687cbe04e 100644
--- a/arch/arm/mach-realview/include/mach/debug-macro.S
+++ b/arch/arm/mach-realview/include/mach/debug-macro.S
@@ -33,12 +33,10 @@
33#error "Unknown RealView platform" 33#error "Unknown RealView platform"
34#endif 34#endif
35 35
36 .macro addruart, rx, tmp 36 .macro addruart, rp, rv
37 mrc p15, 0, \rx, c1, c0 37 mov \rp, #DEBUG_LL_UART_OFFSET
38 tst \rx, #1 @ MMU enabled? 38 orr \rv, \rp, #0xfb000000 @ virtual base
39 moveq \rx, #0x10000000 39 orr \rp, \rp, #0x10000000 @ physical base
40 movne \rx, #0xfb000000 @ virtual base
41 orr \rx, \rx, #DEBUG_LL_UART_OFFSET
42 .endm 40 .endm
43 41
44#include <asm/hardware/debug-pl01x.S> 42#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-rpc/include/mach/debug-macro.S b/arch/arm/mach-rpc/include/mach/debug-macro.S
index 6fc8d66395dc..85effffdc2b2 100644
--- a/arch/arm/mach-rpc/include/mach/debug-macro.S
+++ b/arch/arm/mach-rpc/include/mach/debug-macro.S
@@ -11,13 +11,11 @@
11 * 11 *
12*/ 12*/
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mrc p15, 0, \rx, c1, c0 15 mov \rp, #0x00010000
16 tst \rx, #1 @ MMU enabled? 16 orr \rp, \rp, #0x00000fe0
17 moveq \rx, #0x03000000 17 orr \rv, \rp, #0xe0000000 @ virtual
18 movne \rx, #0xe0000000 18 orr \rp, \rp, #0x03000000 @ physical
19 orr \rx, \rx, #0x00010000
20 orr \rx, \rx, #0x00000fe0
21 .endm 19 .endm
22 20
23#define UART_SHIFT 2 21#define UART_SHIFT 2
diff --git a/arch/arm/mach-s3c2410/include/mach/debug-macro.S b/arch/arm/mach-s3c2410/include/mach/debug-macro.S
index 0eef78b4a6ed..5882deaa56be 100644
--- a/arch/arm/mach-s3c2410/include/mach/debug-macro.S
+++ b/arch/arm/mach-s3c2410/include/mach/debug-macro.S
@@ -19,13 +19,12 @@
19#define S3C2410_UART1_OFF (0x4000) 19#define S3C2410_UART1_OFF (0x4000)
20#define SHIFT_2440TXF (14-9) 20#define SHIFT_2440TXF (14-9)
21 21
22 .macro addruart, rx, tmp 22 .macro addruart, rp, rv
23 mrc p15, 0, \rx, c1, c0 23 ldr \rp, = S3C24XX_PA_UART
24 tst \rx, #1 24 ldr \rv, = S3C24XX_VA_UART
25 ldreq \rx, = S3C24XX_PA_UART
26 ldrne \rx, = S3C24XX_VA_UART
27#if CONFIG_DEBUG_S3C_UART != 0 25#if CONFIG_DEBUG_S3C_UART != 0
28 add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART) 26 add \rp, \rp, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
27 add \rv, \rv, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
29#endif 28#endif
30 .endm 29 .endm
31 30
diff --git a/arch/arm/mach-s3c24a0/include/mach/debug-macro.S b/arch/arm/mach-s3c24a0/include/mach/debug-macro.S
index 239476b81f3b..0c5a73805560 100644
--- a/arch/arm/mach-s3c24a0/include/mach/debug-macro.S
+++ b/arch/arm/mach-s3c24a0/include/mach/debug-macro.S
@@ -10,13 +10,12 @@
10#include <mach/map.h> 10#include <mach/map.h>
11#include <plat/regs-serial.h> 11#include <plat/regs-serial.h>
12 12
13 .macro addruart, rx, tmp 13 .macro addruart, rp, rv
14 mrc p15, 0, \rx, c1, c0 14 ldr \rp, = S3C24XX_PA_UART
15 tst \rx, #1 15 ldr \rv, = S3C24XX_VA_UART
16 ldreq \rx, = S3C24XX_PA_UART
17 ldrne \rx, = S3C24XX_VA_UART
18#if CONFIG_DEBUG_S3C_UART != 0 16#if CONFIG_DEBUG_S3C_UART != 0
19 add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART) 17 add \rp, \rp, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
18 add \rv, \rv, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
20#endif 19#endif
21 .endm 20 .endm
22 21
diff --git a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S b/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
index f9ab5d26052a..a29e70550c70 100644
--- a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
@@ -21,13 +21,12 @@
21 * aligned and add in the offset when we load the value here. 21 * aligned and add in the offset when we load the value here.
22 */ 22 */
23 23
24 .macro addruart, rx, rtmp 24 .macro addruart, rp, rv
25 mrc p15, 0, \rx, c1, c0 25 ldr \rp, = S3C_PA_UART
26 tst \rx, #1 26 ldr \rv, = (S3C_VA_UART + S3C_PA_UART & 0xfffff)
27 ldreq \rx, = S3C_PA_UART
28 ldrne \rx, = (S3C_VA_UART + S3C_PA_UART & 0xfffff)
29#if CONFIG_DEBUG_S3C_UART != 0 27#if CONFIG_DEBUG_S3C_UART != 0
30 add \rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART) 28 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
29 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
31#endif 30#endif
32 .endm 31 .endm
33 32
diff --git a/arch/arm/mach-s5p6442/include/mach/debug-macro.S b/arch/arm/mach-s5p6442/include/mach/debug-macro.S
index bb6536147ffb..e2213205d780 100644
--- a/arch/arm/mach-s5p6442/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5p6442/include/mach/debug-macro.S
@@ -15,13 +15,12 @@
15#include <mach/map.h> 15#include <mach/map.h>
16#include <plat/regs-serial.h> 16#include <plat/regs-serial.h>
17 17
18 .macro addruart, rx, rtmp 18 .macro addruart, rp, rv
19 mrc p15, 0, \rx, c1, c0 19 ldr \rp, = S3C_PA_UART
20 tst \rx, #1 20 ldr \rv, = S3C_VA_UART
21 ldreq \rx, = S3C_PA_UART
22 ldrne \rx, = S3C_VA_UART
23#if CONFIG_DEBUG_S3C_UART != 0 21#if CONFIG_DEBUG_S3C_UART != 0
24 add \rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART) 22 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
23 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
25#endif 24#endif
26 .endm 25 .endm
27 26
diff --git a/arch/arm/mach-s5pc100/include/mach/debug-macro.S b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
index 70e02e91ee3c..b2ba95ddf8e0 100644
--- a/arch/arm/mach-s5pc100/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
@@ -22,13 +22,12 @@
22 * aligned and add in the offset when we load the value here. 22 * aligned and add in the offset when we load the value here.
23 */ 23 */
24 24
25 .macro addruart, rx, rtmp 25 .macro addruart, rp, rv
26 mrc p15, 0, \rx, c1, c0 26 ldr \rp, = S3C_PA_UART
27 tst \rx, #1 27 ldr \rv, = S3C_VA_UART
28 ldreq \rx, = S3C_PA_UART
29 ldrne \rx, = S3C_VA_UART
30#if CONFIG_DEBUG_S3C_UART != 0 28#if CONFIG_DEBUG_S3C_UART != 0
31 add \rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART) 29 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
30 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
32#endif 31#endif
33 .endm 32 .endm
34 33
diff --git a/arch/arm/mach-s5pv210/include/mach/debug-macro.S b/arch/arm/mach-s5pv210/include/mach/debug-macro.S
index 7872f5c3dfc2..169fe654a59e 100644
--- a/arch/arm/mach-s5pv210/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5pv210/include/mach/debug-macro.S
@@ -21,13 +21,12 @@
21 * aligned and add in the offset when we load the value here. 21 * aligned and add in the offset when we load the value here.
22 */ 22 */
23 23
24 .macro addruart, rx, tmp 24 .macro addruart, rp, rv
25 mrc p15, 0, \rx, c1, c0 25 ldr \rp, = S3C_PA_UART
26 tst \rx, #1 26 ldr \rv, = S3C_VA_UART
27 ldreq \rx, = S3C_PA_UART
28 ldrne \rx, = S3C_VA_UART
29#if CONFIG_DEBUG_S3C_UART != 0 27#if CONFIG_DEBUG_S3C_UART != 0
30 add \rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART) 28 add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
29 add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
31#endif 30#endif
32 .endm 31 .endm
33 32
diff --git a/arch/arm/mach-s5pv310/include/mach/debug-macro.S b/arch/arm/mach-s5pv310/include/mach/debug-macro.S
index 6fb3893486be..b0d920c474d3 100644
--- a/arch/arm/mach-s5pv310/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5pv310/include/mach/debug-macro.S
@@ -20,13 +20,12 @@
20 * aligned and add in the offset when we load the value here. 20 * aligned and add in the offset when we load the value here.
21 */ 21 */
22 22
23 .macro addruart, rx, tmp 23 .macro addruart, rp, rv
24 mrc p15, 0, \rx, c1, c0 24 ldreq \rp, = S3C_PA_UART
25 tst \rx, #1 25 ldrne \rv, = S3C_VA_UART
26 ldreq \rx, = S3C_PA_UART
27 ldrne \rx, = S3C_VA_UART
28#if CONFIG_DEBUG_S3C_UART != 0 26#if CONFIG_DEBUG_S3C_UART != 0
29 add \rx, \rx, #(0x10000 * CONFIG_DEBUG_S3C_UART) 27 add \rp, \rp, #(0x10000 * CONFIG_DEBUG_S3C_UART)
28 add \rv, \rv, #(0x10000 * CONFIG_DEBUG_S3C_UART)
30#endif 29#endif
31 .endm 30 .endm
32 31
diff --git a/arch/arm/mach-sa1100/include/mach/debug-macro.S b/arch/arm/mach-sa1100/include/mach/debug-macro.S
index 336adccea542..0cd0fc9635b6 100644
--- a/arch/arm/mach-sa1100/include/mach/debug-macro.S
+++ b/arch/arm/mach-sa1100/include/mach/debug-macro.S
@@ -12,33 +12,37 @@
12*/ 12*/
13#include <mach/hardware.h> 13#include <mach/hardware.h>
14 14
15 .macro addruart, rx, tmp 15 .macro addruart, rp, rv
16 mrc p15, 0, \rx, c1, c0 16 mrc p15, 0, \rp, c1, c0
17 tst \rx, #1 @ MMU enabled? 17 tst \rp, #1 @ MMU enabled?
18 moveq \rx, #0x80000000 @ physical base address 18 moveq \rp, #0x80000000 @ physical base address
19 movne \rx, #0xf8000000 @ virtual address 19 movne \rp, #0xf8000000 @ virtual address
20 20
21 @ We probe for the active serial port here, coherently with 21 @ We probe for the active serial port here, coherently with
22 @ the comment in arch/arm/mach-sa1100/include/mach/uncompress.h. 22 @ the comment in arch/arm/mach-sa1100/include/mach/uncompress.h.
23 @ We assume r1 can be clobbered. 23 @ We assume r1 can be clobbered.
24 24
25 @ see if Ser3 is active 25 @ see if Ser3 is active
26 add \rx, \rx, #0x00050000 26 add \rp, \rp, #0x00050000
27 ldr r1, [\rx, #UTCR3] 27 ldr \rv, [\rp, #UTCR3]
28 tst r1, #UTCR3_TXE 28 tst \rv, #UTCR3_TXE
29 29
30 @ if Ser3 is inactive, then try Ser1 30 @ if Ser3 is inactive, then try Ser1
31 addeq \rx, \rx, #(0x00010000 - 0x00050000) 31 addeq \rp, \rp, #(0x00010000 - 0x00050000)
32 ldreq r1, [\rx, #UTCR3] 32 ldreq \rv, [\rp, #UTCR3]
33 tsteq r1, #UTCR3_TXE 33 tsteq \rv, #UTCR3_TXE
34 34
35 @ if Ser1 is inactive, then try Ser2 35 @ if Ser1 is inactive, then try Ser2
36 addeq \rx, \rx, #(0x00030000 - 0x00010000) 36 addeq \rp, \rp, #(0x00030000 - 0x00010000)
37 ldreq r1, [\rx, #UTCR3] 37 ldreq \rv, [\rp, #UTCR3]
38 tsteq r1, #UTCR3_TXE 38 tsteq \rv, #UTCR3_TXE
39
40 @ clear top bits, and generate both phys and virt addresses
41 lsl \rp, \rp, #8
42 lsr \rp, \rp, #8
43 orr \rv, \rp, #0xf8000000 @ virtual
44 orr \rp, \rp, #0x80000000 @ physical
39 45
40 @ if all ports are inactive, then there is nothing we can do
41 moveq pc, lr
42 .endm 46 .endm
43 47
44 .macro senduart,rd,rx 48 .macro senduart,rd,rx
diff --git a/arch/arm/mach-shark/include/mach/debug-macro.S b/arch/arm/mach-shark/include/mach/debug-macro.S
index 5ea24d4d1ba6..a473f55dc71f 100644
--- a/arch/arm/mach-shark/include/mach/debug-macro.S
+++ b/arch/arm/mach-shark/include/mach/debug-macro.S
@@ -11,9 +11,10 @@
11 * 11 *
12*/ 12*/
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mov \rx, #0xe0000000 15 mov \rp, #0xe0000000
16 orr \rx, \rx, #0x000003f8 16 orr \rp, \rp, #0x000003f8
17 mov \rv, \rp
17 .endm 18 .endm
18 19
19 .macro senduart,rd,rx 20 .macro senduart,rd,rx
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S
index 55a39564b43c..8ea3bffb4e00 100644
--- a/arch/arm/mach-tegra/include/mach/debug-macro.S
+++ b/arch/arm/mach-tegra/include/mach/debug-macro.S
@@ -20,24 +20,28 @@
20 20
21#include <mach/io.h> 21#include <mach/io.h>
22 22
23 .macro addruart,rx, tmp 23 .macro addruart, rp, rv
24 mrc p15, 0, \rx, c1, c0 24 ldreq \rp, =IO_APB_PHYS @ physical
25 tst \rx, #1 @ MMU enabled? 25 ldrne \rv, =IO_APB_VIRT @ virtual
26 ldreq \rx, =IO_APB_PHYS @ physical
27 ldrne \rx, =IO_APB_VIRT @ virtual
28#if defined(CONFIG_TEGRA_DEBUG_UART_NONE) 26#if defined(CONFIG_TEGRA_DEBUG_UART_NONE)
29#error "A debug UART must be selected in the kernel config to use DEBUG_LL" 27#error "A debug UART must be selected in the kernel config to use DEBUG_LL"
30#elif defined(CONFIG_TEGRA_DEBUG_UARTA) 28#elif defined(CONFIG_TEGRA_DEBUG_UARTA)
31 orr \rx, \rx, #0x6000 29 orr \rp, \rp, #0x6000
30 orr \rv, \rv, #0x6000
32#elif defined(CONFIG_TEGRA_DEBUG_UARTB) 31#elif defined(CONFIG_TEGRA_DEBUG_UARTB)
33 ldr \tmp, =0x6040 32 orr \rp, \rp, #0x6000
34 orr \rx, \rx, \tmp 33 orr \rp, \rp, #0x40
34 orr \rv, \rv, #0x6000
35 orr \rv, \rv, #0x40
35#elif defined(CONFIG_TEGRA_DEBUG_UARTC) 36#elif defined(CONFIG_TEGRA_DEBUG_UARTC)
36 orr \rx, \rx, #0x6200 37 orr \rp, \rp, #0x6200
38 orr \rv, \rv, #0x6200
37#elif defined(CONFIG_TEGRA_DEBUG_UARTD) 39#elif defined(CONFIG_TEGRA_DEBUG_UARTD)
38 orr \rx, \rx, #0x6300 40 orr \rp, \rp, #0x6300
41 orr \rv, \rv, #0x6300
39#elif defined(CONFIG_TEGRA_DEBUG_UARTE) 42#elif defined(CONFIG_TEGRA_DEBUG_UARTE)
40 orr \rx, \rx, #0x6400 43 orr \rp, \rp, #0x6400
44 orr \rv, \rv, #0x6400
41#endif 45#endif
42 .endm 46 .endm
43 47
diff --git a/arch/arm/mach-u300/include/mach/debug-macro.S b/arch/arm/mach-u300/include/mach/debug-macro.S
index 92c12420256f..df715707bead 100644
--- a/arch/arm/mach-u300/include/mach/debug-macro.S
+++ b/arch/arm/mach-u300/include/mach/debug-macro.S
@@ -10,13 +10,12 @@
10 */ 10 */
11#include <mach/hardware.h> 11#include <mach/hardware.h>
12 12
13 .macro addruart, rx, tmp 13 .macro addruart, rp, rv
14 /* If we move the address using MMU, use this. */ 14 /* If we move the address using MMU, use this. */
15 mrc p15, 0, \rx, c1, c0 15 ldr \rp, = U300_SLOW_PER_PHYS_BASE @ MMU off, physical address
16 tst \rx, #1 @ MMU enabled? 16 ldr \rv, = U300_SLOW_PER_VIRT_BASE @ MMU on, virtual address
17 ldreq \rx, = U300_SLOW_PER_PHYS_BASE @ MMU off, physical address 17 orr \rp, \rp, #0x00003000
18 ldrne \rx, = U300_SLOW_PER_VIRT_BASE @ MMU on, virtual address 18 orr \rv, \rv, #0x00003000
19 orr \rx, \rx, #0x00003000
20 .endm 19 .endm
21 20
22#include <asm/hardware/debug-pl01x.S> 21#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-ux500/include/mach/debug-macro.S b/arch/arm/mach-ux500/include/mach/debug-macro.S
index c5203b7ea552..be7c0f14e310 100644
--- a/arch/arm/mach-ux500/include/mach/debug-macro.S
+++ b/arch/arm/mach-ux500/include/mach/debug-macro.S
@@ -18,11 +18,9 @@
18#define UX500_UART(n) __UX500_UART(n) 18#define UX500_UART(n) __UX500_UART(n)
19#define UART_BASE UX500_UART(CONFIG_UX500_DEBUG_UART) 19#define UART_BASE UX500_UART(CONFIG_UX500_DEBUG_UART)
20 20
21 .macro addruart, rx, tmp 21 .macro addruart, rp, rv
22 mrc p15, 0, \rx, c1, c0 22 ldr \rp, =UART_BASE @ no, physical address
23 tst \rx, #1 @ MMU enabled? 23 ldr \rv, =IO_ADDRESS(UART_BASE) @ yes, virtual address
24 ldreq \rx, =UART_BASE @ no, physical address
25 ldrne \rx, =IO_ADDRESS(UART_BASE) @ yes, virtual address
26 .endm 24 .endm
27 25
28#include <asm/hardware/debug-pl01x.S> 26#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-versatile/include/mach/debug-macro.S b/arch/arm/mach-versatile/include/mach/debug-macro.S
index 6fea7199c626..eb2cf7dc5c44 100644
--- a/arch/arm/mach-versatile/include/mach/debug-macro.S
+++ b/arch/arm/mach-versatile/include/mach/debug-macro.S
@@ -11,13 +11,11 @@
11 * 11 *
12*/ 12*/
13 13
14 .macro addruart, rx, tmp 14 .macro addruart, rp, rv
15 mrc p15, 0, \rx, c1, c0 15 mov \rp, #0x001F0000
16 tst \rx, #1 @ MMU enabled? 16 orr \rp, \rp, #0x00001000
17 moveq \rx, #0x10000000 17 orr \rv, \rp, #0xf1000000 @ virtual base
18 movne \rx, #0xf1000000 @ virtual base 18 orr \rp, \rp, #0x10000000 @ physical base
19 orr \rx, \rx, #0x001F0000
20 orr \rx, \rx, #0x00001000
21 .endm 19 .endm
22 20
23#include <asm/hardware/debug-pl01x.S> 21#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-vexpress/include/mach/debug-macro.S b/arch/arm/mach-vexpress/include/mach/debug-macro.S
index 5167e2aceeba..050d65e02a42 100644
--- a/arch/arm/mach-vexpress/include/mach/debug-macro.S
+++ b/arch/arm/mach-vexpress/include/mach/debug-macro.S
@@ -12,12 +12,10 @@
12 12
13#define DEBUG_LL_UART_OFFSET 0x00009000 13#define DEBUG_LL_UART_OFFSET 0x00009000
14 14
15 .macro addruart,rx,tmp 15 .macro addruart,rp,rv
16 mrc p15, 0, \rx, c1, c0 16 mov \rp, #DEBUG_LL_UART_OFFSET
17 tst \rx, #1 @ MMU enabled? 17 orr \rv, \rp, #0xf8000000 @ virtual base
18 moveq \rx, #0x10000000 18 orr \rp, \rp, #0x10000000 @ physical base
19 movne \rx, #0xf8000000 @ virtual base
20 orr \rx, \rx, #DEBUG_LL_UART_OFFSET
21 .endm 19 .endm
22 20
23#include <asm/hardware/debug-pl01x.S> 21#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
index 25606409aabc..d56213fb901b 100644
--- a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -62,11 +62,9 @@
62#define UART_PADDR MXC91231_UART2_BASE_ADDR 62#define UART_PADDR MXC91231_UART2_BASE_ADDR
63#define UART_VADDR MXC91231_IO_ADDRESS(MXC91231_UART2_BASE_ADDR) 63#define UART_VADDR MXC91231_IO_ADDRESS(MXC91231_UART2_BASE_ADDR)
64#endif 64#endif
65 .macro addruart, rx, tmp 65 .macro addruart, rp, rv
66 mrc p15, 0, \rx, c1, c0 66 ldr \rp, =UART_PADDR @ physical
67 tst \rx, #1 @ MMU enabled? 67 ldr \rv, =UART_VADDR @ virtual
68 ldreq \rx, =UART_PADDR @ physical
69 ldrne \rx, =UART_VADDR @ virtual
70 .endm 68 .endm
71 69
72 .macro senduart,rd,rx 70 .macro senduart,rd,rx
diff --git a/arch/arm/plat-spear/include/plat/debug-macro.S b/arch/arm/plat-spear/include/plat/debug-macro.S
index 37fa593884ee..e91270e4f640 100644
--- a/arch/arm/plat-spear/include/plat/debug-macro.S
+++ b/arch/arm/plat-spear/include/plat/debug-macro.S
@@ -14,11 +14,9 @@
14#include <linux/amba/serial.h> 14#include <linux/amba/serial.h>
15#include <mach/spear.h> 15#include <mach/spear.h>
16 16
17 .macro addruart, rx 17 .macro addruart, rp, rv
18 mrc p15, 0, \rx, c1, c0 18 mov \rp, #SPEAR_DBG_UART_BASE @ Physical base
19 tst \rx, #1 @ MMU enabled? 19 mov \rv, #VA_SPEAR_DBG_UART_BASE @ Virtual base
20 moveq \rx, #SPEAR_DBG_UART_BASE @ Physical base
21 movne \rx, #VA_SPEAR_DBG_UART_BASE @ Virtual base
22 .endm 20 .endm
23 21
24 .macro senduart, rd, rx 22 .macro senduart, rd, rx
diff --git a/arch/arm/plat-stmp3xxx/include/mach/debug-macro.S b/arch/arm/plat-stmp3xxx/include/mach/debug-macro.S
index 1b9348bf0e49..d3a0985c9681 100644
--- a/arch/arm/plat-stmp3xxx/include/mach/debug-macro.S
+++ b/arch/arm/plat-stmp3xxx/include/mach/debug-macro.S
@@ -16,13 +16,10 @@
16 * http://www.gnu.org/copyleft/gpl.html 16 * http://www.gnu.org/copyleft/gpl.html
17 */ 17 */
18 18
19 .macro addruart, rx, tmp 19 .macro addruart, rp, rv
20 mrc p15, 0, \rx, c1, c0 20 mov \rp, #0x00070000
21 tst \rx, #1 @ MMU enabled? 21 add \rv, \rp, #0xf0000000 @ virtual base
22 moveq \rx, #0x80000000 @ physical base address 22 add \rp, \rp, #0x80000000 @ physical base
23 addeq \rx, \rx, #0x00070000
24 movne \rx, #0xf0000000 @ virtual base
25 addne \rx, \rx, #0x00070000
26 .endm 23 .endm
27 24
28 .macro senduart,rd,rx 25 .macro senduart,rd,rx
diff --git a/arch/arm/plat-tcc/include/mach/debug-macro.S b/arch/arm/plat-tcc/include/mach/debug-macro.S
index 97537845df64..7662f736e42b 100644
--- a/arch/arm/plat-tcc/include/mach/debug-macro.S
+++ b/arch/arm/plat-tcc/include/mach/debug-macro.S
@@ -9,12 +9,11 @@
9 * 9 *
10 */ 10 */
11 11
12 .macro addruart,rx,tmp 12 .macro addruart, rp, rv
13 mrc p15, 0, \rx, c1, c0 13 moveq \rp, #0x90000000 @ physical base address
14 tst \rx, #1 @ MMU enabled? 14 movne \rv, #0xF1000000 @ virtual base
15 moveq \rx, #0x90000000 @ physical base address 15 orr \rp, \rp, #0x00007000 @ UART0
16 movne \rx, #0xF1000000 @ virtual base 16 orr \rv, \rv, #0x00007000 @ UART0
17 orr \rx, \rx, #0x00007000 @ UART0
18 .endm 17 .endm
19 18
20 .macro senduart,rd,rx 19 .macro senduart,rd,rx