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> |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame] | 17 | #include <asm/plat-s3c/regs-serial.h> |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame] | 18 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #define S3C2410_UART1_OFF (0x4000) |
| 20 | #define SHIFT_2440TXF (14-9) |
| 21 | |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame] | 22 | .macro addruart, rx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | mrc p15, 0, \rx, c1, c0 |
| 24 | tst \rx, #1 |
Lucas Correia Villa Real | 0367a8d | 2006-01-26 15:20:50 +0000 | [diff] [blame] | 25 | ldreq \rx, = S3C24XX_PA_UART |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | ldrne \rx, = S3C24XX_VA_UART |
Ben Dooks | 3ec2052 | 2007-07-22 16:12:04 +0100 | [diff] [blame^] | 27 | #if CONFIG_DEBUG_S3C_UART != 0 |
| 28 | add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #endif |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame] | 30 | .endm |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
Ben Dooks | cbc4dbf | 2007-07-22 16:10:23 +0100 | [diff] [blame] | 32 | .macro fifo_full_s3c24xx rd, rx |
Ben Dooks | 68d9ab3 | 2006-06-24 21:21:27 +0100 | [diff] [blame] | 33 | @ check for arm920 vs arm926. currently assume all arm926 |
| 34 | @ devices have an 64 byte FIFO identical to the s3c2440 |
| 35 | mrc p15, 0, \rd, c0, c0 |
| 36 | and \rd, \rd, #0xff0 |
| 37 | teq \rd, #0x260 |
| 38 | beq 1004f |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | mrc p15, 0, \rd, c1, c0 |
| 40 | tst \rd, #1 |
Lucas Correia Villa Real | 0367a8d | 2006-01-26 15:20:50 +0000 | [diff] [blame] | 41 | addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART) |
| 43 | bic \rd, \rd, #0xff000 |
| 44 | ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ] |
| 45 | and \rd, \rd, #0x00ff0000 |
| 46 | teq \rd, #0x00440000 @ is it 2440? |
Ben Dooks | 68d9ab3 | 2006-06-24 21:21:27 +0100 | [diff] [blame] | 47 | 1004: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
| 49 | moveq \rd, \rd, lsr #SHIFT_2440TXF |
| 50 | tst \rd, #S3C2410_UFSTAT_TXFULL |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame] | 51 | .endm |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Ben Dooks | cbc4dbf | 2007-07-22 16:10:23 +0100 | [diff] [blame] | 53 | .macro fifo_full_s3c2410 rd, rx |
| 54 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
| 55 | tst \rd, #S3C2410_UFSTAT_TXFULL |
| 56 | .endm |
| 57 | |
| 58 | /* fifo level reading */ |
| 59 | |
| 60 | .macro fifo_level_s3c24xx rd, rx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | mrc p15, 0, \rd, c1, c0 |
| 62 | tst \rd, #1 |
Lucas Correia Villa Real | 0367a8d | 2006-01-26 15:20:50 +0000 | [diff] [blame] | 63 | addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART) |
| 65 | bic \rd, \rd, #0xff000 |
| 66 | ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ] |
| 67 | and \rd, \rd, #0x00ff0000 |
| 68 | teq \rd, #0x00440000 @ is it 2440? |
| 69 | |
| 70 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
| 71 | andne \rd, \rd, #S3C2410_UFSTAT_TXMASK |
| 72 | andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK |
Ben Dooks | 498e03b | 2007-07-22 16:08:48 +0100 | [diff] [blame] | 73 | .endm |
Ben Dooks | cbc4dbf | 2007-07-22 16:10:23 +0100 | [diff] [blame] | 74 | |
| 75 | .macro fifo_level_s3c2410 rd, rx |
| 76 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
| 77 | and \rd, \rd, #S3C2410_UFSTAT_TXMASK |
| 78 | .endm |
| 79 | |
| 80 | /* Select the correct implementation depending on the configuration. The |
| 81 | * S3C2440 will get selected by default, as these are the most widely |
| 82 | * used variants of these |
| 83 | */ |
| 84 | |
| 85 | #if defined(CONFIG_CPU_LLSERIAL_S3C2410_ONLY) |
| 86 | #define fifo_full fifo_full_s3c2410 |
| 87 | #define fifo_level fifo_level_s3c2410 |
| 88 | #warning 2410only |
| 89 | #elif !defined(CONFIG_CPU_LLSERIAL_S3C2440_ONLY) |
| 90 | #define fifo_full fifo_full_s3c24xx |
| 91 | #define fifo_level fifo_level_s3c24xx |
| 92 | #warning generic |
| 93 | #endif |
| 94 | |
| 95 | /* include the reset of the code which will do the work */ |
| 96 | |
| 97 | #include <asm/plat-s3c/debug-macro.S> |