[ARM] Collect 8250-based debug implementations together
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Thu, 16 Mar 2006 20:40:25 +0000 (20:40 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 21 Mar 2006 22:05:57 +0000 (22:05 +0000)
Several ARM machine implementations used an 8250 compatible port for
debugging purposes, and indepdently implemented the low level debug
macros every time.  Provide a common implementation and convert these
implementations to use this version.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
include/asm-arm/arch-cl7500/debug-macro.S
include/asm-arm/arch-ebsa110/debug-macro.S
include/asm-arm/arch-ebsa285/debug-macro.S
include/asm-arm/arch-iop3xx/debug-macro.S
include/asm-arm/arch-ixp4xx/debug-macro.S
include/asm-arm/arch-pxa/debug-macro.S
include/asm-arm/arch-rpc/debug-macro.S
include/asm-arm/hardware/debug-8250.S [new file with mode: 0644]

index a5d489d7955a953a9a5c40e3d5b35257e28561f5..9a2b67d240985fad4d00540e688c1a588952af39 100644 (file)
                orr     \rx, \rx, #0x00000be0
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
-
-               .macro  busyuart,rd,rx
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldrb    \rd, [\rx, #0x14]
-               tst     \rd, #0x20
-               beq     1001b
-               .endm
+#define UART_SHIFT     2
+#include <asm/hardware/debug-8250.S>
index dcd03a40c502c5acbd4987007427f851a5d17f5a..f61cadabe0ec60e3237308c83ad62069fdef4e40 100644 (file)
                orr     \rx, \rx, #0x00000be0
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
-
-               .macro  busyuart,rd,rx
-1002:          ldrb    \rd, [\rx, #0x14]
-               and     \rd, \rd, #0x60
-               teq     \rd, #0x60
-               bne     1002b
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldrb    \rd, [\rx, #0x18]
-               tst     \rd, #0x10
-               beq     1001b
-               .endm
+#define UART_SHIFT     2
+#define FLOW_CONTROL
+#include <asm/hardware/debug-8250.h>
index 97d15fc629af867c389509b71e4da6057a0e9d83..b48cec4a0c45f083b4b40a67e5b21d695d2746f4 100644 (file)
                orr     \rx, \rx, #0x000003f8
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
+#define UART_SHIFT     0
+#define FLOW_CONTROL
+#include <asm/hardware/debug-8250.S>
 
-               .macro  busyuart,rd,rx
-1002:          ldrb    \rd, [\rx, #0x5]
-               and     \rd, \rd, #0x60
-               teq     \rd, #0x60
-               bne     1002b
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldrb    \rd, [\rx, #0x6]
-               tst     \rd, #0x10
-               beq     1001b
-               .endm
 #else
        /* For EBSA285 debugging */
                .equ    dc21285_high, ARMCSR_BASE & 0xff000000
index cc15f80ebd9a870c4a48d28b67b34e9c0c3bc467..ce007e531994c79e9e605114e7b7283a9d304cb8 100644 (file)
 #endif
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
-
-               .macro  busyuart,rd,rx
-1002:          ldrb    \rd, [\rx, #0x5]
-               and     \rd, \rd, #0x60
-               teq     \rd, #0x60
-               bne     1002b
-               .endm
-
-               .macro  waituart,rd,rx
 #if !defined(CONFIG_ARCH_IQ80321) || !defined(CONFIG_ARCH_IQ31244) || !defined(CONFIG_ARCH_IQ80331)
-1001:          ldrb    \rd, [\rx, #0x6]
-               tst     \rd, #0x10
-               beq     1001b
+#define FLOW_CONTROL
 #endif
-               .endm
+#define UART_SHIFT     0
+#include <asm/hardware/debug-8250.S>
index 2e23651e217fc554a073a8ac77337dd795460f52..37bc8ef23e6759a5cfb1014cdc09e2bb0c463e4a 100644 (file)
                                                @ byte writes used - Big Endian.
                 .endm
 
-               .macro  senduart,rd,rx
-                strb    \rd, [\rx]
-                .endm
-
-                .macro  waituart,rd,rx
-1002:           ldrb    \rd, [\rx, #0x14]
-                and     \rd, \rd, #0x60                @ check THRE and TEMT bits
-                teq     \rd, #0x60
-                bne     1002b
-                .endm
-
-                .macro  busyuart,rd,rx
-                .endm
+#define UART_SHIFT     2
+#include <asm/hardware/debug-8250.S>
index b6ec68879176158e1f6e4dfbf46e4091d8d4aaa9..9012cbc0ad8b1677c1f3596b0fd1ce22bc220df5 100644 (file)
                orr     \rx, \rx, #0x00100000
                .endm
 
-               .macro  senduart,rd,rx
-               str     \rd, [\rx, #0]
-               .endm
-
-               .macro  busyuart,rd,rx
-1002:          ldr     \rd, [\rx, #0x14]
-               tst     \rd, #(1 << 6)
-               beq     1002b
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldr     \rd, [\rx, #0x14]
-               tst     \rd, #(1 << 5)
-               beq     1001b
-               .endm
+#define UART_SHIFT     2
+#include <asm/hardware/debug-8250.S>
index 456d3d754c3d0711208c06a919b94d47becdfd81..c634c8d8f4a152b5d69f02095a35c3ecaf3b4eb3 100644 (file)
                orr     \rx, \rx, #0x00000fe0
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
-
-               .macro  busyuart,rd,rx
-1001:          ldrb    \rd, [\rx, #0x14]
-               and     \rd, \rd, #0x60
-               teq     \rd, #0x60
-               bne     1001b
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldrb    \rd, [\rx, #0x18]
-               tst     \rd, #0x10
-               beq     1001b
-               .endm
+#define UART_SHIFT     2
+#define FLOW_CONTROL
+#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/hardware/debug-8250.S b/include/asm-arm/hardware/debug-8250.S
new file mode 100644 (file)
index 0000000..4594fea
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * linux/include/asm-arm/hardware/debug-8250.h
+ *
+ *  Copyright (C) 1994-1999 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/serial_reg.h>
+
+               .macro  senduart,rd,rx
+               strb    \rd, [\rx, #UART_TX << UART_SHIFT]
+               .endm
+
+               .macro  busyuart,rd,rx
+1002:          ldrb    \rd, [\rx, #UART_LSR << UART_SHIFT]
+               and     \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
+               teq     \rd, #UART_LSR_TEMT | UART_LSR_THRE
+               bne     1002b
+               .endm
+
+               .macro  waituart,rd,rx
+#ifdef FLOW_CONTROL
+1001:          ldrb    \rd, [\rx, #UART_MSR << UART_SHIFT]
+               tst     \rd, #UART_MSR_CTS
+               beq     1001b
+#endif
+               .endm