aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-05-07 22:59:31 -0400
committerPaul Mackerras <paulus@samba.org>2007-05-08 00:47:33 -0400
commitd9b55a03611ff2e2e54fb4e1ad2648d5eb870fa3 (patch)
tree5704be539afcd6f29b1f5751476c8b4f53673bff /arch/powerpc/kernel
parentf6dfc80554b27da11dbb36ebae166b23ec3aa9ca (diff)
[POWERPC] Early serial debug support for PPC44x
This adds support for early serial debugging via the built in port on IBM/AMCC PowerPC 44x CPUs. It uses a bolted TLB entry in address space 1 for the UART's mapping, allowing robust debugging both before and after the initialization of the MMU. Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/head_44x.S34
-rw-r--r--arch/powerpc/kernel/of_platform.c1
-rw-r--r--arch/powerpc/kernel/udbg.c3
-rw-r--r--arch/powerpc/kernel/udbg_16550.c23
4 files changed, 39 insertions, 22 deletions
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index a51026f0a9d7..88695963f587 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -172,36 +172,28 @@ skpinv: addi r4,r4,1 /* Increment */
172 isync 172 isync
173 173
1744: 1744:
175#ifdef CONFIG_SERIAL_TEXT_DEBUG 175#ifdef CONFIG_PPC_EARLY_DEBUG_44x
176 /* 176 /* Add UART mapping for early debug. */
177 * Add temporary UART mapping for early debug. 177
178 * We can map UART registers wherever we want as long as they don't
179 * interfere with other system mappings (e.g. with pinned entries).
180 * For an example of how we handle this - see ocotea.h. --ebs
181 */
182 /* pageid fields */ 178 /* pageid fields */
183 lis r3,UART0_IO_BASE@h 179 lis r3,PPC44x_EARLY_DEBUG_VIRTADDR@h
184 ori r3,r3,PPC44x_TLB_VALID | PPC44x_TLB_4K 180 ori r3,r3,PPC44x_TLB_VALID|PPC44x_TLB_TS|PPC44x_TLB_64K
185 181
186 /* xlat fields */ 182 /* xlat fields */
187 lis r4,UART0_PHYS_IO_BASE@h /* RPN depends on SoC */ 183 lis r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW@h
188#ifndef CONFIG_440EP 184 ori r4,r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH
189 ori r4,r4,0x0001 /* ERPN is 1 for second 4GB page */
190#endif
191 185
192 /* attrib fields */ 186 /* attrib fields */
193 li r5,0 187 li r5,(PPC44x_TLB_SW|PPC44x_TLB_SR|PPC44x_TLB_I|PPC44x_TLB_G)
194 ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_I | PPC44x_TLB_G) 188 li r0,62 /* TLB slot 0 */
195 189
196 li r0,0 /* TLB slot 0 */ 190 tlbwe r3,r0,PPC44x_TLB_PAGEID
197 191 tlbwe r4,r0,PPC44x_TLB_XLAT
198 tlbwe r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */ 192 tlbwe r5,r0,PPC44x_TLB_ATTRIB
199 tlbwe r4,r0,PPC44x_TLB_XLAT /* Load the translation fields */
200 tlbwe r5,r0,PPC44x_TLB_ATTRIB /* Load the attrib/access fields */
201 193
202 /* Force context change */ 194 /* Force context change */
203 isync 195 isync
204#endif /* CONFIG_SERIAL_TEXT_DEBUG */ 196#endif /* CONFIG_PPC_EARLY_DEBUG_44x */
205 197
206 /* Establish the interrupt vector offsets */ 198 /* Establish the interrupt vector offsets */
207 SET_IVOR(0, CriticalInput); 199 SET_IVOR(0, CriticalInput);
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 908ed7926db4..84c34d979a88 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -29,7 +29,6 @@
29#include <asm/ppc-pci.h> 29#include <asm/ppc-pci.h>
30#include <asm/atomic.h> 30#include <asm/atomic.h>
31 31
32
33/* 32/*
34 * The list of OF IDs below is used for matching bus types in the 33 * The list of OF IDs below is used for matching bus types in the
35 * system whose devices are to be exposed as of_platform_devices. 34 * system whose devices are to be exposed as of_platform_devices.
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 7e0971868fc2..7ef97ea8b3ef 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -51,6 +51,9 @@ void __init udbg_early_init(void)
51 udbg_init_pas_realmode(); 51 udbg_init_pas_realmode();
52#elif defined(CONFIG_BOOTX_TEXT) 52#elif defined(CONFIG_BOOTX_TEXT)
53 udbg_init_btext(); 53 udbg_init_btext();
54#elif defined(CONFIG_PPC_EARLY_DEBUG_44x)
55 /* PPC44x debug */
56 udbg_init_44x_as1();
54#endif 57#endif
55} 58}
56 59
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index a963f657222b..7afab5bcd61a 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -191,3 +191,26 @@ void udbg_init_pas_realmode(void)
191 udbg_getc_poll = NULL; 191 udbg_getc_poll = NULL;
192} 192}
193#endif /* CONFIG_PPC_MAPLE */ 193#endif /* CONFIG_PPC_MAPLE */
194
195#ifdef CONFIG_PPC_EARLY_DEBUG_44x
196#include <platforms/44x/44x.h>
197
198static void udbg_44x_as1_putc(char c)
199{
200 if (udbg_comport) {
201 while ((as1_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
202 /* wait for idle */;
203 as1_writeb(c, &udbg_comport->thr); eieio();
204 if (c == '\n')
205 udbg_44x_as1_putc('\r');
206 }
207}
208
209void __init udbg_init_44x_as1(void)
210{
211 udbg_comport =
212 (volatile struct NS16550 __iomem *)PPC44x_EARLY_DEBUG_VIRTADDR;
213
214 udbg_putc = udbg_44x_as1_putc;
215}
216#endif /* CONFIG_PPC_EARLY_DEBUG_44x */