From 6c768ca746c341dd6acbb8b39f48acb48e964d83 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 29 Apr 2011 18:03:29 +0000 Subject: serial: push default_serial_console to drivers Rather than sticking arch/board/driver specific logic in the common serial code, push it all out to the respective drivers. The serial drivers declare these funcs weak so that boards can still override things with their own definition. Signed-off-by: Mike Frysinger CC: Heiko Schocher CC: Anatolij Gustschin CC: Tom Rix CC: Minkyu Kang CC: Craig Nauman CC: Prafulla Wadaskar CC: Mahavir Jain Tested-by: Minkyu Kang --- arch/powerpc/cpu/mpc512x/serial.c | 12 ++++++++++++ arch/powerpc/cpu/mpc5xxx/serial.c | 6 ++++++ arch/powerpc/cpu/mpc8xx/serial.c | 10 ++++++++++ 3 files changed, 28 insertions(+) (limited to 'arch/powerpc/cpu') diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c index cb5bbf0..558e4e2 100644 --- a/arch/powerpc/cpu/mpc512x/serial.c +++ b/arch/powerpc/cpu/mpc512x/serial.c @@ -30,6 +30,7 @@ */ #include +#include #include #include #include @@ -354,6 +355,17 @@ struct serial_device serial6_device = INIT_PSC_SERIAL_STRUCTURE(6, "psc6", "UART6"); #endif +__weak struct serial_device *default_serial_console(void) +{ +#if (CONFIG_PSC_CONSOLE == 3) + return &serial3_device; +#elif (CONFIG_PSC_CONSOLE == 6) + return &serial6_device; +#else +#error "invalid CONFIG_PSC_CONSOLE" +#endif +} + #else void serial_setbrg(void) diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c b/arch/powerpc/cpu/mpc5xxx/serial.c index 0127065..0e1a8ec 100644 --- a/arch/powerpc/cpu/mpc5xxx/serial.c +++ b/arch/powerpc/cpu/mpc5xxx/serial.c @@ -34,6 +34,7 @@ */ #include +#include #include #if defined (CONFIG_SERIAL_MULTI) @@ -348,6 +349,11 @@ struct serial_device serial0_device = serial0_puts, }; +__weak struct serial_device *default_serial_console(void) +{ + return &serial0_device; +} + struct serial_device serial1_device = { "serial1", diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c index 9514c66..21803f5 100644 --- a/arch/powerpc/cpu/mpc8xx/serial.c +++ b/arch/powerpc/cpu/mpc8xx/serial.c @@ -26,6 +26,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -673,6 +674,15 @@ struct serial_device serial_scc_device = #endif /* CONFIG_8xx_CONS_SCCx */ +__weak struct serial_device *default_serial_console(void) +{ +#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) + return &serial_smc_device; +#else + return &serial_scc_device; +#endif +} + #ifdef CONFIG_MODEM_SUPPORT void disable_putc(void) { -- cgit v1.1