diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2007-12-20 23:39:26 -0500 |
---|---|---|
committer | Josh Boyer <jwboyer@linux.vnet.ibm.com> | 2007-12-23 14:13:03 -0500 |
commit | 9dae8afdf212d39bc7c25f1b1ca9b10f10f6beaa (patch) | |
tree | 12721945adf3a3fc01ba292e1756af4826a7eed3 /arch/powerpc/kernel/udbg_16550.c | |
parent | 69c0785112921a43739495a68f459fde88a9bbd8 (diff) |
[POWERPC] 4xx: Add early udbg support for 40x processors
This adds some basic real mode based early udbg support for 40x
in order to debug things more easily
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'arch/powerpc/kernel/udbg_16550.c')
-rw-r--r-- | arch/powerpc/kernel/udbg_16550.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c index df740eae77b8..cb01ebc59387 100644 --- a/arch/powerpc/kernel/udbg_16550.c +++ b/arch/powerpc/kernel/udbg_16550.c | |||
@@ -225,3 +225,36 @@ void __init udbg_init_44x_as1(void) | |||
225 | udbg_getc = udbg_44x_as1_getc; | 225 | udbg_getc = udbg_44x_as1_getc; |
226 | } | 226 | } |
227 | #endif /* CONFIG_PPC_EARLY_DEBUG_44x */ | 227 | #endif /* CONFIG_PPC_EARLY_DEBUG_44x */ |
228 | |||
229 | #ifdef CONFIG_PPC_EARLY_DEBUG_40x | ||
230 | static void udbg_40x_real_putc(char c) | ||
231 | { | ||
232 | if (udbg_comport) { | ||
233 | while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0) | ||
234 | /* wait for idle */; | ||
235 | real_writeb(c, &udbg_comport->thr); eieio(); | ||
236 | if (c == '\n') | ||
237 | udbg_40x_real_putc('\r'); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | static int udbg_40x_real_getc(void) | ||
242 | { | ||
243 | if (udbg_comport) { | ||
244 | while ((real_readb(&udbg_comport->lsr) & LSR_DR) == 0) | ||
245 | ; /* wait for char */ | ||
246 | return real_readb(&udbg_comport->rbr); | ||
247 | } | ||
248 | return -1; | ||
249 | } | ||
250 | |||
251 | void __init udbg_init_40x_realmode(void) | ||
252 | { | ||
253 | udbg_comport = (struct NS16550 __iomem *) | ||
254 | CONFIG_PPC_EARLY_DEBUG_40x_PHYSADDR; | ||
255 | |||
256 | udbg_putc = udbg_40x_real_putc; | ||
257 | udbg_getc = udbg_40x_real_getc; | ||
258 | udbg_getc_poll = NULL; | ||
259 | } | ||
260 | #endif /* CONFIG_PPC_EARLY_DEBUG_40x */ | ||