From patchwork Sat Sep 29 00:30:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 187950 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5B5A52C00D0 for ; Sat, 29 Sep 2012 10:38:13 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 62711281CB; Sat, 29 Sep 2012 02:38:00 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mAyDqECZGEEv; Sat, 29 Sep 2012 02:38:00 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E7D99281CC; Sat, 29 Sep 2012 02:35:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 562EB28113 for ; Sat, 29 Sep 2012 02:32:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7oRQMvaUQuYZ for ; Sat, 29 Sep 2012 02:32:12 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by theia.denx.de (Postfix) with ESMTPS id 63FD52812A for ; Sat, 29 Sep 2012 02:31:46 +0200 (CEST) Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3XT9g60ldxz4KK7X; Sat, 29 Sep 2012 02:31:46 +0200 (CEST) X-Auth-Info: oz+KTCFz8iEAezLMh9FlMvjbLUEp+UhETfDBzmgcPOc= Received: from mashiro.lan (unknown [195.140.253.167]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3XT9g565Yrzbbh2; Sat, 29 Sep 2012 02:31:45 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Date: Sat, 29 Sep 2012 02:30:54 +0200 Message-Id: <1348878687-14194-38-git-send-email-marex@denx.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1348878687-14194-1-git-send-email-marex@denx.de> References: <1347837696-3192-1-git-send-email-marex@denx.de> <1348878687-14194-1-git-send-email-marex@denx.de> Cc: Marek Vasut , Tom Rini , Stefan Roese Subject: [U-Boot] [PATCH 37/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole serial driver X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Implement support for CONFIG_SERIAL_MULTI into sconsole serial driver. This driver was so far only usable directly, but this patch also adds support for the multi method. This allows using more than one serial driver alongside the sconsole driver. Also, add a weak implementation of default_serial_console() returning this driver. Signed-off-by: Marek Vasut Cc: Marek Vasut Cc: Tom Rini Cc: Anatolij Gustschin Cc: Stefan Roese --- board/pcippc2/sconsole.c | 66 +++++++++++++++++++++++++++++++++++++++++----- common/serial.c | 2 ++ 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/board/pcippc2/sconsole.c b/board/pcippc2/sconsole.c index 6ef38f4..0a31963 100644 --- a/board/pcippc2/sconsole.c +++ b/board/pcippc2/sconsole.c @@ -23,6 +23,8 @@ #include #include +#include +#include #include "sconsole.h" @@ -34,7 +36,7 @@ int (*sconsole_getc) (void) = 0; int (*sconsole_tstc) (void) = 0; void (*sconsole_setbrg) (void) = 0; -int serial_init (void) +static int sconsole_serial_init(void) { sconsole_buffer_t *sb = SCONSOLE_BUFFER; @@ -46,7 +48,7 @@ int serial_init (void) return (0); } -void serial_putc (char c) +static void sconsole_serial_putc(char c) { if (sconsole_putc) { (*sconsole_putc) (c); @@ -65,7 +67,7 @@ void serial_putc (char c) } } -void serial_puts (const char *s) +static void sconsole_serial_puts(const char *s) { if (sconsole_puts) { (*sconsole_puts) (s); @@ -84,7 +86,7 @@ void serial_puts (const char *s) } } -int serial_getc (void) +static int sconsole_serial_getc(void) { if (sconsole_getc) { return (*sconsole_getc) (); @@ -93,7 +95,7 @@ int serial_getc (void) } } -int serial_tstc (void) +static int sconsole_serial_tstc(void) { if (sconsole_tstc) { return (*sconsole_tstc) (); @@ -102,7 +104,7 @@ int serial_tstc (void) } } -void serial_setbrg (void) +static void sconsole_serial_setbrg(void) { if (sconsole_setbrg) { (*sconsole_setbrg) (); @@ -113,6 +115,58 @@ void serial_setbrg (void) } } +#ifdef CONFIG_SERIAL_MULTI +static struct serial_device sconsole_serial_drv = { + .name = "sconsole_serial", + .start = sconsole_serial_init, + .stop = NULL, + .setbrg = sconsole_serial_setbrg, + .putc = sconsole_serial_putc, + .puts = sconsole_serial_puts, + .getc = sconsole_serial_getc, + .tstc = sconsole_serial_tstc, +}; + +void sconsole_serial_initialize(void) +{ + serial_register(&sconsole_serial_drv); +} + +__weak struct serial_device *default_serial_console(void) +{ + return &sconsole_serial_drv; +} +#else +int serial_init(void) +{ + return sconsole_serial_init(); +} + +void serial_setbrg(void) +{ + sconsole_serial_setbrg(); +} + +void serial_putc(const char c) +{ + sconsole_serial_putc(c); +} + +void serial_puts(const char *s) +{ + sconsole_serial_puts(s); +} + +int serial_getc(void) +{ + return sconsole_serial_getc(); +} + +int serial_tstc(void) +{ + return sconsole_serial_tstc(); +} +#endif int sconsole_get_baudrate (void) { sconsole_buffer_t *sb = SCONSOLE_BUFFER; diff --git a/common/serial.c b/common/serial.c index 393e296..d9cd3bf 100644 --- a/common/serial.c +++ b/common/serial.c @@ -67,6 +67,7 @@ serial_initfunc(cogent_serial_initialize); serial_initfunc(cpci750_serial_initialize); serial_initfunc(evb64260_serial_initialize); serial_initfunc(ml2_serial_initialize); +serial_initfunc(sconsole_serial_initialize); void serial_register(struct serial_device *dev) { @@ -112,6 +113,7 @@ void serial_initialize(void) cpci750_serial_initialize(); evb64260_serial_initialize(); ml2_serial_initialize(); + sconsole_serial_initialize(); serial_assign(default_serial_console()->name); }