aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
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/mach-omap2
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/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/include/mach/debug-macro.S127
1 files changed, 63 insertions, 64 deletions
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)