Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
1da177e4 LT |
2 | * KGDB and progress routines for the Marvell/Galileo MV64x60 (Discovery). |
3 | * | |
4 | * Author: Mark A. Greer <mgreer@mvista.com> | |
5 | * | |
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. | |
10 | */ | |
11 | ||
12 | /* | |
13 | ***************************************************************************** | |
14 | * | |
15 | * Low-level MPSC/UART I/O routines | |
16 | * | |
17 | ***************************************************************************** | |
18 | */ | |
19 | ||
20 | ||
21 | #include <linux/config.h> | |
22 | #include <linux/irq.h> | |
23 | #include <asm/delay.h> | |
24 | #include <asm/mv64x60.h> | |
fd582ec8 | 25 | #include <asm/machdep.h> |
1da177e4 LT |
26 | |
27 | ||
28 | #if defined(CONFIG_SERIAL_TEXT_DEBUG) | |
29 | ||
30 | #define MPSC_CHR_1 0x000c | |
31 | #define MPSC_CHR_2 0x0010 | |
32 | ||
33 | static struct mv64x60_handle mv64x60_dbg_bh; | |
34 | ||
35 | void | |
36 | mv64x60_progress_init(u32 base) | |
37 | { | |
38 | mv64x60_dbg_bh.v_base = base; | |
39 | return; | |
40 | } | |
41 | ||
42 | static void | |
43 | mv64x60_polled_putc(int chan, char c) | |
44 | { | |
45 | u32 offset; | |
46 | ||
47 | if (chan == 0) | |
48 | offset = 0x8000; | |
49 | else | |
50 | offset = 0x9000; | |
51 | ||
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); | |
55 | } | |
56 | ||
57 | void | |
58 | mv64x60_mpsc_progress(char *s, unsigned short hex) | |
59 | { | |
60 | volatile char c; | |
61 | ||
62 | mv64x60_polled_putc(0, '\r'); | |
63 | ||
64 | while ((c = *s++) != 0) | |
65 | mv64x60_polled_putc(0, c); | |
66 | ||
67 | mv64x60_polled_putc(0, '\n'); | |
68 | mv64x60_polled_putc(0, '\r'); | |
69 | ||
70 | return; | |
71 | } | |
72 | #endif /* CONFIG_SERIAL_TEXT_DEBUG */ | |
73 | ||
74 | ||
75 | #if defined(CONFIG_KGDB) | |
76 | ||
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 | |
84 | ||
85 | void | |
86 | putDebugChar(unsigned char c) | |
87 | { | |
88 | mv64x60_polled_putc(KGDB_PORT, (char)c); | |
89 | } | |
90 | ||
91 | int | |
92 | getDebugChar(void) | |
93 | { | |
94 | unsigned char c; | |
95 | ||
96 | while (!mv64x60_polled_getc(KGDB_PORT, &c)); | |
97 | return (int)c; | |
98 | } | |
99 | ||
100 | void | |
101 | putDebugString(char* str) | |
102 | { | |
103 | while (*str != '\0') { | |
104 | putDebugChar(*str); | |
105 | str++; | |
106 | } | |
107 | putDebugChar('\r'); | |
108 | return; | |
109 | } | |
110 | ||
111 | void | |
112 | kgdb_interruptible(int enable) | |
113 | { | |
114 | } | |
115 | ||
116 | void | |
117 | kgdb_map_scc(void) | |
118 | { | |
119 | if (ppc_md.early_serial_map) | |
120 | ppc_md.early_serial_map(); | |
121 | } | |
122 | #endif /* CONFIG_KGDB */ |