Merge branch 'x86/pebs' into x86/unify-cpu-detect
[linux-2.6] / include / asm-arm / plat-s3c / debug-macro.S
1 /* linux/include/asm-arm/plat-s3c/debug-macro.S
2  *
3  * Copyright 2005, 2007 Simtec Electronics
4  *      http://armlinux.simtec.co.uk/
5  *      Ben Dooks <ben@simtec.co.uk>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10 */
11
12 #include <asm/plat-s3c/regs-serial.h>
13
14 /* The S3C2440 implementations are used by default as they are the
15  * most widely re-used */
16
17         .macro fifo_level_s3c2440 rd, rx
18                 ldr     \rd, [ \rx, # S3C2410_UFSTAT ]
19                 and     \rd, \rd, #S3C2440_UFSTAT_TXMASK
20         .endm
21
22 #ifndef fifo_level
23 #define fifo_level fifo_level_s3c2410
24 #endif
25
26         .macro  fifo_full_s3c2440 rd, rx
27                 ldr     \rd, [ \rx, # S3C2410_UFSTAT ]
28                 tst     \rd, #S3C2440_UFSTAT_TXFULL
29         .endm
30
31 #ifndef fifo_full
32 #define fifo_full fifo_full_s3c2440
33 #endif
34
35         .macro  senduart,rd,rx
36                 strb    \rd, [\rx, # S3C2410_UTXH ]
37         .endm
38
39         .macro  busyuart, rd, rx
40                 ldr     \rd, [ \rx, # S3C2410_UFCON ]
41                 tst     \rd, #S3C2410_UFCON_FIFOMODE    @ fifo enabled?
42                 beq     1001f                           @
43                 @ FIFO enabled...
44 1003:
45                 fifo_full \rd, \rx
46                 bne     1003b
47                 b       1002f
48
49 1001:
50                 @ busy waiting for non fifo
51                 ldr     \rd, [ \rx, # S3C2410_UTRSTAT ]
52                 tst     \rd, #S3C2410_UTRSTAT_TXFE
53                 beq     1001b
54
55 1002:           @ exit busyuart
56         .endm
57
58         .macro  waituart,rd,rx
59                 ldr     \rd, [ \rx, # S3C2410_UFCON ]
60                 tst     \rd, #S3C2410_UFCON_FIFOMODE    @ fifo enabled?
61                 beq     1001f                           @
62                 @ FIFO enabled...
63 1003:
64                 fifo_level \rd, \rx
65                 teq     \rd, #0
66                 bne     1003b
67                 b       1002f
68 1001:
69                 @ idle waiting for non fifo
70                 ldr     \rd, [ \rx, # S3C2410_UTRSTAT ]
71                 tst     \rd, #S3C2410_UTRSTAT_TXFE
72                 beq     1001b
73
74 1002:           @ exit busyuart
75         .endm