Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Benjamin Herrenschmidt and committed by
Josh Boyer
9dae8afd 69c07851

+90
+13
arch/powerpc/Kconfig.debug
··· 227 227 Select this to enable early debugging for IBM 44x chips via the 228 228 inbuilt serial port. 229 229 230 + config 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 + 230 238 config PPC_EARLY_DEBUG_CPM 231 239 bool "Early serial debugging for Freescale CPM-based serial ports" 232 240 depends on SERIAL_CPM ··· 255 247 hex "EPRN of early debug UART physical address" 256 248 depends on PPC_EARLY_DEBUG_44x 257 249 default "0x1" 250 + 251 + config PPC_EARLY_DEBUG_40x_PHYSADDR 252 + hex "Early debug UART physical address" 253 + depends on PPC_EARLY_DEBUG_40x 254 + default "0xef600300" 258 255 259 256 config PPC_EARLY_DEBUG_CPM_ADDR 260 257 hex "CPM UART early debug transmit descriptor address"
+39
arch/powerpc/kernel/misc_32.S
··· 206 206 isync 207 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 250 * Flush MMU TLB
+3
arch/powerpc/kernel/udbg.c
··· 54 54 #elif defined(CONFIG_PPC_EARLY_DEBUG_44x) 55 55 /* PPC44x debug */ 56 56 udbg_init_44x_as1(); 57 + #elif defined(CONFIG_PPC_EARLY_DEBUG_40x) 58 + /* PPC40x debug */ 59 + udbg_init_40x_realmode(); 57 60 #elif defined(CONFIG_PPC_EARLY_DEBUG_CPM) 58 61 udbg_init_cpm(); 59 62 #endif
+33
arch/powerpc/kernel/udbg_16550.c
··· 225 225 udbg_getc = udbg_44x_as1_getc; 226 226 } 227 227 #endif /* CONFIG_PPC_EARLY_DEBUG_44x */ 228 + 229 + #ifdef CONFIG_PPC_EARLY_DEBUG_40x 230 + static 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 + 241 + static 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 + 251 + void __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 */
+1
arch/powerpc/platforms/Kconfig.cputype
··· 43 43 bool "AMCC 40x" 44 44 select PPC_DCR_NATIVE 45 45 select WANT_DEVICE_TREE 46 + select PPC_UDBG_16550 46 47 47 48 config 44x 48 49 bool "AMCC 44x"
+1
include/asm-powerpc/udbg.h
··· 48 48 extern void __init udbg_init_debug_beat(void); 49 49 extern void __init udbg_init_btext(void); 50 50 extern void __init udbg_init_44x_as1(void); 51 + extern void __init udbg_init_40x_realmode(void); 51 52 extern void __init udbg_init_cpm(void); 52 53 53 54 #endif /* __KERNEL__ */