diff mbox

[RESEND] powerpc: make udbg 16550 boot console configurable for EMBEDDED

Message ID 1230037894-26837-1-git-send-email-jacmet@sunsite.dk (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Peter Korsgaard Dec. 23, 2008, 1:11 p.m. UTC
The udbg console is currently always enabled for platforms selecting
the PPC_UDBG_16550 symbol (needed to create platform devices for
8250 SoC UARTs from DT).

Now, the udbg console is nice for debugging as it works so early, but
it also has a number of disadvantages:

- It doesn't respect console= and still outputs console messages even
  if console isn't ttySx (E.G. if CONFIG_SILENT_CONSOLE is enabled in
  U-Boot which sets 'console='
- It's slow (boot is ~0.3s slower on my mpc8347 platform compared to
  using the 8250 driver right away)
- It slightly bloats the kernel (pretty insignificant, around 1K)

As that isn't always desirable, add a PPC_UDBG_16550_CONSOLE kconfig
symbol to let the user disable it (only visible if CONFIG_EMBEDDED).

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 arch/powerpc/kernel/Makefile        |    3 ++-
 arch/powerpc/kernel/legacy_serial.c |    4 ++++
 arch/powerpc/platforms/Kconfig      |    7 +++++++
 3 files changed, 13 insertions(+), 1 deletions(-)

Comments

Scott Wood Dec. 23, 2008, 5:24 p.m. UTC | #1
Peter Korsgaard wrote:
> - It doesn't respect console= and still outputs console messages even
>   if console isn't ttySx (E.G. if CONFIG_SILENT_CONSOLE is enabled in
>   U-Boot which sets 'console='

I believe it uses /chosen/linux,stdout-path; u-boot could clear that if 
silent console is desired.

> As that isn't always desirable, add a PPC_UDBG_16550_CONSOLE kconfig
> symbol to let the user disable it (only visible if CONFIG_EMBEDDED).

There's an existing CONFIG_PPC_EARLY_DEBUG that it could depend on instead.

-Scott
Benjamin Herrenschmidt Dec. 23, 2008, 8:19 p.m. UTC | #2
On Tue, 2008-12-23 at 14:11 +0100, Peter Korsgaard wrote:
> The udbg console is currently always enabled for platforms selecting
> the PPC_UDBG_16550 symbol (needed to create platform devices for
> 8250 SoC UARTs from DT).
> 
> Now, the udbg console is nice for debugging as it works so early, but
> it also has a number of disadvantages:

 .../...

I don't think that's the right approach.

I think a better one is to make a config option that selects whether the
udbg console is registered. ie. CONFIG_UDBG_CONSOLE which would affect
the calls sites in setup_32/64.c or the register_udbg_console() function
itself in udbg.c

Ben.
diff mbox

Patch

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 92673b4..4651c0b 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -80,7 +80,8 @@  obj-$(CONFIG_MODULES)		+= ppc_ksyms.o
 obj-$(CONFIG_BOOTX_TEXT)	+= btext.o
 obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o
-obj-$(CONFIG_PPC_UDBG_16550)	+= legacy_serial.o udbg_16550.o
+obj-$(CONFIG_PPC_UDBG_16550)	+= legacy_serial.o
+obj-$(CONFIG_PPC_UDBG_16550_CONSOLE)	+= udbg_16550.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 
 pci64-$(CONFIG_PPC64)		+= pci_dn.o isa-bridge.o
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 9ddfaef..c0e9866 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -279,6 +279,7 @@  static int __init add_legacy_pci_port(struct device_node *np,
 }
 #endif
 
+#ifdef CONFIG_PPC_UDBG_16550_CONSOLE
 static void __init setup_legacy_serial_console(int console)
 {
 	struct legacy_serial_info *info =
@@ -295,6 +296,9 @@  static void __init setup_legacy_serial_console(int console)
 	DBG("default console speed = %d\n", info->speed);
 	udbg_init_uart(addr, info->speed, info->clock);
 }
+#else
+#define setup_legacy_serial_console(console)	do { } while (0)
+#endif
 
 /*
  * This is called very early, as part of setup_system() or eventually
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 47e956c..bc3ce47 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -312,4 +312,11 @@  config MPC8xxx_GPIO
 	  Say Y here if you're going to use hardware that connects to the
 	  MPC831x/834x/837x/8572/8610 GPIOs.
 
+config PPC_UDBG_16550_CONSOLE
+	bool "Boot console on 16550 UDBG" if EMBEDDED
+	depends on PPC_UDBG_16550
+	default y
+	help
+	  Say Y here to use the UDBG infrastructure for early boot messages.
+
 endmenu