diff options
author | Jeremy Kerr <jeremy.kerr@canonical.com> | 2010-07-06 06:30:06 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2010-10-20 00:27:33 -0400 |
commit | 0ea1293009826da45e1019f45dfde1e557bb30df (patch) | |
tree | 7111bcd355921f03415182845e5f236ffe1896f4 /arch/arm/mach-omap1/include/mach/debug-macro.S | |
parent | 1ea64615601229f0dc16dee91dc5b50216411baa (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-omap1/include/mach/debug-macro.S')
-rw-r--r-- | arch/arm/mach-omap1/include/mach/debug-macro.S | 68 |
1 files changed, 35 insertions, 33 deletions
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 */ |
34 | 9: mrc p15, 0, \rx, c1, c0 | 34 | 9: 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 */ |
50 | 10: cmp \rx, #0 @ no port configured? | 53 | 10: 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 */ |
60 | 11: mov \rx, #0x00fb0000 @ OMAP1UART1 | 63 | 11: mov \rp, #0x00fb0000 @ OMAP1UART1 |
61 | b 98f | 64 | b 98f |
62 | 12: mov \rx, #0x00fb0000 @ OMAP1UART1 | 65 | 12: mov \rp, #0x00fb0000 @ OMAP1UART1 |
63 | orr \rx, \rx, #0x00000800 @ OMAP1UART2 | 66 | orr \rp, \rp, #0x00000800 @ OMAP1UART2 |
64 | b 98f | 67 | b 98f |
65 | 13: mov \rx, #0x00fb0000 @ OMAP1UART1 | 68 | 13: 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 */ |
70 | 98: add \rx, \rx, #0xff000000 @ phys base | 73 | 98: 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 |
82 | 99: | 84 | 99: |
83 | .endm | 85 | .endm |