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: 40533 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1806818wrt; Sun, 8 Jan 2023 10:27:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXtw8si6rCU6LX2MlXsYrOlfgUp3VqdNhUZXyz12WzSljrfnF3Nn6aTI+lSHUttpdRwdOCFK X-Received: by 2002:a05:6402:2072:b0:487:6d4a:444c with SMTP id bd18-20020a056402207200b004876d4a444cmr34901008edb.28.1673202446629; Sun, 08 Jan 2023 10:27:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673202446; cv=none; d=google.com; s=arc-20160816; b=PYHI3KHPf6lPNJmq6CPjDUyYtN9M4os7JTSqsCjYwFlEh+R8roUe3gXwbNGGHPaqRx 5f85tjBiPzCgRx0LEEgOn2t3a7KUqjC2+Sr4EFrb8k2Vn1Ml1RASWjKfMO3Qhf89lSI/ POGIWBETXJD7wYpwEXshHpx3jKpTKv8ayKF79JdsQv1hOzVs8HAMR2aNyGG4aRQvaRjD Wzopo5M4zIHhurBny1aX0EUnqjTjvyLgixrqcFgwnt3G6bq3AK7xg/tx9+L/JOI2CvTu frcR/HYVnQzZ/qotuoOFeOOMtPNDBIZn/5wA4gj90IKN04mJbAMiJfNYgdIHWzFEqvDG RIrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Ue64tR1L9y9zqhBq+z1LUgoa2umwcYX39u8aBNldhkU=; b=Yh1or9ZHZuqELFbI8F1YZp/FKD0IdUjJDQWrBo5D4jH3iurtcV0ybWYupvZotrNutT JuSGugxxsIj6ka32eNPDD2yOyN0EDVoRxZSdHCwkxsHk4/1drWQoaGTSzlVgXQw22sun BkoKtWuy8JX0mlhlDcG4+WCjefXj3LyhS4chUBHUN0U2pJJsN7Ngp76tJ0wjoPScxzA0 UeZXiaeqECuTpVhSTvHTUsMqCrxvMf/9YZjaz/Zg6s+7NBb3FQjDvhmAV4bXEd0HUlRl mbKEOQLlSOZSKKufiVQKGQ6mLPztXcCM17BuyyKcJDo4YIL7rzOvsHej5Uz6g4aNRrll Q2Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=nsFplF0j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b11-20020a056402084b00b0046bc9cbd8f0si8633609edz.504.2023.01.08.10.27.03; Sun, 08 Jan 2023 10:27:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=nsFplF0j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233071AbjAHSSQ (ORCPT + 99 others); Sun, 8 Jan 2023 13:18:16 -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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bKiwK5Zs8KsygWU0i9Fv75KOc6No857FUdL5tJUH kILSWkkQ8TgshG8K8QA2qy3Omdx9OK8hNNoeXIUgycsK+y0tidr44aU5PY9ASuP+L4OaR6qbw w9TYWthZD8gI6r+E8HPVvaLJ3AI= X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MIME_BASE64_TEXT, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754479928722668610?= X-GMAIL-MSGID: =?utf-8?q?1754479928722668610?= 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;