diff options
author | Tony Lindgren <tony@atomide.com> | 2010-02-15 11:49:01 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-02-15 11:49:01 -0500 |
commit | 0c8219f0302d0d27fda52c790d38406801e547ec (patch) | |
tree | 96dc93845e4a8b947fd92b4bab71efd241a02a8e /arch/arm/mach-omap2/include | |
parent | 4f2c49fedf833e522001bc51824b894732900a3d (diff) |
omap: Make uncompress code and DEBUG_LL code generic
Define arch_decomp_setup() the same way as some other
architectures do. Use arch_id to configure the debug uart
based on the machine_is by storing it into the uart
scratchpad register for DEBUG_LL code to use.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/include')
-rw-r--r-- | arch/arm/mach-omap2/include/mach/debug-macro.S | 117 |
1 files changed, 95 insertions, 22 deletions
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S index 8d6da9a39d63..4a63a2ea484d 100644 --- a/arch/arm/mach-omap2/include/mach/debug-macro.S +++ b/arch/arm/mach-omap2/include/mach/debug-macro.S | |||
@@ -15,32 +15,103 @@ | |||
15 | 15 | ||
16 | #include <plat/serial.h> | 16 | #include <plat/serial.h> |
17 | 17 | ||
18 | #define UART_OFFSET(addr) ((addr) & 0x00ffffff) | ||
19 | |||
20 | .pushsection .data | ||
21 | omap_uart_phys: .word 0 | ||
22 | omap_uart_virt: .word 0 | ||
23 | omap_uart_lsr: .word 0 | ||
24 | .popsection | ||
25 | |||
26 | /* | ||
27 | * Note that this code won't work if the bootloader passes | ||
28 | * a wrong machine ID number in r1. To debug, just hardcode | ||
29 | * the desired UART phys and virt addresses temporarily into | ||
30 | * the omap_uart_phys and omap_uart_virt above. | ||
31 | */ | ||
18 | .macro addruart, rx, tmp | 32 | .macro addruart, rx, tmp |
33 | |||
34 | /* Use omap_uart_phys/virt if already configured */ | ||
35 | 10: mrc p15, 0, \rx, c1, c0 | ||
36 | tst \rx, #1 @ MMU enabled? | ||
37 | ldreq \rx, =omap_uart_phys @ physical base address | ||
38 | ldrne \rx, =omap_uart_virt @ virtual base address | ||
39 | ldr \rx, [\rx, #0] | ||
40 | cmp \rx, #0 @ is port configured? | ||
41 | bne 99f @ already configured | ||
42 | |||
43 | /* Check UART1 scratchpad register for uart to use */ | ||
19 | mrc p15, 0, \rx, c1, c0 | 44 | mrc p15, 0, \rx, c1, c0 |
20 | tst \rx, #1 @ MMU enabled? | 45 | tst \rx, #1 @ MMU enabled? |
21 | #ifdef CONFIG_ARCH_OMAP2 | ||
22 | moveq \rx, #0x48000000 @ physical base address | 46 | moveq \rx, #0x48000000 @ physical base address |
23 | movne \rx, #0xfa000000 @ virtual base | 47 | movne \rx, #0xfa000000 @ virtual base |
24 | orr \rx, \rx, #0x0006a000 | 48 | orr \rx, \rx, #0x0006a000 @ uart1 on omap2/3/4 |
25 | #ifdef CONFIG_OMAP_LL_DEBUG_UART2 | 49 | ldrb \rx, [\rx, #(UART_SCR << OMAP_PORT_SHIFT)] @ scratchpad |
26 | add \rx, \rx, #0x00002000 @ UART 2 | 50 | |
27 | #endif | 51 | /* Select the UART to use based on the UART1 scratchpad value */ |
28 | #ifdef CONFIG_OMAP_LL_DEBUG_UART3 | 52 | cmp \rx, #0 @ no port configured? |
29 | add \rx, \rx, #0x00004000 @ UART 3 | 53 | beq 21f @ if none, try to use UART1 |
30 | #endif | 54 | cmp \rx, #OMAP2UART1 @ OMAP2/3/4UART1 |
31 | 55 | beq 21f @ configure OMAP2/3/4UART1 | |
32 | #elif defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) | 56 | cmp \rx, #OMAP2UART2 @ OMAP2/3/4UART2 |
33 | moveq \rx, #0x48000000 @ physical base address | 57 | beq 22f @ configure OMAP2/3/4UART2 |
34 | movne \rx, #0xfa000000 @ virtual base | 58 | cmp \rx, #OMAP2UART3 @ only on 24xx |
35 | orr \rx, \rx, #0x0006a000 | 59 | beq 23f @ configure OMAP2UART3 |
36 | #ifdef CONFIG_OMAP_LL_DEBUG_UART2 | 60 | cmp \rx, #OMAP3UART3 @ only on 34xx |
37 | add \rx, \rx, #0x00002000 @ UART 2 | 61 | beq 33f @ configure OMAP3UART3 |
38 | #endif | 62 | cmp \rx, #OMAP4UART3 @ only on 44xx |
39 | #ifdef CONFIG_OMAP_LL_DEBUG_UART3 | 63 | beq 43f @ configure OMAP4UART3 |
40 | add \rx, \rx, #0x00fb0000 @ UART 3 | 64 | cmp \rx, #OMAP3UART4 @ only on 36xx |
41 | add \rx, \rx, #0x00006000 | 65 | beq 34f @ configure OMAP3UART4 |
42 | #endif | 66 | cmp \rx, #OMAP4UART4 @ only on 44xx |
43 | #endif | 67 | beq 44f @ configure OMAP4UART4 |
68 | cmp \rx, #ZOOM_UART @ only on zoom2/3 | ||
69 | beq 95f @ configure ZOOM_UART | ||
70 | |||
71 | /* Configure the UART offset from the phys/virt base */ | ||
72 | 21: mov \rx, #UART_OFFSET(OMAP2_UART1_BASE) @ omap2/3/4 | ||
73 | b 98f | ||
74 | 22: mov \rx, #UART_OFFSET(OMAP2_UART2_BASE) @ omap2/3/4 | ||
75 | b 98f | ||
76 | 23: mov \rx, #UART_OFFSET(OMAP2_UART3_BASE) | ||
77 | b 98f | ||
78 | 33: mov \rx, #UART_OFFSET(OMAP3_UART1_BASE) | ||
79 | add \rx, \rx, #0x00fb0000 | ||
80 | add \rx, \rx, #0x00006000 @ OMAP3_UART3_BASE | ||
81 | b 98f | ||
82 | 34: mov \rx, #UART_OFFSET(OMAP3_UART1_BASE) | ||
83 | add \rx, \rx, #0x00fb0000 | ||
84 | add \rx, \rx, #0x00028000 @ OMAP3_UART4_BASE | ||
85 | b 98f | ||
86 | 43: mov \rx, #UART_OFFSET(OMAP4_UART3_BASE) | ||
87 | b 98f | ||
88 | 44: mov \rx, #UART_OFFSET(OMAP4_UART4_BASE) | ||
89 | b 98f | ||
90 | 95: mov \rx, #ZOOM_UART_BASE | ||
91 | ldr \tmp, =omap_uart_phys | ||
92 | str \rx, [\tmp, #0] | ||
93 | mov \rx, #ZOOM_UART_VIRT | ||
94 | ldr \tmp, =omap_uart_virt | ||
95 | str \rx, [\tmp, #0] | ||
96 | mov \rx, #(UART_LSR << ZOOM_PORT_SHIFT) | ||
97 | ldr \tmp, =omap_uart_lsr | ||
98 | str \rx, [\tmp, #0] | ||
99 | b 10b | ||
100 | |||
101 | /* Store both phys and virt address for the uart */ | ||
102 | 98: add \rx, \rx, #0x48000000 @ phys base | ||
103 | ldr \tmp, =omap_uart_phys | ||
104 | str \rx, [\tmp, #0] | ||
105 | sub \rx, \rx, #0x48000000 @ phys base | ||
106 | add \rx, \rx, #0xfa000000 @ virt base | ||
107 | ldr \tmp, =omap_uart_virt | ||
108 | str \rx, [\tmp, #0] | ||
109 | mov \rx, #(UART_LSR << OMAP_PORT_SHIFT) | ||
110 | ldr \tmp, =omap_uart_lsr | ||
111 | str \rx, [\tmp, #0] | ||
112 | |||
113 | b 10b | ||
114 | 99: | ||
44 | .endm | 115 | .endm |
45 | 116 | ||
46 | .macro senduart,rd,rx | 117 | .macro senduart,rd,rx |
@@ -48,7 +119,9 @@ | |||
48 | .endm | 119 | .endm |
49 | 120 | ||
50 | .macro busyuart,rd,rx | 121 | .macro busyuart,rd,rx |
51 | 1001: ldrb \rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)] | 122 | 1001: ldr \rd, =omap_uart_lsr |
123 | ldr \rd, [\rd, #0] | ||
124 | ldrb \rd, [\rx, \rd] | ||
52 | and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE) | 125 | and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE) |
53 | teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE) | 126 | teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE) |
54 | bne 1001b | 127 | bne 1001b |