1 /* arch/arm/mach-s3c2410/include/mach/debug-macro.S
3 * Debugging macro include header
5 * Copyright (C) 1994-1999 Russell King
6 * Copyright (C) 2005 Simtec Electronics
8 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
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.
16 #include <mach/regs-gpio.h>
17 #include <plat/regs-serial.h>
19 #define S3C2410_UART1_OFF (0x4000)
20 #define SHIFT_2440TXF (14-9)
22 .macro addruart, rp, rv
23 ldr \rp, = S3C24XX_PA_UART
24 ldr \rv, = S3C24XX_VA_UART
25 #if CONFIG_DEBUG_S3C_UART != 0
26 add \rp, \rp, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
27 add \rv, \rv, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
31 .macro fifo_full_s3c24xx rd, rx
32 @ check for arm920 vs arm926. currently assume all arm926
33 @ devices have an 64 byte FIFO identical to the s3c2440
34 mrc p15, 0, \rd, c0, c0
38 mrc p15, 0, \rd, c1, c0
40 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
41 addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
42 bic \rd, \rd, #0xff000
43 ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
44 and \rd, \rd, #0x00ff0000
45 teq \rd, #0x00440000 @ is it 2440?
47 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
48 moveq \rd, \rd, lsr #SHIFT_2440TXF
49 tst \rd, #S3C2410_UFSTAT_TXFULL
52 .macro fifo_full_s3c2410 rd, rx
53 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
54 tst \rd, #S3C2410_UFSTAT_TXFULL
57 /* fifo level reading */
59 .macro fifo_level_s3c24xx rd, rx
60 @ check for arm920 vs arm926. currently assume all arm926
61 @ devices have an 64 byte FIFO identical to the s3c2440
62 mrc p15, 0, \rd, c0, c0
66 mrc p15, 0, \rd, c1, c0
68 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
69 addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
70 bic \rd, \rd, #0xff000
71 ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
72 and \rd, \rd, #0x00ff0000
73 teq \rd, #0x00440000 @ is it 2440?
76 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
77 andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
78 andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
81 .macro fifo_level_s3c2410 rd, rx
82 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
83 and \rd, \rd, #S3C2410_UFSTAT_TXMASK
86 /* Select the correct implementation depending on the configuration. The
87 * S3C2440 will get selected by default, as these are the most widely
88 * used variants of these
91 #if defined(CONFIG_CPU_LLSERIAL_S3C2410_ONLY)
92 #define fifo_full fifo_full_s3c2410
93 #define fifo_level fifo_level_s3c2410
94 #elif !defined(CONFIG_CPU_LLSERIAL_S3C2440_ONLY)
95 #define fifo_full fifo_full_s3c24xx
96 #define fifo_level fifo_level_s3c24xx
99 /* include the reset of the code which will do the work */
101 #include <plat/debug-macro.S>