From patchwork Tue Jun 28 07:22:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 9202143 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CE6946074E for ; Tue, 28 Jun 2016 07:23:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B848C285E6 for ; Tue, 28 Jun 2016 07:23:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACD83285F3; Tue, 28 Jun 2016 07:23:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CF1F285F2 for ; Tue, 28 Jun 2016 07:23:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750836AbcF1HXD (ORCPT ); Tue, 28 Jun 2016 03:23:03 -0400 Received: from mail2.asahi-net.or.jp ([202.224.39.198]:38724 "EHLO mail2.asahi-net.or.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750704AbcF1HXC (ORCPT ); Tue, 28 Jun 2016 03:23:02 -0400 Received: from sa76r4 (y081184.ppp.asahi-net.or.jp [118.243.81.184]) by mail2.asahi-net.or.jp (Postfix) with ESMTP id 4D69F6D13; Tue, 28 Jun 2016 16:23:00 +0900 (JST) Received: from localhost (localhost [127.0.0.1]) by sa76r4 (Postfix) with ESMTP id 49DE012D2A; Tue, 28 Jun 2016 16:23:00 +0900 (JST) X-Virus-Scanned: Debian amavisd-new at sa76r4.localdomain Received: from sa76r4 ([127.0.0.1]) by localhost (sa76r4.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 19s17MPJejo5; Tue, 28 Jun 2016 16:23:00 +0900 (JST) Received: by sa76r4 (Postfix, from userid 1000) id 34CE812D2C; Tue, 28 Jun 2016 16:23:00 +0900 (JST) From: Yoshinori Sato To: linux-sh@vger.kernel.org, linux-renesas-soc@vger.kernel.org Cc: Yoshinori Sato Subject: [PATCH] sh-sci: Separate sci_port on earlycon Date: Tue, 28 Jun 2016 16:22:58 +0900 Message-Id: <1467098578-10364-1-git-send-email-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.7.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP sci0 and earlycon use same sci_port. So earlycon dead after sci0 initialize. This fix assign separate sci_port for earlycon. Signed-off-by: Yoshinori Sato --- drivers/tty/serial/sh-sci.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 5a73620..210c95e 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -146,6 +146,8 @@ struct sci_port { #define SCI_NPORTS CONFIG_SERIAL_SH_SCI_NR_UARTS static struct sci_port sci_ports[SCI_NPORTS]; +#define EARLY_INDEX 256 +static struct sci_port earlycon_port; static struct uart_driver sci_uart_driver; static inline struct sci_port * @@ -2510,7 +2512,6 @@ static int sci_init_single(struct platform_device *dev, int ret; sci_port->cfg = p; - port->ops = &sci_uart_ops; port->iotype = UPIO_MEM; port->line = index; @@ -2668,12 +2669,16 @@ static void serial_console_putchar(struct uart_port *port, int ch) static void serial_console_write(struct console *co, const char *s, unsigned count) { - struct sci_port *sci_port = &sci_ports[co->index]; - struct uart_port *port = &sci_port->port; + struct sci_port *sci_port; + struct uart_port *port; unsigned short bits, ctrl, ctrl_temp; unsigned long flags; int locked = 1; + sci_port = (co->index != EARLY_INDEX) ? + &sci_ports[co->index] : &earlycon_port; + port = &sci_port->port; + local_irq_save(flags); #if defined(SUPPORT_SYSRQ) if (port->sysrq) @@ -3036,13 +3041,14 @@ static int __init early_console_setup(struct earlycon_device *device, device->port.serial_in = sci_serial_in; device->port.serial_out = sci_serial_out; device->port.type = type; - memcpy(&sci_ports[0].port, &device->port, sizeof(struct uart_port)); - sci_ports[0].cfg = &port_cfg; - sci_ports[0].cfg->type = type; - sci_probe_regmap(sci_ports[0].cfg); - port_cfg.scscr = sci_serial_in(&sci_ports[0].port, SCSCR) | + device->con->index = EARLY_INDEX; + memcpy(&earlycon_port.port, &device->port, sizeof(struct uart_port)); + earlycon_port.cfg = &port_cfg; + earlycon_port.cfg->type = type; + sci_probe_regmap(earlycon_port.cfg); + port_cfg.scscr = sci_serial_in(&earlycon_port.port, SCSCR) | SCSCR_RE | SCSCR_TE; - sci_serial_out(&sci_ports[0].port, SCSCR, port_cfg.scscr); + sci_serial_out(&earlycon_port.port, SCSCR, port_cfg.scscr); device->con->write = serial_console_write; return 0;