From patchwork Wed Nov 9 10:58:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: delisun X-Patchwork-Id: 17495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp275669wru; Wed, 9 Nov 2022 03:19:12 -0800 (PST) X-Google-Smtp-Source: AMsMyM5MRwBTwfbaR6SJpoEr80/ZHt7U33lzcJBGsMoqaXm5za3SL6L39h9RYowWXtSqtyGARj/q X-Received: by 2002:a17:906:9b86:b0:73d:72cf:72af with SMTP id dd6-20020a1709069b8600b0073d72cf72afmr57516046ejc.440.1667992752518; Wed, 09 Nov 2022 03:19:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667992752; cv=none; d=google.com; s=arc-20160816; b=lpAy76sv8+SCs+YI1P74Yv9pjhaMK5C34mXwF2i7kvTKACPJ8v2aY1SI0WCoE4+m0S Q/ReAH1Rq4psb/aWbSHZmQ8j8GJxuJFRznaJbCSzTphJlvQii2t0mvrErAuPIRPgR9vg iTWXizthnH8qXnyu7blpZznHc8SaMjQ8AYWDUYkJymEB2UbfYZ0Jlejig5+MBbWh0NDz KTkVg8q234q07j5FUuFvzmpCp800z+ugAALfqsBfA/J4lvF3JNzHmagSfsvrgvK3QbdB woHlXv5Ig+Q+BKQtMb9amKLckC/9M4sAVahMJooPN4k2Y9jSQOWjMNi7RnBX4A68ONmY 6L9Q== 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=LfVlVSGo5YdJD6oWKx0eanonuwDIKDZ5z7YSupdcSzs=; b=u1I20hOdrg+yUAujobtQZWpjDYviyR1hYz0uG8RUTNuHahJMJtq1Ih137uLPMwgljl U90LhKP6bZ8qOH0Icr6OCnEEOzLmtIvjTGa+waWdg61EPns1/kvagAuN2n61Y2BXe/9f EKtrDJVE9eqDUw3aqDnL0R89xcx2/oZFCMt6j9Glkp+m6+yaowk8L9zu20T/e/Ek1ekH sJ3xKSNEculzRbGbD7DiYNrdZ8+7U2MorbipfdXj5Fp0zYstxXy8iatAPWtT3F0KUhhw 9Ha0/Rsz2O+I/dTRcR2cDbjxTVbdzuWw7b81fU9fi0UnczDnzeNPJ7TCX4KDIDxJoxrl cT9A== 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 dt20-20020a170907729400b0073d5a794b43si6101426ejc.985.2022.11.09.03.18.45; Wed, 09 Nov 2022 03:19:12 -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 S230038AbiKILR7 (ORCPT + 99 others); Wed, 9 Nov 2022 06:17:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230332AbiKILRx (ORCPT ); Wed, 9 Nov 2022 06:17:53 -0500 X-Greylist: delayed 1158 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 09 Nov 2022 03:17:48 PST Received: from lucky1-04.263.net (lucky1-04.263.net [211.157.147.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72C1E617B for ; Wed, 9 Nov 2022 03:17:48 -0800 (PST) Received: from localhost (unknown [192.168.167.223]) by lucky1-04.263.net (Postfix) with ESMTP id CFD14166D0F; Wed, 9 Nov 2022 18:58:26 +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.20]) by smtp.263.net (postfix) whith ESMTP id P17536T140519130769152S1667991504274586_; Wed, 09 Nov 2022 18:58:25 +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.20 X-ATTACHMENT-NUM: 0 X-UNIQUE-TAG: <13a35dee304f2a19198adf39974d83ee> 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: Wed, 9 Nov 2022 18:58:22 +0800 Message-Id: <20221109105822.332011-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, 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?1749017168435199362?= X-GMAIL-MSGID: =?utf-8?q?1749017168435199362?= 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. Signed-off-by: delisun --- 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)