]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/mach-omap2/include/mach/debug-macro.S
Merge branch 'for_2.6.36' of git://git.pwsan.com/linux-2.6 into omap-for-linus
[net-next-2.6.git] / arch / arm / mach-omap2 / include / mach / debug-macro.S
CommitLineData
aca59b89 1/* arch/arm/mach-omap2/include/mach/debug-macro.S
1da177e4
LT
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
4f2c49fe
TL
14#include <linux/serial_reg.h>
15
96554d70
TL
16#include <asm/memory.h>
17
4f2c49fe
TL
18#include <plat/serial.h>
19
0c8219f0
TL
20#define UART_OFFSET(addr) ((addr) & 0x00ffffff)
21
22 .pushsection .data
23omap_uart_phys: .word 0
24omap_uart_virt: .word 0
25omap_uart_lsr: .word 0
26 .popsection
27
28 /*
29 * Note that this code won't work if the bootloader passes
30 * a wrong machine ID number in r1. To debug, just hardcode
31 * the desired UART phys and virt addresses temporarily into
32 * the omap_uart_phys and omap_uart_virt above.
33 */
4e6d488a 34 .macro addruart, rx, tmp
0c8219f0
TL
35
36 /* Use omap_uart_phys/virt if already configured */
3710: mrc p15, 0, \rx, c1, c0
38 tst \rx, #1 @ MMU enabled?
39 ldreq \rx, =omap_uart_phys @ physical base address
40 ldrne \rx, =omap_uart_virt @ virtual base address
41 ldr \rx, [\rx, #0]
42 cmp \rx, #0 @ is port configured?
43 bne 99f @ already configured
44
96554d70 45 /* Check the debug UART configuration set in uncompress.h */
1da177e4
LT
46 mrc p15, 0, \rx, c1, c0
47 tst \rx, #1 @ MMU enabled?
96554d70
TL
48 ldreq \rx, =OMAP_UART_INFO
49 ldrne \rx, =__phys_to_virt(OMAP_UART_INFO)
50 ldr \rx, [\rx, #0]
0c8219f0
TL
51
52 /* Select the UART to use based on the UART1 scratchpad value */
53 cmp \rx, #0 @ no port configured?
54 beq 21f @ if none, try to use UART1
55 cmp \rx, #OMAP2UART1 @ OMAP2/3/4UART1
56 beq 21f @ configure OMAP2/3/4UART1
57 cmp \rx, #OMAP2UART2 @ OMAP2/3/4UART2
58 beq 22f @ configure OMAP2/3/4UART2
59 cmp \rx, #OMAP2UART3 @ only on 24xx
60 beq 23f @ configure OMAP2UART3
61 cmp \rx, #OMAP3UART3 @ only on 34xx
62 beq 33f @ configure OMAP3UART3
63 cmp \rx, #OMAP4UART3 @ only on 44xx
64 beq 43f @ configure OMAP4UART3
65 cmp \rx, #OMAP3UART4 @ only on 36xx
66 beq 34f @ configure OMAP3UART4
67 cmp \rx, #OMAP4UART4 @ only on 44xx
68 beq 44f @ configure OMAP4UART4
69 cmp \rx, #ZOOM_UART @ only on zoom2/3
70 beq 95f @ configure ZOOM_UART
71
72 /* Configure the UART offset from the phys/virt base */
7321: mov \rx, #UART_OFFSET(OMAP2_UART1_BASE) @ omap2/3/4
74 b 98f
7522: mov \rx, #UART_OFFSET(OMAP2_UART2_BASE) @ omap2/3/4
76 b 98f
7723: mov \rx, #UART_OFFSET(OMAP2_UART3_BASE)
78 b 98f
7933: mov \rx, #UART_OFFSET(OMAP3_UART1_BASE)
80 add \rx, \rx, #0x00fb0000
81 add \rx, \rx, #0x00006000 @ OMAP3_UART3_BASE
82 b 98f
8334: mov \rx, #UART_OFFSET(OMAP3_UART1_BASE)
84 add \rx, \rx, #0x00fb0000
85 add \rx, \rx, #0x00028000 @ OMAP3_UART4_BASE
86 b 98f
8743: mov \rx, #UART_OFFSET(OMAP4_UART3_BASE)
88 b 98f
8944: mov \rx, #UART_OFFSET(OMAP4_UART4_BASE)
90 b 98f
a4f57b81 9195: ldr \rx, =ZOOM_UART_BASE
0c8219f0
TL
92 ldr \tmp, =omap_uart_phys
93 str \rx, [\tmp, #0]
a4f57b81 94 ldr \rx, =ZOOM_UART_VIRT
0c8219f0
TL
95 ldr \tmp, =omap_uart_virt
96 str \rx, [\tmp, #0]
97 mov \rx, #(UART_LSR << ZOOM_PORT_SHIFT)
98 ldr \tmp, =omap_uart_lsr
99 str \rx, [\tmp, #0]
100 b 10b
101
102 /* Store both phys and virt address for the uart */
10398: add \rx, \rx, #0x48000000 @ phys base
104 ldr \tmp, =omap_uart_phys
105 str \rx, [\tmp, #0]
106 sub \rx, \rx, #0x48000000 @ phys base
107 add \rx, \rx, #0xfa000000 @ virt base
108 ldr \tmp, =omap_uart_virt
109 str \rx, [\tmp, #0]
110 mov \rx, #(UART_LSR << OMAP_PORT_SHIFT)
111 ldr \tmp, =omap_uart_lsr
112 str \rx, [\tmp, #0]
113
114 b 10b
11599:
1da177e4
LT
116 .endm
117
118 .macro senduart,rd,rx
119 strb \rd, [\rx]
120 .endm
121
122 .macro busyuart,rd,rx
0c8219f0
TL
1231001: ldr \rd, =omap_uart_lsr
124 ldr \rd, [\rd, #0]
125 ldrb \rd, [\rx, \rd]
4f2c49fe
TL
126 and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
127 teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
1da177e4 128 bne 1001b
1da177e4
LT
129 .endm
130
131 .macro waituart,rd,rx
132 .endm