diff options
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r-- | arch/arm/mach-omap1/include/mach/debug-macro.S | 72 |
1 files changed, 65 insertions, 7 deletions
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S index 9ea12f29e0b6..b6d9584544b4 100644 --- a/arch/arm/mach-omap1/include/mach/debug-macro.S +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S | |||
@@ -15,18 +15,76 @@ | |||
15 | 15 | ||
16 | #include <plat/serial.h> | 16 | #include <plat/serial.h> |
17 | 17 | ||
18 | .pushsection .data | ||
19 | omap_uart_phys: .word 0x0 | ||
20 | omap_uart_virt: .word 0x0 | ||
21 | .popsection | ||
22 | |||
23 | /* | ||
24 | * Note that this code won't work if the bootloader passes | ||
25 | * a wrong machine ID number in r1. To debug, just hardcode | ||
26 | * the desired UART phys and virt addresses temporarily into | ||
27 | * the omap_uart_phys and omap_uart_virt above. | ||
28 | */ | ||
18 | .macro addruart, rx, tmp | 29 | .macro addruart, rx, tmp |
30 | |||
31 | /* Use omap_uart_phys/virt if already configured */ | ||
32 | 9: mrc p15, 0, \rx, c1, c0 | ||
33 | tst \rx, #1 @ MMU enabled? | ||
34 | ldreq \rx, =omap_uart_phys @ physical base address | ||
35 | ldrne \rx, =omap_uart_virt @ virtual base | ||
36 | ldr \rx, [\rx, #0] | ||
37 | cmp \rx, #0 @ is port configured? | ||
38 | bne 99f @ already configured | ||
39 | |||
40 | /* Check 7XX UART1 scratchpad register for uart to use */ | ||
41 | mrc p15, 0, \rx, c1, c0 | ||
42 | tst \rx, #1 @ MMU enabled? | ||
43 | moveq \rx, #0xff000000 @ physical base address | ||
44 | movne \rx, #0xfe000000 @ virtual base | ||
45 | orr \rx, \rx, #0x00fb0000 @ OMAP1UART1 | ||
46 | ldrb \rx, [\rx, #(UART_SCR << OMAP7XX_PORT_SHIFT)] | ||
47 | cmp \rx, #0 @ anything in 7XX scratchpad? | ||
48 | bne 10f @ found 7XX uart | ||
49 | |||
50 | /* Check 15xx/16xx UART1 scratchpad register for uart to use */ | ||
19 | mrc p15, 0, \rx, c1, c0 | 51 | mrc p15, 0, \rx, c1, c0 |
20 | tst \rx, #1 @ MMU enabled? | 52 | tst \rx, #1 @ MMU enabled? |
21 | moveq \rx, #0xff000000 @ physical base address | 53 | moveq \rx, #0xff000000 @ physical base address |
22 | movne \rx, #0xfe000000 @ virtual base | 54 | movne \rx, #0xfe000000 @ virtual base |
23 | orr \rx, \rx, #0x00fb0000 | 55 | orr \rx, \rx, #0x00fb0000 @ OMAP1UART1 |
24 | #ifdef CONFIG_OMAP_LL_DEBUG_UART3 | 56 | ldrb \rx, [\rx, #(UART_SCR << OMAP_PORT_SHIFT)] |
25 | orr \rx, \rx, #0x00009000 @ UART 3 | 57 | |
26 | #endif | 58 | /* Select the UART to use based on the UART1 scratchpad value */ |
27 | #if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) | 59 | 10: cmp \rx, #0 @ no port configured? |
28 | orr \rx, \rx, #0x00000800 @ UART 2 & 3 | 60 | beq 11f @ if none, try to use UART1 |
29 | #endif | 61 | cmp \rx, #OMAP1UART1 |
62 | beq 11f @ configure OMAP1UART1 | ||
63 | cmp \rx, #OMAP1UART2 | ||
64 | beq 12f @ configure OMAP1UART2 | ||
65 | cmp \rx, #OMAP1UART3 | ||
66 | beq 13f @ configure OMAP2UART3 | ||
67 | |||
68 | /* Configure the UART offset from the phys/virt base */ | ||
69 | 11: mov \rx, #0x00fb0000 @ OMAP1UART1 | ||
70 | b 98f | ||
71 | 12: mov \rx, #0x00fb0000 @ OMAP1UART1 | ||
72 | orr \rx, \rx, #0x00000800 @ OMAP1UART2 | ||
73 | b 98f | ||
74 | 13: mov \rx, #0x00fb0000 @ OMAP1UART1 | ||
75 | orr \rx, \rx, #0x00000800 @ OMAP1UART2 | ||
76 | orr \rx, \rx, #0x00009000 @ OMAP1UART3 | ||
77 | |||
78 | /* Store both phys and virt address for the uart */ | ||
79 | 98: add \rx, \rx, #0xff000000 @ phys base | ||
80 | ldr \tmp, =omap_uart_phys | ||
81 | str \rx, [\tmp, #0] | ||
82 | sub \rx, \rx, #0xff000000 @ phys base | ||
83 | add \rx, \rx, #0xfe000000 @ virt base | ||
84 | ldr \tmp, =omap_uart_virt | ||
85 | str \rx, [\tmp, #0] | ||
86 | b 9b | ||
87 | 99: | ||
30 | .endm | 88 | .endm |
31 | 89 | ||
32 | .macro senduart,rd,rx | 90 | .macro senduart,rd,rx |