From patchwork Thu Nov 10 02:01:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: delisun X-Patchwork-Id: 17919 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp673724wru; Wed, 9 Nov 2022 18:04:34 -0800 (PST) X-Google-Smtp-Source: AMsMyM7J6NoX93KMoTb65wLPMMJETABfkNHnGRCVQh0oLicE5D+h8aBSXXuf+Ore2hn+Y2Nappod X-Received: by 2002:a17:906:9f20:b0:78d:946e:f65d with SMTP id fy32-20020a1709069f2000b0078d946ef65dmr2125114ejc.365.1668045874788; Wed, 09 Nov 2022 18:04:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668045874; cv=none; d=google.com; s=arc-20160816; b=zIA9iUi+2rBh1Kj7VYQS9+XLKkSd6V17DhfhMchs47MIeLE6w02eCVJ8MR2GdwdG+M SpZju8U/9ucSyFCkgpFsgrWfh0wt9hJh9MOfTS1cic8fKKHOSXTIhozNPprpkqPjHBcj by13J3h19Hzf0qltHDPEw1CU7PwFocDTpnGfzrl+qIKyWwwj5Vr2xV2MAjr6QTbg8tni C2LJeZxsHKrm/VYCXQhGQ/+AzFZgnTw9kUY7sGs90VyLK29yOSsZsbDAsRKdHmBEy8ls Jbxi+VZAFmMeC++QlQdzCvPs7QqnWDl2JwbWA3PjsN0KAPJWHPub6p0dOZ9jk/btqnqu X6zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=CYE+Zth+lAVjtEp6RafpnmEqDr10ae5n6+PFgKOiVHQ=; b=wUEKqFtN9FRSTvNNsjV8uROMwaZIc/FWNkPGRu4TmxKjAM+rvvmsBgMwEm4AAsK3En o4XVK2lbQVFywHYKmTF12vLLl6pc15hA7tj5dz396NmOjkOfMr9RzjSU9UdjrJOwFDRE ufUMQ1HfvuQPvbiQNXmzOZToprxz++GiiQp8B4RX1iKHYt/zTw8LHBf34ROOjtCpQMsz QwnXZ0p6dzpIVbnHO72d9BHyJDI4l5ECMpKUnjhNpiBlNFUoJXPX7YZHIBiOxLEl4EZC JJhKqWmk3cSuGcEAtR+yFlqftCdhq47A8bTdVnEBtziJqIohelufiEi1ydNVgBoZFrGQ zL+g== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a50d785000000b004592ebc28a9si18061621edi.59.2022.11.09.18.04.11; Wed, 09 Nov 2022 18:04:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232601AbiKJCDY (ORCPT + 99 others); Wed, 9 Nov 2022 21:03:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232326AbiKJCCa (ORCPT ); Wed, 9 Nov 2022 21:02:30 -0500 Received: from lucky1-03.263.net (lucky1-03.263.net [211.157.147.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACE13B844; Wed, 9 Nov 2022 18:01:16 -0800 (PST) Received: from localhost (unknown [192.168.167.13]) by lucky1-03.263.net (Postfix) with ESMTP id 8933615912C; Thu, 10 Nov 2022 10:01:13 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from localhost.localdomain (unknown [119.3.119.19]) by smtp.263.net (postfix) whith ESMTP id P9901T140387763083008S1668045671061901_; Thu, 10 Nov 2022 10:01:13 +0800 (CST) X-IP-DOMAINF: 1 X-RL-SENDER: delisun@pateo.com.cn X-SENDER: delisun@pateo.com.cn X-LOGIN-NAME: delisun@pateo.com.cn X-FST-TO: linux@armlinux.org.uk X-RCPT-COUNT: 6 X-LOCAL-RCPT-COUNT: 1 X-MUTI-DOMAIN-COUNT: 0 X-SENDER-IP: 119.3.119.19 X-ATTACHMENT-NUM: 0 X-UNIQUE-TAG: X-System-Flag: 0 From: delisun To: linux@armlinux.org.uk Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, delisun Subject: [PATCH] serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle. Date: Thu, 10 Nov 2022 10:01:08 +0800 Message-Id: <20221110020108.7700-1-delisun@pateo.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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?1749072871374602762?= X-GMAIL-MSGID: =?utf-8?q?1749072871374602762?= Clearing the RX FIFO will cause data loss. Copy the pl011_enabl_interrupts implementation, and remove the clear interrupt and FIFO part of the code. Fixes: 211565b10099 ("serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle") Signed-off-by: delisun Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/amba-pl011.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 5cdced39eafd..08034e5dcec0 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1828,8 +1828,17 @@ static void pl011_enable_interrupts(struct uart_amba_port *uap) static void pl011_unthrottle_rx(struct uart_port *port) { struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port); + unsigned long flags; - pl011_enable_interrupts(uap); + spin_lock_irqsave(&uap->port.lock, flags); + + uap->im = UART011_RTIM; + if (!pl011_dma_rx_running(uap)) + uap->im |= UART011_RXIM; + + pl011_write(uap->im, uap, REG_IMSC); + + spin_unlock_irqrestore(&uap->port.lock, flags); } static int pl011_startup(struct uart_port *port)