The early_printk EHCI debug driver can hang the system or cause unpredictable results because two separate APIs will attempt to write to the mapped PCI region. The safe route is to unregister the early USB console at the end of the core kernel init, which is before the PCI initialization. Later, after the USB initialization completes it is then possible to register the console against the usb debug device and receive the printk messages that were missed in the period between early printk availability and the USB console device. Signed-off-by: Jason Wessel <jason.wessel@xxxxxxxxxxxxx> --- arch/x86/kernel/early_printk.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c index e38c467..ef177d4 100644 --- a/arch/x86/kernel/early_printk.c +++ b/arch/x86/kernel/early_printk.c @@ -952,4 +952,26 @@ static int __init setup_early_printk(char *buf) return 0; } +#ifdef CONFIG_EARLY_PRINTK_DBGP +/* + * The early console must get unregistered prior to the ECHI + * controller getting reset else the debug device cannot be used until + * a subsequent EHCI reset, or the kernel hangs. + */ +static int __init usb_early_debug_cleanup(void) +{ + if (early_dbgp_console.index >= 0 && + early_dbgp_console.flags & CON_PRINTBUFFER) { + console_stop(early_console); + unregister_console(early_console); + early_dbgp_console.index = -1; + early_dbgp_console.flags = 0; + ehci_debug = NULL; + printk(KERN_INFO "Early USB console unregistered\n"); + } + return 0; +} +postcore_initcall(usb_early_debug_cleanup); +#endif /* CONFIG_EARLY_PRINTK_DBGP */ + early_param("earlyprintk", setup_early_printk); -- 1.6.3.rc0.1.gf800 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html