aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-12-20 23:39:26 -0500
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>2007-12-23 14:13:03 -0500
commit9dae8afdf212d39bc7c25f1b1ca9b10f10f6beaa (patch)
tree12721945adf3a3fc01ba292e1756af4826a7eed3
parent69c0785112921a43739495a68f459fde88a9bbd8 (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>
-rw-r--r--arch/powerpc/Kconfig.debug13
-rw-r--r--arch/powerpc/kernel/misc_32.S39
-rw-r--r--arch/powerpc/kernel/udbg.c3
-rw-r--r--arch/powerpc/kernel/udbg_16550.c33
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype1
-rw-r--r--include/asm-powerpc/udbg.h1
6 files changed, 90 insertions, 0 deletions
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index d20ccf5f2ca9..179a453f7e04 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -227,6 +227,14 @@ config PPC_EARLY_DEBUG_44x
227 Select this to enable early debugging for IBM 44x chips via the 227 Select this to enable early debugging for IBM 44x chips via the
228 inbuilt serial port. 228 inbuilt serial port.
229 229
230config PPC_EARLY_DEBUG_40x
231 bool "Early serial debugging for IBM/AMCC 40x CPUs"
232 depends on 40x
233 help
234 Select this to enable early debugging for IBM 40x chips via the
235 inbuilt serial port. This works on chips with a 16550 compatible
236 UART. Xilinx chips with uartlite cannot use this option.
237
230config PPC_EARLY_DEBUG_CPM 238config PPC_EARLY_DEBUG_CPM
231 bool "Early serial debugging for Freescale CPM-based serial ports" 239 bool "Early serial debugging for Freescale CPM-based serial ports"
232 depends on SERIAL_CPM 240 depends on SERIAL_CPM
@@ -248,6 +256,11 @@ config PPC_EARLY_DEBUG_44x_PHYSHIGH
248 depends on PPC_EARLY_DEBUG_44x 256 depends on PPC_EARLY_DEBUG_44x
249 default "0x1" 257 default "0x1"
250 258
259config PPC_EARLY_DEBUG_40x_PHYSADDR
260 hex "Early debug UART physical address"
261 depends on PPC_EARLY_DEBUG_40x
262 default "0xef600300"
263
251config PPC_EARLY_DEBUG_CPM_ADDR 264config PPC_EARLY_DEBUG_CPM_ADDR
252 hex "CPM UART early debug transmit descriptor address" 265 hex "CPM UART early debug transmit descriptor address"
253 depends on PPC_EARLY_DEBUG_CPM 266 depends on PPC_EARLY_DEBUG_CPM
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index ea1137851a4a..be09f0d2d90b 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -206,6 +206,45 @@ _GLOBAL(_nmask_and_or_msr)
206 isync 206 isync
207 blr /* Done */ 207 blr /* Done */
208 208
209#ifdef CONFIG_40x
210
211/*
212 * Do an IO access in real mode
213 */
214_GLOBAL(real_readb)
215 mfmsr r7
216 ori r0,r7,MSR_DR
217 xori r0,r0,MSR_DR
218 sync
219 mtmsr r0
220 sync
221 isync
222 lbz r3,0(r3)
223 sync
224 mtmsr r7
225 sync
226 isync
227 blr
228
229 /*
230 * Do an IO access in real mode
231 */
232_GLOBAL(real_writeb)
233 mfmsr r7
234 ori r0,r7,MSR_DR
235 xori r0,r0,MSR_DR
236 sync
237 mtmsr r0
238 sync
239 isync
240 stb r3,0(r4)
241 sync
242 mtmsr r7
243 sync
244 isync
245 blr
246
247#endif /* CONFIG_40x */
209 248
210/* 249/*
211 * Flush MMU TLB 250 * Flush MMU TLB
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index eba148f2a31c..7aad6203e411 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -54,6 +54,9 @@ 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_40x)
58 /* PPC40x debug */
59 udbg_init_40x_realmode();
57#elif defined(CONFIG_PPC_EARLY_DEBUG_CPM) 60#elif defined(CONFIG_PPC_EARLY_DEBUG_CPM)
58 udbg_init_cpm(); 61 udbg_init_cpm();
59#endif 62#endif
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
230static 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
241static 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
251void __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 */
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 99684ea606af..c3ee0b58d539 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -43,6 +43,7 @@ config 40x
43 bool "AMCC 40x" 43 bool "AMCC 40x"
44 select PPC_DCR_NATIVE 44 select PPC_DCR_NATIVE
45 select WANT_DEVICE_TREE 45 select WANT_DEVICE_TREE
46 select PPC_UDBG_16550
46 47
47config 44x 48config 44x
48 bool "AMCC 44x" 49 bool "AMCC 44x"
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h
index a9e0b0ebcb0f..6418ceea44b7 100644
--- a/include/asm-powerpc/udbg.h
+++ b/include/asm-powerpc/udbg.h
@@ -48,6 +48,7 @@ extern void __init udbg_init_rtas_console(void);
48extern void __init udbg_init_debug_beat(void); 48extern void __init udbg_init_debug_beat(void);
49extern void __init udbg_init_btext(void); 49extern void __init udbg_init_btext(void);
50extern void __init udbg_init_44x_as1(void); 50extern void __init udbg_init_44x_as1(void);
51extern void __init udbg_init_40x_realmode(void);
51extern void __init udbg_init_cpm(void); 52extern void __init udbg_init_cpm(void);
52 53
53#endif /* __KERNEL__ */ 54#endif /* __KERNEL__ */