From patchwork Tue Jun 19 04:54:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 10473143 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 0F8CE60230 for ; Tue, 19 Jun 2018 04:55:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2D2128C05 for ; Tue, 19 Jun 2018 04:55:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E75B628C14; Tue, 19 Jun 2018 04:55:33 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 960EA28C05 for ; Tue, 19 Jun 2018 04:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=TdB/ltNqA756+mLwqf5tGegs2vD191Ko/e5+TjlEg0U=; b=FNi 9DwhzE1S9kBVpKIa8NzAs5QIW++wKGnkCOT2ZdRmsqTGyGEFiYWKqPXoH90l+cQ4JNaPKsIniFRQe e+55T7jzESTRLFZtDx5ZW7tLkgoXlH+B7YfpAmt22iSO4qL8mSS5Rmf8wDLkFMtDlgH1XNu/lXL0b 48ovusJaLmgLrm06KLXAZ6W5GPh7dR6QzYbsecsaduDY//paJC5KsgRl4BdulDGJqL03Ur0VGQh76 6y6lMJt0iHwACpdlNWFEkitWNzmS50MaiNeF+jJxN1lXtb7WXNLSJIzTbabm5dsUOdKcaSvGGOpck g+colGZudmIoapZlyyOlebheCbsGTYQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fV8fu-0001Pr-Pr; Tue, 19 Jun 2018 04:55:26 +0000 Received: from bh-25.webhostbox.net ([208.91.199.152]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fV8fr-00008E-S1 for linux-arm-kernel@lists.infradead.org; Tue, 19 Jun 2018 04:55:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ydtPFiCSjbtnpCqtIM6tg8r1MWp5rp7POmlT0HoEEwA=; b=tWoOwCNfLywrri6YLM5VyZCDQS be4gZuRuGjtFtExXQwT4keKrpCcaWR+hRWNGc7HKRoUWNJMRVFqwEZyxcVk8wD3JDWMU4Ku57K1ZP azoddPQ1xXFnxrlSq+vNzNoSGvoaxpiF10/qpAlmCqaqKNpsJNDkWLAgHZcPEN6yOWg9CHUQLi2x6 GIVHo+Rn7/NWanqsk7GVd4o7RKCyYwr40XauCFzO1o84GGuHc6HSrUsqHA2zwpUDD/nvQNAEtY1It C9/e+pvrogGMVk1dKqIh9s2Ijs0WV4ll4+Xhw0YuK3efOMqXiMmiB7haMYBvlsRx3xz6mBNEGExnC F6uK6MGA==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:41150 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.89) (envelope-from ) id 1fV8fS-00HVQ6-UV; Tue, 19 Jun 2018 04:54:59 +0000 From: Guenter Roeck To: Greg Kroah-Hartman Subject: [PATCH] serial: mps2-uart: Initialize early console Date: Mon, 18 Jun 2018 21:54:57 -0700 Message-Id: <1529384097-1631-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180618_215523_965549_BB391F0D X-CRM114-Status: UNSURE ( 6.68 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladimir Murzin , Sudeep Holla , Liviu Dudau , linux-kernel@vger.kernel.org, Lorenzo Pieralisi , Guenter Roeck , linux-serial@vger.kernel.org, Jiri Slaby , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The early console code for mps2-uart assumes that the serial hardware is enabled for transmit when the system boots. However, this is not the case after reset. This results in a hang in mps2_early_putchar() if the serial transmitter is not enabled by a boot loader or ROM monitor. Signed-off-by: Guenter Roeck --- drivers/tty/serial/mps2-uart.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c index 9f8f63719126..0743a0551ce1 100644 --- a/drivers/tty/serial/mps2-uart.c +++ b/drivers/tty/serial/mps2-uart.c @@ -448,6 +448,14 @@ static struct console mps2_uart_console = { #define MPS2_SERIAL_CONSOLE (&mps2_uart_console) +static void mps2_early_init(struct uart_port *port) +{ + u8 control = readb(port->membase + UARTn_CTRL); + + control |= UARTn_CTRL_TX_ENABLE; + writeb(control, port->membase + UARTn_CTRL); +} + static void mps2_early_putchar(struct uart_port *port, int ch) { while (readb(port->membase + UARTn_STATE) & UARTn_STATE_TX_FULL) @@ -469,6 +477,7 @@ static int __init mps2_early_console_setup(struct earlycon_device *device, if (!device->port.membase) return -ENODEV; + mps2_early_init(&device->port); device->con->write = mps2_early_write; return 0;