Linux 5.7.6
[linux/fpc-iii.git] / arch / arm / include / debug / samsung.S
blob69201d7fb48f6443d0ec8e5bb474764d947275b0
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright 2005, 2007 Simtec Electronics
4  *      http://armlinux.simtec.co.uk/
5  *      Ben Dooks <ben@simtec.co.uk>
6  */
8 #include <linux/serial_s3c.h>
10 /* The S5PV210/S5PC110 implementations are as belows. */
12         .macro fifo_level_s5pv210 rd, rx
13                 ldr     \rd, [\rx, # S3C2410_UFSTAT]
14 ARM_BE8(rev \rd, \rd)
15                 and     \rd, \rd, #S5PV210_UFSTAT_TXMASK
16         .endm
18         .macro  fifo_full_s5pv210 rd, rx
19                 ldr     \rd, [\rx, # S3C2410_UFSTAT]
20 ARM_BE8(rev \rd, \rd)
21                 tst     \rd, #S5PV210_UFSTAT_TXFULL
22         .endm
24 /* The S3C2440 implementations are used by default as they are the
25  * most widely re-used */
27         .macro fifo_level_s3c2440 rd, rx
28                 ldr     \rd, [\rx, # S3C2410_UFSTAT]
29 ARM_BE8(rev \rd, \rd)
30                 and     \rd, \rd, #S3C2440_UFSTAT_TXMASK
31         .endm
33 #ifndef fifo_level
34 #define fifo_level fifo_level_s3c2440
35 #endif
37         .macro  fifo_full_s3c2440 rd, rx
38                 ldr     \rd, [\rx, # S3C2410_UFSTAT]
39 ARM_BE8(rev \rd, \rd)
40                 tst     \rd, #S3C2440_UFSTAT_TXFULL
41         .endm
43 #ifndef fifo_full
44 #define fifo_full fifo_full_s3c2440
45 #endif
47         .macro  senduart,rd,rx
48                 strb    \rd, [\rx, # S3C2410_UTXH]
49         .endm
51         .macro  busyuart, rd, rx
52                 ldr     \rd, [\rx, # S3C2410_UFCON]
53 ARM_BE8(rev \rd, \rd)
54                 tst     \rd, #S3C2410_UFCON_FIFOMODE    @ fifo enabled?
55                 beq     1001f                           @
56                 @ FIFO enabled...
57 1003:
58                 fifo_full \rd, \rx
59                 bne     1003b
60                 b       1002f
62 1001:
63                 @ busy waiting for non fifo
64                 ldr     \rd, [\rx, # S3C2410_UTRSTAT]
65 ARM_BE8(rev \rd, \rd)
66                 tst     \rd, #S3C2410_UTRSTAT_TXFE
67                 beq     1001b
69 1002:           @ exit busyuart
70         .endm
72         .macro  waituart,rd,rx
73                 ldr     \rd, [\rx, # S3C2410_UFCON]
74 ARM_BE8(rev \rd, \rd)
75                 tst     \rd, #S3C2410_UFCON_FIFOMODE    @ fifo enabled?
76                 beq     1001f                           @
77                 @ FIFO enabled...
78 1003:
79                 fifo_level \rd, \rx
80                 teq     \rd, #0
81                 bne     1003b
82                 b       1002f
83 1001:
84                 @ idle waiting for non fifo
85                 ldr     \rd, [\rx, # S3C2410_UTRSTAT]
86 ARM_BE8(rev \rd, \rd)
87                 tst     \rd, #S3C2410_UTRSTAT_TXFE
88                 beq     1001b
90 1002:           @ exit busyuart
91         .endm