diff options
Diffstat (limited to 'arch/ppc/syslib/mv64x60_dbg.c')
-rw-r--r-- | arch/ppc/syslib/mv64x60_dbg.c | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/arch/ppc/syslib/mv64x60_dbg.c b/arch/ppc/syslib/mv64x60_dbg.c new file mode 100644 index 000000000000..2927c7adf5e5 --- /dev/null +++ b/arch/ppc/syslib/mv64x60_dbg.c | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * arch/ppc/syslib/mv64x60_dbg.c | ||
3 | * | ||
4 | * KGDB and progress routines for the Marvell/Galileo MV64x60 (Discovery). | ||
5 | * | ||
6 | * Author: Mark A. Greer <mgreer@mvista.com> | ||
7 | * | ||
8 | * 2003 (c) MontaVista Software, Inc. This file is licensed under | ||
9 | * the terms of the GNU General Public License version 2. This program | ||
10 | * is licensed "as is" without any warranty of any kind, whether express | ||
11 | * or implied. | ||
12 | */ | ||
13 | |||
14 | /* | ||
15 | ***************************************************************************** | ||
16 | * | ||
17 | * Low-level MPSC/UART I/O routines | ||
18 | * | ||
19 | ***************************************************************************** | ||
20 | */ | ||
21 | |||
22 | |||
23 | #include <linux/config.h> | ||
24 | #include <linux/irq.h> | ||
25 | #include <asm/delay.h> | ||
26 | #include <asm/mv64x60.h> | ||
27 | |||
28 | |||
29 | #if defined(CONFIG_SERIAL_TEXT_DEBUG) | ||
30 | |||
31 | #define MPSC_CHR_1 0x000c | ||
32 | #define MPSC_CHR_2 0x0010 | ||
33 | |||
34 | static struct mv64x60_handle mv64x60_dbg_bh; | ||
35 | |||
36 | void | ||
37 | mv64x60_progress_init(u32 base) | ||
38 | { | ||
39 | mv64x60_dbg_bh.v_base = base; | ||
40 | return; | ||
41 | } | ||
42 | |||
43 | static void | ||
44 | mv64x60_polled_putc(int chan, char c) | ||
45 | { | ||
46 | u32 offset; | ||
47 | |||
48 | if (chan == 0) | ||
49 | offset = 0x8000; | ||
50 | else | ||
51 | offset = 0x9000; | ||
52 | |||
53 | mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_1, (u32)c); | ||
54 | mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_2, 0x200); | ||
55 | udelay(2000); | ||
56 | } | ||
57 | |||
58 | void | ||
59 | mv64x60_mpsc_progress(char *s, unsigned short hex) | ||
60 | { | ||
61 | volatile char c; | ||
62 | |||
63 | mv64x60_polled_putc(0, '\r'); | ||
64 | |||
65 | while ((c = *s++) != 0) | ||
66 | mv64x60_polled_putc(0, c); | ||
67 | |||
68 | mv64x60_polled_putc(0, '\n'); | ||
69 | mv64x60_polled_putc(0, '\r'); | ||
70 | |||
71 | return; | ||
72 | } | ||
73 | #endif /* CONFIG_SERIAL_TEXT_DEBUG */ | ||
74 | |||
75 | |||
76 | #if defined(CONFIG_KGDB) | ||
77 | |||
78 | #if defined(CONFIG_KGDB_TTYS0) | ||
79 | #define KGDB_PORT 0 | ||
80 | #elif defined(CONFIG_KGDB_TTYS1) | ||
81 | #define KGDB_PORT 1 | ||
82 | #else | ||
83 | #error "Invalid kgdb_tty port" | ||
84 | #endif | ||
85 | |||
86 | void | ||
87 | putDebugChar(unsigned char c) | ||
88 | { | ||
89 | mv64x60_polled_putc(KGDB_PORT, (char)c); | ||
90 | } | ||
91 | |||
92 | int | ||
93 | getDebugChar(void) | ||
94 | { | ||
95 | unsigned char c; | ||
96 | |||
97 | while (!mv64x60_polled_getc(KGDB_PORT, &c)); | ||
98 | return (int)c; | ||
99 | } | ||
100 | |||
101 | void | ||
102 | putDebugString(char* str) | ||
103 | { | ||
104 | while (*str != '\0') { | ||
105 | putDebugChar(*str); | ||
106 | str++; | ||
107 | } | ||
108 | putDebugChar('\r'); | ||
109 | return; | ||
110 | } | ||
111 | |||
112 | void | ||
113 | kgdb_interruptible(int enable) | ||
114 | { | ||
115 | } | ||
116 | |||
117 | void | ||
118 | kgdb_map_scc(void) | ||
119 | { | ||
120 | if (ppc_md.early_serial_map) | ||
121 | ppc_md.early_serial_map(); | ||
122 | } | ||
123 | #endif /* CONFIG_KGDB */ | ||