[CONNECTOR]: Fix warning in cn_queue.c
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / ppc / syslib / mv64x60_dbg.c
blob9cf18764a1a145d33584181a2f37cd0c6998d938
1 /*
2 * KGDB and progress routines for the Marvell/Galileo MV64x60 (Discovery).
4 * Author: Mark A. Greer <mgreer@mvista.com>
6 * 2003 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
13 *****************************************************************************
15 * Low-level MPSC/UART I/O routines
17 *****************************************************************************
21 #include <linux/config.h>
22 #include <linux/irq.h>
23 #include <asm/delay.h>
24 #include <asm/mv64x60.h>
25 #include <asm/machdep.h>
28 #if defined(CONFIG_SERIAL_TEXT_DEBUG)
30 #define MPSC_CHR_1 0x000c
31 #define MPSC_CHR_2 0x0010
33 static struct mv64x60_handle mv64x60_dbg_bh;
35 void
36 mv64x60_progress_init(u32 base)
38 mv64x60_dbg_bh.v_base = base;
39 return;
42 static void
43 mv64x60_polled_putc(int chan, char c)
45 u32 offset;
47 if (chan == 0)
48 offset = 0x8000;
49 else
50 offset = 0x9000;
52 mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_1, (u32)c);
53 mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_2, 0x200);
54 udelay(2000);
57 void
58 mv64x60_mpsc_progress(char *s, unsigned short hex)
60 volatile char c;
62 mv64x60_polled_putc(0, '\r');
64 while ((c = *s++) != 0)
65 mv64x60_polled_putc(0, c);
67 mv64x60_polled_putc(0, '\n');
68 mv64x60_polled_putc(0, '\r');
70 return;
72 #endif /* CONFIG_SERIAL_TEXT_DEBUG */
75 #if defined(CONFIG_KGDB)
77 #if defined(CONFIG_KGDB_TTYS0)
78 #define KGDB_PORT 0
79 #elif defined(CONFIG_KGDB_TTYS1)
80 #define KGDB_PORT 1
81 #else
82 #error "Invalid kgdb_tty port"
83 #endif
85 void
86 putDebugChar(unsigned char c)
88 mv64x60_polled_putc(KGDB_PORT, (char)c);
91 int
92 getDebugChar(void)
94 unsigned char c;
96 while (!mv64x60_polled_getc(KGDB_PORT, &c));
97 return (int)c;
100 void
101 putDebugString(char* str)
103 while (*str != '\0') {
104 putDebugChar(*str);
105 str++;
107 putDebugChar('\r');
108 return;
111 void
112 kgdb_interruptible(int enable)
116 void
117 kgdb_map_scc(void)
119 if (ppc_md.early_serial_map)
120 ppc_md.early_serial_map();
122 #endif /* CONFIG_KGDB */