diff options
Diffstat (limited to 'arch/arm/mach-omap1/include/mach/debug-macro.S')
-rw-r--r-- | arch/arm/mach-omap1/include/mach/debug-macro.S | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S index 62856044eb63..2b36a281dc84 100644 --- a/arch/arm/mach-omap1/include/mach/debug-macro.S +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S | |||
@@ -13,13 +13,8 @@ | |||
13 | 13 | ||
14 | #include <linux/serial_reg.h> | 14 | #include <linux/serial_reg.h> |
15 | 15 | ||
16 | #include <asm/memory.h> | ||
17 | |||
18 | #include <plat/serial.h> | 16 | #include <plat/serial.h> |
19 | 17 | ||
20 | #define omap_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET) | ||
21 | #define omap_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET) | ||
22 | |||
23 | .pushsection .data | 18 | .pushsection .data |
24 | omap_uart_phys: .word 0x0 | 19 | omap_uart_phys: .word 0x0 |
25 | omap_uart_virt: .word 0x0 | 20 | omap_uart_virt: .word 0x0 |
@@ -31,26 +26,24 @@ omap_uart_virt: .word 0x0 | |||
31 | * the desired UART phys and virt addresses temporarily into | 26 | * the desired UART phys and virt addresses temporarily into |
32 | * the omap_uart_phys and omap_uart_virt above. | 27 | * the omap_uart_phys and omap_uart_virt above. |
33 | */ | 28 | */ |
34 | .macro addruart, rp, rv | 29 | .macro addruart, rp, rv, tmp |
35 | 30 | ||
36 | /* Use omap_uart_phys/virt if already configured */ | 31 | /* Use omap_uart_phys/virt if already configured */ |
37 | 9: mrc p15, 0, \rp, c1, c0 | 32 | 9: adr \rp, 99f @ get effective addr of 99f |
38 | tst \rp, #1 @ MMU enabled? | 33 | ldr \rv, [\rp] @ get absolute addr of 99f |
39 | ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled | 34 | sub \rv, \rv, \rp @ offset between the two |
40 | ldrne \rp, =omap_uart_phys @ MMU enabled | 35 | ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys |
41 | add \rv, \rp, #4 @ omap_uart_virt | 36 | sub \tmp, \rp, \rv @ make it effective |
42 | ldr \rp, [\rp, #0] | 37 | ldr \rp, [\tmp, #0] @ omap_uart_phys |
43 | ldr \rv, [\rv, #0] | 38 | ldr \rv, [\tmp, #4] @ omap_uart_virt |
44 | cmp \rp, #0 @ is port configured? | 39 | cmp \rp, #0 @ is port configured? |
45 | cmpne \rv, #0 | 40 | cmpne \rv, #0 |
46 | bne 99f @ already configured | 41 | bne 100f @ already configured |
47 | 42 | ||
48 | /* Check the debug UART configuration set in uncompress.h */ | 43 | /* Check the debug UART configuration set in uncompress.h */ |
49 | mrc p15, 0, \rp, c1, c0 | 44 | and \rp, pc, #0xff000000 |
50 | tst \rp, #1 @ MMU enabled? | 45 | ldr \rv, =OMAP_UART_INFO_OFS |
51 | ldreq \rp, =OMAP_UART_INFO @ MMU not enabled | 46 | ldr \rp, [\rp, \rv] |
52 | ldrne \rp, =omap_uart_p2v(OMAP_UART_INFO) @ MMU enabled | ||
53 | ldr \rp, [\rp, #0] | ||
54 | 47 | ||
55 | /* Select the UART to use based on the UART1 scratchpad value */ | 48 | /* Select the UART to use based on the UART1 scratchpad value */ |
56 | 10: cmp \rp, #0 @ no port configured? | 49 | 10: cmp \rp, #0 @ no port configured? |
@@ -74,17 +67,18 @@ omap_uart_virt: .word 0x0 | |||
74 | 67 | ||
75 | /* Store both phys and virt address for the uart */ | 68 | /* Store both phys and virt address for the uart */ |
76 | 98: add \rp, \rp, #0xff000000 @ phys base | 69 | 98: add \rp, \rp, #0xff000000 @ phys base |
77 | mrc p15, 0, \rv, c1, c0 | 70 | str \rp, [\tmp, #0] @ omap_uart_phys |
78 | tst \rv, #1 @ MMU enabled? | ||
79 | ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled | ||
80 | ldrne \rv, =omap_uart_phys @ MMU enabled | ||
81 | str \rp, [\rv, #0] | ||
82 | sub \rp, \rp, #0xff000000 @ phys base | 71 | sub \rp, \rp, #0xff000000 @ phys base |
83 | add \rp, \rp, #0xfe000000 @ virt base | 72 | add \rp, \rp, #0xfe000000 @ virt base |
84 | add \rv, \rv, #4 @ omap_uart_lsr | 73 | str \rp, [\tmp, #4] @ omap_uart_virt |
85 | str \rp, [\rv, #0] | ||
86 | b 9b | 74 | b 9b |
87 | 99: | 75 | |
76 | .align | ||
77 | 99: .word . | ||
78 | .word omap_uart_phys | ||
79 | .ltorg | ||
80 | |||
81 | 100: | ||
88 | .endm | 82 | .endm |
89 | 83 | ||
90 | .macro senduart,rd,rx | 84 | .macro senduart,rd,rx |