From patchwork Sat Sep 29 00:30:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 187935 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 1C61D2C00D0 for ; Sat, 29 Sep 2012 10:35:23 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 94E262811F; Sat, 29 Sep 2012 02:34:55 +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 OzmwUvztQKMe; Sat, 29 Sep 2012 02:34:55 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3072528193; Sat, 29 Sep 2012 02:32:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DC90228119 for ; Sat, 29 Sep 2012 02:31:55 +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 CYnxNfBVQEnk for ; Sat, 29 Sep 2012 02:31:55 +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.10]) by theia.denx.de (Postfix) with ESMTPS id ED4D52811A for ; Sat, 29 Sep 2012 02:31:40 +0200 (CEST) Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3XT9g04kb7z3hhcD; Sat, 29 Sep 2012 02:31:40 +0200 (CEST) X-Auth-Info: 8z/j3dXDmmHT2nsQX1tre5z3hp1u8Hw0FJkN0B4Dt6I= Received: from mashiro.lan (unknown [195.140.253.167]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3XT9g03CB3zbbmY; Sat, 29 Sep 2012 02:31:40 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Date: Sat, 29 Sep 2012 02:30:36 +0200 Message-Id: <1348878687-14194-20-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 Subject: [U-Boot] [PATCH 19/70] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI 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 Rework the emulation of serial console via JTAG from simple ad-hoc implementation of serial port routines to CONFIG_SERIAL_MULTI and enable CONFIG_SERIAL_MULTI unconditionally for blackfin. In order for the JTAG serial console to take precedence over all other serial ports available in system, implement override for default_serial_console call returning this JTAG serial console. This brings in a bit of a growth of size, but eventually will allow us to unconditionally enable CONFIG_SERIAL_MULTI throughout the whole U-Boot and maintain only one serial subsystem. Signed-off-by: Marek Vasut Cc: Marek Vasut Cc: Tom Rini Cc: Mike Frysinger --- arch/blackfin/cpu/jtag-console.c | 37 ++++++++++++++++++++++++++++++------- common/serial.c | 2 ++ include/configs/bfin_adi_common.h | 2 +- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/arch/blackfin/cpu/jtag-console.c b/arch/blackfin/cpu/jtag-console.c index a77358a..7cddb85 100644 --- a/arch/blackfin/cpu/jtag-console.c +++ b/arch/blackfin/cpu/jtag-console.c @@ -194,12 +194,35 @@ int drv_jtag_console_init(void) } #ifdef CONFIG_UART_CONSOLE_IS_JTAG +#include /* Since the JTAG is always available (at power on), allow it to fake a UART */ -void serial_set_baud(uint32_t baud) {} -void serial_setbrg(void) {} -int serial_init(void) { return 0; } -void serial_putc(const char c) __attribute__((alias("jtag_putc"))); -void serial_puts(const char *s) __attribute__((alias("jtag_puts"))); -int serial_tstc(void) __attribute__((alias("jtag_tstc"))); -int serial_getc(void) __attribute__((alias("jtag_getc"))); +void jtag_serial_setbrg(void) +{ +} + +int jtag_serial_init(void) +{ + return 0; +} + +static struct serial_device serial_jtag_drv = { + .name = "jtag", + .start = jtag_serial_init, + .stop = NULL, + .setbrg = jtag_serial_setbrg, + .putc = jtag_putc, + .puts = jtag_puts, + .tstc = jtag_tstc, + .getc = jtag_getc, +}; + +void bfin_jtag_initialize(void) +{ + serial_register(&serial_jtag_drv); +} + +struct serial_device *default_serial_console(void) +{ + return &serial_jtag_drv; +} #endif diff --git a/common/serial.c b/common/serial.c index 0a43c1b..25aeea0 100644 --- a/common/serial.c +++ b/common/serial.c @@ -46,6 +46,7 @@ serial_initfunc(pxa_serial_initialize); serial_initfunc(s3c24xx_serial_initialize); serial_initfunc(s5p_serial_initialize); serial_initfunc(bfin_serial_initialize); +serial_initfunc(bfin_jtag_initialize); serial_initfunc(mpc512x_serial_initialize); serial_initfunc(uartlite_serial_initialize); @@ -73,6 +74,7 @@ void serial_initialize(void) s5p_serial_initialize(); mpc512x_serial_initialize(); bfin_serial_initialize(); + bfin_jtag_initialize(); uartlite_serial_initialize(); serial_assign(default_serial_console()->name); } diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h index 3fbf5c6..7132f8f 100644 --- a/include/configs/bfin_adi_common.h +++ b/include/configs/bfin_adi_common.h @@ -108,11 +108,11 @@ #define CONFIG_LOADS_ECHO 1 #define CONFIG_JTAG_CONSOLE #define CONFIG_SILENT_CONSOLE +#define CONFIG_SERIAL_MULTI #ifndef CONFIG_BAUDRATE # define CONFIG_BAUDRATE 57600 #endif #ifndef CONFIG_DEBUG_EARLY_SERIAL -# define CONFIG_SERIAL_MULTI # define CONFIG_SYS_BFIN_UART #endif