Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1706177pxb; Thu, 16 Sep 2021 13:30:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaDeOVJnaPUv5EONb8/YEYa2xuxe7itR7YFThYq7dLv46ZV1QpbXpRES8pck+XfveywsfG X-Received: by 2002:a17:906:dbf8:: with SMTP id yd24mr8447791ejb.560.1631824216385; Thu, 16 Sep 2021 13:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631824216; cv=none; d=google.com; s=arc-20160816; b=W9kbFNXunDtm7ZsbpLCRCG8XuMHsdINyvZ74C9ElFQUtqSnMsneBz0wc7f8JG8hCes ZFGRDtTiY23AOaPMBLGhclEkgVq9a6jRWybS6ifAcS5zVILu4z8sTe6yRQ1NBLc4X5kd ChOT2q9Ejm0c5Q+PIMOI0aU4dmCpirh21kJ8QfB4o/BNY9KZDkmTeHnX31iB2qWhNq3X ogXhOIf66dpbUi43MthCn9I8jHnPKBSd0LrjOtMddzyAEIfHiY9YqzpGIbSL1eIxJXsk bFPdNPplO5l27W/HkcZyO/E2CwDx2r2iGFFSCN4AAsdc2QmI6BtgK5XiDguINorwwfB+ CyhQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fUpYQ6ex88BMNr2svf1+Z2FkXFe0JdZ2bAmNe8NtOk8=; b=ZcdaFGJVvK8h1JHyBtJpfNag4LGJ3dKxcW2oNUAG4Tzb46NtaoyMYs8e+0zCYMWeKv VvS+/fB3izUHKm3/6yXjTNCY+kZ0nOxaB+yAzUY5e5yFpWTesx3RN9w2NuuVc0Dzq290 CWFJii/8h3isUfMqPlxQQg2yMXG1YgA35J0C1BTr60QbkVKQSBkKQjqJc7bKBH+ZU0Xs Urs9DZ0cSIa5tO5vViaDjBz0cw001GeyAde29+UddsJFx4VYt8D71uj8GZ+XAWUyIAuf bFhPscN3oIdJbZRwYp5+QAqVemjbx0YSZK1YepRezzYnrCGkmWo/grVq8SEm5IR7J7SP xIig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fi3pVomq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p24si4560815edr.355.2021.09.16.13.29.51; Thu, 16 Sep 2021 13:30:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fi3pVomq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241281AbhIPQ2y (ORCPT + 99 others); Thu, 16 Sep 2021 12:28:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:53832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241275AbhIPQPZ (ORCPT ); Thu, 16 Sep 2021 12:15:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E211B6127B; Thu, 16 Sep 2021 16:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808691; bh=/0JtWiTJOi4JRW8g7IDSKPFVPSInRC6zR4wkgle/4Ro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fi3pVomqbQLMGgKMGCvOi4mT9YmQgCPCPOCh+ji0KUlR3UJWdYAqdUroI7oUEPxkD L9f+GqG4XS7HCa4Xr/6HQRWZX1VceLYEVCRO5LmjKaT56qS66eYC5FQZ/WmhKci7nA xgsO4FUAfsWNQ41x1axMRSkdRQlYTRUIM2OfC6Z0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carl Philipp Klemm , Merlijn Wajer , Pavel Machek , Sebastian Reichel , Vignesh Raghavendra , Tony Lindgren , Sasha Levin Subject: [PATCH 5.10 187/306] serial: 8250_omap: Handle optional overrun-throttle-ms property Date: Thu, 16 Sep 2021 17:58:52 +0200 Message-Id: <20210916155800.457449753@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tony Lindgren [ Upstream commit 1fe0e1fa3209ad8e9124147775bd27b1d9f04bd4 ] Handle optional overrun-throttle-ms property as done for 8250_fsl in commit 6d7f677a2afa ("serial: 8250: Rate limit serial port rx interrupts during input overruns"). This can be used to rate limit the UART interrupts on noisy lines that end up producing messages like the following: ttyS ttyS2: 4 input overrun(s) At least on droid4, the multiplexed USB and UART port is left to UART mode by the bootloader for a debug console, and if a USB charger is connected on boot, we get noise on the UART until the PMIC related drivers for PHY and charger are loaded. With this patch and overrun-throttle-ms = <500> we avoid the extra rx interrupts. Cc: Carl Philipp Klemm Cc: Merlijn Wajer Cc: Pavel Machek Cc: Sebastian Reichel Cc: Vignesh Raghavendra Signed-off-by: Tony Lindgren Link: https://lore.kernel.org/r/20210727103533.51547-2-tony@atomide.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_omap.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index c37468887fd2..efe4cf32add2 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -617,7 +617,7 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id) struct uart_port *port = dev_id; struct omap8250_priv *priv = port->private_data; struct uart_8250_port *up = up_to_u8250p(port); - unsigned int iir; + unsigned int iir, lsr; int ret; #ifdef CONFIG_SERIAL_8250_DMA @@ -628,6 +628,7 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id) #endif serial8250_rpm_get(up); + lsr = serial_port_in(port, UART_LSR); iir = serial_port_in(port, UART_IIR); ret = serial8250_handle_irq(port, iir); @@ -642,6 +643,24 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id) serial_port_in(port, UART_RX); } + /* Stop processing interrupts on input overrun */ + if ((lsr & UART_LSR_OE) && up->overrun_backoff_time_ms > 0) { + unsigned long delay; + + up->ier = port->serial_in(port, UART_IER); + if (up->ier & (UART_IER_RLSI | UART_IER_RDI)) { + port->ops->stop_rx(port); + } else { + /* Keep restarting the timer until + * the input overrun subsides. + */ + cancel_delayed_work(&up->overrun_backoff); + } + + delay = msecs_to_jiffies(up->overrun_backoff_time_ms); + schedule_delayed_work(&up->overrun_backoff, delay); + } + serial8250_rpm_put(up); return IRQ_RETVAL(ret); @@ -1353,6 +1372,10 @@ static int omap8250_probe(struct platform_device *pdev) } } + if (of_property_read_u32(np, "overrun-throttle-ms", + &up.overrun_backoff_time_ms) != 0) + up.overrun_backoff_time_ms = 0; + priv->wakeirq = irq_of_parse_and_map(np, 1); pdata = of_device_get_match_data(&pdev->dev); -- 2.30.2