From patchwork Sun Jan 8 18:17:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 640538 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78981C63797 for ; Sun, 8 Jan 2023 18:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233244AbjAHSSN (ORCPT ); Sun, 8 Jan 2023 13:18:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233668AbjAHSSH (ORCPT ); Sun, 8 Jan 2023 13:18:07 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FF941DA; Sun, 8 Jan 2023 10:18:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1673201876; bh=Ue64tR1L9y9zqhBq+z1LUgoa2umwcYX39u8aBNldhkU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=nsFplF0j940ChYwpMPhXePVg1LaweDnJIMNnDfU9HsB8m19+bh1+EUagej/6KV/vd bRCuavSg8gro4GbbRif9SvQ7ateVxCW3NFp8cY66oGIG/4BQmcECrJLCEEAAGgsjNm QmaF3APuUeoIxP5wrRr3QZudUlIOMlg0bnlZG8g6+gQ0sLieVddp9rm8+nMEyIMGoe ZvIy3nwf0idhL21DY/EUgES6V749Ok4mGjf7zN/S1FOBZuQZQSEa3ahIsIvSuUXgNE 6LYtMEeLihr6uGpBcDVY6G2JCo/eRhANTTK5WuzpIjurGEyM1ORr+BzUEHZfXmnzGl 0S8rsz9Uv57cA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Venus.speedport.ip ([84.162.7.17]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MD9XF-1p5Xpl358r-0099D8; Sun, 08 Jan 2023 19:17:56 +0100 From: Lino Sanfilippo To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux@armlinux.org.uk, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, l.sanfilippo@kunbus.com, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com, stable@vger.kernel.org Subject: [PATCH] serial: amba-pl011: fix high priority character transmission in rs486 mode Date: Sun, 8 Jan 2023 19:17:35 +0100 Message-Id: <20230108181735.10937-1-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:wjqYc8SNEaE4jlrIZG5Osc3vN+ELeRU7LHPoC3iLh6qm4AykcZ9 +Og6ZfK+ZBqkqoQma8XzayY5F0zgF7ozCrch7/q9NkLZD00c6Wram5zcGqMm+dTze4rH4n2 hSwSLg1i1l/9CODvtDOjlMXCSUgIxuXzQlmwh9gyL94Ul+1f3aVps+uCqZuR3M52o7k1t4k t6dlAGMdTCTm2NL4lbBig== UI-OutboundReport: notjunk:1;M01:P0:9bzYUfwnTaw=;4W8UX6PCPm3CIzddWsYVLzW937E QdBoQVS2ndbg57qNKGmG31AQFVnOR9yN1OFsrz+nXWyaVlD3uZUGMbaqklm/bJBnPCZXr3/nA SMwJNN6VFfJbMNpjG5M50DF7r8MrkZedWe5S6/1JvGrUNCY9TgNp2NQDNuIeHzoxXQ3MiISHu MxY1TxgqYtitfTNoJd/JiEInSpKfBZECrf9SJI99njtJ9DLytnSbCgx6ib19GjfLW2ZCmhrOa hlJq2tn/oOIDj6rR0J4z0sxNH7whv9QEXZOlxosTmC2bkjfup3yUpW3A7sZOuJ2r378RqAmDI sp93+jkmEQdEqztATVYVsgfU2NF4Rt1/ATnY2VbTJWWwjX+UXRpQ8jqdotrpvqjvAjRvkUhcG eEYIwoyO9ZRR2XJis58AeSxWj5dhGvnK5u4UbJ+qs21tL9x6z9/A133iLR9Myuo0HWc1pK1s8 HxYs+IVZ6DULM2wUj0L7sKbGYVHqopALdUeAxFXi/e7j1ehJ/T10eUd4uJJOat51bzwY1io4n guOZ42UHKkJHnjg4CiIsyD58snsgOttRZz/Aji2C7IZ1/pz1mNuuE+61zD3bhdJIKZ7Ho7gZB ogHXf5PoTb34oRI32uSuB6rtnR+ZcFSh6/91R9pRi02fqD4r1Utj4dkkV3u/zsQu0hZ+WJNSx NCJ7R5KENqySdQu26m8TQGyaBcAIUjNQ4TugGSsy6UoVJItQV3GUK/G0qS6Ag2Y0WrXRmkbb5 mOvZSIXrjK8RELMsGQ+u/1jytY0ONPewe3mvF3k9VHBlI1Muo1ozpk3xBvXm5mGdIb9AMXVcd cvWCblvZ6SU+P89+qr2qNiwQxN7BaXY8QbKiwK5Zs8KsygWU0i9Fv75KOc6No857FUdL5tJUH kILSWkkQ8TgshG8K8QA2qy3Omdx9OK8hNNoeXIUgycsK+y0tidr44aU5PY9ASuP+L4OaR6qbw w9TYWthZD8gI6r+E8HPVvaLJ3AI= Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Lino Sanfilippo In RS485 mode the transmission of a high priority character fails since it is written to the data register before the transmitter is enabled. Fix this in pl011_tx_chars() by enabling RS485 transmission before writing the character. Fixes: 8d479237727c ("serial: amba-pl011: add RS485 support") Cc: stable@vger.kernel.org Signed-off-by: Lino Sanfilippo --- drivers/tty/serial/amba-pl011.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) base-commit: 93928d485d9df12be724cbdf1caa7d197b65001e diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index d75c39f4622b..d8c2f3455eeb 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1466,6 +1466,10 @@ static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq) struct circ_buf *xmit = &uap->port.state->xmit; int count = uap->fifosize >> 1; + if ((uap->port.rs485.flags & SER_RS485_ENABLED) && + !uap->rs485_tx_started) + pl011_rs485_tx_start(uap); + if (uap->port.x_char) { if (!pl011_tx_char(uap, uap->port.x_char, from_irq)) return true; @@ -1477,10 +1481,6 @@ static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq) return false; } - if ((uap->port.rs485.flags & SER_RS485_ENABLED) && - !uap->rs485_tx_started) - pl011_rs485_tx_start(uap); - /* If we are using DMA mode, try to send some characters. */ if (pl011_dma_tx_irq(uap)) return true;