Initial commit
[wrt350n-kernel.git] / arch / ppc / syslib / mv64x60_dbg.c
blobe1876261e5dcc359f53ac12062f900d598d5a241
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/irq.h>
22 #include <asm/delay.h>
23 #include <asm/mv64x60.h>
24 #include <asm/machdep.h>
27 #if defined(CONFIG_SERIAL_TEXT_DEBUG)
29 #define MPSC_CHR_1 0x000c
30 #define MPSC_CHR_2 0x0010
32 static struct mv64x60_handle mv64x60_dbg_bh;
34 void
35 mv64x60_progress_init(u32 base)
37 mv64x60_dbg_bh.v_base = base;
38 return;
41 static void
42 mv64x60_polled_putc(int chan, char c)
44 u32 offset;
46 if (chan == 0)
47 offset = 0x8000;
48 else
49 offset = 0x9000;
51 mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_1, (u32)c);
52 mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_2, 0x200);
53 udelay(2000);
56 void
57 mv64x60_mpsc_progress(char *s, unsigned short hex)
59 volatile char c;
61 mv64x60_polled_putc(0, '\r');
63 while ((c = *s++) != 0)
64 mv64x60_polled_putc(0, c);
66 mv64x60_polled_putc(0, '\n');
67 mv64x60_polled_putc(0, '\r');
69 return;
71 #endif /* CONFIG_SERIAL_TEXT_DEBUG */
74 #if defined(CONFIG_KGDB)
76 #if defined(CONFIG_KGDB_TTYS0)
77 #define KGDB_PORT 0
78 #elif defined(CONFIG_KGDB_TTYS1)
79 #define KGDB_PORT 1
80 #else
81 #error "Invalid kgdb_tty port"
82 #endif
84 void
85 putDebugChar(unsigned char c)
87 mv64x60_polled_putc(KGDB_PORT, (char)c);
90 int
91 getDebugChar(void)
93 unsigned char c;
95 while (!mv64x60_polled_getc(KGDB_PORT, &c));
96 return (int)c;
99 void
100 putDebugString(char* str)
102 while (*str != '\0') {
103 putDebugChar(*str);
104 str++;
106 putDebugChar('\r');
107 return;
110 void
111 kgdb_interruptible(int enable)
115 void
116 kgdb_map_scc(void)
118 if (ppc_md.early_serial_map)
119 ppc_md.early_serial_map();
121 #endif /* CONFIG_KGDB */