diff options
Diffstat (limited to 'arch/powerpc/kernel/udbg_16550.c')
-rw-r--r-- | arch/powerpc/kernel/udbg_16550.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c index b4b167b33643..6837f839ab78 100644 --- a/arch/powerpc/kernel/udbg_16550.c +++ b/arch/powerpc/kernel/udbg_16550.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * udbg for NS16550 compatable serial ports | 2 | * udbg for NS16550 compatible serial ports |
3 | * | 3 | * |
4 | * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp | 4 | * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp |
5 | * | 5 | * |
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <asm/udbg.h> | 12 | #include <asm/udbg.h> |
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/reg_a2.h> | ||
14 | 15 | ||
15 | extern u8 real_readb(volatile u8 __iomem *addr); | 16 | extern u8 real_readb(volatile u8 __iomem *addr); |
16 | extern void real_writeb(u8 data, volatile u8 __iomem *addr); | 17 | extern void real_writeb(u8 data, volatile u8 __iomem *addr); |
@@ -298,3 +299,53 @@ void __init udbg_init_40x_realmode(void) | |||
298 | udbg_getc_poll = NULL; | 299 | udbg_getc_poll = NULL; |
299 | } | 300 | } |
300 | #endif /* CONFIG_PPC_EARLY_DEBUG_40x */ | 301 | #endif /* CONFIG_PPC_EARLY_DEBUG_40x */ |
302 | |||
303 | #ifdef CONFIG_PPC_EARLY_DEBUG_WSP | ||
304 | static void udbg_wsp_flush(void) | ||
305 | { | ||
306 | if (udbg_comport) { | ||
307 | while ((readb(&udbg_comport->lsr) & LSR_THRE) == 0) | ||
308 | /* wait for idle */; | ||
309 | } | ||
310 | } | ||
311 | |||
312 | static void udbg_wsp_putc(char c) | ||
313 | { | ||
314 | if (udbg_comport) { | ||
315 | if (c == '\n') | ||
316 | udbg_wsp_putc('\r'); | ||
317 | udbg_wsp_flush(); | ||
318 | writeb(c, &udbg_comport->thr); eieio(); | ||
319 | } | ||
320 | } | ||
321 | |||
322 | static int udbg_wsp_getc(void) | ||
323 | { | ||
324 | if (udbg_comport) { | ||
325 | while ((readb(&udbg_comport->lsr) & LSR_DR) == 0) | ||
326 | ; /* wait for char */ | ||
327 | return readb(&udbg_comport->rbr); | ||
328 | } | ||
329 | return -1; | ||
330 | } | ||
331 | |||
332 | static int udbg_wsp_getc_poll(void) | ||
333 | { | ||
334 | if (udbg_comport) | ||
335 | if (readb(&udbg_comport->lsr) & LSR_DR) | ||
336 | return readb(&udbg_comport->rbr); | ||
337 | return -1; | ||
338 | } | ||
339 | |||
340 | void __init udbg_init_wsp(void) | ||
341 | { | ||
342 | udbg_comport = (struct NS16550 __iomem *)WSP_UART_VIRT; | ||
343 | |||
344 | udbg_init_uart(udbg_comport, 57600, 50000000); | ||
345 | |||
346 | udbg_putc = udbg_wsp_putc; | ||
347 | udbg_flush = udbg_wsp_flush; | ||
348 | udbg_getc = udbg_wsp_getc; | ||
349 | udbg_getc_poll = udbg_wsp_getc_poll; | ||
350 | } | ||
351 | #endif /* CONFIG_PPC_EARLY_DEBUG_WSP */ | ||