This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / asm-arm / arch-s3c2410 / debug-macro.S
1 /* linux/include/asm-arm/arch-s3c2410/debug-macro.S
2  *
3  * Debugging macro include header
4  *
5  *  Copyright (C) 1994-1999 Russell King
6  *  Copyright (C) 2005 Simtec Electronics
7  *
8  *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  *
14 */
15
16 #include <asm/arch/map.h>
17 #include <asm/arch/regs-serial.h>
18 #include <asm/arch/regs-gpio.h>
19
20 #define S3C2410_UART1_OFF (0x4000)
21 #define SHIFT_2440TXF (14-9)
22
23                 .macro addruart, rx
24                 mrc     p15, 0, \rx, c1, c0
25                 tst     \rx, #1
26                 ldreq   \rx, = S3C2410_PA_UART
27                 ldrne   \rx, = S3C2410_VA_UART
28 #if CONFIG_DEBUG_S3C2410_UART != 0
29                 add     \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C2410_UART)
30 #endif
31                 .endm
32
33                 .macro  senduart,rd,rx
34                 str     \rd, [\rx, # S3C2410_UTXH ]
35                 .endm
36
37                 .macro  busyuart, rd, rx
38                 ldr     \rd, [ \rx, # S3C2410_UFCON ]
39                 tst     \rd, #S3C2410_UFCON_FIFOMODE    @ fifo enabled?
40                 beq     1001f                           @
41                 @ FIFO enabled...
42 1003:
43                 mrc     p15, 0, \rd, c1, c0
44                 tst     \rd, #1
45                 addeq   \rd, \rx, #(S3C2410_PA_GPIO - S3C2410_PA_UART)
46                 addne   \rd, \rx, #(S3C2410_VA_GPIO - S3C2410_VA_UART)
47                 bic     \rd, \rd, #0xff000
48                 ldr     \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
49                 and     \rd, \rd, #0x00ff0000
50                 teq     \rd, #0x00440000                @ is it 2440?
51
52                 ldr     \rd, [ \rx, # S3C2410_UFSTAT ]
53                 moveq   \rd, \rd, lsr #SHIFT_2440TXF
54                 tst     \rd, #S3C2410_UFSTAT_TXFULL
55                 bne     1003b
56                 b       1002f
57
58 1001:
59                 @ busy waiting for non fifo
60                 ldr     \rd, [ \rx, # S3C2410_UTRSTAT ]
61                 tst     \rd, #S3C2410_UTRSTAT_TXFE
62                 beq     1001b
63
64 1002:           @ exit busyuart
65                 .endm
66
67                 .macro  waituart,rd,rx
68
69                 ldr     \rd, [ \rx, # S3C2410_UFCON ]
70                 tst     \rd, #S3C2410_UFCON_FIFOMODE    @ fifo enabled?
71                 beq     1001f                           @
72                 @ FIFO enabled...
73 1003:
74                 mrc     p15, 0, \rd, c1, c0
75                 tst     \rd, #1
76                 addeq   \rd, \rx, #(S3C2410_PA_GPIO - S3C2410_PA_UART)
77                 addne   \rd, \rx, #(S3C2410_VA_GPIO - S3C2410_VA_UART)
78                 bic     \rd, \rd, #0xff000
79                 ldr     \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
80                 and     \rd, \rd, #0x00ff0000
81                 teq     \rd, #0x00440000                @ is it 2440?
82
83                 ldr     \rd, [ \rx, # S3C2410_UFSTAT ]
84                 andne   \rd, \rd, #S3C2410_UFSTAT_TXMASK
85                 andeq   \rd, \rd, #S3C2440_UFSTAT_TXMASK
86                 teq     \rd, #0
87                 bne     1003b
88                 b       1002f
89
90 1001:
91                 @ idle waiting for non fifo
92                 ldr     \rd, [ \rx, # S3C2410_UTRSTAT ]
93                 tst     \rd, #S3C2410_UTRSTAT_TXFE
94                 beq     1001b
95
96 1002:           @ exit busyuart
97                 .endm