From patchwork Wed Mar 15 15:29:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 9625931 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 8D5676048C for ; Wed, 15 Mar 2017 15:29:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FA2A285A1 for ; Wed, 15 Mar 2017 15:29:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 749812863E; Wed, 15 Mar 2017 15:29:39 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 1EEB3285A1 for ; Wed, 15 Mar 2017 15:29:39 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=4niLKKIpayT7enNoYScp5xvX2gLVLZSRpmp2w8br+uQ=; b=AR9JzS7dAHs6Tc HmocJeb4689k4elf0n4RxOyCCgHA7+8roKOmfxTtjdGJrurv8eNhg4t4mYskwtTDc5vRblf2afLtb AVzpnD4rAV87x3PntaXePgdDxLMG2+WHF9nQnv/GX7ZpBO6yo+hHGSUprLnmVmIZVFgiWYR1V6/sF 1lN2w0o4LaDsdMZy/zpKDt5fSqMcMeg+PIuXJxLpV7mgTX8r3JV3LoUparoTm6R+5CaZzASgzjVlP AXNpEh4/pU+YdwVFT4TH1yRQYKuQitxwlNpjA5NQdGcUkS6TbKJZ0WQ4NNanaoGbLdlYdaeyk9fFm OwUxv068QO24Wrt/yZGQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1coArl-000784-BF; Wed, 15 Mar 2017 15:29:33 +0000 Received: from esa1.microchip.iphmx.com ([68.232.147.91]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1coArh-000766-0h for linux-arm-kernel@lists.infradead.org; Wed, 15 Mar 2017 15:29:31 +0000 X-IronPort-AV: E=Sophos;i="5.36,169,1486450800"; d="scan'208";a="261386" Received: from exsmtp01.microchip.com (HELO email.microchip.com) ([198.175.253.37]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 15 Mar 2017 08:29:06 -0700 Received: from tenerife.corp.atmel.com (10.10.76.4) by CHN-SV-EXCH01.mchp-main.com (10.10.76.37) with Microsoft SMTP Server id 14.3.181.6; Wed, 15 Mar 2017 08:29:05 -0700 From: Nicolas Ferre To: Richard Genoud , Subject: [RFC PATCH] tty/serial: atmel: fix TX path in atmel_console_write() Date: Wed, 15 Mar 2017 16:29:48 +0100 Message-ID: <20170315152948.10978-1-nicolas.ferre@microchip.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170315_082929_074728_6AF90BA6 X-CRM114-Status: UNSURE ( 8.65 ) 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: "stable # 4 . 4+" , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 A side effect of 89d8232411a8 ("tty/serial: atmel_serial: BUG: stop DMA from transmitting in stop_tx") is that the console can be called with TX path disabled. Then the system would hang trying to push charecters out in atmel_console_putchar(). Signed-off-by: Nicolas Ferre Fixes: 89d8232411a8 ("tty/serial: atmel_serial: BUG: stop DMA from transmitting in stop_tx") Cc: stable # 4.4+ Acked-by: Richard Genoud --- Hi Richard, I found this to fix the problem with system hang in my linux-4.4-at91 branch (in the atmel_console_putchar() waiting loop actually). I'm open to more insignt. As we cannot figure out if this bit is set or not, I didn't preserve the current status... Regards, drivers/tty/serial/atmel_serial.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index dcebb28ffbc4..7372dbdb7a4c 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -2483,6 +2483,9 @@ static void atmel_console_write(struct console *co, const char *s, u_int count) pdc_tx = atmel_uart_readl(port, ATMEL_PDC_PTSR) & ATMEL_PDC_TXTEN; atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_TXTDIS); + /* Make sure that tx path is actually able to send characters */ + atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN); + uart_console_write(port, s, count, atmel_console_putchar); /*