diff options
| author | Scott Wood <scottwood@freescale.com> | 2007-07-16 12:43:43 -0400 |
|---|---|---|
| committer | Kumar Gala <galak@kernel.crashing.org> | 2007-10-03 21:35:43 -0400 |
| commit | c374e00e17f1c10768d5af922a1ff33e43df2eb0 (patch) | |
| tree | fc6149e7f3b86bb202c475d4414a926c481761b8 /arch/powerpc/sysdev | |
| parent | e631ae3b164158fbf486fbed5adb597696c4f0e5 (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')
| -rw-r--r-- | arch/powerpc/sysdev/Makefile | 1 | ||||
| -rw-r--r-- | arch/powerpc/sysdev/cpm_common.c | 46 |
2 files changed, 47 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile index 592c17ea713d..52e93bca10ca 100644 --- a/arch/powerpc/sysdev/Makefile +++ b/arch/powerpc/sysdev/Makefile | |||
| @@ -31,6 +31,7 @@ endif | |||
| 31 | 31 | ||
| 32 | # Temporary hack until we have migrated to asm-powerpc | 32 | # Temporary hack until we have migrated to asm-powerpc |
| 33 | ifeq ($(ARCH),powerpc) | 33 | ifeq ($(ARCH),powerpc) |
| 34 | obj-$(CONFIG_CPM) += cpm_common.o | ||
| 34 | obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o | 35 | obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o |
| 35 | obj-$(CONFIG_8xx) += mpc8xx_pic.o commproc.o | 36 | obj-$(CONFIG_8xx) += mpc8xx_pic.o commproc.o |
| 36 | obj-$(CONFIG_UCODE_PATCH) += micropatch.o | 37 | obj-$(CONFIG_UCODE_PATCH) += micropatch.o |
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 | ||
| 20 | static u32 __iomem *cpm_udbg_txdesc = | ||
| 21 | (u32 __iomem __force *)CONFIG_PPC_EARLY_DEBUG_CPM_ADDR; | ||
| 22 | |||
| 23 | static 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 | |||
| 37 | void __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 | ||
