Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #include <asm/arch/map.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <asm/arch/regs-gpio.h> |
| 17 | |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame^] | 18 | #include <asm/plat-s3c/regs-serial.h> |
| 19 | #include <asm/plat-s3c/debug-macro.S> |
| 20 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #define S3C2410_UART1_OFF (0x4000) |
| 22 | #define SHIFT_2440TXF (14-9) |
| 23 | |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame^] | 24 | .macro addruart, rx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | mrc p15, 0, \rx, c1, c0 |
| 26 | tst \rx, #1 |
Lucas Correia Villa Real | 0367a8d | 2006-01-26 15:20:50 +0000 | [diff] [blame] | 27 | ldreq \rx, = S3C24XX_PA_UART |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | 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 Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame^] | 32 | .endm |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame^] | 34 | .macro fifo_full rd, rx |
Ben Dooks | 68d9ab3 | 2006-06-24 21:21:27 +0100 | [diff] [blame] | 35 | @ 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | mrc p15, 0, \rd, c1, c0 |
| 42 | tst \rd, #1 |
Lucas Correia Villa Real | 0367a8d | 2006-01-26 15:20:50 +0000 | [diff] [blame] | 43 | addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | 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 Dooks | 68d9ab3 | 2006-06-24 21:21:27 +0100 | [diff] [blame] | 49 | 1004: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
| 51 | moveq \rd, \rd, lsr #SHIFT_2440TXF |
| 52 | tst \rd, #S3C2410_UFSTAT_TXFULL |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame^] | 53 | .endm |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame^] | 55 | .macro fifo_level rd, rx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | mrc p15, 0, \rd, c1, c0 |
| 57 | tst \rd, #1 |
Lucas Correia Villa Real | 0367a8d | 2006-01-26 15:20:50 +0000 | [diff] [blame] | 58 | addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | 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 Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame^] | 68 | .endm |