aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/cpm_common.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2007-07-16 12:43:43 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-10-03 21:35:43 -0400
commitc374e00e17f1c10768d5af922a1ff33e43df2eb0 (patch)
treefc6149e7f3b86bb202c475d4414a926c481761b8 /arch/powerpc/sysdev/cpm_common.c
parente631ae3b164158fbf486fbed5adb597696c4f0e5 (diff)
[POWERPC] Add early debug console for CPM serial ports.
This code assumes that the ports have been previously set up, with buffers in DPRAM. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev/cpm_common.c')
-rw-r--r--arch/powerpc/sysdev/cpm_common.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
new file mode 100644
index 000000000000..9daa6ac67676
--- /dev/null
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -0,0 +1,46 @@
1/*
2 * Common CPM code
3 *
4 * Author: Scott Wood <scottwood@freescale.com>
5 *
6 * Copyright 2007 Freescale Semiconductor, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of version 2 of the GNU General Public License as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/init.h>
14#include <asm/udbg.h>
15#include <asm/io.h>
16#include <asm/system.h>
17#include <mm/mmu_decl.h>
18
19#ifdef CONFIG_PPC_EARLY_DEBUG_CPM
20static u32 __iomem *cpm_udbg_txdesc =
21 (u32 __iomem __force *)CONFIG_PPC_EARLY_DEBUG_CPM_ADDR;
22
23static void udbg_putc_cpm(char c)
24{
25 u8 __iomem *txbuf = (u8 __iomem __force *)in_be32(&cpm_udbg_txdesc[1]);
26
27 if (c == '\n')
28 udbg_putc('\r');
29
30 while (in_be32(&cpm_udbg_txdesc[0]) & 0x80000000)
31 ;
32
33 out_8(txbuf, c);
34 out_be32(&cpm_udbg_txdesc[0], 0xa0000001);
35}
36
37void __init udbg_init_cpm(void)
38{
39 if (cpm_udbg_txdesc) {
40#ifdef CONFIG_CPM2
41 setbat(1, 0xf0000000, 0xf0000000, 1024*1024, _PAGE_IO);
42#endif
43 udbg_putc = udbg_putc_cpm;
44 }
45}
46#endif