aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm/arch-s3c2410/debug-macro.S
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-arm/arch-s3c2410/debug-macro.S')
-rw-r--r--include/asm-arm/arch-s3c2410/debug-macro.S84
1 files changed, 43 insertions, 41 deletions
diff --git a/include/asm-arm/arch-s3c2410/debug-macro.S b/include/asm-arm/arch-s3c2410/debug-macro.S
index 93064860e0e5..9c8cd9abb82b 100644
--- a/include/asm-arm/arch-s3c2410/debug-macro.S
+++ b/include/asm-arm/arch-s3c2410/debug-macro.S
@@ -13,32 +13,23 @@
13*/ 13*/
14 14
15#include <asm/arch/map.h> 15#include <asm/arch/map.h>
16#include <asm/arch/regs-serial.h>
17#include <asm/arch/regs-gpio.h> 16#include <asm/arch/regs-gpio.h>
17#include <asm/plat-s3c/regs-serial.h>
18 18
19#define S3C2410_UART1_OFF (0x4000) 19#define S3C2410_UART1_OFF (0x4000)
20#define SHIFT_2440TXF (14-9) 20#define SHIFT_2440TXF (14-9)
21 21
22 .macro addruart, rx 22 .macro addruart, rx
23 mrc p15, 0, \rx, c1, c0 23 mrc p15, 0, \rx, c1, c0
24 tst \rx, #1 24 tst \rx, #1
25 ldreq \rx, = S3C24XX_PA_UART 25 ldreq \rx, = S3C24XX_PA_UART
26 ldrne \rx, = S3C24XX_VA_UART 26 ldrne \rx, = S3C24XX_VA_UART
27#if CONFIG_DEBUG_S3C2410_UART != 0 27#if CONFIG_DEBUG_S3C_UART != 0
28 add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C2410_UART) 28 add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
29#endif 29#endif
30 .endm 30 .endm
31 31
32 .macro senduart,rd,rx 32 .macro fifo_full_s3c24xx rd, rx
33 strb \rd, [\rx, # S3C2410_UTXH ]
34 .endm
35
36 .macro busyuart, rd, rx
37 ldr \rd, [ \rx, # S3C2410_UFCON ]
38 tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
39 beq 1001f @
40 @ FIFO enabled...
411003:
42 @ check for arm920 vs arm926. currently assume all arm926 33 @ check for arm920 vs arm926. currently assume all arm926
43 @ devices have an 64 byte FIFO identical to the s3c2440 34 @ devices have an 64 byte FIFO identical to the s3c2440
44 mrc p15, 0, \rd, c0, c0 35 mrc p15, 0, \rd, c0, c0
@@ -57,25 +48,22 @@
57 ldr \rd, [ \rx, # S3C2410_UFSTAT ] 48 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
58 moveq \rd, \rd, lsr #SHIFT_2440TXF 49 moveq \rd, \rd, lsr #SHIFT_2440TXF
59 tst \rd, #S3C2410_UFSTAT_TXFULL 50 tst \rd, #S3C2410_UFSTAT_TXFULL
60 bne 1003b 51 .endm
61 b 1002f
62
631001:
64 @ busy waiting for non fifo
65 ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
66 tst \rd, #S3C2410_UTRSTAT_TXFE
67 beq 1001b
68 52
691002: @ exit busyuart 53 .macro fifo_full_s3c2410 rd, rx
70 .endm 54 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
55 tst \rd, #S3C2410_UFSTAT_TXFULL
56 .endm
71 57
72 .macro waituart,rd,rx 58/* fifo level reading */
73 59
74 ldr \rd, [ \rx, # S3C2410_UFCON ] 60 .macro fifo_level_s3c24xx rd, rx
75 tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled? 61 @ check for arm920 vs arm926. currently assume all arm926
76 beq 1001f @ 62 @ devices have an 64 byte FIFO identical to the s3c2440
77 @ FIFO enabled... 63 mrc p15, 0, \rd, c0, c0
781003: 64 and \rd, \rd, #0xff0
65 teq \rd, #0x260
66 beq 10000f
79 mrc p15, 0, \rd, c1, c0 67 mrc p15, 0, \rd, c1, c0
80 tst \rd, #1 68 tst \rd, #1
81 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) 69 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
@@ -85,18 +73,32 @@
85 and \rd, \rd, #0x00ff0000 73 and \rd, \rd, #0x00ff0000
86 teq \rd, #0x00440000 @ is it 2440? 74 teq \rd, #0x00440000 @ is it 2440?
87 75
7610000:
88 ldr \rd, [ \rx, # S3C2410_UFSTAT ] 77 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
89 andne \rd, \rd, #S3C2410_UFSTAT_TXMASK 78 andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
90 andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK 79 andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
91 teq \rd, #0 80 .endm
92 bne 1003b 81
93 b 1002f 82 .macro fifo_level_s3c2410 rd, rx
83 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
84 and \rd, \rd, #S3C2410_UFSTAT_TXMASK
85 .endm
86
87/* Select the correct implementation depending on the configuration. The
88 * S3C2440 will get selected by default, as these are the most widely
89 * used variants of these
90*/
91
92#if defined(CONFIG_CPU_LLSERIAL_S3C2410_ONLY)
93#define fifo_full fifo_full_s3c2410
94#define fifo_level fifo_level_s3c2410
95#warning 2410only
96#elif !defined(CONFIG_CPU_LLSERIAL_S3C2440_ONLY)
97#define fifo_full fifo_full_s3c24xx
98#define fifo_level fifo_level_s3c24xx
99#warning generic
100#endif
94 101
951001: 102/* include the reset of the code which will do the work */
96 @ idle waiting for non fifo
97 ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
98 tst \rd, #S3C2410_UTRSTAT_TXFE
99 beq 1001b
100 103
1011002: @ exit busyuart 104#include <asm/plat-s3c/debug-macro.S>
102 .endm