blob: b0a44178b14e7f5c4755fc4af177e43cbaca0c1e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* 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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013*/
14
15#include <asm/arch/map.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <asm/arch/regs-gpio.h>
17
Ben Dooks498e03b2007-07-22 16:08:48 +010018#include <asm/plat-s3c/regs-serial.h>
19#include <asm/plat-s3c/debug-macro.S>
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#define S3C2410_UART1_OFF (0x4000)
22#define SHIFT_2440TXF (14-9)
23
Ben Dooks498e03b2007-07-22 16:08:48 +010024 .macro addruart, rx
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 mrc p15, 0, \rx, c1, c0
26 tst \rx, #1
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +000027 ldreq \rx, = S3C24XX_PA_UART
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 ldrne \rx, = S3C24XX_VA_UART
29#if CONFIG_DEBUG_S3C2410_UART != 0
30 add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C2410_UART)
31#endif
Ben Dooks498e03b2007-07-22 16:08:48 +010032 .endm
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Ben Dooks498e03b2007-07-22 16:08:48 +010034 .macro fifo_full rd, rx
Ben Dooks68d9ab32006-06-24 21:21:27 +010035 @ check for arm920 vs arm926. currently assume all arm926
36 @ devices have an 64 byte FIFO identical to the s3c2440
37 mrc p15, 0, \rd, c0, c0
38 and \rd, \rd, #0xff0
39 teq \rd, #0x260
40 beq 1004f
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 mrc p15, 0, \rd, c1, c0
42 tst \rd, #1
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +000043 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
45 bic \rd, \rd, #0xff000
46 ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
47 and \rd, \rd, #0x00ff0000
48 teq \rd, #0x00440000 @ is it 2440?
Ben Dooks68d9ab32006-06-24 21:21:27 +0100491004:
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
51 moveq \rd, \rd, lsr #SHIFT_2440TXF
52 tst \rd, #S3C2410_UFSTAT_TXFULL
Ben Dooks498e03b2007-07-22 16:08:48 +010053 .endm
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Ben Dooks498e03b2007-07-22 16:08:48 +010055 .macro fifo_level rd, rx
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 mrc p15, 0, \rd, c1, c0
57 tst \rd, #1
Lucas Correia Villa Real0367a8d2006-01-26 15:20:50 +000058 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
60 bic \rd, \rd, #0xff000
61 ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
62 and \rd, \rd, #0x00ff0000
63 teq \rd, #0x00440000 @ is it 2440?
64
65 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
66 andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
67 andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
Ben Dooks498e03b2007-07-22 16:08:48 +010068 .endm