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 | |
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')
-rw-r--r-- | arch/powerpc/Kconfig.debug | 21 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_32.S | 16 | ||||
-rw-r--r-- | arch/powerpc/kernel/udbg.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/8xx/Kconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/Kconfig | 4 | ||||
-rw-r--r-- | arch/powerpc/sysdev/Makefile | 1 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm_common.c | 46 |
7 files changed, 91 insertions, 0 deletions
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug index c38bc2237057..f4e5d22312a0 100644 --- a/arch/powerpc/Kconfig.debug +++ b/arch/powerpc/Kconfig.debug | |||
@@ -221,6 +221,15 @@ config PPC_EARLY_DEBUG_44x | |||
221 | Select this to enable early debugging for IBM 44x chips via the | 221 | Select this to enable early debugging for IBM 44x chips via the |
222 | inbuilt serial port. | 222 | inbuilt serial port. |
223 | 223 | ||
224 | config PPC_EARLY_DEBUG_CPM | ||
225 | bool "Early serial debugging for Freescale CPM-based serial ports" | ||
226 | depends on SERIAL_CPM | ||
227 | select PIN_TLB if PPC_8xx | ||
228 | help | ||
229 | Select this to enable early debugging for Freescale chips | ||
230 | using a CPM-based serial port. This assumes that the bootwrapper | ||
231 | has run, and set up the CPM in a particular way. | ||
232 | |||
224 | endchoice | 233 | endchoice |
225 | 234 | ||
226 | config PPC_EARLY_DEBUG_44x_PHYSLOW | 235 | config PPC_EARLY_DEBUG_44x_PHYSLOW |
@@ -233,4 +242,16 @@ config PPC_EARLY_DEBUG_44x_PHYSHIGH | |||
233 | depends PPC_EARLY_DEBUG_44x | 242 | depends PPC_EARLY_DEBUG_44x |
234 | default "0x1" | 243 | default "0x1" |
235 | 244 | ||
245 | config PPC_EARLY_DEBUG_CPM_ADDR | ||
246 | hex "CPM UART early debug transmit descriptor address" | ||
247 | depends on PPC_EARLY_DEBUG_CPM | ||
248 | default "0xfa202808" if PPC_EP88XC | ||
249 | default "0xf0000808" if CPM2 | ||
250 | default "0xff002808" if CPM1 | ||
251 | help | ||
252 | This specifies the address of the transmit descriptor | ||
253 | used for early debug output. Because it is needed before | ||
254 | platform probing is done, all platforms selected must | ||
255 | share the same address. | ||
256 | |||
236 | endmenu | 257 | endmenu |
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S index c86c626cf156..d83f04e5a599 100644 --- a/arch/powerpc/kernel/head_32.S +++ b/arch/powerpc/kernel/head_32.S | |||
@@ -149,6 +149,9 @@ __after_mmu_off: | |||
149 | #if defined(CONFIG_BOOTX_TEXT) | 149 | #if defined(CONFIG_BOOTX_TEXT) |
150 | bl setup_disp_bat | 150 | bl setup_disp_bat |
151 | #endif | 151 | #endif |
152 | #ifdef CONFIG_PPC_EARLY_DEBUG_CPM | ||
153 | bl setup_cpm_bat | ||
154 | #endif | ||
152 | 155 | ||
153 | /* | 156 | /* |
154 | * Call setup_cpu for CPU 0 and initialize 6xx Idle | 157 | * Call setup_cpu for CPU 0 and initialize 6xx Idle |
@@ -1245,6 +1248,19 @@ setup_disp_bat: | |||
1245 | blr | 1248 | blr |
1246 | #endif /* CONFIG_BOOTX_TEXT */ | 1249 | #endif /* CONFIG_BOOTX_TEXT */ |
1247 | 1250 | ||
1251 | #ifdef CONFIG_PPC_EARLY_DEBUG_CPM | ||
1252 | setup_cpm_bat: | ||
1253 | lis r8, 0xf000 | ||
1254 | ori r8, r8, 0x002a | ||
1255 | mtspr SPRN_DBAT1L, r8 | ||
1256 | |||
1257 | lis r11, 0xf000 | ||
1258 | ori r11, r11, (BL_1M << 2) | 2 | ||
1259 | mtspr SPRN_DBAT1U, r11 | ||
1260 | |||
1261 | blr | ||
1262 | #endif | ||
1263 | |||
1248 | #ifdef CONFIG_8260 | 1264 | #ifdef CONFIG_8260 |
1249 | /* Jump into the system reset for the rom. | 1265 | /* Jump into the system reset for the rom. |
1250 | * We first disable the MMU, and then jump to the ROM reset address. | 1266 | * We first disable the MMU, and then jump to the ROM reset address. |
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c index 0f9b4eadfbcb..d723070c9a33 100644 --- a/arch/powerpc/kernel/udbg.c +++ b/arch/powerpc/kernel/udbg.c | |||
@@ -54,6 +54,8 @@ void __init udbg_early_init(void) | |||
54 | #elif defined(CONFIG_PPC_EARLY_DEBUG_44x) | 54 | #elif defined(CONFIG_PPC_EARLY_DEBUG_44x) |
55 | /* PPC44x debug */ | 55 | /* PPC44x debug */ |
56 | udbg_init_44x_as1(); | 56 | udbg_init_44x_as1(); |
57 | #elif defined(CONFIG_PPC_EARLY_DEBUG_CPM) | ||
58 | udbg_init_cpm(); | ||
57 | #endif | 59 | #endif |
58 | } | 60 | } |
59 | 61 | ||
diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig index 39bb8c5ebe70..8ecd01ad0de8 100644 --- a/arch/powerpc/platforms/8xx/Kconfig +++ b/arch/powerpc/platforms/8xx/Kconfig | |||
@@ -3,6 +3,7 @@ config FADS | |||
3 | 3 | ||
4 | config CPM1 | 4 | config CPM1 |
5 | bool | 5 | bool |
6 | select CPM | ||
6 | 7 | ||
7 | choice | 8 | choice |
8 | prompt "8xx Machine Type" | 9 | prompt "8xx Machine Type" |
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index 8a62ca533b30..cc6013ffc29a 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig | |||
@@ -273,6 +273,7 @@ config QUICC_ENGINE | |||
273 | config CPM2 | 273 | config CPM2 |
274 | bool | 274 | bool |
275 | default n | 275 | default n |
276 | select CPM | ||
276 | help | 277 | help |
277 | The CPM2 (Communications Processor Module) is a coprocessor on | 278 | The CPM2 (Communications Processor Module) is a coprocessor on |
278 | embedded CPUs made by Freescale. Selecting this option means that | 279 | embedded CPUs made by Freescale. Selecting this option means that |
@@ -309,4 +310,7 @@ config FSL_ULI1575 | |||
309 | Freescale reference boards. The boards all use the ULI in pretty | 310 | Freescale reference boards. The boards all use the ULI in pretty |
310 | much the same way. | 311 | much the same way. |
311 | 312 | ||
313 | config CPM | ||
314 | bool | ||
315 | |||
312 | endmenu | 316 | endmenu |
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 | ||