diff options
author | Jason Wang <jason77.wang@gmail.com> | 2010-08-02 23:44:18 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-08-04 05:17:53 -0400 |
commit | 7e788b4289bb025a96e327c604cb2db92e17108f (patch) | |
tree | 6509b18c25f888a60e7222739e5ea5a0be96d639 | |
parent | 331d919af416b9b92428947ef8c535a3e24c6b31 (diff) |
omap: Fix DEBUG_LL uart to access phys addr when MMU isn't enable
Now we use a memory address to store the debug port info, So we need
to read/write this address when we choose DEBUG_LL. When MMU isn't
enable(I.E. the begining part of init stage of the linux kernel boot),
we need to access physical address instead of virtual address,
otherwise the kernel will crash.
Signed-off-by: Jason Wang <jason77.wang@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap1/include/mach/debug-macro.S | 10 | ||||
-rw-r--r-- | arch/arm/mach-omap2/include/mach/debug-macro.S | 29 |
2 files changed, 28 insertions, 11 deletions
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S index e8a8cf36b7f0..671408eb4ab4 100644 --- a/arch/arm/mach-omap1/include/mach/debug-macro.S +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S | |||
@@ -33,7 +33,7 @@ omap_uart_virt: .word 0x0 | |||
33 | /* Use omap_uart_phys/virt if already configured */ | 33 | /* Use omap_uart_phys/virt if already configured */ |
34 | 9: mrc p15, 0, \rx, c1, c0 | 34 | 9: mrc p15, 0, \rx, c1, c0 |
35 | tst \rx, #1 @ MMU enabled? | 35 | tst \rx, #1 @ MMU enabled? |
36 | ldreq \rx, =omap_uart_phys @ physical base address | 36 | ldreq \rx, =__virt_to_phys(omap_uart_phys) @ physical base address |
37 | ldrne \rx, =omap_uart_virt @ virtual base | 37 | ldrne \rx, =omap_uart_virt @ virtual base |
38 | ldr \rx, [\rx, #0] | 38 | ldr \rx, [\rx, #0] |
39 | cmp \rx, #0 @ is port configured? | 39 | cmp \rx, #0 @ is port configured? |
@@ -68,11 +68,15 @@ omap_uart_virt: .word 0x0 | |||
68 | 68 | ||
69 | /* Store both phys and virt address for the uart */ | 69 | /* Store both phys and virt address for the uart */ |
70 | 98: add \rx, \rx, #0xff000000 @ phys base | 70 | 98: add \rx, \rx, #0xff000000 @ phys base |
71 | ldr \tmp, =omap_uart_phys | 71 | mrc p15, 0, \tmp, c1, c0 |
72 | tst \tmp, #1 @ MMU enabled? | ||
73 | ldreq \tmp, =__virt_to_phys(omap_uart_phys) | ||
74 | ldrne \tmp, =omap_uart_phys | ||
72 | str \rx, [\tmp, #0] | 75 | str \rx, [\tmp, #0] |
73 | sub \rx, \rx, #0xff000000 @ phys base | 76 | sub \rx, \rx, #0xff000000 @ phys base |
74 | add \rx, \rx, #0xfe000000 @ virt base | 77 | add \rx, \rx, #0xfe000000 @ virt base |
75 | ldr \tmp, =omap_uart_virt | 78 | ldreq \tmp, =__virt_to_phys(omap_uart_virt) |
79 | ldrne \tmp, =omap_uart_virt | ||
76 | str \rx, [\tmp, #0] | 80 | str \rx, [\tmp, #0] |
77 | b 9b | 81 | b 9b |
78 | 99: | 82 | 99: |
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S index 35b24409a0c8..09331bbbda52 100644 --- a/arch/arm/mach-omap2/include/mach/debug-macro.S +++ b/arch/arm/mach-omap2/include/mach/debug-macro.S | |||
@@ -36,7 +36,7 @@ omap_uart_lsr: .word 0 | |||
36 | /* Use omap_uart_phys/virt if already configured */ | 36 | /* Use omap_uart_phys/virt if already configured */ |
37 | 10: mrc p15, 0, \rx, c1, c0 | 37 | 10: mrc p15, 0, \rx, c1, c0 |
38 | tst \rx, #1 @ MMU enabled? | 38 | tst \rx, #1 @ MMU enabled? |
39 | ldreq \rx, =omap_uart_phys @ physical base address | 39 | ldreq \rx, =__virt_to_phys(omap_uart_phys) @ physical base address |
40 | ldrne \rx, =omap_uart_virt @ virtual base address | 40 | ldrne \rx, =omap_uart_virt @ virtual base address |
41 | ldr \rx, [\rx, #0] | 41 | ldr \rx, [\rx, #0] |
42 | cmp \rx, #0 @ is port configured? | 42 | cmp \rx, #0 @ is port configured? |
@@ -89,26 +89,36 @@ omap_uart_lsr: .word 0 | |||
89 | 44: mov \rx, #UART_OFFSET(OMAP4_UART4_BASE) | 89 | 44: mov \rx, #UART_OFFSET(OMAP4_UART4_BASE) |
90 | b 98f | 90 | b 98f |
91 | 95: ldr \rx, =ZOOM_UART_BASE | 91 | 95: ldr \rx, =ZOOM_UART_BASE |
92 | ldr \tmp, =omap_uart_phys | 92 | mrc p15, 0, \tmp, c1, c0 |
93 | tst \tmp, #1 @ MMU enabled? | ||
94 | ldreq \tmp, =__virt_to_phys(omap_uart_phys) | ||
95 | ldrne \tmp, =omap_uart_phys | ||
93 | str \rx, [\tmp, #0] | 96 | str \rx, [\tmp, #0] |
94 | ldr \rx, =ZOOM_UART_VIRT | 97 | ldr \rx, =ZOOM_UART_VIRT |
95 | ldr \tmp, =omap_uart_virt | 98 | ldreq \tmp, =__virt_to_phys(omap_uart_virt) |
99 | ldrne \tmp, =omap_uart_virt | ||
96 | str \rx, [\tmp, #0] | 100 | str \rx, [\tmp, #0] |
97 | mov \rx, #(UART_LSR << ZOOM_PORT_SHIFT) | 101 | mov \rx, #(UART_LSR << ZOOM_PORT_SHIFT) |
98 | ldr \tmp, =omap_uart_lsr | 102 | ldreq \tmp, =__virt_to_phys(omap_uart_lsr) |
103 | ldrne \tmp, =omap_uart_lsr | ||
99 | str \rx, [\tmp, #0] | 104 | str \rx, [\tmp, #0] |
100 | b 10b | 105 | b 10b |
101 | 106 | ||
102 | /* Store both phys and virt address for the uart */ | 107 | /* Store both phys and virt address for the uart */ |
103 | 98: add \rx, \rx, #0x48000000 @ phys base | 108 | 98: add \rx, \rx, #0x48000000 @ phys base |
104 | ldr \tmp, =omap_uart_phys | 109 | mrc p15, 0, \tmp, c1, c0 |
110 | tst \tmp, #1 @ MMU enabled? | ||
111 | ldreq \tmp, =__virt_to_phys(omap_uart_phys) | ||
112 | ldrne \tmp, =omap_uart_phys | ||
105 | str \rx, [\tmp, #0] | 113 | str \rx, [\tmp, #0] |
106 | sub \rx, \rx, #0x48000000 @ phys base | 114 | sub \rx, \rx, #0x48000000 @ phys base |
107 | add \rx, \rx, #0xfa000000 @ virt base | 115 | add \rx, \rx, #0xfa000000 @ virt base |
108 | ldr \tmp, =omap_uart_virt | 116 | ldreq \tmp, =__virt_to_phys(omap_uart_virt) |
117 | ldrne \tmp, =omap_uart_virt | ||
109 | str \rx, [\tmp, #0] | 118 | str \rx, [\tmp, #0] |
110 | mov \rx, #(UART_LSR << OMAP_PORT_SHIFT) | 119 | mov \rx, #(UART_LSR << OMAP_PORT_SHIFT) |
111 | ldr \tmp, =omap_uart_lsr | 120 | ldreq \tmp, =__virt_to_phys(omap_uart_lsr) |
121 | ldrne \tmp, =omap_uart_lsr | ||
112 | str \rx, [\tmp, #0] | 122 | str \rx, [\tmp, #0] |
113 | 123 | ||
114 | b 10b | 124 | b 10b |
@@ -120,7 +130,10 @@ omap_uart_lsr: .word 0 | |||
120 | .endm | 130 | .endm |
121 | 131 | ||
122 | .macro busyuart,rd,rx | 132 | .macro busyuart,rd,rx |
123 | 1001: ldr \rd, =omap_uart_lsr | 133 | 1001: mrc p15, 0, \rd, c1, c0 |
134 | tst \rd, #1 @ MMU enabled? | ||
135 | ldreq \rd, =__virt_to_phys(omap_uart_lsr) | ||
136 | ldrne \rd, =omap_uart_lsr | ||
124 | ldr \rd, [\rd, #0] | 137 | ldr \rd, [\rd, #0] |
125 | ldrb \rd, [\rx, \rd] | 138 | ldrb \rd, [\rx, \rd] |
126 | and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE) | 139 | and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE) |